Files
Ian Kibet 3f5f2fd11e
Some checks failed
Release / Release (push) Has been cancelled
Refactor code structure for improved readability and maintainability
2025-05-27 21:47:20 +03:00

6 lines
734 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import e from"url";import t from"util";import r from"tty";import n from"os";import i from"buffer";import s from"crypto";import o from"zlib";import a from"http";import c from"https";import l from"events";import u from"assert";import d from"querystring";import f from"fs";import p from"path";import h from"constants";import m from"stream";import y from"dns";import g from"net";import _ from"tls";import v from"string_decoder";var b="object"==typeof global&&global&&global.Object===Object&&global,w="object"==typeof self&&self&&self.Object===Object&&self,S=b||w||Function("return this")(),E=S.Symbol,k=Object.prototype,A=k.hasOwnProperty,O=k.toString,C=E?E.toStringTag:void 0;var T=Object.prototype.toString;var R="[object Null]",I="[object Undefined]",x=E?E.toStringTag:void 0;function j(e){return null==e?void 0===e?I:R:x&&x in Object(e)?function(e){var t=A.call(e,C),r=e[C];try{e[C]=void 0;var n=!0}catch(e){}var i=O.call(e);return n&&(t?e[C]=r:delete e[C]),i}(e):function(e){return T.call(e)}(e)}function P(e){return null!=e&&"object"==typeof e}var N="[object Symbol]";function $(e){return"symbol"==typeof e||P(e)&&j(e)==N}var M=Array.isArray,D=1/0,L=E?E.prototype:void 0,B=L?L.toString:void 0;function K(e){if("string"==typeof e)return e;if(M(e))return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(e,K)+"";if($(e))return B?B.call(e):"";var t=e+"";return"0"==t&&1/e==-D?"-0":t}var F=/\s/;var U=/^\s+/;function W(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&F.test(e.charAt(t)););return t}(e)+1).replace(U,""):e}function J(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var H=NaN,G=/^[-+]0x[0-9a-f]+$/i,z=/^0b[01]+$/i,V=/^0o[0-7]+$/i,q=parseInt;function X(e){if("number"==typeof e)return e;if($(e))return H;if(J(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=J(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=W(e);var r=z.test(e);return r||V.test(e)?q(e.slice(2),r?2:8):G.test(e)?H:+e}var Y="[object AsyncFunction]",Z="[object Function]",Q="[object GeneratorFunction]",ee="[object Proxy]";function te(e){if(!J(e))return!1;var t=j(e);return t==Z||t==Q||t==Y||t==ee}var re,ne=S["__core-js_shared__"],ie=(re=/[^.]+$/.exec(ne&&ne.keys&&ne.keys.IE_PROTO||""))?"Symbol(src)_1."+re:"";var se=Function.prototype.toString;function oe(e){if(null!=e){try{return se.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var ae=/^\[object .+?Constructor\]$/,ce=Function.prototype,le=Object.prototype,ue=ce.toString,de=le.hasOwnProperty,fe=RegExp("^"+ue.call(de).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function pe(e){return!(!J(e)||(t=e,ie&&ie in t))&&(te(e)?fe:ae).test(oe(e));var t}function he(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return pe(r)?r:void 0}var me=he(S,"WeakMap"),ye=Object.create,ge=function(){function e(){}return function(t){if(!J(t))return{};if(ye)return ye(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();var _e=function(){try{var e=he(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var ve=9007199254740991,be=/^(?:0|[1-9]\d*)$/;function we(e,t){var r=typeof e;return!!(t=null==t?ve:t)&&("number"==r||"symbol"!=r&&be.test(e))&&e>-1&&e%1==0&&e<t}function Se(e,t,r){"__proto__"==t&&_e?_e(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Ee(e,t){return e===t||e!=e&&t!=t}var ke=Object.prototype.hasOwnProperty;function Ae(e,t,r){var n=e[t];ke.call(e,t)&&Ee(n,r)&&(void 0!==r||t in e)||Se(e,t,r)}function Oe(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=n?n(r[a],e[a],a,r,e):void 0;void 0===c&&(c=e[a]),i?Se(r,a,c):Ae(r,a,c)}return r}var Ce=9007199254740991;function Te(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Ce}function Re(e){return null!=e&&Te(e.length)&&!te(e)}var Ie=Object.prototype;function xe(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ie)}function je(e){return P(e)&&"[object Arguments]"==j(e)}var Pe=Object.prototype,Ne=Pe.hasOwnProperty,$e=Pe.propertyIsEnumerable,Me=je(function(){return arguments}())?je:function(e){return P(e)&&Ne.call(e,"callee")&&!$e.call(e,"callee")};var De="object"==typeof exports&&exports&&!exports.nodeType&&exports,Le=De&&"object"==typeof module&&module&&!module.nodeType&&module,Be=Le&&Le.exports===De?S.Buffer:void 0,Ke=(Be?Be.isBuffer:void 0)||function(){return!1},Fe={};function Ue(e){return function(t){return e(t)}}Fe["[object Float32Array]"]=Fe["[object Float64Array]"]=Fe["[object Int8Array]"]=Fe["[object Int16Array]"]=Fe["[object Int32Array]"]=Fe["[object Uint8Array]"]=Fe["[object Uint8ClampedArray]"]=Fe["[object Uint16Array]"]=Fe["[object Uint32Array]"]=!0,Fe["[object Arguments]"]=Fe["[object Array]"]=Fe["[object ArrayBuffer]"]=Fe["[object Boolean]"]=Fe["[object DataView]"]=Fe["[object Date]"]=Fe["[object Error]"]=Fe["[object Function]"]=Fe["[object Map]"]=Fe["[object Number]"]=Fe["[object Object]"]=Fe["[object RegExp]"]=Fe["[object Set]"]=Fe["[object String]"]=Fe["[object WeakMap]"]=!1;var We="object"==typeof exports&&exports&&!exports.nodeType&&exports,Je=We&&"object"==typeof module&&module&&!module.nodeType&&module,He=Je&&Je.exports===We&&b.process,Ge=function(){try{var e=Je&&Je.require&&Je.require("util").types;return e||He&&He.binding&&He.binding("util")}catch(e){}}(),ze=Ge&&Ge.isTypedArray,Ve=ze?Ue(ze):function(e){return P(e)&&Te(e.length)&&!!Fe[j(e)]},qe=Object.prototype.hasOwnProperty;function Xe(e,t){var r=M(e),n=!r&&Me(e),i=!r&&!n&&Ke(e),s=!r&&!n&&!i&&Ve(e),o=r||n||i||s,a=o?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=a.length;for(var l in e)!t&&!qe.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||we(l,c))||a.push(l);return a}function Ye(e,t){return function(r){return e(t(r))}}var Ze=Ye(Object.keys,Object),Qe=Object.prototype.hasOwnProperty;function et(e){return Re(e)?Xe(e):function(e){if(!xe(e))return Ze(e);var t=[];for(var r in Object(e))Qe.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var tt=Object.prototype.hasOwnProperty;function rt(e){if(!J(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=xe(e),r=[];for(var n in e)("constructor"!=n||!t&&tt.call(e,n))&&r.push(n);return r}function nt(e){return Re(e)?Xe(e,!0):rt(e)}var it=he(Object,"create");var st=Object.prototype.hasOwnProperty;var ot=Object.prototype.hasOwnProperty;function at(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ct(e,t){for(var r=e.length;r--;)if(Ee(e[r][0],t))return r;return-1}at.prototype.clear=function(){this.__data__=it?it(null):{},this.size=0},at.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},at.prototype.get=function(e){var t=this.__data__;if(it){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return st.call(t,e)?t[e]:void 0},at.prototype.has=function(e){var t=this.__data__;return it?void 0!==t[e]:ot.call(t,e)},at.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=it&&void 0===t?"__lodash_hash_undefined__":t,this};var lt=Array.prototype.splice;function ut(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ut.prototype.clear=function(){this.__data__=[],this.size=0},ut.prototype.delete=function(e){var t=this.__data__,r=ct(t,e);return!(r<0)&&(r==t.length-1?t.pop():lt.call(t,r,1),--this.size,!0)},ut.prototype.get=function(e){var t=this.__data__,r=ct(t,e);return r<0?void 0:t[r][1]},ut.prototype.has=function(e){return ct(this.__data__,e)>-1},ut.prototype.set=function(e,t){var r=this.__data__,n=ct(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var dt=he(S,"Map");function ft(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function pt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ht(e){return null==e?"":K(e)}function mt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}pt.prototype.clear=function(){this.size=0,this.__data__={hash:new at,map:new(dt||ut),string:new at}},pt.prototype.delete=function(e){var t=ft(this,e).delete(e);return this.size-=t?1:0,t},pt.prototype.get=function(e){return ft(this,e).get(e)},pt.prototype.has=function(e){return ft(this,e).has(e)},pt.prototype.set=function(e,t){var r=ft(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};var yt=Ye(Object.getPrototypeOf,Object);function gt(e){var t=this.__data__=new ut(e);this.size=t.size}gt.prototype.clear=function(){this.__data__=new ut,this.size=0},gt.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},gt.prototype.get=function(e){return this.__data__.get(e)},gt.prototype.has=function(e){return this.__data__.has(e)},gt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ut){var n=r.__data__;if(!dt||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new pt(n)}return r.set(e,t),this.size=r.size,this};var _t="object"==typeof exports&&exports&&!exports.nodeType&&exports,vt=_t&&"object"==typeof module&&module&&!module.nodeType&&module,bt=vt&&vt.exports===_t?S.Buffer:void 0,wt=bt?bt.allocUnsafe:void 0;function St(){return[]}var Et=Object.prototype.propertyIsEnumerable,kt=Object.getOwnPropertySymbols,At=kt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}(kt(e),(function(t){return Et.call(e,t)})))}:St;var Ot=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)mt(t,At(e)),e=yt(e);return t}:St;function Ct(e,t,r){var n=t(e);return M(e)?n:mt(n,r(e))}function Tt(e){return Ct(e,et,At)}function Rt(e){return Ct(e,nt,Ot)}var It=he(S,"DataView"),xt=he(S,"Promise"),jt=he(S,"Set"),Pt="[object Map]",Nt="[object Promise]",$t="[object Set]",Mt="[object WeakMap]",Dt="[object DataView]",Lt=oe(It),Bt=oe(dt),Kt=oe(xt),Ft=oe(jt),Ut=oe(me),Wt=j;(It&&Wt(new It(new ArrayBuffer(1)))!=Dt||dt&&Wt(new dt)!=Pt||xt&&Wt(xt.resolve())!=Nt||jt&&Wt(new jt)!=$t||me&&Wt(new me)!=Mt)&&(Wt=function(e){var t=j(e),r="[object Object]"==t?e.constructor:void 0,n=r?oe(r):"";if(n)switch(n){case Lt:return Dt;case Bt:return Pt;case Kt:return Nt;case Ft:return $t;case Ut:return Mt}return t});var Jt=Wt,Ht=Object.prototype.hasOwnProperty;var Gt=S.Uint8Array;function zt(e){var t=new e.constructor(e.byteLength);return new Gt(t).set(new Gt(e)),t}var Vt=/\w*$/;var qt=E?E.prototype:void 0,Xt=qt?qt.valueOf:void 0;var Yt="[object Boolean]",Zt="[object Date]",Qt="[object Map]",er="[object Number]",tr="[object RegExp]",rr="[object Set]",nr="[object String]",ir="[object Symbol]",sr="[object ArrayBuffer]",or="[object DataView]",ar="[object Float32Array]",cr="[object Float64Array]",lr="[object Int8Array]",ur="[object Int16Array]",dr="[object Int32Array]",fr="[object Uint8Array]",pr="[object Uint8ClampedArray]",hr="[object Uint16Array]",mr="[object Uint32Array]";function yr(e,t,r){var n,i,s=e.constructor;switch(t){case sr:return zt(e);case Yt:case Zt:return new s(+e);case or:return function(e,t){var r=t?zt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case ar:case cr:case lr:case ur:case dr:case fr:case pr:case hr:case mr:return function(e,t){var r=t?zt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,r);case Qt:return new s;case er:case nr:return new s(e);case tr:return(i=new(n=e).constructor(n.source,Vt.exec(n))).lastIndex=n.lastIndex,i;case rr:return new s;case ir:return function(e){return Xt?Object(Xt.call(e)):{}}(e)}}var gr=Ge&&Ge.isMap,_r=gr?Ue(gr):function(e){return P(e)&&"[object Map]"==Jt(e)};var vr=Ge&&Ge.isSet,br=vr?Ue(vr):function(e){return P(e)&&"[object Set]"==Jt(e)},wr=1,Sr=2,Er=4,kr="[object Arguments]",Ar="[object Function]",Or="[object GeneratorFunction]",Cr="[object Object]",Tr={};function Rr(e,t,r,n,i,s){var o,a=t&wr,c=t&Sr,l=t&Er;if(r&&(o=i?r(e,n,i,s):r(e)),void 0!==o)return o;if(!J(e))return e;var u=M(e);if(u){if(o=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Ht.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!a)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(e,o)}else{var d=Jt(e),f=d==Ar||d==Or;if(Ke(e))return function(e,t){if(t)return e.slice();var r=e.length,n=wt?wt(r):new e.constructor(r);return e.copy(n),n}(e,a);if(d==Cr||d==kr||f&&!i){if(o=c||f?{}:function(e){return"function"!=typeof e.constructor||xe(e)?{}:ge(yt(e))}(e),!a)return c?function(e,t){return Oe(e,Ot(e),t)}(e,function(e,t){return e&&Oe(t,nt(t),e)}(o,e)):function(e,t){return Oe(e,At(e),t)}(e,function(e,t){return e&&Oe(t,et(t),e)}(o,e))}else{if(!Tr[d])return i?e:{};o=yr(e,d,a)}}s||(s=new gt);var p=s.get(e);if(p)return p;s.set(e,o),br(e)?e.forEach((function(n){o.add(Rr(n,t,r,n,e,s))})):_r(e)&&e.forEach((function(n,i){o.set(i,Rr(n,t,r,i,e,s))}));var h=u?void 0:(l?c?Rt:Tt:c?nt:et)(e);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(h||e,(function(n,i){h&&(n=e[i=n]),Ae(o,i,Rr(n,t,r,i,e,s))})),o}Tr[kr]=Tr["[object Array]"]=Tr["[object ArrayBuffer]"]=Tr["[object DataView]"]=Tr["[object Boolean]"]=Tr["[object Date]"]=Tr["[object Float32Array]"]=Tr["[object Float64Array]"]=Tr["[object Int8Array]"]=Tr["[object Int16Array]"]=Tr["[object Int32Array]"]=Tr["[object Map]"]=Tr["[object Number]"]=Tr[Cr]=Tr["[object RegExp]"]=Tr["[object Set]"]=Tr["[object String]"]=Tr["[object Symbol]"]=Tr["[object Uint8Array]"]=Tr["[object Uint8ClampedArray]"]=Tr["[object Uint16Array]"]=Tr["[object Uint32Array]"]=!0,Tr["[object Error]"]=Tr[Ar]=Tr["[object WeakMap]"]=!1;var Ir=4;var xr=(0).constructor;xr.isFinite,xr.isInteger,[].constructor.isArray;new(function(){function e(e){this.size=e,this.reset()}return e.prototype.reset=function(){this.oldestIndex=0,this.map={},this.cachedKeys=new Array(this.size)},e.prototype.get=function(e){return this.map[e]},e.prototype.set=function(e,t){this.map[e]=t;var r=this.cachedKeys[this.oldestIndex];void 0!==r&&delete this.map[r],this.cachedKeys[this.oldestIndex]=e,this.oldestIndex++,this.oldestIndex%=this.size},e}())(1e3);var jr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Pr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nr={exports:{}},$r=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}};!function(e,t){const r=$r;Nr.exports=class extends Error{constructor(e){super(e.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:r(e))).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}}(0,Nr.exports);var Mr=Nr.exports;const Dr=Mr;var Lr=function(e,...t){if(!e){if(1===t.length&&t[0]instanceof Error)throw t[0];throw new Dr(t)}};const Br=Lr,Kr={};var Fr=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const n=Array.isArray(t);Br(!n||!r.separator,"Separator option is not valid for array-based chain");const i=n?t:t.split(r.separator||".");let s=e;for(let e=0;e<i.length;++e){let n=i[e];const o=r.iterables&&Kr.iterables(s);if(Array.isArray(s)||"set"===o){const e=Number(n);Number.isInteger(e)&&(n=e<0?s.length+e:e)}if(!s||"function"==typeof s&&!1===r.functions||!o&&void 0===s[n]){Br(!r.strict||e+1===i.length,"Missing segment",n,"in reach path ",t),Br("object"==typeof s||!0===r.functions||"function"!=typeof s,"Invalid segment",n,"in reach path ",t),s=r.default;break}s=o?"set"===o?[...s][n]:s.get(n):s[n]}return s};Kr.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0};var Ur={exports:{}};!function(e,t){const r={};t=Ur.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},r.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(Buffer&&e instanceof Buffer)return t.buffer;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const n=Object.prototype.toString.call(e);return r.typeMap.get(n)||t.generic}}(0,Ur.exports);var Wr=Ur.exports,Jr={keys:function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}};const Hr=Fr,Gr=Wr,zr=Jr,Vr={needsProtoHack:new Set([Gr.set,Gr.map,Gr.weakSet,Gr.weakMap])};var qr=Vr.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let n=Vr.clone,i=r;if(t.shallow){if(!0!==t.shallow)return Vr.cloneWithShallow(e,t);n=e=>e}else if(i){const t=i.get(e);if(t)return t}else i=new Map;const s=Gr.getInternalProto(e);if(s===Gr.buffer)return Buffer&&Buffer.from(e);if(s===Gr.date)return new Date(e.getTime());if(s===Gr.regex)return new RegExp(e);const o=Vr.base(e,s,t);if(o===e)return e;if(i&&i.set(e,o),s===Gr.set)for(const r of e)o.add(n(r,t,i));else if(s===Gr.map)for(const[r,s]of e)o.set(r,n(s,t,i));const a=zr.keys(e,t);for(const r of a){if("__proto__"===r)continue;if(s===Gr.array&&"length"===r){o.length=e.length;continue}const a=Object.getOwnPropertyDescriptor(e,r);a?a.get||a.set?Object.defineProperty(o,r,a):a.enumerable?o[r]=n(e[r],t,i):Object.defineProperty(o,r,{enumerable:!1,writable:!0,configurable:!0,value:n(e[r],t,i)}):Object.defineProperty(o,r,{enumerable:!0,writable:!0,configurable:!0,value:n(e[r],t,i)})}return o};Vr.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const n=new Map;for(const t of r){const r=Hr(e,t);"object"!=typeof r&&"function"!=typeof r||n.set(r,r)}return Vr.clone(e,t,n)},Vr.base=function(e,t,r){if(!1===r.prototype)return Vr.needsProtoHack.has(t)?new t.constructor:t===Gr.array?[]:{};const n=Object.getPrototypeOf(e);if(n&&n.isImmutable)return e;if(t===Gr.array){const e=[];return n!==t&&Object.setPrototypeOf(e,n),e}if(Vr.needsProtoHack.has(t)){const e=new n.constructor;return n!==t&&Object.setPrototypeOf(e,n),e}return Object.create(n)};const Xr={};var Yr=function(e){if(!e)return"";let t="";for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);Xr.isSafe(n)?t+=e[r]:t+=Xr.escapeHtmlChar(n)}return t};Xr.escapeHtmlChar=function(e){const t=Xr.namedHtml.get(e);if(t)return t;if(e>=256)return"&#"+e+";";return`&#x${e.toString(16).padStart(2,"0")};`},Xr.isSafe=function(e){return Xr.safeCharCodes.has(e)},Xr.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),Xr.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}();var Zr={};!function(e){const t={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};e.Parser=class{constructor(e,r={}){if(!r[t.settings]&&r.constants)for(const e in r.constants){const t=r.constants[e];if(null!==t&&!["boolean","number","string"].includes(typeof t))throw new Error(`Formula constant ${e} contains invalid ${typeof t} value type`)}this.settings=r[t.settings]?r:Object.assign({[t.settings]:!0,constants:{},functions:{}},r),this.single=null,this._parts=null,this._parse(e)}_parse(r){let n=[],i="",s=0,o=!1;const a=r=>{if(s)throw new Error("Formula missing closing parenthesis");const a=n.length?n[n.length-1]:null;if(o||i||r){if(a&&"reference"===a.type&&")"===r)return a.type="function",a.value=this._subFormula(i,a.value),void(i="");if(")"===r){const t=new e.Parser(i,this.settings);n.push({type:"segment",value:t})}else if(o){if("]"===o)return n.push({type:"reference",value:i}),void(i="");n.push({type:"literal",value:i})}else if(t.operatorCharacters.includes(i))a&&"operator"===a.type&&t.operators.includes(a.value+i)?a.value+=i:n.push({type:"operator",value:i});else if(i.match(t.numberRx))n.push({type:"constant",value:parseFloat(i)});else if(void 0!==this.settings.constants[i])n.push({type:"constant",value:this.settings.constants[i]});else{if(!i.match(t.tokenRx))throw new Error(`Formula contains invalid token: ${i}`);n.push({type:"reference",value:i})}i=""}};for(const e of r)o?e===o?(a(),o=!1):i+=e:s?"("===e?(i+=e,++s):")"===e?(--s,s?i+=e:a(e)):i+=e:e in t.literals?o=t.literals[e]:"("===e?(a(),++s):t.operatorCharacters.includes(e)?(a(),i=e,a()):" "!==e?i+=e:a();a(),n=n.map(((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==n[t-1].type?e:{type:"operator",value:"n"}));let c=!1;for(const e of n){if("operator"===e.type){if(t.operatorsPrefix.includes(e.value))continue;if(!c)throw new Error("Formula contains an operator in invalid position");if(!t.operators.includes(e.value))throw new Error(`Formula contains an unknown operator ${e.value}`)}else if(c)throw new Error("Formula missing expected operator");c=!c}if(!c)throw new Error("Formula contains invalid trailing operator");1===n.length&&["reference","literal","constant"].includes(n[0].type)&&(this.single={type:"reference"===n[0].type?"reference":"value",value:n[0].value}),this._parts=n.map((e=>{if("operator"===e.type)return t.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error(`Formula contains invalid reference ${e.value}`);return this.settings.reference?this.settings.reference(e.value):t.reference(e.value)}))}_subFormula(r,n){const i=this.settings.functions[n];if("function"!=typeof i)throw new Error(`Formula contains unknown function ${n}`);let s=[];if(r){let e="",i=0,o=!1;const a=()=>{if(!e)throw new Error(`Formula contains function ${n} with invalid arguments ${r}`);s.push(e),e=""};for(let n=0;n<r.length;++n){const s=r[n];o?(e+=s,s===o&&(o=!1)):s in t.literals&&!i?(e+=s,o=t.literals[s]):","!==s||i?(e+=s,"("===s?++i:")"===s&&--i):a()}a()}return s=s.map((t=>new e.Parser(t,this.settings))),function(e){const t=[];for(const r of s)t.push(r.evaluate(e));return i.call(e,...t)}}evaluate(e){const r=this._parts.slice();for(let n=r.length-2;n>=0;--n){const i=r[n];if(i&&"operator"===i.type){const s=r[n+1];r.splice(n+1,1);const o=t.evaluate(s,e);r[n]=t.single(i.value,o)}}return t.operatorsOrder.forEach((n=>{for(let i=1;i<r.length-1;)if(n.includes(r[i])){const n=r[i],s=t.evaluate(r[i-1],e),o=t.evaluate(r[i+1],e);r.splice(i,2);const a=t.calculate(n,s,o);r[i-1]=0===a?0:a}else i+=2})),t.evaluate(r[0],e)}},e.Parser.prototype[t.symbol]=!0,t.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},t.evaluate=function(e,r){return null===e?null:"function"==typeof e?e(r):e[t.symbol]?e.evaluate(r):e},t.single=function(e,t){if("!"===e)return!t;const r=-t;return 0===r?0:r},t.calculate=function(e,r,n){if("??"===e)return t.exists(r)?r:n;if("string"==typeof r||"string"==typeof n){if("+"===e)return(r=t.exists(r)?r:"")+(n=t.exists(n)?n:"")}else switch(e){case"^":return Math.pow(r,n);case"*":return r*n;case"/":return r/n;case"%":return r%n;case"+":return r+n;case"-":return r-n}switch(e){case"<":return r<n;case"<=":return r<=n;case">":return r>n;case">=":return r>=n;case"==":return r===n;case"!=":return r!==n;case"&&":return r&&n;case"||":return r||n}return null},t.exists=function(e){return null!=e}}(Zr);const Qr=Wr,en={mismatched:null};var tn=function(e,t,r){return r=Object.assign({prototype:!0},r),!!en.isDeepEqual(e,t,r,[])};en.isDeepEqual=function(e,t,r,n){if(e===t)return 0!==e||1/e==1/t;const i=typeof e;if(i!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===i){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==i)return e!=e&&t!=t;const s=en.getSharedType(e,t,!!r.prototype);switch(s){case Qr.buffer:return Buffer&&Buffer.prototype.equals.call(e,t);case Qr.promise:return e===t;case Qr.regex:return e.toString()===t.toString();case en.mismatched:return!1}for(let r=n.length-1;r>=0;--r)if(n[r].isSame(e,t))return!0;n.push(new en.SeenEntry(e,t));try{return!!en.isDeepEqualObj(s,e,t,r,n)}finally{n.pop()}},en.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?en.mismatched:Qr.getInternalProto(e);const n=Qr.getInternalProto(e);return n!==Qr.getInternalProto(t)?en.mismatched:n},en.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},en.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},en.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},en.isDeepEqualObj=function(e,t,r,n,i){const{isDeepEqual:s,valueOf:o,hasOwnEnumerableProperty:a}=en,{keys:c,getOwnPropertySymbols:l}=Object;if(e===Qr.array){if(!n.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!s(t[e],r[e],n,i))return!1;return!0}for(const e of t)for(const t of r)if(s(e,t,n,i))return!0}else if(e===Qr.set){if(t.size!==r.size)return!1;if(!en.isSetSimpleEqual(t,r)){const e=new Set(Set.prototype.values.call(r));for(const r of Set.prototype.values.call(t)){if(e.delete(r))continue;let t=!1;for(const o of e)if(s(r,o,n,i)){e.delete(o),t=!0;break}if(!t)return!1}}}else if(e===Qr.map){if(t.size!==r.size)return!1;for(const[e,o]of Map.prototype.entries.call(t)){if(void 0===o&&!Map.prototype.has.call(r,e))return!1;if(!s(o,Map.prototype.get.call(r,e),n,i))return!1}}else if(e===Qr.error&&(t.name!==r.name||t.message!==r.message))return!1;const u=o(t),d=o(r);if((t!==u||r!==d)&&!s(u,d,n,i))return!1;const f=c(t);if(!n.part&&f.length!==c(r).length&&!n.skip)return!1;let p=0;for(const e of f)if(n.skip&&n.skip.includes(e))void 0===r[e]&&++p;else{if(!a(r,e))return!1;if(!s(t[e],r[e],n,i))return!1}if(!n.part&&f.length-p!==c(r).length)return!1;if(!1!==n.symbols){const e=l(t),o=new Set(l(r));for(const c of e){if(!n.skip||!n.skip.includes(c))if(a(t,c)){if(!a(r,c))return!1;if(!s(t[c],r[c],n,i))return!1}else if(a(r,c))return!1;o.delete(c)}for(const e of o)if(a(r,e))return!1}return!0},en.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}};var rn={location:function(e=0){const t=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const r={};Error.captureStackTrace(r,this);const n=r.stack[e+1];return Error.prepareStackTrace=t,{filename:n.getFileName(),line:n.getLineNumber()}}};const nn=Lr,sn=qr,on=Jr,an={};var cn=an.merge=function(e,t,r){if(nn(e&&"object"==typeof e,"Invalid target value: must be an object"),nn(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){nn(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let n=0;n<t.length;++n)e.push(sn(t[n],{symbols:r.symbols}));return e}const n=on.keys(t,r);for(let i=0;i<n.length;++i){const s=n[i];if("__proto__"===s||!Object.prototype.propertyIsEnumerable.call(t,s))continue;const o=t[s];if(o&&"object"==typeof o){if(e[s]===o)continue;!e[s]||"object"!=typeof e[s]||Array.isArray(e[s])!==Array.isArray(o)||o instanceof Date||Buffer&&Buffer.isBuffer(o)||o instanceof RegExp?e[s]=sn(o,{symbols:r.symbols}):an.merge(e[s],o,r)}else(null!=o||r.nullOverride)&&(e[s]=o)}return e},ln=function(){};const un=Lr,dn=qr,fn=cn,pn=Fr,hn={};var mn=function(e,t,r={}){if(un(e&&"object"==typeof e,"Invalid defaults value: must be an object"),un(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),un("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return hn.applyToDefaultsWithShallow(e,t,r);const n=dn(e);if(!0===t)return n;const i=void 0!==r.nullOverride&&r.nullOverride;return fn(n,t,{nullOverride:i,mergeArrays:!1})};hn.applyToDefaultsWithShallow=function(e,t,r){const n=r.shallow;un(Array.isArray(n),"Invalid keys");const i=new Map,s=!0===t?null:new Set;for(let r of n){r=Array.isArray(r)?r:r.split(".");const n=pn(e,r);n&&"object"==typeof n?i.set(n,s&&pn(t,r)||n):s&&s.add(r)}const o=dn(e,{},i);if(!s)return o;for(const e of s)hn.reachCopy(o,t,e);const a=void 0!==r.nullOverride&&r.nullOverride;return fn(o,t,{nullOverride:a,mergeArrays:!1})},hn.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const n=t;let i=e;for(let e=0;e<r.length-1;++e){const t=r[e];"object"!=typeof i[t]&&(i[t]={}),i=i[t]}i[r[r.length-1]]=n};var yn={};const gn=Lr,_n={};yn.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t||{}).before||[]),n=[].concat(t.after||[]),i=t.group||"?",s=t.sort||0;gn(!r.includes(i),`Item cannot come before itself: ${i}`),gn(!r.includes("?"),"Item cannot come before unassociated items"),gn(!n.includes(i),`Item cannot come after itself: ${i}`),gn(!n.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:s,before:r,after:n,group:i,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();gn(e,"item","?"!==i?`added into group ${i}`:"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(_n.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return gn(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return gn(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),r=Object.create(null);for(const n of this._items){const i=n.seq,s=n.group;r[s]=r[s]||[],r[s].push(i),e[i]=n.before;for(const e of n.after)t[e]=t[e]||[],t[e].push(i)}for(const t in e){const n=[];for(const i in e[t]){const s=e[t][i];r[s]=r[s]||[],n.push(...r[s])}e[t]=n}for(const n in t)if(r[n])for(const i of r[n])e[i].push(...t[n]);const n={};for(const t in e){const r=e[t];for(const e of r)n[e]=n[e]||[],n[e].push(t)}const i={},s=[];for(let e=0;e<this._items.length;++e){let t=e;if(n[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===i[e])continue;n[e]||(n[e]=[]);const r=n[e].length;let s=0;for(let t=0;t<r;++t)i[n[e][t]]&&++s;if(s===r){t=e;break}}}null!==t&&(i[t]=!0,s.push(t))}if(s.length!==this._items.length)return!1;const o={};for(const e of this._items)o[e.seq]=e;this._items=[],this.nodes=[];for(const e of s){const t=o[e];this.nodes.push(t.node),this._items.push(t)}return!0}},_n.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1;var vn={},bn={};!function(e){e.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},e.code=function(t){return{code:t,error:e.codes[t]}}}(bn),function(t){const r=bn,n={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:e.URL||URL};t.analyze=function(e,t={}){if(!e)return r.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return r.code("DOMAIN_TOO_LONG");if(!!n.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return r.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(n.domainControlRx.test(e))return r.code("DOMAIN_INVALID_CHARS");e=n.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const i=t.minDomainSegments||n.minDomainSegments,s=e.split(".");if(s.length<i)return r.code("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&s.length>t.maxDomainSegments)return r.code("DOMAIN_SEGMENTS_COUNT_MAX");const o=t.tlds;if(o){const e=s[s.length-1].toLowerCase();if(o.deny&&o.deny.has(e)||o.allow&&!o.allow.has(e))return r.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<s.length;++e){const t=s[e];if(!t.length)return r.code("DOMAIN_EMPTY_SEGMENT");if(t.length>63)return r.code("DOMAIN_LONG_SEGMENT");if(e<s.length-1){if(!n.domainSegmentRx.test(t))return r.code("DOMAIN_INVALID_CHARS")}else if(!n.tldSegmentRx.test(t))return r.code("DOMAIN_INVALID_TLDS_CHARS")}return null},t.isValid=function(e,r){return!t.analyze(e,r)},n.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new n.URL(`http://${e}`).host}catch(t){return e}}}(vn);var wn={};const Sn=vn,En=bn,kn={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(t.TextEncoder||TextEncoder)};wn.analyze=function(e,t){return kn.email(e,t)},wn.isValid=function(e,t){return!kn.email(e,t)},kn.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return En.code("EMPTY_STRING");const r=!kn.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return En.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const n=e.split("@");if(2!==n.length)return n.length>2?En.code("MULTIPLE_AT_CHAR"):En.code("MISSING_AT_CHAR");const[i,s]=n;if(!i)return En.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return En.code("ADDRESS_TOO_LONG");if(kn.encoder.encode(i).length>64)return En.code("LOCAL_TOO_LONG")}return kn.local(i,r)||Sn.analyze(s,t)},kn.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return En.code("EMPTY_LOCAL_SEGMENT");if(t){if(!kn.atextRx.test(e))return En.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(kn.atextRx.test(t))continue;const e=kn.binary(t);if(!kn.atomRx.test(e))return En.code("INVALID_LOCAL_CHARS")}}},kn.binary=function(e){return Array.from(kn.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")},kn.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,kn.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"));var An={},On={},Cn=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")};const Tn=Lr,Rn=Cn,In={generate:function(){const e={},t="\\dA-Fa-f",r="["+t+"]",n="\\w-\\.~",i="!\\$&'\\(\\)\\*\\+,;=",s="%"+t,o=n+s+i+":@",a="["+o+"]",c="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+c+"\\.){3}"+c;const l=r+"{1,4}",u="(?:"+l+":"+l+"|"+e.ipv4address+")",d="(?:"+l+":){6}"+u,f="::(?:"+l+":){5}"+u,p="(?:"+l+")?::(?:"+l+":){4}"+u,h="(?:(?:"+l+":){0,1}"+l+")?::(?:"+l+":){3}"+u,m="(?:(?:"+l+":){0,2}"+l+")?::(?:"+l+":){2}"+u,y="(?:(?:"+l+":){0,3}"+l+")?::"+l+":"+u,g="(?:(?:"+l+":){0,4}"+l+")?::"+u,_="(?:(?:"+l+":){0,5}"+l+")?::"+l,v="(?:(?:"+l+":){0,6}"+l+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+d+"|"+f+"|"+p+"|"+h+"|"+m+"|"+y+"|"+g+"|"+_+"|"+v+")",e.ipvFuture="v"+r+"+\\.["+n+i+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const b="["+n+s+i+":]*",w="["+n+s+i+"]{1,255}",S="(?:"+("\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]")+"|"+e.ipv4address+"|"+w+")",E="(?:"+b+"@)?"+S+"(?::\\d*)?",k="(?:"+b+"@)?("+S+")(?::\\d*)?",A=a+"*",O=a+"+",C="(?:\\/"+A+")*",T="\\/(?:"+O+C+")?",R=O+C,I="["+n+s+i+"@]+"+C,x="(?:\\/\\/\\/"+A+C+")";return e.hierPart="(?:(?:\\/\\/"+E+C+")|"+T+"|"+R+"|"+x+")",e.hierPartCapture="(?:(?:\\/\\/"+k+C+")|"+T+"|"+R+")",e.relativeRef="(?:(?:\\/\\/"+E+C+")|"+T+"|"+I+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+k+C+")|"+T+"|"+I+"|)",e.query="["+o+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+o+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+o+"\\/\\?]*",e}};In.rfc3986=In.generate(),On.ip={v4Cidr:In.rfc3986.ipv4Cidr,v6Cidr:In.rfc3986.ipv6Cidr,ipv4:In.rfc3986.ipv4address,ipv6:In.rfc3986.ipv6address,ipvfuture:In.rfc3986.ipvFuture},In.createRegex=function(e){const t=In.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",n=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return In.wrap(n+r);let i="";if(e.scheme){Tn(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);Tn(r.length>=1,"scheme must have at least 1 scheme specified");const n=[];for(let e=0;e<r.length;++e){const i=r[e];Tn(i instanceof RegExp||"string"==typeof i,"scheme at position "+e+" must be a RegExp or String"),i instanceof RegExp?n.push(i.source.toString()):(Tn(t.schemeRegex.test(i),"scheme at position "+e+" must be a valid scheme"),n.push(Rn(i)))}i=n.join("|")}const s="(?:"+(i?"(?:"+i+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",o=e.allowRelative?"(?:"+s+"|"+n+")":s;return In.wrap(o+r,i)},In.wrap=function(e,t){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}},In.uriRegex=In.createRegex({}),On.regex=function(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?In.createRegex(e):In.uriRegex};const xn=Lr,jn=On;An.regex=function(e={}){xn(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";xn(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),xn(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),xn(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<r.length;++e)xn("string"==typeof r[e],"options.version must only contain strings"),r[e]=r[e].toLowerCase(),xn(["ipv4","ipv6","ipvfuture"].includes(r[e]),"options.version contains unknown version "+r[e]+" - must be one of ipv4, ipv6, ipvfuture");r=Array.from(new Set(r));const n=r.map((e=>{if("forbidden"===t)return jn.ip[e];const r=`\\/${"ipv4"===e?jn.ip.v4Cidr:jn.ip.v6Cidr}`;return"required"===t?`${jn.ip[e]}${r}`:`${jn.ip[e]}(?:${r})?`})),i=`(?:${n.join("|")})`,s=new RegExp(`^${i}$`);return{cidr:t,versions:r,regex:s,raw:i}};const Pn={tlds:["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"]};var Nn,$n,Mn,Dn,Ln,Bn=new Set(Pn.tlds.map((e=>e.toLowerCase()))),Kn={exports:{}},Fn={exports:{}};function Un(){if($n)return Nn;$n=1;var e=1e3,t=60*e,r=60*t,n=24*r,i=7*n,s=365.25*n;function o(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}return Nn=function(a,c){c=c||{};var l=typeof a;if("string"===l&&a.length>0)return function(o){if(o=String(o),o.length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===l&&isFinite(a))return c.long?function(i){var s=Math.abs(i);if(s>=n)return o(i,s,n,"day");if(s>=r)return o(i,s,r,"hour");if(s>=t)return o(i,s,t,"minute");if(s>=e)return o(i,s,e,"second");return i+" ms"}(a):function(i){var s=Math.abs(i);if(s>=n)return Math.round(i/n)+"d";if(s>=r)return Math.round(i/r)+"h";if(s>=t)return Math.round(i/t)+"m";if(s>=e)return Math.round(i/e)+"s";return i+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))},Nn}function Wn(){if(Dn)return Mn;return Dn=1,Mn=function(e){function t(e){let n,i,s,o=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),s=i-(n||i);r.diff=s,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";o++;const s=t.formatters[i];if("function"==typeof s){const t=e[o];n=s.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Un(),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},Mn}var Jn,Hn,Gn,zn,Vn,qn={exports:{}};function Xn(){return Hn?Jn:(Hn=1,Jn=(e,t=process.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return-1!==n&&(-1===i||n<i)})}"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Kn.exports=(Ln||(Ln=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Wn()(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Fn,Fn.exports)),Fn.exports):Kn.exports=(Vn||(Vn=1,function(e,i){const s=r,o=t;i.init=function(e){e.inspectOpts={};const t=Object.keys(i.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=i.inspectOpts[t[r]]},i.log=function(...e){return process.stderr.write(o.formatWithOptions(i.inspectOpts,...e)+"\n")},i.formatArgs=function(t){const{namespace:r,useColors:n}=this;if(n){const n=this.color,i="[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${r} `;t[0]=s+t[0].split("\n").join("\n"+s),t.push(i+"m+"+e.exports.humanize(this.diff)+"")}else t[0]=(i.inspectOpts.hideDate?"":(new Date).toISOString()+" ")+r+" "+t[0]},i.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},i.load=function(){return process.env.DEBUG},i.useColors=function(){return"colors"in i.inspectOpts?Boolean(i.inspectOpts.colors):s.isatty(process.stderr.fd)},i.destroy=o.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),i.colors=[6,2,3,4,5,1];try{const e=function(){if(zn)return Gn;zn=1;const e=n,t=r,i=Xn(),{env:s}=process;let o;function a(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function c(t,r){if(0===o)return 0;if(i("color=16m")||i("color=full")||i("color=truecolor"))return 3;if(i("color=256"))return 2;if(t&&!r&&void 0===o)return 0;const n=o||0;if("dumb"===s.TERM)return n;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in s)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in s))||"codeship"===s.CI_NAME?1:n;if("TEAMCITY_VERSION"in s)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0;if("truecolor"===s.COLORTERM)return 3;if("TERM_PROGRAM"in s){const e=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(s.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)||"COLORTERM"in s?1:n}return i("no-color")||i("no-colors")||i("color=false")||i("color=never")?o=0:(i("color")||i("colors")||i("color=true")||i("color=always"))&&(o=1),"FORCE_COLOR"in s&&(o="true"===s.FORCE_COLOR?1:"false"===s.FORCE_COLOR?0:0===s.FORCE_COLOR.length?1:Math.min(parseInt(s.FORCE_COLOR,10),3)),Gn={supportsColor:function(e){return a(c(e,e&&e.isTTY))},stdout:a(c(!0,t.isatty(1))),stderr:a(c(!0,t.isatty(2)))},Gn}();e&&(e.stderr||e).level>=2&&(i.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}i.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),e.exports=Wn()(i);const{formatters:a}=e.exports;a.o=function(e){return this.inspectOpts.colors=this.useColors,o.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},a.O=function(e){return this.inspectOpts.colors=this.useColors,o.inspect(e,this.inspectOpts)}}(qn,qn.exports)),qn.exports);var Yn,Zn,Qn=Kn.exports;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Yn||(Yn={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Zn||(Zn={}));const ei=Yn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ti=e=>{switch(typeof e){case"undefined":return ei.undefined;case"string":return ei.string;case"number":return isNaN(e)?ei.nan:ei.number;case"boolean":return ei.boolean;case"function":return ei.function;case"bigint":return ei.bigint;case"symbol":return ei.symbol;case"object":return Array.isArray(e)?ei.array:null===e?ei.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ei.promise:"undefined"!=typeof Map&&e instanceof Map?ei.map:"undefined"!=typeof Set&&e instanceof Set?ei.set:"undefined"!=typeof Date&&e instanceof Date?ei.date:ei.object;default:return ei.unknown}},ri=Yn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ni extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){const r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof ni))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Yn.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}ni.create=e=>new ni(e);const ii=(e,t)=>{let r;switch(e.code){case ri.invalid_type:r=e.received===ei.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ri.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Yn.jsonStringifyReplacer)}`;break;case ri.unrecognized_keys:r=`Unrecognized key(s) in object: ${Yn.joinValues(e.keys,", ")}`;break;case ri.invalid_union:r="Invalid input";break;case ri.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Yn.joinValues(e.options)}`;break;case ri.invalid_enum_value:r=`Invalid enum value. Expected ${Yn.joinValues(e.options)}, received '${e.received}'`;break;case ri.invalid_arguments:r="Invalid function arguments";break;case ri.invalid_return_type:r="Invalid function return type";break;case ri.invalid_date:r="Invalid date";break;case ri.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Yn.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ri.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ri.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ri.custom:r="Invalid input";break;case ri.invalid_intersection_types:r="Intersection results could not be merged";break;case ri.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ri.not_finite:r="Number must be finite";break;default:r=t.defaultError,Yn.assertNever(e)}return{message:r}};let si=ii;function oi(){return si}const ai=e=>{const{data:t,path:r,errorMaps:n,issueData:i}=e,s=[...r,...i.path||[]],o={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let a="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)a=e(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function ci(e,t){const r=oi(),n=ai({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ii?void 0:ii].filter((e=>!!e))});e.common.issues.push(n)}class li{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return ui;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return li.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:i}=n;if("aborted"===t.status)return ui;if("aborted"===i.status)return ui;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!n.alwaysSet||(r[t.value]=i.value)}return{status:e.value,value:r}}}const ui=Object.freeze({status:"aborted"}),di=e=>({status:"dirty",value:e}),fi=e=>({status:"valid",value:e}),pi=e=>"aborted"===e.status,hi=e=>"dirty"===e.status,mi=e=>"valid"===e.status,yi=e=>"undefined"!=typeof Promise&&e instanceof Promise;function gi(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function _i(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}var vi,bi,wi;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(vi||(vi={}));class Si{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ei=(e,t)=>{if(mi(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ni(e.common.issues);return this._error=t,this._error}}};function ki(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var s,o;const{message:a}=e;return"invalid_enum_value"===t.code?{message:null!=a?a:i.defaultError}:void 0===i.data?{message:null!==(s=null!=a?a:n)&&void 0!==s?s:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=a?a:r)&&void 0!==o?o:i.defaultError}},description:i}}class Ai{get description(){return this._def.description}_getType(e){return ti(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ti(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new li,ctx:{common:e.parent.common,data:e.data,parsedType:ti(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(yi(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ti(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Ei(n,i)}"~validate"(e){var t,r;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ti(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:n});return mi(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then((e=>mi(e)?{value:e.value}:{issues:n.common.issues}))}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ti(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(yi(n)?n:Promise.resolve(n));return Ei(r,i)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),s=()=>n.addIssue({code:ri.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(s(),!1))):!!i||(s(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Os({schema:this,typeName:Ls.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Cs.create(this,this._def)}nullable(){return Ts.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return as.create(this)}promise(){return As.create(this,this._def)}or(e){return us.create([this,e],this._def)}and(e){return hs.create(this,e,this._def)}transform(e){return new Os({...ki(this._def),schema:this,typeName:Ls.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Rs({...ki(this._def),innerType:this,defaultValue:t,typeName:Ls.ZodDefault})}brand(){return new Ps({typeName:Ls.ZodBranded,type:this,...ki(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Is({...ki(this._def),innerType:this,catchValue:t,typeName:Ls.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ns.create(this,e)}readonly(){return $s.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Oi=/^c[^\s-]{8,}$/i,Ci=/^[0-9a-z]+$/,Ti=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ri=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ii=/^[a-z0-9_-]{21}$/i,xi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ji=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Pi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Ni;const $i=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mi=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Di=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Li=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ki=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fi="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ui=new RegExp(`^${Fi}$`);function Wi(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function Ji(e){let t=`${Fi}T${Wi(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Hi(e,t){return!("v4"!==t&&t||!$i.test(e))||!("v6"!==t&&t||!Di.test(e))}function Gi(e,t){if(!xi.test(e))return!1;try{const[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return"object"==typeof i&&null!==i&&(!(!i.typ||!i.alg)&&(!t||i.alg===t))}catch(e){return!1}}function zi(e,t){return!("v4"!==t&&t||!Mi.test(e))||!("v6"!==t&&t||!Li.test(e))}class Vi extends Ai{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==ei.string){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.string,received:t.parsedType}),ui}const t=new li;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const i=e.data.length>n.value,s=e.data.length<n.value;(i||s)&&(r=this._getOrReturnCtx(e,r),i?ci(r,{code:ri.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):s&&ci(r,{code:ri.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)Pi.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"email",code:ri.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)Ni||(Ni=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ni.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"emoji",code:ri.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)Ri.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"uuid",code:ri.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)Ii.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"nanoid",code:ri.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)Oi.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"cuid",code:ri.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)Ci.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"cuid2",code:ri.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)Ti.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"ulid",code:ri.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch(i){r=this._getOrReturnCtx(e,r),ci(r,{validation:"url",code:ri.invalid_string,message:n.message}),t.dirty()}else if("regex"===n.kind){n.regex.lastIndex=0;n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"regex",code:ri.invalid_string,message:n.message}),t.dirty())}else if("trim"===n.kind)e.data=e.data.trim();else if("includes"===n.kind)e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty());else if("toLowerCase"===n.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===n.kind)e.data=e.data.toUpperCase();else if("startsWith"===n.kind)e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty());else if("endsWith"===n.kind)e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty());else if("datetime"===n.kind){Ji(n).test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.invalid_string,validation:"datetime",message:n.message}),t.dirty())}else if("date"===n.kind){Ui.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.invalid_string,validation:"date",message:n.message}),t.dirty())}else if("time"===n.kind){new RegExp(`^${Wi(n)}$`).test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.invalid_string,validation:"time",message:n.message}),t.dirty())}else"duration"===n.kind?ji.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"duration",code:ri.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?Hi(e.data,n.version)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"ip",code:ri.invalid_string,message:n.message}),t.dirty()):"jwt"===n.kind?Gi(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"jwt",code:ri.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?zi(e.data,n.version)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"cidr",code:ri.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?Bi.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"base64",code:ri.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?Ki.test(e.data)||(r=this._getOrReturnCtx(e,r),ci(r,{validation:"base64url",code:ri.invalid_string,message:n.message}),t.dirty()):Yn.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:ri.invalid_string,...vi.errToObj(r)})}_addCheck(e){return new Vi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...vi.errToObj(e)})}url(e){return this._addCheck({kind:"url",...vi.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...vi.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...vi.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...vi.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...vi.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...vi.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...vi.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...vi.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...vi.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...vi.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...vi.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...vi.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...vi.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...vi.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...vi.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...vi.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...vi.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...vi.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...vi.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...vi.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...vi.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...vi.errToObj(t)})}nonempty(e){return this.min(1,vi.errToObj(e))}trim(){return new Vi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Vi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Vi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function qi(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Vi.create=e=>{var t;return new Vi({checks:[],typeName:Ls.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...ki(e)})};class Xi extends Ai{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ei.number){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.number,received:t.parsedType}),ui}let t;const r=new li;for(const n of this._def.checks)if("int"===n.kind)Yn.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ci(t,{code:ri.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),ci(t,{code:ri.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),ci(t,{code:ri.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else"multipleOf"===n.kind?0!==qi(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),ci(t,{code:ri.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ci(t,{code:ri.not_finite,message:n.message}),r.dirty()):Yn.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,vi.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vi.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vi.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vi.toString(t))}setLimit(e,t,r,n){return new Xi({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:vi.toString(n)}]})}_addCheck(e){return new Xi({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:vi.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:vi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:vi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:vi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:vi.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vi.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:vi.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:vi.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:vi.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Yn.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Xi.create=e=>new Xi({checks:[],typeName:Ls.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...ki(e)});class Yi extends Ai{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==ei.bigint)return this._getInvalidInput(e);let t;const r=new li;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),ci(t,{code:ri.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),ci(t,{code:ri.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ci(t,{code:ri.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Yn.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.bigint,received:t.parsedType}),ui}gte(e,t){return this.setLimit("min",e,!0,vi.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vi.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vi.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vi.toString(t))}setLimit(e,t,r,n){return new Yi({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:vi.toString(n)}]})}_addCheck(e){return new Yi({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:vi.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:vi.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:vi.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:vi.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vi.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Yi.create=e=>{var t;return new Yi({checks:[],typeName:Ls.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...ki(e)})};class Zi extends Ai{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ei.boolean){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.boolean,received:t.parsedType}),ui}return fi(e.data)}}Zi.create=e=>new Zi({typeName:Ls.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...ki(e)});class Qi extends Ai{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ei.date){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.date,received:t.parsedType}),ui}if(isNaN(e.data.getTime())){return ci(this._getOrReturnCtx(e),{code:ri.invalid_date}),ui}const t=new li;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),ci(r,{code:ri.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):Yn.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qi({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:vi.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:vi.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Qi.create=e=>new Qi({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ls.ZodDate,...ki(e)});class es extends Ai{_parse(e){if(this._getType(e)!==ei.symbol){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.symbol,received:t.parsedType}),ui}return fi(e.data)}}es.create=e=>new es({typeName:Ls.ZodSymbol,...ki(e)});class ts extends Ai{_parse(e){if(this._getType(e)!==ei.undefined){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.undefined,received:t.parsedType}),ui}return fi(e.data)}}ts.create=e=>new ts({typeName:Ls.ZodUndefined,...ki(e)});class rs extends Ai{_parse(e){if(this._getType(e)!==ei.null){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.null,received:t.parsedType}),ui}return fi(e.data)}}rs.create=e=>new rs({typeName:Ls.ZodNull,...ki(e)});class ns extends Ai{constructor(){super(...arguments),this._any=!0}_parse(e){return fi(e.data)}}ns.create=e=>new ns({typeName:Ls.ZodAny,...ki(e)});class is extends Ai{constructor(){super(...arguments),this._unknown=!0}_parse(e){return fi(e.data)}}is.create=e=>new is({typeName:Ls.ZodUnknown,...ki(e)});class ss extends Ai{_parse(e){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.never,received:t.parsedType}),ui}}ss.create=e=>new ss({typeName:Ls.ZodNever,...ki(e)});class os extends Ai{_parse(e){if(this._getType(e)!==ei.undefined){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.void,received:t.parsedType}),ui}return fi(e.data)}}os.create=e=>new os({typeName:Ls.ZodVoid,...ki(e)});class as extends Ai{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==ei.array)return ci(t,{code:ri.invalid_type,expected:ei.array,received:t.parsedType}),ui;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(ci(t,{code:e?ri.too_big:ri.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(ci(t,{code:ri.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(ci(t,{code:ri.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new Si(t,e,t.path,r))))).then((e=>li.mergeArray(r,e)));const i=[...t.data].map(((e,r)=>n.type._parseSync(new Si(t,e,t.path,r))));return li.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new as({...this._def,minLength:{value:e,message:vi.toString(t)}})}max(e,t){return new as({...this._def,maxLength:{value:e,message:vi.toString(t)}})}length(e,t){return new as({...this._def,exactLength:{value:e,message:vi.toString(t)}})}nonempty(e){return this.min(1,e)}}function cs(e){if(e instanceof ls){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Cs.create(cs(n))}return new ls({...e._def,shape:()=>t})}return e instanceof as?new as({...e._def,type:cs(e.element)}):e instanceof Cs?Cs.create(cs(e.unwrap())):e instanceof Ts?Ts.create(cs(e.unwrap())):e instanceof ms?ms.create(e.items.map((e=>cs(e)))):e}as.create=(e,t)=>new as({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ls.ZodArray,...ki(t)});class ls extends Ai{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Yn.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ei.object){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.object,received:t.parsedType}),ui}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof ss&&"strip"===this._def.unknownKeys))for(const e in r.data)i.includes(e)||s.push(e);const o=[];for(const e of i){const t=n[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new Si(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ss){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)s.length>0&&(ci(r,{code:ri.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new Si(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>li.mergeObjectSync(t,e))):li.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return vi.errToObj,new ls({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,s,o;const a=null!==(s=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,t,r).message)&&void 0!==s?s:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=vi.errToObj(e).message)&&void 0!==o?o:a}:{message:a}}}:{}})}strip(){return new ls({...this._def,unknownKeys:"strip"})}passthrough(){return new ls({...this._def,unknownKeys:"passthrough"})}extend(e){return new ls({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ls({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ls.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ls({...this._def,catchall:e})}pick(e){const t={};return Yn.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new ls({...this._def,shape:()=>t})}omit(e){const t={};return Yn.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new ls({...this._def,shape:()=>t})}deepPartial(){return cs(this)}partial(e){const t={};return Yn.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new ls({...this._def,shape:()=>t})}required(e){const t={};return Yn.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Cs;)e=e._def.innerType;t[r]=e}})),new ls({...this._def,shape:()=>t})}keyof(){return Ss(Yn.objectKeys(this.shape))}}ls.create=(e,t)=>new ls({shape:()=>e,unknownKeys:"strip",catchall:ss.create(),typeName:Ls.ZodObject,...ki(t)}),ls.strictCreate=(e,t)=>new ls({shape:()=>e,unknownKeys:"strict",catchall:ss.create(),typeName:Ls.ZodObject,...ki(t)}),ls.lazycreate=(e,t)=>new ls({shape:e,unknownKeys:"strip",catchall:ss.create(),typeName:Ls.ZodObject,...ki(t)});class us extends Ai{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new ni(e.ctx.common.issues)));return ci(t,{code:ri.invalid_union,unionErrors:r}),ui}));{let e;const n=[];for(const i of r){const r={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=n.map((e=>new ni(e)));return ci(t,{code:ri.invalid_union,unionErrors:i}),ui}}get options(){return this._def.options}}us.create=(e,t)=>new us({options:e,typeName:Ls.ZodUnion,...ki(t)});const ds=e=>e instanceof bs?ds(e.schema):e instanceof Os?ds(e.innerType()):e instanceof ws?[e.value]:e instanceof Es?e.options:e instanceof ks?Yn.objectValues(e.enum):e instanceof Rs?ds(e._def.innerType):e instanceof ts?[void 0]:e instanceof rs?[null]:e instanceof Cs?[void 0,...ds(e.unwrap())]:e instanceof Ts?[null,...ds(e.unwrap())]:e instanceof Ps||e instanceof $s?ds(e.unwrap()):e instanceof Is?ds(e._def.innerType):[];class fs extends Ai{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ei.object)return ci(t,{code:ri.invalid_type,expected:ei.object,received:t.parsedType}),ui;const r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ci(t,{code:ri.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ui)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=ds(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,r)}}return new fs({typeName:Ls.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...ki(r)})}}function ps(e,t){const r=ti(e),n=ti(t);if(e===t)return{valid:!0,data:e};if(r===ei.object&&n===ei.object){const r=Yn.objectKeys(t),n=Yn.objectKeys(e).filter((e=>-1!==r.indexOf(e))),i={...e,...t};for(const r of n){const n=ps(e[r],t[r]);if(!n.valid)return{valid:!1};i[r]=n.data}return{valid:!0,data:i}}if(r===ei.array&&n===ei.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const i=ps(e[n],t[n]);if(!i.valid)return{valid:!1};r.push(i.data)}return{valid:!0,data:r}}return r===ei.date&&n===ei.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class hs extends Ai{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(pi(e)||pi(n))return ui;const i=ps(e.value,n.value);return i.valid?((hi(e)||hi(n))&&t.dirty(),{status:t.value,value:i.data}):(ci(r,{code:ri.invalid_intersection_types}),ui)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}hs.create=(e,t,r)=>new hs({left:e,right:t,typeName:Ls.ZodIntersection,...ki(r)});class ms extends Ai{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ei.array)return ci(r,{code:ri.invalid_type,expected:ei.array,received:r.parsedType}),ui;if(r.data.length<this._def.items.length)return ci(r,{code:ri.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ui;!this._def.rest&&r.data.length>this._def.items.length&&(ci(r,{code:ri.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Si(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>li.mergeArray(t,e))):li.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ms({...this._def,rest:e})}}ms.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ms({items:e,typeName:Ls.ZodTuple,rest:null,...ki(t)})};class ys extends Ai{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ei.object)return ci(r,{code:ri.invalid_type,expected:ei.object,received:r.parsedType}),ui;const n=[],i=this._def.keyType,s=this._def.valueType;for(const e in r.data)n.push({key:i._parse(new Si(r,e,r.path,e)),value:s._parse(new Si(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?li.mergeObjectAsync(t,n):li.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new ys(t instanceof Ai?{keyType:e,valueType:t,typeName:Ls.ZodRecord,...ki(r)}:{keyType:Vi.create(),valueType:e,typeName:Ls.ZodRecord,...ki(t)})}}class gs extends Ai{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ei.map)return ci(r,{code:ri.invalid_type,expected:ei.map,received:r.parsedType}),ui;const n=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map((([e,t],s)=>({key:n._parse(new Si(r,e,r.path,[s,"key"])),value:i._parse(new Si(r,t,r.path,[s,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of s){const n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return ui;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of s){const n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return ui;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}gs.create=(e,t,r)=>new gs({valueType:t,keyType:e,typeName:Ls.ZodMap,...ki(r)});class _s extends Ai{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ei.set)return ci(r,{code:ri.invalid_type,expected:ei.set,received:r.parsedType}),ui;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(ci(r,{code:ri.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(ci(r,{code:ri.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function s(e){const r=new Set;for(const n of e){if("aborted"===n.status)return ui;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const o=[...r.data.values()].map(((e,t)=>i._parse(new Si(r,e,r.path,t))));return r.common.async?Promise.all(o).then((e=>s(e))):s(o)}min(e,t){return new _s({...this._def,minSize:{value:e,message:vi.toString(t)}})}max(e,t){return new _s({...this._def,maxSize:{value:e,message:vi.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_s.create=(e,t)=>new _s({valueType:e,minSize:null,maxSize:null,typeName:Ls.ZodSet,...ki(t)});class vs extends Ai{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ei.function)return ci(t,{code:ri.invalid_type,expected:ei.function,received:t.parsedType}),ui;function r(e,r){return ai({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oi(),ii].filter((e=>!!e)),issueData:{code:ri.invalid_arguments,argumentsError:r}})}function n(e,r){return ai({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oi(),ii].filter((e=>!!e)),issueData:{code:ri.invalid_return_type,returnTypeError:r}})}const i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof As){const e=this;return fi((async function(...t){const o=new ni([]),a=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(r(t,e)),o})),c=await Reflect.apply(s,this,a),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(n(c,e)),o}));return l}))}{const e=this;return fi((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new ni([r(t,o.error)]);const a=Reflect.apply(s,this,o.data),c=e._def.returns.safeParse(a,i);if(!c.success)throw new ni([n(a,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vs({...this._def,args:ms.create(e).rest(is.create())})}returns(e){return new vs({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new vs({args:e||ms.create([]).rest(is.create()),returns:t||is.create(),typeName:Ls.ZodFunction,...ki(r)})}}class bs extends Ai{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}bs.create=(e,t)=>new bs({getter:e,typeName:Ls.ZodLazy,...ki(t)});class ws extends Ai{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ci(t,{received:t.data,code:ri.invalid_literal,expected:this._def.value}),ui}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ss(e,t){return new Es({values:e,typeName:Ls.ZodEnum,...ki(t)})}ws.create=(e,t)=>new ws({value:e,typeName:Ls.ZodLiteral,...ki(t)});class Es extends Ai{constructor(){super(...arguments),bi.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return ci(t,{expected:Yn.joinValues(r),received:t.parsedType,code:ri.invalid_type}),ui}if(gi(this,bi,"f")||_i(this,bi,new Set(this._def.values),"f"),!gi(this,bi,"f").has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return ci(t,{received:t.data,code:ri.invalid_enum_value,options:r}),ui}return fi(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Es.create(e,{...this._def,...t})}exclude(e,t=this._def){return Es.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}bi=new WeakMap,Es.create=Ss;class ks extends Ai{constructor(){super(...arguments),wi.set(this,void 0)}_parse(e){const t=Yn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ei.string&&r.parsedType!==ei.number){const e=Yn.objectValues(t);return ci(r,{expected:Yn.joinValues(e),received:r.parsedType,code:ri.invalid_type}),ui}if(gi(this,wi,"f")||_i(this,wi,new Set(Yn.getValidEnumValues(this._def.values)),"f"),!gi(this,wi,"f").has(e.data)){const e=Yn.objectValues(t);return ci(r,{received:r.data,code:ri.invalid_enum_value,options:e}),ui}return fi(e.data)}get enum(){return this._def.values}}wi=new WeakMap,ks.create=(e,t)=>new ks({values:e,typeName:Ls.ZodNativeEnum,...ki(t)});class As extends Ai{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ei.promise&&!1===t.common.async)return ci(t,{code:ri.invalid_type,expected:ei.promise,received:t.parsedType}),ui;const r=t.parsedType===ei.promise?t.data:Promise.resolve(t.data);return fi(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}As.create=(e,t)=>new As({type:e,typeName:Ls.ZodPromise,...ki(t)});class Os extends Ai{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ls.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{ci(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){const e=n.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return ui;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?ui:"dirty"===n.status||"dirty"===t.value?di(n.value):n}));{if("aborted"===t.value)return ui;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?ui:"dirty"===n.status||"dirty"===t.value?di(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?ui:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?ui:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!mi(e))return e;const s=n.transform(e.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>mi(e)?Promise.resolve(n.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Yn.assertNever(n)}}Os.create=(e,t,r)=>new Os({schema:e,typeName:Ls.ZodEffects,effect:t,...ki(r)}),Os.createWithPreprocess=(e,t,r)=>new Os({schema:t,effect:{type:"preprocess",transform:e},typeName:Ls.ZodEffects,...ki(r)});class Cs extends Ai{_parse(e){return this._getType(e)===ei.undefined?fi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Cs.create=(e,t)=>new Cs({innerType:e,typeName:Ls.ZodOptional,...ki(t)});class Ts extends Ai{_parse(e){return this._getType(e)===ei.null?fi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ts.create=(e,t)=>new Ts({innerType:e,typeName:Ls.ZodNullable,...ki(t)});class Rs extends Ai{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===ei.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Rs.create=(e,t)=>new Rs({innerType:e,typeName:Ls.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ki(t)});class Is extends Ai{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return yi(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ni(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new ni(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Is.create=(e,t)=>new Is({innerType:e,typeName:Ls.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ki(t)});class xs extends Ai{_parse(e){if(this._getType(e)!==ei.nan){const t=this._getOrReturnCtx(e);return ci(t,{code:ri.invalid_type,expected:ei.nan,received:t.parsedType}),ui}return{status:"valid",value:e.data}}}xs.create=e=>new xs({typeName:Ls.ZodNaN,...ki(e)});const js=Symbol("zod_brand");class Ps extends Ai{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ns extends Ai{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ui:"dirty"===e.status?(t.dirty(),di(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ui:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Ns({in:e,out:t,typeName:Ls.ZodPipeline})}}class $s extends Ai{_parse(e){const t=this._def.innerType._parse(e),r=e=>(mi(e)&&(e.value=Object.freeze(e.value)),e);return yi(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function Ms(e,t={},r){return e?ns.create().superRefine(((n,i)=>{var s,o;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,a=null===(o=null!==(s=e.fatal)&&void 0!==s?s:r)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:a})}})):ns.create()}$s.create=(e,t)=>new $s({innerType:e,typeName:Ls.ZodReadonly,...ki(t)});const Ds={object:ls.lazycreate};var Ls;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Ls||(Ls={}));const Bs=Vi.create,Ks=Xi.create,Fs=xs.create,Us=Yi.create,Ws=Zi.create,Js=Qi.create,Hs=es.create,Gs=ts.create,zs=rs.create,Vs=ns.create,qs=is.create,Xs=ss.create,Ys=os.create,Zs=as.create,Qs=ls.create,eo=ls.strictCreate,to=us.create,ro=fs.create,no=hs.create,io=ms.create,so=ys.create,oo=gs.create,ao=_s.create,co=vs.create,lo=bs.create,uo=ws.create,fo=Es.create,po=ks.create,ho=As.create,mo=Os.create,yo=Cs.create,go=Ts.create,_o=Os.createWithPreprocess,vo=Ns.create,bo={string:e=>Vi.create({...e,coerce:!0}),number:e=>Xi.create({...e,coerce:!0}),boolean:e=>Zi.create({...e,coerce:!0}),bigint:e=>Yi.create({...e,coerce:!0}),date:e=>Qi.create({...e,coerce:!0})},wo=ui;var So=Object.freeze({__proto__:null,defaultErrorMap:ii,setErrorMap:function(e){si=e},getErrorMap:oi,makeIssue:ai,EMPTY_PATH:[],addIssueToContext:ci,ParseStatus:li,INVALID:ui,DIRTY:di,OK:fi,isAborted:pi,isDirty:hi,isValid:mi,isAsync:yi,get util(){return Yn},get objectUtil(){return Zn},ZodParsedType:ei,getParsedType:ti,ZodType:Ai,datetimeRegex:Ji,ZodString:Vi,ZodNumber:Xi,ZodBigInt:Yi,ZodBoolean:Zi,ZodDate:Qi,ZodSymbol:es,ZodUndefined:ts,ZodNull:rs,ZodAny:ns,ZodUnknown:is,ZodNever:ss,ZodVoid:os,ZodArray:as,ZodObject:ls,ZodUnion:us,ZodDiscriminatedUnion:fs,ZodIntersection:hs,ZodTuple:ms,ZodRecord:ys,ZodMap:gs,ZodSet:_s,ZodFunction:vs,ZodLazy:bs,ZodLiteral:ws,ZodEnum:Es,ZodNativeEnum:ks,ZodPromise:As,ZodEffects:Os,ZodTransformer:Os,ZodOptional:Cs,ZodNullable:Ts,ZodDefault:Rs,ZodCatch:Is,ZodNaN:xs,BRAND:js,ZodBranded:Ps,ZodPipeline:Ns,ZodReadonly:$s,custom:Ms,Schema:Ai,ZodSchema:Ai,late:Ds,get ZodFirstPartyTypeKind(){return Ls},coerce:bo,any:Vs,array:Zs,bigint:Us,boolean:Ws,date:Js,discriminatedUnion:ro,effect:mo,enum:fo,function:co,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Ms((t=>t instanceof e),t),intersection:no,lazy:lo,literal:uo,map:oo,nan:Fs,nativeEnum:po,never:Xs,null:zs,nullable:go,number:Ks,object:Qs,oboolean:()=>Ws().optional(),onumber:()=>Ks().optional(),optional:yo,ostring:()=>Bs().optional(),pipeline:vo,preprocess:_o,promise:ho,record:so,set:ao,strictObject:eo,string:Bs,symbol:Hs,transformer:mo,tuple:io,undefined:Gs,union:to,unknown:qs,void:Ys,NEVER:wo,ZodIssueCode:ri,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ni}),Eo=["interface","display","layout","module","panel","theme"],ko=["hook","endpoint"],Ao=["operation"],Oo="directus:extension",Co=So.object({app:So.string(),api:So.string()}),To=So.object({request:So.optional(So.object({urls:So.array(So.string()),methods:So.array(So.union([So.literal("GET"),So.literal("POST"),So.literal("PATCH"),So.literal("PUT"),So.literal("DELETE")]))})),log:So.optional(So.object({})),sleep:So.optional(So.object({}))}),Ro=So.optional(So.object({enabled:So.boolean(),requestedScopes:To})),Io=So.union([So.object({type:So.enum(ko),name:So.string(),source:So.string()}),So.object({type:So.enum(Eo),name:So.string(),source:So.string()}),So.object({type:So.enum(Ao),name:So.string(),source:Co})]),xo=So.object({host:So.string(),hidden:So.boolean().optional()}),jo=So.object({type:So.enum(Eo),path:So.string(),source:So.string()}),Po=So.object({type:So.enum(ko),path:So.string(),source:So.string(),sandbox:Ro}),No=So.object({type:So.enum(Ao),path:Co,source:Co,sandbox:Ro}),$o=So.object({type:So.literal("bundle"),partial:So.boolean().optional(),path:Co,entries:So.array(Io)});So.array(Io);var Mo=xo.and(So.union([jo,Po,No,$o]));So.object({name:So.string(),version:So.string(),type:So.union([So.literal("module"),So.literal("commonjs")]).optional(),description:So.string().optional(),icon:So.string().optional(),dependencies:So.record(So.string()).optional(),devDependencies:So.record(So.string()).optional(),[Oo]:Mo});var Do,Lo={},Bo={},Ko={name:"joi",description:"Object schema validation",version:"17.13.1",repository:"git://github.com/hapijs/joi",main:"lib/index.js",types:"lib/index.d.ts",browser:"dist/joi-browser.min.js",files:["lib/**/*","dist/*"],keywords:["schema","validation"],dependencies:{"@hapi/hoek":"^9.3.0","@hapi/topo":"^5.1.0","@sideway/address":"^4.1.5","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},devDependencies:{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.1.3","@types/node":"^14.18.63",typescript:"4.3.x"},scripts:{prepublishOnly:"cd browser && npm install && npm run build",test:"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},license:"BSD-3-Clause"},Fo={};function Uo(){if(Do)return Fo;Do=1;const e=vc(),t={};return t.wrap=e.string().min(1).max(2).allow(!1),Fo.preferences=e.object({allowUnknown:e.boolean(),abortEarly:e.boolean(),artifacts:e.boolean(),cache:e.boolean(),context:e.object(),convert:e.boolean(),dateFormat:e.valid("date","iso","string","time","utc"),debug:e.boolean(),errors:{escapeHtml:e.boolean(),label:e.valid("path","key",!1),language:[e.string(),e.object().ref()],render:e.boolean(),stack:e.boolean(),wrap:{label:t.wrap,array:t.wrap,string:t.wrap}},externals:e.boolean(),messages:e.object(),noDefaults:e.boolean(),nonEnumerables:e.boolean(),presence:e.valid("required","optional","forbidden"),skipFunctions:e.boolean(),stripUnknown:e.object({arrays:e.boolean(),objects:e.boolean()}).or("arrays","objects").allow(!0,!1),warnings:e.boolean()}).strict(),t.nameRx=/^[a-zA-Z0-9]\w*$/,t.rule=e.object({alias:e.array().items(e.string().pattern(t.nameRx)).single(),args:e.array().items(e.string(),e.object({name:e.string().pattern(t.nameRx).required(),ref:e.boolean(),assert:e.alternatives([e.function(),e.object().schema()]).conditional("ref",{is:!0,then:e.required()}),normalize:e.function(),message:e.string().when("assert",{is:e.function(),then:e.required()})})),convert:e.boolean(),manifest:e.boolean(),method:e.function().allow(!1),multi:e.boolean(),validate:e.function()}),Fo.extension=e.object({type:e.alternatives([e.string(),e.object().regex()]).required(),args:e.function(),cast:e.object().pattern(t.nameRx,e.object({from:e.function().maxArity(1).required(),to:e.function().minArity(1).maxArity(2).required()})),base:e.object().schema().when("type",{is:e.object().regex(),then:e.forbidden()}),coerce:[e.function().maxArity(3),e.object({method:e.function().maxArity(3).required(),from:e.array().items(e.string()).single()})],flags:e.object().pattern(t.nameRx,e.object({setter:e.string(),default:e.any()})),manifest:{build:e.function().arity(2)},messages:[e.object(),e.string()],modifiers:e.object().pattern(t.nameRx,e.function().minArity(1).maxArity(2)),overrides:e.object().pattern(t.nameRx,e.function()),prepare:e.function().maxArity(3),rebuild:e.function().arity(1),rules:e.object().pattern(t.nameRx,t.rule),terms:e.object().pattern(t.nameRx,e.object({init:e.array().allow(null).required(),manifest:e.object().pattern(/.+/,[e.valid("schema","single"),e.object({mapped:e.object({from:e.string().required(),to:e.string().required()}).required()})])})),validate:e.function().maxArity(3)}).strict(),Fo.extensions=e.array().items(e.object(),e.function().arity(1)).strict(),t.desc={buffer:e.object({buffer:e.string()}),func:e.object({function:e.function().required(),options:{literal:!0}}),override:e.object({override:!0}),ref:e.object({ref:e.object({type:e.valid("value","global","local"),path:e.array().required(),separator:e.string().length(1).allow(!1),ancestor:e.number().min(0).integer().allow("root"),map:e.array().items(e.array().length(2)).min(1),adjust:e.function(),iterables:e.boolean(),in:e.boolean(),render:e.boolean()}).required()}),regex:e.object({regex:e.string().min(3)}),special:e.object({special:e.valid("deep").required()}),template:e.object({template:e.string().required(),options:e.object()}),value:e.object({value:e.alternatives([e.object(),e.array()]).required()})},t.desc.entity=e.alternatives([e.array().items(e.link("...")),e.boolean(),e.function(),e.number(),e.string(),t.desc.buffer,t.desc.func,t.desc.ref,t.desc.regex,t.desc.special,t.desc.template,t.desc.value,e.link("/")]),t.desc.values=e.array().items(null,e.boolean(),e.function(),e.number().allow(1/0,-1/0),e.string().allow(""),e.symbol(),t.desc.buffer,t.desc.func,t.desc.override,t.desc.ref,t.desc.regex,t.desc.template,t.desc.value),t.desc.messages=e.object().pattern(/.+/,[e.string(),t.desc.template,e.object().pattern(/.+/,[e.string(),t.desc.template])]),Fo.description=e.object({type:e.string().required(),flags:e.object({cast:e.string(),default:e.any(),description:e.string(),empty:e.link("/"),failover:t.desc.entity,id:e.string(),label:e.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:e.boolean(),unit:e.string()}).unknown(),preferences:{allowUnknown:e.boolean(),abortEarly:e.boolean(),artifacts:e.boolean(),cache:e.boolean(),convert:e.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:e.boolean(),label:["path","key"],language:[e.string(),t.desc.ref],wrap:{label:t.wrap,array:t.wrap}},externals:e.boolean(),messages:t.desc.messages,noDefaults:e.boolean(),nonEnumerables:e.boolean(),presence:["required","optional","forbidden"],skipFunctions:e.boolean(),stripUnknown:e.object({arrays:e.boolean(),objects:e.boolean()}).or("arrays","objects").allow(!0,!1),warnings:e.boolean()},allow:t.desc.values,invalid:t.desc.values,rules:e.array().min(1).items({name:e.string().required(),args:e.object().min(1),keep:e.boolean(),message:[e.string(),t.desc.messages],warn:e.boolean()}),keys:e.object().pattern(/.*/,e.link("/")),link:t.desc.ref}).pattern(/^[a-z]\w*$/,e.any()),Fo}var Wo,Jo,Ho={},Go={exports:{}},zo={},Vo={};function qo(){if(Wo)return Vo;Wo=1;const e=qr,t=oa(),r={annotations:Symbol("annotations")};return Vo.error=function(n){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const i=n?"":"",s=n?"":"",o=n?"":"",a=e(this._original);for(let e=this.details.length-1;e>=0;--e){const n=e+1,i=this.details[e],s=i.path;let o=a;for(let e=0;;++e){const a=s[e];if(t.isSchema(o)&&(o=o.clone()),!(e+1<s.length&&"string"!=typeof o[a])){const e=o[r.annotations]||{errors:{},missing:{}};o[r.annotations]=e;const t=a||i.context.key;void 0!==o[a]?(e.errors[t]=e.errors[t]||[],e.errors[t].push(n)):e.missing[t]=n;break}o=o[a]}}const c=/_\$key\$_([, \d]+)_\$end\$_"/g,l=/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,u=/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,d=/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g;let f=r.safeStringify(a,2).replace(c,((e,t)=>`" ${i}[${t}]${o}`)).replace(l,((e,t,r)=>`${s}"${t}"${o}${i} [${r}]: -- missing --${o}`)).replace(u,((e,t,r)=>`\n${r} ${i}[${t}]${o}`)).replace(d,((e,t)=>t));f=`${f}\n${i}`;for(let e=0;e<this.details.length;++e){f=`${f}\n[${e+1}] ${this.details[e].message}`}return f+=o,f},r.safeStringify=function(e,t){return JSON.stringify(e,r.serializer(),t)},r.serializer=function(){const e=[],t=[],n=(r,n)=>t[0]===n?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(n)).join(".")+"]";return function(i,s){if(t.length>0){const r=t.indexOf(this);~r?(t.length=r+1,e.length=r+1,e[r]=i):(t.push(this),e.push(i)),~t.indexOf(s)&&(s=n.call(this,i,s))}else t.push(s);if(s){const e=s[r.annotations];if(e){if(Array.isArray(s)){const t=[];for(let r=0;r<s.length;++r)e.errors[r]&&t.push(`_$idx$_${e.errors[r].sort().join(", ")}_$end$_`),t.push(s[r]);s=t}else{for(const t in e.errors)s[`${t}_$key$_${e.errors[t].sort().join(", ")}_$end$_`]=s[t],s[t]=void 0;for(const t in e.missing)s[`_$miss$_${t}|${e.missing[t]}_$end$_`]="__missing__"}return s}}return s===1/0||s===-1/0||Number.isNaN(s)||"function"==typeof s||"symbol"==typeof s?"["+s.toString()+"]":s}},Vo}function Xo(){return Jo||(Jo=1,function(e){const t=qo(),r=oa(),n=ia();e.Report=class{constructor(t,r,n,i,s,o,a){if(this.code=t,this.flags=i,this.messages=s,this.path=o.path,this.prefs=a,this.state=o,this.value=r,this.message=null,this.template=null,this.local=n||{},this.local.label=e.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(t,r){return e.template(this.value,t,r||this.code,this.state,this.prefs)}},e.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},e.template=function(e,t,i,s,o){if(!t)return;if(n.isTemplate(t))return"root"!==i?t:null;let a=o.errors.language;if(r.isResolvable(a)&&(a=a.resolve(e,s,o)),a&&t[a]){if(void 0!==t[a][i])return t[a][i];if(void 0!==t[a]["*"])return t[a]["*"]}return t[i]?t[i]:t["*"]},e.label=function(t,r,n,i){if(!n.errors.label)return"";if(t.label)return t.label;let s=r.path;"key"===n.errors.label&&r.path.length>1&&(s=r.path.slice(-1));const o=e.path(s);return o||(e.template(null,n.messages,"root",r,n)||i&&e.template(null,i,"root",r,n)||"value")},e.process=function(t,r,n){if(!t)return null;const{override:i,message:s,details:o}=e.details(t);if(i)return i;if(n.errors.stack)return new e.ValidationError(s,o,r);const a=Error.stackTraceLimit;Error.stackTraceLimit=0;const c=new e.ValidationError(s,o,r);return Error.stackTraceLimit=a,c},e.details=function(e,t={}){let r=[];const n=[];for(const i of e){if(i instanceof Error){if(!1!==t.override)return{override:i};const e=i.toString();r.push(e),n.push({message:e,type:"override",context:{error:i}});continue}const e=i.toString();r.push(e),n.push({message:e,path:i.path.filter((e=>"object"!=typeof e)),type:i.code,context:i.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:n}},e.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(t){return t instanceof e.ValidationError}},e.ValidationError.prototype.isJoi=!0,e.ValidationError.prototype.name="ValidationError",e.ValidationError.prototype.annotate=t.error}(zo)),zo}var Yo,Zo,Qo,ea,ta,ra={};function na(){return Yo||(Yo=1,function(e){const t=Lr,r=qr,n=Fr,i=oa();let s;const o={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};e.create=function(e,r={}){t("string"==typeof e,"Invalid reference key:",e),i.assertOptions(r,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),t(!r.prefix||"object"==typeof r.prefix,"options.prefix must be of type object");const n=Object.assign({},o.defaults,r);delete n.prefix;const s=n.separator,a=o.context(e,s,r.prefix);if(n.type=a.type,e=a.key,"value"===n.type)if(a.root&&(t(!s||e[0]!==s,"Cannot specify relative path with root prefix"),n.ancestor="root",e||(e=null)),s&&s===e)e=null,n.ancestor=0;else if(void 0!==n.ancestor)t(!s||!e||e[0]!==s,"Cannot combine prefix with ancestor option");else{const[t,r]=o.ancestor(e,s);r&&""===(e=e.slice(r))&&(e=null),n.ancestor=t}return n.path=s?null===e?[]:e.split(s):[e],new o.Ref(n)},e.in=function(t,r={}){return e.create(t,{...r,in:!0})},e.isRef=function(e){return!!e&&!!e[i.symbols.ref]},o.Ref=class{constructor(e){t("object"==typeof e,"Invalid reference construction"),i.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),t([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),t(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),t(!e.map||Array.isArray(e.map),"options.map must be an array"),t(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,o.defaults,e),t("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,r,n,i,s={}){return t(!this.in||s.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(n.context,r,s):"local"===this.type?this._resolve(i,r,s):this.ancestor?"root"===this.ancestor?this._resolve(r.ancestors[r.ancestors.length-1],r,s):(t(this.ancestor<=r.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(r.ancestors[this.ancestor-1],r,s)):this._resolve(e,r,s)}_resolve(e,t,r){let i;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(i=t.mainstay.shadow.get(this.absolute(t))),void 0===i&&(i=n(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(i=this.adjust(i)),this.map){const e=this.map.get(i);void 0!==e&&(i=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,i),i}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new o.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},o.Ref.prototype[i.symbols.ref]=!0,e.build=function(e){return"value"===(e=Object.assign({},o.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new o.Ref(e)},o.context=function(e,t,r={}){if(e=e.trim(),r){const n=void 0===r.global?"$":r.global;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"global"};const i=void 0===r.local?"#":r.local;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"local"};const s=void 0===r.root?"/":r.root;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"value",root:!0}}return{key:e,type:"value"}},o.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},e.toSibling=0,e.toParent=1,e.Manager=class{constructor(){this.refs=[]}register(t,r){if(t)if(r=void 0===r?e.toParent:r,Array.isArray(t))for(const e of t)this.register(e,r);else if(i.isSchema(t))for(const e of t._refs.refs)e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root});else e.isRef(t)&&"value"===t.type&&t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root}),s=s||ia(),s.isTemplate(t)&&this.register(t.refs(),r)}get length(){return this.refs.length}clone(){const t=new e.Manager;return t.refs=r(this.refs),t}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}}(ra)),ra}function ia(){return Zo||(Zo=1,function(e,t){const r=Lr,n=qr,i=Yr,s=Zr,o=oa(),a=Xo(),c=na(),l={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=l.Template=class{constructor(e,t){if(r("string"==typeof e,"Template source must be a string"),r(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,t){const{functions:e,...i}=t;this._settings=Object.keys(i).length?n(i):void 0,this._functions=e,this._functions&&(r(Object.keys(this._functions).every((e=>"string"==typeof e)),"Functions keys must be strings"),r(Object.values(this._functions).every((e=>"function"==typeof e)),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const e=l.encode(this.source),t=l.split(e);let r=!1;const n=[],i=t.shift();i&&n.push(i);for(const e of t){const t="{"!==e[0],i=t?"}":"}}",s=e.indexOf(i);if(-1===s||"{"===e[1]){n.push(`{${l.decode(e)}`);continue}let o=e.slice(t?0:1,s);const a=":"===o[0];a&&(o=o.slice(1));const c=this._ref(l.decode(o),{raw:t,wrapped:a});n.push(c),"string"!=typeof c&&(r=!0);const u=e.slice(s+i.length);u&&n.push(l.decode(u))}r?this._template=n:this.rendered=n.join("")}static date(e,t){return l.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),this._functions&&(t.functions=this._functions),t}static build(e){return new l.Template(e.template,e.options||e.functions?{...e.options,functions:e.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[o.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,n){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,n,{}):this.render(e,t,r,n)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,r,n,s={}){if(!this.isDynamic())return this.rendered;const o=[];for(const a of this._template)if("string"==typeof a)o.push(a);else{const c=this._part(a,e,t,r,n,s),u=l.stringify(c,e,t,r,n,s);if(void 0!==u){const e=a.raw||!1===(s.errors&&s.errors.escapeHtml)?u:i(u);o.push(l.wrap(e,a.wrapped&&r.errors.wrap.label))}}return o.join("")}_ref(e,{raw:t,wrapped:r}){const n=[],i=e=>{const t=c.create(e,this._settings);return n.push(t),e=>{const r=t.resolve(...e);return void 0!==r?r:null}};try{const t=this._functions?{...l.functions,...this._functions}:l.functions;var o=new s.Parser(e,{reference:i,functions:t,constants:l.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(o.single){if("reference"===o.single.type){const e=n[0];return{ref:e,raw:t,refs:n,wrapped:r||"local"===e.type&&"label"===e.key}}return l.stringify(o.single.value)}return{formula:o,raw:t,refs:n}}toString(){return this.source}},l.Template.prototype[o.symbols.template]=!0,l.Template.prototype.isImmutable=!0,l.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>l.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>l.closes.slice(0,t.length)))},l.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},l.split=function(e){const t=[];let r="";for(let n=0;n<e.length;++n){const i=e[n];if("{"===i){let i="";for(;n+1<e.length&&"{"===e[n+1];)i+="{",++n;t.push(r),r=i}else r+=i}return t.push(r),t},l.wrap=function(e,t){return t?1===t.length?`${t}${e}${t}`:`${t[0]}${e}${t[1]}`:e},l.stringify=function(e,t,r,n,i,s={}){const o=typeof e,a=n&&n.errors&&n.errors.wrap||{};let u=!1;if(c.isRef(e)&&e.render&&(u=e.in,e=e.resolve(t,r,n,i,{in:e.in,...s})),null===e)return"null";if("string"===o)return l.wrap(e,s.arrayItems&&a.string);if("number"===o||"function"===o||"symbol"===o)return e.toString();if("object"!==o)return JSON.stringify(e);if(e instanceof Date)return l.Template.date(e,n);if(e instanceof Map){const t=[];for(const[r,n]of e.entries())t.push(`${r.toString()} -> ${n.toString()}`);e=t}if(!Array.isArray(e))return e.toString();const d=[];for(const o of e)d.push(l.stringify(o,t,r,n,i,{arrayItems:!0,...s}));return l.wrap(d.join(", "),!u&&a.array)},l.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},l.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,n,i,s]=this,o=s.messages;if(!o)return"";const c=a.template(t,o[0],e,r,n)||a.template(t,o[1],e,r,n);return c?c.render(t,r,n,i,s):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}}(Go)),Go.exports}function sa(){return Qo||(Qo=1,function(e){const t=Lr,r=qr,n=ia();e.compile=function(e,i){if("string"==typeof e)return t(!i,"Cannot set single message string"),new n(e);if(n.isTemplate(e))return t(!i,"Cannot set single message template"),e;t("object"==typeof e&&!Array.isArray(e),"Invalid message options"),i=i?r(i):{};for(let r in e){const s=e[r];if("root"===r||n.isTemplate(s)){i[r]=s;continue}if("string"==typeof s){i[r]=new n(s);continue}t("object"==typeof s&&!Array.isArray(s),"Invalid message for",r);const o=r;for(r in i[o]=i[o]||{},s){const e=s[r];"root"===r||n.isTemplate(e)?i[o][r]=e:(t("string"==typeof e,"Invalid message for",r,"in",o),i[o][r]=new n(e))}}return i},e.decompile=function(e){const t={};for(let r in e){const i=e[r];if("root"===r){t.root=i;continue}if(n.isTemplate(i)){t[r]=i.describe({compact:!0});continue}const s=r;for(r in t[s]={},i){const e=i[r];"root"!==r?t[s][r]=e.describe({compact:!0}):t[s].root=e}}return t},e.merge=function(i,s){if(!i)return e.compile(s);if(!s)return i;if("string"==typeof s)return new n(s);if(n.isTemplate(s))return s;const o=r(i);for(let e in s){const r=s[e];if("root"===e||n.isTemplate(r)){o[e]=r;continue}if("string"==typeof r){o[e]=new n(r);continue}t("object"==typeof r&&!Array.isArray(r),"Invalid message for",e);const i=e;for(e in o[i]=o[i]||{},r){const s=r[e];"root"===e||n.isTemplate(s)?o[i][e]=s:(t("string"==typeof s,"Invalid message for",e,"in",i),o[i][e]=new n(s))}}return o}}(Ho)),Ho}function oa(){return ea||(ea=1,function(e){const t=Lr,r=Mr,n=Ko;let i,s;const o={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};e.version=n.version,e.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},e.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},e.assertOptions=function(e,r,n="Options"){t(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const i=Object.keys(e).filter((e=>!r.includes(e)));t(0===i.length,`${n} contain unknown keys: ${i}`)},e.checkPreferences=function(e){s=s||Uo();const t=s.preferences.validate(e);if(t.error)throw new r([t.error.details[0].message])},e.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},e.default=function(e,t){return void 0===e?t:e},e.isIsoDate=function(e){return o.isoDate.test(e)},e.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},e.isResolvable=function(t){return!!t&&(t[e.symbols.ref]||t[e.symbols.template])},e.isSchema=function(r,n={}){const i=r&&r[e.symbols.any];return!!i&&(t(n.legacy||i.version===e.version,"Cannot mix different versions of joi schemas"),!0)},e.isValues=function(t){return t[e.symbols.values]},e.limit=function(e){return Number.isSafeInteger(e)&&e>=0},e.preferences=function(t,r){i=i||sa(),t=t||{},r=r||{};const n=Object.assign({},t,r);return r.errors&&t.errors&&(n.errors=Object.assign({},t.errors,r.errors),n.errors.wrap=Object.assign({},t.errors.wrap,r.errors.wrap)),r.messages&&(n.messages=i.compile(r.messages,t.messages)),delete n[e.symbols.prefs],n},e.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},e.validateArg=function(t,r,{assert:n,message:i}){if(e.isSchema(n)){const e=n.validate(t);if(!e.error)return;return e.error.message}if(!n(t))return r?`${r} ${i}`:i},e.verifyFlat=function(e,r){for(const n of e)t(!Array.isArray(n),"Method no longer accepts array arguments:",r)}}(Bo)),Bo}function aa(){if(ta)return Lo;ta=1;const e=Lr,t=qr,r=oa(),n={max:1e3,supported:new Set(["undefined","boolean","number","string"])};return Lo.provider={provision:e=>new n.Cache(e)},n.Cache=class{constructor(t={}){r.assertOptions(t,["max"]),e(void 0===t.max||t.max&&t.max>0&&isFinite(t.max),"Invalid max cache size"),this._max=t.max||n.max,this._map=new Map,this._list=new n.List}get length(){return this._map.size}set(e,t){if(null!==e&&!n.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const r=this._map.get(e);if(r)return this._list.first(r),t(r.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},n.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}},Lo}var ca,la={};function ua(){return ca||(ca=1,function(e){const t=Lr,r=oa(),n=na(),i={};e.schema=function(e,t,n={}){r.assertOptions(n,["appendPath","override"]);try{return i.schema(e,t,n)}catch(e){throw n.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},i.schema=function(e,n,s){t(void 0!==n,"Invalid undefined schema"),Array.isArray(n)&&(t(n.length,"Invalid empty array schema"),1===n.length&&(n=n[0]));const o=(t,...r)=>!1!==s.override?t.valid(e.override,...r):t.valid(...r);if(i.simple(n))return o(e,n);if("function"==typeof n)return e.custom(n);if(t("object"==typeof n,"Invalid schema content:",typeof n),r.isResolvable(n))return o(e,n);if(r.isSchema(n))return n;if(Array.isArray(n)){for(const t of n)if(!i.simple(t))return e.alternatives().try(...n);return o(e,...n)}return n instanceof RegExp?e.string().regex(n):n instanceof Date?o(e.date(),n):(t(Object.getPrototypeOf(n)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(n))},e.ref=function(e,t){return n.isRef(e)?e:n.create(e,t)},e.compile=function(n,s,o={}){r.assertOptions(o,["legacy"]);const a=s&&s[r.symbols.any];if(a)return t(o.legacy||a.version===r.version,"Cannot mix different versions of joi schemas:",a.version,r.version),s;if("object"!=typeof s||!o.legacy)return e.schema(n,s,{appendPath:!0});const c=i.walk(s);return c?c.compile(c.root,s):e.schema(n,s,{appendPath:!0})},i.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=i.walk(t);if(e)return e}return null}const n=e[r.symbols.any];if(n)return{root:e[n.root],compile:n.compile};t(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=i.walk(e[t]);if(r)return r}return null},i.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},e.when=function(s,o,a){if(void 0===a&&(t(o&&"object"==typeof o,"Missing options"),a=o,o=n.create(".")),Array.isArray(a)&&(a={switch:a}),r.assertOptions(a,["is","not","then","otherwise","switch","break"]),r.isSchema(o))return t(void 0===a.is,'"is" can not be used with a schema condition'),t(void 0===a.not,'"not" can not be used with a schema condition'),t(void 0===a.switch,'"switch" can not be used with a schema condition'),i.condition(s,{is:o,then:a.then,otherwise:a.otherwise,break:a.break});if(t(n.isRef(o)||"string"==typeof o,"Invalid condition:",o),t(void 0===a.not||void 0===a.is,'Cannot combine "is" with "not"'),void 0===a.switch){let c=a;void 0!==a.not&&(c={is:a.not,then:a.otherwise,otherwise:a.then,break:a.break});let l=void 0!==c.is?s.$_compile(c.is):s.$_root.invalid(null,!1,0,"").required();return t(void 0!==c.then||void 0!==c.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),t(void 0===c.break||void 0===c.then||void 0===c.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===a.is||n.isRef(a.is)||r.isSchema(a.is)||(l=l.required()),i.condition(s,{ref:e.ref(o),is:l,then:c.then,otherwise:c.otherwise,break:c.break})}t(Array.isArray(a.switch),'"switch" must be an array'),t(void 0===a.is,'Cannot combine "switch" with "is"'),t(void 0===a.not,'Cannot combine "switch" with "not"'),t(void 0===a.then,'Cannot combine "switch" with "then"');const c={ref:e.ref(o),switch:[],break:a.break};for(let e=0;e<a.switch.length;++e){const i=a.switch[e],o=e===a.switch.length-1;r.assertOptions(i,o?["is","then","otherwise"]:["is","then"]),t(void 0!==i.is,'Switch statement missing "is"'),t(void 0!==i.then,'Switch statement missing "then"');const l={is:s.$_compile(i.is),then:s.$_compile(i.then)};if(n.isRef(i.is)||r.isSchema(i.is)||(l.is=l.is.required()),o){t(void 0===a.otherwise||void 0===i.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const e=void 0!==a.otherwise?a.otherwise:i.otherwise;void 0!==e&&(t(void 0===c.break,"Cannot specify both otherwise and break"),l.otherwise=s.$_compile(e))}c.switch.push(l)}return c},i.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}}(la)),la}var da,fa={};function pa(){if(da)return fa;da=1;const e=Lr,t=qr,r=oa(),n=sa(),i={};return fa.type=function(s,o){const a=Object.getPrototypeOf(s),c=t(a),l=s._assign(Object.create(c)),u=Object.assign({},o);delete u.base,c._definition=u;const d=a._definition||{};u.messages=n.merge(d.messages,u.messages),u.properties=Object.assign({},d.properties,u.properties),l.type=u.type,u.flags=Object.assign({},d.flags,u.flags);const f=Object.assign({},d.terms);if(u.terms)for(const t in u.terms){const r=u.terms[t];e(void 0===l.$_terms[t],"Invalid term override for",u.type,t),l.$_terms[t]=r.init,f[t]=r}u.terms=f,u.args||(u.args=d.args),u.prepare=i.prepare(u.prepare,d.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=i.coerce(u.coerce,d.coerce),u.validate=i.validate(u.validate,d.validate);const p=Object.assign({},d.rules);if(u.rules)for(const t in u.rules){const n=u.rules[t];e("object"==typeof n,"Invalid rule definition for",u.type,t);let i=n.method;if(void 0===i&&(i=function(){return this.$_addRule(t)}),i&&(e(!c[t],"Rule conflict in",u.type,t),c[t]=i),e(!p[t],"Rule conflict in",u.type,t),p[t]=n,n.alias){const e=[].concat(n.alias);for(const t of e)c[t]=n.method}n.args&&(n.argsByName=new Map,n.args=n.args.map((t=>("string"==typeof t&&(t={name:t}),e(!n.argsByName.has(t.name),"Duplicated argument name",t.name),r.isSchema(t.assert)&&(t.assert=t.assert.strict().label(t.name)),n.argsByName.set(t.name,t),t))))}u.rules=p;const h=Object.assign({},d.modifiers);if(u.modifiers)for(const t in u.modifiers){e(!c[t],"Rule conflict in",u.type,t);const r=u.modifiers[t];e("function"==typeof r,"Invalid modifier definition for",u.type,t);const n=function(e){return this.rule({[t]:e})};c[t]=n,h[t]=r}if(u.modifiers=h,u.overrides){c._super=a,l.$_super={};for(const t in u.overrides)e(a[t],"Cannot override missing",t),u.overrides[t][r.symbols.parent]=a[t],l.$_super[t]=a[t].bind(l);Object.assign(c,u.overrides)}u.cast=Object.assign({},d.cast,u.cast);const m=Object.assign({},d.manifest,u.manifest);return m.build=i.build(u.manifest&&u.manifest.build,d.manifest&&d.manifest.build),u.manifest=m,u.rebuild=i.rebuild(u.rebuild,d.rebuild),l},i.build=function(e,t){return e&&t?function(r,n){return t(e(r,n),n)}:e||t},i.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,n){let i;if((!t.from||t.from.includes(typeof r))&&(i=t.method(r,n),i)){if(i.errors||void 0===i.value)return i;r=i.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,n);if(t)return t}return i}}:e||t},i.prepare=function(e,t){return e&&t?function(r,n){const i=e(r,n);if(i){if(i.errors||void 0===i.value)return i;r=i.value}return t(r,n)||i}:e||t},i.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},i.validate=function(e,t){return e&&t?function(r,n){const i=t(r,n);if(i){if(i.errors&&(!Array.isArray(i.errors)||i.errors.length))return i;r=i.value}return e(r,n)||i}:e||t},fa}var ha,ma={};function ya(){if(ha)return ma;ha=1;const e=Lr,t=qr,r=oa(),n=sa(),i=na(),s=ia();let o;const a={};return ma.describe=function(i){const s=i._definition,o={type:i.type,flags:{},rules:[]};for(const e in i._flags)"_"!==e[0]&&(o.flags[e]=a.describe(i._flags[e]));Object.keys(o.flags).length||delete o.flags,i._preferences&&(o.preferences=t(i._preferences,{shallow:["messages"]}),delete o.preferences[r.symbols.prefs],o.preferences.messages&&(o.preferences.messages=n.decompile(o.preferences.messages))),i._valids&&(o.allow=i._valids.describe()),i._invalids&&(o.invalid=i._invalids.describe());for(const e of i._rules){if(!1===s.rules[e.name].manifest)continue;const t={name:e.name};for(const r in s.modifiers)void 0!==e[r]&&(t[r]=a.describe(e[r]));if(e.args){t.args={};for(const r in e.args){const n=e.args[r];("options"!==r||Object.keys(n).length)&&(t.args[r]=a.describe(n,{assign:r}))}Object.keys(t.args).length||delete t.args}o.rules.push(t)}o.rules.length||delete o.rules;for(const t in i.$_terms){if("_"===t[0])continue;e(!o[t],"Cannot describe schema due to internal name conflict with",t);const n=i.$_terms[t];if(!n)continue;if(n instanceof Map){n.size&&(o[t]=[...n.entries()]);continue}if(r.isValues(n)){o[t]=n.describe();continue}e(s.terms[t],"Term",t,"missing configuration");const c=s.terms[t].manifest,l="object"==typeof c;if(!n.length&&!l)continue;const u=[];for(const e of n)u.push(a.describe(e));if(l){const{from:e,to:r}=c.mapped;o[t]={};for(const n of u)o[t][n[r]]=n[e]}else"single"!==c?o[t]=u:(e(1===u.length,"Term",t,"contains more than one item"),o[t]=u[0])}return a.validate(i.$_root,o),o},a.describe=function(e,n={}){if(Array.isArray(e))return e.map(a.describe);if(e===r.symbols.deepDefault)return{special:"deep"};if("object"!=typeof e||null===e)return e;if("options"===n.assign)return t(e);if(Buffer&&Buffer.isBuffer(e))return{buffer:e.toString("binary")};if(e instanceof Date)return e.toISOString();if(e instanceof Error)return e;if(e instanceof RegExp)return"regex"===n.assign?e.toString():{regex:e.toString()};if(e[r.symbols.literal])return{function:e.literal};if("function"==typeof e.describe)return"ref"===n.assign?e.describe().ref:e.describe();const i={};for(const t in e){const r=e[t];void 0!==r&&(i[t]=a.describe(r,{assign:t}))}return i},ma.build=function(e,t){return new a.Builder(e).parse(t)},a.Builder=class{constructor(e){this.joi=e}parse(t){a.validate(this.joi,t);let r=this.joi[t.type]()._bare();const n=r._definition;if(t.flags)for(const i in t.flags){const s=n.flags[i]&&n.flags[i].setter||i;e("function"==typeof r[s],"Invalid flag",i,"for type",t.type),r=r[s](this.build(t.flags[i]))}if(t.preferences&&(r=r.preferences(this.build(t.preferences))),t.allow&&(r=r.allow(...this.build(t.allow))),t.invalid&&(r=r.invalid(...this.build(t.invalid))),t.rules)for(const i of t.rules){e("function"==typeof r[i.name],"Invalid rule",i.name,"for type",t.type);const s=[];if(i.args){const r={};for(const e in i.args)r[e]=this.build(i.args[e],{assign:e});const o=Object.keys(r),a=n.rules[i.name].args;if(a){e(o.length<=a.length,"Invalid number of arguments for",t.type,i.name,"(expected up to",a.length,", found",o.length,")");for(const{name:e}of a)s.push(r[e])}else e(1===o.length,"Invalid number of arguments for",t.type,i.name,"(expected up to 1, found",o.length,")"),s.push(r[o[0]])}r=r[i.name](...s);const o={};for(const e in n.modifiers)void 0!==i[e]&&(o[e]=this.build(i[e]));Object.keys(o).length&&(r=r.rule(o))}const i={};for(const r in t){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(r))continue;e(n.terms[r],"Term",r,"missing configuration");const s=n.terms[r].manifest;if("schema"!==s)if("values"!==s)if("single"!==s)if("object"!=typeof s)i[r]=this.build(t[r]);else{i[r]={};for(const e in t[r]){const n=t[r][e];i[r][e]=this.parse(n)}}else i[r]=this.build(t[r]);else i[r]=t[r].map((e=>this.build(e)));else i[r]=t[r].map((e=>this.parse(e)))}return t.whens&&(i.whens=t.whens.map((e=>this.build(e)))),r=n.manifest.build(r,i),r.$_temp.ruleset=!1,r}build(n,o={}){if(null===n)return null;if(Array.isArray(n))return n.map((e=>this.build(e)));if(n instanceof Error)return n;if("options"===o.assign)return t(n);if("regex"===o.assign)return a.regex(n);if("ref"===o.assign)return i.build(n);if("object"!=typeof n)return n;if(1===Object.keys(n).length){if(n.buffer)return e(Buffer,"Buffers are not supported"),Buffer&&Buffer.from(n.buffer,"binary");if(n.function)return{[r.symbols.literal]:!0,literal:n.function};if(n.override)return r.symbols.override;if(n.ref)return i.build(n.ref);if(n.regex)return a.regex(n.regex);if(n.special)return e(["deep"].includes(n.special),"Unknown special value",n.special),r.symbols.deepDefault;if(n.value)return t(n.value)}if(n.type)return this.parse(n);if(n.template)return s.build(n);const c={};for(const e in n)c[e]=this.build(n[e],{assign:e});return c}},a.regex=function(e){const t=e.lastIndexOf("/"),r=e.slice(1,t),n=e.slice(t+1);return new RegExp(r,n)},a.validate=function(e,t){o=o||Uo(),e.assert(t,o.description)},ma}var ga,_a={};function va(){if(ga)return _a;ga=1;const e=tn,t=rn,r=Xo(),n={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};return _a.setup=function(e){const t=function(){return e._tracer=e._tracer||new n.Tracer,e._tracer};e.trace=t,e[Symbol.for("@hapi/lab/coverage/initialize")]=t,e.untrace=()=>{e._tracer=null}},_a.location=function(e){return e.$_setFlag("_tracerLocation",t.location(2))},n.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(e){const r=this._schemas.get(e);if(r)return r.store;const i=new n.Store(e),{filename:s,line:o}=e._flags._tracerLocation||t.location(5);return this._schemas.set(e,{filename:s,line:o,store:i}),i}_combine(e,t){for(const{store:r}of this._schemas.values())r._combine(e,t)}report(e){const t=[];for(const{filename:r,line:i,store:s}of this._schemas.values()){if(e&&e!==r)continue;const o=[],a=[];for(const[e,t]of s._sources.entries()){if(n.sub(t.paths,a))continue;if(!t.entry){o.push({status:"never reached",paths:[...t.paths]}),a.push(...t.paths);continue}for(const r of["valid","invalid"]){const n=e[`_${r}s`];if(!n)continue;const i=new Set(n._values),s=new Set(n._refs);for(const{value:e,ref:n}of t[r])i.delete(e),s.delete(n);(i.size||s.size)&&o.push({status:[...i,...[...s].map((e=>e.display))],rule:`${r}s`})}const r=e._rules.map((e=>e.name));for(const t of["default","failover"])void 0!==e._flags[t]&&r.push(t);for(const e of r){const r=n.labels[t.rule[e]||0];if(r){const n={rule:e,status:r};t.paths.size&&(n.paths=[...t.paths]),o.push(n)}}}o.length&&t.push({filename:r,line:i,missing:o,severity:"error",message:`Schema missing tests for ${o.map(n.message).join(", ")}`})}return t.length?t:null}},n.Store=class{constructor(e){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(e)}debug(e,t,r,n){e.mainstay.debug&&e.mainstay.debug.push({type:t,name:r,result:n,path:e.path})}entry(e,t){n.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,i){n.debug(t,{type:r,...i}),this._record(e,(e=>{e[r].add(i)}))}log(e,t,r,i,s){n.debug(t,{type:r,name:i,result:"full"===s?"pass":s}),this._record(e,(e=>{e[r][i]=e[r][i]||0,e[r][i]|=n.codes[s]}))}resolve(e,t,r){if(!e.mainstay.debug)return;const n={type:"resolve",ref:t.display,to:r,path:e.path};e.mainstay.debug.push(n)}value(t,r,n,i,s){if(!t.mainstay.debug||e(n,i))return;const o={type:"value",by:r,from:n,to:i,path:t.path};s&&(o.name=s),t.mainstay.debug.push(o)}_record(e,t){const r=this._sources.get(e);if(r)return void t(r);const n=this._combos.get(e);for(const e of n)this._record(e,t)}_scan(e,t){const r=t||[];let i=this._sources.get(e);i||(i={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(e,i)),r.length&&i.paths.add(r);e.$_modify({each:(e,t)=>{const i=n.id(e,t);this._scan(e,r.concat(i))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},n.message=function(e){return`${e.paths?r.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},n.id=function(e,{source:t,name:r,path:n,key:i}){return e._flags.id?e._flags.id:i||(r=`@${r}`,"terms"===t?[r,n[Math.min(n.length-1,1)]]:r)},n.sub=function(t,r){for(const n of t)for(const t of r)if(e(n.slice(0,t.length),t))return!0;return!1},n.debug=function(e,t){e.mainstay.debug&&(t.path=e.debug?[...e.path,e.debug]:e.path,e.mainstay.debug.push(t))},_a}var ba,wa={};var Sa,Ea,ka,Aa,Oa,Ca,Ta,Ra,Ia,xa,ja,Pa,Na,$a,Ma,Da,La,Ba,Ka,Fa,Ua,Wa,Ja,Ha,Ga,za,Va,qa,Xa,Ya,Za,Qa,ec,tc,rc,nc={};function ic(){return ka||(ka=1,function(e){const t=Lr,r=qr,n=ln,i=Fr,s=oa(),o=Xo(),a=function(){if(Ea)return Sa;Ea=1;const e=qr,t=Fr,r=oa(),n={value:Symbol("value")};return Sa=n.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const i=new n.State(e,t,this);return r&&i.schemas&&(i.schemas=[n.schemas(r),...i.schemas]),i}nest(e,t){const r=new n.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[n.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new n.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=e(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},n.schemas=function(e){return r.isSchema(e)?{schema:e}:e},n.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let i=this._values;for(let t=0;t<e.length;++t){const r=e[t];let n=i.get(r);n||(n=new Map,i.set(r,n)),i=n}i[n.value]=t}get(e){const t=this.node(e);if(t)return t[n.value]}node(e){if(this._values)return t(this._values,e,{iterables:!0})}override(e,r){if(!this._values)return;const n=e.slice(0,-1),i=e[e.length-1],s=t(this._values,n,{iterables:!0});r?s.set(i,r):s&&s.delete(i)}},Sa}(),c={result:Symbol("result")};e.entry=function(e,r,n){let i=s.defaults;n&&(t(void 0===n.warnings,"Cannot override warnings preference in synchronous validation"),t(void 0===n.artifacts,"Cannot override artifacts preference in synchronous validation"),i=s.preferences(s.defaults,n));const a=c.entry(e,r,i);t(!a.mainstay.externals.length,"Schema with external rules must use validateAsync()");const l={value:a.value};return a.error&&(l.error=a.error),a.mainstay.warnings.length&&(l.warning=o.details(a.mainstay.warnings)),a.mainstay.debug&&(l.debug=a.mainstay.debug),a.mainstay.artifacts&&(l.artifacts=a.mainstay.artifacts),l},e.entryAsync=async function(e,t,r){let n=s.defaults;r&&(n=s.preferences(s.defaults,r));const a=c.entry(e,t,n),l=a.mainstay;if(a.error)throw l.debug&&(a.error.debug=l.debug),a.error;if(l.externals.length){let t=a.value;const u=[];for(const a of l.externals){const d=a.state.path,f="link"===a.schema.type?l.links.get(a.schema):null;let p,h,m=t;const y=d.length?[t]:[],g=d.length?i(e,d):e;if(d.length){p=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],y.unshift(e);h=y[0],m=h[p]}try{const e=(e,t)=>(f||a.schema).$_createError(e,m,t,a.state,n),i=await a.method(m,{schema:a.schema,linked:f,state:a.state,prefs:r,original:g,error:e,errorsArray:c.errorsArray,warn:(e,t)=>l.warnings.push((f||a.schema).$_createError(e,m,t,a.state,n)),message:(e,t)=>(f||a.schema).$_createError("external",m,t,a.state,n,{messages:e})});if(void 0===i||i===m)continue;if(i instanceof o.Report){if(l.tracer.log(a.schema,a.state,"rule","external","error"),u.push(i),n.abortEarly)break;continue}if(Array.isArray(i)&&i[s.symbols.errors]){if(l.tracer.log(a.schema,a.state,"rule","external","error"),u.push(...i),n.abortEarly)break;continue}h?(l.tracer.value(a.state,"rule",m,i,"external"),h[p]=i):(l.tracer.value(a.state,"rule",t,i,"external"),t=i)}catch(e){throw n.errors.label&&(e.message+=` (${a.label})`),e}}if(a.value=t,u.length)throw a.error=o.process(u,e,n),l.debug&&(a.error.debug=l.debug),a.error}if(!n.warnings&&!n.debug&&!n.artifacts)return a.value;const u={value:a.value};return l.warnings.length&&(u.warning=o.details(l.warnings)),l.debug&&(u.debug=l.debug),l.artifacts&&(u.artifacts=l.artifacts),u},c.Mainstay=class{constructor(e,t,r){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=r,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},c.entry=function(t,r,n){const{tracer:i,cleanup:s}=c.tracer(r,n),l=n.debug?[]:null,u=r._ids._schemaChain?new Map:null,d=new c.Mainstay(i,l,u),f=r._ids._schemaChain?[{schema:r}]:null,p=new a([],[],{mainstay:d,schemas:f}),h=e.validate(t,r,p,n);s&&r.$_root.untrace();const m=o.process(h.errors,t,n);return{value:h.value,error:m,mainstay:d}},c.tracer=function(e,r){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:r.debug?(t(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:c.ignore}},e.validate=function(e,t,r,n,i={}){if(t.$_terms.whens&&(t=t._generate(e,r,n).schema),t._preferences&&(n=c.prefs(t,n)),t._cache&&n.cache){const n=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!n),n)return n}const o=(i,s,o)=>t.$_createError(i,e,s,o||r,n),a={original:e,prefs:n,schema:t,state:r,error:o,errorsArray:c.errorsArray,warn:(e,t,n)=>r.mainstay.warnings.push(o(e,t,n)),message:(i,s)=>t.$_createError("custom",e,s,r,n,{messages:i})};r.mainstay.tracer.entry(t,r);const l=t._definition;if(l.prepare&&void 0!==e&&n.convert){const t=l.prepare(e,a);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),a);e=t.value}}if(l.coerce&&void 0!==e&&n.convert&&(!l.coerce.from||l.coerce.from.includes(typeof e))){const t=l.coerce.method(e,a);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),a);e=t.value}}const u=t._flags.empty;u&&u.$_match(c.trim(e,t),r.nest(u),s.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const d=i.presence||t._flags.presence||(t._flags._endedSwitch?null:n.presence);if(void 0===e){if("forbidden"===d)return c.finalize(e,null,a);if("required"===d)return c.finalize(e,[t.$_createError("any.required",e,null,r,n)],a);if("optional"===d){if(t._flags.default!==s.symbols.deepDefault)return c.finalize(e,null,a);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===d)return c.finalize(e,[t.$_createError("any.unknown",e,null,r,n)],a);const f=[];if(t._valids){const i=t._valids.get(e,r,n,t._flags.insensitive);if(i)return n.convert&&(r.mainstay.tracer.value(r,"valids",e,i.value),e=i.value),r.mainstay.tracer.filter(t,r,"valid",i),c.finalize(e,null,a);if(t._flags.only){const i=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[i],a);f.push(i)}}if(t._invalids){const i=t._invalids.get(e,r,n,t._flags.insensitive);if(i){r.mainstay.tracer.filter(t,r,"invalid",i);const s=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,n);if(n.abortEarly)return c.finalize(e,[s],a);f.push(s)}}if(l.validate){const t=l.validate(e,a);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return f.push(t.errors),c.finalize(e,f,a);if(t.errors.length)return f.push(...t.errors),c.finalize(e,f,a)}}return t._rules.length?c.rules(e,f,a):c.finalize(e,f,a)},c.rules=function(e,t,r){const{schema:n,state:i,prefs:o}=r;for(const a of n._rules){const l=n._definition.rules[a.method];if(l.convert&&o.convert){i.mainstay.tracer.log(n,i,"rule",a.name,"full");continue}let u,d=a.args;if(a._resolve.length){d=Object.assign({},d);for(const t of a._resolve){const r=l.argsByName.get(t),a=d[t].resolve(e,i,o),c=r.normalize?r.normalize(a):a,f=s.validateArg(c,null,r);if(f){u=n.$_createError("any.ref",a,{arg:t,ref:d[t],reason:f},i,o);break}d[t]=c}}u=u||l.validate(e,r,d,a);const f=c.rule(u,a);if(f.errors){if(i.mainstay.tracer.log(n,i,"rule",a.name,"error"),a.warn){i.mainstay.warnings.push(...f.errors);continue}if(o.abortEarly)return c.finalize(e,f.errors,r);t.push(...f.errors)}else i.mainstay.tracer.log(n,i,"rule",a.name,"pass"),i.mainstay.tracer.value(i,"rule",e,f.value,a.name),e=f.value}return c.finalize(e,t,r)},c.rule=function(e,t){return e instanceof o.Report?(c.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[s.symbols.errors]?(e.forEach((e=>c.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},c.error=function(e,t){return t.message&&e._setTemplate(t.message),e},c.finalize=function(e,r,n){r=r||[];const{schema:i,state:s,prefs:a}=n;if(r.length){const t=c.default("failover",void 0,r,n);void 0!==t&&(s.mainstay.tracer.value(s,"failover",e,t),e=t,r=[])}if(r.length&&i._flags.error)if("function"==typeof i._flags.error){r=i._flags.error(r),Array.isArray(r)||(r=[r]);for(const e of r)t(e instanceof Error||e instanceof o.Report,"error() must return an Error object")}else r=[i._flags.error];if(void 0===e){const t=c.default("default",e,r,n);s.mainstay.tracer.value(s,"default",e,t),e=t}if(i._flags.cast&&void 0!==e){const t=i._definition.cast[i._flags.cast];if(t.from(e)){const r=t.to(e,n);s.mainstay.tracer.value(s,"cast",e,r,i._flags.cast),e=r}}if(i.$_terms.externals&&a.externals&&!1!==a._externals)for(const{method:e}of i.$_terms.externals)s.mainstay.externals.push({method:e,schema:i,state:s,label:o.label(i._flags,s,a)});const l={value:e,errors:r.length?r:null};return i._flags.result&&(l.value="strip"===i._flags.result?void 0:n.original,s.mainstay.tracer.value(s,i._flags.result,e,l.value),s.shadow(e,i._flags.result)),i._cache&&!1!==a.cache&&!i._refs.length&&i._cache.set(n.original,l),void 0===e||l.errors||void 0===i._flags.artifact||(s.mainstay.artifacts=s.mainstay.artifacts||new Map,s.mainstay.artifacts.has(i._flags.artifact)||s.mainstay.artifacts.set(i._flags.artifact,[]),s.mainstay.artifacts.get(i._flags.artifact).push(s.path)),l},c.prefs=function(e,t){const r=t===s.defaults;return r&&e._preferences[s.symbols.prefs]?e._preferences[s.symbols.prefs]:(t=s.preferences(t,e._preferences),r&&(e._preferences[s.symbols.prefs]=t),t)},c.default=function(e,t,n,i){const{schema:o,state:a,prefs:c}=i,l=o._flags[e];if(c.noDefaults||void 0===l)return t;if(a.mainstay.tracer.log(o,a,"rule",e,"full"),!l)return l;if("function"==typeof l){const t=l.length?[r(a.ancestors[0]),i]:[];try{return l(...t)}catch(t){return void n.push(o.$_createError(`any.${e}`,null,{error:t},a,c))}}return"object"!=typeof l?l:l[s.symbols.literal]?l.literal:s.isResolvable(l)?l.resolve(t,a,c):r(l)},c.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},c.ignore={active:!1,debug:n,entry:n,filter:n,log:n,resolve:n,value:n},c.errorsArray=function(){const e=[];return e[s.symbols.errors]=!0,e}}(nc)),nc}function sc(){if(Oa)return Aa;Oa=1;const e=Lr,t=tn,r=oa(),n={};return Aa=n.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=n.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){r.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new n.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){r.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,n){return!!this.get(e,t,r,n)}get(e,r,n,i){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&i){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const r of this._values)if(t(r,e))return{value:r};if(r)for(const s of this._refs){const o=s.resolve(e,r,n,null,{in:!0});if(void 0===o)continue;const a=s.in&&"object"==typeof o?Array.isArray(o)?o:Object.keys(o):[o];for(const r of a)if(typeof r==typeof e)if(i&&e&&"string"==typeof e){if(r.toLowerCase()===e.toLowerCase())return{value:r,ref:s}}else if(t(r,e))return{value:r,ref:s}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new n.Values(this._values,this._refs);return e._override=this._override,e}concat(t){e(!t._override,"Cannot concat override set of values");const r=new n.Values([...this._values,...t._values],[...this._refs,...t._refs]);return r._override=this._override,r}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},n.Values.prototype[r.symbols.values]=!0,n.Values.prototype.slice=n.Values.prototype.clone,n.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t},Aa}function oc(){if(Ta)return Ca;Ta=1;const e=Lr,t=qr,r=tn,n=cn,i=aa(),s=oa(),o=ua(),a=Xo(),c=pa(),l=ya(),u=sa(),d=(ba||(ba=1,function(e){const t=Lr,r=oa(),n=na(),i={};e.Ids=i.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new i.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[r,n]of e._byId.entries())t(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,n);for(const[r,n]of e._byKey.entries())t(!this._byId.has(r),"Schema key conflicts with existing id:",r),this._byKey.set(r,n)}fork(e,n,s){const o=this._collect(e);o.push({schema:s});const a=o.shift();let c={id:a.id,schema:n(a.schema)};t(r.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const e of o)c={id:e.id,schema:i.fork(e.schema,c.id,c.schema)};return c.schema}labels(e,t=[]){const r=e[0],n=this._get(r);if(!n)return[...t,...e].join(".");const i=e.slice(1);return t=[...t,n.schema._flags.label||r],i.length?n.schema._ids.labels(i,t):t.join(".")}reach(e,r=[]){const n=e[0],i=this._get(n);t(i,"Schema does not contain path",[...r,...e].join("."));const s=e.slice(1);return s.length?i.schema._ids.reach(s,[...r,n]):i.schema}register(e,{key:n}={}){if(!e||!r.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const i=e._flags.id;if(i){const r=this._byId.get(i);t(!r||r.schema===e,"Cannot add different schemas with the same id:",i),t(!this._byKey.has(i),"Schema id conflicts with existing key:",i),this._byId.set(i,{schema:e,id:i})}n&&(t(!this._byKey.has(n),"Schema already contains key:",n),t(!this._byId.has(n),"Schema key conflicts with existing id:",n),this._byKey.set(n,{schema:e,id:n}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,r=[],n=[]){const i=e[0],s=this._get(i);t(s,"Schema does not contain path",[...r,...e].join(".")),n=[s,...n];const o=e.slice(1);return o.length?s.schema._ids._collect(o,[...r,i],n):n}_get(e){return this._byId.get(e)||this._byKey.get(e)}},i.fork=function(t,r,n){const i=e.schema(t,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return n},ref:!1});return i?i.$_mutateRebuild():t},e.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const s=i.scan(e._flags[n],{source:"flags",name:n},t);void 0!==s&&(r=r||e.clone(),r._flags[n]=s)}for(let n=0;n<e._rules.length;++n){const s=e._rules[n],o=i.scan(s.args,{source:"rules",name:s.name},t);if(void 0!==o){r=r||e.clone();const t=Object.assign({},s);t.args=o,r._rules[n]=t,r._singleRules.get(s.name)===s&&r._singleRules.set(s.name,t)}}for(const n in e.$_terms){if("_"===n[0])continue;const s=i.scan(e.$_terms[n],{source:"terms",name:n},t);void 0!==s&&(r=r||e.clone(),r.$_terms[n]=s)}return r},i.scan=function(e,t,s,o,a){const c=o||[];if(null===e||"object"!=typeof e)return;let l;if(Array.isArray(e)){for(let r=0;r<e.length;++r){const n="terms"===t.source&&"keys"===t.name&&e[r].key,o=i.scan(e[r],t,s,[r,...c],n);void 0!==o&&(l=l||e.slice(),l[r]=o)}return l}if(!1!==s.schema&&r.isSchema(e)||!1!==s.ref&&n.isRef(e)){const r=s.each(e,{...t,path:c,key:a});if(r===e)return;return r}for(const r in e){if("_"===r[0])continue;const n=i.scan(e[r],t,s,[r,...c],a);void 0!==n&&(l=l||Object.assign({},e),l[r]=n)}return l}}(wa)),wa),f=na(),p=va(),h=ic(),m=sc(),y={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new d.Ids,this._preferences=null,this._refs=new f.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return e("function"==typeof l.describe,"Manifest functionality disabled"),l.describe(this)}allow(...e){return s.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(t){e(t&&"object"==typeof t&&!Array.isArray(t),"Invalid targets argument"),e(!this._inRuleset(),"Cannot set alterations inside a ruleset");const r=this.clone();r.$_terms.alterations=r.$_terms.alterations||[];for(const n in t){const i=t[n];e("function"==typeof i,"Alteration adjuster for",n,"must be a function"),r.$_terms.alterations.push({target:n,adjuster:i})}return r.$_temp.ruleset=!1,r}artifact(t){return e(void 0!==t,"Artifact cannot be undefined"),e(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",t)}cast(t){return e(!1===t||"string"==typeof t,"Invalid to value"),e(!1===t||this._definition.cast[t],"Type",this.type,"does not support casting to",t),this.$_setFlag("cast",!1===t?void 0:t)}default(e,t){return this._default("default",e,t)}description(t){return e(t&&"string"==typeof t,"Description must be a non-empty string"),this.$_setFlag("description",t)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(t){return e(t,"Missing error"),e(t instanceof Error||"function"==typeof t,"Must provide a valid Error object or a function"),this.$_setFlag("error",t)}example(t,r={}){return e(void 0!==t,"Missing example"),s.assertOptions(r,["override"]),this._inner("examples",t,{single:!0,override:r.override})}external(t,r){return"object"==typeof t&&(e(!r,"Cannot combine options with description"),r=t.description,t=t.method),e("function"==typeof t,"Method must be a function"),e(void 0===r||r&&"string"==typeof r,"Description must be a non-empty string"),this._inner("externals",{method:t,description:r},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(t){return t?(e("string"==typeof t,"id must be a non-empty string"),e(/^[^\.]+$/.test(t),"id cannot contain period character"),this.$_setFlag("id",t)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(t){return e(t&&"string"==typeof t,"Label name must be a non-empty string"),this.$_setFlag("label",t)}meta(t){return e(void 0!==t,"Meta cannot be undefined"),this._inner("metas",t,{single:!0})}note(...t){e(t.length,"Missing notes");for(const r of t)e(r&&"string"==typeof r,"Notes must be non-empty strings");return this._inner("notes",t)}only(t=!0){return e("boolean"==typeof t,"Invalid mode:",t),this.$_setFlag("only",t)}optional(){return this.presence("optional")}prefs(t){e(t,"Missing preferences"),e(void 0===t.context,"Cannot override context"),e(void 0===t.externals,"Cannot override externals"),e(void 0===t.warnings,"Cannot override warnings"),e(void 0===t.debug,"Cannot override debug"),s.checkPreferences(t);const r=this.clone();return r._preferences=s.preferences(r._preferences,t),r}presence(t){return e(["optional","required","forbidden"].includes(t),"Unknown presence mode",t),this.$_setFlag("presence",t)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(t){return e(["raw","strip"].includes(t),"Unknown result mode",t),this.$_setFlag("result",t)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=s.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...t){e(t.length,"Missing tags");for(const r of t)e(r&&"string"==typeof r,"Tags must be non-empty strings");return this._inner("tags",t)}unit(t){return e(t&&"string"==typeof t,"Unit name must be a non-empty string"),this.$_setFlag("unit",t)}valid(...e){s.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(t,r){const n=this.clone();n.$_terms.whens||(n.$_terms.whens=[]);const i=o.when(n,t,r);if(!["any","link"].includes(n.type)){const t=i.is?[i]:i.switch;for(const r of t)e(!r.then||"any"===r.then.type||r.then.type===n.type,"Cannot combine",n.type,"with",r.then&&r.then.type),e(!r.otherwise||"any"===r.otherwise.type||r.otherwise.type===n.type,"Cannot combine",n.type,"with",r.otherwise&&r.otherwise.type)}return n.$_terms.whens.push(i),n.$_mutateRebuild()}cache(t){e(!this._inRuleset(),"Cannot set caching inside a ruleset"),e(!this._cache,"Cannot override schema cache"),e(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const r=this.clone();return r._cache=t||i.provider.provision(),r.$_temp.ruleset=!1,r}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(t){e(s.isSchema(t),"Invalid schema object"),e("any"===this.type||"any"===t.type||t.type===this.type,"Cannot merge type",this.type,"with another type:",t.type),e(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),e(!t._inRuleset(),"Cannot concatenate a schema with open ruleset");let r=this.clone();if("any"===this.type&&"any"!==t.type){const e=t.clone();for(const t of Object.keys(r))"type"!==t&&(e[t]=r[t]);r=e}r._ids.concat(t._ids),r._refs.register(t,f.toSibling),r._preferences=r._preferences?s.preferences(r._preferences,t._preferences):t._preferences,r._valids=m.merge(r._valids,t._valids,t._invalids),r._invalids=m.merge(r._invalids,t._invalids,t._valids);for(const e of t._singleRules.keys())r._singleRules.has(e)&&(r._rules=r._rules.filter((t=>t.keep||t.name!==e)),r._singleRules.delete(e));for(const e of t._rules)t._definition.rules[e.method].multi||r._singleRules.set(e.name,e),r._rules.push(e);if(r._flags.empty&&t._flags.empty){r._flags.empty=r._flags.empty.concat(t._flags.empty);const e=Object.assign({},t._flags);delete e.empty,n(r._flags,e)}else if(t._flags.empty){r._flags.empty=t._flags.empty;const e=Object.assign({},t._flags);delete e.empty,n(r._flags,e)}else n(r._flags,t._flags);for(const e in t.$_terms){const n=t.$_terms[e];n?r.$_terms[e]?r.$_terms[e]=r.$_terms[e].concat(n):r.$_terms[e]=n.slice():r.$_terms[e]||(r.$_terms[e]=n)}return this.$_root._tracer&&this.$_root._tracer._combine(r,[this,t]),r.$_mutateRebuild()}extend(t){return e(!t.base,"Cannot extend type with another base"),c.type(this,t)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(t,r){e(!this._inRuleset(),"Cannot fork inside a ruleset");let n=this;for(let e of[].concat(t))e=Array.isArray(e)?e:e.split("."),n=n._ids.fork(e,r,n);return n.$_temp.ruleset=!1,n}rule(r){const n=this._definition;s.assertOptions(r,Object.keys(n.modifiers)),e(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const i=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;e(i>=0&&i<this._rules.length,"Cannot apply rules to empty ruleset");const o=this.clone();for(let s=i;s<o._rules.length;++s){const i=o._rules[s],a=t(i);for(const t in r)n.modifiers[t](a,r[t]),e(a.name===i.name,"Cannot change rule name");o._rules[s]=a,o._singleRules.get(a.name)===i&&o._singleRules.set(a.name,a)}return o.$_temp.ruleset=!1,o.$_mutateRebuild()}get ruleset(){e(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const t=this.clone();return t.$_temp.ruleset=t._rules.length,t}get $(){return this.ruleset}tailor(t){t=[].concat(t),e(!this._inRuleset(),"Cannot tailor inside a ruleset");let r=this;if(this.$_terms.alterations)for(const{target:n,adjuster:i}of this.$_terms.alterations)t.includes(n)&&(r=i(r),e(s.isSchema(r),"Alteration adjuster for",n,"failed to return a schema object"));return r=r.$_modify({each:e=>e.tailor(t),ref:!1}),r.$_temp.ruleset=!1,r.$_mutateRebuild()}tracer(){return p.location?p.location(this):this}validate(e,t){return h.entry(e,this,t)}validateAsync(e,t){return h.entryAsync(e,this,t)}$_addRule(t){"string"==typeof t&&(t={name:t}),e(t&&"object"==typeof t,"Invalid options"),e(t.name&&"string"==typeof t.name,"Invalid rule name");for(const r in t)e("_"!==r[0],"Cannot set private rule properties");const r=Object.assign({},t);r._resolve=[],r.method=r.method||r.name;const n=this._definition.rules[r.method],i=r.args;e(n,"Unknown rule",r.method);const o=this.clone();if(i){e(1===Object.keys(i).length||Object.keys(i).length===this._definition.rules[r.name].args.length,"Invalid rule definition for",this.type,r.name);for(const t in i){let a=i[t];if(n.argsByName){const c=n.argsByName.get(t);if(c.ref&&s.isResolvable(a))r._resolve.push(t),o.$_mutateRegister(a);else if(c.normalize&&(a=c.normalize(a),i[t]=a),c.assert){const r=s.validateArg(a,t,c);e(!r,r,"or reference")}}void 0!==a?i[t]=a:delete i[t]}}return n.multi||(o._ruleRemove(r.name,{clone:!1}),o._singleRules.set(r.name,r)),!1===o.$_temp.ruleset&&(o.$_temp.ruleset=null),n.priority?o._rules.unshift(r):o._rules.push(r),o}$_compile(e,t){return o.schema(this.$_root,e,t)}$_createError(e,t,r,n,i,s={}){const o=!1!==s.flags?this._flags:{},c=s.messages?u.merge(this._definition.messages,s.messages):this._definition.messages;return new a.Report(e,t,r,o,c,n,i)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,n){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const i=!h.validate(e,this,t,r,n).errors;return t.restore(),i}$_modify(e){return s.assertOptions(e,["each","once","ref","schema"]),d.schema(this,e)||this}$_mutateRebuild(){e(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset();return this.$_modify({each:(e,{source:t,name:r,path:n,key:i})=>{const s=this._definition[t][r]&&this._definition[t][r].register;!1!==s&&this.$_mutateRegister(e,{family:s,key:i})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(t,n,i={}){e("_"===t[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const s=this._definition.flags[t]||{};if(r(n,s.default)&&(n=void 0),r(n,this._flags[t]))return this;const o=!1!==i.clone?this.clone():this;return void 0!==n?(o._flags[t]=n,o.$_mutateRegister(n)):delete o._flags[t],"_"!==t[0]&&(o.$_temp.ruleset=!1),o}$_parent(e,...t){return this[e][s.symbols.parent].call(this,...t)}$_validate(e,t,r){return h.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=t(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const n=t[r];e.$_terms[r]=n.init}return e.$_mutateRebuild()}_default(t,r,n={}){s.assertOptions(n,"literal"),e(void 0!==r,"Missing",t,"value"),e("function"==typeof r||!n.literal,"Only function value supports literal option"),"function"==typeof r&&n.literal&&(r={[s.symbols.literal]:!0,literal:r});return this.$_setFlag(t,r)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const n=[],i=[];for(let s=0;s<this.$_terms.whens.length;++s){const o=this.$_terms.whens[s];if(o.concat){n.push(o.concat),i.push(`${s}.concat`);continue}const a=o.ref?o.ref.resolve(e,t,r):e,c=o.is?[o]:o.switch,l=i.length;for(let l=0;l<c.length;++l){const{is:u,then:d,otherwise:f}=c[l],p=`${s}${o.switch?"."+l:""}`;if(u.$_match(a,t.nest(u,`${p}.is`),r)){if(d){const s=t.localize([...t.path,`${p}.then`],t.ancestors,t.schemas),{schema:o,id:a}=d._generate(e,s,r);n.push(o),i.push(`${p}.then${a?`(${a})`:""}`);break}}else if(f){const s=t.localize([...t.path,`${p}.otherwise`],t.ancestors,t.schemas),{schema:o,id:a}=f._generate(e,s,r);n.push(o),i.push(`${p}.otherwise${a?`(${a})`:""}`);break}}if(o.break&&i.length>l)break}const s=i.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",s),!s)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[s])return{schema:this.$_temp.whens[s],id:s};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,r));for(const e of n)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...n]),this.$_temp.whens[s]=o,{schema:o,id:s}}_inner(t,r,n={}){e(!this._inRuleset(),`Cannot set ${t} inside a ruleset`);const i=this.clone();return i.$_terms[t]&&!n.override||(i.$_terms[t]=[]),n.single?i.$_terms[t].push(r):i.$_terms[t].push(...r),i.$_temp.ruleset=!1,i}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const n=[];for(let t=0;t<r._rules.length;++t){const i=r._rules[t];i.name!==e||i.keep?n.push(i):r._inRuleset()&&t<r.$_temp.ruleset&&--r.$_temp.ruleset}return r._rules=n,r}_values(t,r){s.verifyFlat(t,r.slice(1,-1));const n=this.clone(),i=t[0]===s.symbols.override;if(i&&(t=t.slice(1)),!n[r]&&t.length?n[r]=new m:i&&(n[r]=t.length?new m:null,n.$_mutateRebuild()),!n[r])return n;i&&n[r].override();for(const i of t){e(void 0!==i,"Cannot call allow/valid/invalid with undefined"),e(i!==s.symbols.override,"Override must be the first value");const t="_invalids"===r?"_valids":"_invalids";n[t]&&(n[t].remove(i),n[t].length||(e("_valids"===r||!n._flags.only,"Setting invalid value",i,"leaves schema rejecting all values due to previous valid rule"),n[t]=null)),n[r].add(i,n._refs)}return n}}};return y.Base.prototype[s.symbols.any]={version:s.version,compile:o.compile,root:"$_root"},y.Base.prototype.isImmutable=!0,y.Base.prototype.deny=y.Base.prototype.invalid,y.Base.prototype.disallow=y.Base.prototype.invalid,y.Base.prototype.equal=y.Base.prototype.valid,y.Base.prototype.exist=y.Base.prototype.required,y.Base.prototype.not=y.Base.prototype.invalid,y.Base.prototype.options=y.Base.prototype.prefs,y.Base.prototype.preferences=y.Base.prototype.prefs,Ca=new y.Base}function ac(){if(Ia)return Ra;Ia=1;const e=Lr,t=oc(),r=oa(),n=sa();return Ra=t.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(t,r){return e("function"==typeof t,"Method must be a function"),e(void 0===r||r&&"string"==typeof r,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:t,description:r}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(t){e(r.isSchema(t)&&t._flags.id,"Schema must be a schema with an id");const n=this.clone();return n.$_terms.shared=n.$_terms.shared||[],n.$_terms.shared.push(t),n.$_mutateRegister(t),n}},warning:{method(t,r){return e(t&&"string"==typeof t,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:t,local:r},warn:!0})},validate:(e,t,{code:r,local:n})=>t.error(r,n),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=n.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const r in t){const n=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of n)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of n)e=e.shared(t)}else for(const t of n){const{ref:r,is:n,not:i,then:s,otherwise:o,concat:a}=t;e=a?e.concat(a):r?e.when(r,{is:n,not:i,then:s,otherwise:o,switch:t.switch,break:t.break}):e.when(n,{then:s,otherwise:o,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of n)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}}),Ra}function cc(){if(ja)return xa;ja=1;const e=Lr,t=cn,r=ac(),n=oa(),i=ua(),s=Xo(),o=na(),a={};return xa=r.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:o.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,r){const{schema:n,error:i,state:o,prefs:c}=r;if(n._flags.match){const r=[],a=[];for(let t=0;t<n.$_terms.matches.length;++t){const i=n.$_terms.matches[t],s=o.nest(i.schema,`match.${t}`);s.snapshot();const l=i.schema.$_validate(e,s,c);l.errors?(a.push(l.errors),s.restore()):(r.push(l.value),s.commit())}if(0===r.length){const e={details:a.map((e=>s.details(e,{override:!1})))};return{errors:i("alternatives.any",e)}}if("one"===n._flags.match)return 1===r.length?{value:r[0]}:{errors:i("alternatives.one")};if(r.length!==n.$_terms.matches.length){const e={details:a.map((e=>s.details(e,{override:!1})))};return{errors:i("alternatives.all",e)}}const l=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&l(e.schema)));return l(n)?{value:r.reduce(((e,r)=>t(e,r,{mergeArrays:!1})))}:{value:r[r.length-1]}}const l=[];for(let t=0;t<n.$_terms.matches.length;++t){const r=n.$_terms.matches[t];if(r.schema){const n=o.nest(r.schema,`match.${t}`);n.snapshot();const i=r.schema.$_validate(e,n,c);if(!i.errors)return n.commit(),i;n.restore(),l.push({schema:r.schema,reports:i.errors});continue}const i=r.ref?r.ref.resolve(e,o,c):e,s=r.is?[r]:r.switch;for(let n=0;n<s.length;++n){const a=s[n],{is:l,then:u,otherwise:d}=a,f=`match.${t}${r.switch?"."+n:""}`;if(l.$_match(i,o.nest(l,`${f}.is`),c)){if(u)return u.$_validate(e,o.nest(u,`${f}.then`),c)}else if(d)return d.$_validate(e,o.nest(d,`${f}.otherwise`),c)}}return a.errors(l,r)},rules:{conditional:{method(t,r){e(!this._flags._endedSwitch,"Unreachable condition"),e(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),e(void 0===r.break,"Cannot use break option with alternatives conditional");const n=this.clone(),s=i.when(n,t,r),o=s.is?[s]:s.switch;for(const e of o)if(e.then&&e.otherwise){n.$_setFlag("_endedSwitch",!0,{clone:!1});break}return n.$_terms.matches.push(s),n.$_mutateRebuild()}},match:{method(t){if(e(["any","one","all"].includes(t),"Invalid alternatives match mode",t),"any"!==t)for(const r of this.$_terms.matches)e(r.schema,"Cannot combine match mode",t,"with conditional rules");return this.$_setFlag("match",t)}},try:{method(...t){e(t.length,"Missing alternative schemas"),n.verifyFlat(t,"try"),e(!this._flags._endedSwitch,"Unreachable condition");const r=this.clone();for(const e of t)r.$_terms.matches.push({schema:r.$_compile(e)});return r.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,r)=>"is"!==r.path[0]&&"string"!=typeof t._flags.label?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{n.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:n,is:i,not:s,then:o,otherwise:a}=r;e=t?e.try(t):n?e.conditional(n,{is:i,then:o,not:s,otherwise:a,switch:r.switch}):e.conditional(i,{then:o,otherwise:a})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),a.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const n=new Set,i=[];for(const{reports:o,schema:c}of e){if(o.length>1)return a.unmatched(e,t);const l=o[0];if(l instanceof s.Report==!1)return a.unmatched(e,t);if(l.state.path.length!==r.path.length){i.push({type:c.type,report:l});continue}if("any.only"===l.code){for(const e of l.local.valids)n.add(e);continue}const[u,d]=l.code.split(".");"base"===d?n.add(u):i.push({type:c.type,report:l})}return i.length?1===i.length?{errors:i[0].report}:a.unmatched(e,t):{errors:t("alternatives.types",{types:[...n]})}},a.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",s.details(r,{override:!1}))}},xa}function lc(){if(Na)return Pa;Na=1;const e=Lr,t=tn,r=Fr,n=ac(),i=oa(),s=ua(),o={};return Pa=n.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:n}){if(!Array.isArray(e))return;const i=t.$_getRule("sort");return i?o.sort(t,e,i.args.options,r,n):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[i.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:n},{schema:i}){const s=[e,...t.ancestors];for(let n=0;n<e.length;++n){const o=t.localize([...t.path,n],s,i);if(i.$_match(e[n],o,r))return e}const o=i._flags.label;return o?n("array.hasKnown",{patternLabel:o}):n("array.hasUnknown",null)},multi:!0},items:{method(...e){i.verifyFlat(e,"items");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const n=i.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(n)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:n,prefs:s,errorsArray:a}){const c=t.$_terms._requireds.slice(),l=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...c],d=!e[i.symbols.arraySingle];delete e[i.symbols.arraySingle];const f=a();let p=e.length;for(let i=0;i<p;++i){const a=e[i];let h=!1,m=!1;const y=d?i:new Number(i),g=[...n.path,y];if(!t._flags.sparse&&void 0===a){if(f.push(r("array.sparse",{key:y,path:g,pos:i,value:void 0},n.localize(g))),s.abortEarly)return f;l.shift();continue}const _=[e,...n.ancestors];for(const e of t.$_terms._exclusions)if(e.$_match(a,n.localize(g,_,e),s,{presence:"ignore"})){if(f.push(r("array.excludes",{pos:i,value:a},n.localize(g))),s.abortEarly)return f;h=!0,l.shift();break}if(h)continue;if(t.$_terms.ordered.length){if(l.length){const c=l.shift(),u=c.$_validate(a,n.localize(g,_,c),s);if(u.errors){if(f.push(...u.errors),s.abortEarly)return f}else if("strip"===c._flags.result)o.fastSplice(e,i),--i,--p;else{if(!t._flags.sparse&&void 0===u.value){if(f.push(r("array.sparse",{key:y,path:g,pos:i,value:void 0},n.localize(g))),s.abortEarly)return f;continue}e[i]=u.value}continue}if(!t.$_terms.items.length){if(f.push(r("array.orderedLength",{pos:i,limit:t.$_terms.ordered.length})),s.abortEarly)return f;break}}const v=[];let b=c.length;for(let l=0;l<b;++l){const u=n.localize(g,_,c[l]);u.snapshot();const d=c[l].$_validate(a,u,s);if(v[l]=d,!d.errors){if(u.commit(),e[i]=d.value,m=!0,o.fastSplice(c,l),--l,--b,!t._flags.sparse&&void 0===d.value&&(f.push(r("array.sparse",{key:y,path:g,pos:i,value:void 0},n.localize(g))),s.abortEarly))return f;break}u.restore()}if(m)continue;const w=s.stripUnknown&&!!s.stripUnknown.arrays||!1;b=u.length;for(const l of u){let u;const d=c.indexOf(l);if(-1!==d)u=v[d];else{const c=n.localize(g,_,l);if(c.snapshot(),u=l.$_validate(a,c,s),!u.errors){c.commit(),"strip"===l._flags.result?(o.fastSplice(e,i),--i,--p):t._flags.sparse||void 0!==u.value?e[i]=u.value:(f.push(r("array.sparse",{key:y,path:g,pos:i,value:void 0},n.localize(g))),h=!0),m=!0;break}c.restore()}if(1===b){if(w){o.fastSplice(e,i),--i,--p,m=!0;break}if(f.push(...u.errors),s.abortEarly)return f;h=!0;break}}if(!h&&((t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!m)){if(w){o.fastSplice(e,i),--i,--p;continue}if(f.push(r("array.includes",{pos:i,value:a},n.localize(g))),s.abortEarly)return f}}return c.length&&o.fillMissedErrors(t,f,c,e,n,s),l.length&&(o.fillOrderedErrors(t,f,l,e,n,s),f.length||o.fillDefault(l,e,n,s)),f.length?f:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:s,args:o})=>i.compare(e.length,r,s)?e:t.error("array."+n,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(...e){i.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const n=i.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});o.validateSingle(n,t),t.$_mutateRegister(n),t.$_terms.ordered.push(n)}return t.$_mutateRebuild()}},single:{method(t){const r=void 0===t||!!t;return e(!r||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",r)}},sort:{method(t={}){i.assertOptions(t,["by","order"]);const r={order:t.order||"ascending"};return t.by&&(r.by=s.ref(t.by,{ancestor:0}),e(!r.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:r}})},validate(e,{error:t,state:r,prefs:n,schema:i},{options:s}){const{value:a,errors:c}=o.sort(i,e,s,r,n);if(c)return c;for(let r=0;r<e.length;++r)if(e[r]!==a[r])return t("array.sort",{order:s.order,by:s.by?s.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;if(this._flags.sparse===t)return this;return(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(t,r={}){e(!t||"function"==typeof t||"string"==typeof t,"comparator must be a function or a string"),i.assertOptions(r,["ignoreUndefined","separator"]);const n={name:"unique",args:{options:r,comparator:t}};if(t)if("string"==typeof t){const e=i.default(r.separator,".");n.path=e?t.split(e):[t]}else n.comparator=t;return this.$_addRule(n)},validate(n,{state:i,error:s,schema:o},{comparator:a,options:c},{comparator:l,path:u}){const d={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},f=l||t,p=c.ignoreUndefined;for(let t=0;t<n.length;++t){const o=u?r(n[t],u):n[t],c=l?d.custom:d[typeof o];if(e(c,"Failed to find unique map container for type",typeof o),c instanceof Map){const e=c.entries();let r;for(;!(r=e.next()).done;)if(f(r.value[0],o)){const e=i.localize([...i.path,t],[n,...i.ancestors]),o={pos:t,value:n[t],dupePos:r.value[1],dupeValue:n[r.value[1]]};return u&&(o.path=a),s("array.unique",o,e)}c.set(o,t)}else{if((!p||void 0!==o)&&void 0!==c[o]){const e={pos:t,value:n[t],dupePos:c[o],dupeValue:n[c[o]]};u&&(e.path=a);return s("array.unique",e,i.localize([...i.path,t],[n,...i.ancestors]))}c[o]=t}}return n},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)o.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)o.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),o.fillMissedErrors=function(e,t,r,n,i,s){const o=[];let a=0;for(const e of r){const t=e._flags.label;t?o.push(t):++a}o.length?a?t.push(e.$_createError("array.includesRequiredBoth",n,{knownMisses:o,unknownMisses:a},i,s)):t.push(e.$_createError("array.includesRequiredKnowns",n,{knownMisses:o},i,s)):t.push(e.$_createError("array.includesRequiredUnknowns",n,{unknownMisses:a},i,s))},o.fillOrderedErrors=function(e,t,r,n,i,s){const a=[];for(const e of r)"required"===e._flags.presence&&a.push(e);a.length&&o.fillMissedErrors(e,t,a,n,i,s)},o.fillDefault=function(e,t,r,n){const i=[];let s=!0;for(let o=e.length-1;o>=0;--o){const a=e[o],c=[t,...r.ancestors],l=a.$_validate(void 0,r.localize(r.path,c,a),n).value;if(s){if(void 0===l)continue;s=!1}i.unshift(l)}i.length&&t.push(...i)},o.fastSplice=function(e,t){let r=t;for(;r<e.length;)e[r++]=e[r];--e.length},o.validateSingle=function(t,r){("array"===t.type||t._flags._arrayItems)&&(e(!r._flags.single,"Cannot specify array item with single rule enabled"),r.$_setFlag("_arrayItems",!0,{clone:!1}))},o.sort=function(e,t,r,n,i){const s="ascending"===r.order?1:-1,a=-1*s,c=s,l=(l,u)=>{let d=o.compare(l,u,a,c);if(null!==d)return d;if(r.by&&(l=r.by.resolve(l,n,i),u=r.by.resolve(u,n,i)),d=o.compare(l,u,a,c),null!==d)return d;const f=typeof l;if(f!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,n,i);if("number"!==f&&"string"!==f)throw e.$_createError("array.sort.unsupported",t,{type:f},n,i);return"number"===f?(l-u)*s:l<u?a:c};try{return{value:t.slice().sort(l)}}catch(e){return{errors:e}}},o.compare=function(e,t,r,n){return e===t?0:void 0===e?1:void 0===t?-1:null===e?n:null===t?r:null},Pa}function uc(){if(Ma)return $a;Ma=1;const e=Lr,t=ac(),r=oa(),n=sc(),i={isBool:function(e){return"boolean"==typeof e}};return $a=t.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...t){r.verifyFlat(t,"truthy");const i=this.clone();i.$_terms.truthy=i.$_terms.truthy||new n;for(let r=0;r<t.length;++r){const n=t[r];e(void 0!==n,"Cannot call truthy with undefined"),i.$_terms.truthy.add(n)}return i}},falsy:{method(...t){r.verifyFlat(t,"falsy");const i=this.clone();i.$_terms.falsy=i.$_terms.falsy||new n;for(let r=0;r<t.length;++r){const n=t[r];e(void 0!==n,"Cannot call falsy with undefined"),i.$_terms.falsy.add(n)}return i}},sensitive:{method(e=!0){return this.$_setFlag("sensitive",e)}}},cast:{number:{from:i.isBool,to:(e,t)=>e?1:0},string:{from:i.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}}),$a}function dc(){if(La)return Da;La=1;const e=Lr,t=ac(),r=oa(),n=ia(),i={isDate:function(e){return e instanceof Date}};return Da=t.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:i.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:n}){if(e instanceof Date&&!isNaN(e.getTime()))return;const i=t._flags.format;return n.convert&&i&&"string"==typeof e?{value:e,errors:r("date.format",{format:i})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:n},{name:i,operator:s,args:o}){const a="now"===n?Date.now():n.getTime();return r.compare(e.getTime(),a,s)?e:t.error("date."+i,{limit:o.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:i.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(t){return e(["iso","javascript","unix"].includes(t),"Unknown date format",t),this.$_setFlag("format",t)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(t="javascript"){return e(["javascript","unix"].includes(t),'"type" must be one of "javascript, unix"'),this.format(t)}}},cast:{number:{from:i.isDate,to:(e,t)=>e.getTime()},string:{from:i.isDate,to:(e,{prefs:t})=>n.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),i.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return r.isIsoDate(e)?i.date(e.toString()):null;const n=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return i.date(1*e);if("unix"===t)return i.date(1e3*e);if("string"==typeof n)return null}return i.date(e)},i.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t},Da}function fc(){if(Ka)return Ba;Ka=1;const e=mn,t=Lr,r=qr,n=yn,i=ac(),s=oa(),o=ua(),a=Xo(),c=na(),l=ia(),u={renameDefaults:{alias:!1,multiple:!1,override:!1}};return Ba=i.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:n,prefs:i}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=u.clone(e,i);const s=[];if(t.$_terms.renames&&!u.rename(t,e,n,i,s))return{value:e,errors:s};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:s};const o=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...n.ancestors];for(const a of t.$_terms.keys){const t=a.key,c=e[t];o.delete(t);const l=n.localize([...n.path,t],r,a),u=a.schema.$_validate(c,l,i);if(u.errors){if(i.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),s.push(...u.errors)}else"strip"===a.schema._flags.result||void 0===u.value&&void 0!==c?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(o.size||t._flags._hasPatternMatch){const r=u.unknown(t,e,o,s,n,i);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(null!==r.key&&!1===u.isPresent(r.options)(r.key.resolve(e,n,i,null,{shadow:!1})))continue;const o=u.dependencies[r.rel](t,r,e,n,i);if(o){const r=t.$_createError(o.code,e,o.context,n,i);if(i.abortEarly)return{value:e,errors:r};s.push(r)}}return{value:e,errors:s}},rules:{and:{method(...e){return s.verifyFlat(e,"and"),u.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,r,n){l.isTemplate(e)||(e=o.ref(e)),t(void 0===n||"string"==typeof n,"Message must be a string"),r=this.$_compile(r,{appendPath:!0});const i=this.$_addRule({name:"assert",args:{subject:e,schema:r,message:n}});return i.$_mutateRegister(e),i.$_mutateRegister(r),i},validate(e,{error:t,prefs:r,state:n},{subject:i,schema:s,message:o}){const a=i.resolve(e,n,r),l=c.isRef(i)?i.absolute(n):[];return s.$_match(a,n.localize(l,[e,...n.ancestors],s),r)?e:t("object.assert",{subject:i,message:o})},args:["subject","schema","message"],multi:!0},instance:{method(e,r){return t("function"==typeof e,"constructor must be a function"),r=r||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:r}})},validate:(e,t,{constructor:r,name:n})=>e instanceof r?e:t.error("object.instance",{type:n,value:e}),args:["constructor","name"]},keys:{method(e){t(void 0===e||"object"==typeof e,"Object schema must be a valid object"),t(!s.isSchema(e),"Object schema cannot be a joi schema");const r=this.clone();if(e)if(Object.keys(e).length){r.$_terms.keys=r.$_terms.keys?r.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new u.Keys;for(const t in e)s.tryWithPath((()=>r.$_terms.keys.push({key:t,schema:this.$_compile(e[t])})),t)}else r.$_terms.keys=new u.Keys;else r.$_terms.keys=null;return r.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:n,operator:i,args:o})=>s.compare(Object.keys(e).length,r,i)?e:t.error("object."+n,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:s.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return s.verifyFlat(e,"nand"),u.dependency(this,"nand",null,e)}},or:{method(...e){return s.verifyFlat(e,"or"),u.dependency(this,"or",null,e)}},oxor:{method(...e){return u.dependency(this,"oxor",null,e)}},pattern:{method(e,r,n={}){const i=e instanceof RegExp;i||(e=this.$_compile(e,{appendPath:!0})),t(void 0!==r,"Invalid rule"),s.assertOptions(n,["fallthrough","matches"]),i&&t(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),r=this.$_compile(r,{appendPath:!0});const o=this.clone();o.$_terms.patterns=o.$_terms.patterns||[];const a={[i?"regex":"schema"]:e,rule:r};return n.matches&&(a.matches=this.$_compile(n.matches),"array"!==a.matches.type&&(a.matches=a.matches.$_root.array().items(a.matches)),o.$_mutateRegister(a.matches),o.$_setFlag("_hasPatternMatch",!0,{clone:!1})),n.fallthrough&&(a.fallthrough=!0),o.$_terms.patterns.push(a),o.$_mutateRegister(r),o}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>c.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(r,n,i={}){t("string"==typeof r||r instanceof RegExp,"Rename missing the from argument"),t("string"==typeof n||n instanceof l,"Invalid rename to argument"),t(n!==r,"Cannot rename key to same name:",r),s.assertOptions(i,["alias","ignoreUndefined","override","multiple"]);const o=this.clone();o.$_terms.renames=o.$_terms.renames||[];for(const e of o.$_terms.renames)t(e.from!==r,"Cannot rename the same key multiple times");return n instanceof l&&o.$_mutateRegister(n),o.$_terms.renames.push({from:r,to:n,options:e(u.renameDefaults,i)}),o}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!s.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return u.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return u.dependency(this,"without",e,t,r)}},xor:{method(...e){return s.verifyFlat(e,"xor"),u.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=s.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new n.Sorter;for(const r of e.$_terms.keys)s.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new u.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:n=null,peers:i,options:s}of t.dependencies)e=u.dependency(e,r,n,i,s);if(t.patterns)for(const{regex:r,schema:n,rule:i,fallthrough:s,matches:o}of t.patterns)e=e.pattern(r||n,i,{fallthrough:s,matches:o});if(t.renames)for(const{from:r,to:n,options:i}of t.renames)e=e.rename(r,n,i);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),u.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return r(e,{shallow:!0});const n=Object.create(Object.getPrototypeOf(e));return Object.assign(n,e),n}const n=function(...t){return e.apply(this,t)};return n.prototype=r(e.prototype),Object.defineProperty(n,"name",{value:e.name,writable:!1}),Object.defineProperty(n,"length",{value:e.length,writable:!1}),Object.assign(n,e),n},u.dependency=function(e,r,n,i,a){t(null===n||"string"==typeof n,r,"key must be a strings"),a||(a=i.length>1&&"object"==typeof i[i.length-1]?i.pop():{}),s.assertOptions(a,["separator","isPresent"]),i=[].concat(i);const c=s.default(a.separator,"."),l=[];for(const e of i)t("string"==typeof e,r,"peers must be strings"),l.push(o.ref(e,{separator:c,ancestor:0,prefix:!1}));null!==n&&(n=o.ref(n,{separator:c,ancestor:0,prefix:!1}));const d=e.clone();return d.$_terms.dependencies=d.$_terms.dependencies||[],d.$_terms.dependencies.push(new u.Dependency(r,n,l,i,a)),d},u.dependencies={and(e,t,r,n,i){const s=[],o=[],a=t.peers.length,c=u.isPresent(t.options);for(const e of t.peers)!1===c(e.resolve(r,n,i,null,{shadow:!1}))?s.push(e.key):o.push(e.key);if(s.length!==a&&o.length!==a)return{code:"object.and",context:{present:o,presentWithLabels:u.keysToLabels(e,o),missing:s,missingWithLabels:u.keysToLabels(e,s)}}},nand(e,t,r,n,i){const s=[],o=u.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,i,null,{shadow:!1}))&&s.push(e.key);if(s.length!==t.peers.length)return;const a=t.paths[0],c=t.paths.slice(1);return{code:"object.nand",context:{main:a,mainWithLabel:u.keysToLabels(e,a),peers:c,peersWithLabels:u.keysToLabels(e,c)}}},or(e,t,r,n,i){const s=u.isPresent(t.options);for(const e of t.peers)if(s(e.resolve(r,n,i,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:u.keysToLabels(e,t.paths)}}},oxor(e,t,r,n,i){const s=[],o=u.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,i,null,{shadow:!1}))&&s.push(e.key);if(!s.length||1===s.length)return;const a={peers:t.paths,peersWithLabels:u.keysToLabels(e,t.paths)};return a.present=s,a.presentWithLabels=u.keysToLabels(e,s),{code:"object.oxor",context:a}},with(e,t,r,n,i){const s=u.isPresent(t.options);for(const o of t.peers)if(!1===s(o.resolve(r,n,i,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:u.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:u.keysToLabels(e,o.key)}}},without(e,t,r,n,i){const s=u.isPresent(t.options);for(const o of t.peers)if(s(o.resolve(r,n,i,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:u.keysToLabels(e,t.key.key),peer:o.key,peerWithLabel:u.keysToLabels(e,o.key)}}},xor(e,t,r,n,i){const s=[],o=u.isPresent(t.options);for(const e of t.peers)o(e.resolve(r,n,i,null,{shadow:!1}))&&s.push(e.key);if(1===s.length)return;const a={peers:t.paths,peersWithLabels:u.keysToLabels(e,t.paths)};return 0===s.length?{code:"object.missing",context:a}:(a.present=s,a.presentWithLabels=u.keysToLabels(e,s),{code:"object.xor",context:a})}},u.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},u.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},u.rename=function(e,t,r,n,i){const s={};for(const o of e.$_terms.renames){const a=[],c="string"!=typeof o.from;if(c)for(const e in t){if(void 0===t[e]&&o.options.ignoreUndefined)continue;if(e===o.to)continue;const r=o.from.exec(e);r&&a.push({from:e,to:o.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,o.from)||void 0===t[o.from]&&o.options.ignoreUndefined||a.push(o);for(const u of a){const a=u.from;let d=u.to;if(d instanceof l&&(d=d.render(t,r,n,u.match)),a!==d){if(!o.options.multiple&&s[d]&&(i.push(e.$_createError("object.rename.multiple",t,{from:a,to:d,pattern:c},r,n)),n.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,d)&&!o.options.override&&!s[d]&&(i.push(e.$_createError("object.rename.override",t,{from:a,to:d,pattern:c},r,n)),n.abortEarly))return!1;void 0===t[a]?delete t[d]:t[d]=t[a],s[d]=!0,o.options.alias||delete t[a]}}}return!0},u.unknown=function(e,t,r,n,i,o){if(e.$_terms.patterns){let s=!1;const c=e.$_terms.patterns.map((e=>{if(e.matches)return s=!0,[]})),l=[t,...i.ancestors];for(const s of r){const a=t[s],u=[...i.path,s];for(let d=0;d<e.$_terms.patterns.length;++d){const f=e.$_terms.patterns[d];if(f.regex){const e=f.regex.test(s);if(i.mainstay.tracer.debug(i,"rule",`pattern.${d}`,e?"pass":"error"),!e)continue}else if(!f.schema.$_match(s,i.nest(f.schema,`pattern.${d}`),o))continue;r.delete(s);const p=i.localize(u,l,{schema:f.rule,key:s}),h=f.rule.$_validate(a,p,o);if(h.errors){if(o.abortEarly)return{value:t,errors:h.errors};n.push(...h.errors)}if(f.matches&&c[d].push(s),t[s]=h.value,!f.fallthrough)break}}if(s)for(let r=0;r<c.length;++r){const s=c[r];if(!s)continue;const u=e.$_terms.patterns[r].matches,d=i.localize(i.path,l,u),f=u.$_validate(s,d,o);if(f.errors){const r=a.details(f.errors,{override:!1});r.matches=s;const c=e.$_createError("object.pattern.match",t,r,i,o);if(o.abortEarly)return{value:t,errors:c};n.push(c)}}}if(!r.size||!e.$_terms.keys&&!e.$_terms.patterns)return;if(o.stripUnknown&&!e._flags.unknown||o.skipFunctions){const e=!!o.stripUnknown&&(!0===o.stripUnknown||!!o.stripUnknown.objects);for(const n of r)e?(delete t[n],r.delete(n)):"function"==typeof t[n]&&r.delete(n)}if(!s.default(e._flags.unknown,o.allowUnknown))for(const s of r){const r=i.localize([...i.path,s],[]),a=e.$_createError("object.unknown",t[s],{child:s},r,o,{flags:!1});if(o.abortEarly)return{value:t,errors:a};n.push(a)}},u.Dependency=class{constructor(e,t,r,n,i){this.rel=e,this.key=t,this.peers=r,this.paths=n,this.options=i}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options={...e.options,separator:this.peers[0].separator}),this.options.isPresent&&(e.options={...e.options,isPresent:this.options.isPresent}),e}},u.Keys=class extends Array{concat(e){const t=this.slice(),r=new Map;for(let e=0;e<t.length;++e)r.set(t[e].key,e);for(const n of e){const e=n.key,i=r.get(e);void 0!==i?t[i]={key:e,schema:t[i].schema.concat(n.schema)}:t.push(n)}return t}},Ba}function pc(){if(Ua)return Fa;Ua=1;const e=Lr,t=fc();return Fa=t.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(t){return e(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:t}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(t){return e(Number.isSafeInteger(t)&&t>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:t}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(t){return e(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:t}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}}),Fa}function hc(){if(Ja)return Wa;Ja=1;const e=Lr,t=ac(),r=oa(),n=ua(),i=Xo(),s={};return Wa=t.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(t,{schema:r,state:n,prefs:i}){e(r.$_terms.link,"Uninitialized link schema");const o=s.generate(r,t,n,i),a=r.$_terms.link[0].ref;return o.$_validate(t,n.nest(o,`link:${a.display}:${o.type}`),i)},generate:(e,t,r,n)=>s.generate(e,t,r,n),rules:{ref:{method(t){e(!this.$_terms.link,"Cannot reinitialize schema"),t=n.ref(t),e("value"===t.type||"local"===t.type,"Invalid reference type:",t.type),e("local"===t.type||"root"===t.ancestor||t.ancestor>0,"Link cannot reference itself");const r=this.clone();return r.$_terms.link=[{ref:t}],r}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(t){e(this.$_terms.link,"Uninitialized link schema"),e(r.isSchema(t),"Invalid schema object"),e("link"!==t.type,"Cannot merge type link with another link");const n=this.clone();return n.$_terms.whens||(n.$_terms.whens=[]),n.$_terms.whens.push({concat:t}),n.$_mutateRebuild()}},manifest:{build:(t,r)=>(e(r.link,"Invalid link description missing link"),t.ref(r.link))}}),s.generate=function(e,t,r,n){let i=r.mainstay.links.get(e);if(i)return i._generate(t,r,n).schema;const o=e.$_terms.link[0].ref,{perspective:a,path:c}=s.perspective(o,r);s.assert(a,"which is outside of schema boundaries",o,e,r,n);try{i=c.length?a.$_reach(c):a}catch(t){s.assert(!1,"to non-existing schema",o,e,r,n)}return s.assert("link"!==i.type,"which is another link",o,e,r,n),e._flags.relative||r.mainstay.links.set(e,i),i._generate(t,r,n).schema},s.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:n}of t.schemas){if((r._flags.id||n)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},s.assert=function(t,r,n,s,o,a){t||e(!1,`"${i.label(s._flags,o,a)}" contains link reference "${n.display}" ${r}`)},Wa}function mc(){if(Ga)return Ha;Ga=1;const e=Lr,t=ac(),r=oa(),n={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const t=e.toString(),r=t.indexOf("."),n=t.indexOf("e");return(r<0?0:(n<0?t.length:n)-r-1)+(n<0?0:Math.max(0,-parseInt(t.slice(n+1))))}};return Ha=t.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(n.numberRx))return;e=e.trim();const i={value:parseFloat(e)};if(0===i.value&&(i.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(n.extractSignificantDigits(e)!==n.extractSignificantDigits(String(i.value)))return i.errors=r("number.unsafe"),i}else{const t=i.value.toString();if(t.match(/e/i))return i;if(t!==n.normalizeDecimal(e))return i.errors=r("number.unsafe"),i}return i}},validate(e,{schema:t,error:n,prefs:i}){if(e===1/0||e===-1/0)return{value:e,errors:n("number.infinity")};if(!r.isNumber(e))return{value:e,errors:n("number.base")};const s={value:e};if(i.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);s.value=Math.round(s.value*t)/t}}return 0===s.value&&(s.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(s.errors=n("number.unsafe")),s},rules:{compare:{method:!1,validate:(e,t,{limit:n},{name:i,operator:s,args:o})=>r.compare(e,n,s)?e:t.error("number."+i,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:r.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const t="number"==typeof e?n.decimalPlaces(e):null,r=Math.pow(10,t);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:t,pfactor:r}})},validate:(e,t,{base:r,baseDecimalPlace:i,pfactor:s},o)=>n.decimalPlaces(e)>i?t.error("number.multiple",{multiple:o.args.base,value:e}):Math.round(s*e)%Math.round(s*r)==0?e:t.error("number.multiple",{multiple:o.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(t){return e(Number.isSafeInteger(t),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:t}})},validate(e,t,{limit:r}){const i=e.toString().match(n.precisionRx);return Math.max((i[1]?i[1].length:0)-(i[2]?parseInt(i[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(t){return e(["negative","positive"].includes(t),"Invalid sign",t),this.$_addRule({name:"sign",args:{sign:t}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(t=!0){return e("boolean"==typeof t,"enabled must be a boolean"),this.$_setFlag("unsafe",t)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),n.extractSignificantDigits=function(e){return e.replace(n.exponentialPartRegex,"").replace(n.dotRegex,"").replace(n.trailingZerosRegex,"").replace(n.leadingSignAndZerosRegex,"")},n.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e},Ha}function yc(){if(Va)return za;Va=1;const e=fc();return za=e.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})}function gc(){if(Xa)return qa;Xa=1;const e=Lr,t=vn,r=wn,n=An,i=Cn,s=Bn,o=On,a=ac(),c=oa(),l={tlds:s instanceof Set&&{tlds:{allow:s,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:n.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};return qa=a.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:n}){const i=t.$_getRule("normalize");i&&(e=e.normalize(i.args.form));const s=t.$_getRule("case");s&&(e="upper"===s.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const o=t.$_getRule("trim");if(o&&o.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const a=t.$_getRule("hex");if(a&&a.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=l.isoDate(e);t&&(e=t)}if(t._flags.truncate){const i=t.$_getRule("max");if(i){let s=i.args.limit;if(c.isResolvable(s)&&(s=s.resolve(e,r,n),!c.limit(s)))return{value:e,errors:t.$_createError("any.ref",s,{ref:i.args.limit,arg:"limit",reason:"must be a positive integer"},r,n)};e=e.slice(0,s)}}return{value:e}}},validate(e,{schema:t,error:r}){if("string"!=typeof e)return{value:e,errors:r("string.base")};if(""===e){const n=t.$_getRule("min");if(n&&0===n.args.limit)return;return{value:e,errors:r("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(t={}){return c.assertOptions(t,["paddingRequired","urlSafe"]),t={urlSafe:!1,paddingRequired:!0,...t},e("boolean"==typeof t.paddingRequired,"paddingRequired must be boolean"),e("boolean"==typeof t.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:t}})},validate:(e,t,{options:r})=>l.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(t){return e(["lower","upper"].includes(t),"Invalid case:",t),this.$_addRule({name:"case",args:{direction:t}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,n=0,i=1;for(;r--;){const t=e.charAt(r)*i;n+=t-9*(t>9),i^=3}return n>0&&n%10==0?e:t.error("string.creditCard")}},dataUri:{method(t={}){return c.assertOptions(t,["paddingRequired"]),t={paddingRequired:!0,...t},e("boolean"==typeof t.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:t}})},validate(e,t,{options:r}){const n=e.match(l.dataUriRegex);if(n){if(!n[2])return e;if("base64"!==n[2])return e;if(l.base64Regex[r.paddingRequired].false.test(n[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&c.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=l.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,r,n,{address:i})=>t.isValid(e,i)?e:r.error("string.domain")},email:{method(t={}){c.assertOptions(t,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),e(void 0===t.multiple||"boolean"==typeof t.multiple,"multiple option must be an boolean");const r=l.addressOptions(t),n=new RegExp(`\\s*[${t.separator?i(t.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:t},regex:n,address:r})},validate(e,t,{options:n},{regex:i,address:s}){const o=n.multiple?e.split(i):[e],a=[];for(const e of o)r.isValid(e,s)||a.push(e);return a.length?t.error("string.email",{value:e,invalids:a}):e}},guid:{alias:"uuid",method(t={}){c.assertOptions(t,["version","separator"]);let r="";if(t.version){const n=[].concat(t.version);e(n.length>=1,"version must have at least 1 valid version specified");const i=new Set;for(let t=0;t<n.length;++t){const s=n[t];e("string"==typeof s,"version at position "+t+" must be a string");const o=l.guidVersions[s.toLowerCase()];e(o,"version at position "+t+" must be one of "+Object.keys(l.guidVersions).join(", ")),e(!i.has(o),"version at position "+t+" must not be a duplicate"),r+=o,i.add(o)}}e(l.guidSeparators.has(t.separator),'separator must be one of true, false, "-", or ":"');const n=void 0===t.separator?"[:-]?":!0===t.separator?"[:-]":!1===t.separator?"[]?":`\\${t.separator}`,i=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${n})[0-9A-F]{4}\\2?[${r||"0-9A-F"}][0-9A-F]{3}\\2?[${r?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:t},regex:i})},validate(e,t,r,{regex:n}){const i=n.exec(e);return i?l.guidBrackets[i[1]]!==i[i.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(t={}){return c.assertOptions(t,["byteAligned","prefix"]),t={byteAligned:!1,prefix:!1,...t},e("boolean"==typeof t.byteAligned,"byteAligned must be boolean"),e("boolean"==typeof t.prefix||"optional"===t.prefix,'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:t}})},validate:(e,t,{options:r})=>("optional"===r.prefix?l.hexRegex.withOptionalPrefix:!0===r.prefix?l.hexRegex.withPrefix:l.hexRegex.withoutPrefix).test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,r)=>t.isValid(e,{minDomainSegments:1})||l.ipRegex.test(e)?e:r.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){c.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:i}=n.regex(e),s=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:s}},regex:i})},validate:(e,t,{options:r},{regex:n})=>n.test(e)?e:r.version?t.error("string.ipVersion",{value:e,cidr:r.cidr,version:r.version}):t.error("string.ip",{value:e,cidr:r.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>l.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>l.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return l.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:n},{name:i,operator:s,args:o}){const a=n?Buffer&&Buffer.byteLength(e,n):e.length;return c.compare(a,r,s)?e:t.error("string."+i,{limit:o.limit,value:e,encoding:n})},args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return l.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return l.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(t="NFC"){return e(l.normalizationForms.includes(t),"normalization form must be one of "+l.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:t}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(t,r={}){e(t instanceof RegExp,"regex must be a RegExp"),e(!t.flags.includes("g")&&!t.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof r&&(r={name:r}),c.assertOptions(r,["invert","name"]);const n=["string.pattern",r.invert?".invert":"",r.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:t,options:r},errorCode:n})},validate:(e,t,{regex:r,options:n},{errorCode:i})=>r.test(e)^n.invert?e:t.error(i,{name:n.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(t,r){"string"==typeof t&&(t=new RegExp(i(t),"g")),e(t instanceof RegExp,"pattern must be a RegExp"),e("string"==typeof r,"replacement must be a String");const n=this.clone();return n.$_terms.replacements||(n.$_terms.replacements=[]),n.$_terms.replacements.push({pattern:t,replacement:r}),n}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(t=!0){return e("boolean"==typeof t,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:t}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(t=!0){return e("boolean"==typeof t,"enabled must be a boolean"),this.$_setFlag("truncate",t)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){c.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),e.domain&&c.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=o.regex(e),n=e.domain?l.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:n,scheme:r})},validate(e,r,{options:n},{regex:i,domain:s,scheme:o}){if(["http:/","https:/"].includes(e))return r.error("string.uri");let a=i.exec(e);if(!a&&r.prefs.convert&&n.encodeUri){const t=encodeURI(e);a=i.exec(t),a&&(e=t)}if(a){const i=a[1]||a[2];return!s||n.allowRelative&&!i||t.isValid(i,s)?e:r.error("string.domain",{value:i})}return n.relativeOnly?r.error("string.uriRelativeOnly"):n.scheme?r.error("string.uriCustomScheme",{scheme:o,value:e}):r.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:n}of t.replacements)e=e.replace(r,n);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),l.addressOptions=function(t){if(!t)return l.tlds||t;if(e(void 0===t.minDomainSegments||Number.isSafeInteger(t.minDomainSegments)&&t.minDomainSegments>0,"minDomainSegments must be a positive integer"),e(void 0===t.maxDomainSegments||Number.isSafeInteger(t.maxDomainSegments)&&t.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===t.tlds)return t;if(!0===t.tlds||void 0===t.tlds)return e(l.tlds,"Built-in TLD list disabled"),Object.assign({},t,l.tlds);e("object"==typeof t.tlds,"tlds must be true, false, or an object");const r=t.tlds.deny;if(r)return Array.isArray(r)&&(t=Object.assign({},t,{tlds:{deny:new Set(r)}})),e(t.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),e(!t.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),l.validateTlds(t.tlds.deny,"tlds.deny"),t;const n=t.tlds.allow;return n?!0===n?(e(l.tlds,"Built-in TLD list disabled"),Object.assign({},t,l.tlds)):(Array.isArray(n)&&(t=Object.assign({},t,{tlds:{allow:new Set(n)}})),e(t.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),l.validateTlds(t.tlds.allow,"tlds.allow"),t):t},l.validateTlds=function(r,n){for(const i of r)e(t.isValid(i,{minDomainSegments:1,maxDomainSegments:1}),`${n} must contain valid top level domain names`)},l.isoDate=function(e){if(!c.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},l.length=function(t,r,n,i,s){return e(!s||Buffer&&Buffer.isEncoding(s),"Invalid encoding:",s),t.$_addRule({name:r,method:"length",args:{limit:n,encoding:s},operator:i})},qa}function _c(){if(Za)return Ya;Za=1;const e=Lr,t=ac(),r={};return r.Map=class extends Map{slice(){return new r.Map(this)}},Ya=t.extend({type:"symbol",terms:{map:{init:new r.Map}},coerce:{method(e,{schema:t,error:r}){const n=t.$_terms.map.get(e);return n&&(e=n),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(t){t&&!t[Symbol.iterator]&&"object"==typeof t&&(t=Object.entries(t)),e(t&&t[Symbol.iterator],"Iterable must be an iterable or object");const r=this.clone(),n=[];for(const i of t){e(i&&i[Symbol.iterator],"Entry must be an iterable");const[t,s]=i;e("object"!=typeof t&&"function"!=typeof t&&"symbol"!=typeof t,"Key must not be of type object, function, or Symbol"),e("symbol"==typeof s,"Value must be a Symbol"),r.$_terms.map.set(t,s),n.push(s)}return r.valid(...n)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}}),Ya}function vc(){if(rc)return tc;rc=1;const e=Lr,t=qr,r=aa(),n=oa(),i=ua(),s=Xo(),o=pa(),a=ya(),c=na(),l=ia(),u=va();let d;const f={types:{alternatives:cc(),any:ac(),array:lc(),boolean:uc(),date:dc(),function:pc(),link:hc(),number:mc(),object:yc(),string:gc(),symbol:_c()},aliases:{alt:"alternatives",bool:"boolean",func:"function"}};return Buffer&&(f.types.binary=function(){if(ec)return Qa;ec=1;const e=Lr,t=ac(),r=oa();return Qa=t.extend({type:"binary",coerce:{from:["string","object"],method(e,{schema:t}){if("string"==typeof e||null!==e&&"Buffer"===e.type)try{return{value:Buffer.from(e,t._flags.encoding)}}catch(e){}}},validate(e,{error:t}){if(!Buffer.isBuffer(e))return{value:e,errors:t("binary.base")}},rules:{encoding:{method(t){return e(Buffer.isEncoding(t),"Invalid encoding:",t),this.$_setFlag("encoding",t)}},length:{method(e){return this.$_addRule({name:"length",method:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:n},{name:i,operator:s,args:o})=>r.compare(e.length,n,s)?e:t.error("binary."+i,{limit:o.limit,value:e}),args:[{name:"limit",ref:!0,assert:r.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}}},cast:{string:{from:e=>Buffer.isBuffer(e),to:(e,t)=>e.toString()}},messages:{"binary.base":"{{#label}} must be a buffer or a string","binary.length":"{{#label}} must be {{#limit}} bytes","binary.max":"{{#label}} must be less than or equal to {{#limit}} bytes","binary.min":"{{#label}} must be at least {{#limit}} bytes"}}),Qa}()),f.root=function(){const t={_types:new Set(Object.keys(f.types))};for(const r of t._types)t[r]=function(...t){return e(!t.length||["alternatives","link","object"].includes(r),"The",r,"type does not allow arguments"),f.generate(this,f.types[r],t)};for(const e of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])t[e]=function(...t){return this.any()[e](...t)};Object.assign(t,f.methods);for(const e in f.aliases){const r=f.aliases[e];t[e]=t[r]}return t.x=t.expression,u.setup&&u.setup(t),t},f.methods={ValidationError:s.ValidationError,version:n.version,cache:r.provider,assert(e,t,...r){f.assert(e,t,!0,r)},attempt:(e,t,...r)=>f.assert(e,t,!1,r),build(t){return e("function"==typeof a.build,"Manifest functionality disabled"),a.build(this,t)},checkPreferences(e){n.checkPreferences(e)},compile(e,t){return i.compile(this,e,t)},defaults(t){e("function"==typeof t,"modifier must be a function");const r=Object.assign({},this);for(const i of r._types){const s=t(r[i]());e(n.isSchema(s),"modifier must return a valid schema object"),r[i]=function(...e){return f.generate(this,s,e)}}return r},expression:(...e)=>new l(...e),extend(...t){n.verifyFlat(t,"extend"),d=d||Uo(),e(t.length,"You need to provide at least one extension"),this.assert(t,d.extensions);const r=Object.assign({},this);r._types=new Set(r._types);for(let n of t){"function"==typeof n&&(n=n(r)),this.assert(n,d.extension);const t=f.expandExtension(n,r);for(const n of t){e(void 0===r[n.type]||r._types.has(n.type),"Cannot override name",n.type);const t=n.base||this.any(),i=o.type(t,n);r._types.add(n.type),r[n.type]=function(...e){return f.generate(this,i,e)}}}return r},isError:s.ValidationError.isError,isExpression:l.isTemplate,isRef:c.isRef,isSchema:n.isSchema,in:(...e)=>c.in(...e),override:n.symbols.override,ref:(...e)=>c.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in f.aliases)e[t]=this[t]();return e}},f.assert=function(e,r,i,o){const a=o[0]instanceof Error||"string"==typeof o[0]?o[0]:null,c=null!==a?o[1]:o[0],l=r.validate(e,n.preferences({errors:{stack:!0}},c||{}));let u=l.error;if(!u)return l.value;if(a instanceof Error)throw a;const d=i&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof s.ValidationError==!1&&(u=t(u)),u.message=a?`${a} ${d}`:d,u},f.generate=function(t,r,n){return e(t,"Must be invoked on a Joi instance."),r.$_root=t,r._definition.args&&n.length?r._definition.args(r,...n):r},f.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const n of t._types)if(e.type.test(n)){const i=Object.assign({},e);i.type=n,i.base=t[n](),r.push(i)}return r},tc=f.root()}var bc=Pr(vc()),wc={table:"directus_collections",defaults:{collection:null,hidden:!1,singleton:!1,icon:null,note:null,translations:null,display_template:null,accountability:"all"},data:[{collection:"directus_activity",note:"$t:directus_collection.directus_activity",accountability:null},{collection:"directus_collections",icon:"database",note:"$t:directus_collection.directus_collections"},{collection:"directus_fields",icon:"input",note:"$t:directus_collection.directus_fields"},{collection:"directus_files",icon:"folder",note:"$t:directus_collection.directus_files",display_template:"{{ $thumbnail }} {{ title }}"},{collection:"directus_folders",note:"$t:directus_collection.directus_folders",display_template:"{{ name }}"},{collection:"directus_migrations",note:"$t:directus_collection.directus_migrations"},{collection:"directus_permissions",icon:"admin_panel_settings",note:"$t:directus_collection.directus_permissions"},{collection:"directus_presets",icon:"bookmark",note:"$t:directus_collection.directus_presets",accountability:null},{collection:"directus_relations",icon:"merge_type",note:"$t:directus_collection.directus_relations"},{collection:"directus_revisions",note:"$t:directus_collection.directus_revisions",accountability:null},{collection:"directus_roles",icon:"supervised_user_circle",note:"$t:directus_collection.directus_roles"},{collection:"directus_sessions",note:"$t:directus_collection.directus_sessions"},{collection:"directus_settings",singleton:!0,note:"$t:directus_collection.directus_settings"},{collection:"directus_users",archive_field:"status",archive_value:"archived",unarchive_value:"draft",icon:"people_alt",note:"$t:directus_collection.directus_users",display_template:"{{ first_name }} {{ last_name }}"},{collection:"directus_webhooks",note:"$t:directus_collection.directus_webhooks"},{collection:"directus_dashboards",note:"$t:directus_collection.directus_dashboards"},{collection:"directus_panels",note:"$t:directus_collection.directus_panels"},{collection:"directus_notifications",note:"$t:directus_collection.directus_notifications"},{collection:"directus_shares",icon:"share",note:"$t:directus_collection.directus_shares"},{collection:"directus_flows",note:"$t:directus_collection.directus_flows"},{collection:"directus_operations",note:"$t:directus_collection.directus_operations"},{collection:"directus_translations",note:"$t:directus_collection.directus_translations"},{collection:"directus_versions",note:"$t:directus_collection.directus_versions"},{collection:"directus_extensions",note:"$t:directus_collection.directus_extensions"}]};wc.data.map((e=>({...wc.defaults,...e,system:!0}))),wc.data.map((e=>e.collection));var Sc={table:"directus_relations",defaults:{many_collection:"directus_users",many_field:null,one_collection:null,one_field:null,one_allowed_collections:null,one_collection_field:null,one_deselect_action:"nullify",junction_field:null,sort_field:null},data:[{many_collection:"directus_collections",many_field:"group",one_collection:"directus_collections"},{many_collection:"directus_users",many_field:"role",one_collection:"directus_roles",one_field:"users"},{many_collection:"directus_users",many_field:"avatar",one_collection:"directus_files"},{many_collection:"directus_revisions",many_field:"activity",one_collection:"directus_activity",one_field:"revisions"},{many_collection:"directus_revisions",many_field:"parent",one_collection:"directus_revisions"},{many_collection:"directus_revisions",many_field:"version",one_collection:"directus_versions"},{many_collection:"directus_presets",many_field:"user",one_collection:"directus_users"},{many_collection:"directus_presets",many_field:"role",one_collection:"directus_roles"},{many_collection:"directus_folders",many_field:"parent",one_collection:"directus_folders"},{many_collection:"directus_files",many_field:"folder",one_collection:"directus_folders"},{many_collection:"directus_files",many_field:"uploaded_by",one_collection:"directus_users"},{many_collection:"directus_files",many_field:"modified_by",one_collection:"directus_users"},{many_collection:"directus_fields",many_field:"collection",one_collection:"directus_collections",one_field:"fields"},{many_collection:"directus_fields",many_field:"group",one_collection:"directus_fields"},{many_collection:"directus_activity",many_field:"user",one_collection:"directus_users"},{many_collection:"directus_settings",many_field:"project_logo",one_collection:"directus_files"},{many_collection:"directus_settings",many_field:"public_foreground",one_collection:"directus_files"},{many_collection:"directus_settings",many_field:"public_background",one_collection:"directus_files"},{many_collection:"directus_settings",many_field:"public_favicon",one_collection:"directus_files"},{many_collection:"directus_settings",many_field:"storage_default_folder",one_collection:"directus_folders"},{many_collection:"directus_panels",many_field:"dashboard",one_collection:"directus_dashboards",one_field:"panels"},{many_collection:"directus_panels",many_field:"user_created",one_collection:"directus_users"},{many_collection:"directus_flows",many_field:"operation",one_collection:"directus_operations"},{many_collection:"directus_flows",many_field:"user_created",one_collection:"directus_users"},{many_collection:"directus_operations",many_field:"flow",one_collection:"directus_flows",one_field:"operations",one_deselect_action:"delete"},{many_collection:"directus_operations",many_field:"resolve",one_collection:"directus_operations"},{many_collection:"directus_operations",many_field:"reject",one_collection:"directus_operations"},{many_collection:"directus_operations",many_field:"user_created",one_collection:"directus_users"},{many_collection:"directus_permissions",many_field:"role",one_collection:"directus_roles"},{many_collection:"directus_sessions",many_field:"user",one_collection:"directus_users"},{many_collection:"directus_sessions",many_field:"share",one_collection:"directus_shares"},{many_collection:"directus_dashboards",many_field:"user_created",one_collection:"directus_users"},{many_collection:"directus_notifications",many_field:"recipient",one_collection:"directus_users"},{many_collection:"directus_notifications",many_field:"sender",one_collection:"directus_users"},{many_collection:"directus_shares",many_field:"role",one_collection:"directus_roles"},{many_collection:"directus_shares",many_field:"collection",one_collection:"directus_collections"},{many_collection:"directus_shares",many_field:"user_created",one_collection:"directus_users"},{many_collection:"directus_versions",many_field:"collection",one_collection:"directus_collections"},{many_collection:"directus_versions",many_field:"user_created",one_collection:"directus_users"},{many_collection:"directus_versions",many_field:"user_updated",one_collection:"directus_users"}]};Sc.data.map((e=>({...Sc.defaults,...e,system:!0})));var Ec={collection:null,field:null,special:null,interface:null,options:null,display:null,display_options:null,readonly:!1,hidden:!1,sort:null,width:"full",group:null,translations:null,note:null,conditions:null,required:!1},kc={table:"directus_settings",fields:[{field:"id",hidden:!0},{field:"project_name",interface:"input",options:{iconRight:"title",placeholder:"$t:field_options.directus_settings.project_name_placeholder"},width:"half"},{field:"project_descriptor",interface:"input",options:{iconRight:"title",placeholder:"$t:field_options.directus_settings.project_name_placeholder"},width:"half"},{field:"project_url",interface:"input",options:{iconRight:"link",placeholder:"https://example.com"},width:"half"},{field:"default_language",interface:"system-language",options:{iconRight:"language",placeholder:"en-US"},width:"half"},{field:"theming_group",interface:"group-raw",special:["alias","no-data","group"]},{field:"branding_divider",interface:"presentation-divider",options:{icon:"palette",title:"$t:fields.directus_settings.branding"},special:["alias","no-data"],width:"full",group:"theming_group"},{field:"project_color",interface:"select-color",note:"$t:field_options.directus_settings.project_color_note",width:"half",group:"theming_group"},{field:"project_logo",interface:"file",note:"$t:field_options.directus_settings.project_logo_note",width:"half",group:"theming_group"},{field:"public_foreground",interface:"file",width:"half",group:"theming_group"},{field:"public_background",interface:"file",width:"half",group:"theming_group"},{field:"public_favicon",interface:"file",note:"$t:field_options.directus_settings.project_favicon_note",width:"half",group:"theming_group"},{field:"public_note",interface:"input",options:{placeholder:"$t:field_options.directus_settings.public_note_placeholder",iconRight:"info"},width:"half",group:"theming_group"},{field:"theming_divider",interface:"presentation-divider",options:{icon:"palette",title:"$t:fields.directus_settings.theming"},special:["alias","no-data"],width:"full",group:"theming_group"},{field:"default_appearance",interface:"select-dropdown",width:"half",options:{choices:[{value:"auto",text:"$t:appearance_auto"},{value:"light",text:"$t:appearance_light"},{value:"dark",text:"$t:appearance_dark"}]},group:"theming_group"},{field:"default_theme_light",width:"full",interface:"system-theme",options:{appearance:"light"},group:"theming_group"},{field:"theme_light_overrides",width:"full",interface:"system-theme-overrides",options:{appearance:"light"},group:"theming_group",special:["cast-json"]},{field:"default_theme_dark",width:"full",interface:"system-theme",options:{appearance:"dark"},group:"theming_group"},{field:"theme_dark_overrides",width:"full",interface:"system-theme-overrides",options:{appearance:"dark"},group:"theming_group",special:["cast-json"]},{field:"custom_css",interface:"input-code",options:{language:"css",lineNumber:!0,template:"#app, #main-content, body {\n --v-button-background-color: #6644FF !important;\n --v-button-background-color-hover: #5E41EC !important;\n}\n"},width:"full",group:"theming_group"},{field:"modules_divider",interface:"presentation-divider",options:{icon:"menu_open",title:"$t:modules"},special:["alias","no-data"],width:"full"},{field:"module_bar",interface:"system-modules",special:["cast-json"]},{field:"security_divider",interface:"presentation-divider",options:{icon:"shield",title:"$t:security"},special:["alias","no-data"],width:"full"},{field:"auth_password_policy",interface:"select-dropdown",options:{choices:[{value:null,text:"$t:field_options.directus_settings.auth_password_policy.none_text"},{value:"/^.{8,}$/",text:"$t:field_options.directus_settings.auth_password_policy.weak_text"},{value:"/(?=^.{8,}$)(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{';'?>.<,])(?!.*\\s).*$/",text:"$t:field_options.directus_settings.auth_password_policy.strong_text"}],allowOther:!0},width:"half"},{field:"auth_login_attempts",interface:"input",options:{iconRight:"lock",placeholder:"$t:unlimited"},width:"half"},{field:"public_registration_divider",interface:"presentation-divider",options:{icon:"person_add",title:"$t:fields.directus_settings.public_registration"},special:["alias","no-data"],width:"full"},{field:"public_registration",interface:"boolean",note:"$t:fields.directus_settings.public_registration_note",width:"half",options:{label:"$t:enabled"},special:["cast-boolean"]},{field:"public_registration_role",interface:"select-dropdown-m2o",note:"$t:fields.directus_settings.public_registration_role_note",options:{template:"{{ name }}",filter:{admin_access:{_eq:!1}}},special:["m2o"],width:"half",display:"related-values",display_options:{template:"{{ name }}"}},{field:"public_registration_verify_email",interface:"boolean",note:"$t:fields.directus_settings.public_registration_verify_email_note",width:"half",options:{label:"$t:enabled"},special:["cast-boolean"]},{field:"public_registration_email_filter",interface:"system-filter",note:"$t:fields.directus_settings.public_registration_email_filter_note",options:{collectionName:"directus_users",collectionField:"email",fieldName:"email"},special:["cast-json"],width:"half"},{field:"files_divider",interface:"presentation-divider",options:{icon:"folder",title:"$t:fields.directus_settings.files_and_thumbnails"},special:["alias","no-data"],width:"full"},{field:"storage_asset_transform",interface:"select-dropdown",options:{choices:[{value:"all",text:"$t:fields.directus_settings.transformations_all"},{value:"none",text:"$t:fields.directus_settings.transformations_none"},{value:"presets",text:"$t:fields.directus_settings.transformations_presets"}]},width:"half"},{field:"storage_default_folder",interface:"system-folder",width:"half",note:"$t:interfaces.system-folder.field_hint"},{field:"storage_asset_presets",interface:"list",options:{fields:[{field:"key",name:"$t:key",type:"string",schema:{is_nullable:!1},meta:{interface:"input",options:{slug:!0,onlyOnCreate:!1},width:"full",required:!0}},{field:"fit",name:"$t:field_options.directus_settings.storage_asset_presets.fit_label",type:"string",schema:{is_nullable:!1},meta:{interface:"select-dropdown",options:{choices:[{value:"contain",text:"$t:field_options.directus_settings.storage_asset_presets.fit.contain_text"},{value:"cover",text:"$t:field_options.directus_settings.storage_asset_presets.fit.cover_text"},{value:"inside",text:"$t:field_options.directus_settings.storage_asset_presets.fit.fit_text"},{value:"outside",text:"$t:field_options.directus_settings.storage_asset_presets.fit.outside_text"}]},width:"half"}},{field:"width",name:"$t:width",type:"integer",schema:{is_nullable:!1},meta:{interface:"input",width:"half"}},{field:"height",name:"$t:height",type:"integer",schema:{is_nullable:!1},meta:{interface:"input",width:"half"}},{field:"quality",type:"integer",name:"$t:quality",schema:{default_value:80,is_nullable:!1},meta:{interface:"slider",options:{max:100,min:0,step:1},width:"half"}},{field:"withoutEnlargement",name:"$t:field_options.directus_settings.storage_asset_presets.upscaling",type:"boolean",schema:{default_value:!1},meta:{interface:"boolean",width:"half",options:{label:"$t:no_upscale"}}},{field:"format",name:"$t:format",type:"string",schema:{is_nullable:!1,default_value:""},meta:{interface:"select-dropdown",options:{allowNone:!0,choices:[{value:"auto",text:"Auto"},{value:"jpeg",text:"JPEG"},{value:"png",text:"PNG"},{value:"webp",text:"WebP"},{value:"tiff",text:"Tiff"},{value:"avif",text:"AVIF"}]},width:"half"}},{field:"transforms",name:"$t:field_options.directus_settings.additional_transforms",type:"json",schema:{is_nullable:!1,default_value:[]},meta:{note:"$t:field_options.directus_settings.transforms_note",interface:"json",options:{template:'[\n ["blur", 45],\n ["grayscale"],\n ["extend", { "right": 500, "background": "rgb(255, 0, 0)" }]\n]\n',placeholder:'[\n ["blur", 45],\n ["grayscale"],\n ["extend", { "right": 500, "background": "rgb(255, 0, 0)" }]\n]\n'},width:"full"}}],template:"{{key}}"},special:["cast-json"],width:"full"},{field:"reporting_divider",interface:"presentation-divider",options:{icon:"feedback",title:"$t:fields.directus_settings.reporting"},special:["alias","no-data"],width:"full"},{field:"report_feature_url",interface:"input",options:{iconRight:"link",placeholder:"https://example.com/feature"},width:"half"},{field:"report_bug_url",interface:"input",options:{iconRight:"link",placeholder:"https://example.com/bug"},width:"half"},{field:"report_error_url",interface:"system-display-template",options:{placeholder:"https://example.com/error",fields:[{name:"Error",field:"error",key:"error",path:"error",children:[{name:"Name",field:"name",key:"error.name",path:"error.name"},{name:"Message",field:"message",key:"error.message",path:"error.message"}]},{name:"Navigator",field:"navigator",key:"navigator",path:"navigator",children:[{name:"Language",field:"language",key:"navigator.language",path:"navigator.language"},{name:"User Agent",field:"userAgent",key:"navigator.userAgent",path:"navigator.userAgent"}]},{name:"Route",field:"route",key:"route",path:"route",children:[{name:"Full Path",field:"fullPath",key:"route.fullPath",path:"route.fullPath"},{name:"Hash",field:"hash",key:"route.hash",path:"route.hash"},{name:"Name",field:"name",key:"route.name",path:"route.name"},{name:"Path",field:"path",key:"route.path",path:"route.path"},{name:"Query",field:"query",key:"route.query",path:"route.query"}]},{name:"User",field:"user",key:"user",path:"user",children:[{name:"ID",field:"id",key:"user.id",path:"user.id"},{name:"First Name",field:"first_name",key:"user.first_name",path:"user.first_name"},{name:"Last Name",field:"last_name",key:"user.last_name",path:"user.last_name"},{name:"Status",field:"status",key:"user.status",path:"user.status"},{name:"Title",field:"title",key:"user.title",path:"user.title"},{name:"Description",field:"description",key:"user.description",path:"user.description"},{name:"Location",field:"location",key:"user.location",path:"user.location"}]},{name:"Role",field:"role",key:"role",path:"role",children:[{name:"ID",field:"id",key:"role.id",path:"role.id"},{name:"Name",field:"name",key:"role.name",path:"role.name"}]}]},width:"full"},{field:"map_divider",interface:"presentation-divider",options:{icon:"map",title:"$t:fields.directus_settings.mapping"},special:["alias","no-data"],width:"full"},{field:"mapbox_key",interface:"input",options:{icon:"key",title:"$t:field_options.directus_settings.mapbox_key",placeholder:"$t:field_options.directus_settings.mapbox_placeholder",iconLeft:"vpn_key",font:"monospace"},width:"full"},{field:"basemaps",interface:"list",special:["cast-json"],options:{template:"{{name}}",fields:[{field:"name",name:"$t:name",schema:{is_nullable:!1},meta:{interface:"text-input",required:!0,options:{placeholder:"$t:field_options.directus_settings.basemaps_name_placeholder"}}},{field:"type",name:"$t:type",meta:{interface:"select-dropdown",options:{choices:[{value:"raster",text:"$t:field_options.directus_settings.basemaps_raster"},{value:"tile",text:"$t:field_options.directus_settings.basemaps_tile"},{value:"style",text:"$t:field_options.directus_settings.basemaps_style"}]}}},{field:"url",name:"$t:url",schema:{is_nullable:!1},meta:{interface:"text-input",options:{placeholder:"http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png"}}},{field:"tileSize",name:"$t:tile_size",type:"integer",schema:{is_nullable:!0},meta:{interface:"input",options:{placeholder:"512"},conditions:[{name:"typeNeqRaster",rule:{type:{_neq:"raster"}},hidden:!0}]}},{field:"attribution",name:"$t:fields.directus_settings.attribution",type:"string",schema:{is_nullable:!0},meta:{interface:"input",options:{placeholder:"$t:fields.directus_settings.attribution_placeholder"}}}]}},{field:"image_editor",interface:"presentation-divider",options:{icon:"image",title:"$t:fields.directus_settings.image_editor"},special:["alias","no-data"],width:"full"},{field:"custom_aspect_ratios",interface:"list",special:["cast-json"],options:{template:"{{text}}",fields:[{field:"text",name:"$t:text",type:"string",meta:{interface:"text-input",width:"half",required:!0,options:{placeholder:"$t:text"}}},{field:"value",name:"$t:value",type:"float",meta:{interface:"input",width:"half",required:!0,options:{placeholder:"$t:value"}}}]}}]},Ac=[];function Oc(e){let{fields:t,table:r}=e;t.forEach(((e,t)=>{Ac.push({system:!0,...Ec,...e,collection:r,sort:t+1})}))}Oc({table:"directus_activity",fields:[{field:"id",width:"half"},{field:"item",width:"half"},{field:"action",display:"labels",display_options:{choices:[{text:"$t:field_options.directus_activity.create",value:"create",foreground:"var(--theme--primary)",background:"var(--theme--primary-subdued)"},{text:"$t:field_options.directus_activity.update",value:"update",foreground:"var(--blue)",background:"var(--blue-25)"},{text:"$t:field_options.directus_activity.delete",value:"delete",foreground:"var(--theme--danger)",background:"var(--danger-25)"},{text:"$t:field_options.directus_activity.login",value:"login",foreground:"var(--purple)",background:"var(--purple-25)"}]},width:"half"},{field:"collection",display:"collection",display_options:{icon:!0},width:"half"},{field:"timestamp",display:"datetime",special:["date-created","cast-timestamp"],options:{relative:!0},width:"half"},{field:"user",display:"user",width:"half"},{field:"comment",display:"formatted-value",display_options:{color:"var(--theme--foreground-subdued)"},width:"half"},{field:"user_agent",display:"formatted-value",display_options:{font:"monospace"},width:"half"},{field:"origin",display:"formatted-value",display_options:{font:"monospace"},width:"half"},{field:"ip",display:"formatted-value",display_options:{font:"monospace"},width:"half"},{field:"revisions",interface:"list-o2m",special:["o2m"],options:{fields:["collection","item"]},width:"half"}]}),Oc({table:"directus_collections",fields:[{field:"collection_divider",special:["alias","no-data"],interface:"presentation-divider",options:{icon:"box",title:"$t:field_options.directus_collections.collection_setup"},width:"full"},{field:"collection",interface:"input",options:{font:"monospace"},readonly:!0,width:"half"},{field:"note",interface:"input",options:{placeholder:"$t:field_options.directus_collections.note_placeholder"},width:"half"},{field:"icon",interface:"select-icon",options:null,width:"half"},{field:"color",interface:"select-color",options:{placeholder:"$t:interfaces.select-color.placeholder"},width:"half"},{field:"display_template",interface:"system-display-template",options:{collectionField:"collection"},width:"full"},{field:"hidden",special:["cast-boolean"],interface:"boolean",options:{label:"$t:field_options.directus_collections.hidden_label"},width:"half"},{field:"singleton",special:["cast-boolean"],interface:"boolean",options:{label:"$t:singleton_label"},width:"half"},{field:"translations",special:["cast-json"],interface:"list",options:{template:"{{ translation }} ({{ language }})",fields:[{field:"language",name:"$t:language",type:"string",schema:{default_value:"en-US"},meta:{interface:"system-language",width:"half",required:!0}},{field:"translation",name:"$t:field_options.directus_collections.collection_name",type:"string",meta:{interface:"input",width:"half",required:!0,options:{placeholder:"$t:field_options.directus_collections.translation_placeholder"}}},{field:"singular",name:"$t:field_options.directus_collections.singular_unit",type:"string",meta:{interface:"input",width:"half",options:{placeholder:"$t:field_options.directus_collections.translation_placeholder"}}},{field:"plural",name:"$t:field_options.directus_collections.plural_unit",type:"string",meta:{interface:"input",width:"half",options:{placeholder:"$t:field_options.directus_collections.translation_placeholder"}}}]},width:"full"},{field:"preview_divider",special:["alias","no-data"],interface:"presentation-divider",options:{icon:"preview",title:"$t:field_options.directus_collections.preview_divider"},width:"full"},{field:"preview_url",interface:"system-display-template",options:{collectionField:"collection",injectVersionField:!0},width:"full"},{field:"content_versioning_divider",special:["alias","no-data"],interface:"presentation-divider",options:{icon:"published_with_changes",title:"$t:field_options.directus_collections.content_versioning_divider"},width:"full"},{field:"versioning",interface:"boolean",special:["cast-boolean"],options:{label:"$t:field_options.directus_collections.enable_versioning"},width:"half"},{field:"archive_divider",special:["alias","no-data"],interface:"presentation-divider",options:{icon:"archive",title:"$t:field_options.directus_collections.archive_divider"},width:"full"},{field:"archive_field",interface:"system-field",options:{collectionField:"collection",allowNone:!0,placeholder:"$t:field_options.directus_collections.archive_field_placeholder"},width:"half"},{field:"archive_app_filter",interface:"boolean",special:["cast-boolean"],options:{label:"$t:field_options.directus_collections.archive_app_filter"},width:"half"},{field:"archive_value",interface:"input",options:{font:"monospace",iconRight:"archive",placeholder:"$t:field_options.directus_collections.archive_value"},width:"half"},{field:"unarchive_value",interface:"input",options:{font:"monospace",iconRight:"unarchive",placeholder:"$t:field_options.directus_collections.unarchive_value"},width:"half"},{field:"sort_divider",special:["alias","no-data"],interface:"presentation-divider",options:{icon:"sort",title:"$t:field_options.directus_collections.sort_divider"},width:"full"},{field:"sort_field",interface:"system-field",options:{collectionField:"collection",placeholder:"$t:field_options.directus_collections.sort_field",typeAllowList:["float","decimal","integer"],allowNone:!0,allowPrimaryKey:!1,allowForeignKeys:!1},width:"half"},{field:"accountability_divider",special:["alias","no-data"],interface:"presentation-divider",options:{icon:"admin_panel_settings",title:"$t:field_options.directus_collections.accountability_divider"},width:"full"},{field:"accountability",interface:"select-dropdown",options:{choices:[{text:"$t:field_options.directus_collections.track_activity_revisions",value:"all"},{text:"$t:field_options.directus_collections.only_track_activity",value:"activity"},{text:"$t:field_options.directus_collections.do_not_track_anything",value:null}]},width:"half"},{field:"duplication_divider",special:["alias","no-data"],interface:"presentation-divider",options:{icon:"content_copy",title:"$t:field_options.directus_collections.duplication_divider"}},{field:"item_duplication_fields",special:["cast-json"],interface:"system-field-tree",options:{collectionField:"collection"}},{field:"sort",hidden:!0},{field:"group",hidden:!0},{field:"collapse",hidden:!0}]}),Oc({table:"directus_fields",fields:[{collection:"directus_fields",field:"id",width:"half"},{collection:"directus_fields",field:"collection",width:"half"},{collection:"directus_fields",field:"field",width:"half"},{collection:"directus_fields",field:"special",hidden:!0,special:["cast-csv"],width:"half"},{collection:"directus_fields",field:"interface",width:"half"},{collection:"directus_fields",field:"options",hidden:!0,special:["cast-json"],width:"half"},{collection:"directus_fields",field:"display",width:"half"},{collection:"directus_fields",field:"display_options",hidden:!0,special:["cast-json"],width:"half"},{collection:"directus_fields",field:"readonly",hidden:!0,special:["cast-boolean"],width:"half"},{collection:"directus_fields",field:"hidden",hidden:!0,special:["cast-boolean"],width:"half"},{collection:"directus_fields",field:"required",hidden:!0,special:["cast-boolean"],width:"half"},{collection:"directus_fields",field:"sort",width:"half"},{collection:"directus_fields",field:"width",width:"half"},{collection:"directus_fields",field:"group",width:"half"},{collection:"directus_fields",field:"translations",hidden:!0,special:["cast-json"],width:"half"},{collection:"directus_fields",field:"note",width:"half"},{collection:"directus_fields",field:"conditions",hidden:!0,special:["cast-json"]},{collection:"directus_fields",field:"validation",hidden:!0,special:["cast-json"]},{collection:"directus_fields",field:"validation_message",hidden:!0}]}),Oc({table:"directus_files",fields:[{field:"id",hidden:!0,interface:"input",special:["uuid"]},{field:"title",interface:"input",options:{iconRight:"title",placeholder:"$t:field_options.directus_files.title"},width:"full"},{field:"description",interface:"input-multiline",width:"full",options:{placeholder:"$t:field_options.directus_files.description"}},{field:"tags",interface:"tags",options:{iconRight:"local_offer"},special:["cast-json"],width:"full",display:"labels",display_options:{choices:null,format:!1}},{field:"location",interface:"input",options:{iconRight:"place",placeholder:"$t:field_options.directus_files.location"},width:"half"},{field:"storage",interface:"input",options:{iconRight:"storage"},width:"half",readonly:!0},{field:"focal_point_divider",interface:"presentation-divider",options:{icon:"image_search",title:"$t:field_options.directus_files.focal_point_divider"},special:["alias","no-data"],width:"full"},{field:"focal_point_x",width:"half"},{field:"focal_point_y",width:"half"},{field:"storage_divider",interface:"presentation-divider",options:{icon:"insert_drive_file",title:"$t:field_options.directus_files.storage_divider"},special:["alias","no-data"],width:"full"},{field:"filename_disk",interface:"input",options:{iconRight:"publish",placeholder:"$t:field_options.directus_files.filename_disk"},readonly:!0,width:"half"},{field:"filename_download",interface:"input",options:{iconRight:"get_app",placeholder:"$t:field_options.directus_files.filename_download"},width:"half"},{field:"metadata",hidden:!0,special:["cast-json"]},{field:"type",display:"mime-type",readonly:!0},{field:"filesize",display:"filesize",readonly:!0},{field:"modified_by",interface:"select-dropdown-m2o",special:["user-updated"],width:"half",display:"user",readonly:!0,options:{template:"{{avatar.$thumbnail}} {{first_name}} {{last_name}}"}},{field:"modified_on",interface:"datetime",special:["date-updated"],width:"half",display:"datetime",readonly:!0},{field:"embed",width:"half",hidden:!0},{field:"uploaded_by",display:"user",width:"half",hidden:!0,special:["user-created"]},{field:"uploaded_on",display:"datetime",width:"half",hidden:!0},{field:"folder",width:"half",readonly:!0,special:["m2o"],display:"related-values",display_options:{template:"{{ name }}"}},{field:"width",width:"half",readonly:!0},{field:"height",width:"half",readonly:!0},{field:"charset",width:"half",readonly:!0},{field:"duration",width:"half",readonly:!0}]}),Oc({table:"directus_folders",fields:[{field:"id",interface:"input",special:["uuid"],width:"half"},{field:"parent",width:"half"},{field:"name",width:"full"}]}),Oc({table:"directus_migrations",fields:[{collection:"directus_migrations",field:"version"},{collection:"directus_migrations",field:"name"},{collection:"directus_migrations",field:"timestamp"}]}),Oc({table:"directus_permissions",fields:[{field:"permissions",hidden:!0,special:["cast-json"],width:"half"},{field:"presets",hidden:!0,special:["cast-json"],width:"half"},{field:"role",width:"half"},{field:"collection",width:"half"},{field:"id",width:"half"},{field:"fields",width:"half",special:["cast-csv"]},{field:"action",width:"half"},{field:"validation",width:"half",special:["cast-json"]}]}),Oc({table:"directus_presets",fields:[{field:"filter",hidden:!0,special:["cast-json"]},{field:"layout_query",hidden:!0,special:["cast-json"]},{field:"layout_options",hidden:!0,special:["cast-json"]},{field:"role",width:"half",special:["m2o"],display:"related-values",display_options:{template:"{{ name }}"}},{field:"user",width:"half",special:["m2o"],display:"related-values",display_options:{template:"{{ email }}"}},{field:"id",width:"half"},{field:"bookmark",width:"half"},{field:"icon",width:"half"},{field:"color",width:"half"},{field:"search",width:"half"},{field:"collection",width:"half"},{field:"layout",width:"half"},{field:"refresh_interval"}]}),Oc({table:"directus_relations",fields:[{field:"id",width:"half"},{field:"many_collection",width:"half"},{field:"many_field",width:"half"},{field:"one_collection",width:"half"},{field:"one_field",width:"half"},{field:"one_collection_field",width:"half"},{field:"one_allowed_collections",special:["cast-csv"],width:"half"},{field:"junction_field",width:"half"},{field:"sort_field",width:"half"},{field:"one_deselect_action",width:"half"}]}),Oc({table:"directus_revisions",fields:[{field:"id",width:"half"},{field:"activity",width:"half"},{field:"collection",width:"half"},{field:"item",width:"half"},{field:"data",hidden:!0,special:["cast-json"]},{field:"delta",hidden:!0,special:["cast-json"]},{field:"parent",width:"half"},{field:"version",width:"half"}]}),Oc({table:"directus_roles",fields:[{field:"id",hidden:!0,interface:"input",special:["uuid"]},{field:"name",interface:"input",options:{placeholder:"$t:field_options.directus_roles.name"},width:"half"},{field:"icon",interface:"select-icon",display:"icon",width:"half"},{field:"description",interface:"input",options:{placeholder:"$t:field_options.directus_roles.description"},width:"full"},{field:"app_access",interface:"boolean",special:["cast-boolean"],width:"half"},{field:"admin_access",interface:"boolean",special:["cast-boolean"],width:"half"},{field:"ip_access",interface:"tags",options:{placeholder:"$t:field_options.directus_roles.ip_access"},special:["cast-csv"],width:"full"},{field:"enforce_tfa",interface:"boolean",special:["cast-boolean"],width:"half"},{field:"users",interface:"list-o2m",special:["o2m"],options:{fields:["first_name","last_name"]},width:"full"}]}),Oc({table:"directus_sessions",fields:[{field:"token",width:"half"},{field:"user",width:"half"},{field:"expires",width:"half"},{field:"ip",width:"half"},{field:"user_agent",width:"half"},{field:"origin",width:"half"},{field:"share",width:"half"},{field:"next_token",width:"half"}]}),Oc(kc),Oc({table:"directus_users",fields:[{field:"first_name",interface:"input",options:{iconRight:"account_circle"},width:"half"},{field:"last_name",interface:"input",options:{iconRight:"account_circle"},width:"half"},{field:"email",interface:"input",options:{iconRight:"email"},width:"half"},{field:"password",special:["hash","conceal"],interface:"input-hash",options:{iconRight:"lock",masked:!0},width:"half"},{field:"avatar",interface:"file",width:"full",display:"image"},{field:"location",interface:"input",options:{iconRight:"place"},width:"half"},{field:"title",interface:"input",options:{iconRight:"work"},width:"half"},{field:"description",interface:"input-multiline",width:"full"},{field:"tags",interface:"tags",special:["cast-json"],width:"full",options:{iconRight:"local_offer"},display:"labels",display_options:{choices:null,format:!1}},{field:"preferences_divider",interface:"presentation-divider",options:{icon:"face",title:"$t:fields.directus_users.user_preferences"},special:["alias","no-data"],width:"full"},{field:"language",interface:"system-language",width:"half",options:{includeProjectDefault:!0}},{field:"tfa_secret",interface:"system-mfa-setup",special:["conceal"],width:"half"},{field:"email_notifications",interface:"boolean",width:"half",special:["cast-boolean"]},{field:"theming_divider",interface:"presentation-divider",options:{icon:"palette",title:"$t:theme"},special:["alias","no-data"],width:"full"},{field:"appearance",interface:"select-dropdown",options:{choices:[{value:null,text:"$t:default_sync_with_project"},{value:"auto",text:"$t:appearance_auto"},{value:"light",text:"$t:appearance_light"},{value:"dark",text:"$t:appearance_dark"}]},width:"half"},{field:"theme_light",width:"full",interface:"system-theme",options:{appearance:"light",includeNull:!0}},{field:"theme_light_overrides",width:"full",interface:"system-theme-overrides",options:{appearance:"light"},special:["cast-json"]},{field:"theme_dark",width:"full",interface:"system-theme",options:{appearance:"dark",includeNull:!0}},{field:"theme_dark_overrides",width:"full",interface:"system-theme-overrides",options:{appearance:"dark"},special:["cast-json"]},{field:"admin_divider",interface:"presentation-divider",options:{icon:"verified_user",title:"$t:fields.directus_users.admin_options",color:"var(--theme--danger)"},special:["alias","no-data"],width:"full"},{field:"status",interface:"select-dropdown",options:{choices:[{text:"$t:fields.directus_users.status_draft",value:"draft"},{text:"$t:fields.directus_users.status_invited",value:"invited"},{text:"$t:fields.directus_users.status_unverified",value:"unverified"},{text:"$t:fields.directus_users.status_active",value:"active"},{text:"$t:fields.directus_users.status_suspended",value:"suspended"},{text:"$t:fields.directus_users.status_archived",value:"archived"}]},width:"half"},{field:"role",interface:"select-dropdown-m2o",options:{template:"{{ name }}"},special:["m2o"],width:"half",display:"related-values",display_options:{template:"{{ name }}"}},{field:"token",interface:"system-token",special:["conceal"],width:"full"},{field:"id",special:["uuid"],interface:"input",options:{iconRight:"vpn_key"},width:"full"},{field:"last_page",width:"half"},{field:"last_access",width:"half",display:"datetime",readonly:!0,display_options:{relative:!0}},{field:"provider",width:"half",interface:"select-dropdown",options:{choices:[{text:"$t:default_provider",value:"default"}]}},{field:"external_identifier",width:"half",options:{iconRight:"account_circle"},interface:"input"},{field:"auth_data",hidden:!0}]}),Oc({table:"directus_webhooks",fields:[{field:"id",hidden:!0},{field:"name",interface:"input",options:{iconRight:"title"},width:"full"},{field:"method",interface:"select-dropdown",display:"labels",display_options:{choices:[{value:"POST",foreground:"var(--theme--primary)",background:"var(--theme--primary-subdued)"},{value:"GET",foreground:"var(--theme--secondary)",background:"var(--secondary-25)"}],format:!1},options:{choices:["GET","POST"]},width:"half"},{field:"url",interface:"input",options:{iconRight:"link"},width:"half"},{field:"status",interface:"select-dropdown",display:"labels",display_options:{showAsDot:!0,choices:[{text:"$t:field_options.directus_webhooks.status_options_active",value:"active",foreground:"var(--theme--primary-background)",background:"var(--theme--primary)"},{text:"$t:field_options.directus_webhooks.status_options_inactive",value:"inactive",foreground:"var(--theme--foreground)",background:"var(--background-normal-alt)"}]},options:{choices:[{text:"$t:field_options.directus_webhooks.status_options_active",value:"active"},{text:"$t:field_options.directus_webhooks.status_options_inactive",value:"inactive"}]},width:"half"},{field:"data",interface:"boolean",options:{label:"$t:fields.directus_webhooks.data_label"},special:["cast-boolean"],width:"half",display:"boolean"},{field:"headers",special:["cast-json"],interface:"list",options:{template:"{{ header }}: {{ value }}",addLabel:"$t:field_options.directus_webhooks.headers.add",fields:[{field:"header",name:"$t:field_options.directus_webhooks.headers.header",type:"string",meta:{interface:"input",width:"half"}},{field:"value",name:"$t:field_options.directus_webhooks.headers.value",type:"string",meta:{interface:"input",width:"half"}}]},width:"full"},{field:"triggers_divider",interface:"presentation-divider",options:{icon:"api",title:"$t:fields.directus_webhooks.triggers"},special:["alias","no-data"],width:"full"},{field:"actions",interface:"select-multiple-checkbox",options:{choices:[{text:"$t:create",value:"create"},{text:"$t:update",value:"update"},{text:"$t:delete_label",value:"delete"}]},special:["cast-csv"],width:"full",display:"labels",display_options:{choices:[{text:"$t:create",value:"create",foreground:"var(--theme--primary)",background:"var(--theme--primary-subdued)"},{text:"$t:update",value:"update",foreground:"var(--blue)",background:"var(--blue-25)"},{text:"$t:delete_label",value:"delete",foreground:"var(--theme--danger)",background:"var(--danger-25)"},{text:"$t:login",value:"login",foreground:"var(--purple)",background:"var(--purple-25)"}]}},{field:"collections",interface:"system-collections",special:["cast-csv"],width:"full",display:"labels",display_options:{choices:null,format:!1}},{field:"was_active_before_deprecation",hidden:!0},{field:"migrated_flow",hidden:!0}]}),Oc({table:"directus_dashboards",fields:[{field:"id",special:["uuid"]},{field:"name"},{field:"icon"},{field:"panels",special:["o2m"]},{field:"date_created",special:["date-created","cast-timestamp"]},{field:"user_created",special:["user-created"]},{field:"note"},{field:"color"}]}),Oc({table:"directus_panels",fields:[{field:"id",special:["uuid"]},{field:"name"},{field:"icon"},{field:"color"},{field:"note"},{field:"type"},{field:"show_header",special:["cast-boolean"]},{field:"position_x"},{field:"position_y"},{field:"width"},{field:"height"},{field:"options",special:["cast-json"]},{field:"date_created",special:["date-created","cast-timestamp"]},{field:"user_created",special:["user-created"]},{field:"dashboard"}]}),Oc({table:"directus_notifications",fields:[{field:"id"},{field:"timestamp",special:["date-created","cast-timestamp"]},{field:"status"},{field:"recipient"},{field:"sender"},{field:"subject"},{field:"message"},{field:"collection"},{field:"item"}]}),Oc({table:"directus_shares",fields:[{field:"id",special:["uuid"],readonly:!0,hidden:!0},{field:"name"},{field:"collection",width:"half",hidden:!0},{field:"item",width:"half",hidden:!0},{field:"role",interface:"select-dropdown-m2o",width:"half",options:{template:"{{name}}",filter:{admin_access:{_eq:!1}}}},{field:"password",special:["hash","conceal"],interface:"input-hash",options:{iconRight:"lock",masked:!0},width:"half",note:"$t:shared_leave_blank_for_passwordless_access"},{field:"date_start",width:"half",note:"$t:shared_leave_blank_for_unlimited"},{field:"date_end",width:"half",note:"$t:shared_leave_blank_for_unlimited"},{field:"max_uses",width:"half",note:"$t:shared_leave_blank_for_unlimited"},{field:"times_used",width:"half",readonly:!0},{field:"date_created",special:["date-created","cast-timestamp"],width:"half",readonly:!0,conditions:[{name:"notCreatedYet",rule:{id:{_null:!0}},hidden:!0}]},{field:"user_created",special:["user-created"],interface:"select-dropdown-m2o",width:"half",display:"user",options:{template:"{{avatar.$thumbnail}} {{first_name}} {{last_name}}"},readonly:!0,conditions:[{name:"notCreatedYet",rule:{id:{_null:!0}},hidden:!0}]}]}),Oc({table:"directus_flows",fields:[{field:"id",special:["uuid"]},{field:"name"},{field:"icon"},{field:"color"},{field:"description"},{field:"status"},{field:"trigger"},{field:"accountability"},{field:"options",special:["cast-json"]},{field:"operation"},{field:"operations",special:["o2m"]},{field:"date_created",special:["date-created"]},{field:"user_created",special:["user-created"]}]}),Oc({table:"directus_operations",fields:[{field:"id",special:["uuid"]},{field:"name"},{field:"key"},{field:"type"},{field:"position_x"},{field:"position_y"},{field:"options",special:["cast-json"]},{field:"resolve"},{field:"reject"},{field:"flow"},{field:"date_created",special:["date-created"]},{field:"user_created",special:["user-created"]}]}),Oc({table:"directus_translations",fields:[{field:"id",hidden:!0,sort:1,special:["uuid"]},{field:"key",width:"half",sort:2,required:!0,interface:"input",options:{font:"monospace",placeholder:"$t:translation_key_placeholder"}},{field:"language",interface:"system-language",width:"half",sort:3,required:!0},{field:"value",interface:"input-multiline",sort:4,required:!0,options:{placeholder:"$t:enter_a_value"}}]}),Oc({table:"directus_versions",fields:[{field:"id",special:["uuid"],readonly:!0,hidden:!0},{field:"key"},{field:"name"},{field:"collection"},{field:"item"},{field:"hash",readonly:!0,hidden:!0},{field:"date_created",special:["date-created","cast-timestamp"]},{field:"date_updated",special:["date-updated","cast-timestamp"]},{field:"user_created",special:["user-created"]},{field:"user_updated",special:["user-updated"]}]}),Oc({table:"directus_extensions",fields:[{collection:"directus_extensions",field:"id",special:["uuid"]},{collection:"directus_extensions",field:"folder"},{collection:"directus_extensions",field:"source"},{collection:"directus_extensions",field:"bundle"},{collection:"directus_extensions",field:"enabled",special:["cast-boolean"]}]});var Cc={role:null,permissions:{},validation:null,presets:null,fields:["*"],system:!0},Tc=[{collection:"directus_collections",action:"read"},{collection:"directus_fields",action:"read"},{collection:"directus_permissions",action:"read",permissions:{role:{_eq:"$CURRENT_ROLE"}}},{collection:"directus_relations",action:"read"}].map((e=>({...Cc,...e})));function Rc(e,t){if("__proto__"!==e)return t}function Ic(e){return"string"==typeof e?e.split(","):Array.isArray(e)?e:[e]}[...Tc,{collection:"directus_activity",action:"read",permissions:{user:{_eq:"$CURRENT_USER"}}},{collection:"directus_activity",action:"create",validation:{comment:{_nnull:!0}}},{collection:"directus_presets",action:"read",permissions:{_or:[{user:{_eq:"$CURRENT_USER"}},{_and:[{user:{_null:!0}},{role:{_eq:"$CURRENT_ROLE"}}]},{_and:[{user:{_null:!0}},{role:{_null:!0}}]}]}},{collection:"directus_presets",action:"create",validation:{user:{_eq:"$CURRENT_USER"}}},{collection:"directus_presets",action:"update",permissions:{user:{_eq:"$CURRENT_USER"}}},{collection:"directus_presets",action:"delete",permissions:{user:{_eq:"$CURRENT_USER"}}},{collection:"directus_roles",action:"read",permissions:{id:{_eq:"$CURRENT_ROLE"}}},{collection:"directus_settings",action:"read"},{collection:"directus_translations",action:"read"},{collection:"directus_notifications",action:"read",permissions:{recipient:{_eq:"$CURRENT_USER"}}},{collection:"directus_notifications",action:"update",permissions:{recipient:{_eq:"$CURRENT_USER"}},fields:["status"]},{collection:"directus_shares",action:"read",permissions:{user_created:{_eq:"$CURRENT_USER"}}},{collection:"directus_users",action:"read",permissions:{id:{_eq:"$CURRENT_USER"}},fields:["id","first_name","last_name","last_page","email","password","location","title","description","tags","preferences_divider","avatar","language","appearance","theme_light","theme_dark","tfa_secret","status","role"]}].map((e=>({...Cc,...e}))),bc.extend({type:"string",base:bc.string(),messages:{"string.contains":"{{#label}} must contain [{{#substring}}]","string.icontains":"{{#label}} must contain case insensitive [{{#substring}}]","string.ncontains":"{{#label}} can't contain [{{#substring}}]"},rules:{contains:{args:[{name:"substring",ref:!0,assert:e=>"string"==typeof e,message:"must be a string"}],method(e){return this.$_addRule({name:"contains",args:{substring:e}})},validate:(e,t,{substring:r})=>!1===e.includes(r)?t.error("string.contains",{substring:r}):e},icontains:{args:[{name:"substring",ref:!0,assert:e=>"string"==typeof e,message:"must be a string"}],method(e){return this.$_addRule({name:"icontains",args:{substring:e}})},validate:(e,t,{substring:r})=>!1===e.toLowerCase().includes(r.toLowerCase())?t.error("string.icontains",{substring:r}):e},ncontains:{args:[{name:"substring",ref:!0,assert:e=>"string"==typeof e,message:"must be a string"}],method(e){return this.$_addRule({name:"ncontains",args:{substring:e}})},validate:(e,t,{substring:r})=>!0===e.includes(r)?t.error("string.ncontains",{substring:r}):e}}});var xc={exports:{}},jc={},Pc={},Nc={},$c={},Mc={},Dc={};Object.defineProperty(Dc,"__esModule",{value:!0});const Lc=s;Dc.default=(e,t)=>(0,Lc.createHash)(e).update(t).digest(),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.concatKdf=e.lengthAndInput=e.uint32be=e.uint64be=e.p2s=e.concat=e.decoder=e.encoder=void 0;const t=Dc;e.encoder=new TextEncoder,e.decoder=new TextDecoder;const r=2**32;function n(...e){const t=e.reduce(((e,{length:t})=>e+t),0),r=new Uint8Array(t);let n=0;return e.forEach((e=>{r.set(e,n),n+=e.length})),r}function i(e,t,n){if(t<0||t>=r)throw new RangeError(`value must be >= 0 and <= ${r-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],n)}function s(e){const t=new Uint8Array(4);return i(t,e),t}e.concat=n,e.p2s=function(t,r){return n(e.encoder.encode(t),new Uint8Array([0]),r)},e.uint64be=function(e){const t=Math.floor(e/r),n=e%r,s=new Uint8Array(8);return i(s,t,0),i(s,n,4),s},e.uint32be=s,e.lengthAndInput=function(e){return n(s(e.length),e)},e.concatKdf=async function(e,r,n){const i=Math.ceil((r>>3)/32),o=new Uint8Array(32*i);for(let r=0;r<i;r++){const i=new Uint8Array(4+e.length+n.length);i.set(s(r+1)),i.set(e,4),i.set(n,4+e.length),o.set(await(0,t.default)("sha256",i),32*r)}return o.slice(0,r>>3)}}(Mc),Object.defineProperty($c,"__esModule",{value:!0}),$c.decode=$c.encode=$c.encodeBase64=$c.decodeBase64=void 0;const Bc=i,Kc=Mc;Bc.Buffer.isEncoding("base64url")?$c.encode=e=>Bc.Buffer.from(e).toString("base64url"):$c.encode=e=>Bc.Buffer.from(e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");$c.decodeBase64=e=>Bc.Buffer.from(e,"base64");$c.encodeBase64=e=>Bc.Buffer.from(e).toString("base64");$c.decode=e=>Bc.Buffer.from(function(e){let t=e;return t instanceof Uint8Array&&(t=Kc.decoder.decode(t)),t}(e),"base64");var Fc={},Uc={},Wc={};Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.JWSSignatureVerificationFailed=Wc.JWKSTimeout=Wc.JWKSMultipleMatchingKeys=Wc.JWKSNoMatchingKey=Wc.JWKSInvalid=Wc.JWKInvalid=Wc.JWTInvalid=Wc.JWSInvalid=Wc.JWEInvalid=Wc.JWEDecompressionFailed=Wc.JWEDecryptionFailed=Wc.JOSENotSupported=Wc.JOSEAlgNotAllowed=Wc.JWTExpired=Wc.JWTClaimValidationFailed=Wc.JOSEError=void 0;class Jc extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(e){var t;super(e),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}Wc.JOSEError=Jc;Wc.JWTClaimValidationFailed=class extends Jc{static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=t,this.reason=r}};Wc.JWTExpired=class extends Jc{static get code(){return"ERR_JWT_EXPIRED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_EXPIRED",this.claim=t,this.reason=r}};Wc.JOSEAlgNotAllowed=class extends Jc{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}};Wc.JOSENotSupported=class extends Jc{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}};Wc.JWEDecryptionFailed=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWE_DECRYPTION_FAILED",this.message="decryption operation failed"}static get code(){return"ERR_JWE_DECRYPTION_FAILED"}};Wc.JWEDecompressionFailed=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWE_DECOMPRESSION_FAILED",this.message="decompression operation failed"}static get code(){return"ERR_JWE_DECOMPRESSION_FAILED"}};Wc.JWEInvalid=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}static get code(){return"ERR_JWE_INVALID"}};Wc.JWSInvalid=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}};Wc.JWTInvalid=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}};Wc.JWKInvalid=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}static get code(){return"ERR_JWK_INVALID"}};Wc.JWKSInvalid=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}};Wc.JWKSNoMatchingKey=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWKS_NO_MATCHING_KEY",this.message="no applicable key found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_NO_MATCHING_KEY"}};Wc.JWKSMultipleMatchingKeys=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS",this.message="multiple matching keys found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_MULTIPLE_MATCHING_KEYS"}};Wc.JWKSTimeout=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}};Wc.JWSSignatureVerificationFailed=class extends Jc{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}};var Hc={},Gc={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=s;Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.randomFillSync}})}(Gc),Object.defineProperty(Hc,"__esModule",{value:!0}),Hc.bitLength=void 0;const zc=Wc,Vc=Gc;function qc(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new zc.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}Hc.bitLength=qc,Hc.default=e=>(0,Vc.default)(new Uint8Array(qc(e)>>3)),Object.defineProperty(Uc,"__esModule",{value:!0});const Xc=Wc,Yc=Hc;Uc.default=(e,t)=>{if(t.length<<3!==(0,Yc.bitLength)(e))throw new Xc.JWEInvalid("Invalid Initialization Vector length")};var Zc={},Qc={};Object.defineProperty(Qc,"__esModule",{value:!0});const el=s,tl=t;Qc.default=tl.types.isKeyObject?e=>tl.types.isKeyObject(e):e=>null!=e&&e instanceof el.KeyObject,Object.defineProperty(Zc,"__esModule",{value:!0});const rl=Wc,nl=Qc;Zc.default=(e,t)=>{let r;switch(e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new rl.JOSENotSupported(`Content Encryption Algorithm ${e} is not supported either by JOSE or your javascript runtime`)}if(t instanceof Uint8Array){const e=t.byteLength<<3;if(e!==r)throw new rl.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`)}else{if(!(0,nl.default)(t)||"secret"!==t.type)throw new TypeError("Invalid Content Encryption Key type");{const e=t.symmetricKeySize<<3;if(e!==r)throw new rl.JWEInvalid(`Invalid Content Encryption Key length. Expected ${r} bits, got ${e} bits`)}}};var il={};Object.defineProperty(il,"__esModule",{value:!0});const sl=s.timingSafeEqual;il.default=sl;var ol={};Object.defineProperty(ol,"__esModule",{value:!0});const al=s,cl=Mc;ol.default=function(e,t,r,n,i,s){const o=(0,cl.concat)(e,t,r,(0,cl.uint64be)(e.length<<3)),a=(0,al.createHmac)(`sha${n}`,i);return a.update(o),a.digest().slice(0,s>>3)};var ll={};Object.defineProperty(ll,"__esModule",{value:!0}),ll.isCryptoKey=void 0;const ul=t,dl=s.webcrypto;ll.default=dl,ll.isCryptoKey=ul.types.isCryptoKey?e=>ul.types.isCryptoKey(e):e=>!1;var fl={};function pl(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function hl(e,t){return e.name===t}function ml(e){return parseInt(e.name.slice(4),10)}function yl(e,t){if(t.length&&!t.some((t=>e.usages.includes(t)))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw new TypeError(e)}}Object.defineProperty(fl,"__esModule",{value:!0}),fl.checkEncCryptoKey=fl.checkSigCryptoKey=void 0,fl.checkSigCryptoKey=function(e,t,...r){switch(t){case"HS256":case"HS384":case"HS512":{if(!hl(e.algorithm,"HMAC"))throw pl("HMAC");const r=parseInt(t.slice(2),10);if(ml(e.algorithm.hash)!==r)throw pl(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!hl(e.algorithm,"RSASSA-PKCS1-v1_5"))throw pl("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(ml(e.algorithm.hash)!==r)throw pl(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!hl(e.algorithm,"RSA-PSS"))throw pl("RSA-PSS");const r=parseInt(t.slice(2),10);if(ml(e.algorithm.hash)!==r)throw pl(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==e.algorithm.name&&"Ed448"!==e.algorithm.name)throw pl("Ed25519 or Ed448");break;case"ES256":case"ES384":case"ES512":{if(!hl(e.algorithm,"ECDSA"))throw pl("ECDSA");const r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==r)throw pl(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}yl(e,r)},fl.checkEncCryptoKey=function(e,t,...r){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!hl(e.algorithm,"AES-GCM"))throw pl("AES-GCM");const r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw pl(r,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!hl(e.algorithm,"AES-KW"))throw pl("AES-KW");const r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw pl(r,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw pl("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!hl(e.algorithm,"PBKDF2"))throw pl("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!hl(e.algorithm,"RSA-OAEP"))throw pl("RSA-OAEP");const r=parseInt(t.slice(9),10)||1;if(ml(e.algorithm.hash)!==r)throw pl(`SHA-${r}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}yl(e,r)};var gl={};function _l(e,t,...r){if(r.length>2){const t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor&&t.constructor.name&&(e+=` Received an instance of ${t.constructor.name}`),e}Object.defineProperty(gl,"__esModule",{value:!0}),gl.withAlg=void 0,gl.default=(e,...t)=>_l("Key must be ",e,...t),gl.withAlg=function(e,t,...r){return _l(`Key for the ${e} algorithm must be `,t,...r)};var vl={};Object.defineProperty(vl,"__esModule",{value:!0});const bl=s;let wl;vl.default=e=>(wl||(wl=new Set((0,bl.getCiphers)())),wl.has(e));var Sl={};Object.defineProperty(Sl,"__esModule",{value:!0}),Sl.types=void 0;const El=ll,kl=Qc;Sl.default=e=>(0,kl.default)(e)||(0,El.isCryptoKey)(e);const Al=["KeyObject"];Sl.types=Al,(globalThis.CryptoKey||(null===El.default||void 0===El.default?void 0:El.default.CryptoKey))&&Al.push("CryptoKey"),Object.defineProperty(Fc,"__esModule",{value:!0});const Ol=s,Cl=Uc,Tl=Zc,Rl=Mc,Il=Wc,xl=il,jl=ol,Pl=ll,Nl=fl,$l=Qc,Ml=gl,Dl=vl,Ll=Sl;Fc.default=(e,t,r,n,i,s)=>{let o;if((0,Pl.isCryptoKey)(t))(0,Nl.checkEncCryptoKey)(t,e,"decrypt"),o=Ol.KeyObject.from(t);else{if(!(t instanceof Uint8Array||(0,$l.default)(t)))throw new TypeError((0,Ml.default)(t,...Ll.types,"Uint8Array"));o=t}switch((0,Tl.default)(e,o),(0,Cl.default)(e,n),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,n,i,s){const o=parseInt(e.slice(1,4),10);(0,$l.default)(t)&&(t=t.export());const a=t.subarray(o>>3),c=t.subarray(0,o>>3),l=parseInt(e.slice(-3),10),u=`aes-${o}-cbc`;if(!(0,Dl.default)(u))throw new Il.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const d=(0,jl.default)(s,n,r,l,c,o);let f,p;try{f=(0,xl.default)(i,d)}catch{}if(!f)throw new Il.JWEDecryptionFailed;try{const e=(0,Ol.createDecipheriv)(u,a,n);p=(0,Rl.concat)(e.update(r),e.final())}catch{}if(!p)throw new Il.JWEDecryptionFailed;return p}(e,o,r,n,i,s);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,n,i,s){const o=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,Dl.default)(o))throw new Il.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);try{const e=(0,Ol.createDecipheriv)(o,t,n,{authTagLength:16});e.setAuthTag(i),s.byteLength&&e.setAAD(s,{plaintextLength:r.length});const a=e.update(r);return e.final(),a}catch{throw new Il.JWEDecryptionFailed}}(e,o,r,n,i,s);default:throw new Il.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}};var Bl={};Object.defineProperty(Bl,"__esModule",{value:!0}),Bl.deflate=Bl.inflate=void 0;const Kl=t,Fl=o,Ul=Wc,Wl=(0,Kl.promisify)(Fl.inflateRaw),Jl=(0,Kl.promisify)(Fl.deflateRaw);Bl.inflate=e=>Wl(e,{maxOutputLength:25e4}).catch((()=>{throw new Ul.JWEDecompressionFailed}));Bl.deflate=e=>Jl(e);var Hl={};Object.defineProperty(Hl,"__esModule",{value:!0});Hl.default=(...e)=>{const t=e.filter(Boolean);if(0===t.length||1===t.length)return!0;let r;for(const e of t){const t=Object.keys(e);if(r&&0!==r.size)for(const e of t){if(r.has(e))return!1;r.add(e)}else r=new Set(t)}return!0};var Gl={};Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.default=function(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let r=e;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r};var zl={},Vl={};Object.defineProperty(Vl,"__esModule",{value:!0}),Vl.unwrap=Vl.wrap=void 0;const ql=i,Xl=s,Yl=Wc,Zl=Mc,Ql=ll,eu=fl,tu=Qc,ru=gl,nu=vl,iu=Sl;function su(e,t){if(e.symmetricKeySize<<3!==parseInt(t.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${t}`)}function ou(e,t,r){if((0,tu.default)(e))return e;if(e instanceof Uint8Array)return(0,Xl.createSecretKey)(e);if((0,Ql.isCryptoKey)(e))return(0,eu.checkEncCryptoKey)(e,t,r),Xl.KeyObject.from(e);throw new TypeError((0,ru.default)(e,...iu.types,"Uint8Array"))}Vl.wrap=(e,t,r)=>{const n=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,nu.default)(n))throw new Yl.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const i=ou(t,e,"wrapKey");su(i,e);const s=(0,Xl.createCipheriv)(n,i,ql.Buffer.alloc(8,166));return(0,Zl.concat)(s.update(r),s.final())};Vl.unwrap=(e,t,r)=>{const n=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,nu.default)(n))throw new Yl.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);const i=ou(t,e,"unwrapKey");su(i,e);const s=(0,Xl.createDecipheriv)(n,i,ql.Buffer.alloc(8,166));return(0,Zl.concat)(s.update(r),s.final())};var au={},cu={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.setCurve=e.weakMap=void 0;const t=i,r=s,n=Wc,o=ll,a=Qc,c=gl,l=Sl,u=t.Buffer.from([42,134,72,206,61,3,1,7]),d=t.Buffer.from([43,129,4,0,34]),f=t.Buffer.from([43,129,4,0,35]),p=t.Buffer.from([43,129,4,0,10]);e.weakMap=new WeakMap;const h=(t,i)=>{var s;let m;if((0,o.isCryptoKey)(t))m=r.KeyObject.from(t);else{if(!(0,a.default)(t))throw new TypeError((0,c.default)(t,...l.types));m=t}if("secret"===m.type)throw new TypeError('only "private" or "public" type keys can be used for this operation');switch(m.asymmetricKeyType){case"ed25519":case"ed448":return`Ed${m.asymmetricKeyType.slice(2)}`;case"x25519":case"x448":return`X${m.asymmetricKeyType.slice(1)}`;case"ec":{if(e.weakMap.has(m))return e.weakMap.get(m);let t=null===(s=m.asymmetricKeyDetails)||void 0===s?void 0:s.namedCurve;if(t||"private"!==m.type){if(!t){const e=m.export({format:"der",type:"spki"}),r=e[1]<128?14:15,i=e[r],s=e.slice(r+1,r+1+i);if(s.equals(u))t="prime256v1";else if(s.equals(d))t="secp384r1";else if(s.equals(f))t="secp521r1";else{if(!s.equals(p))throw new n.JOSENotSupported("Unsupported key curve for this operation");t="secp256k1"}}}else t=h((0,r.createPublicKey)(m),!0);if(i)return t;const o=(e=>{switch(e){case"prime256v1":return"P-256";case"secp384r1":return"P-384";case"secp521r1":return"P-521";case"secp256k1":return"secp256k1";default:throw new n.JOSENotSupported("Unsupported key curve for this operation")}})(t);return e.weakMap.set(m,o),o}default:throw new TypeError("Invalid asymmetric key type for this operation")}};e.setCurve=function(t,r){e.weakMap.set(t,r)},e.default=h}(cu),Object.defineProperty(au,"__esModule",{value:!0}),au.ecdhAllowed=au.generateEpk=au.deriveKey=void 0;const lu=s,uu=cu,du=Mc,fu=Wc,pu=ll,hu=fl,mu=Qc,yu=gl,gu=Sl,_u=(0,t.promisify)(lu.generateKeyPair);au.deriveKey=async function(e,t,r,n,i=new Uint8Array(0),s=new Uint8Array(0)){let o,a;if((0,pu.isCryptoKey)(e))(0,hu.checkEncCryptoKey)(e,"ECDH"),o=lu.KeyObject.from(e);else{if(!(0,mu.default)(e))throw new TypeError((0,yu.default)(e,...gu.types));o=e}if((0,pu.isCryptoKey)(t))(0,hu.checkEncCryptoKey)(t,"ECDH","deriveBits"),a=lu.KeyObject.from(t);else{if(!(0,mu.default)(t))throw new TypeError((0,yu.default)(t,...gu.types));a=t}const c=(0,du.concat)((0,du.lengthAndInput)(du.encoder.encode(r)),(0,du.lengthAndInput)(i),(0,du.lengthAndInput)(s),(0,du.uint32be)(n)),l=(0,lu.diffieHellman)({privateKey:a,publicKey:o});return(0,du.concatKdf)(l,n,c)},au.generateEpk=async function(e){let t;if((0,pu.isCryptoKey)(e))t=lu.KeyObject.from(e);else{if(!(0,mu.default)(e))throw new TypeError((0,yu.default)(e,...gu.types));t=e}switch(t.asymmetricKeyType){case"x25519":return _u("x25519");case"x448":return _u("x448");case"ec":{const e=(0,uu.default)(t);return _u("ec",{namedCurve:e})}default:throw new fu.JOSENotSupported("Invalid or unsupported EPK")}};au.ecdhAllowed=e=>["P-256","P-384","P-521","X25519","X448"].includes((0,uu.default)(e));var vu={},bu={};Object.defineProperty(bu,"__esModule",{value:!0});const wu=Wc;bu.default=function(e){if(!(e instanceof Uint8Array)||e.length<8)throw new wu.JWEInvalid("PBES2 Salt Input must be 8 or more octets")},Object.defineProperty(vu,"__esModule",{value:!0}),vu.decrypt=vu.encrypt=void 0;const Su=s,Eu=Gc,ku=Mc,Au=$c,Ou=Vl,Cu=bu,Tu=ll,Ru=fl,Iu=Qc,xu=gl,ju=Sl,Pu=(0,t.promisify)(Su.pbkdf2);function Nu(e,t){if((0,Iu.default)(e))return e.export();if(e instanceof Uint8Array)return e;if((0,Tu.isCryptoKey)(e))return(0,Ru.checkEncCryptoKey)(e,t,"deriveBits","deriveKey"),Su.KeyObject.from(e).export();throw new TypeError((0,xu.default)(e,...ju.types,"Uint8Array"))}vu.encrypt=async(e,t,r,n=2048,i=(0,Eu.default)(new Uint8Array(16)))=>{(0,Cu.default)(i);const s=(0,ku.p2s)(e,i),o=parseInt(e.slice(13,16),10)>>3,a=Nu(t,e),c=await Pu(a,s,n,o,`sha${e.slice(8,11)}`);return{encryptedKey:await(0,Ou.wrap)(e.slice(-6),c,r),p2c:n,p2s:(0,Au.encode)(i)}};vu.decrypt=async(e,t,r,n,i)=>{(0,Cu.default)(i);const s=(0,ku.p2s)(e,i),o=parseInt(e.slice(13,16),10)>>3,a=Nu(t,e),c=await Pu(a,s,n,o,`sha${e.slice(8,11)}`);return(0,Ou.unwrap)(e.slice(-6),c,r)};var $u={},Mu={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.setModulusLength=e.weakMap=void 0,e.weakMap=new WeakMap;const t=(e,r)=>{let n=e.readUInt8(1);if(!(128&n))return 0===r?n:t(e.subarray(2+n),r-1);const i=127&n;n=0;for(let t=0;t<i;t++){n<<=8;n|=e.readUInt8(2+t)}return 0===r?n:t(e.subarray(2+n),r-1)},r=r=>{var n,i;if(e.weakMap.has(r))return e.weakMap.get(r);const s=null!==(i=null===(n=r.asymmetricKeyDetails)||void 0===n?void 0:n.modulusLength)&&void 0!==i?i:((e,r)=>{const n=e.readUInt8(1);if(!(128&n))return t(e.subarray(2),r);const i=127&n;return t(e.subarray(2+i),r)})(r.export({format:"der",type:"pkcs1"}),"private"===r.type?1:0)-1<<3;return e.weakMap.set(r,s),s};e.setModulusLength=(t,r)=>{e.weakMap.set(t,r)},e.default=(e,t)=>{if(r(e)<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}}(Mu),Object.defineProperty($u,"__esModule",{value:!0}),$u.decrypt=$u.encrypt=void 0;const Du=s,Lu=Mu,Bu=ll,Ku=fl,Fu=Qc,Uu=gl,Wu=Sl,Ju=(e,t)=>{if("rsa"!==e.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");(0,Lu.default)(e,t)},Hu=e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return Du.constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return Du.constants.RSA_PKCS1_PADDING;default:return}},Gu=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}};function zu(e,t,...r){if((0,Fu.default)(e))return e;if((0,Bu.isCryptoKey)(e))return(0,Ku.checkEncCryptoKey)(e,t,...r),Du.KeyObject.from(e);throw new TypeError((0,Uu.default)(e,...Wu.types))}$u.encrypt=(e,t,r)=>{const n=Hu(e),i=Gu(e),s=zu(t,e,"wrapKey","encrypt");return Ju(s,e),(0,Du.publicEncrypt)({key:s,oaepHash:i,padding:n},r)};$u.decrypt=(e,t,r)=>{const n=Hu(e),i=Gu(e),s=zu(t,e,"unwrapKey","decrypt");return Ju(s,e),(0,Du.privateDecrypt)({key:s,oaepHash:i,padding:n},r)};var Vu={};Object.defineProperty(Vu,"__esModule",{value:!0}),Vu.bitLength=void 0;const qu=Wc,Xu=Gc;function Yu(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new qu.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}Vu.bitLength=Yu,Vu.default=e=>(0,Xu.default)(new Uint8Array(Yu(e)>>3));var Zu={},Qu={};Object.defineProperty(Qu,"__esModule",{value:!0}),Qu.fromX509=Qu.fromSPKI=Qu.fromPKCS8=Qu.toPKCS8=Qu.toSPKI=void 0;const ed=s,td=i,rd=ll,nd=Qc,id=gl,sd=Sl,od=(e,t,r)=>{let n;if((0,rd.isCryptoKey)(r)){if(!r.extractable)throw new TypeError("CryptoKey is not extractable");n=ed.KeyObject.from(r)}else{if(!(0,nd.default)(r))throw new TypeError((0,id.default)(r,...sd.types));n=r}if(n.type!==e)throw new TypeError(`key is not a ${e} key`);return n.export({format:"pem",type:t})};Qu.toSPKI=e=>od("public","spki",e);Qu.toPKCS8=e=>od("private","pkcs8",e);Qu.fromPKCS8=e=>(0,ed.createPrivateKey)({key:td.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,""),"base64"),type:"pkcs8",format:"der"});Qu.fromSPKI=e=>(0,ed.createPublicKey)({key:td.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,""),"base64"),type:"spki",format:"der"});Qu.fromX509=e=>(0,ed.createPublicKey)({key:e,type:"spki",format:"pem"});var ad={},cd={};Object.defineProperty(cd,"__esModule",{value:!0});const ld=i,ud=Wc,dd=ld.Buffer.from([0]),fd=ld.Buffer.from([2]),pd=ld.Buffer.from([3]),hd=ld.Buffer.from([48]),md=ld.Buffer.from([4]),yd=e=>{if(e<128)return ld.Buffer.from([e]);const t=ld.Buffer.alloc(5);t.writeUInt32BE(e,1);let r=1;for(;0===t[r];)r++;return t[r-1]=128|5-r,t.slice(r-1)},gd=new Map([["P-256",ld.Buffer.from("06 08 2A 86 48 CE 3D 03 01 07".replace(/ /g,""),"hex")],["secp256k1",ld.Buffer.from("06 05 2B 81 04 00 0A".replace(/ /g,""),"hex")],["P-384",ld.Buffer.from("06 05 2B 81 04 00 22".replace(/ /g,""),"hex")],["P-521",ld.Buffer.from("06 05 2B 81 04 00 23".replace(/ /g,""),"hex")],["ecPublicKey",ld.Buffer.from("06 07 2A 86 48 CE 3D 02 01".replace(/ /g,""),"hex")],["X25519",ld.Buffer.from("06 03 2B 65 6E".replace(/ /g,""),"hex")],["X448",ld.Buffer.from("06 03 2B 65 6F".replace(/ /g,""),"hex")],["Ed25519",ld.Buffer.from("06 03 2B 65 70".replace(/ /g,""),"hex")],["Ed448",ld.Buffer.from("06 03 2B 65 71".replace(/ /g,""),"hex")]]);cd.default=class{constructor(){this.length=0,this.elements=[]}oidFor(e){const t=gd.get(e);if(!t)throw new ud.JOSENotSupported("Invalid or unsupported OID");this.elements.push(t),this.length+=t.length}zero(){this.elements.push(fd,ld.Buffer.from([1]),dd),this.length+=3}one(){this.elements.push(fd,ld.Buffer.from([1]),ld.Buffer.from([1])),this.length+=3}unsignedInteger(e){if(128&e[0]){const t=yd(e.length+1);this.elements.push(fd,t,dd,e),this.length+=2+t.length+e.length}else{let t=0;for(;0===e[t]&&!(128&e[t+1]);)t++;const r=yd(e.length-t);this.elements.push(fd,yd(e.length-t),e.slice(t)),this.length+=1+r.length+e.length-t}}octStr(e){const t=yd(e.length);this.elements.push(md,yd(e.length),e),this.length+=1+t.length+e.length}bitStr(e){const t=yd(e.length+1);this.elements.push(pd,yd(e.length+1),dd,e),this.length+=1+t.length+e.length+1}add(e){this.elements.push(e),this.length+=e.length}end(e=hd){const t=yd(this.length);return ld.Buffer.concat([e,t,...this.elements],1+t.length+this.length)}};var _d={};Object.defineProperty(_d,"__esModule",{value:!0}),_d.jwkImport=_d.jwkExport=_d.rsaPssParams=_d.oneShotCallback=void 0;const[vd,bd]=process.versions.node.split(".").map((e=>parseInt(e,10)));_d.oneShotCallback=vd>=16||15===vd&&bd>=13,_d.rsaPssParams=!("electron"in process.versions)&&(vd>=17||16===vd&&bd>=9),_d.jwkExport=vd>=16||15===vd&&bd>=9,_d.jwkImport=vd>=16||15===vd&&bd>=12,Object.defineProperty(ad,"__esModule",{value:!0});const wd=i,Sd=s,Ed=$c,kd=Wc,Ad=cu,Od=Mu,Cd=cd,Td=_d;ad.default=e=>{if(Td.jwkImport&&"oct"!==e.kty)return e.d?(0,Sd.createPrivateKey)({format:"jwk",key:e}):(0,Sd.createPublicKey)({format:"jwk",key:e});switch(e.kty){case"oct":return(0,Sd.createSecretKey)((0,Ed.decode)(e.k));case"RSA":{const t=new Cd.default,r=void 0!==e.d,n=wd.Buffer.from(e.n,"base64"),i=wd.Buffer.from(e.e,"base64");r?(t.zero(),t.unsignedInteger(n),t.unsignedInteger(i),t.unsignedInteger(wd.Buffer.from(e.d,"base64")),t.unsignedInteger(wd.Buffer.from(e.p,"base64")),t.unsignedInteger(wd.Buffer.from(e.q,"base64")),t.unsignedInteger(wd.Buffer.from(e.dp,"base64")),t.unsignedInteger(wd.Buffer.from(e.dq,"base64")),t.unsignedInteger(wd.Buffer.from(e.qi,"base64"))):(t.unsignedInteger(n),t.unsignedInteger(i));const s={key:t.end(),format:"der",type:"pkcs1"},o=r?(0,Sd.createPrivateKey)(s):(0,Sd.createPublicKey)(s);return(0,Od.setModulusLength)(o,n.length<<3),o}case"EC":{const t=new Cd.default,r=void 0!==e.d,n=wd.Buffer.concat([wd.Buffer.alloc(1,4),wd.Buffer.from(e.x,"base64"),wd.Buffer.from(e.y,"base64")]);if(r){t.zero();const r=new Cd.default;r.oidFor("ecPublicKey"),r.oidFor(e.crv),t.add(r.end());const i=new Cd.default;i.one(),i.octStr(wd.Buffer.from(e.d,"base64"));const s=new Cd.default;s.bitStr(n);const o=s.end(wd.Buffer.from([161]));i.add(o);const a=i.end(),c=new Cd.default;c.add(a);const l=c.end(wd.Buffer.from([4]));t.add(l);const u=t.end(),d=(0,Sd.createPrivateKey)({key:u,format:"der",type:"pkcs8"});return(0,Ad.setCurve)(d,e.crv),d}const i=new Cd.default;i.oidFor("ecPublicKey"),i.oidFor(e.crv),t.add(i.end()),t.bitStr(n);const s=t.end(),o=(0,Sd.createPublicKey)({key:s,format:"der",type:"spki"});return(0,Ad.setCurve)(o,e.crv),o}case"OKP":{const t=new Cd.default;if(void 0!==e.d){t.zero();const r=new Cd.default;r.oidFor(e.crv),t.add(r.end());const n=new Cd.default;n.octStr(wd.Buffer.from(e.d,"base64"));const i=n.end(wd.Buffer.from([4]));t.add(i);const s=t.end();return(0,Sd.createPrivateKey)({key:s,format:"der",type:"pkcs8"})}const r=new Cd.default;r.oidFor(e.crv),t.add(r.end()),t.bitStr(wd.Buffer.from(e.x,"base64"));const n=t.end();return(0,Sd.createPublicKey)({key:n,format:"der",type:"spki"})}default:throw new kd.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}},Object.defineProperty(Zu,"__esModule",{value:!0}),Zu.importJWK=Zu.importPKCS8=Zu.importX509=Zu.importSPKI=void 0;const Rd=$c,Id=Qu,xd=ad,jd=Wc,Pd=Gl;Zu.importSPKI=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PUBLIC KEY-----"))throw new TypeError('"spki" must be SPKI formatted string');return(0,Id.fromSPKI)(e,t,r)},Zu.importX509=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN CERTIFICATE-----"))throw new TypeError('"x509" must be X.509 formatted string');return(0,Id.fromX509)(e,t,r)},Zu.importPKCS8=async function(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return(0,Id.fromPKCS8)(e,t,r)},Zu.importJWK=async function(e,t,r){var n;if(!(0,Pd.default)(e))throw new TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return null!=r||(r=!0!==e.ext),r?(0,xd.default)({...e,alg:t,ext:null!==(n=e.ext)&&void 0!==n&&n}):(0,Rd.decode)(e.k);case"RSA":if(void 0!==e.oth)throw new jd.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return(0,xd.default)({...e,alg:t});default:throw new jd.JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}};var Nd={};Object.defineProperty(Nd,"__esModule",{value:!0});const $d=gl,Md=Sl;Nd.default=(e,t,r)=>{e.startsWith("HS")||"dir"===e||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?((e,t)=>{if(!(t instanceof Uint8Array)){if(!(0,Md.default)(t))throw new TypeError((0,$d.withAlg)(e,t,...Md.types,"Uint8Array"));if("secret"!==t.type)throw new TypeError(`${Md.types.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}})(e,t):((e,t,r)=>{if(!(0,Md.default)(t))throw new TypeError((0,$d.withAlg)(e,t,...Md.types));if("secret"===t.type)throw new TypeError(`${Md.types.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw new TypeError(`${Md.types.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw new TypeError(`${Md.types.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw new TypeError(`${Md.types.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw new TypeError(`${Md.types.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)})(e,t,r)};var Dd={},Ld={};Object.defineProperty(Ld,"__esModule",{value:!0});const Bd=s,Kd=Uc,Fd=Zc,Ud=Mc,Wd=ol,Jd=ll,Hd=fl,Gd=Qc,zd=gl,Vd=Wc,qd=vl,Xd=Sl;Ld.default=(e,t,r,n,i)=>{let s;if((0,Jd.isCryptoKey)(r))(0,Hd.checkEncCryptoKey)(r,e,"encrypt"),s=Bd.KeyObject.from(r);else{if(!(r instanceof Uint8Array||(0,Gd.default)(r)))throw new TypeError((0,zd.default)(r,...Xd.types,"Uint8Array"));s=r}switch((0,Fd.default)(e,s),(0,Kd.default)(e,n),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return function(e,t,r,n,i){const s=parseInt(e.slice(1,4),10);(0,Gd.default)(r)&&(r=r.export());const o=r.subarray(s>>3),a=r.subarray(0,s>>3),c=`aes-${s}-cbc`;if(!(0,qd.default)(c))throw new Vd.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const l=(0,Bd.createCipheriv)(c,o,n),u=(0,Ud.concat)(l.update(t),l.final()),d=parseInt(e.slice(-3),10);return{ciphertext:u,tag:(0,Wd.default)(i,n,u,d,a,s)}}(e,t,s,n,i);case"A128GCM":case"A192GCM":case"A256GCM":return function(e,t,r,n,i){const s=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,qd.default)(s))throw new Vd.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);const o=(0,Bd.createCipheriv)(s,r,n,{authTagLength:16});i.byteLength&&o.setAAD(i,{plaintextLength:t.length});const a=o.update(t);return o.final(),{ciphertext:a,tag:o.getAuthTag()}}(e,t,s,n,i);default:throw new Vd.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}},Object.defineProperty(Dd,"__esModule",{value:!0}),Dd.unwrap=Dd.wrap=void 0;const Yd=Ld,Zd=Fc,Qd=Hc,ef=$c;Dd.wrap=async function(e,t,r,n){const i=e.slice(0,7);n||(n=(0,Qd.default)(i));const{ciphertext:s,tag:o}=await(0,Yd.default)(i,r,t,n,new Uint8Array(0));return{encryptedKey:s,iv:(0,ef.encode)(n),tag:(0,ef.encode)(o)}},Dd.unwrap=async function(e,t,r,n,i){const s=e.slice(0,7);return(0,Zd.default)(s,t,r,n,i,new Uint8Array(0))},Object.defineProperty(zl,"__esModule",{value:!0});const tf=Vl,rf=au,nf=vu,sf=$u,of=$c,af=Wc,cf=Vu,lf=Zu,uf=Nd,df=Gl,ff=Dd;zl.default=async function(e,t,r,n,i){switch((0,uf.default)(e,t,"decrypt"),e){case"dir":if(void 0!==r)throw new af.JWEInvalid("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new af.JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!(0,df.default)(n.epk))throw new af.JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!rf.ecdhAllowed(t))throw new af.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const i=await(0,lf.importJWK)(n.epk,e);let s,o;if(void 0!==n.apu){if("string"!=typeof n.apu)throw new af.JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{s=(0,of.decode)(n.apu)}catch{throw new af.JWEInvalid("Failed to base64url decode the apu")}}if(void 0!==n.apv){if("string"!=typeof n.apv)throw new af.JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{o=(0,of.decode)(n.apv)}catch{throw new af.JWEInvalid("Failed to base64url decode the apv")}}const a=await rf.deriveKey(i,t,"ECDH-ES"===e?n.enc:e,"ECDH-ES"===e?(0,cf.bitLength)(n.enc):parseInt(e.slice(-5,-2),10),s,o);if("ECDH-ES"===e)return a;if(void 0===r)throw new af.JWEInvalid("JWE Encrypted Key missing");return(0,tf.unwrap)(e.slice(-6),a,r)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===r)throw new af.JWEInvalid("JWE Encrypted Key missing");return(0,sf.decrypt)(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(void 0===r)throw new af.JWEInvalid("JWE Encrypted Key missing");if("number"!=typeof n.p2c)throw new af.JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');const s=(null==i?void 0:i.maxPBES2Count)||1e4;if(n.p2c>s)throw new af.JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof n.p2s)throw new af.JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let o;try{o=(0,of.decode)(n.p2s)}catch{throw new af.JWEInvalid("Failed to base64url decode the p2s")}return(0,nf.decrypt)(e,t,r,n.p2c,o)}case"A128KW":case"A192KW":case"A256KW":if(void 0===r)throw new af.JWEInvalid("JWE Encrypted Key missing");return(0,tf.unwrap)(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(void 0===r)throw new af.JWEInvalid("JWE Encrypted Key missing");if("string"!=typeof n.iv)throw new af.JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof n.tag)throw new af.JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let i,s;try{i=(0,of.decode)(n.iv)}catch{throw new af.JWEInvalid("Failed to base64url decode the iv")}try{s=(0,of.decode)(n.tag)}catch{throw new af.JWEInvalid("Failed to base64url decode the tag")}return(0,ff.unwrap)(e,t,r,i,s)}default:throw new af.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}};var pf={};Object.defineProperty(pf,"__esModule",{value:!0});const hf=Wc;pf.default=function(e,t,r,n,i){if(void 0!==i.crit&&void 0===n.crit)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||void 0===n.crit)return new Set;if(!Array.isArray(n.crit)||0===n.crit.length||n.crit.some((e=>"string"!=typeof e||0===e.length)))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let s;s=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t;for(const t of n.crit){if(!s.has(t))throw new hf.JOSENotSupported(`Extension Header Parameter "${t}" is not recognized`);if(void 0===i[t])throw new e(`Extension Header Parameter "${t}" is missing`);if(s.get(t)&&void 0===n[t])throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return new Set(n.crit)};var mf={};Object.defineProperty(mf,"__esModule",{value:!0});mf.default=(e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some((e=>"string"!=typeof e))))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)},Object.defineProperty(Nc,"__esModule",{value:!0}),Nc.flattenedDecrypt=void 0;const yf=$c,gf=Fc,_f=Bl,vf=Wc,bf=Hl,wf=Gl,Sf=zl,Ef=Mc,kf=Vu,Af=pf,Of=mf;Nc.flattenedDecrypt=async function(e,t,r){var n;if(!(0,wf.default)(e))throw new vf.JWEInvalid("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new vf.JWEInvalid("JOSE Header missing");if("string"!=typeof e.iv)throw new vf.JWEInvalid("JWE Initialization Vector missing or incorrect type");if("string"!=typeof e.ciphertext)throw new vf.JWEInvalid("JWE Ciphertext missing or incorrect type");if("string"!=typeof e.tag)throw new vf.JWEInvalid("JWE Authentication Tag missing or incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new vf.JWEInvalid("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new vf.JWEInvalid("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new vf.JWEInvalid("JWE AAD incorrect type");if(void 0!==e.header&&!(0,wf.default)(e.header))throw new vf.JWEInvalid("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!(0,wf.default)(e.unprotected))throw new vf.JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let i;if(e.protected)try{const t=(0,yf.decode)(e.protected);i=JSON.parse(Ef.decoder.decode(t))}catch{throw new vf.JWEInvalid("JWE Protected Header is invalid")}if(!(0,bf.default)(i,e.header,e.unprotected))throw new vf.JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const s={...i,...e.header,...e.unprotected};if((0,Af.default)(vf.JWEInvalid,new Map,null==r?void 0:r.crit,i,s),void 0!==s.zip){if(!i||!i.zip)throw new vf.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==s.zip)throw new vf.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:o,enc:a}=s;if("string"!=typeof o||!o)throw new vf.JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof a||!a)throw new vf.JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");const c=r&&(0,Of.default)("keyManagementAlgorithms",r.keyManagementAlgorithms),l=r&&(0,Of.default)("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(c&&!c.has(o))throw new vf.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(l&&!l.has(a))throw new vf.JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter not allowed');let u;if(void 0!==e.encrypted_key)try{u=(0,yf.decode)(e.encrypted_key)}catch{throw new vf.JWEInvalid("Failed to base64url decode the encrypted_key")}let d,f,p,h=!1;"function"==typeof t&&(t=await t(i,e),h=!0);try{d=await(0,Sf.default)(o,t,u,s,r)}catch(e){if(e instanceof TypeError||e instanceof vf.JWEInvalid||e instanceof vf.JOSENotSupported)throw e;d=(0,kf.default)(a)}try{f=(0,yf.decode)(e.iv)}catch{throw new vf.JWEInvalid("Failed to base64url decode the iv")}try{p=(0,yf.decode)(e.tag)}catch{throw new vf.JWEInvalid("Failed to base64url decode the tag")}const m=Ef.encoder.encode(null!==(n=e.protected)&&void 0!==n?n:"");let y,g;y=void 0!==e.aad?(0,Ef.concat)(m,Ef.encoder.encode("."),Ef.encoder.encode(e.aad)):m;try{g=(0,yf.decode)(e.ciphertext)}catch{throw new vf.JWEInvalid("Failed to base64url decode the ciphertext")}let _=await(0,gf.default)(a,d,g,f,p,y);"DEF"===s.zip&&(_=await((null==r?void 0:r.inflateRaw)||_f.inflate)(_));const v={plaintext:_};if(void 0!==e.protected&&(v.protectedHeader=i),void 0!==e.aad)try{v.additionalAuthenticatedData=(0,yf.decode)(e.aad)}catch{throw new vf.JWEInvalid("Failed to base64url decode the aad")}return void 0!==e.unprotected&&(v.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(v.unprotectedHeader=e.header),h?{...v,key:t}:v},Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.compactDecrypt=void 0;const Cf=Nc,Tf=Wc,Rf=Mc;Pc.compactDecrypt=async function(e,t,r){if(e instanceof Uint8Array&&(e=Rf.decoder.decode(e)),"string"!=typeof e)throw new Tf.JWEInvalid("Compact JWE must be a string or Uint8Array");const{0:n,1:i,2:s,3:o,4:a,length:c}=e.split(".");if(5!==c)throw new Tf.JWEInvalid("Invalid Compact JWE");const l=await(0,Cf.flattenedDecrypt)({ciphertext:o,iv:s||void 0,protected:n||void 0,tag:a||void 0,encrypted_key:i||void 0},t,r),u={plaintext:l.plaintext,protectedHeader:l.protectedHeader};return"function"==typeof t?{...u,key:l.key}:u};var If={};Object.defineProperty(If,"__esModule",{value:!0}),If.generalDecrypt=void 0;const xf=Nc,jf=Wc,Pf=Gl;If.generalDecrypt=async function(e,t,r){if(!(0,Pf.default)(e))throw new jf.JWEInvalid("General JWE must be an object");if(!Array.isArray(e.recipients)||!e.recipients.every(Pf.default))throw new jf.JWEInvalid("JWE Recipients missing or incorrect type");if(!e.recipients.length)throw new jf.JWEInvalid("JWE Recipients has no members");for(const n of e.recipients)try{return await(0,xf.flattenedDecrypt)({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:n.encrypted_key,header:n.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},t,r)}catch{}throw new jf.JWEDecryptionFailed};var Nf={},$f={},Mf={},Df={},Lf={},Bf={};Object.defineProperty(Bf,"__esModule",{value:!0});Bf.default=class{constructor(e){if(48!==e[0])throw new TypeError;this.buffer=e,this.offset=1;if(this.decodeLength()!==e.length-this.offset)throw new TypeError}decodeLength(){let e=this.buffer[this.offset++];if(128&e){const t=-129&e;e=0;for(let r=0;r<t;r++)e=e<<8|this.buffer[this.offset+r];this.offset+=t}return e}unsignedInteger(){if(2!==this.buffer[this.offset++])throw new TypeError;let e=this.decodeLength();0===this.buffer[this.offset]&&(this.offset++,e--);const t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}end(){if(this.offset!==this.buffer.length)throw new TypeError}},Object.defineProperty(Lf,"__esModule",{value:!0});const Kf=s,Ff=$c,Uf=Bf,Wf=Wc,Jf=cu,Hf=ll,Gf=Qc,zf=gl,Vf=Sl,qf=_d,Xf=e=>{let t;if((0,Hf.isCryptoKey)(e)){if(!e.extractable)throw new TypeError("CryptoKey is not extractable");t=Kf.KeyObject.from(e)}else{if(!(0,Gf.default)(e)){if(e instanceof Uint8Array)return{kty:"oct",k:(0,Ff.encode)(e)};throw new TypeError((0,zf.default)(e,...Vf.types,"Uint8Array"))}t=e}if(qf.jwkExport){if("secret"!==t.type&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(t.asymmetricKeyType))throw new Wf.JOSENotSupported("Unsupported key asymmetricKeyType");return t.export({format:"jwk"})}switch(t.type){case"secret":return{kty:"oct",k:(0,Ff.encode)(t.export())};case"private":case"public":switch(t.asymmetricKeyType){case"rsa":{const e=t.export({format:"der",type:"pkcs1"}),r=new Uf.default(e);"private"===t.type&&r.unsignedInteger();const n=(0,Ff.encode)(r.unsignedInteger()),i=(0,Ff.encode)(r.unsignedInteger());let s;return"private"===t.type&&(s={d:(0,Ff.encode)(r.unsignedInteger()),p:(0,Ff.encode)(r.unsignedInteger()),q:(0,Ff.encode)(r.unsignedInteger()),dp:(0,Ff.encode)(r.unsignedInteger()),dq:(0,Ff.encode)(r.unsignedInteger()),qi:(0,Ff.encode)(r.unsignedInteger())}),r.end(),{kty:"RSA",n:n,e:i,...s}}case"ec":{const e=(0,Jf.default)(t);let r,n,i;switch(e){case"secp256k1":r=64,n=33,i=-1;break;case"P-256":r=64,n=36,i=-1;break;case"P-384":r=96,n=35,i=-3;break;case"P-521":r=132,n=35,i=-3;break;default:throw new Wf.JOSENotSupported("Unsupported curve")}if("public"===t.type){const n=t.export({type:"spki",format:"der"});return{kty:"EC",crv:e,x:(0,Ff.encode)(n.subarray(-r,-r/2)),y:(0,Ff.encode)(n.subarray(-r/2))}}const s=t.export({type:"pkcs8",format:"der"});return s.length<100&&(n+=i),{...Xf((0,Kf.createPublicKey)(t)),d:(0,Ff.encode)(s.subarray(n,n+r/2))}}case"ed25519":case"x25519":{const e=(0,Jf.default)(t);if("public"===t.type){const r=t.export({type:"spki",format:"der"});return{kty:"OKP",crv:e,x:(0,Ff.encode)(r.subarray(-32))}}const r=t.export({type:"pkcs8",format:"der"});return{...Xf((0,Kf.createPublicKey)(t)),d:(0,Ff.encode)(r.subarray(-32))}}case"ed448":case"x448":{const e=(0,Jf.default)(t);if("public"===t.type){const r=t.export({type:"spki",format:"der"});return{kty:"OKP",crv:e,x:(0,Ff.encode)(r.subarray("Ed448"===e?-57:-56))}}const r=t.export({type:"pkcs8",format:"der"});return{...Xf((0,Kf.createPublicKey)(t)),d:(0,Ff.encode)(r.subarray("Ed448"===e?-57:-56))}}default:throw new Wf.JOSENotSupported("Unsupported key asymmetricKeyType")}default:throw new Wf.JOSENotSupported("Unsupported key type")}};Lf.default=Xf,Object.defineProperty(Df,"__esModule",{value:!0}),Df.exportJWK=Df.exportPKCS8=Df.exportSPKI=void 0;const Yf=Qu,Zf=Qu,Qf=Lf;Df.exportSPKI=async function(e){return(0,Yf.toSPKI)(e)},Df.exportPKCS8=async function(e){return(0,Zf.toPKCS8)(e)},Df.exportJWK=async function(e){return(0,Qf.default)(e)},Object.defineProperty(Mf,"__esModule",{value:!0});const ep=Vl,tp=au,rp=vu,np=$u,ip=$c,sp=Vu,op=Wc,ap=Df,cp=Nd,lp=Dd;Mf.default=async function(e,t,r,n,i={}){let s,o,a;switch((0,cp.default)(e,r,"encrypt"),e){case"dir":a=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!tp.ecdhAllowed(r))throw new op.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:c,apv:l}=i;let{epk:u}=i;u||(u=(await tp.generateEpk(r)).privateKey);const{x:d,y:f,crv:p,kty:h}=await(0,ap.exportJWK)(u),m=await tp.deriveKey(r,u,"ECDH-ES"===e?t:e,"ECDH-ES"===e?(0,sp.bitLength)(t):parseInt(e.slice(-5,-2),10),c,l);if(o={epk:{x:d,crv:p,kty:h}},"EC"===h&&(o.epk.y=f),c&&(o.apu=(0,ip.encode)(c)),l&&(o.apv=(0,ip.encode)(l)),"ECDH-ES"===e){a=m;break}a=n||(0,sp.default)(t);const y=e.slice(-6);s=await(0,ep.wrap)(y,m,a);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":a=n||(0,sp.default)(t),s=await(0,np.encrypt)(e,r,a);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{a=n||(0,sp.default)(t);const{p2c:c,p2s:l}=i;({encryptedKey:s,...o}=await(0,rp.encrypt)(e,r,a,c,l));break}case"A128KW":case"A192KW":case"A256KW":a=n||(0,sp.default)(t),s=await(0,ep.wrap)(e,r,a);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{a=n||(0,sp.default)(t);const{iv:c}=i;({encryptedKey:s,...o}=await(0,lp.wrap)(e,r,a,c));break}default:throw new op.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:a,encryptedKey:s,parameters:o}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FlattenedEncrypt=e.unprotected=void 0;const t=$c,r=Ld,n=Bl,i=Hc,s=Mf,o=Wc,a=Hl,c=Mc,l=pf;e.unprotected=Symbol();e.FlattenedEncrypt=class{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(u,d){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new o.JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!(0,a.default)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new o.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const f={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if((0,l.default)(o.JWEInvalid,new Map,null==d?void 0:d.crit,this._protectedHeader,f),void 0!==f.zip){if(!this._protectedHeader||!this._protectedHeader.zip)throw new o.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==f.zip)throw new o.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:p,enc:h}=f;if("string"!=typeof p||!p)throw new o.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof h||!h)throw new o.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let m,y,g,_,v,b,w;if("dir"===p){if(this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Encryption")}else if("ECDH-ES"===p&&this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Key Agreement");{let t;({cek:y,encryptedKey:m,parameters:t}=await(0,s.default)(p,h,u,this._cek,this._keyManagementParameters)),t&&(d&&e.unprotected in d?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...t}:this.setUnprotectedHeader(t):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...t}:this.setProtectedHeader(t))}if(this._iv||(this._iv=(0,i.default)(h)),_=this._protectedHeader?c.encoder.encode((0,t.encode)(JSON.stringify(this._protectedHeader))):c.encoder.encode(""),this._aad?(v=(0,t.encode)(this._aad),g=(0,c.concat)(_,c.encoder.encode("."),c.encoder.encode(v))):g=_,"DEF"===f.zip){const e=await((null==d?void 0:d.deflateRaw)||n.deflate)(this._plaintext);({ciphertext:b,tag:w}=await(0,r.default)(h,e,y,this._iv,g))}else({ciphertext:b,tag:w}=await(0,r.default)(h,this._plaintext,y,this._iv,g));const S={ciphertext:(0,t.encode)(b),iv:(0,t.encode)(this._iv),tag:(0,t.encode)(w)};return m&&(S.encrypted_key=(0,t.encode)(m)),v&&(S.aad=v),this._protectedHeader&&(S.protected=c.decoder.decode(_)),this._sharedUnprotectedHeader&&(S.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(S.header=this._unprotectedHeader),S}}}($f),Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.GeneralEncrypt=void 0;const up=$f,dp=Wc,fp=Vu,pp=Hl,hp=Mf,mp=$c,yp=pf;class gp{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}}Nf.GeneralEncrypt=class{constructor(e){this._recipients=[],this._plaintext=e}addRecipient(e,t){const r=new gp(this,e,{crit:null==t?void 0:t.crit});return this._recipients.push(r),r}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(e){var t,r,n;if(!this._recipients.length)throw new dp.JWEInvalid("at least one recipient must be added");if(e={deflateRaw:null==e?void 0:e.deflateRaw},1===this._recipients.length){const[t]=this._recipients,r=await new up.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(t.unprotectedHeader).encrypt(t.key,{...t.options,...e});let n={ciphertext:r.ciphertext,iv:r.iv,recipients:[{}],tag:r.tag};return r.aad&&(n.aad=r.aad),r.protected&&(n.protected=r.protected),r.unprotected&&(n.unprotected=r.unprotected),r.encrypted_key&&(n.recipients[0].encrypted_key=r.encrypted_key),r.header&&(n.recipients[0].header=r.header),n}let i;for(let e=0;e<this._recipients.length;e++){const t=this._recipients[e];if(!(0,pp.default)(this._protectedHeader,this._unprotectedHeader,t.unprotectedHeader))throw new dp.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader,...t.unprotectedHeader},{alg:n}=r;if("string"!=typeof n||!n)throw new dp.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("dir"===n||"ECDH-ES"===n)throw new dp.JWEInvalid('"dir" and "ECDH-ES" alg may only be used with a single recipient');if("string"!=typeof r.enc||!r.enc)throw new dp.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(i){if(i!==r.enc)throw new dp.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}else i=r.enc;if((0,yp.default)(dp.JWEInvalid,new Map,t.options.crit,this._protectedHeader,r),!(void 0===r.zip||this._protectedHeader&&this._protectedHeader.zip))throw new dp.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected')}const s=(0,fp.default)(i);let o={ciphertext:"",iv:"",recipients:[],tag:""};for(let a=0;a<this._recipients.length;a++){const c=this._recipients[a],l={};o.recipients.push(l);const u={...this._protectedHeader,...this._unprotectedHeader,...c.unprotectedHeader}.alg.startsWith("PBES2")?2048+a:void 0;if(0===a){const t=await new up.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(s).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(c.unprotectedHeader).setKeyManagementParameters({p2c:u}).encrypt(c.key,{...c.options,...e,[up.unprotected]:!0});o.ciphertext=t.ciphertext,o.iv=t.iv,o.tag=t.tag,t.aad&&(o.aad=t.aad),t.protected&&(o.protected=t.protected),t.unprotected&&(o.unprotected=t.unprotected),l.encrypted_key=t.encrypted_key,t.header&&(l.header=t.header);continue}const{encryptedKey:d,parameters:f}=await(0,hp.default)((null===(t=c.unprotectedHeader)||void 0===t?void 0:t.alg)||(null===(r=this._protectedHeader)||void 0===r?void 0:r.alg)||(null===(n=this._unprotectedHeader)||void 0===n?void 0:n.alg),i,c.key,s,{p2c:u});l.encrypted_key=(0,mp.encode)(d),(c.unprotectedHeader||f)&&(l.header={...c.unprotectedHeader,...f})}return o}};var _p={},vp={},bp={},wp={};Object.defineProperty(wp,"__esModule",{value:!0});const Sp=Wc;wp.default=function(e){switch(e){case"PS256":case"RS256":case"ES256":case"ES256K":return"sha256";case"PS384":case"RS384":case"ES384":return"sha384";case"PS512":case"RS512":case"ES512":return"sha512";case"EdDSA":return;default:throw new Sp.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}};var Ep={};Object.defineProperty(Ep,"__esModule",{value:!0});const kp=s,Ap=cu,Op=Wc,Cp=Mu,Tp=_d,Rp={padding:kp.constants.RSA_PKCS1_PSS_PADDING,saltLength:kp.constants.RSA_PSS_SALTLEN_DIGEST},Ip=new Map([["ES256","P-256"],["ES256K","secp256k1"],["ES384","P-384"],["ES512","P-521"]]);Ep.default=function(e,t){switch(e){case"EdDSA":if(!["ed25519","ed448"].includes(t.asymmetricKeyType))throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448");return t;case"RS256":case"RS384":case"RS512":if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,Cp.default)(t,e),t;case Tp.rsaPssParams&&"PS256":case Tp.rsaPssParams&&"PS384":case Tp.rsaPssParams&&"PS512":if("rsa-pss"===t.asymmetricKeyType){const{hashAlgorithm:r,mgf1HashAlgorithm:n,saltLength:i}=t.asymmetricKeyDetails,s=parseInt(e.slice(-3),10);if(void 0!==r&&(r!==`sha${s}`||n!==r))throw new TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}`);if(void 0!==i&&i>s>>3)throw new TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}`)}else if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss");return(0,Cp.default)(t,e),{key:t,...Rp};case!Tp.rsaPssParams&&"PS256":case!Tp.rsaPssParams&&"PS384":case!Tp.rsaPssParams&&"PS512":if("rsa"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");return(0,Cp.default)(t,e),{key:t,...Rp};case"ES256":case"ES256K":case"ES384":case"ES512":{if("ec"!==t.asymmetricKeyType)throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be ec");const r=(0,Ap.default)(t),n=Ip.get(e);if(r!==n)throw new TypeError(`Invalid key curve for the algorithm, its curve must be ${n}, got ${r}`);return{dsaEncoding:"ieee-p1363",key:t}}default:throw new Op.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}};var xp={},jp={};Object.defineProperty(jp,"__esModule",{value:!0});const Pp=Wc;jp.default=function(e){switch(e){case"HS256":return"sha256";case"HS384":return"sha384";case"HS512":return"sha512";default:throw new Pp.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}};var Np={};Object.defineProperty(Np,"__esModule",{value:!0});const $p=s,Mp=ll,Dp=fl,Lp=gl,Bp=Sl;Np.default=function(e,t,r){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError((0,Lp.default)(t,...Bp.types));return(0,$p.createSecretKey)(t)}if(t instanceof $p.KeyObject)return t;if((0,Mp.isCryptoKey)(t))return(0,Dp.checkSigCryptoKey)(t,e,r),$p.KeyObject.from(t);throw new TypeError((0,Lp.default)(t,...Bp.types,"Uint8Array"))},Object.defineProperty(xp,"__esModule",{value:!0});const Kp=s,Fp=t,Up=wp,Wp=jp,Jp=Ep,Hp=Np;let Gp;Gp=Kp.sign.length>3?(0,Fp.promisify)(Kp.sign):Kp.sign;xp.default=async(e,t,r)=>{const n=(0,Hp.default)(e,t,"sign");if(e.startsWith("HS")){const t=Kp.createHmac((0,Wp.default)(e),n);return t.update(r),t.digest()}return Gp((0,Up.default)(e),r,(0,Jp.default)(e,n))},Object.defineProperty(bp,"__esModule",{value:!0});const zp=s,Vp=t,qp=wp,Xp=Ep,Yp=xp,Zp=Np,Qp=_d;let eh;eh=zp.verify.length>4&&Qp.oneShotCallback?(0,Vp.promisify)(zp.verify):zp.verify;bp.default=async(e,t,r,n)=>{const i=(0,Zp.default)(e,t,"verify");if(e.startsWith("HS")){const t=await(0,Yp.default)(e,i,n),s=r;try{return zp.timingSafeEqual(s,t)}catch{return!1}}const s=(0,qp.default)(e),o=(0,Xp.default)(e,i);try{return await eh(s,n,o,r)}catch{return!1}},Object.defineProperty(vp,"__esModule",{value:!0}),vp.flattenedVerify=void 0;const th=$c,rh=bp,nh=Wc,ih=Mc,sh=Hl,oh=Gl,ah=Nd,ch=pf,lh=mf;vp.flattenedVerify=async function(e,t,r){var n;if(!(0,oh.default)(e))throw new nh.JWSInvalid("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new nh.JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new nh.JWSInvalid("JWS Protected Header incorrect type");if(void 0===e.payload)throw new nh.JWSInvalid("JWS Payload missing");if("string"!=typeof e.signature)throw new nh.JWSInvalid("JWS Signature missing or incorrect type");if(void 0!==e.header&&!(0,oh.default)(e.header))throw new nh.JWSInvalid("JWS Unprotected Header incorrect type");let i={};if(e.protected)try{const t=(0,th.decode)(e.protected);i=JSON.parse(ih.decoder.decode(t))}catch{throw new nh.JWSInvalid("JWS Protected Header is invalid")}if(!(0,sh.default)(i,e.header))throw new nh.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const s={...i,...e.header};let o=!0;if((0,ch.default)(nh.JWSInvalid,new Map([["b64",!0]]),null==r?void 0:r.crit,i,s).has("b64")&&(o=i.b64,"boolean"!=typeof o))throw new nh.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:a}=s;if("string"!=typeof a||!a)throw new nh.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=r&&(0,lh.default)("algorithms",r.algorithms);if(c&&!c.has(a))throw new nh.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(o){if("string"!=typeof e.payload)throw new nh.JWSInvalid("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new nh.JWSInvalid("JWS Payload must be a string or an Uint8Array instance");let l=!1;"function"==typeof t&&(t=await t(i,e),l=!0),(0,ah.default)(a,t,"verify");const u=(0,ih.concat)(ih.encoder.encode(null!==(n=e.protected)&&void 0!==n?n:""),ih.encoder.encode("."),"string"==typeof e.payload?ih.encoder.encode(e.payload):e.payload);let d,f;try{d=(0,th.decode)(e.signature)}catch{throw new nh.JWSInvalid("Failed to base64url decode the signature")}if(!await(0,rh.default)(a,t,d,u))throw new nh.JWSSignatureVerificationFailed;if(o)try{f=(0,th.decode)(e.payload)}catch{throw new nh.JWSInvalid("Failed to base64url decode the payload")}else f="string"==typeof e.payload?ih.encoder.encode(e.payload):e.payload;const p={payload:f};return void 0!==e.protected&&(p.protectedHeader=i),void 0!==e.header&&(p.unprotectedHeader=e.header),l?{...p,key:t}:p},Object.defineProperty(_p,"__esModule",{value:!0}),_p.compactVerify=void 0;const uh=vp,dh=Wc,fh=Mc;_p.compactVerify=async function(e,t,r){if(e instanceof Uint8Array&&(e=fh.decoder.decode(e)),"string"!=typeof e)throw new dh.JWSInvalid("Compact JWS must be a string or Uint8Array");const{0:n,1:i,2:s,length:o}=e.split(".");if(3!==o)throw new dh.JWSInvalid("Invalid Compact JWS");const a=await(0,uh.flattenedVerify)({payload:i,protected:n,signature:s},t,r),c={payload:a.payload,protectedHeader:a.protectedHeader};return"function"==typeof t?{...c,key:a.key}:c};var ph={};Object.defineProperty(ph,"__esModule",{value:!0}),ph.generalVerify=void 0;const hh=vp,mh=Wc,yh=Gl;ph.generalVerify=async function(e,t,r){if(!(0,yh.default)(e))throw new mh.JWSInvalid("General JWS must be an object");if(!Array.isArray(e.signatures)||!e.signatures.every(yh.default))throw new mh.JWSInvalid("JWS Signatures missing or incorrect type");for(const n of e.signatures)try{return await(0,hh.flattenedVerify)({header:n.header,payload:e.payload,protected:n.protected,signature:n.signature},t,r)}catch{}throw new mh.JWSSignatureVerificationFailed};var gh={},_h={},vh={};Object.defineProperty(vh,"__esModule",{value:!0}),vh.default=e=>Math.floor(e.getTime()/1e3);var bh={};Object.defineProperty(bh,"__esModule",{value:!0});const wh=86400,Sh=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;bh.default=e=>{const t=Sh.exec(e);if(!t)throw new TypeError("Invalid time period format");const r=parseFloat(t[1]);switch(t[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(r);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(60*r);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(3600*r);case"day":case"days":case"d":return Math.round(r*wh);case"week":case"weeks":case"w":return Math.round(604800*r);default:return Math.round(31557600*r)}},Object.defineProperty(_h,"__esModule",{value:!0});const Eh=Wc,kh=Mc,Ah=vh,Oh=bh,Ch=Gl,Th=e=>e.toLowerCase().replace(/^application\//,"");_h.default=(e,t,r={})=>{const{typ:n}=r;if(n&&("string"!=typeof e.typ||Th(e.typ)!==Th(n)))throw new Eh.JWTClaimValidationFailed('unexpected "typ" JWT header value',"typ","check_failed");let i;try{i=JSON.parse(kh.decoder.decode(t))}catch{}if(!(0,Ch.default)(i))throw new Eh.JWTInvalid("JWT Claims Set must be a top-level JSON object");const{requiredClaims:s=[],issuer:o,subject:a,audience:c,maxTokenAge:l}=r;void 0!==l&&s.push("iat"),void 0!==c&&s.push("aud"),void 0!==a&&s.push("sub"),void 0!==o&&s.push("iss");for(const e of new Set(s.reverse()))if(!(e in i))throw new Eh.JWTClaimValidationFailed(`missing required "${e}" claim`,e,"missing");if(o&&!(Array.isArray(o)?o:[o]).includes(i.iss))throw new Eh.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");if(a&&i.sub!==a)throw new Eh.JWTClaimValidationFailed('unexpected "sub" claim value',"sub","check_failed");if(c&&(u=i.aud,d="string"==typeof c?[c]:c,!("string"==typeof u?d.includes(u):Array.isArray(u)&&d.some(Set.prototype.has.bind(new Set(u))))))throw new Eh.JWTClaimValidationFailed('unexpected "aud" claim value',"aud","check_failed");var u,d;let f;switch(typeof r.clockTolerance){case"string":f=(0,Oh.default)(r.clockTolerance);break;case"number":f=r.clockTolerance;break;case"undefined":f=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:p}=r,h=(0,Ah.default)(p||new Date);if((void 0!==i.iat||l)&&"number"!=typeof i.iat)throw new Eh.JWTClaimValidationFailed('"iat" claim must be a number',"iat","invalid");if(void 0!==i.nbf){if("number"!=typeof i.nbf)throw new Eh.JWTClaimValidationFailed('"nbf" claim must be a number',"nbf","invalid");if(i.nbf>h+f)throw new Eh.JWTClaimValidationFailed('"nbf" claim timestamp check failed',"nbf","check_failed")}if(void 0!==i.exp){if("number"!=typeof i.exp)throw new Eh.JWTClaimValidationFailed('"exp" claim must be a number',"exp","invalid");if(i.exp<=h-f)throw new Eh.JWTExpired('"exp" claim timestamp check failed',"exp","check_failed")}if(l){const e=h-i.iat;if(e-f>("number"==typeof l?l:(0,Oh.default)(l)))throw new Eh.JWTExpired('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(e<0-f)throw new Eh.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return i},Object.defineProperty(gh,"__esModule",{value:!0}),gh.jwtVerify=void 0;const Rh=_p,Ih=_h,xh=Wc;gh.jwtVerify=async function(e,t,r){var n;const i=await(0,Rh.compactVerify)(e,t,r);if((null===(n=i.protectedHeader.crit)||void 0===n?void 0:n.includes("b64"))&&!1===i.protectedHeader.b64)throw new xh.JWTInvalid("JWTs MUST NOT use unencoded payload");const s={payload:(0,Ih.default)(i.protectedHeader,i.payload,r),protectedHeader:i.protectedHeader};return"function"==typeof t?{...s,key:i.key}:s};var jh={};Object.defineProperty(jh,"__esModule",{value:!0}),jh.jwtDecrypt=void 0;const Ph=Pc,Nh=_h,$h=Wc;jh.jwtDecrypt=async function(e,t,r){const n=await(0,Ph.compactDecrypt)(e,t,r),i=(0,Nh.default)(n.protectedHeader,n.plaintext,r),{protectedHeader:s}=n;if(void 0!==s.iss&&s.iss!==i.iss)throw new $h.JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',"iss","mismatch");if(void 0!==s.sub&&s.sub!==i.sub)throw new $h.JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',"sub","mismatch");if(void 0!==s.aud&&JSON.stringify(s.aud)!==JSON.stringify(i.aud))throw new $h.JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch',"aud","mismatch");const o={payload:i,protectedHeader:s};return"function"==typeof t?{...o,key:n.key}:o};var Mh={};Object.defineProperty(Mh,"__esModule",{value:!0}),Mh.CompactEncrypt=void 0;const Dh=$f;Mh.CompactEncrypt=class{constructor(e){this._flattened=new Dh.FlattenedEncrypt(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){const r=await this._flattened.encrypt(e,t);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")}};var Lh={},Bh={};Object.defineProperty(Bh,"__esModule",{value:!0}),Bh.FlattenedSign=void 0;const Kh=$c,Fh=xp,Uh=Hl,Wh=Wc,Jh=Mc,Hh=Nd,Gh=pf;Bh.FlattenedSign=class{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new Wh.JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!(0,Uh.default)(this._protectedHeader,this._unprotectedHeader))throw new Wh.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader};let n=!0;if((0,Gh.default)(Wh.JWSInvalid,new Map([["b64",!0]]),null==t?void 0:t.crit,this._protectedHeader,r).has("b64")&&(n=this._protectedHeader.b64,"boolean"!=typeof n))throw new Wh.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:i}=r;if("string"!=typeof i||!i)throw new Wh.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');(0,Hh.default)(i,e,"sign");let s,o=this._payload;n&&(o=Jh.encoder.encode((0,Kh.encode)(o))),s=this._protectedHeader?Jh.encoder.encode((0,Kh.encode)(JSON.stringify(this._protectedHeader))):Jh.encoder.encode("");const a=(0,Jh.concat)(s,Jh.encoder.encode("."),o),c=await(0,Fh.default)(i,e,a),l={signature:(0,Kh.encode)(c),payload:""};return n&&(l.payload=Jh.decoder.decode(o)),this._unprotectedHeader&&(l.header=this._unprotectedHeader),this._protectedHeader&&(l.protected=Jh.decoder.decode(s)),l}},Object.defineProperty(Lh,"__esModule",{value:!0}),Lh.CompactSign=void 0;const zh=Bh;Lh.CompactSign=class{constructor(e){this._flattened=new zh.FlattenedSign(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){const r=await this._flattened.sign(e,t);if(void 0===r.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}};var Vh={};Object.defineProperty(Vh,"__esModule",{value:!0}),Vh.GeneralSign=void 0;const qh=Bh,Xh=Wc;class Yh{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setProtectedHeader(e){if(this.protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}}Vh.GeneralSign=class{constructor(e){this._signatures=[],this._payload=e}addSignature(e,t){const r=new Yh(this,e,t);return this._signatures.push(r),r}async sign(){if(!this._signatures.length)throw new Xh.JWSInvalid("at least one signature must be added");const e={signatures:[],payload:""};for(let t=0;t<this._signatures.length;t++){const r=this._signatures[t],n=new qh.FlattenedSign(this._payload);n.setProtectedHeader(r.protectedHeader),n.setUnprotectedHeader(r.unprotectedHeader);const{payload:i,...s}=await n.sign(r.key,r.options);if(0===t)e.payload=i;else if(e.payload!==i)throw new Xh.JWSInvalid("inconsistent use of JWS Unencoded Payload (RFC7797)");e.signatures.push(s)}return e}};var Zh={},Qh={};Object.defineProperty(Qh,"__esModule",{value:!0}),Qh.ProduceJWT=void 0;const em=vh,tm=Gl,rm=bh;Qh.ProduceJWT=class{constructor(e){if(!(0,tm.default)(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return this._payload="number"==typeof e?{...this._payload,nbf:e}:{...this._payload,nbf:(0,em.default)(new Date)+(0,rm.default)(e)},this}setExpirationTime(e){return this._payload="number"==typeof e?{...this._payload,exp:e}:{...this._payload,exp:(0,em.default)(new Date)+(0,rm.default)(e)},this}setIssuedAt(e){return this._payload=void 0===e?{...this._payload,iat:(0,em.default)(new Date)}:{...this._payload,iat:e},this}},Object.defineProperty(Zh,"__esModule",{value:!0}),Zh.SignJWT=void 0;const nm=Lh,im=Wc,sm=Mc,om=Qh;class am extends om.ProduceJWT{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){var r;const n=new nm.CompactSign(sm.encoder.encode(JSON.stringify(this._payload)));if(n.setProtectedHeader(this._protectedHeader),Array.isArray(null===(r=this._protectedHeader)||void 0===r?void 0:r.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new im.JWTInvalid("JWTs MUST NOT use unencoded payload");return n.sign(e,t)}}Zh.SignJWT=am;var cm={};Object.defineProperty(cm,"__esModule",{value:!0}),cm.EncryptJWT=void 0;const lm=Mh,um=Mc,dm=Qh;class fm extends dm.ProduceJWT{setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,t){const r=new lm.CompactEncrypt(um.encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),r.setProtectedHeader(this._protectedHeader),this._iv&&r.setInitializationVector(this._iv),this._cek&&r.setContentEncryptionKey(this._cek),this._keyManagementParameters&&r.setKeyManagementParameters(this._keyManagementParameters),r.encrypt(e,t)}}cm.EncryptJWT=fm;var pm={};Object.defineProperty(pm,"__esModule",{value:!0}),pm.calculateJwkThumbprintUri=pm.calculateJwkThumbprint=void 0;const hm=Dc,mm=$c,ym=Wc,gm=Mc,_m=Gl,vm=(e,t)=>{if("string"!=typeof e||!e)throw new ym.JWKInvalid(`${t} missing or invalid`)};async function bm(e,t){if(!(0,_m.default)(e))throw new TypeError("JWK must be an object");if(null!=t||(t="sha256"),"sha256"!==t&&"sha384"!==t&&"sha512"!==t)throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let r;switch(e.kty){case"EC":vm(e.crv,'"crv" (Curve) Parameter'),vm(e.x,'"x" (X Coordinate) Parameter'),vm(e.y,'"y" (Y Coordinate) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":vm(e.crv,'"crv" (Subtype of Key Pair) Parameter'),vm(e.x,'"x" (Public Key) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":vm(e.e,'"e" (Exponent) Parameter'),vm(e.n,'"n" (Modulus) Parameter'),r={e:e.e,kty:e.kty,n:e.n};break;case"oct":vm(e.k,'"k" (Key Value) Parameter'),r={k:e.k,kty:e.kty};break;default:throw new ym.JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported')}const n=gm.encoder.encode(JSON.stringify(r));return(0,mm.encode)(await(0,hm.default)(t,n))}pm.calculateJwkThumbprint=bm,pm.calculateJwkThumbprintUri=async function(e,t){null!=t||(t="sha256");const r=await bm(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${r}`};var wm={};Object.defineProperty(wm,"__esModule",{value:!0}),wm.EmbeddedJWK=void 0;const Sm=Zu,Em=Gl,km=Wc;wm.EmbeddedJWK=async function(e,t){const r={...e,...null==t?void 0:t.header};if(!(0,Em.default)(r.jwk))throw new km.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');const n=await(0,Sm.importJWK)({...r.jwk,ext:!0},r.alg,!0);if(n instanceof Uint8Array||"public"!==n.type)throw new km.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');return n};var Am={};Object.defineProperty(Am,"__esModule",{value:!0}),Am.createLocalJWKSet=Am.LocalJWKSet=Am.isJWKSLike=void 0;const Om=Zu,Cm=Wc,Tm=Gl;function Rm(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(Im)}function Im(e){return(0,Tm.default)(e)}Am.isJWKSLike=Rm;class xm{constructor(e){if(this._cached=new WeakMap,!Rm(e))throw new Cm.JWKSInvalid("JSON Web Key Set malformed");var t;this._jwks=(t=e,"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t)))}async getKey(e,t){const{alg:r,kid:n}={...e,...null==t?void 0:t.header},i=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new Cm.JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set')}}(r),s=this._jwks.keys.filter((e=>{let t=i===e.kty;if(t&&"string"==typeof n&&(t=n===e.kid),t&&"string"==typeof e.alg&&(t=r===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t&&"EdDSA"===r&&(t="Ed25519"===e.crv||"Ed448"===e.crv),t)switch(r){case"ES256":t="P-256"===e.crv;break;case"ES256K":t="secp256k1"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv}return t})),{0:o,length:a}=s;if(0===a)throw new Cm.JWKSNoMatchingKey;if(1!==a){const e=new Cm.JWKSMultipleMatchingKeys,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(const e of s)try{yield await jm(t,e,r)}catch{continue}},e}return jm(this._cached,o,r)}}async function jm(e,t,r){const n=e.get(t)||e.set(t,{}).get(t);if(void 0===n[r]){const e=await(0,Om.importJWK)({...t,ext:!0},r);if(e instanceof Uint8Array||"public"!==e.type)throw new Cm.JWKSInvalid("JSON Web Key Set members must be public keys");n[r]=e}return n[r]}Am.LocalJWKSet=xm,Am.createLocalJWKSet=function(e){const t=new xm(e);return async function(e,r){return t.getKey(e,r)}};var Pm={},Nm={};Object.defineProperty(Nm,"__esModule",{value:!0});const $m=a,Mm=c,Dm=l,Lm=Wc,Bm=Mc;Nm.default=async(e,t,r)=>{let n;switch(e.protocol){case"https:":n=Mm.get;break;case"http:":n=$m.get;break;default:throw new TypeError("Unsupported URL protocol.")}const{agent:i,headers:s}=r,o=n(e.href,{agent:i,timeout:t,headers:s}),[a]=await Promise.race([(0,Dm.once)(o,"response"),(0,Dm.once)(o,"timeout")]);if(!a)throw o.destroy(),new Lm.JWKSTimeout;if(200!==a.statusCode)throw new Lm.JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");const c=[];for await(const e of a)c.push(e);try{return JSON.parse(Bm.decoder.decode((0,Bm.concat)(...c)))}catch{throw new Lm.JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON")}},Object.defineProperty(Pm,"__esModule",{value:!0}),Pm.createRemoteJWKSet=void 0;const Km=Nm,Fm=Wc,Um=Am;class Wm extends Um.LocalJWKSet{constructor(e,t){if(super({keys:[]}),this._jwks=void 0,!(e instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(e.href),this._options={agent:null==t?void 0:t.agent,headers:null==t?void 0:t.headers},this._timeoutDuration="number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3,this._cooldownDuration="number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(e,t){this._jwks&&this.fresh()||await this.reload();try{return await super.getKey(e,t)}catch(r){if(r instanceof Fm.JWKSNoMatchingKey&&!1===this.coolingDown())return await this.reload(),super.getKey(e,t);throw r}}async reload(){this._pendingFetch&&("undefined"!=typeof WebSocketPair||"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||"undefined"!=typeof EdgeRuntime&&"vercel"===EdgeRuntime)&&(this._pendingFetch=void 0),this._pendingFetch||(this._pendingFetch=(0,Km.default)(this._url,this._timeoutDuration,this._options).then((e=>{if(!(0,Um.isJWKSLike)(e))throw new Fm.JWKSInvalid("JSON Web Key Set malformed");this._jwks={keys:e.keys},this._jwksTimestamp=Date.now(),this._pendingFetch=void 0})).catch((e=>{throw this._pendingFetch=void 0,e}))),await this._pendingFetch}}Pm.createRemoteJWKSet=function(e,t){const r=new Wm(e,t);return async function(e,t){return r.getKey(e,t)}};var Jm={};Object.defineProperty(Jm,"__esModule",{value:!0}),Jm.UnsecuredJWT=void 0;const Hm=$c,Gm=Mc,zm=Wc,Vm=_h,qm=Qh;class Xm extends qm.ProduceJWT{encode(){return`${Hm.encode(JSON.stringify({alg:"none"}))}.${Hm.encode(JSON.stringify(this._payload))}.`}static decode(e,t){if("string"!=typeof e)throw new zm.JWTInvalid("Unsecured JWT must be a string");const{0:r,1:n,2:i,length:s}=e.split(".");if(3!==s||""!==i)throw new zm.JWTInvalid("Invalid Unsecured JWT");let o;try{if(o=JSON.parse(Gm.decoder.decode(Hm.decode(r))),"none"!==o.alg)throw new Error}catch{throw new zm.JWTInvalid("Invalid Unsecured JWT")}return{payload:(0,Vm.default)(o,Hm.decode(n),t),header:o}}}Jm.UnsecuredJWT=Xm;var Ym={},Zm={};Object.defineProperty(Zm,"__esModule",{value:!0}),Zm.decode=Zm.encode=void 0;const Qm=$c;Zm.encode=Qm.encode,Zm.decode=Qm.decode,Object.defineProperty(Ym,"__esModule",{value:!0}),Ym.decodeProtectedHeader=void 0;const ey=Zm,ty=Mc,ry=Gl;Ym.decodeProtectedHeader=function(e){let t;if("string"==typeof e){const r=e.split(".");3!==r.length&&5!==r.length||([t]=r)}else if("object"==typeof e&&e){if(!("protected"in e))throw new TypeError("Token does not contain a Protected Header");t=e.protected}try{if("string"!=typeof t||!t)throw new Error;const e=JSON.parse(ty.decoder.decode((0,ey.decode)(t)));if(!(0,ry.default)(e))throw new Error;return e}catch{throw new TypeError("Invalid Token or Protected Header formatting")}};var ny={};Object.defineProperty(ny,"__esModule",{value:!0}),ny.decodeJwt=void 0;const iy=Zm,sy=Mc,oy=Gl,ay=Wc;ny.decodeJwt=function(e){if("string"!=typeof e)throw new ay.JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:r}=e.split(".");if(5===r)throw new ay.JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(3!==r)throw new ay.JWTInvalid("Invalid JWT");if(!t)throw new ay.JWTInvalid("JWTs must contain a payload");let n,i;try{n=(0,iy.decode)(t)}catch{throw new ay.JWTInvalid("Failed to base64url decode the payload")}try{i=JSON.parse(sy.decoder.decode(n))}catch{throw new ay.JWTInvalid("Failed to parse the decoded payload as JSON")}if(!(0,oy.default)(i))throw new ay.JWTInvalid("Invalid JWT Claims Set");return i};var cy={},ly={};Object.defineProperty(ly,"__esModule",{value:!0}),ly.generateKeyPair=ly.generateSecret=void 0;const uy=s,dy=Gc,fy=Mu,py=Wc,hy=(0,t.promisify)(uy.generateKeyPair);ly.generateSecret=async function(e,t){let r;switch(e){case"HS256":case"HS384":case"HS512":case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":r=parseInt(e.slice(-3),10);break;case"A128KW":case"A192KW":case"A256KW":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":r=parseInt(e.slice(1,4),10);break;default:throw new py.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return(0,uy.createSecretKey)((0,dy.default)(new Uint8Array(r>>3)))},ly.generateKeyPair=async function(e,t){var r,n;switch(e){case"RS256":case"RS384":case"RS512":case"PS256":case"PS384":case"PS512":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":case"RSA1_5":{const e=null!==(r=null==t?void 0:t.modulusLength)&&void 0!==r?r:2048;if("number"!=typeof e||e<2048)throw new py.JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");const n=await hy("rsa",{modulusLength:e,publicExponent:65537});return(0,fy.setModulusLength)(n.privateKey,e),(0,fy.setModulusLength)(n.publicKey,e),n}case"ES256":return hy("ec",{namedCurve:"P-256"});case"ES256K":return hy("ec",{namedCurve:"secp256k1"});case"ES384":return hy("ec",{namedCurve:"P-384"});case"ES512":return hy("ec",{namedCurve:"P-521"});case"EdDSA":switch(null==t?void 0:t.crv){case void 0:case"Ed25519":return hy("ed25519");case"Ed448":return hy("ed448");default:throw new py.JOSENotSupported("Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448")}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":const e=null!==(n=null==t?void 0:t.crv)&&void 0!==n?n:"P-256";switch(e){case void 0:case"P-256":case"P-384":case"P-521":return hy("ec",{namedCurve:e});case"X25519":return hy("x25519");case"X448":return hy("x448");default:throw new py.JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}default:throw new py.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}},Object.defineProperty(cy,"__esModule",{value:!0}),cy.generateKeyPair=void 0;const my=ly;cy.generateKeyPair=async function(e,t){return(0,my.generateKeyPair)(e,t)};var yy={};Object.defineProperty(yy,"__esModule",{value:!0}),yy.generateSecret=void 0;const gy=ly;yy.generateSecret=async function(e,t){return(0,gy.generateSecret)(e,t)};var _y={},vy={};Object.defineProperty(vy,"__esModule",{value:!0}),vy.default="node:crypto",Object.defineProperty(_y,"__esModule",{value:!0});const by=vy;function wy(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="JwksError",this.message=e}_y.default=by.default,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.cryptoRuntime=e.base64url=e.generateSecret=e.generateKeyPair=e.errors=e.decodeJwt=e.decodeProtectedHeader=e.importJWK=e.importX509=e.importPKCS8=e.importSPKI=e.exportJWK=e.exportSPKI=e.exportPKCS8=e.UnsecuredJWT=e.createRemoteJWKSet=e.createLocalJWKSet=e.EmbeddedJWK=e.calculateJwkThumbprintUri=e.calculateJwkThumbprint=e.EncryptJWT=e.SignJWT=e.GeneralSign=e.FlattenedSign=e.CompactSign=e.FlattenedEncrypt=e.CompactEncrypt=e.jwtDecrypt=e.jwtVerify=e.generalVerify=e.flattenedVerify=e.compactVerify=e.GeneralEncrypt=e.generalDecrypt=e.flattenedDecrypt=e.compactDecrypt=void 0;var t=Pc;Object.defineProperty(e,"compactDecrypt",{enumerable:!0,get:function(){return t.compactDecrypt}});var r=Nc;Object.defineProperty(e,"flattenedDecrypt",{enumerable:!0,get:function(){return r.flattenedDecrypt}});var n=If;Object.defineProperty(e,"generalDecrypt",{enumerable:!0,get:function(){return n.generalDecrypt}});var i=Nf;Object.defineProperty(e,"GeneralEncrypt",{enumerable:!0,get:function(){return i.GeneralEncrypt}});var s=_p;Object.defineProperty(e,"compactVerify",{enumerable:!0,get:function(){return s.compactVerify}});var o=vp;Object.defineProperty(e,"flattenedVerify",{enumerable:!0,get:function(){return o.flattenedVerify}});var a=ph;Object.defineProperty(e,"generalVerify",{enumerable:!0,get:function(){return a.generalVerify}});var c=gh;Object.defineProperty(e,"jwtVerify",{enumerable:!0,get:function(){return c.jwtVerify}});var l=jh;Object.defineProperty(e,"jwtDecrypt",{enumerable:!0,get:function(){return l.jwtDecrypt}});var u=Mh;Object.defineProperty(e,"CompactEncrypt",{enumerable:!0,get:function(){return u.CompactEncrypt}});var d=$f;Object.defineProperty(e,"FlattenedEncrypt",{enumerable:!0,get:function(){return d.FlattenedEncrypt}});var f=Lh;Object.defineProperty(e,"CompactSign",{enumerable:!0,get:function(){return f.CompactSign}});var p=Bh;Object.defineProperty(e,"FlattenedSign",{enumerable:!0,get:function(){return p.FlattenedSign}});var h=Vh;Object.defineProperty(e,"GeneralSign",{enumerable:!0,get:function(){return h.GeneralSign}});var m=Zh;Object.defineProperty(e,"SignJWT",{enumerable:!0,get:function(){return m.SignJWT}});var y=cm;Object.defineProperty(e,"EncryptJWT",{enumerable:!0,get:function(){return y.EncryptJWT}});var g=pm;Object.defineProperty(e,"calculateJwkThumbprint",{enumerable:!0,get:function(){return g.calculateJwkThumbprint}}),Object.defineProperty(e,"calculateJwkThumbprintUri",{enumerable:!0,get:function(){return g.calculateJwkThumbprintUri}});var _=wm;Object.defineProperty(e,"EmbeddedJWK",{enumerable:!0,get:function(){return _.EmbeddedJWK}});var v=Am;Object.defineProperty(e,"createLocalJWKSet",{enumerable:!0,get:function(){return v.createLocalJWKSet}});var b=Pm;Object.defineProperty(e,"createRemoteJWKSet",{enumerable:!0,get:function(){return b.createRemoteJWKSet}});var w=Jm;Object.defineProperty(e,"UnsecuredJWT",{enumerable:!0,get:function(){return w.UnsecuredJWT}});var S=Df;Object.defineProperty(e,"exportPKCS8",{enumerable:!0,get:function(){return S.exportPKCS8}}),Object.defineProperty(e,"exportSPKI",{enumerable:!0,get:function(){return S.exportSPKI}}),Object.defineProperty(e,"exportJWK",{enumerable:!0,get:function(){return S.exportJWK}});var E=Zu;Object.defineProperty(e,"importSPKI",{enumerable:!0,get:function(){return E.importSPKI}}),Object.defineProperty(e,"importPKCS8",{enumerable:!0,get:function(){return E.importPKCS8}}),Object.defineProperty(e,"importX509",{enumerable:!0,get:function(){return E.importX509}}),Object.defineProperty(e,"importJWK",{enumerable:!0,get:function(){return E.importJWK}});var k=Ym;Object.defineProperty(e,"decodeProtectedHeader",{enumerable:!0,get:function(){return k.decodeProtectedHeader}});var A=ny;Object.defineProperty(e,"decodeJwt",{enumerable:!0,get:function(){return A.decodeJwt}}),e.errors=Wc;var O=cy;Object.defineProperty(e,"generateKeyPair",{enumerable:!0,get:function(){return O.generateKeyPair}});var C=yy;Object.defineProperty(e,"generateSecret",{enumerable:!0,get:function(){return C.generateSecret}}),e.base64url=Zm;var T=_y;Object.defineProperty(e,"cryptoRuntime",{enumerable:!0,get:function(){return T.default}})}(jc),wy.prototype=Object.create(Error.prototype),wy.prototype.constructor=wy;var Sy=wy;const Ey=jc,ky=Sy;function Ay(e){if(e.alg)return e.alg;if("RSA"===e.kty)return"RS256";if("EC"===e.kty)switch(e.crv){case"P-256":return"ES256";case"secp256k1":return"ES256K";case"P-384":return"ES384";case"P-521":return"ES512"}if("OKP"===e.kty)switch(e.crv){case"Ed25519":case"Ed448":return"EdDSA"}throw new ky("Unsupported JWK")}var Oy={retrieveSigningKeys:async function(e){const t=[];e=e.filter((({use:e})=>"sig"===e||void 0===e)).filter((({kty:e})=>"RSA"===e||"EC"===e||"OKP"===e));for(const r of e)try{const e=await Ey.importJWK(r,Ay(r));if("public"!==e.type)continue;let n;switch(e[Symbol.toStringTag]){case"CryptoKey":{const t=await Ey.exportSPKI(e);n=()=>t;break}default:n=()=>e.export({format:"pem",type:"spki"})}t.push({get publicKey(){return n()},get rsaPublicKey(){return n()},getPublicKey:()=>n(),..."string"==typeof r.kid&&r.kid?{kid:r.kid}:void 0,..."string"==typeof r.alg&&r.alg?{alg:r.alg}:void 0})}catch(e){continue}return t}},Cy={};const Ty=a,Ry=c,Iy=e;Cy.default=e=>e.fetcher?e.fetcher(e.uri):new Promise(((t,r)=>{const{hostname:n,path:i,port:s,protocol:o}=Iy.parse(e.uri),a={hostname:n,path:i,port:s,method:"GET",...e.headers&&{headers:{...e.headers}},...e.timeout&&{timeout:e.timeout},...e.agent&&{agent:e.agent}},c=("https:"===o?Ry:Ty).request(a,(e=>{let n="";e.setEncoding("utf8"),e.on("data",(e=>{n+=e})),e.on("end",(()=>{if(e.statusCode<200||e.statusCode>=300){const t=e.body&&(e.body.message||e.body)||e.statusMessage||`Http Error ${e.statusCode}`;r({errorMsg:t})}else try{t(n&&JSON.parse(n))}catch(e){r(e)}}))}));c.on("timeout",(()=>c.destroy())).on("error",(e=>r(e))).end()}));var xy,jy,Py={},Ny={};var $y=My;function My(e){var t=this;if(t instanceof My||(t=new My),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,n=arguments.length;r<n;r++)t.push(arguments[r]);return t}function Dy(e,t,r){var n=t===e.head?new Ky(r,null,t,e):new Ky(r,t,t.next,e);return null===n.next&&(e.tail=n),null===n.prev&&(e.head=n),e.length++,n}function Ly(e,t){e.tail=new Ky(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function By(e,t){e.head=new Ky(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function Ky(e,t,r,n){if(!(this instanceof Ky))return new Ky(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}My.Node=Ky,My.create=My,My.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},My.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++}},My.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++}},My.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)Ly(this,arguments[e]);return this.length},My.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)By(this,arguments[e]);return this.length},My.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}},My.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}},My.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},My.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},My.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},My.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},My.prototype.map=function(e,t){t=t||this;for(var r=new My,n=this.head;null!==n;)r.push(e.call(t,n.value,this)),n=n.next;return r},My.prototype.mapReverse=function(e,t){t=t||this;for(var r=new My,n=this.tail;null!==n;)r.push(e.call(t,n.value,this)),n=n.prev;return r},My.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},My.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},My.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},My.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},My.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new My;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=0,i=this.head;null!==i&&n<e;n++)i=i.next;for(;null!==i&&n<t;n++,i=i.next)r.push(i.value);return r},My.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new My;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=this.length,i=this.tail;null!==i&&n>t;n--)i=i.prev;for(;null!==i&&n>e;n--,i=i.prev)r.push(i.value);return r},My.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,i=this.head;null!==i&&n<e;n++)i=i.next;var s=[];for(n=0;i&&n<t;n++)s.push(i.value),i=this.removeNode(i);null===i&&(i=this.tail),i!==this.head&&i!==this.tail&&(i=i.prev);for(n=0;n<r.length;n++)i=Dy(this,i,r[n]);return s},My.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{(jy||(jy=1,xy=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),xy)(My)}catch(HL){}const Fy=$y,Uy=Symbol("max"),Wy=Symbol("length"),Jy=Symbol("lengthCalculator"),Hy=Symbol("allowStale"),Gy=Symbol("maxAge"),zy=Symbol("dispose"),Vy=Symbol("noDisposeOnSet"),qy=Symbol("lruList"),Xy=Symbol("cache"),Yy=Symbol("updateAgeOnGet"),Zy=()=>1;const Qy=(e,t,r)=>{const n=e[Xy].get(t);if(n){const t=n.value;if(eg(e,t)){if(rg(e,n),!e[Hy])return}else r&&(e[Yy]&&(n.value.now=Date.now()),e[qy].unshiftNode(n));return t.value}},eg=(e,t)=>{if(!t||!t.maxAge&&!e[Gy])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[Gy]&&r>e[Gy]},tg=e=>{if(e[Wy]>e[Uy])for(let t=e[qy].tail;e[Wy]>e[Uy]&&null!==t;){const r=t.prev;rg(e,t),t=r}},rg=(e,t)=>{if(t){const r=t.value;e[zy]&&e[zy](r.key,r.value),e[Wy]-=r.length,e[Xy].delete(r.key),e[qy].removeNode(t)}};class ng{constructor(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}}const ig=(e,t,r,n)=>{let i=r.value;eg(e,i)&&(rg(e,r),e[Hy]||(i=void 0)),i&&t.call(n,i.value,i.key,e)};var sg=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[Uy]=e.max||1/0;const t=e.length||Zy;if(this[Jy]="function"!=typeof t?Zy:t,this[Hy]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[Gy]=e.maxAge||0,this[zy]=e.dispose,this[Vy]=e.noDisposeOnSet||!1,this[Yy]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[Uy]=e||1/0,tg(this)}get max(){return this[Uy]}set allowStale(e){this[Hy]=!!e}get allowStale(){return this[Hy]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[Gy]=e,tg(this)}get maxAge(){return this[Gy]}set lengthCalculator(e){"function"!=typeof e&&(e=Zy),e!==this[Jy]&&(this[Jy]=e,this[Wy]=0,this[qy].forEach((e=>{e.length=this[Jy](e.value,e.key),this[Wy]+=e.length}))),tg(this)}get lengthCalculator(){return this[Jy]}get length(){return this[Wy]}get itemCount(){return this[qy].length}rforEach(e,t){t=t||this;for(let r=this[qy].tail;null!==r;){const n=r.prev;ig(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[qy].head;null!==r;){const n=r.next;ig(this,e,r,t),r=n}}keys(){return this[qy].toArray().map((e=>e.key))}values(){return this[qy].toArray().map((e=>e.value))}reset(){this[zy]&&this[qy]&&this[qy].length&&this[qy].forEach((e=>this[zy](e.key,e.value))),this[Xy]=new Map,this[qy]=new Fy,this[Wy]=0}dump(){return this[qy].map((e=>!eg(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[qy]}set(e,t,r){if((r=r||this[Gy])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,i=this[Jy](t,e);if(this[Xy].has(e)){if(i>this[Uy])return rg(this,this[Xy].get(e)),!1;const s=this[Xy].get(e).value;return this[zy]&&(this[Vy]||this[zy](e,s.value)),s.now=n,s.maxAge=r,s.value=t,this[Wy]+=i-s.length,s.length=i,this.get(e),tg(this),!0}const s=new ng(e,t,i,n,r);return s.length>this[Uy]?(this[zy]&&this[zy](e,t),!1):(this[Wy]+=s.length,this[qy].unshift(s),this[Xy].set(e,this[qy].head),tg(this),!0)}has(e){if(!this[Xy].has(e))return!1;const t=this[Xy].get(e).value;return!eg(this,t)}get(e){return Qy(this,e,!0)}peek(e){return Qy(this,e,!1)}pop(){const e=this[qy].tail;return e?(rg(this,e),e.value):null}del(e){rg(this,this[Xy].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const e=i-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[Xy].forEach(((e,t)=>Qy(this,t,!1)))}},og={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,i="[object Arguments]",s="[object Boolean]",o="[object Date]",a="[object Function]",c="[object GeneratorFunction]",l="[object Map]",u="[object Number]",d="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",m="[object String]",y="[object Symbol]",g="[object WeakMap]",_="[object ArrayBuffer]",v="[object DataView]",b="[object Float32Array]",w="[object Float64Array]",S="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",A="[object Uint8Array]",O="[object Uint8ClampedArray]",C="[object Uint16Array]",T="[object Uint32Array]",R=/\w*$/,I=/^\[object .+?Constructor\]$/,x=/^(?:0|[1-9]\d*)$/,j={};j[i]=j["[object Array]"]=j[_]=j[v]=j[s]=j[o]=j[b]=j[w]=j[S]=j[E]=j[k]=j[l]=j[u]=j[d]=j[p]=j[h]=j[m]=j[y]=j[A]=j[O]=j[C]=j[T]=!0,j["[object Error]"]=j[a]=j[g]=!1;var P="object"==typeof jr&&jr&&jr.Object===Object&&jr,N="object"==typeof self&&self&&self.Object===Object&&self,$=P||N||Function("return this")(),M=t&&!t.nodeType&&t,D=M&&e&&!e.nodeType&&e,L=D&&D.exports===M;function B(e,t){return e.set(t[0],t[1]),e}function K(e,t){return e.add(t),e}function F(e,t,r,n){var i=-1,s=e?e.length:0;for(n&&s&&(r=e[++i]);++i<s;)r=t(r,e[i],i,e);return r}function U(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function W(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function J(e,t){return function(r){return e(t(r))}}function H(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var G=Array.prototype,z=Function.prototype,V=Object.prototype,q=$["__core-js_shared__"],X=function(){var e=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Y=z.toString,Z=V.hasOwnProperty,Q=V.toString,ee=RegExp("^"+Y.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),te=L?$.Buffer:void 0,re=$.Symbol,ne=$.Uint8Array,ie=J(Object.getPrototypeOf,Object),se=Object.create,oe=V.propertyIsEnumerable,ae=G.splice,ce=Object.getOwnPropertySymbols,le=te?te.isBuffer:void 0,ue=J(Object.keys,Object),de=Me($,"DataView"),fe=Me($,"Map"),pe=Me($,"Promise"),he=Me($,"Set"),me=Me($,"WeakMap"),ye=Me(Object,"create"),ge=Fe(de),_e=Fe(fe),ve=Fe(pe),be=Fe(he),we=Fe(me),Se=re?re.prototype:void 0,Ee=Se?Se.valueOf:void 0;function ke(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ae(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Ce(e){this.__data__=new Ae(e)}function Te(e,t){var r=We(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Je(e)}(e)&&Z.call(e,"callee")&&(!oe.call(e,"callee")||Q.call(e)==i)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,s=!!n;for(var o in e)!t&&!Z.call(e,o)||s&&("length"==o||Be(o,n))||r.push(o);return r}function Re(e,t,r){var n=e[t];Z.call(e,t)&&Ue(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function Ie(e,t){for(var r=e.length;r--;)if(Ue(e[r][0],t))return r;return-1}function xe(e,t,r,n,f,g,I){var x;if(n&&(x=g?n(e,f,g,I):n(e)),void 0!==x)return x;if(!ze(e))return e;var P=We(e);if(P){if(x=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(e,x)}else{var N=Le(e),$=N==a||N==c;if(He(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(N==d||N==i||$&&!g){if(U(e))return g?e:{};if(x=function(e){return"function"!=typeof e.constructor||Ke(e)?{}:(t=ie(e),ze(t)?se(t):{});var t}($?{}:e),!t)return function(e,t){return Ne(e,De(e),t)}(e,function(e,t){return e&&Ne(t,Ve(t),e)}(x,e))}else{if(!j[N])return g?e:{};x=function(e,t,r,n){var i=e.constructor;switch(t){case _:return Pe(e);case s:case o:return new i(+e);case v:return function(e,t){var r=t?Pe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,n);case b:case w:case S:case E:case k:case A:case O:case C:case T:return function(e,t){var r=t?Pe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,n);case l:return function(e,t,r){var n=t?r(W(e),!0):W(e);return F(n,B,new e.constructor)}(e,n,r);case u:case m:return new i(e);case p:return function(e){var t=new e.constructor(e.source,R.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,r){var n=t?r(H(e),!0):H(e);return F(n,K,new e.constructor)}(e,n,r);case y:return function(e){return Ee?Object(Ee.call(e)):{}}(e)}}(e,N,xe,t)}}I||(I=new Ce);var M=I.get(e);if(M)return M;if(I.set(e,x),!P)var D=r?function(e){return function(e,t,r){var n=t(e);return We(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,Ve,De)}(e):Ve(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(D||e,(function(i,s){D&&(i=e[s=i]),Re(x,s,xe(i,t,r,n,s,e,I))})),x}function je(e){return!(!ze(e)||(t=e,X&&X in t))&&(Ge(e)||U(e)?ee:I).test(Fe(e));var t}function Pe(e){var t=new e.constructor(e.byteLength);return new ne(t).set(new ne(e)),t}function Ne(e,t,r,n){r||(r={});for(var i=-1,s=t.length;++i<s;){var o=t[i],a=n?n(r[o],e[o],o,r,e):void 0;Re(r,o,void 0===a?e[o]:a)}return r}function $e(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function Me(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return je(r)?r:void 0}ke.prototype.clear=function(){this.__data__=ye?ye(null):{}},ke.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ke.prototype.get=function(e){var t=this.__data__;if(ye){var n=t[e];return n===r?void 0:n}return Z.call(t,e)?t[e]:void 0},ke.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:Z.call(t,e)},ke.prototype.set=function(e,t){return this.__data__[e]=ye&&void 0===t?r:t,this},Ae.prototype.clear=function(){this.__data__=[]},Ae.prototype.delete=function(e){var t=this.__data__,r=Ie(t,e);return!(r<0)&&(r==t.length-1?t.pop():ae.call(t,r,1),!0)},Ae.prototype.get=function(e){var t=this.__data__,r=Ie(t,e);return r<0?void 0:t[r][1]},Ae.prototype.has=function(e){return Ie(this.__data__,e)>-1},Ae.prototype.set=function(e,t){var r=this.__data__,n=Ie(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},Oe.prototype.clear=function(){this.__data__={hash:new ke,map:new(fe||Ae),string:new ke}},Oe.prototype.delete=function(e){return $e(this,e).delete(e)},Oe.prototype.get=function(e){return $e(this,e).get(e)},Oe.prototype.has=function(e){return $e(this,e).has(e)},Oe.prototype.set=function(e,t){return $e(this,e).set(e,t),this},Ce.prototype.clear=function(){this.__data__=new Ae},Ce.prototype.delete=function(e){return this.__data__.delete(e)},Ce.prototype.get=function(e){return this.__data__.get(e)},Ce.prototype.has=function(e){return this.__data__.has(e)},Ce.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ae){var n=r.__data__;if(!fe||n.length<199)return n.push([e,t]),this;r=this.__data__=new Oe(n)}return r.set(e,t),this};var De=ce?J(ce,Object):function(){return[]},Le=function(e){return Q.call(e)};function Be(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||x.test(e))&&e>-1&&e%1==0&&e<t}function Ke(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||V)}function Fe(e){if(null!=e){try{return Y.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ue(e,t){return e===t||e!=e&&t!=t}(de&&Le(new de(new ArrayBuffer(1)))!=v||fe&&Le(new fe)!=l||pe&&Le(pe.resolve())!=f||he&&Le(new he)!=h||me&&Le(new me)!=g)&&(Le=function(e){var t=Q.call(e),r=t==d?e.constructor:void 0,n=r?Fe(r):void 0;if(n)switch(n){case ge:return v;case _e:return l;case ve:return f;case be:return h;case we:return g}return t});var We=Array.isArray;function Je(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}(e.length)&&!Ge(e)}var He=le||function(){return!1};function Ge(e){var t=ze(e)?Q.call(e):"";return t==a||t==c}function ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ve(e){return Je(e)?Te(e):function(e){if(!Ke(e))return ue(e);var t=[];for(var r in Object(e))Z.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return xe(e,!0,!0)}}(og,og.exports);var ag=og.exports,cg={};Object.defineProperty(cg,"__esModule",{value:!0}),cg.deepFreeze=void 0,cg.deepFreeze=function e(t){return t&&(Object.freeze(t),Object.getOwnPropertyNames(t).forEach((function(r){!t.hasOwnProperty(r)||null===t[r]||"object"!=typeof t[r]&&"function"!=typeof t[r]||t[r].constructor===Buffer||Object.isFrozen(t[r])||e(t[r])}))),t};var lg={},ug=jr&&jr.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},dg=jr&&jr.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ug(arguments[t]));return e},fg=jr&&jr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lg,"__esModule",{value:!0}),lg.syncMemoizer=void 0;var pg=fg(sg),hg=l,mg=fg(ag),yg=cg;lg.syncMemoizer=function(e){var t=new pg.default(e),r=e.load,n=e.hash,i=e.bypass,s=e.itemMaxAge,o=e.freeze,a=e.clone,c=new hg.EventEmitter,l=Object.assign({del:function(){var e=n.apply(void 0,dg(arguments));t.del(e)},reset:function(){return t.reset()},keys:t.keys.bind(t),on:c.on.bind(c),once:c.once.bind(c)},e);if(e.disable)return Object.assign(r,l);function u(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.emit.apply(c,dg([e],t))}function d(e){return e&&e.then&&"function"==typeof e.then}function f(e){var t=e;return a&&(t=d(t)?t.then(mg.default):mg.default(t)),o&&(d(t)?t=t.then(yg.deepFreeze):yg.deepFreeze(t)),t}return Object.assign((function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];if(i&&i.apply(void 0,dg(e)))return u.apply(void 0,dg(["miss"],e)),r.apply(void 0,dg(e));var a=n.apply(void 0,dg(e)),c=t.get(a);if(c)return u.apply(void 0,dg(["hit"],e)),f(c);u.apply(void 0,dg(["miss"],e));var l=r.apply(void 0,dg(e));return s?t.set(a,l,s.apply(void 0,dg(e.concat([l])))):t.set(a,l),f(l)}),l)};var gg=jr&&jr.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},_g=jr&&jr.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(gg(arguments[t]));return e},vg=jr&&jr.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},bg=jr&&jr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ny,"__esModule",{value:!0}),Ny.asyncMemoizer=void 0;var wg=bg(sg),Sg=l,Eg=bg(ag),kg=cg,Ag=lg;function Og(e){var t=new wg.default(e),r=e.load,n=e.hash,i=e.bypass,s=e.itemMaxAge,o=e.freeze,a=e.clone,c=e.queueMaxAge||1e3,l=new Map,u=new Sg.EventEmitter,d=Object.assign({del:function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=n.apply(void 0,_g(e));t.del(i)},reset:function(){return t.reset()},keys:t.keys.bind(t),on:u.on.bind(u),once:u.once.bind(u)},e);if(e.disable)return Object.assign(r,d);function f(e,t){var r,n;try{for(var i=vg(e),s=i.next();!s.done;s=i.next()){var o=s.value;a?setImmediate.apply(void 0,_g([o],t.map(Eg.default))):setImmediate.apply(void 0,_g([o],t))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}function p(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.emit.apply(u,_g([e],t))}return Object.assign((function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];var u,d=e.slice(0,-1),h=e.slice(-1).pop();if(i&&i.apply(void 0,_g(d)))return p.apply(void 0,_g(["miss"],d)),r.apply(void 0,_g(e));u=0!==d.length||n?n.apply(void 0,_g(d)):"_";var m=t.get(u);if(m)return p.apply(void 0,_g(["hit"],d)),f([h],[null].concat(m));var y=l.get(u);if(y&&y.expiresAt>Date.now())return y.queue.push(h),void p.apply(void 0,_g(["queue"],d));p.apply(void 0,_g(["miss"],d));var g=Date.now(),_=[h];l.set(u,{queue:_,expiresAt:g+c}),r.apply(void 0,_g(d,[function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];e[0]||function(e,r,n){o&&n.forEach(kg.deepFreeze),s?t.set(e,n,s.apply(void 0,_g(r.concat(n)))):t.set(e,n)}(u,d,e.slice(1)),l.delete(u),p.apply(void 0,_g(["loaded",Date.now()-g],d)),f(_,e)}]))}),d)}Ny.asyncMemoizer=Og,Og.sync=Ag.syncMemoizer;var Cg=Ny.asyncMemoizer;const Tg=Qn("jwks"),Rg=Cg,{promisify:Ig,callbackify:xg}=t;Py.default=function(e,{cacheMaxEntries:t=5,cacheMaxAge:r=6e5}){return Tg(`Configured caching of signing keys. Max: ${t} / Age: ${r}`),Ig(Rg({hash:e=>e,load:xg(e.getSigningKey.bind(e)),maxAge:r,max:t}))};var jg={},Pg={},Ng=function(e,t,r,n){if(this.bucketSize=e,this.tokensPerInterval=t,"string"==typeof r)switch(r){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+r)}else this.interval=r;this.parentBucket=n,this.content=0,this.lastDrip=+new Date};Ng.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(e,t){var r=this;return this.bucketSize?e>this.bucketSize?(process.nextTick(t.bind(null,"Requested tokens "+e+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),e>this.content?n():this.parentBucket?this.parentBucket.removeTokens(e,(function(i,s){return i?t(i,null):e>r.content?n():(r.content-=e,void t(null,Math.min(s,r.content)))})):(this.content-=e,process.nextTick(t.bind(null,null,this.content)),!0)):(process.nextTick(t.bind(null,null,e,Number.POSITIVE_INFINITY)),!0);function n(){var n=Math.ceil((e-r.content)*(r.interval/r.tokensPerInterval));return setTimeout((function(){r.removeTokens(e,t)}),n),!1}},tryRemoveTokens:function(e){return!this.bucketSize||!(e>this.bucketSize)&&(this.drip(),!(e>this.content)&&(!(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))&&(this.content-=e,!0)))},drip:function(){if(this.tokensPerInterval){var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var r=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+r,this.bucketSize)}else this.content=this.bucketSize}};var $g=Ng,Mg=$g,Dg=function(){if("undefined"!=typeof process&&process.hrtime){var e=process.hrtime(),t=e[0],r=e[1];return 1e3*t+Math.floor(r/1e6)}return(new Date).getTime()},Lg=function(e,t,r){this.tokenBucket=new Mg(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=Dg(),this.tokensThisInterval=0,this.fireImmediately=r};Lg.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,t){if(e>this.tokenBucket.bucketSize)return process.nextTick(t.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var r=this,n=Dg();if((n<this.curIntervalStart||n-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=n,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)process.nextTick(t.bind(null,null,-1));else{var i=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-n);setTimeout((function(){r.tokenBucket.removeTokens(e,s)}),i)}return!1}return this.tokenBucket.removeTokens(e,s);function s(n,i){if(n)return t(n,null);r.tokensThisInterval+=e,t(null,i)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=Dg();if((t<this.curIntervalStart||t-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var r=this.tokenBucket.tryRemoveTokens(e);return r&&(this.tokensThisInterval+=e),r},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}};var Bg=Lg;function Kg(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="JwksRateLimitError",this.message=e}Pg.RateLimiter=Bg,Pg.TokenBucket=$g,Kg.prototype=Object.create(Error.prototype),Kg.prototype.constructor=Kg;var Fg=Kg;const Ug=Qn("jwks"),{RateLimiter:Wg}=Pg,Jg=Fg;jg.default=function(e,{jwksRequestsPerMinute:t=10}){const r=e.getSigningKey.bind(e),n=new Wg(t,"minute",!0);return Ug(`Configured rate limiting to JWKS endpoint at ${t}/minute`),async e=>await new Promise(((t,i)=>{n.removeTokens(1,(async(n,s)=>{if(n&&i(n),Ug("Requests to the JWKS endpoint available for the next minute:",s),s<0)Ug("Too many requests to the JWKS endpoint"),i(new Jg("Too many requests to the JWKS endpoint"));else try{const n=await r(e);t(n)}catch(e){i(e)}}))}))};var Hg={};const Gg=Oy.retrieveSigningKeys;Hg.default=function(e,{getKeysInterceptor:t}){const r=e.getSigningKey.bind(e);return async e=>{const n=await t();let i;if(n&&n.length&&(i=await Gg(n)),i&&i.length){const t=i.find((t=>!e||t.kid===e));if(t)return t}return r(e)}};var zg={};const{callbackify:Vg}=t;zg.default=e=>{const t=e.getSigningKey.bind(e);return(e,r)=>{if(r){return Vg(t)(e,r)}return t(e)}};var qg={request:Cy.default,cacheSigningKey:Py.default,rateLimitSigningKey:jg.default,getKeysInterceptor:Hg.default,callbackSupport:zg.default};function Xg(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="SigningKeyNotFoundError",this.message=e}Xg.prototype=Object.create(Error.prototype),Xg.prototype.constructor=Xg;var Yg=Xg;const Zg=Qn("jwks"),{retrieveSigningKeys:Qg}=Oy,{request:e_,cacheSigningKey:t_,rateLimitSigningKey:r_,getKeysInterceptor:n_,callbackSupport:i_}=qg,s_=Sy,o_=Yg;var a_={JwksClient:class{constructor(e){this.options={rateLimit:!1,cache:!0,timeout:3e4,...e},this.options.getKeysInterceptor&&(this.getSigningKey=n_(this,e)),this.options.rateLimit&&(this.getSigningKey=r_(this,e)),this.options.cache&&(this.getSigningKey=t_(this,e)),this.getSigningKey=i_(this,e)}async getKeys(){Zg(`Fetching keys from '${this.options.jwksUri}'`);try{const e=await e_({uri:this.options.jwksUri,headers:this.options.requestHeaders,agent:this.options.requestAgent,timeout:this.options.timeout,fetcher:this.options.fetcher});return Zg("Keys:",e.keys),e.keys}catch(e){const{errorMsg:t}=e;throw Zg("Failure:",t||e),t?new s_(t):e}}async getSigningKeys(){const e=await this.getKeys();if(!e||!e.length)throw new s_("The JWKS endpoint did not contain any keys");const t=await Qg(e);if(!t.length)throw new s_("The JWKS endpoint did not contain any signing keys");return Zg("Signing Keys:",t),t}async getSigningKey(e){Zg(`Fetching signing key for '${e}'`);const t=await this.getSigningKeys(),r=null!=e;if(!r&&t.length>1)throw Zg("No KID specified and JWKS endpoint returned more than 1 key"),new o_("No KID specified and JWKS endpoint returned more than 1 key");const n=t.find((t=>!r||t.kid===e));if(n)return n;throw Zg(`Unable to find a signing key that matches '${e}'`),new o_(`Unable to find a signing key that matches '${e}'`)}}};function c_(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="ArgumentError",this.message=e}c_.prototype=Object.create(Error.prototype),c_.prototype.constructor=c_;var l_={ArgumentError:c_,JwksError:Sy,JwksRateLimitError:Fg,SigningKeyNotFoundError:Yg},u_={exports:{}};var d_=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES256K","ES384","ES512","EdDSA"];!function(e){const{ArgumentError:t}=l_,{JwksClient:r}=a_,n=d_,i=(e,t)=>e&&"SigningKeyNotFoundError"===e.name||e?t(e,null,null):void 0;e.exports.hapiJwt2KeyAsync=t=>{const r=e.exports.hapiJwt2Key(t);return function(e){return new Promise(((t,n)=>{r(e,((e,r)=>{!r||e?n(e):t({key:r})}))}))}},e.exports.hapiJwt2Key=function(e){if(null==e)throw new t("An options object must be provided when initializing hapiJwt2Key");const s=new r(e),o=e.handleSigningKeyError||i;return function(e,t){return e&&e.header?n.includes(e.header.alg)?void s.getSigningKey(e.header.kid).then((e=>t(null,e.publicKey||e.rsaPublicKey,e))).catch((e=>o(e,(e=>t(e,null,null))))):t(new Error("Unsupported algorithm "+e.header.alg+" supplied."),null,null):t(new Error("Cannot find a signing certificate if there is no header"),null,null)}}}(u_);var f_=u_.exports,p_={};const{ArgumentError:h_}=l_,{JwksClient:m_}=a_,y_=d_,g_=(e,t)=>e&&"SigningKeyNotFoundError"===e.name?t(null):e?t(e):void 0;p_.expressJwtSecret=function(e){if(null==e)throw new h_("An options object must be provided when initializing expressJwtSecret");const t=new m_(e),r=e.handleSigningKeyError||g_,n=async(e,n)=>{if(!n)return;const i=n.header;if(i&&y_.includes(i.alg))try{const e=await t.getSigningKey(i.kid);return e.publicKey||e.rsaPublicKey}catch(e){return new Promise(((t,n)=>{r(e,(e=>{if(!e)return t();n(e)}))}))}};return function(e,t,r,i){if(4!==arguments.length)return n(0,arguments[1]);n(0,{header:t}).then((e=>{setImmediate(i,null,e)})).catch((e=>{setImmediate(i,e)}))}};var __={};const{ArgumentError:v_}=l_,{JwksClient:b_}=a_,w_=d_;__.koaJwtSecret=function(e={}){if(!e.jwksUri)throw new v_("No JWKS provided. Please provide a jwksUri");const t=new b_(e);return function({alg:r,kid:n}={}){return new Promise(((i,s)=>{if(!w_.includes(r))return s(new Error("Missing / invalid token algorithm"));t.getSigningKey(n).then((e=>{i(e.publicKey||e.rsaPublicKey)})).catch((t=>e.handleSigningKeyError?e.handleSigningKeyError(t).then(s):s(t)))}))}};var S_={};const E_=jc,{ArgumentError:k_}=l_,{JwksClient:A_}=a_,O_=d_,C_=(e,t)=>e&&"SigningKeyNotFoundError"===e.name?t(null):e?t(e):void 0;S_.passportJwtSecret=function(e){if(null==e)throw new k_("An options object must be provided when initializing passportJwtSecret");if(!e.jwksUri)throw new k_("No JWKS provided. Please provide a jwksUri");const t=new A_(e),r=e.handleSigningKeyError||C_;return function(e,n,i){let s;try{s={payload:E_.decodeJwt(n),header:E_.decodeProtectedHeader(n)}}catch(e){s=null}if(!s||!O_.includes(s.header.alg))return i(null,null);t.getSigningKey(s.header.kid).then((e=>{i(null,e.publicKey||e.rsaPublicKey)})).catch((e=>{r(e,(e=>i(e,null)))}))}};const{JwksClient:T_}=a_,R_=l_,{hapiJwt2Key:I_,hapiJwt2KeyAsync:x_}=f_,{expressJwtSecret:j_}=p_,{koaJwtSecret:P_}=__,{passportJwtSecret:N_}=S_;xc.exports=e=>new T_(e);var $_=xc.exports.JwksClient=T_;xc.exports.ArgumentError=R_.ArgumentError,xc.exports.JwksError=R_.JwksError,xc.exports.JwksRateLimitError=R_.JwksRateLimitError,xc.exports.SigningKeyNotFoundError=R_.SigningKeyNotFoundError,xc.exports.expressJwtSecret=j_,xc.exports.hapiJwt2Key=I_,xc.exports.hapiJwt2KeyAsync=x_,xc.exports.koaJwtSecret=P_,xc.exports.passportJwtSecret=N_;const{format:M_}=t;let D_=class extends Error{constructor({error_description:e,error:t,error_uri:r,session_state:n,state:i,scope:s},o){super(e?`${t} (${e})`:t),Object.assign(this,{error:t},e&&{error_description:e},r&&{error_uri:r},i&&{state:i},s&&{scope:s},n&&{session_state:n}),o&&Object.defineProperty(this,"response",{value:o}),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},L_=class extends Error{constructor(...e){if("string"==typeof e[0])super(M_(...e));else{const{message:t,printf:r,response:n,...i}=e[0];super(r?M_(...r):t),Object.assign(this,i),n&&Object.defineProperty(this,"response",{value:n})}this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}};var B_={OPError:D_,RPError:L_},K_={exports:{}};const F_=s,[U_,W_]=process.version.substring(1).split(".").map((e=>parseInt(e,10)));var J_=(U_>12||12===U_&&W_>=8)&&F_.getHashes().includes("shake256");const{strict:H_}=u,{createHash:G_}=s,{format:z_}=t,V_=J_;let q_;if(Buffer.isEncoding("base64url"))q_=e=>e.toString("base64url");else{const GL=e=>e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");q_=e=>GL(e.toString("base64"))}function X_(e,t,r){const n=function(e,t){switch(e){case"HS256":case"RS256":case"PS256":case"ES256":case"ES256K":return G_("sha256");case"HS384":case"RS384":case"PS384":case"ES384":return G_("sha384");case"HS512":case"RS512":case"PS512":case"ES512":return G_("sha512");case"EdDSA":switch(t){case"Ed25519":return G_("sha512");case"Ed448":if(!V_)throw new TypeError("Ed448 *_hash calculation is not supported in your Node.js runtime version");return G_("shake256",{outputLength:114});default:throw new TypeError("unrecognized or invalid EdDSA curve provided")}default:throw new TypeError("unrecognized or invalid JWS algorithm provided")}}(t,r).update(e).digest();return q_(n.slice(0,n.length/2))}var Y_={validate:function(e,t,r,n,i){if("string"!=typeof e.claim||!e.claim)throw new TypeError("names.claim must be a non-empty string");if("string"!=typeof e.source||!e.source)throw new TypeError("names.source must be a non-empty string");let s,o;H_("string"==typeof t&&t,`${e.claim} must be a non-empty string`),H_("string"==typeof r&&r,`${e.source} must be a non-empty string`);try{s=X_(r,n,i)}catch(t){o=z_("%s could not be validated (%s)",e.claim,t.message)}o=o||z_("%s mismatch, expected %s, got: %s",e.claim,s,t),H_.equal(s,t,o)},generate:X_};const Z_=s;var Q_=t.types.isKeyObject||(e=>e&&e instanceof Z_.KeyObject),ev={};let tv;if(Buffer.isEncoding("base64url"))tv=(e,t="utf8")=>Buffer.from(e,t).toString("base64url");else{const zL=e=>e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");tv=(e,t="utf8")=>zL(Buffer.from(e,t).toString("base64"))}ev.decode=e=>Buffer.from(e,"base64"),ev.encode=tv;const rv=ev;var nv={exports:{}},iv=e=>!!e&&e.constructor===Object;const sv=iv;function ov(e,t,...r){for(const n of r)if(sv(n))for(const[r,i]of Object.entries(n))"__proto__"!==r&&"constructor"!==r&&(void 0===t[r]&&void 0!==i&&(t[r]=i),e&&sv(t[r])&&sv(i)&&ov(!0,t[r],i));return t}nv.exports=ov.bind(void 0,!1),nv.exports.deep=ov.bind(void 0,!0);var av=nv.exports;const cv=/(\w+)=("[^"]*")/g;var lv=e=>{const t={};try{for(;null!==cv.exec(e);)RegExp.$1&&RegExp.$2&&(t[RegExp.$1]=RegExp.$2.slice(1,-1))}catch(e){}return t};var uv={assertSigningAlgValuesSupport:function(e,t,r){if(!t[`${e}_endpoint`])return;const n=`${e}_endpoint_auth_method`,i=`${e}_endpoint_auth_signing_alg`,s=`${e}_endpoint_auth_signing_alg_values_supported`;if(r[n]&&r[n].endsWith("_jwt")&&!r[i]&&!t[s])throw new TypeError(`${s} must be configured on the issuer if ${i} is not defined on a client`)},assertIssuerConfiguration:function(e,t){if(!e[t])throw new TypeError(`${t} must be configured on the issuer`)}},dv=function(e,...t){const r={};for(const n of t)void 0!==e[n]&&(r[n]=e[n]);return r};const{STATUS_CODES:fv}=a,{format:pv}=t,{OPError:hv}=B_,mv=lv;var yv=function(e,{statusCode:t=200,body:r=!0,bearer:n=!1}={}){if(e.statusCode!==t){if(n&&(e=>{const t=mv(e.headers["www-authenticate"]);if(t.error)throw new hv(t,e)})(e),(e=>{let t=!1;try{let r;r="object"!=typeof e.body||Buffer.isBuffer(e.body)?JSON.parse(e.body):e.body,t="string"==typeof r.error&&r.error.length,t&&Object.defineProperty(e,"body",{value:r,configurable:!0})}catch(e){}return t})(e))throw new hv(e.body,e);throw new hv({error:pv("expected %i %s, got: %i %s",t,fv[t],e.statusCode,fv[e.statusCode])},e)}if(r&&!e.body)throw new hv({error:pv("expected %i %s with body but no body was returned",t,fv[t])},e);return e.body},gv=()=>Math.floor(Date.now()/1e3);const _v=ev,vv=gv;var bv=class{constructor(e){Object.assign(this,e);const{constructor:t,...r}=Object.getOwnPropertyDescriptors(this.constructor.prototype);Object.defineProperties(this,r)}set expires_in(e){this.expires_at=vv()+Number(e)}get expires_in(){return Math.max.apply(null,[this.expires_at-vv(),0])}expired(){return 0===this.expires_in}claims(){if(!this.id_token)throw new TypeError("id_token not present in TokenSet");return JSON.parse(_v.decode(this.id_token.split(".")[1]))}};const{createHash:wv,randomBytes:Sv}=s,Ev=ev,kv=(e=32)=>Ev.encode(Sv(e));var Av={random:kv,state:kv,nonce:kv,codeVerifier:kv,codeChallenge:e=>Ev.encode(wv("sha256").update(e).digest())},Ov={exports:{}},Cv={name:"openid-client",version:"5.6.5",description:"OpenID Connect Relying Party (RP, Client) implementation for Node.js runtime, supports passportjs",keywords:["auth","authentication","basic","certified","client","connect","dynamic","electron","hybrid","identity","implicit","oauth","oauth2","oidc","openid","passport","relying party","strategy"],homepage:"https://github.com/panva/node-openid-client",repository:"panva/node-openid-client",funding:{url:"https://github.com/sponsors/panva"},license:"MIT",author:"Filip Skokan <panva.ip@gmail.com>",exports:{types:"./types/index.d.ts",import:"./lib/index.mjs",require:"./lib/index.js"},main:"./lib/index.js",types:"./types/index.d.ts",files:["lib","types/index.d.ts"],scripts:{format:"npx prettier --loglevel silent --write ./lib ./test ./certification ./types",test:"mocha test/**/*.test.js"},dependencies:{jose:"^4.15.5","lru-cache":"^6.0.0","object-hash":"^2.2.0","oidc-token-hash":"^5.0.3"},devDependencies:{"@types/node":"^16.18.87","@types/passport":"^1.0.16",base64url:"^3.0.1",chai:"^4.4.1",mocha:"^10.3.0",nock:"^13.5.4",prettier:"^2.8.8","readable-mock-req":"^0.2.2",sinon:"^9.2.4",timekeeper:"^2.3.1"},"standard-version":{scripts:{postchangelog:"sed -i '' -e 's/### \\[/## [/g' CHANGELOG.md"},types:[{type:"feat",section:"Features"},{type:"fix",section:"Fixes"},{type:"chore",hidden:!0},{type:"docs",hidden:!0},{type:"style",hidden:!0},{type:"refactor",section:"Refactor",hidden:!1},{type:"perf",section:"Performance",hidden:!1},{type:"test",hidden:!0}]}};const Tv=Symbol();var Rv={CLOCK_TOLERANCE:Symbol(),HTTP_OPTIONS:Tv};const Iv=u,xv=d,jv=a,Pv=c,{once:Nv}=l,{URL:$v}=e,Mv=sg,Dv=Cv,{RPError:Lv}=B_,Bv=dv,{deep:Kv}=av,{HTTP_OPTIONS:Fv}=Rv;let Uv;const Wv=/^[\x21\x23-\x5B\x5D-\x7E]+$/,Jv=["agent","ca","cert","crl","headers","key","lookup","passphrase","pfx","timeout"],Hv=(e,t)=>{Uv=Kv({},e.length?Bv(t,...e):t,Uv)};function Gv(e,t,r){r&&(e.removeHeader("content-type"),e.setHeader("content-type",r)),t&&(e.removeHeader("content-length"),e.setHeader("content-length",Buffer.byteLength(t)),e.write(t)),e.end()}Hv([],{headers:{"User-Agent":`${Dv.name}/${Dv.version} (${Dv.homepage})`,"Accept-Encoding":"identity"},timeout:3500});const zv=new Mv({max:100});Ov.exports=async function(e,{accessToken:t,mTLS:r=!1,DPoP:n}={}){let i;try{i=new $v(e.url),delete e.url,Iv(/^(https?:)$/.test(i.protocol))}catch(e){throw new TypeError("only valid absolute URLs can be requested")}const s=this[Fv];let o=e;const a=`${i.origin}${i.pathname}`;let c,l,u,d,f,p;if(n&&"dpopProof"in this&&(o.headers=o.headers||{},o.headers.DPoP=await this.dpopProof({htu:`${i.origin}${i.pathname}`,htm:e.method,nonce:zv.get(a)},n,t)),s&&(c=Bv(s.call(this,i,Kv({},o,Uv)),...Jv)),o=Kv({},c,o,Uv),r&&!o.pfx&&(!o.key||!o.cert))throw new TypeError("mutual-TLS certificate and key not set");if(o.searchParams)for(const[e,t]of Object.entries(o.searchParams))i.searchParams.delete(e),i.searchParams.set(e,t);({form:u,responseType:l,json:d,body:f,...o}=o);for(const[e,t]of Object.entries(o.headers||{}))void 0===t&&delete o.headers[e];const h=("https:"===i.protocol?Pv.request:jv.request)(i.href,o);return(async()=>{if(d?Gv(h,JSON.stringify(d),"application/json"):u?Gv(h,xv.stringify(u),"application/x-www-form-urlencoded"):f?Gv(h,f):Gv(h),[p]=await Promise.race([Nv(h,"response"),Nv(h,"timeout")]),!p)throw h.destroy(),new Lv(`outgoing request timed out after ${o.timeout}ms`);const e=[];for await(const t of p)e.push(t);if(e.length)switch(l){case"json":Object.defineProperty(p,"body",{get(){let t=Buffer.concat(e);try{t=JSON.parse(t)}catch(e){throw Object.defineProperty(e,"response",{value:p}),e}finally{Object.defineProperty(p,"body",{value:t,configurable:!0})}return t},configurable:!0});break;case void 0:case"buffer":Object.defineProperty(p,"body",{get(){const t=Buffer.concat(e);return Object.defineProperty(p,"body",{value:t,configurable:!0}),t},configurable:!0});break;default:throw new TypeError("unsupported responseType request option")}return p})().catch((e=>{throw p&&Object.defineProperty(e,"response",{value:p}),e})).finally((()=>{const e=p&&p.headers["dpop-nonce"];e&&Wv.test(e)&&zv.set(a,e)}))},Ov.exports.setDefaults=Hv.bind(void 0,Jv);var Vv=Ov.exports,qv={};qv.keystores=new WeakMap;var Xv=globalThis.structuredClone||(e=>JSON.parse(JSON.stringify(e)));const Yv=jc,Zv=Xv,Qv=iv,eb=Symbol(),tb=(e,{alg:t,use:r})=>{let n=0;return t&&e.alg&&n++,r&&e.use&&n++,n};function rb(e,t,r,n){if(t)return new Set([t]);switch(r){case"EC":{let t=[];if("enc"!==e&&void 0!==e||(t=t.concat(["ECDH-ES","ECDH-ES+A128KW","ECDH-ES+A192KW","ECDH-ES+A256KW"])),"sig"===e||void 0===e)switch(n){case"P-256":case"P-384":t=t.concat([`ES${n.slice(-3)}`]);break;case"P-521":t=t.concat(["ES512"]);break;case"secp256k1":"node:crypto"===Yv.cryptoRuntime&&(t=t.concat(["ES256K"]))}return new Set(t)}case"OKP":return new Set(["ECDH-ES","ECDH-ES+A128KW","ECDH-ES+A192KW","ECDH-ES+A256KW"]);case"RSA":{let t=[];return"enc"!==e&&void 0!==e||(t=t.concat(["RSA-OAEP","RSA-OAEP-256","RSA-OAEP-384","RSA-OAEP-512"]),"node:crypto"===Yv.cryptoRuntime&&(t=t.concat(["RSA1_5"]))),"sig"!==e&&void 0!==e||(t=t.concat(["PS256","PS384","PS512","RS256","RS384","RS512"])),new Set(t)}default:throw new Error("unreachable")}}var nb=class{#e;constructor(e,t){if(e!==eb)throw new Error("invalid constructor call");this.#e=t}toJWKS(){return{keys:this.map((({jwk:{d:e,p:t,q:r,dp:n,dq:i,qi:s,...o}})=>o))}}all({alg:e,kid:t,use:r}={}){if(!r||!e)throw new Error;const n=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:return}}(e),i={alg:e,use:r};return this.filter((i=>{let s=!0;return s&&void 0!==n&&i.jwk.kty!==n&&(s=!1),s&&void 0!==t&&i.jwk.kid!==t&&(s=!1),s&&void 0!==r&&void 0!==i.jwk.use&&i.jwk.use!==r&&(s=!1),s&&i.jwk.alg&&i.jwk.alg!==e?s=!1:i.algorithms.has(e)||(s=!1),s})).sort(((e,t)=>tb(t,i)-tb(e,i)))}get(...e){return this.all(...e)[0]}static async fromJWKS(e,{onlyPublic:t=!1,onlyPrivate:r=!1}={}){if(!Qv(e)||!Array.isArray(e.keys)||e.keys.some((e=>!Qv(e)||!("kty"in e))))throw new TypeError("jwks must be a JSON Web Key Set formatted object");const n=[];for(let i of e.keys){i=Zv(i);const{kty:e,kid:s,crv:o}=i;let{alg:a,use:c}=i;if("string"==typeof e&&e&&((void 0===c||"sig"===c||"enc"===c)&&!("string"!=typeof a&&void 0!==a||"string"!=typeof s&&void 0!==s))){if("EC"===e&&"sig"===c)switch(o){case"P-256":a="ES256";break;case"P-384":a="ES384";break;case"P-521":a="ES512"}if("secp256k1"===o&&(c="sig",a="ES256K"),"OKP"===e)switch(o){case"Ed25519":case"Ed448":c="sig",a="EdDSA";break;case"X25519":case"X448":c="enc"}if(a&&!c)switch(!0){case a.startsWith("ECDH"):case a.startsWith("RSA"):c="enc"}if(r&&("oct"===i.kty||!i.d))throw new Error("jwks must only contain private keys");t&&(i.d||i.k)||n.push({jwk:{...i,alg:a,use:c},async keyObject(e){if(this[e])return this[e];const t=await Yv.importJWK(this.jwk,e);return this[e]=t,t},get algorithms(){return Object.defineProperty(this,"algorithms",{value:rb(this.jwk.use,this.jwk.alg,this.jwk.kty,this.jwk.crv),enumerable:!0,configurable:!1}),this.algorithms}})}}return new this(eb,n)}filter(...e){return this.#e.filter(...e)}find(...e){return this.#e.find(...e)}every(...e){return this.#e.every(...e)}some(...e){return this.#e.some(...e)}map(...e){return this.#e.map(...e)}forEach(...e){return this.#e.forEach(...e)}reduce(...e){return this.#e.reduce(...e)}sort(...e){return this.#e.sort(...e)}*[Symbol.iterator](){for(const e of this.#e)yield e}};const ib=iv;var sb=function e(t,...r){for(const n of r)if(ib(n))for(const[r,i]of Object.entries(n))"__proto__"!==r&&"constructor"!==r&&(ib(t[r])&&ib(i)?t[r]=e(t[r],i):void 0!==i&&(t[r]=i));return t};const ob=jc,{RPError:ab}=B_,{assertIssuerConfiguration:cb}=uv,{random:lb}=Av,ub=gv,db=Vv,{keystores:fb}=qv,pb=sb,hb=e=>encodeURIComponent(e).replace(/%20/g,"+");async function mb(e,t){let r=this[`${e}_endpoint_auth_signing_alg`];if(r||cb(this.issuer,`${e}_endpoint_auth_signing_alg_values_supported`),"client_secret_jwt"===this[`${e}_endpoint_auth_method`]){if(!r){const t=this.issuer[`${e}_endpoint_auth_signing_alg_values_supported`];r=Array.isArray(t)&&t.find((e=>/^HS(?:256|384|512)/.test(e)))}if(!r)throw new ab(`failed to determine a JWS Algorithm to use for ${this[`${e}_endpoint_auth_method`]} Client Assertion`);return new ob.CompactSign(Buffer.from(JSON.stringify(t))).setProtectedHeader({alg:r}).sign(this.secretForAlg(r))}const n=await fb.get(this);if(!n)throw new TypeError("no client jwks provided for signing a client assertion with");if(!r){const t=this.issuer[`${e}_endpoint_auth_signing_alg_values_supported`];r=Array.isArray(t)&&t.find((e=>n.get({alg:e,use:"sig"})))}if(!r)throw new ab(`failed to determine a JWS Algorithm to use for ${this[`${e}_endpoint_auth_method`]} Client Assertion`);const i=n.get({alg:r,use:"sig"});if(!i)throw new ab(`no key found in client jwks to sign a client assertion with using alg ${r}`);return new ob.CompactSign(Buffer.from(JSON.stringify(t))).setProtectedHeader({alg:r,kid:i.jwk&&i.jwk.kid}).sign(await i.keyObject(r))}async function yb(e,{clientAssertionPayload:t}={}){switch(this[`${e}_endpoint_auth_method`]){case"self_signed_tls_client_auth":case"tls_client_auth":case"none":return{form:{client_id:this.client_id}};case"client_secret_post":if("string"!=typeof this.client_secret)throw new TypeError("client_secret_post client authentication method requires a client_secret");return{form:{client_id:this.client_id,client_secret:this.client_secret}};case"private_key_jwt":case"client_secret_jwt":{const r=ub(),n=[...new Set([this.issuer.issuer,this.issuer.token_endpoint].filter(Boolean))],i=await mb.call(this,e,{iat:r,exp:r+60,jti:lb(),iss:this.client_id,sub:this.client_id,aud:n,...t});return{form:{client_id:this.client_id,client_assertion:i,client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}}case"client_secret_basic":{if("string"!=typeof this.client_secret)throw new TypeError("client_secret_basic client authentication method requires a client_secret");const e=`${hb(this.client_id)}:${hb(this.client_secret)}`;return{headers:{Authorization:`Basic ${Buffer.from(e).toString("base64")}`}}}default:throw new TypeError(`missing, or unsupported, ${e}_endpoint_auth_method`)}}var gb={resolveResponseType:function(){const{length:e,0:t}=this.response_types;if(1===e)return t},resolveRedirectUri:function(){const{length:e,0:t}=this.redirect_uris||[];if(1===e)return t},authFor:yb,authenticatedPost:async function(e,t,{clientAssertionPayload:r,endpointAuthMethod:n=e,DPoP:i}={}){const s=await yb.call(this,n,{clientAssertionPayload:r}),o=pb(t,s),a=this[`${n}_endpoint_auth_method`].includes("tls_client_auth")||"token"===e&&this.tls_client_certificate_bound_access_tokens;let c;if(a&&this.issuer.mtls_endpoint_aliases&&(c=this.issuer.mtls_endpoint_aliases[`${e}_endpoint`]),c=c||this.issuer[`${e}_endpoint`],"form"in o)for(const[e,t]of Object.entries(o.form))void 0===t&&delete o.form[e];return db.call(this,{...o,method:"POST",url:c,headers:{..."revocation"!==e?{Accept:"application/json"}:void 0,...o.headers}},{mTLS:a,DPoP:i})}},_b={},vb={exports:{}};!function(e,t){var r=s;function n(e,t){return function(e,t){var n;n="passthrough"!==t.algorithm?r.createHash(t.algorithm):new u;void 0===n.write&&(n.write=n.update,n.end=n.update);var i=l(t,n);i.dispatch(e),n.update||n.end("");if(n.digest)return n.digest("buffer"===t.encoding?void 0:t.encoding);var s=n.read();if("buffer"===t.encoding)return s;return s.toString(t.encoding)}(e,t=a(e,t))}(t=vb.exports=n).sha1=function(e){return n(e)},t.keys=function(e){return n(e,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},t.MD5=function(e){return n(e,{algorithm:"md5",encoding:"hex"})},t.keysMD5=function(e){return n(e,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var i=r.getHashes?r.getHashes().slice():["sha1","md5"];i.push("passthrough");var o=["buffer","hex","binary","base64"];function a(e,t){t=t||{};var r={};if(r.algorithm=t.algorithm||"sha1",r.encoding=t.encoding||"hex",r.excludeValues=!!t.excludeValues,r.algorithm=r.algorithm.toLowerCase(),r.encoding=r.encoding.toLowerCase(),r.ignoreUnknown=!0===t.ignoreUnknown,r.respectType=!1!==t.respectType,r.respectFunctionNames=!1!==t.respectFunctionNames,r.respectFunctionProperties=!1!==t.respectFunctionProperties,r.unorderedArrays=!0===t.unorderedArrays,r.unorderedSets=!1!==t.unorderedSets,r.unorderedObjects=!1!==t.unorderedObjects,r.replacer=t.replacer||void 0,r.excludeKeys=t.excludeKeys||void 0,void 0===e)throw new Error("Object argument required.");for(var n=0;n<i.length;++n)i[n].toLowerCase()===r.algorithm.toLowerCase()&&(r.algorithm=i[n]);if(-1===i.indexOf(r.algorithm))throw new Error('Algorithm "'+r.algorithm+'" not supported. supported values: '+i.join(", "));if(-1===o.indexOf(r.encoding)&&"passthrough"!==r.algorithm)throw new Error('Encoding "'+r.encoding+'" not supported. supported values: '+o.join(", "));return r}function c(e){if("function"!=typeof e)return!1;return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e))}function l(e,t,r){r=r||[];var n=function(e){return t.update?t.update(e,"utf8"):t.write(e,"utf8")};return{dispatch:function(t){e.replacer&&(t=e.replacer(t));var r=typeof t;return null===t&&(r="null"),this["_"+r](t)},_object:function(t){var i=Object.prototype.toString.call(t),s=/\[object (.*)\]/i.exec(i);s=(s=s?s[1]:"unknown:["+i+"]").toLowerCase();var o;if((o=r.indexOf(t))>=0)return this.dispatch("[CIRCULAR:"+o+"]");if(r.push(t),"undefined"!=typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(t))return n("buffer:"),n(t);if("object"===s||"function"===s||"asyncfunction"===s){var a=Object.keys(t);e.unorderedObjects&&(a=a.sort()),!1===e.respectType||c(t)||a.splice(0,0,"prototype","__proto__","constructor"),e.excludeKeys&&(a=a.filter((function(t){return!e.excludeKeys(t)}))),n("object:"+a.length+":");var l=this;return a.forEach((function(r){l.dispatch(r),n(":"),e.excludeValues||l.dispatch(t[r]),n(",")}))}if(!this["_"+s]){if(e.ignoreUnknown)return n("["+s+"]");throw new Error('Unknown object type "'+s+'"')}this["_"+s](t)},_array:function(t,i){i=void 0!==i?i:!1!==e.unorderedArrays;var s=this;if(n("array:"+t.length+":"),!i||t.length<=1)return t.forEach((function(e){return s.dispatch(e)}));var o=[],a=t.map((function(t){var n=new u,i=r.slice();return l(e,n,i).dispatch(t),o=o.concat(i.slice(r.length)),n.read().toString()}));return r=r.concat(o),a.sort(),this._array(a,!1)},_date:function(e){return n("date:"+e.toJSON())},_symbol:function(e){return n("symbol:"+e.toString())},_error:function(e){return n("error:"+e.toString())},_boolean:function(e){return n("bool:"+e.toString())},_string:function(e){n("string:"+e.length+":"),n(e.toString())},_function:function(t){n("fn:"),c(t)?this.dispatch("[native]"):this.dispatch(t.toString()),!1!==e.respectFunctionNames&&this.dispatch("function-name:"+String(t.name)),e.respectFunctionProperties&&this._object(t)},_number:function(e){return n("number:"+e.toString())},_xml:function(e){return n("xml:"+e.toString())},_null:function(){return n("Null")},_undefined:function(){return n("Undefined")},_regexp:function(e){return n("regex:"+e.toString())},_uint8array:function(e){return n("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint8clampedarray:function(e){return n("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(e))},_int8array:function(e){return n("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint16array:function(e){return n("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_int16array:function(e){return n("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_uint32array:function(e){return n("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_int32array:function(e){return n("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_float32array:function(e){return n("float32array:"),this.dispatch(Array.prototype.slice.call(e))},_float64array:function(e){return n("float64array:"),this.dispatch(Array.prototype.slice.call(e))},_arraybuffer:function(e){return n("arraybuffer:"),this.dispatch(new Uint8Array(e))},_url:function(e){return n("url:"+e.toString())},_map:function(t){n("map:");var r=Array.from(t);return this._array(r,!1!==e.unorderedSets)},_set:function(t){n("set:");var r=Array.from(t);return this._array(r,!1!==e.unorderedSets)},_file:function(e){return n("file:"),this.dispatch([e.name,e.size,e.type,e.lastModfied])},_blob:function(){if(e.ignoreUnknown)return n("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return n("domwindow")},_bigint:function(e){return n("bigint:"+e.toString())},_process:function(){return n("process")},_timer:function(){return n("timer")},_pipe:function(){return n("pipe")},_tcp:function(){return n("tcp")},_udp:function(){return n("udp")},_tty:function(){return n("tty")},_statwatcher:function(){return n("statwatcher")},_securecontext:function(){return n("securecontext")},_connection:function(){return n("connection")},_zlib:function(){return n("zlib")},_context:function(){return n("context")},_nodescript:function(){return n("nodescript")},_httpparser:function(){return n("httpparser")},_dataview:function(){return n("dataview")},_signal:function(){return n("signal")},_fsevent:function(){return n("fsevent")},_tlswrap:function(){return n("tlswrap")}}}function u(){return{buf:"",write:function(e){this.buf+=e},end:function(e){this.buf+=e},read:function(){return this.buf}}}t.writeToStream=function(e,t,r){return void 0===r&&(r=t,t={}),l(t=a(e,t),r).dispatch(e)}}(0,vb.exports);const bb=vb.exports,wb=sg,{RPError:Sb}=B_,{assertIssuerConfiguration:Eb}=uv,kb=nb,{keystores:Ab}=qv,Ob=yv,Cb=Vv,Tb=new WeakMap,Rb=new WeakMap,Ib=e=>(Rb.has(e)||Rb.set(e,new wb({max:100})),Rb.get(e));async function xb(e=!1){Eb(this,"jwks_uri");const t=Ab.get(this),r=Ib(this);return e||!t?(Tb.has(this)||(r.reset(),Tb.set(this,(async()=>{const e=await Cb.call(this,{method:"GET",responseType:"json",url:this.jwks_uri,headers:{Accept:"application/json, application/jwk-set+json"}}).finally((()=>{Tb.delete(this)})),t=Ob(e),n=kb.fromJWKS(t,{onlyPublic:!0});return r.set("throttle",!0,6e4),Ab.set(this,n),n})())),Tb.get(this)):t}_b.queryKeyStore=async function({kid:e,kty:t,alg:r,use:n},{allowMulti:i=!1}={}){const s=Ib(this),o={kid:e,kty:t,alg:r,use:n},a=bb(o,{algorithm:"sha256",ignoreUnknown:!0,unorderedArrays:!0,unorderedSets:!0,respectType:!1}),c=s.get(a)||s.get("throttle"),l=await xb.call(this,!c),u=l.all(o);if(delete o.use,0===u.length)throw new Sb({printf:["no valid key found in issuer's jwks_uri for key parameters %j",o],jwks:l});if(!i&&u.length>1&&!e)throw new Sb({printf:["multiple matching keys found in issuer's jwks_uri for key parameters %j, kid must be provided in this case",o],jwks:l});return s.set(a,!0),u},_b.keystore=xb;const{inspect:jb}=t,{RPError:Pb,OPError:Nb}=B_,$b=gv;let Mb=class{#t;#r;#n;#i;#s;#o;#a;#c;#l;constructor({client:e,exchangeBody:t,clientAssertionPayload:r,response:n,maxAge:i,DPoP:s}){if(["verification_uri","user_code","device_code"].forEach((e=>{if("string"!=typeof n[e]||!n[e])throw new Pb(`expected ${e} string to be returned by Device Authorization Response, got %j`,n[e])})),!Number.isSafeInteger(n.expires_in))throw new Pb("expected expires_in number to be returned by Device Authorization Response, got %j",n.expires_in);this.#o=$b()+n.expires_in,this.#r=e,this.#i=s,this.#c=i,this.#s=t,this.#n=r,this.#l=n,this.#a=1e3*n.interval||5e3}abort(){this.#t=!0}async poll({signal:e}={}){if(e&&e.aborted||this.#t)throw new Pb("polling aborted");if(this.expired())throw new Pb("the device code %j has expired and the device authorization session has concluded",this.device_code);let t;await new Promise((e=>setTimeout(e,this.#a)));try{t=await this.#r.grant({...this.#s,grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:this.device_code},{clientAssertionPayload:this.#n,DPoP:this.#i})}catch(t){switch(t instanceof Nb&&t.error){case"slow_down":this.#a+=5e3;case"authorization_pending":return this.poll({signal:e});default:throw t}}return"id_token"in t&&(await this.#r.decryptIdToken(t),await this.#r.validateIdToken(t,void 0,"token",this.#c)),t}get device_code(){return this.#l.device_code}get user_code(){return this.#l.user_code}get verification_uri(){return this.#l.verification_uri}get verification_uri_complete(){return this.#l.verification_uri_complete}get expires_in(){return Math.max.apply(null,[this.#o-$b(),0])}expired(){return 0===this.expires_in}[jb.custom](){return`${this.constructor.name} ${jb(this.#l,{depth:1/0,colors:process.stdout.isTTY,compact:!1,sorted:!0})}`}};var Db=Mb;const{inspect:Lb}=t,Bb=a,Kb=s,{strict:Fb}=u,Ub=d,Wb=e,{URL:Jb,URLSearchParams:Hb}=e,Gb=jc,zb=Y_,Vb=Q_,qb=e=>{if("string"!=typeof e||!e)throw new TypeError("JWT must be a string");const{0:t,1:r,2:n,length:i}=e.split(".");if(5===i)throw new TypeError("encrypted JWTs cannot be decoded");if(3!==i)throw new Error("JWTs must have three components");try{return{header:JSON.parse(rv.decode(t)),payload:JSON.parse(rv.decode(r)),signature:n}}catch(e){throw new Error("JWT is malformed")}},Xb=ev,Yb=av,Zb=lv,{assertSigningAlgValuesSupport:Qb,assertIssuerConfiguration:ew}=uv,tw=dv,rw=iv,nw=yv,iw=bv,{OPError:sw,RPError:ow}=B_,aw=gv,{random:cw}=Av,lw=Vv,{CLOCK_TOLERANCE:uw}=Rv,{keystores:dw}=qv,fw=nb,pw=Xv,{authenticatedPost:hw,resolveResponseType:mw,resolveRedirectUri:yw}=gb,{queryKeyStore:gw}=_b,_w=Db,[vw,bw]=process.version.slice(1).split(".").map((e=>parseInt(e,10))),ww=vw>=17||16===vw&&bw>=9,Sw=Symbol(),Ew=Symbol(),kw=Symbol();function Aw(e){return tw(e,"access_token","code","error_description","error_uri","error","expires_in","id_token","iss","response","session_state","state","token_type")}function Ow(e,t="Bearer"){return`${t} ${e}`}function Cw(e){const t=Wb.parse(e);return t.search?Ub.parse(t.search.substring(1)):{}}function Tw(e,t,r){if(void 0===e[r])throw new ow({message:`missing required JWT property ${r}`,jwt:t})}function Rw(e){const t={client_id:this.client_id,scope:"openid",response_type:mw.call(this),redirect_uri:yw.call(this),...e};return Object.entries(t).forEach((([e,r])=>{null==r?delete t[e]:"claims"===e&&"object"==typeof r?t[e]=JSON.stringify(r):"resource"===e&&Array.isArray(r)?t[e]=r:"string"!=typeof r&&(t[e]=String(r))})),t}function Iw(e){if(!rw(e)||!Array.isArray(e.keys)||e.keys.some((e=>!rw(e)||!("kty"in e))))throw new TypeError("jwks must be a JSON Web Key Set formatted object");return fw.fromJWKS(e,{onlyPrivate:!0})}let xw,jw=class{#u;#d;#f;#p;constructor(e,t,r={},n,i){if(this.#u=new Map,this.#d=e,this.#f=t,"string"!=typeof r.client_id||!r.client_id)throw new TypeError("client_id is required");const s={grant_types:["authorization_code"],id_token_signed_response_alg:"RS256",authorization_signed_response_alg:"RS256",response_types:["code"],token_endpoint_auth_method:"client_secret_basic",...this.fapi()?{grant_types:["authorization_code","implicit"],id_token_signed_response_alg:"PS256",authorization_signed_response_alg:"PS256",response_types:["code id_token"],tls_client_certificate_bound_access_tokens:!0,token_endpoint_auth_method:void 0}:void 0,...r};if(this.fapi())switch(s.token_endpoint_auth_method){case"self_signed_tls_client_auth":case"tls_client_auth":break;case"private_key_jwt":if(!n)throw new TypeError("jwks is required");break;case void 0:throw new TypeError("token_endpoint_auth_method is required");default:throw new TypeError("invalid or unsupported token_endpoint_auth_method")}if(function(e,t,r){if(t.token_endpoint_auth_method||function(e,t){try{const r=e.issuer.token_endpoint_auth_methods_supported;r.includes(t.token_endpoint_auth_method)||r.includes("client_secret_post")&&(t.token_endpoint_auth_method="client_secret_post")}catch(e){}}(e,r),t.redirect_uri){if(t.redirect_uris)throw new TypeError("provide a redirect_uri or redirect_uris, not both");r.redirect_uris=[t.redirect_uri],delete r.redirect_uri}if(t.response_type){if(t.response_types)throw new TypeError("provide a response_type or response_types, not both");r.response_types=[t.response_type],delete r.response_type}}(this,r,s),Qb("token",this.issuer,s),["introspection","revocation"].forEach((e=>{!function(e,t,r){if(!t[`${e}_endpoint`])return;const n=r.token_endpoint_auth_method,i=r.token_endpoint_auth_signing_alg,s=`${e}_endpoint_auth_method`,o=`${e}_endpoint_auth_signing_alg`;void 0===r[s]&&void 0===r[o]&&(void 0!==n&&(r[s]=n),void 0!==i&&(r[o]=i))}(e,this.issuer,s),Qb(e,this.issuer,s)})),Object.entries(s).forEach((([e,t])=>{this.#u.set(e,t),this[e]||Object.defineProperty(this,e,{get(){return this.#u.get(e)},enumerable:!0})})),void 0!==n){const e=Iw.call(this,n);dw.set(this,e)}null!=i&&i.additionalAuthorizedParties&&(this.#p=pw(i.additionalAuthorizedParties)),this[uw]=0}authorizationUrl(e={}){if(!rw(e))throw new TypeError("params must be a plain object");ew(this.issuer,"authorization_endpoint");const t=new Jb(this.issuer.authorization_endpoint);for(const[r,n]of Object.entries(Rw.call(this,e)))if(Array.isArray(n)){t.searchParams.delete(r);for(const e of n)t.searchParams.append(r,e)}else t.searchParams.set(r,n);return t.href.replace(/\+/g,"%20")}authorizationPost(e={}){if(!rw(e))throw new TypeError("params must be a plain object");const t=Rw.call(this,e),r=Object.keys(t).map((e=>`<input type="hidden" name="${e}" value="${t[e]}"/>`)).join("\n");return`<!DOCTYPE html>\n<head>\n<title>Requesting Authorization</title>\n</head>\n<body onload="javascript:document.forms[0].submit()">\n<form method="post" action="${this.issuer.authorization_endpoint}">\n ${r}\n</form>\n</body>\n</html>`}endSessionUrl(e={}){ew(this.issuer,"end_session_endpoint");const{0:t,length:r}=this.post_logout_redirect_uris||[],{post_logout_redirect_uri:n=(1===r?t:void 0)}=e;let i;if(({id_token_hint:i,...e}=e),i instanceof iw){if(!i.id_token)throw new TypeError("id_token not present in TokenSet");i=i.id_token}const s=Wb.parse(this.issuer.end_session_endpoint),o=Yb(Cw(this.issuer.end_session_endpoint),e,{post_logout_redirect_uri:n,client_id:this.client_id},{id_token_hint:i});return Object.entries(o).forEach((([e,t])=>{null==t&&delete o[e]})),s.search=null,s.query=o,Wb.format(s)}callbackParams(e){const t=e instanceof Bb.IncomingMessage||e&&e.method&&e.url;if(!("string"==typeof e)&&!t)throw new TypeError("#callbackParams only accepts string urls, http.IncomingMessage or a lookalike");if(!t)return Aw(Cw(e));switch(e.method){case"GET":return Aw(Cw(e.url));case"POST":if(void 0===e.body)throw new TypeError("incoming message body missing, include a body parser prior to this method call");switch(typeof e.body){case"object":case"string":return Buffer.isBuffer(e.body)?Aw(Ub.parse(e.body.toString("utf-8"))):"string"==typeof e.body?Aw(Ub.parse(e.body)):Aw(e.body);default:throw new TypeError("invalid IncomingMessage body object")}default:throw new TypeError("invalid IncomingMessage method")}}async callback(e,t,r={},{exchangeBody:n,clientAssertionPayload:i,DPoP:s}={}){let o=Aw(t);if(r.jarm&&!("response"in t))throw new ow({message:"expected a JARM response",checks:r,params:o});if("response"in t){const e=await this.decryptJARM(o.response);o=await this.validateJARM(e)}if(this.default_max_age&&!r.max_age&&(r.max_age=this.default_max_age),o.state&&!r.state)throw new TypeError("checks.state argument is missing");if(!o.state&&r.state)throw new ow({message:"state missing from the response",checks:r,params:o});if(r.state!==o.state)throw new ow({printf:["state mismatch, expected %s, got: %s",r.state,o.state],checks:r,params:o});if("iss"in o){if(ew(this.issuer,"issuer"),o.iss!==this.issuer.issuer)throw new ow({printf:["iss mismatch, expected %s, got: %s",this.issuer.issuer,o.iss],params:o})}else if(this.issuer.authorization_response_iss_parameter_supported&&!("id_token"in o)&&!("response"in t))throw new ow({message:"iss missing from the response",params:o});if(o.error)throw new sw(o);const a={code:["code"],id_token:["id_token"],token:["access_token","token_type"]};if(r.response_type)for(const e of r.response_type.split(" "))if("none"===e){if(o.code||o.id_token||o.access_token)throw new ow({message:'unexpected params encountered for "none" response',checks:r,params:o})}else for(const t of a[e])if(!o[t])throw new ow({message:`${t} missing from response`,checks:r,params:o});if(o.id_token){const e=new iw(o);if(await this.decryptIdToken(e),await this.validateIdToken(e,r.nonce,"authorization",r.max_age,r.state),!o.code)return e}if(o.code){const t=await this.grant({...n,grant_type:"authorization_code",code:o.code,redirect_uri:e,code_verifier:r.code_verifier},{clientAssertionPayload:i,DPoP:s});return await this.decryptIdToken(t),await this.validateIdToken(t,r.nonce,"token",r.max_age),o.session_state&&(t.session_state=o.session_state),t}return new iw(o)}async oauthCallback(e,t,r={},{exchangeBody:n,clientAssertionPayload:i,DPoP:s}={}){let o=Aw(t);if(r.jarm&&!("response"in t))throw new ow({message:"expected a JARM response",checks:r,params:o});if("response"in t){const e=await this.decryptJARM(o.response);o=await this.validateJARM(e)}if(o.state&&!r.state)throw new TypeError("checks.state argument is missing");if(!o.state&&r.state)throw new ow({message:"state missing from the response",checks:r,params:o});if(r.state!==o.state)throw new ow({printf:["state mismatch, expected %s, got: %s",r.state,o.state],checks:r,params:o});if("iss"in o){if(ew(this.issuer,"issuer"),o.iss!==this.issuer.issuer)throw new ow({printf:["iss mismatch, expected %s, got: %s",this.issuer.issuer,o.iss],params:o})}else if(this.issuer.authorization_response_iss_parameter_supported&&!("id_token"in o)&&!("response"in t))throw new ow({message:"iss missing from the response",params:o});if(o.error)throw new sw(o);if("string"==typeof o.id_token&&o.id_token.length)throw new ow({message:"id_token detected in the response, you must use client.callback() instead of client.oauthCallback()",params:o});delete o.id_token;const a={code:["code"],token:["access_token","token_type"]};if(r.response_type)for(const e of r.response_type.split(" ")){if("none"===e&&(o.code||o.id_token||o.access_token))throw new ow({message:'unexpected params encountered for "none" response',checks:r,params:o});if(a[e])for(const t of a[e])if(!o[t])throw new ow({message:`${t} missing from response`,checks:r,params:o})}if(o.code){const t=await this.grant({...n,grant_type:"authorization_code",code:o.code,redirect_uri:e,code_verifier:r.code_verifier},{clientAssertionPayload:i,DPoP:s});if("string"==typeof t.id_token&&t.id_token.length)throw new ow({message:"id_token detected in the response, you must use client.callback() instead of client.oauthCallback()",params:o});return delete t.id_token,t}return new iw(o)}async decryptIdToken(e){if(!this.id_token_encrypted_response_alg)return e;let t=e;if(t instanceof iw){if(!t.id_token)throw new TypeError("id_token not present in TokenSet");t=t.id_token}const r=this.id_token_encrypted_response_alg,n=this.id_token_encrypted_response_enc,i=await this.decryptJWE(t,r,n);return e instanceof iw?(e.id_token=i,e):i}async validateJWTUserinfo(e){const t=this.userinfo_signed_response_alg;return this.validateJWT(e,t,[])}async decryptJARM(e){if(!this.authorization_encrypted_response_alg)return e;const t=this.authorization_encrypted_response_alg,r=this.authorization_encrypted_response_enc;return this.decryptJWE(e,t,r)}async decryptJWTUserinfo(e){if(!this.userinfo_encrypted_response_alg)return e;const t=this.userinfo_encrypted_response_alg,r=this.userinfo_encrypted_response_enc;return this.decryptJWE(e,t,r)}async decryptJWE(e,t,r="A128CBC-HS256"){const n=JSON.parse(Xb.decode(e.split(".")[0]));if(n.alg!==t)throw new ow({printf:["unexpected JWE alg received, expected %s, got: %s",t,n.alg],jwt:e});if(n.enc!==r)throw new ow({printf:["unexpected JWE enc received, expected %s, got: %s",r,n.enc],jwt:e});const i=e=>(new TextDecoder).decode(e.plaintext);let s;if(t.match(/^(?:RSA|ECDH)/)){const t=await dw.get(this),r=Gb.decodeProtectedHeader(e);for(const n of t.all({...r,use:"enc"}))if(s=await Gb.compactDecrypt(e,await n.keyObject(r.alg)).then(i,(()=>{})),s)break}else s=await Gb.compactDecrypt(e,this.secretForAlg("dir"===t?r:t)).then(i,(()=>{}));if(!s)throw new ow({message:"failed to decrypt JWE",jwt:e});return s}async validateIdToken(e,t,r,n,i){let s=e;const o=this.id_token_signed_response_alg;if(s instanceof iw){if(!s.id_token)throw new TypeError("id_token not present in TokenSet");s=s.id_token}s=String(s);const a=aw(),{protected:c,payload:l,key:u}=await this.validateJWT(s,o);if("number"==typeof n||n!==kw&&this.require_auth_time){if(!l.auth_time)throw new ow({message:"missing required JWT property auth_time",jwt:s});if("number"!=typeof l.auth_time)throw new ow({message:"JWT auth_time claim must be a JSON numeric value",jwt:s})}if("number"==typeof n&&l.auth_time+n<a-this[uw])throw new ow({printf:["too much time has elapsed since the last End-User authentication, max_age %i, auth_time: %i, now %i",n,l.auth_time,a-this[uw]],now:a,tolerance:this[uw],auth_time:l.auth_time,jwt:s});if(t!==Ew&&(l.nonce||void 0!==t)&&l.nonce!==t)throw new ow({printf:["nonce mismatch, expected %s, got: %s",t,l.nonce],jwt:s});if("authorization"===r){if(!l.at_hash&&e.access_token)throw new ow({message:"missing required property at_hash",jwt:s});if(!l.c_hash&&e.code)throw new ow({message:"missing required property c_hash",jwt:s});if(this.fapi()&&!l.s_hash&&(e.state||i))throw new ow({message:"missing required property s_hash",jwt:s});if(l.s_hash){if(!i)throw new TypeError('cannot verify s_hash, "checks.state" property not provided');try{zb.validate({claim:"s_hash",source:"state"},l.s_hash,i,c.alg,u.jwk&&u.jwk.crv)}catch(e){throw new ow({message:e.message,jwt:s})}}}if(this.fapi()&&l.iat<a-3600)throw new ow({printf:["JWT issued too far in the past, now %i, iat %i",a,l.iat],now:a,tolerance:this[uw],iat:l.iat,jwt:s});if(e.access_token&&void 0!==l.at_hash)try{zb.validate({claim:"at_hash",source:"access_token"},l.at_hash,e.access_token,c.alg,u.jwk&&u.jwk.crv)}catch(e){throw new ow({message:e.message,jwt:s})}if(e.code&&void 0!==l.c_hash)try{zb.validate({claim:"c_hash",source:"code"},l.c_hash,e.code,c.alg,u.jwk&&u.jwk.crv)}catch(e){throw new ow({message:e.message,jwt:s})}return e}async validateJWT(e,t,r=["iss","sub","aud","exp","iat"]){const n="https://self-issued.me"===this.issuer.issuer,i=aw();let s,o,a;try{({header:s,payload:o}=qb(e,{complete:!0}))}catch(t){throw new ow({printf:["failed to decode JWT (%s: %s)",t.name,t.message],jwt:e})}if(s.alg!==t)throw new ow({printf:["unexpected JWT alg received, expected %s, got: %s",t,s.alg],jwt:e});if(n&&(r=[...r,"sub_jwk"]),r.forEach(Tw.bind(void 0,o,e)),void 0!==o.iss){let t=this.issuer.issuer;if(this.#f&&(t=this.issuer.issuer.replace("{tenantid}",o.tid)),o.iss!==t)throw new ow({printf:["unexpected iss value, expected %s, got: %s",t,o.iss],jwt:e})}if(void 0!==o.iat&&"number"!=typeof o.iat)throw new ow({message:"JWT iat claim must be a JSON numeric value",jwt:e});if(void 0!==o.nbf){if("number"!=typeof o.nbf)throw new ow({message:"JWT nbf claim must be a JSON numeric value",jwt:e});if(o.nbf>i+this[uw])throw new ow({printf:["JWT not active yet, now %i, nbf %i",i+this[uw],o.nbf],now:i,tolerance:this[uw],nbf:o.nbf,jwt:e})}if(void 0!==o.exp){if("number"!=typeof o.exp)throw new ow({message:"JWT exp claim must be a JSON numeric value",jwt:e});if(i-this[uw]>=o.exp)throw new ow({printf:["JWT expired, now %i, exp %i",i-this[uw],o.exp],now:i,tolerance:this[uw],exp:o.exp,jwt:e})}if(void 0!==o.aud)if(Array.isArray(o.aud)){if(o.aud.length>1&&!o.azp)throw new ow({message:"missing required JWT property azp",jwt:e});if(!o.aud.includes(this.client_id))throw new ow({printf:["aud is missing the client_id, expected %s to be included in %j",this.client_id,o.aud],jwt:e})}else if(o.aud!==this.client_id)throw new ow({printf:["aud mismatch, expected %s, got: %s",this.client_id,o.aud],jwt:e});if(void 0!==o.azp){let t=this.#p;if(t="string"==typeof t?[this.client_id,t]:Array.isArray(t)?[this.client_id,...t]:[this.client_id],!t.includes(o.azp))throw new ow({printf:["azp mismatch, got: %s",o.azp],jwt:e})}if(n){try{Fb(rw(o.sub_jwk));const e=await Gb.importJWK(o.sub_jwk,s.alg);Fb.equal(e.type,"public"),a=[{keyObject:()=>e}]}catch(t){throw new ow({message:"failed to use sub_jwk claim as an asymmetric JSON Web Key",jwt:e})}if(await Gb.calculateJwkThumbprint(o.sub_jwk)!==o.sub)throw new ow({message:"failed to match the subject with sub_jwk",jwt:e})}else s.alg.startsWith("HS")?a=[this.secretForAlg(s.alg)]:"none"!==s.alg&&(a=await gw.call(this.issuer,{...s,use:"sig"}));if(!a&&"none"===s.alg)return{protected:s,payload:o};for(const t of a){const r=await Gb.compactVerify(e,t instanceof Uint8Array?t:await t.keyObject(s.alg)).catch((()=>{}));if(r)return{payload:o,protected:r.protectedHeader,key:t}}throw new ow({message:"failed to validate JWT signature",jwt:e})}async refresh(e,{exchangeBody:t,clientAssertionPayload:r,DPoP:n}={}){let i=e;if(i instanceof iw){if(!i.refresh_token)throw new TypeError("refresh_token not present in TokenSet");i=i.refresh_token}const s=await this.grant({...t,grant_type:"refresh_token",refresh_token:String(i)},{clientAssertionPayload:r,DPoP:n});if(s.id_token&&(await this.decryptIdToken(s),await this.validateIdToken(s,Ew,"token",kw),e instanceof iw&&e.id_token)){const t=e.claims().sub,r=s.claims().sub;if(r!==t)throw new ow({printf:["sub mismatch, expected %s, got: %s",t,r],jwt:s.id_token})}return s}async requestResource(e,t,{method:r,headers:n,body:i,DPoP:s,tokenType:o=(s?"DPoP":t instanceof iw?t.token_type:"Bearer")}={},a){if(t instanceof iw){if(!t.access_token)throw new TypeError("access_token not present in TokenSet");t=t.access_token}if(!t)throw new TypeError("no access token provided");if("string"!=typeof t)throw new TypeError("invalid access token provided");const c={headers:{Authorization:Ow(t,o),...n},body:i},l=!!this.tls_client_certificate_bound_access_tokens,u=await lw.call(this,{...c,responseType:"buffer",method:r,url:e},{accessToken:t,mTLS:l,DPoP:s}),d=u.headers["www-authenticate"];return a!==Sw&&d&&d.toLowerCase().startsWith("dpop ")&&"use_dpop_nonce"===Zb(d).error?this.requestResource(e,t,{method:r,headers:n,body:i,DPoP:s,tokenType:o}):u}async userinfo(e,{method:t="GET",via:r="header",tokenType:n,params:i,DPoP:s}={}){ew(this.issuer,"userinfo_endpoint");const o={tokenType:n,method:String(t).toUpperCase(),DPoP:s};if("GET"!==o.method&&"POST"!==o.method)throw new TypeError("#userinfo() method can only be POST or a GET");if("body"===r&&"POST"!==o.method)throw new TypeError("can only send body on POST");const a=!(!this.userinfo_signed_response_alg&&!this.userinfo_encrypted_response_alg);o.headers=a?{Accept:"application/jwt"}:{Accept:"application/json"};let c;!!this.tls_client_certificate_bound_access_tokens&&this.issuer.mtls_endpoint_aliases&&(c=this.issuer.mtls_endpoint_aliases.userinfo_endpoint),c=new Jb(c||this.issuer.userinfo_endpoint),"body"===r&&(o.headers.Authorization=void 0,o.headers["Content-Type"]="application/x-www-form-urlencoded",o.body=new Hb,o.body.append("access_token",e instanceof iw?e.access_token:e)),i&&("GET"===o.method?Object.entries(i).forEach((([e,t])=>{c.searchParams.append(e,t)})):(o.body||(o.body=new Hb,o.headers["Content-Type"]="application/x-www-form-urlencoded"),Object.entries(i).forEach((([e,t])=>{o.body.append(e,t)})))),o.body&&(o.body=o.body.toString());const l=await this.requestResource(c,e,o);let u=nw(l,{bearer:!0});if(a){if(!/^application\/jwt/.test(l.headers["content-type"]))throw new ow({message:"expected application/jwt response from the userinfo_endpoint",response:l});const e=l.body.toString(),t=await this.decryptJWTUserinfo(e);if(this.userinfo_signed_response_alg)({payload:u}=await this.validateJWTUserinfo(t));else try{u=JSON.parse(t),Fb(rw(u))}catch(e){throw new ow({message:"failed to parse userinfo JWE payload as JSON",jwt:t})}}else try{u=JSON.parse(l.body)}catch(e){throw Object.defineProperty(e,"response",{value:l}),e}if(e instanceof iw&&e.id_token){const t=e.claims().sub;if(u.sub!==t)throw new ow({printf:["userinfo sub mismatch, expected %s, got: %s",t,u.sub],body:u,jwt:e.id_token})}return u}encryptionSecret(e){const t=e<=256?"sha256":e<=384?"sha384":e<=512&&"sha512";if(!t)throw new Error("unsupported symmetric encryption key derivation");return Kb.createHash(t).update(this.client_secret).digest().slice(0,e/8)}secretForAlg(e){if(!this.client_secret)throw new TypeError("client_secret is required");return/^A(\d{3})(?:GCM)?KW$/.test(e)?this.encryptionSecret(parseInt(RegExp.$1,10)):/^A(\d{3})(?:GCM|CBC-HS(\d{3}))$/.test(e)?this.encryptionSecret(parseInt(RegExp.$2||RegExp.$1,10)):(new TextEncoder).encode(this.client_secret)}async grant(e,{clientAssertionPayload:t,DPoP:r}={},n){ew(this.issuer,"token_endpoint");const i=await hw.call(this,"token",{form:e,responseType:"json"},{clientAssertionPayload:t,DPoP:r});let s;try{s=nw(i)}catch(i){if(n!==Sw&&i instanceof sw&&"use_dpop_nonce"===i.error)return this.grant(e,{clientAssertionPayload:t,DPoP:r},Sw);throw i}return new iw(s)}async deviceAuthorization(e={},{exchangeBody:t,clientAssertionPayload:r,DPoP:n}={}){ew(this.issuer,"device_authorization_endpoint"),ew(this.issuer,"token_endpoint");const i=Rw.call(this,{client_id:this.client_id,redirect_uri:null,response_type:null,...e}),s=await hw.call(this,"device_authorization",{responseType:"json",form:i},{clientAssertionPayload:r,endpointAuthMethod:"token"}),o=nw(s);return new _w({client:this,exchangeBody:t,clientAssertionPayload:r,response:o,maxAge:e.max_age,DPoP:n})}async revoke(e,t,{revokeBody:r,clientAssertionPayload:n}={}){if(ew(this.issuer,"revocation_endpoint"),void 0!==t&&"string"!=typeof t)throw new TypeError("hint must be a string");const i={...r,token:e};t&&(i.token_type_hint=t);const s=await hw.call(this,"revocation",{form:i},{clientAssertionPayload:n});nw(s,{body:!1})}async introspect(e,t,{introspectBody:r,clientAssertionPayload:n}={}){if(ew(this.issuer,"introspection_endpoint"),void 0!==t&&"string"!=typeof t)throw new TypeError("hint must be a string");const i={...r,token:e};t&&(i.token_type_hint=t);const s=await hw.call(this,"introspection",{form:i,responseType:"json"},{clientAssertionPayload:n});return nw(s)}static async register(e,t={}){const{initialAccessToken:r,jwks:n,...i}=t;if(ew(this.issuer,"registration_endpoint"),void 0!==n&&!e.jwks&&!e.jwks_uri){const t=await Iw.call(this,n);e.jwks=t.toJWKS()}const s=await lw.call(this,{headers:{Accept:"application/json",...r?{Authorization:Ow(r)}:void 0},responseType:"json",json:e,url:this.issuer.registration_endpoint,method:"POST"});return new this(nw(s,{statusCode:201,bearer:!0}),n,i)}get metadata(){return pw(Object.fromEntries(this.#u.entries()))}static async fromUri(e,t,r,n){const i=await lw.call(this,{method:"GET",url:e,responseType:"json",headers:{Authorization:Ow(t),Accept:"application/json"}});return new this(nw(i,{bearer:!0}),r,n)}async requestObject(e={},{sign:t=this.request_object_signing_alg||"none",encrypt:{alg:r=this.request_object_encryption_alg,enc:n=this.request_object_encryption_enc||"A128CBC-HS256"}={}}={}){if(!rw(e))throw new TypeError("requestObject must be a plain object");let i,s;const o=aw(),a={alg:t,typ:"oauth-authz-req+jwt"},c=JSON.stringify(Yb({},e,{iss:this.client_id,aud:this.issuer.issuer,client_id:this.client_id,jti:cw(),iat:o,exp:o+300,...this.fapi()?{nbf:o}:void 0}));if("none"===t)i=[Xb.encode(JSON.stringify(a)),Xb.encode(c),""].join(".");else{const e=t.startsWith("HS");if(e)s=this.secretForAlg(t);else{const e=await dw.get(this);if(!e)throw new TypeError(`no keystore present for client, cannot sign using alg ${t}`);if(s=e.get({alg:t,use:"sig"}),!s)throw new TypeError(`no key to sign with found for alg ${t}`)}i=await new Gb.CompactSign((new TextEncoder).encode(c)).setProtectedHeader({...a,kid:e?void 0:s.jwk.kid}).sign(e?s:await s.keyObject(t))}if(!r)return i;const l={alg:r,enc:n,cty:"oauth-authz-req+jwt"};return l.alg.match(/^(RSA|ECDH)/)?[s]=await gw.call(this.issuer,{alg:l.alg,use:"enc"},{allowMulti:!0}):s=this.secretForAlg("dir"===l.alg?l.enc:l.alg),new Gb.CompactEncrypt((new TextEncoder).encode(i)).setProtectedHeader({...l,kid:s instanceof Uint8Array?void 0:s.jwk.kid}).encrypt(s instanceof Uint8Array?s:await s.keyObject(l.alg))}async pushedAuthorizationRequest(e={},{clientAssertionPayload:t}={}){ew(this.issuer,"pushed_authorization_request_endpoint");const r={..."request"in e?e:Rw.call(this,e),client_id:this.client_id},n=await hw.call(this,"pushed_authorization_request",{responseType:"json",form:r},{clientAssertionPayload:t,endpointAuthMethod:"token"}),i=nw(n,{statusCode:201});if(!("expires_in"in i))throw new ow({message:"expected expires_in in Pushed Authorization Successful Response",response:n});if("number"!=typeof i.expires_in)throw new ow({message:"invalid expires_in value in Pushed Authorization Successful Response",response:n});if(!("request_uri"in i))throw new ow({message:"expected request_uri in Pushed Authorization Successful Response",response:n});if("string"!=typeof i.request_uri)throw new ow({message:"invalid request_uri value in Pushed Authorization Successful Response",response:n});return i}get issuer(){return this.#d}[Lb.custom](){return`${this.constructor.name} ${Lb(this.metadata,{depth:1/0,colors:process.stdout.isTTY,compact:!1,sorted:!0})}`}fapi(){return"FAPI1Client"===this.constructor.name}async validateJARM(e){const t=this.authorization_signed_response_alg,{payload:r}=await this.validateJWT(e,t,["iss","exp","aud"]);return Aw(r)}async dpopProof(e,t,r){if(!rw(e))throw new TypeError("payload must be a plain object");let n;if(Vb(t))n=t;else if("CryptoKey"===t[Symbol.toStringTag])n=t;else{if("node:crypto"!==Gb.cryptoRuntime)throw new TypeError("unrecognized crypto runtime");n=Kb.createPrivateKey(t)}if("private"!==n.type)throw new TypeError('"DPoP" option must be a private key');let i=xw.call(this,n,t);if(!i)throw new TypeError("could not determine DPoP JWS Algorithm");return new Gb.SignJWT({ath:r?Xb.encode(Kb.createHash("sha256").update(r).digest()):void 0,...e}).setProtectedHeader({alg:i,typ:"dpop+jwt",jwk:await $w(n,t)}).setIssuedAt().setJti(cw()).sign(n)}};function Pw(e){switch(e.algorithm.name){case"Ed25519":case"Ed448":return"EdDSA";case"ECDSA":switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512"}break;case"RSASSA-PKCS1-v1_5":return`RS${e.algorithm.hash.name.slice(4)}`;case"RSA-PSS":return`PS${e.algorithm.hash.name.slice(4)}`;default:throw new TypeError("unsupported DPoP private key")}}if("node:crypto"===Gb.cryptoRuntime){xw=function(e,t){if("CryptoKey"===t[Symbol.toStringTag])return Pw(e);switch(e.asymmetricKeyType){case"ed25519":case"ed448":return"EdDSA";case"ec":return eB(e,t);case"rsa":case ww&&"rsa-pss":return qL(e,t,this.issuer.dpop_signing_alg_values_supported);default:throw new TypeError("unsupported DPoP private key")}};const VL=/^(?:RS|PS)(?:256|384|512)$/;function qL(e,t,r){if("object"==typeof t&&"jwk"===t.format&&t.key&&t.key.alg)return t.key.alg;if(Array.isArray(r)){let t=r.filter(RegExp.prototype.test.bind(VL));return"rsa-pss"===e.asymmetricKeyType&&(t=t.filter((e=>e.startsWith("PS")))),["PS256","PS384","PS512","RS256","RS384","RS384"].find((e=>t.includes(e)))}return"PS256"}const XL=Buffer.from([42,134,72,206,61,3,1,7]),YL=Buffer.from([43,129,4,0,34]),ZL=Buffer.from([43,129,4,0,35]),QL=Buffer.from([43,129,4,0,10]);function eB(e,t){switch("object"==typeof t&&"object"==typeof t.key&&t.key.crv){case"P-256":return"ES256";case"secp256k1":return"ES256K";case"P-384":return"ES384";case"P-512":return"ES512"}const r=e.export({format:"der",type:"pkcs8"}),n=r[1]<128?17:18,i=r[n],s=r.slice(n+1,n+1+i);if(s.equals(XL))return"ES256";if(s.equals(YL))return"ES384";if(s.equals(ZL))return"ES512";if(s.equals(QL))return"ES256K";throw new TypeError("unsupported DPoP private key curve")}}else xw=Pw;const Nw=new WeakMap;async function $w(e,t){if("node:crypto"===Gb.cryptoRuntime&&"object"==typeof t&&"object"==typeof t.key&&"jwk"===t.format)return tw(t.key,"kty","crv","x","y","e","n");if(Nw.has(t))return Nw.get(t);const r=tw(await Gb.exportJWK(e),"kty","crv","x","y","e","n");return(Vb(t)||"WebCryptoAPI"===Gb.cryptoRuntime)&&Nw.set(t,r),r}K_.exports=(e,t=!1)=>class extends jw{constructor(...r){super(e,t,...r)}static get issuer(){return e}},K_.exports.BaseClient=jw;var Mw=K_.exports;var Dw=new sg({max:100});const Lw=/^\d+$/;var Bw=function(e){if("string"!=typeof e)throw new TypeError("input must be a string");let t;return t=function(e){if(e.includes("://"))return!0;const t=e.replace(/(\/|\?)/g,"#").split("#")[0];if(t.includes(":")){const e=t.indexOf(":"),r=t.slice(e+1);if(!Lw.test(r))return!0}return!1}(e)?e:function(e){if(!e.includes("@"))return!1;const t=e.split("@"),r=t[t.length-1];return!(r.includes(":")||r.includes("/")||r.includes("?"))}(e)?`acct:${e}`:`https://${e}`,t.split("#")[0]};const{inspect:Kw}=t,Fw=e,{RPError:Uw}=B_,Ww=Mw,Jw=Dw,Hw=yv,Gw=Bw,zw=Vv,Vw=Xv,{keystore:qw}=_b,Xw=["https://login.microsoftonline.com/common/.well-known/openid-configuration","https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration","https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration","https://login.microsoftonline.com/consumers/v2.0/.well-known/openid-configuration"],Yw=Symbol(),Zw={claim_types_supported:["normal"],claims_parameter_supported:!1,grant_types_supported:["authorization_code","implicit"],request_parameter_supported:!1,request_uri_parameter_supported:!0,require_request_uri_registration:!1,response_modes_supported:["query","fragment"],token_endpoint_auth_methods_supported:["client_secret_basic"]};let Qw=class e{#u;constructor(e={}){const t=e[Yw];delete e[Yw],["introspection","revocation"].forEach((t=>{e[`${t}_endpoint`]&&void 0===e[`${t}_endpoint_auth_methods_supported`]&&void 0===e[`${t}_endpoint_auth_signing_alg_values_supported`]&&(e.token_endpoint_auth_methods_supported&&(e[`${t}_endpoint_auth_methods_supported`]=e.token_endpoint_auth_methods_supported),e.token_endpoint_auth_signing_alg_values_supported&&(e[`${t}_endpoint_auth_signing_alg_values_supported`]=e.token_endpoint_auth_signing_alg_values_supported))})),this.#u=new Map,Object.entries(e).forEach((([e,t])=>{this.#u.set(e,t),this[e]||Object.defineProperty(this,e,{get(){return this.#u.get(e)},enumerable:!0})})),Jw.set(this.issuer,this);const r=Ww(this,t);Object.defineProperties(this,{Client:{value:r,enumerable:!0},FAPI1Client:{value:class extends r{},enumerable:!0}})}get metadata(){return Vw(Object.fromEntries(this.#u.entries()))}static async webfinger(e){const t=Gw(e),{host:r}=Fw.parse(t),n=`https://${r}/.well-known/webfinger`,i=await zw.call(this,{method:"GET",url:n,responseType:"json",searchParams:{resource:t,rel:"http://openid.net/specs/connect/1.0/issuer"},headers:{Accept:"application/json"}}),s=Hw(i),o=Array.isArray(s.links)&&s.links.find((e=>"object"==typeof e&&"http://openid.net/specs/connect/1.0/issuer"===e.rel&&e.href));if(!o)throw new Uw({message:"no issuer found in webfinger response",body:s});if("string"!=typeof o.href||!o.href.startsWith("https://"))throw new Uw({printf:["invalid issuer location %s",o.href],body:s});const a=o.href;if(Jw.has(a))return Jw.get(a);const c=await this.discover(a);if(c.issuer!==a)throw Jw.del(c.issuer),new Uw("discovered issuer mismatch, expected %s, got: %s",a,c.issuer);return c}static async discover(t){const r=function(e){const t=Fw.parse(e);if(t.pathname.includes("/.well-known/"))return e;{let e;return e=t.pathname.endsWith("/")?`${t.pathname}.well-known/openid-configuration`:`${t.pathname}/.well-known/openid-configuration`,Fw.format({...t,pathname:e})}}(t),n=await zw.call(this,{method:"GET",responseType:"json",url:r,headers:{Accept:"application/json"}}),i=Hw(n);return new e({...Zw,...i,[Yw]:!!Xw.find((e=>r.startsWith(e)))})}async reloadJwksUri(){await qw.call(this,!0)}[Kw.custom](){return`${this.constructor.name} ${Kw(this.metadata,{depth:1/0,colors:process.stdout.isTTY,compact:!1,sorted:!0})}`}};var eS=Qw;const tS=e,{format:rS}=t,nS=Xv,{RPError:iS,OPError:sS}=B_,{BaseClient:oS}=Mw,{random:aS,codeChallenge:cS}=Av,lS=dv,{resolveResponseType:uS,resolveRedirectUri:dS}=gb;function fS(e,t,r={}){e?this.error(e):t?this.success(t,r):this.fail(r)}function pS({client:e,params:t={},passReqToCallback:r=!1,sessionKey:n,usePKCE:i=!0,extras:s={}}={},o){if(!(e instanceof oS))throw new TypeError("client must be an instance of openid-client Client");if("function"!=typeof o)throw new TypeError("verify callback must be a function");if(!e.issuer||!e.issuer.issuer)throw new TypeError("client must have an issuer with an identifier");if(this._client=e,this._issuer=e.issuer,this._verify=o,this._passReqToCallback=r,this._usePKCE=i,this._key=n||`oidc:${tS.parse(this._issuer.issuer).hostname}`,this._params=nS(t),delete this._params.state,delete this._params.nonce,this._extras=nS(s),this._params.response_type||(this._params.response_type=uS.call(e)),this._params.redirect_uri||(this._params.redirect_uri=dS.call(e)),this._params.scope||(this._params.scope="openid"),!0===this._usePKCE){const e=!!Array.isArray(this._issuer.code_challenge_methods_supported)&&this._issuer.code_challenge_methods_supported;if(e&&e.includes("S256"))this._usePKCE="S256";else if(e&&e.includes("plain"))this._usePKCE="plain";else{if(e)throw new TypeError("neither code_challenge_method supported by the client is supported by the issuer");this._usePKCE="S256"}}else if("string"==typeof this._usePKCE&&!["plain","S256"].includes(this._usePKCE))throw new TypeError(`${this._usePKCE} is not valid/implemented PKCE code_challenge_method`);this.name=tS.parse(e.issuer.issuer).hostname}pS.prototype.authenticate=function(e,t){(async()=>{const r=this._client;if(!e.session)throw new TypeError("authentication requires session support");const n=r.callbackParams(e),i=this._key,{0:s,length:o}=Object.keys(n);if(0===o||1===o&&"iss"===s){const n={state:aS(),...this._params,...t};if(!n.nonce&&n.response_type.includes("id_token")&&(n.nonce=aS()),e.session[i]=lS(n,"nonce","state","max_age","response_type"),this._usePKCE&&n.response_type.includes("code")){const t=aS();switch(e.session[i].code_verifier=t,this._usePKCE){case"S256":n.code_challenge=cS(t),n.code_challenge_method="S256";break;case"plain":n.code_challenge=t}}return void this.redirect(r.authorizationUrl(n))}const a=e.session[i];if(0===Object.keys(a||{}).length)throw new Error(rS('did not find expected authorization request details in session, req.session["%s"] is %j',i,a));const{state:c,nonce:l,max_age:u,code_verifier:d,response_type:f}=a;try{delete e.session[i]}catch(e){}const p={redirect_uri:this._params.redirect_uri,...t},h={state:c,nonce:l,max_age:u,code_verifier:d,response_type:f},m=await r.callback(p.redirect_uri,n,h,this._extras),y=this._passReqToCallback,g=this._verify.length>(y?3:2)&&r.issuer.userinfo_endpoint,_=[m,fS.bind(this)];if(g){if(!m.access_token)throw new iS({message:"expected access_token to be returned when asking for userinfo in verify callback",tokenset:m});const e=await r.userinfo(m);_.splice(1,0,e)}y&&_.unshift(e),this._verify(..._)})().catch((e=>{e instanceof sS&&"server_error"!==e.error&&!e.error.startsWith("invalid")||e instanceof iS?this.fail(e):this.error(e)}))};var hS=pS;const mS=eS,{OPError:yS,RPError:gS}=B_,_S=hS,vS=bv,{CLOCK_TOLERANCE:bS,HTTP_OPTIONS:wS}=Rv,SS=Av,{setDefaults:ES}=Vv;var kS=Pr({Issuer:mS,Strategy:_S,TokenSet:vS,errors:{OPError:yS,RPError:gS},custom:{setHttpOptionsDefaults:ES,http_options:wS,clock_tolerance:bS},generators:SS});const AS=kS.Issuer;kS.Strategy,kS.TokenSet,kS.errors,kS.custom,kS.generators;var OS={exports:{}};const CS=f,TS=p,RS=n,IS=s,xS={name:"dotenv",version:"16.4.5",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard","lint-readme":"standard-markdown",pretest:"npm run lint && npm run dts-check",test:"tap tests/*.js --100 -Rspec","test:coverage":"tap --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@definitelytyped/dtslint":"^0.0.133","@types/node":"^18.11.3",decache:"^4.6.1",sinon:"^14.0.1",standard:"^17.0.0","standard-markdown":"^7.1.0","standard-version":"^9.5.0",tap:"^16.3.0",tar:"^6.1.11",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}.version,jS=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function PS(e){console.log(`[dotenv@${xS}][DEBUG] ${e}`)}function NS(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function $S(e,t){let r;try{r=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){const e=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}const n=r.password;if(!n){const e=new Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}const i=r.searchParams.get("environment");if(!i){const e=new Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}const s=`DOTENV_VAULT_${i.toUpperCase()}`,o=e.parsed[s];if(!o){const e=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:o,key:n}}function MS(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(const r of e.path)CS.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=TS.resolve(process.cwd(),".env.vault");return CS.existsSync(t)?t:null}function DS(e){return"~"===e[0]?TS.join(RS.homedir(),e.slice(1)):e}const LS={configDotenv:function(e){const t=TS.resolve(process.cwd(),".env");let r="utf8";const n=Boolean(e&&e.debug);e&&e.encoding?r=e.encoding:n&&PS("No encoding is specified. UTF-8 is used by default");let i,s=[t];if(e&&e.path)if(Array.isArray(e.path)){s=[];for(const t of e.path)s.push(DS(t))}else s=[DS(e.path)];const o={};for(const t of s)try{const n=LS.parse(CS.readFileSync(t,{encoding:r}));LS.populate(o,n,e)}catch(e){n&&PS(`Failed to load ${t} ${e.message}`),i=e}let a=process.env;return e&&null!=e.processEnv&&(a=e.processEnv),LS.populate(a,o,e),i?{parsed:o,error:i}:{parsed:o}},_configVault:function(e){!function(e){console.log(`[dotenv@${xS}][INFO] ${e}`)}("Loading env from encrypted .env.vault");const t=LS._parseVault(e);let r=process.env;return e&&null!=e.processEnv&&(r=e.processEnv),LS.populate(r,t,e),{parsed:t}},_parseVault:function(e){const t=MS(e),r=LS.configDotenv({path:t});if(!r.parsed){const e=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code="MISSING_DATA",e}const n=NS(e).split(","),i=n.length;let s;for(let e=0;e<i;e++)try{const t=$S(r,n[e].trim());s=LS.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=i)throw t}return LS.parse(s)},config:function(e){if(0===NS(e).length)return LS.configDotenv(e);const t=MS(e);return t?LS._configVault(e):(function(e){console.log(`[dotenv@${xS}][WARN] ${e}`)}(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),LS.configDotenv(e))},decrypt:function(e,t){const r=Buffer.from(t.slice(-64),"hex");let n=Buffer.from(e,"base64");const i=n.subarray(0,12),s=n.subarray(-16);n=n.subarray(12,-16);try{const e=IS.createDecipheriv("aes-256-gcm",r,i);return e.setAuthTag(s),`${e.update(n)}${e.final()}`}catch(e){const t=e instanceof RangeError,r="Invalid key length"===e.message,n="Unsupported state or unable to authenticate data"===e.message;if(t||r){const e=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(n){const e=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw e}},parse:function(e){const t={};let r,n=e.toString();for(n=n.replace(/\r\n?/gm,"\n");null!=(r=jS.exec(n));){const e=r[1];let n=r[2]||"";n=n.trim();const i=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===i&&(n=n.replace(/\\n/g,"\n"),n=n.replace(/\\r/g,"\r")),t[e]=n}return t},populate:function(e,t,r={}){const n=Boolean(r&&r.debug),i=Boolean(r&&r.override);if("object"!=typeof t){const e=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(const r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(!0===i&&(e[r]=t[r]),n&&PS(!0===i?`"${r}" is already defined and WAS overwritten`:`"${r}" is already defined and was NOT overwritten`)):e[r]=t[r]}};OS.exports.configDotenv=LS.configDotenv,OS.exports._configVault=LS._configVault,OS.exports._parseVault=LS._parseVault,OS.exports.config=LS.config,OS.exports.decrypt=LS.decrypt,OS.exports.parse=LS.parse,OS.exports.populate=LS.populate,OS.exports=LS;var BS=Pr(OS.exports),KS={},FS={fromCallback:function(e){return Object.defineProperty((function(...t){if("function"!=typeof t[t.length-1])return new Promise(((r,n)=>{t.push(((e,t)=>null!=e?n(e):r(t))),e.apply(this,t)}));e.apply(this,t)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(...t){const r=t[t.length-1];if("function"!=typeof r)return e.apply(this,t);t.pop(),e.apply(this,t).then((e=>r(null,e)),r)}),"name",{value:e.name})}},US=h,WS=process.cwd,JS=null,HS=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return JS||(JS=WS.call(process)),JS};try{process.cwd()}catch(tB){}if("function"==typeof process.chdir){var GS=process.chdir;process.chdir=function(e){JS=null,GS.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,GS)}var zS=function(e){US.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,r,n){e.open(t,US.O_WRONLY|US.O_SYMLINK,r,(function(t,i){t?n&&n(t):e.fchmod(i,r,(function(t){e.close(i,(function(e){n&&n(t||e)}))}))}))},e.lchmodSync=function(t,r){var n,i=e.openSync(t,US.O_WRONLY|US.O_SYMLINK,r),s=!0;try{n=e.fchmodSync(i,r),s=!1}finally{if(s)try{e.closeSync(i)}catch(e){}else e.closeSync(i)}return n}}(e);e.lutimes||function(e){US.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,r,n,i){e.open(t,US.O_SYMLINK,(function(t,s){t?i&&i(t):e.futimes(s,r,n,(function(t){e.close(s,(function(e){i&&i(t||e)}))}))}))},e.lutimesSync=function(t,r,n){var i,s=e.openSync(t,US.O_SYMLINK),o=!0;try{i=e.futimesSync(s,r,n),o=!1}finally{if(o)try{e.closeSync(s)}catch(e){}else e.closeSync(s)}return i}):e.futimes&&(e.lutimes=function(e,t,r,n){n&&process.nextTick(n)},e.lutimesSync=function(){})}(e);e.chown=n(e.chown),e.fchown=n(e.fchown),e.lchown=n(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=i(e.chownSync),e.fchownSync=i(e.fchownSync),e.lchownSync=i(e.lchownSync),e.chmodSync=r(e.chmodSync),e.fchmodSync=r(e.fchmodSync),e.lchmodSync=r(e.lchmodSync),e.stat=s(e.stat),e.fstat=s(e.fstat),e.lstat=s(e.lstat),e.statSync=o(e.statSync),e.fstatSync=o(e.fstatSync),e.lstatSync=o(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,r){r&&process.nextTick(r)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,r,n){n&&process.nextTick(n)},e.lchownSync=function(){});"win32"===HS&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function r(r,n,i){var s=Date.now(),o=0;t(r,n,(function a(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-s<6e4)return setTimeout((function(){e.stat(n,(function(e,s){e&&"ENOENT"===e.code?t(r,n,a):i(c)}))}),o),void(o<100&&(o+=10));i&&i(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(r,t),r}(e.rename));function t(t){return t?function(r,n,i){return t.call(e,r,n,(function(e){a(e)&&(e=null),i&&i.apply(this,arguments)}))}:t}function r(t){return t?function(r,n){try{return t.call(e,r,n)}catch(e){if(!a(e))throw e}}:t}function n(t){return t?function(r,n,i,s){return t.call(e,r,n,i,(function(e){a(e)&&(e=null),s&&s.apply(this,arguments)}))}:t}function i(t){return t?function(r,n,i){try{return t.call(e,r,n,i)}catch(e){if(!a(e))throw e}}:t}function s(t){return t?function(r,n,i){function s(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof n&&(i=n,n=null),n?t.call(e,r,n,s):t.call(e,r,s)}:t}function o(t){return t?function(r,n){var i=n?t.call(e,r,n):t.call(e,r);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:t}function a(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function r(r,n,i,s,o,a){var c;if(a&&"function"==typeof a){var l=0;c=function(u,d,f){if(u&&"EAGAIN"===u.code&&l<10)return l++,t.call(e,r,n,i,s,o,c);a.apply(this,arguments)}}return t.call(e,r,n,i,s,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(r,t),r}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,r,n,i,s){for(var o=0;;)try{return c.call(e,t,r,n,i,s)}catch(e){if("EAGAIN"===e.code&&o<10){o++;continue}throw e}});var c};var VS=m.Stream,qS=function(e){return{ReadStream:function t(r,n){if(!(this instanceof t))return new t(r,n);VS.call(this);var i=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,n=n||{};for(var s=Object.keys(n),o=0,a=s.length;o<a;o++){var c=s[o];this[c]=n[c]}this.encoding&&this.setEncoding(this.encoding);if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){i._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return i.emit("error",e),void(i.readable=!1);i.fd=t,i.emit("open",t),i._read()}))},WriteStream:function t(r,n){if(!(this instanceof t))return new t(r,n);VS.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,n=n||{};for(var i=Object.keys(n),s=0,o=i.length;s<o;s++){var a=i[s];this[a]=n[a]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var XS=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:YS(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})),t},YS=Object.getPrototypeOf||function(e){return e.__proto__};var ZS,QS,eE=f,tE=zS,rE=qS,nE=XS,iE=t;function sE(e,t){Object.defineProperty(e,ZS,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(ZS=Symbol.for("graceful-fs.queue"),QS=Symbol.for("graceful-fs.previous")):(ZS="___graceful-fs.queue",QS="___graceful-fs.previous");var oE=function(){};if(iE.debuglog?oE=iE.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(oE=function(){var e=iE.format.apply(iE,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!eE[ZS]){var aE=jr[ZS]||[];sE(eE,aE),eE.close=function(e){function t(t,r){return e.call(eE,t,(function(e){e||fE(),"function"==typeof r&&r.apply(this,arguments)}))}return Object.defineProperty(t,QS,{value:e}),t}(eE.close),eE.closeSync=function(e){function t(t){e.apply(eE,arguments),fE()}return Object.defineProperty(t,QS,{value:e}),t}(eE.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){oE(eE[ZS]),u.equal(eE[ZS].length,0)}))}jr[ZS]||sE(jr,eE[ZS]);var cE,lE=uE(nE(eE));function uE(e){tE(e),e.gracefulify=uE,e.createReadStream=function(t,r){return new e.ReadStream(t,r)},e.createWriteStream=function(t,r){return new e.WriteStream(t,r)};var t=e.readFile;e.readFile=function(e,r,n){"function"==typeof r&&(n=r,r=null);return function e(r,n,i,s){return t(r,n,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof i&&i.apply(this,arguments):dE([e,[r,n,i],t,s||Date.now(),Date.now()])}))}(e,r,n)};var r=e.writeFile;e.writeFile=function(e,t,n,i){"function"==typeof n&&(i=n,n=null);return function e(t,n,i,s,o){return r(t,n,i,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof s&&s.apply(this,arguments):dE([e,[t,n,i,s],r,o||Date.now(),Date.now()])}))}(e,t,n,i)};var n=e.appendFile;n&&(e.appendFile=function(e,t,r,i){"function"==typeof r&&(i=r,r=null);return function e(t,r,i,s,o){return n(t,r,i,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof s&&s.apply(this,arguments):dE([e,[t,r,i,s],n,o||Date.now(),Date.now()])}))}(e,t,r,i)});var i=e.copyFile;i&&(e.copyFile=function(e,t,r,n){"function"==typeof r&&(n=r,r=0);return function e(t,r,n,s,o){return i(t,r,n,(function(i){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof s&&s.apply(this,arguments):dE([e,[t,r,n,s],i,o||Date.now(),Date.now()])}))}(e,t,r,n)});var s=e.readdir;e.readdir=function(e,t,r){"function"==typeof t&&(r=t,t=null);var n=o.test(process.version)?function(e,t,r,n){return s(e,i(e,t,r,n))}:function(e,t,r,n){return s(e,t,i(e,t,r,n))};return n(e,t,r);function i(e,t,r,i){return function(s,o){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?(o&&o.sort&&o.sort(),"function"==typeof r&&r.call(this,s,o)):dE([n,[e,t,r],s,i||Date.now(),Date.now()])}}};var o=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var a=rE(e);f=a.ReadStream,p=a.WriteStream}var c=e.ReadStream;c&&(f.prototype=Object.create(c.prototype),f.prototype.open=function(){var e=this;m(e.path,e.flags,e.mode,(function(t,r){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=r,e.emit("open",r),e.read())}))});var l=e.WriteStream;l&&(p.prototype=Object.create(l.prototype),p.prototype.open=function(){var e=this;m(e.path,e.flags,e.mode,(function(t,r){t?(e.destroy(),e.emit("error",t)):(e.fd=r,e.emit("open",r))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return p},set:function(e){p=e},enumerable:!0,configurable:!0});var u=f;Object.defineProperty(e,"FileReadStream",{get:function(){return u},set:function(e){u=e},enumerable:!0,configurable:!0});var d=p;function f(e,t){return this instanceof f?(c.apply(this,arguments),this):f.apply(Object.create(f.prototype),arguments)}function p(e,t){return this instanceof p?(l.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0});var h=e.open;function m(e,t,r,n){return"function"==typeof r&&(n=r,r=null),function e(t,r,n,i,s){return h(t,r,n,(function(o,a){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof i&&i.apply(this,arguments):dE([e,[t,r,n,i],o,s||Date.now(),Date.now()])}))}(e,t,r,n)}return e.open=m,e}function dE(e){oE("ENQUEUE",e[0].name,e[1]),eE[ZS].push(e),pE()}function fE(){for(var e=Date.now(),t=0;t<eE[ZS].length;++t)eE[ZS][t].length>2&&(eE[ZS][t][3]=e,eE[ZS][t][4]=e);pE()}function pE(){if(clearTimeout(cE),cE=void 0,0!==eE[ZS].length){var e=eE[ZS].shift(),t=e[0],r=e[1],n=e[2],i=e[3],s=e[4];if(void 0===i)oE("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-i>=6e4){oE("TIMEOUT",t.name,r);var o=r.pop();"function"==typeof o&&o.call(null,n)}else{var a=Date.now()-s,c=Math.max(s-i,1);a>=Math.min(1.2*c,100)?(oE("RETRY",t.name,r),t.apply(null,r.concat([i]))):eE[ZS].push(e)}void 0===cE&&(cE=setTimeout(pE,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!eE.__patched&&(lE=uE(eE),eE.__patched=!0),function(e){const t=FS.fromCallback,r=lE,n=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof r[e]));Object.assign(e,r),n.forEach((n=>{e[n]=t(r[n])})),e.exists=function(e,t){return"function"==typeof t?r.exists(e,t):new Promise((t=>r.exists(e,t)))},e.read=function(e,t,n,i,s,o){return"function"==typeof o?r.read(e,t,n,i,s,o):new Promise(((o,a)=>{r.read(e,t,n,i,s,((e,t,r)=>{if(e)return a(e);o({bytesRead:t,buffer:r})}))}))},e.write=function(e,t,...n){return"function"==typeof n[n.length-1]?r.write(e,t,...n):new Promise(((i,s)=>{r.write(e,t,...n,((e,t,r)=>{if(e)return s(e);i({bytesWritten:t,buffer:r})}))}))},e.readv=function(e,t,...n){return"function"==typeof n[n.length-1]?r.readv(e,t,...n):new Promise(((i,s)=>{r.readv(e,t,...n,((e,t,r)=>{if(e)return s(e);i({bytesRead:t,buffers:r})}))}))},e.writev=function(e,t,...n){return"function"==typeof n[n.length-1]?r.writev(e,t,...n):new Promise(((i,s)=>{r.writev(e,t,...n,((e,t,r)=>{if(e)return s(e);i({bytesWritten:t,buffers:r})}))}))},"function"==typeof r.realpath.native?e.realpath.native=t(r.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}(KS);var hE={},mE={};const yE=p;mE.checkPath=function(e){if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(yE.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};const gE=KS,{checkPath:_E}=mE,vE=e=>"number"==typeof e?e:{mode:511,...e}.mode;hE.makeDir=async(e,t)=>(_E(e),gE.mkdir(e,{mode:vE(t),recursive:!0})),hE.makeDirSync=(e,t)=>(_E(e),gE.mkdirSync(e,{mode:vE(t),recursive:!0}));const bE=FS.fromPromise,{makeDir:wE,makeDirSync:SE}=hE,EE=bE(wE);var kE={mkdirs:EE,mkdirsSync:SE,mkdirp:EE,mkdirpSync:SE,ensureDir:EE,ensureDirSync:SE};const AE=FS.fromPromise,OE=KS;var CE={pathExists:AE((function(e){return OE.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:OE.existsSync};const TE=KS;var RE={utimesMillis:(0,FS.fromPromise)((async function(e,t,r){const n=await TE.open(e,"r+");let i=null;try{await TE.futimes(n,t,r)}finally{try{await TE.close(n)}catch(e){i=e}}if(i)throw i})),utimesMillisSync:function(e,t,r){const n=TE.openSync(e,"r+");return TE.futimesSync(n,t,r),TE.closeSync(n)}};const IE=KS,xE=p,jE=FS.fromPromise;function PE(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function NE(e,t){const r=xE.resolve(e).split(xE.sep).filter((e=>e)),n=xE.resolve(t).split(xE.sep).filter((e=>e));return r.every(((e,t)=>n[t]===e))}function $E(e,t,r){return`Cannot ${r} '${e}' to a subdirectory of itself, '${t}'.`}var ME={checkPaths:jE((async function(e,t,r,n){const{srcStat:i,destStat:s}=await function(e,t,r){const n=r.dereference?e=>IE.stat(e,{bigint:!0}):e=>IE.lstat(e,{bigint:!0});return Promise.all([n(e),n(t).catch((e=>{if("ENOENT"===e.code)return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}(e,t,n);if(s){if(PE(i,s)){const n=xE.basename(e),o=xE.basename(t);if("move"===r&&n!==o&&n.toLowerCase()===o.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(i.isDirectory()&&NE(e,t))throw new Error($E(e,t,r));return{srcStat:i,destStat:s}})),checkPathsSync:function(e,t,r,n){const{srcStat:i,destStat:s}=function(e,t,r){let n;const i=r.dereference?e=>IE.statSync(e,{bigint:!0}):e=>IE.lstatSync(e,{bigint:!0}),s=i(e);try{n=i(t)}catch(e){if("ENOENT"===e.code)return{srcStat:s,destStat:null};throw e}return{srcStat:s,destStat:n}}(e,t,n);if(s){if(PE(i,s)){const n=xE.basename(e),o=xE.basename(t);if("move"===r&&n!==o&&n.toLowerCase()===o.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(i.isDirectory()&&NE(e,t))throw new Error($E(e,t,r));return{srcStat:i,destStat:s}},checkParentPaths:jE((async function e(t,r,n,i){const s=xE.resolve(xE.dirname(t)),o=xE.resolve(xE.dirname(n));if(o===s||o===xE.parse(o).root)return;let a;try{a=await IE.stat(o,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(PE(r,a))throw new Error($E(t,n,i));return e(t,r,o,i)})),checkParentPathsSync:function e(t,r,n,i){const s=xE.resolve(xE.dirname(t)),o=xE.resolve(xE.dirname(n));if(o===s||o===xE.parse(o).root)return;let a;try{a=IE.statSync(o,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(PE(r,a))throw new Error($E(t,n,i));return e(t,r,o,i)},isSrcSubdir:NE,areIdentical:PE};const DE=KS,LE=p,{mkdirs:BE}=kE,{pathExists:KE}=CE,{utimesMillis:FE}=RE,UE=ME;async function WE(e,t,r){return!r.filter||r.filter(e,t)}async function JE(e,t,r,n){const i=n.dereference?DE.stat:DE.lstat,s=await i(t);if(s.isDirectory())return async function(e,t,r,n,i){t||await DE.mkdir(n);const s=await DE.readdir(r);await Promise.all(s.map((async e=>{const t=LE.join(r,e),s=LE.join(n,e);if(!await WE(t,s,i))return;const{destStat:o}=await UE.checkPaths(t,s,"copy",i);return JE(o,t,s,i)}))),t||await DE.chmod(n,e.mode)}(s,e,t,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return async function(e,t,r,n,i){if(!t)return HE(e,r,n,i);if(i.overwrite)return await DE.unlink(n),HE(e,r,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}(s,e,t,r,n);if(s.isSymbolicLink())return async function(e,t,r,n){let i=await DE.readlink(t);n.dereference&&(i=LE.resolve(process.cwd(),i));if(!e)return DE.symlink(i,r);let s=null;try{s=await DE.readlink(r)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return DE.symlink(i,r);throw e}n.dereference&&(s=LE.resolve(process.cwd(),s));if(UE.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(UE.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await DE.unlink(r),DE.symlink(i,r)}(e,t,r,n);if(s.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(s.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}async function HE(e,t,r,n){if(await DE.copyFile(t,r),n.preserveTimestamps){128&e.mode||await function(e,t){return DE.chmod(e,128|t)}(r,e.mode);const n=await DE.stat(t);await FE(r,n.atime,n.mtime)}return DE.chmod(r,e.mode)}var GE=async function(e,t,r={}){"function"==typeof r&&(r={filter:r}),r.clobber=!("clobber"in r)||!!r.clobber,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001");const{srcStat:n,destStat:i}=await UE.checkPaths(e,t,"copy",r);if(await UE.checkParentPaths(e,n,t,"copy"),!await WE(e,t,r))return;const s=LE.dirname(t);await KE(s)||await BE(s),await JE(i,e,t,r)};const zE=lE,VE=p,qE=kE.mkdirsSync,XE=RE.utimesMillisSync,YE=ME;function ZE(e,t,r,n){const i=(n.dereference?zE.statSync:zE.lstatSync)(t);if(i.isDirectory())return function(e,t,r,n,i){return t?tk(r,n,i):function(e,t,r,n){return zE.mkdirSync(r),tk(t,r,n),ek(r,e)}(e.mode,r,n,i)}(i,e,t,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return function(e,t,r,n,i){return t?function(e,t,r,n){if(n.overwrite)return zE.unlinkSync(r),QE(e,t,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}(e,r,n,i):QE(e,r,n,i)}(i,e,t,r,n);if(i.isSymbolicLink())return function(e,t,r,n){let i=zE.readlinkSync(t);n.dereference&&(i=VE.resolve(process.cwd(),i));if(e){let e;try{e=zE.readlinkSync(r)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return zE.symlinkSync(i,r);throw e}if(n.dereference&&(e=VE.resolve(process.cwd(),e)),YE.isSrcSubdir(i,e))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${e}'.`);if(YE.isSrcSubdir(e,i))throw new Error(`Cannot overwrite '${e}' with '${i}'.`);return function(e,t){return zE.unlinkSync(t),zE.symlinkSync(e,t)}(i,r)}return zE.symlinkSync(i,r)}(e,t,r,n);if(i.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(i.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function QE(e,t,r,n){return zE.copyFileSync(t,r),n.preserveTimestamps&&function(e,t,r){(function(e){return!(128&e)})(e)&&function(e,t){ek(e,128|t)}(r,e);(function(e,t){const r=zE.statSync(e);XE(t,r.atime,r.mtime)})(t,r)}(e.mode,t,r),ek(r,e.mode)}function ek(e,t){return zE.chmodSync(e,t)}function tk(e,t,r){zE.readdirSync(e).forEach((n=>function(e,t,r,n){const i=VE.join(t,e),s=VE.join(r,e);if(n.filter&&!n.filter(i,s))return;const{destStat:o}=YE.checkPathsSync(i,s,"copy",n);return ZE(o,i,s,n)}(n,e,t,r)))}var rk=function(e,t,r){"function"==typeof r&&(r={filter:r}),(r=r||{}).clobber=!("clobber"in r)||!!r.clobber,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002");const{srcStat:n,destStat:i}=YE.checkPathsSync(e,t,"copy",r);if(YE.checkParentPathsSync(e,n,t,"copy"),r.filter&&!r.filter(e,t))return;const s=VE.dirname(t);return zE.existsSync(s)||qE(s),ZE(i,e,t,r)};var nk={copy:(0,FS.fromPromise)(GE),copySync:rk};const ik=lE;var sk={remove:(0,FS.fromCallback)((function(e,t){ik.rm(e,{recursive:!0,force:!0},t)})),removeSync:function(e){ik.rmSync(e,{recursive:!0,force:!0})}};const ok=FS.fromPromise,ak=KS,ck=p,lk=kE,uk=sk,dk=ok((async function(e){let t;try{t=await ak.readdir(e)}catch{return lk.mkdirs(e)}return Promise.all(t.map((t=>uk.remove(ck.join(e,t)))))}));function fk(e){let t;try{t=ak.readdirSync(e)}catch{return lk.mkdirsSync(e)}t.forEach((t=>{t=ck.join(e,t),uk.removeSync(t)}))}var pk={emptyDirSync:fk,emptydirSync:fk,emptyDir:dk,emptydir:dk};const hk=FS.fromPromise,mk=p,yk=KS,gk=kE;var _k={createFile:hk((async function(e){let t;try{t=await yk.stat(e)}catch{}if(t&&t.isFile())return;const r=mk.dirname(e);let n=null;try{n=await yk.stat(r)}catch(t){if("ENOENT"===t.code)return await gk.mkdirs(r),void await yk.writeFile(e,"");throw t}n.isDirectory()?await yk.writeFile(e,""):await yk.readdir(r)})),createFileSync:function(e){let t;try{t=yk.statSync(e)}catch{}if(t&&t.isFile())return;const r=mk.dirname(e);try{yk.statSync(r).isDirectory()||yk.readdirSync(r)}catch(e){if(!e||"ENOENT"!==e.code)throw e;gk.mkdirsSync(r)}yk.writeFileSync(e,"")}};const vk=FS.fromPromise,bk=p,wk=KS,Sk=kE,{pathExists:Ek}=CE,{areIdentical:kk}=ME;var Ak={createLink:vk((async function(e,t){let r,n;try{r=await wk.lstat(t)}catch{}try{n=await wk.lstat(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}if(r&&kk(n,r))return;const i=bk.dirname(t);await Ek(i)||await Sk.mkdirs(i),await wk.link(e,t)})),createLinkSync:function(e,t){let r;try{r=wk.lstatSync(t)}catch{}try{const t=wk.lstatSync(e);if(r&&kk(t,r))return}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=bk.dirname(t);return wk.existsSync(n)||Sk.mkdirsSync(n),wk.linkSync(e,t)}};const Ok=p,Ck=KS,{pathExists:Tk}=CE;var Rk={symlinkPaths:(0,FS.fromPromise)((async function(e,t){if(Ok.isAbsolute(e)){try{await Ck.lstat(e)}catch(e){throw e.message=e.message.replace("lstat","ensureSymlink"),e}return{toCwd:e,toDst:e}}const r=Ok.dirname(t),n=Ok.join(r,e);if(await Tk(n))return{toCwd:n,toDst:e};try{await Ck.lstat(e)}catch(e){throw e.message=e.message.replace("lstat","ensureSymlink"),e}return{toCwd:e,toDst:Ok.relative(r,e)}})),symlinkPathsSync:function(e,t){if(Ok.isAbsolute(e)){if(!Ck.existsSync(e))throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}const r=Ok.dirname(t),n=Ok.join(r,e);if(Ck.existsSync(n))return{toCwd:n,toDst:e};if(!Ck.existsSync(e))throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:Ok.relative(r,e)}}};const Ik=KS;var xk={symlinkType:(0,FS.fromPromise)((async function(e,t){if(t)return t;let r;try{r=await Ik.lstat(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"})),symlinkTypeSync:function(e,t){if(t)return t;let r;try{r=Ik.lstatSync(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}};const jk=FS.fromPromise,Pk=p,Nk=KS,{mkdirs:$k,mkdirsSync:Mk}=kE,{symlinkPaths:Dk,symlinkPathsSync:Lk}=Rk,{symlinkType:Bk,symlinkTypeSync:Kk}=xk,{pathExists:Fk}=CE,{areIdentical:Uk}=ME;var Wk={createSymlink:jk((async function(e,t,r){let n;try{n=await Nk.lstat(t)}catch{}if(n&&n.isSymbolicLink()){const[r,n]=await Promise.all([Nk.stat(e),Nk.stat(t)]);if(Uk(r,n))return}const i=await Dk(e,t);e=i.toDst;const s=await Bk(i.toCwd,r),o=Pk.dirname(t);return await Fk(o)||await $k(o),Nk.symlink(e,t,s)})),createSymlinkSync:function(e,t,r){let n;try{n=Nk.lstatSync(t)}catch{}if(n&&n.isSymbolicLink()){const r=Nk.statSync(e),n=Nk.statSync(t);if(Uk(r,n))return}const i=Lk(e,t);e=i.toDst,r=Kk(i.toCwd,r);const s=Pk.dirname(t);return Nk.existsSync(s)||Mk(s),Nk.symlinkSync(e,t,r)}};const{createFile:Jk,createFileSync:Hk}=_k,{createLink:Gk,createLinkSync:zk}=Ak,{createSymlink:Vk,createSymlinkSync:qk}=Wk;var Xk={createFile:Jk,createFileSync:Hk,ensureFile:Jk,ensureFileSync:Hk,createLink:Gk,createLinkSync:zk,ensureLink:Gk,ensureLinkSync:zk,createSymlink:Vk,createSymlinkSync:qk,ensureSymlink:Vk,ensureSymlinkSync:qk};var Yk={stringify:function(e,{EOL:t="\n",finalEOL:r=!0,replacer:n=null,spaces:i}={}){const s=r?t:"";return JSON.stringify(e,n,i).replace(/\n/g,t)+s},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}};let Zk;try{Zk=lE}catch(rB){Zk=f}const Qk=FS,{stringify:eA,stripBom:tA}=Yk;const rA=Qk.fromPromise((async function(e,t={}){"string"==typeof t&&(t={encoding:t});const r=t.fs||Zk,n=!("throws"in t)||t.throws;let i,s=await Qk.fromCallback(r.readFile)(e,t);s=tA(s);try{i=JSON.parse(s,t?t.reviver:null)}catch(t){if(n)throw t.message=`${e}: ${t.message}`,t;return null}return i}));const nA=Qk.fromPromise((async function(e,t,r={}){const n=r.fs||Zk,i=eA(t,r);await Qk.fromCallback(n.writeFile)(e,i,r)}));const iA={readFile:rA,readFileSync:function(e,t={}){"string"==typeof t&&(t={encoding:t});const r=t.fs||Zk,n=!("throws"in t)||t.throws;try{let n=r.readFileSync(e,t);return n=tA(n),JSON.parse(n,t.reviver)}catch(t){if(n)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:nA,writeFileSync:function(e,t,r={}){const n=r.fs||Zk,i=eA(t,r);return n.writeFileSync(e,i,r)}};var sA={readJson:iA.readFile,readJsonSync:iA.readFileSync,writeJson:iA.writeFile,writeJsonSync:iA.writeFileSync};const oA=FS.fromPromise,aA=KS,cA=p,lA=kE,uA=CE.pathExists;var dA={outputFile:oA((async function(e,t,r="utf-8"){const n=cA.dirname(e);return await uA(n)||await lA.mkdirs(n),aA.writeFile(e,t,r)})),outputFileSync:function(e,...t){const r=cA.dirname(e);aA.existsSync(r)||lA.mkdirsSync(r),aA.writeFileSync(e,...t)}};const{stringify:fA}=Yk,{outputFile:pA}=dA;var hA=async function(e,t,r={}){const n=fA(t,r);await pA(e,n,r)};const{stringify:mA}=Yk,{outputFileSync:yA}=dA;var gA=function(e,t,r){const n=mA(t,r);yA(e,n,r)};const _A=FS.fromPromise,vA=sA;vA.outputJson=_A(hA),vA.outputJsonSync=gA,vA.outputJSON=vA.outputJson,vA.outputJSONSync=vA.outputJsonSync,vA.writeJSON=vA.writeJson,vA.writeJSONSync=vA.writeJsonSync,vA.readJSON=vA.readJson,vA.readJSONSync=vA.readJsonSync;var bA=vA;const wA=KS,SA=p,{copy:EA}=nk,{remove:kA}=sk,{mkdirp:AA}=kE,{pathExists:OA}=CE,CA=ME;var TA=async function(e,t,r={}){const n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await CA.checkPaths(e,t,"move",r);await CA.checkParentPaths(e,i,t,"move");const o=SA.dirname(t);return SA.parse(o).root!==o&&await AA(o),async function(e,t,r,n){if(!n)if(r)await kA(t);else if(await OA(t))throw new Error("dest already exists.");try{await wA.rename(e,t)}catch(n){if("EXDEV"!==n.code)throw n;await async function(e,t,r){const n={overwrite:r,errorOnExist:!0,preserveTimestamps:!0};return await EA(e,t,n),kA(e)}(e,t,r)}}(e,t,n,s)};const RA=lE,IA=p,xA=nk.copySync,jA=sk.removeSync,PA=kE.mkdirpSync,NA=ME;function $A(e,t,r){try{RA.renameSync(e,t)}catch(n){if("EXDEV"!==n.code)throw n;return function(e,t,r){const n={overwrite:r,errorOnExist:!0,preserveTimestamps:!0};return xA(e,t,n),jA(e)}(e,t,r)}}var MA=function(e,t,r){const n=(r=r||{}).overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=NA.checkPathsSync(e,t,"move",r);return NA.checkParentPathsSync(e,i,t,"move"),function(e){const t=IA.dirname(e);return IA.parse(t).root===t}(t)||PA(IA.dirname(t)),function(e,t,r,n){if(n)return $A(e,t,r);if(r)return jA(t),$A(e,t,r);if(RA.existsSync(t))throw new Error("dest already exists.");return $A(e,t,r)}(e,t,n,s)};var DA={move:(0,FS.fromPromise)(TA),moveSync:MA},LA=Pr({...KS,...nk,...pk,...Xk,...bA,...kE,...DA,...dA,...CE,...sk});
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
function BA(e){return null==e}var KA=function(e,t){var r,n="";for(r=0;r<t;r+=1)n+=e;return n},FA=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},UA=function(e,t){var r,n,i,s;if(t)for(r=0,n=(s=Object.keys(t)).length;r<n;r+=1)e[i=s[r]]=t[i];return e},WA={isNothing:BA,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:BA(e)?[]:[e]},repeat:KA,isNegativeZero:FA,extend:UA};function JA(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+="\n\n"+e.mark.snippet),n+" "+r):n}function HA(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=JA(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}HA.prototype=Object.create(Error.prototype),HA.prototype.constructor=HA,HA.prototype.toString=function(e){return this.name+": "+JA(this,e)};var GA=HA;function zA(e,t,r,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-t>a&&(t=n-a+(s=" ... ").length),r-n>a&&(r=n+a-(o=" ...").length),{str:s+e.slice(t,r).replace(/\t/g,"→")+o,pos:n-t+s.length}}function VA(e,t){return WA.repeat(" ",t-e.length)+e}var qA=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var r,n=/\r?\n|\r|\0/g,i=[0],s=[],o=-1;r=n.exec(e.buffer);)s.push(r.index),i.push(r.index+r[0].length),e.position<=r.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var a,c,l="",u=Math.min(e.line+t.linesAfter,s.length).toString().length,d=t.maxLength-(t.indent+u+3);for(a=1;a<=t.linesBefore&&!(o-a<0);a++)c=zA(e.buffer,i[o-a],s[o-a],e.position-(i[o]-i[o-a]),d),l=WA.repeat(" ",t.indent)+VA((e.line-a+1).toString(),u)+" | "+c.str+"\n"+l;for(c=zA(e.buffer,i[o],s[o],e.position,d),l+=WA.repeat(" ",t.indent)+VA((e.line+1).toString(),u)+" | "+c.str+"\n",l+=WA.repeat("-",t.indent+u+3+c.pos)+"^\n",a=1;a<=t.linesAfter&&!(o+a>=s.length);a++)c=zA(e.buffer,i[o+a],s[o+a],e.position-(i[o]-i[o+a]),d),l+=WA.repeat(" ",t.indent)+VA((e.line+a+1).toString(),u)+" | "+c.str+"\n";return l.replace(/\n$/,"")},XA=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],YA=["scalar","sequence","mapping"];var ZA=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===XA.indexOf(t))throw new GA('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(r){e[r].forEach((function(e){t[String(e)]=r}))})),t}(t.styleAliases||null),-1===YA.indexOf(this.kind))throw new GA('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function QA(e,t){var r=[];return e[t].forEach((function(e){var t=r.length;r.forEach((function(r,n){r.tag===e.tag&&r.kind===e.kind&&r.multi===e.multi&&(t=n)})),r[t]=e})),r}function eO(e){return this.extend(e)}eO.prototype.extend=function(e){var t=[],r=[];if(e instanceof ZA)r.push(e);else if(Array.isArray(e))r=r.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new GA("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(r=r.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof ZA))throw new GA("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new GA("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new GA("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),r.forEach((function(e){if(!(e instanceof ZA))throw new GA("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var n=Object.create(eO.prototype);return n.implicit=(this.implicit||[]).concat(t),n.explicit=(this.explicit||[]).concat(r),n.compiledImplicit=QA(n,"implicit"),n.compiledExplicit=QA(n,"explicit"),n.compiledTypeMap=function(){var e,t,r={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function n(e){e.multi?(r.multi[e.kind].push(e),r.multi.fallback.push(e)):r[e.kind][e.tag]=r.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(n);return r}(n.compiledImplicit,n.compiledExplicit),n};var tO=eO,rO=new ZA("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),nO=new ZA("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),iO=new ZA("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}}),sO=new tO({explicit:[rO,nO,iO]});var oO=new ZA("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var aO=new ZA("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function cO(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function lO(e){return 48<=e&&e<=55}function uO(e){return 48<=e&&e<=57}var dO=new ZA("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r=e.length,n=0,i=!1;if(!r)return!1;if("-"!==(t=e[n])&&"+"!==t||(t=e[++n]),"0"===t){if(n+1===r)return!0;if("b"===(t=e[++n])){for(n++;n<r;n++)if("_"!==(t=e[n])){if("0"!==t&&"1"!==t)return!1;i=!0}return i&&"_"!==t}if("x"===t){for(n++;n<r;n++)if("_"!==(t=e[n])){if(!cO(e.charCodeAt(n)))return!1;i=!0}return i&&"_"!==t}if("o"===t){for(n++;n<r;n++)if("_"!==(t=e[n])){if(!lO(e.charCodeAt(n)))return!1;i=!0}return i&&"_"!==t}}if("_"===t)return!1;for(;n<r;n++)if("_"!==(t=e[n])){if(!uO(e.charCodeAt(n)))return!1;i=!0}return!(!i||"_"===t)},construct:function(e){var t,r=e,n=1;if(-1!==r.indexOf("_")&&(r=r.replace(/_/g,"")),"-"!==(t=r[0])&&"+"!==t||("-"===t&&(n=-1),t=(r=r.slice(1))[0]),"0"===r)return 0;if("0"===t){if("b"===r[1])return n*parseInt(r.slice(2),2);if("x"===r[1])return n*parseInt(r.slice(2),16);if("o"===r[1])return n*parseInt(r.slice(2),8)}return n*parseInt(r,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!WA.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),fO=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var pO=/^[-+]?[0-9]+e/;var hO=new ZA("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!fO.test(e)||"_"===e[e.length-1])},construct:function(e){var t,r;return r="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:r*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||WA.isNegativeZero(e))},represent:function(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(WA.isNegativeZero(e))return"-0.0";return r=e.toString(10),pO.test(r)?r.replace("e",".e"):r},defaultStyle:"lowercase"}),mO=sO.extend({implicit:[oO,aO,dO,hO]}),yO=mO,gO=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),_O=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var vO=new ZA("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==gO.exec(e)||null!==_O.exec(e))},construct:function(e){var t,r,n,i,s,o,a,c,l=0,u=null;if(null===(t=gO.exec(e))&&(t=_O.exec(e)),null===t)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(r,n,i));if(s=+t[4],o=+t[5],a=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(r,n,i,s,o,a,l)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var bO=new ZA("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),wO="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var SO=new ZA("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,r,n=0,i=e.length,s=wO;for(r=0;r<i;r++)if(!((t=s.indexOf(e.charAt(r)))>64)){if(t<0)return!1;n+=6}return n%8==0},construct:function(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,s=wO,o=0,a=[];for(t=0;t<i;t++)t%4==0&&t&&(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)),o=o<<6|s.indexOf(n.charAt(t));return 0===(r=i%4*6)?(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)):18===r?(a.push(o>>10&255),a.push(o>>2&255)):12===r&&a.push(o>>4&255),new Uint8Array(a)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,r,n="",i=0,s=e.length,o=wO;for(t=0;t<s;t++)t%3==0&&t&&(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]),i=(i<<8)+e[t];return 0===(r=s%3)?(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]):2===r?(n+=o[i>>10&63],n+=o[i>>4&63],n+=o[i<<2&63],n+=o[64]):1===r&&(n+=o[i>>2&63],n+=o[i<<4&63],n+=o[64],n+=o[64]),n}}),EO=Object.prototype.hasOwnProperty,kO=Object.prototype.toString;var AO=new ZA("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,i,s,o=[],a=e;for(t=0,r=a.length;t<r;t+=1){if(n=a[t],s=!1,"[object Object]"!==kO.call(n))return!1;for(i in n)if(EO.call(n,i)){if(s)return!1;s=!0}if(!s)return!1;if(-1!==o.indexOf(i))return!1;o.push(i)}return!0},construct:function(e){return null!==e?e:[]}}),OO=Object.prototype.toString;var CO=new ZA("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,r,n,i,s,o=e;for(s=new Array(o.length),t=0,r=o.length;t<r;t+=1){if(n=o[t],"[object Object]"!==OO.call(n))return!1;if(1!==(i=Object.keys(n)).length)return!1;s[t]=[i[0],n[i[0]]]}return!0},construct:function(e){if(null===e)return[];var t,r,n,i,s,o=e;for(s=new Array(o.length),t=0,r=o.length;t<r;t+=1)n=o[t],i=Object.keys(n),s[t]=[i[0],n[i[0]]];return s}}),TO=Object.prototype.hasOwnProperty;var RO=new ZA("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,r=e;for(t in r)if(TO.call(r,t)&&null!==r[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),IO=yO.extend({implicit:[vO,bO],explicit:[SO,AO,CO,RO]}),xO=Object.prototype.hasOwnProperty,jO=1,PO=2,NO=3,$O=4,MO=1,DO=2,LO=3,BO=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,KO=/[\x85\u2028\u2029]/,FO=/[,\[\]\{\}]/,UO=/^(?:!|!!|![a-z\-]+!)$/i,WO=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function JO(e){return Object.prototype.toString.call(e)}function HO(e){return 10===e||13===e}function GO(e){return 9===e||32===e}function zO(e){return 9===e||32===e||10===e||13===e}function VO(e){return 44===e||91===e||93===e||123===e||125===e}function qO(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function XO(e){return 120===e?2:117===e?4:85===e?8:0}function YO(e){return 48<=e&&e<=57?e-48:-1}function ZO(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function QO(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var eC=new Array(256),tC=new Array(256),rC=0;rC<256;rC++)eC[rC]=ZO(rC)?1:0,tC[rC]=ZO(rC);function nC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||IO,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function iC(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=qA(r),new GA(t,r)}function sC(e,t){throw iC(e,t)}function oC(e,t){e.onWarning&&e.onWarning.call(null,iC(e,t))}var aC={YAML:function(e,t,r){var n,i,s;null!==e.version&&sC(e,"duplication of %YAML directive"),1!==r.length&&sC(e,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]))&&sC(e,"ill-formed argument of the YAML directive"),i=parseInt(n[1],10),s=parseInt(n[2],10),1!==i&&sC(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=s<2,1!==s&&2!==s&&oC(e,"unsupported YAML version of the document")},TAG:function(e,t,r){var n,i;2!==r.length&&sC(e,"TAG directive accepts exactly two arguments"),n=r[0],i=r[1],UO.test(n)||sC(e,"ill-formed tag handle (first argument) of the TAG directive"),xO.call(e.tagMap,n)&&sC(e,'there is a previously declared suffix for "'+n+'" tag handle'),WO.test(i)||sC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){sC(e,"tag prefix is malformed: "+i)}e.tagMap[n]=i}};function cC(e,t,r,n){var i,s,o,a;if(t<r){if(a=e.input.slice(t,r),n)for(i=0,s=a.length;i<s;i+=1)9===(o=a.charCodeAt(i))||32<=o&&o<=1114111||sC(e,"expected valid JSON character");else BO.test(a)&&sC(e,"the stream contains non-printable characters");e.result+=a}}function lC(e,t,r,n){var i,s,o,a;for(WA.isObject(r)||sC(e,"cannot merge mappings; the provided source object is unacceptable"),o=0,a=(i=Object.keys(r)).length;o<a;o+=1)s=i[o],xO.call(t,s)||(t[s]=r[s],n[s]=!0)}function uC(e,t,r,n,i,s,o,a,c){var l,u;if(Array.isArray(i))for(l=0,u=(i=Array.prototype.slice.call(i)).length;l<u;l+=1)Array.isArray(i[l])&&sC(e,"nested arrays are not supported inside keys"),"object"==typeof i&&"[object Object]"===JO(i[l])&&(i[l]="[object Object]");if("object"==typeof i&&"[object Object]"===JO(i)&&(i="[object Object]"),i=String(i),null===t&&(t={}),"tag:yaml.org,2002:merge"===n)if(Array.isArray(s))for(l=0,u=s.length;l<u;l+=1)lC(e,t,s[l],r);else lC(e,t,s,r);else e.json||xO.call(r,i)||!xO.call(t,i)||(e.line=o||e.line,e.lineStart=a||e.lineStart,e.position=c||e.position,sC(e,"duplicated mapping key")),"__proto__"===i?Object.defineProperty(t,i,{configurable:!0,enumerable:!0,writable:!0,value:s}):t[i]=s,delete r[i];return t}function dC(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):sC(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function fC(e,t,r){for(var n=0,i=e.input.charCodeAt(e.position);0!==i;){for(;GO(i);)9===i&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&35===i)do{i=e.input.charCodeAt(++e.position)}while(10!==i&&13!==i&&0!==i);if(!HO(i))break;for(dC(e),i=e.input.charCodeAt(e.position),n++,e.lineIndent=0;32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position)}return-1!==r&&0!==n&&e.lineIndent<r&&oC(e,"deficient indentation"),n}function pC(e){var t,r=e.position;return!(45!==(t=e.input.charCodeAt(r))&&46!==t||t!==e.input.charCodeAt(r+1)||t!==e.input.charCodeAt(r+2)||(r+=3,0!==(t=e.input.charCodeAt(r))&&!zO(t)))}function hC(e,t){1===t?e.result+=" ":t>1&&(e.result+=WA.repeat("\n",t-1))}function mC(e,t){var r,n,i=e.tag,s=e.anchor,o=[],a=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),n=e.input.charCodeAt(e.position);0!==n&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,sC(e,"tab characters must not be used in indentation")),45===n)&&zO(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,fC(e,!0,-1)&&e.lineIndent<=t)o.push(null),n=e.input.charCodeAt(e.position);else if(r=e.line,_C(e,t,NO,!1,!0),o.push(e.result),fC(e,!0,-1),n=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==n)sC(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=i,e.anchor=s,e.kind="sequence",e.result=o,!0)}function yC(e){var t,r,n,i,s=!1,o=!1;if(33!==(i=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&sC(e,"duplication of a tag property"),60===(i=e.input.charCodeAt(++e.position))?(s=!0,i=e.input.charCodeAt(++e.position)):33===i?(o=!0,r="!!",i=e.input.charCodeAt(++e.position)):r="!",t=e.position,s){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&62!==i);e.position<e.length?(n=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):sC(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==i&&!zO(i);)33===i&&(o?sC(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),UO.test(r)||sC(e,"named tag handle cannot contain such characters"),o=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);n=e.input.slice(t,e.position),FO.test(n)&&sC(e,"tag suffix cannot contain flow indicator characters")}n&&!WO.test(n)&&sC(e,"tag name cannot contain such characters: "+n);try{n=decodeURIComponent(n)}catch(t){sC(e,"tag name is malformed: "+n)}return s?e.tag=n:xO.call(e.tagMap,r)?e.tag=e.tagMap[r]+n:"!"===r?e.tag="!"+n:"!!"===r?e.tag="tag:yaml.org,2002:"+n:sC(e,'undeclared tag handle "'+r+'"'),!0}function gC(e){var t,r;if(38!==(r=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&sC(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!zO(r)&&!VO(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&sC(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function _C(e,t,r,n,i){var s,o,a,c,l,u,d,f,p,h=1,m=!1,y=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=o=a=$O===r||NO===r,n&&fC(e,!0,-1)&&(m=!0,e.lineIndent>t?h=1:e.lineIndent===t?h=0:e.lineIndent<t&&(h=-1)),1===h)for(;yC(e)||gC(e);)fC(e,!0,-1)?(m=!0,a=s,e.lineIndent>t?h=1:e.lineIndent===t?h=0:e.lineIndent<t&&(h=-1)):a=!1;if(a&&(a=m||i),1!==h&&$O!==r||(f=jO===r||PO===r?t:t+1,p=e.position-e.lineStart,1===h?a&&(mC(e,p)||function(e,t,r){var n,i,s,o,a,c,l,u=e.tag,d=e.anchor,f={},p=Object.create(null),h=null,m=null,y=null,g=!1,_=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=f),l=e.input.charCodeAt(e.position);0!==l;){if(g||-1===e.firstTabInLine||(e.position=e.firstTabInLine,sC(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),s=e.line,63!==l&&58!==l||!zO(n)){if(o=e.line,a=e.lineStart,c=e.position,!_C(e,r,PO,!1,!0))break;if(e.line===s){for(l=e.input.charCodeAt(e.position);GO(l);)l=e.input.charCodeAt(++e.position);if(58===l)zO(l=e.input.charCodeAt(++e.position))||sC(e,"a whitespace character is expected after the key-value separator within a block mapping"),g&&(uC(e,f,p,h,m,null,o,a,c),h=m=y=null),_=!0,g=!1,i=!1,h=e.tag,m=e.result;else{if(!_)return e.tag=u,e.anchor=d,!0;sC(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!_)return e.tag=u,e.anchor=d,!0;sC(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===l?(g&&(uC(e,f,p,h,m,null,o,a,c),h=m=y=null),_=!0,g=!0,i=!0):g?(g=!1,i=!0):sC(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,l=n;if((e.line===s||e.lineIndent>t)&&(g&&(o=e.line,a=e.lineStart,c=e.position),_C(e,t,$O,!0,i)&&(g?m=e.result:y=e.result),g||(uC(e,f,p,h,m,y,o,a,c),h=m=y=null),fC(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&0!==l)sC(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return g&&uC(e,f,p,h,m,null,o,a,c),_&&(e.tag=u,e.anchor=d,e.kind="mapping",e.result=f),_}(e,p,f))||function(e,t){var r,n,i,s,o,a,c,l,u,d,f,p,h=!0,m=e.tag,y=e.anchor,g=Object.create(null);if(91===(p=e.input.charCodeAt(e.position)))o=93,l=!1,s=[];else{if(123!==p)return!1;o=125,l=!0,s={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=s),p=e.input.charCodeAt(++e.position);0!==p;){if(fC(e,!0,t),(p=e.input.charCodeAt(e.position))===o)return e.position++,e.tag=m,e.anchor=y,e.kind=l?"mapping":"sequence",e.result=s,!0;h?44===p&&sC(e,"expected the node content, but found ','"):sC(e,"missed comma between flow collection entries"),f=null,a=c=!1,63===p&&zO(e.input.charCodeAt(e.position+1))&&(a=c=!0,e.position++,fC(e,!0,t)),r=e.line,n=e.lineStart,i=e.position,_C(e,t,jO,!1,!0),d=e.tag,u=e.result,fC(e,!0,t),p=e.input.charCodeAt(e.position),!c&&e.line!==r||58!==p||(a=!0,p=e.input.charCodeAt(++e.position),fC(e,!0,t),_C(e,t,jO,!1,!0),f=e.result),l?uC(e,s,g,d,u,f,r,n,i):a?s.push(uC(e,null,g,d,u,f,r,n,i)):s.push(u),fC(e,!0,t),44===(p=e.input.charCodeAt(e.position))?(h=!0,p=e.input.charCodeAt(++e.position)):h=!1}sC(e,"unexpected end of the stream within a flow collection")}(e,f)?y=!0:(o&&function(e,t){var r,n,i,s,o=MO,a=!1,c=!1,l=t,u=0,d=!1;if(124===(s=e.input.charCodeAt(e.position)))n=!1;else{if(62!==s)return!1;n=!0}for(e.kind="scalar",e.result="";0!==s;)if(43===(s=e.input.charCodeAt(++e.position))||45===s)MO===o?o=43===s?LO:DO:sC(e,"repeat of a chomping mode identifier");else{if(!((i=YO(s))>=0))break;0===i?sC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?sC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(GO(s)){do{s=e.input.charCodeAt(++e.position)}while(GO(s));if(35===s)do{s=e.input.charCodeAt(++e.position)}while(!HO(s)&&0!==s)}for(;0!==s;){for(dC(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!c||e.lineIndent<l)&&32===s;)e.lineIndent++,s=e.input.charCodeAt(++e.position);if(!c&&e.lineIndent>l&&(l=e.lineIndent),HO(s))u++;else{if(e.lineIndent<l){o===LO?e.result+=WA.repeat("\n",a?1+u:u):o===MO&&a&&(e.result+="\n");break}for(n?GO(s)?(d=!0,e.result+=WA.repeat("\n",a?1+u:u)):d?(d=!1,e.result+=WA.repeat("\n",u+1)):0===u?a&&(e.result+=" "):e.result+=WA.repeat("\n",u):e.result+=WA.repeat("\n",a?1+u:u),a=!0,c=!0,u=0,r=e.position;!HO(s)&&0!==s;)s=e.input.charCodeAt(++e.position);cC(e,r,e.position,!1)}}return!0}(e,f)||function(e,t){var r,n,i;if(39!==(r=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(r=e.input.charCodeAt(e.position));)if(39===r){if(cC(e,n,e.position,!0),39!==(r=e.input.charCodeAt(++e.position)))return!0;n=e.position,e.position++,i=e.position}else HO(r)?(cC(e,n,i,!0),hC(e,fC(e,!1,t)),n=i=e.position):e.position===e.lineStart&&pC(e)?sC(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);sC(e,"unexpected end of the stream within a single quoted scalar")}(e,f)||function(e,t){var r,n,i,s,o,a;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return cC(e,r,e.position,!0),e.position++,!0;if(92===a){if(cC(e,r,e.position,!0),HO(a=e.input.charCodeAt(++e.position)))fC(e,!1,t);else if(a<256&&eC[a])e.result+=tC[a],e.position++;else if((o=XO(a))>0){for(i=o,s=0;i>0;i--)(o=qO(a=e.input.charCodeAt(++e.position)))>=0?s=(s<<4)+o:sC(e,"expected hexadecimal character");e.result+=QO(s),e.position++}else sC(e,"unknown escape sequence");r=n=e.position}else HO(a)?(cC(e,r,n,!0),hC(e,fC(e,!1,t)),r=n=e.position):e.position===e.lineStart&&pC(e)?sC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}sC(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?y=!0:!function(e){var t,r,n;if(42!==(n=e.input.charCodeAt(e.position)))return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!zO(n)&&!VO(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&sC(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),xO.call(e.anchorMap,r)||sC(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],fC(e,!0,-1),!0}(e)?function(e,t,r){var n,i,s,o,a,c,l,u,d=e.kind,f=e.result;if(zO(u=e.input.charCodeAt(e.position))||VO(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(zO(n=e.input.charCodeAt(e.position+1))||r&&VO(n)))return!1;for(e.kind="scalar",e.result="",i=s=e.position,o=!1;0!==u;){if(58===u){if(zO(n=e.input.charCodeAt(e.position+1))||r&&VO(n))break}else if(35===u){if(zO(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&pC(e)||r&&VO(u))break;if(HO(u)){if(a=e.line,c=e.lineStart,l=e.lineIndent,fC(e,!1,-1),e.lineIndent>=t){o=!0,u=e.input.charCodeAt(e.position);continue}e.position=s,e.line=a,e.lineStart=c,e.lineIndent=l;break}}o&&(cC(e,i,s,!1),hC(e,e.line-a),i=s=e.position,o=!1),GO(u)||(s=e.position+1),u=e.input.charCodeAt(++e.position)}return cC(e,i,s,!1),!!e.result||(e.kind=d,e.result=f,!1)}(e,f,jO===r)&&(y=!0,null===e.tag&&(e.tag="?")):(y=!0,null===e.tag&&null===e.anchor||sC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===h&&(y=a&&mC(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&sC(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c<l;c+=1)if((d=e.implicitTypes[c]).resolve(e.result)){e.result=d.construct(e.result),e.tag=d.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(xO.call(e.typeMap[e.kind||"fallback"],e.tag))d=e.typeMap[e.kind||"fallback"][e.tag];else for(d=null,c=0,l=(u=e.typeMap.multi[e.kind||"fallback"]).length;c<l;c+=1)if(e.tag.slice(0,u[c].tag.length)===u[c].tag){d=u[c];break}d||sC(e,"unknown tag !<"+e.tag+">"),null!==e.result&&d.kind!==e.kind&&sC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+d.kind+'", not "'+e.kind+'"'),d.resolve(e.result,e.tag)?(e.result=d.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):sC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function vC(e){var t,r,n,i,s=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(fC(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!zO(i);)i=e.input.charCodeAt(++e.position);for(n=[],(r=e.input.slice(t,e.position)).length<1&&sC(e,"directive name must not be less than one character in length");0!==i;){for(;GO(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!HO(i));break}if(HO(i))break;for(t=e.position;0!==i&&!zO(i);)i=e.input.charCodeAt(++e.position);n.push(e.input.slice(t,e.position))}0!==i&&dC(e),xO.call(aC,r)?aC[r](e,r,n):oC(e,'unknown document directive "'+r+'"')}fC(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,fC(e,!0,-1)):o&&sC(e,"directives end mark is expected"),_C(e,e.lineIndent-1,$O,!1,!0),fC(e,!0,-1),e.checkLineBreaks&&KO.test(e.input.slice(s,e.position))&&oC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&pC(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,fC(e,!0,-1)):e.position<e.length-1&&sC(e,"end of the stream or a document separator is expected")}function bC(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var r=new nC(e,t),n=e.indexOf("\0");for(-1!==n&&(r.position=n,sC(r,"null byte is not allowed in input")),r.input+="\0";32===r.input.charCodeAt(r.position);)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)vC(r);return r.documents}var wC=function(e,t,r){null!==t&&"object"==typeof t&&void 0===r&&(r=t,t=null);var n=bC(e,r);if("function"!=typeof t)return n;for(var i=0,s=n.length;i<s;i+=1)t(n[i])},SC={loadAll:wC,load:function(e,t){var r=bC(e,t);if(0!==r.length){if(1===r.length)return r[0];throw new GA("expected a single document in the stream, but found more")}}},EC=Object.prototype.toString,kC=Object.prototype.hasOwnProperty,AC=65279,OC=9,CC=10,TC=13,RC=32,IC=33,xC=34,jC=35,PC=37,NC=38,$C=39,MC=42,DC=44,LC=45,BC=58,KC=61,FC=62,UC=63,WC=64,JC=91,HC=93,GC=96,zC=123,VC=124,qC=125,XC={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},YC=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],ZC=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function QC(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else{if(!(e<=4294967295))throw new GA("code point within a string may not be greater than 0xFFFFFFFF");r="U",n=8}return"\\"+r+WA.repeat("0",n-t.length)+t}var eT=1,tT=2;function rT(e){this.schema=e.schema||IO,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=WA.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var r,n,i,s,o,a,c;if(null===t)return{};for(r={},i=0,s=(n=Object.keys(t)).length;i<s;i+=1)o=n[i],a=String(t[o]),"!!"===o.slice(0,2)&&(o="tag:yaml.org,2002:"+o.slice(2)),(c=e.compiledTypeMap.fallback[o])&&kC.call(c.styleAliases,a)&&(a=c.styleAliases[a]),r[o]=a;return r}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType='"'===e.quotingType?tT:eT,this.forceQuotes=e.forceQuotes||!1,this.replacer="function"==typeof e.replacer?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function nT(e,t){for(var r,n=WA.repeat(" ",t),i=0,s=-1,o="",a=e.length;i<a;)-1===(s=e.indexOf("\n",i))?(r=e.slice(i),i=a):(r=e.slice(i,s+1),i=s+1),r.length&&"\n"!==r&&(o+=n),o+=r;return o}function iT(e,t){return"\n"+WA.repeat(" ",e.indent*t)}function sT(e){return e===RC||e===OC}function oT(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&e!==AC||65536<=e&&e<=1114111}function aT(e){return oT(e)&&e!==AC&&e!==TC&&e!==CC}function cT(e,t,r){var n=aT(e),i=n&&!sT(e);return(r?n:n&&e!==DC&&e!==JC&&e!==HC&&e!==zC&&e!==qC)&&e!==jC&&!(t===BC&&!i)||aT(t)&&!sT(t)&&e===jC||t===BC&&i}function lT(e,t){var r,n=e.charCodeAt(t);return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1))>=56320&&r<=57343?1024*(n-55296)+r-56320+65536:n}function uT(e){return/^\n* /.test(e)}var dT=1,fT=2,pT=3,hT=4,mT=5;function yT(e,t,r,n,i,s,o,a){var c,l=0,u=null,d=!1,f=!1,p=-1!==n,h=-1,m=function(e){return oT(e)&&e!==AC&&!sT(e)&&e!==LC&&e!==UC&&e!==BC&&e!==DC&&e!==JC&&e!==HC&&e!==zC&&e!==qC&&e!==jC&&e!==NC&&e!==MC&&e!==IC&&e!==VC&&e!==KC&&e!==FC&&e!==$C&&e!==xC&&e!==PC&&e!==WC&&e!==GC}(lT(e,0))&&function(e){return!sT(e)&&e!==BC}(lT(e,e.length-1));if(t||o)for(c=0;c<e.length;l>=65536?c+=2:c++){if(!oT(l=lT(e,c)))return mT;m=m&&cT(l,u,a),u=l}else{for(c=0;c<e.length;l>=65536?c+=2:c++){if((l=lT(e,c))===CC)d=!0,p&&(f=f||c-h-1>n&&" "!==e[h+1],h=c);else if(!oT(l))return mT;m=m&&cT(l,u,a),u=l}f=f||p&&c-h-1>n&&" "!==e[h+1]}return d||f?r>9&&uT(e)?mT:o?s===tT?mT:fT:f?hT:pT:!m||o||i(e)?s===tT?mT:fT:dT}function gT(e,t,r,n,i){e.dump=function(){if(0===t.length)return e.quotingType===tT?'""':"''";if(!e.noCompatMode&&(-1!==YC.indexOf(t)||ZC.test(t)))return e.quotingType===tT?'"'+t+'"':"'"+t+"'";var s=e.indent*Math.max(1,r),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-s),a=n||e.flowLevel>-1&&r>=e.flowLevel;switch(yT(t,a,e.indent,o,(function(t){return function(e,t){var r,n;for(r=0,n=e.implicitTypes.length;r<n;r+=1)if(e.implicitTypes[r].resolve(t))return!0;return!1}(e,t)}),e.quotingType,e.forceQuotes&&!n,i)){case dT:return t;case fT:return"'"+t.replace(/'/g,"''")+"'";case pT:return"|"+_T(t,e.indent)+vT(nT(t,s));case hT:return">"+_T(t,e.indent)+vT(nT(function(e,t){var r,n,i=/(\n+)([^\n]*)/g,s=(a=e.indexOf("\n"),a=-1!==a?a:e.length,i.lastIndex=a,bT(e.slice(0,a),t)),o="\n"===e[0]||" "===e[0];var a;for(;n=i.exec(e);){var c=n[1],l=n[2];r=" "===l[0],s+=c+(o||r||""===l?"":"\n")+bT(l,t),o=r}return s}(t,o),s));case mT:return'"'+function(e){for(var t,r="",n=0,i=0;i<e.length;n>=65536?i+=2:i++)n=lT(e,i),!(t=XC[n])&&oT(n)?(r+=e[i],n>=65536&&(r+=e[i+1])):r+=t||QC(n);return r}(t)+'"';default:throw new GA("impossible error: invalid scalar style")}}()}function _T(e,t){var r=uT(e)?String(t):"",n="\n"===e[e.length-1];return r+(n&&("\n"===e[e.length-2]||"\n"===e)?"+":n?"":"-")+"\n"}function vT(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function bT(e,t){if(""===e||" "===e[0])return e;for(var r,n,i=/ [^ ]/g,s=0,o=0,a=0,c="";r=i.exec(e);)(a=r.index)-s>t&&(n=o>s?o:a,c+="\n"+e.slice(s,n),s=n+1),o=a;return c+="\n",e.length-s>t&&o>s?c+=e.slice(s,o)+"\n"+e.slice(o+1):c+=e.slice(s),c.slice(1)}function wT(e,t,r,n){var i,s,o,a="",c=e.tag;for(i=0,s=r.length;i<s;i+=1)o=r[i],e.replacer&&(o=e.replacer.call(r,String(i),o)),(ET(e,t+1,o,!0,!0,!1,!0)||void 0===o&&ET(e,t+1,null,!0,!0,!1,!0))&&(n&&""===a||(a+=iT(e,t)),e.dump&&CC===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=c,e.dump=a||"[]"}function ST(e,t,r){var n,i,s,o,a,c;for(s=0,o=(i=r?e.explicitTypes:e.implicitTypes).length;s<o;s+=1)if(((a=i[s]).instanceOf||a.predicate)&&(!a.instanceOf||"object"==typeof t&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(r?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(c=e.styleMap[a.tag]||a.defaultStyle,"[object Function]"===EC.call(a.represent))n=a.represent(t,c);else{if(!kC.call(a.represent,c))throw new GA("!<"+a.tag+'> tag resolver accepts not "'+c+'" style');n=a.represent[c](t,c)}e.dump=n}return!0}return!1}function ET(e,t,r,n,i,s,o){e.tag=null,e.dump=r,ST(e,r,!1)||ST(e,r,!0);var a,c=EC.call(e.dump),l=n;n&&(n=e.flowLevel<0||e.flowLevel>t);var u,d,f="[object Object]"===c||"[object Array]"===c;if(f&&(d=-1!==(u=e.duplicates.indexOf(r))),(null!==e.tag&&"?"!==e.tag||d||2!==e.indent&&t>0)&&(i=!1),d&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&d&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===c)n&&0!==Object.keys(e.dump).length?(!function(e,t,r,n){var i,s,o,a,c,l,u="",d=e.tag,f=Object.keys(r);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new GA("sortKeys must be a boolean or a function");for(i=0,s=f.length;i<s;i+=1)l="",n&&""===u||(l+=iT(e,t)),a=r[o=f[i]],e.replacer&&(a=e.replacer.call(r,o,a)),ET(e,t+1,o,!0,!0,!0)&&((c=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(e.dump&&CC===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=iT(e,t)),ET(e,t+1,a,!0,c)&&(e.dump&&CC===e.dump.charCodeAt(0)?l+=":":l+=": ",u+=l+=e.dump));e.tag=d,e.dump=u||"{}"}(e,t,e.dump,i),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,r){var n,i,s,o,a,c="",l=e.tag,u=Object.keys(r);for(n=0,i=u.length;n<i;n+=1)a="",""!==c&&(a+=", "),e.condenseFlow&&(a+='"'),o=r[s=u[n]],e.replacer&&(o=e.replacer.call(r,s,o)),ET(e,t,s,!1,!1)&&(e.dump.length>1024&&(a+="? "),a+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ET(e,t,o,!1,!1)&&(c+=a+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===c)n&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?wT(e,t-1,e.dump,i):wT(e,t,e.dump,i),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,r){var n,i,s,o="",a=e.tag;for(n=0,i=r.length;n<i;n+=1)s=r[n],e.replacer&&(s=e.replacer.call(r,String(n),s)),(ET(e,t,s,!1,!1)||void 0===s&&ET(e,t,null,!1,!1))&&(""!==o&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=a,e.dump="["+o+"]"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else{if("[object String]"!==c){if("[object Undefined]"===c)return!1;if(e.skipInvalid)return!1;throw new GA("unacceptable kind of an object to dump "+c)}"?"!==e.tag&&gT(e,e.dump,t,s,l)}null!==e.tag&&"?"!==e.tag&&(a=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),a="!"===e.tag[0]?"!"+a:"tag:yaml.org,2002:"===a.slice(0,18)?"!!"+a.slice(18):"!<"+a+">",e.dump=a+" "+e.dump)}return!0}function kT(e,t){var r,n,i=[],s=[];for(AT(e,i,s),r=0,n=s.length;r<n;r+=1)t.duplicates.push(i[s[r]]);t.usedDuplicates=new Array(n)}function AT(e,t,r){var n,i,s;if(null!==e&&"object"==typeof e)if(-1!==(i=t.indexOf(e)))-1===r.indexOf(i)&&r.push(i);else if(t.push(e),Array.isArray(e))for(i=0,s=e.length;i<s;i+=1)AT(e[i],t,r);else for(i=0,s=(n=Object.keys(e)).length;i<s;i+=1)AT(e[n[i]],t,r)}var OT=function(e,t){var r=new rT(t=t||{});r.noRefs||kT(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),ET(r,0,n,!0,!0)?r.dump+"\n":""};function CT(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var TT={Type:ZA,Schema:tO,FAILSAFE_SCHEMA:sO,JSON_SCHEMA:mO,CORE_SCHEMA:yO,DEFAULT_SCHEMA:IO,load:SC.load,loadAll:SC.loadAll,dump:{dump:OT}.dump,YAMLException:GA,types:{binary:SO,float:hO,map:iO,null:oO,pairs:CO,set:RO,timestamp:vO,bool:aO,int:dO,merge:bO,omap:AO,seq:nO,str:rO},safeLoad:CT("safeLoad","load"),safeLoadAll:CT("safeLoadAll","loadAll"),safeDump:CT("safeDump","dump")};const RT=["CONFIG_PATH","CACHE_ENABLED","CACHE_TTL","CACHE_CONTROL_S_MAXAGE","CACHE_AUTO_PURGE","CACHE_AUTO_PURGE_IGNORE_LIST","CACHE_SYSTEM_TTL","CACHE_SCHEMA","CACHE_PERMISSIONS","CACHE_NAMESPACE","CACHE_STORE","CACHE_STATUS_HEADER","CACHE_VALUE_MAX_SIZE","CACHE_SKIP_ALLOWED","CACHE_HEALTHCHECK_THRESHOLD","CACHE_JWT_NAMESPACE","REDIS","REDIS_HOST","REDIS_PORT","REDIS_USERNAME","REDIS_PASSWORD","REDIS_PASSWORD_FILE","REDIS_JWT_DB","AUTH_PROVIDERS","AUTH_.+_DRIVER","AUTH_.+_CLIENT_ID","AUTH_.+_CLIENT_SECRET","AUTH_.+_SCOPE","AUTH_.+_AUTHORIZE_URL","AUTH_.+_ACCESS_URL","AUTH_.+_PROFILE_URL","AUTH_.+_IDENTIFIER_KEY","AUTH_.+_EMAIL_KEY","AUTH_.+_FIRST_NAME_KEY","AUTH_.+_LAST_NAME_KEY","AUTH_.+_ALLOW_PUBLIC_REGISTRATION","AUTH_.+_DEFAULT_ROLE_ID","AUTH_.+_ICON","AUTH_.+_LABEL","AUTH_.+_PARAMS","AUTH_.+_ISSUER_URL","AUTH_.+_CLIENT_URL","AUTH_.+_TRUSTED","AUTH_.+_JWKS_URL","AUTH_.+_JWKS_KEYS","AUTH_.+_JWT_ROLE_KEY","AUTH_.+_JWT_ADMIN_KEY","AUTH_.+_JWT_APP_KEY","AUTH_.+_JWT_USEDB"].map((e=>new RegExp(`^${e}$`))),IT=["string","number","regex","array","json"],xT={},jT={CONFIG_PATH:p.resolve(process.cwd(),".env")};let PT={...jT,...process.env,...function(){const e=p.resolve(process.env.CONFIG_PATH||jT.CONFIG_PATH);if(!1===f.existsSync(e))return{};const t=p.extname(e).toLowerCase();if(".js"===t){const t=require(e),r=t.default||t;if("function"==typeof r)return r(process.env);if("object"==typeof r)return r;throw new Error(`Invalid JS configuration file export type. Requires one of "function", "object", received: "${typeof r}"`)}if(".json"===t)return require(e);if(".yaml"===t||".yml"===t){const t=function(e){const t=LA.readFileSync(e,"utf8");return TT.load(t)}(e);if("object"==typeof t)return t;throw new Error("Invalid YAML configuration. Root has to be an object.")}return BS.parse(f.readFileSync(e,{encoding:"utf8"}))}()};process.env=PT,PT=function(e){t=e,e=Rr(t,Ir);var t;for(let[t,r]of Object.entries(e)){let n;if(t.length>5&&t.endsWith("_FILE")&&(n=t.slice(0,-5),RT.some((e=>e.test(n))))){if(n in e&&(!(n in jT)||e[n]!==jT[n]))throw new Error(`Duplicate environment variable encountered: you can't use "${n}" and "${t}" simultaneously.`);try{r=f.readFileSync(r,{encoding:"utf8"}),t=n}catch{throw new Error(`Failed to read value from file "${r}", defined in environment variable "${t}".`)}}if("string"==typeof r&&DT(r))e[t]=MT(r);else if(xT[t])switch(xT[t]){case"number":e[t]=X(r);break;case"string":e[t]=ht(r);break;case"array":e[t]=Ic(r);break;case"json":e[t]=LT(r);break;case"boolean":e[t]=$T(r)}else"true"!==r?"false"!==r?"null"!==r?!1===String(r).startsWith("0")&&!1===isNaN(r)&&r.length>0&&r<=Number.MAX_SAFE_INTEGER?e[t]=Number(r):String(r).includes(",")?e[t]=Ic(r):(e[t]=LT(r),n&&(e[t]=r)):e[t]=null:e[t]=!1:e[t]=!0}return e}(PT);var NT=PT;function $T(e){return"true"===e||!0===e||"1"===e||1===e}function MT(e){const t=e.split(":").slice(0,-1)[0]??!1;const r=function(e,t){return e.split(`${t}:`)[1]}(e,t)??!1;switch(t){case"number":return X(r);case"array":return Ic(r).map((e=>DT(e)?MT(e):e));case"regex":return new RegExp(r);case"string":return r;case"json":return LT(r)}}function DT(e){return IT.some((t=>e.includes(`${t}:`)))}function LT(e){try{return t=e,String(t).includes("__proto__")?JSON.parse(t,Rc):JSON.parse(t)}catch{return e}var t}var BT=1e3,KT=60*BT,FT=60*KT,UT=24*FT,WT=7*UT,JT=365.25*UT;function HT(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}var GT=(e,t,r=500)=>class extends Error{name="DirectusError";extensions;code=e.toUpperCase();status=r;constructor(e,r){super("string"==typeof t?t:t(e),r),this.extensions=e}toString(){return`${this.name} [${this.code}]: ${this.message}`}};const zT=GT("INVALID_JWKS_ISSUER_ERROR","No JWKS_URL or JWKS_KEYS and could not discover JWKS_URL from openid metadata",500),VT=GT("INVALID_JWKS_ISSUER_ERROR","Could not retrieve any valid keys from JWKS_URL",500),qT=GT("INVALID_JWKS_ISSUER_ERROR","No signing keys in response from provider");async function XT(e){if(void 0!==e.jwks_keys&&null==e.issuer_url&&null==e.jwks_url){const t=JSON.parse(e.jwks_keys),r=new $_({getKeysInterceptor:()=>t,jwksUri:""});e.JWKSClient=r}if(e.issuer_url&&!e.jwks_url){const t=await AS.discover(e.issuer_url);null!=t.metadata.jwks_uri&&(e.jwks_url=t.metadata.jwks_uri)}if(null==e.jwks_url)throw new zT;const t=await async function(e){const t=new $_({jwksUri:e,cache:!0,cacheMaxAge:36e6,cacheMaxEntries:10,timeout:3e4});try{if(0==(await t.getSigningKeys()).length)throw new qT}catch(e){throw new VT}return t}(e.jwks_url);return e.JWKSClient=t,e}var YT={},ZT={exports:{}};
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
!function(e,t){var r=i,n=r.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=o),o.prototype=Object.create(n.prototype),s(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(ZT,ZT.exports);var QT=ZT.exports,eR=QT.Buffer,tR=m;function rR(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=eR.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=eR.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}t.inherits(rR,tR),rR.prototype.write=function(e){this.buffer=eR.concat([this.buffer,eR.from(e)]),this.emit("data",e)},rR.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1};var nR=rR,iR=i.Buffer,sR=i.SlowBuffer,oR=aR;function aR(e,t){if(!iR.isBuffer(e)||!iR.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}aR.install=function(){iR.prototype.equal=sR.prototype.equal=function(e){return aR(this,e)}};var cR=iR.prototype.equal,lR=sR.prototype.equal;function uR(e){return(e/8|0)+(e%8==0?0:1)}aR.restore=function(){iR.prototype.equal=cR,sR.prototype.equal=lR};var dR={ES256:uR(256),ES384:uR(384),ES512:uR(521)};var fR=function(e){var t=dR[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')},pR=QT.Buffer,hR=fR,mR=128;function yR(e){if(pR.isBuffer(e))return e;if("string"==typeof e)return pR.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function gR(e,t,r){for(var n=0;t+n<r&&0===e[t+n];)++n;return e[t+n]>=mR&&--n,n}var _R={derToJose:function(e,t){e=yR(e);var r=hR(t),n=r+1,i=e.length,s=0;if(48!==e[s++])throw new Error('Could not find expected "seq"');var o=e[s++];if(o===(1|mR)&&(o=e[s++]),i-s<o)throw new Error('"seq" specified length of "'+o+'", only "'+(i-s)+'" remaining');if(2!==e[s++])throw new Error('Could not find expected "int" for "r"');var a=e[s++];if(i-s-2<a)throw new Error('"r" specified length of "'+a+'", only "'+(i-s-2)+'" available');if(n<a)throw new Error('"r" specified length of "'+a+'", max of "'+n+'" is acceptable');var c=s;if(s+=a,2!==e[s++])throw new Error('Could not find expected "int" for "s"');var l=e[s++];if(i-s!==l)throw new Error('"s" specified length of "'+l+'", expected "'+(i-s)+'"');if(n<l)throw new Error('"s" specified length of "'+l+'", max of "'+n+'" is acceptable');var u=s;if((s+=l)!==i)throw new Error('Expected to consume entire buffer, but "'+(i-s)+'" bytes remain');var d=r-a,f=r-l,p=pR.allocUnsafe(d+a+f+l);for(s=0;s<d;++s)p[s]=0;e.copy(p,s,c+Math.max(-d,0),c+a);for(var h=s=r;s<h+f;++s)p[s]=0;return e.copy(p,s,u+Math.max(-f,0),u+l),p=(p=p.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=yR(e);var r=hR(t),n=e.length;if(n!==2*r)throw new TypeError('"'+t+'" signatures must be "'+2*r+'" bytes, saw "'+n+'"');var i=gR(e,0,r),s=gR(e,r,e.length),o=r-i,a=r-s,c=2+o+1+1+a,l=c<mR,u=pR.allocUnsafe((l?2:3)+c),d=0;return u[d++]=48,l?u[d++]=c:(u[d++]=1|mR,u[d++]=255&c),u[d++]=2,u[d++]=o,i<0?(u[d++]=0,d+=e.copy(u,d,0,r)):d+=e.copy(u,d,i,r),u[d++]=2,u[d++]=a,s<0?(u[d++]=0,e.copy(u,d,r)):e.copy(u,d,r+s),u}},vR=oR,bR=QT.Buffer,wR=s,SR=_R,ER=t,kR="secret must be a string or buffer",AR="key must be a string or a buffer",OR="key must be a string, a buffer or an object",CR="function"==typeof wR.createPublicKey;function TR(e){if(!bR.isBuffer(e)&&"string"!=typeof e){if(!CR)throw jR(AR);if("object"!=typeof e)throw jR(AR);if("string"!=typeof e.type)throw jR(AR);if("string"!=typeof e.asymmetricKeyType)throw jR(AR);if("function"!=typeof e.export)throw jR(AR)}}function RR(e){if(!bR.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw jR(OR)}function IR(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function xR(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function jR(e){var t=[].slice.call(arguments,1),r=ER.format.bind(ER,e).apply(null,t);return new TypeError(r)}function PR(e){var t;return t=e,bR.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function NR(e){return function(t,r){!function(e){if(!bR.isBuffer(e)){if("string"==typeof e)return e;if(!CR)throw jR(kR);if("object"!=typeof e)throw jR(kR);if("secret"!==e.type)throw jR(kR);if("function"!=typeof e.export)throw jR(kR)}}(r),t=PR(t);var n=wR.createHmac("sha"+e,r);return IR((n.update(t),n.digest("base64")))}}function $R(e){return function(t,r,n){var i=NR(e)(t,n);return vR(bR.from(r),bR.from(i))}}function MR(e){return function(t,r){RR(r),t=PR(t);var n=wR.createSign("RSA-SHA"+e);return IR((n.update(t),n.sign(r,"base64")))}}function DR(e){return function(t,r,n){TR(n),t=PR(t),r=xR(r);var i=wR.createVerify("RSA-SHA"+e);return i.update(t),i.verify(n,r,"base64")}}function LR(e){return function(t,r){RR(r),t=PR(t);var n=wR.createSign("RSA-SHA"+e);return IR((n.update(t),n.sign({key:r,padding:wR.constants.RSA_PKCS1_PSS_PADDING,saltLength:wR.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function BR(e){return function(t,r,n){TR(n),t=PR(t),r=xR(r);var i=wR.createVerify("RSA-SHA"+e);return i.update(t),i.verify({key:n,padding:wR.constants.RSA_PKCS1_PSS_PADDING,saltLength:wR.constants.RSA_PSS_SALTLEN_DIGEST},r,"base64")}}function KR(e){var t=MR(e);return function(){var r=t.apply(null,arguments);return r=SR.derToJose(r,"ES"+e)}}function FR(e){var t=DR(e);return function(r,n,i){return n=SR.joseToDer(n,"ES"+e).toString("base64"),t(r,n,i)}}function UR(){return function(){return""}}function WR(){return function(e,t){return""===t}}CR&&(AR+=" or a KeyObject",kR+="or a KeyObject");var JR=function(e){var t={hs:NR,rs:MR,ps:LR,es:KR,none:UR},r={hs:$R,rs:DR,ps:BR,es:FR,none:WR},n=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);if(!n)throw jR('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',e);var i=(n[1]||n[3]).toLowerCase(),s=n[2];return{sign:t[i](s),verify:r[i](s)}},HR=i.Buffer,GR=function(e){return"string"==typeof e?e:"number"==typeof e||HR.isBuffer(e)?e.toString():JSON.stringify(e)},zR=QT.Buffer,VR=nR,qR=JR,XR=m,YR=GR,ZR=t;function QR(e,t){return zR.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function eI(e){var t=e.header,r=e.payload,n=e.secret||e.privateKey,i=e.encoding,s=qR(t.alg),o=function(e,t,r){r=r||"utf8";var n=QR(YR(e),"binary"),i=QR(YR(t),r);return ZR.format("%s.%s",n,i)}(t,r,i),a=s.sign(o,n);return ZR.format("%s.%s",o,a)}function tI(e){var t=e.secret||e.privateKey||e.key,r=new VR(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new VR(e.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}ZR.inherits(tI,XR),tI.prototype.sign=function(){try{var e=eI({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},tI.sign=eI;var rI=tI,nI=QT.Buffer,iI=nR,sI=JR,oI=m,aI=GR,cI=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function lI(e){if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(e))return e;try{return JSON.parse(e)}catch(e){return}}function uI(e){var t=e.split(".",1)[0];return lI(nI.from(t,"base64").toString("binary"))}function dI(e){return e.split(".")[2]}function fI(e){return cI.test(e)&&!!uI(e)}function pI(e,t,r){if(!t){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}var i=dI(e=aI(e)),s=function(e){return e.split(".",2).join(".")}(e);return sI(t).verify(s,i,r)}function hI(e,t){if(t=t||{},!fI(e=aI(e)))return null;var r=uI(e);if(!r)return null;var n=function(e,t){t=t||"utf8";var r=e.split(".")[1];return nI.from(r,"base64").toString(t)}(e);return("JWT"===r.typ||t.json)&&(n=JSON.parse(n,t.encoding)),{header:r,payload:n,signature:dI(e)}}function mI(e){var t=(e=e||{}).secret||e.publicKey||e.key,r=new iI(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new iI(e.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}t.inherits(mI,oI),mI.prototype.verify=function(){try{var e=pI(this.signature.buffer,this.algorithm,this.key.buffer),t=hI(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},mI.decode=hI,mI.isValid=fI,mI.verify=pI;var yI=rI,gI=mI;YT.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],YT.sign=yI.sign,YT.verify=gI.verify,YT.decode=gI.decode,YT.isValid=gI.isValid,YT.createSign=function(e){return new yI(e)},YT.createVerify=function(e){return new gI(e)};var _I=YT,vI=function(e,t){t=t||{};var r=_I.decode(e,t);if(!r)return null;var n=r.payload;if("string"==typeof n)try{var i=JSON.parse(n);null!==i&&"object"==typeof i&&(n=i)}catch(e){}return!0===t.complete?{header:r.header,payload:n,signature:r.signature}:n},bI=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};(bI.prototype=Object.create(Error.prototype)).constructor=bI;var wI=bI,SI=wI,EI=function(e,t){SI.call(this,e),this.name="NotBeforeError",this.date=t};(EI.prototype=Object.create(SI.prototype)).constructor=EI;var kI=EI,AI=wI,OI=function(e,t){AI.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};(OI.prototype=Object.create(AI.prototype)).constructor=OI;var CI=OI,TI=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if(e=String(e),e.length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*JT;case"weeks":case"week":case"w":return r*WT;case"days":case"day":case"d":return r*UT;case"hours":case"hour":case"hrs":case"hr":case"h":return r*FT;case"minutes":case"minute":case"mins":case"min":case"m":return r*KT;case"seconds":case"second":case"secs":case"sec":case"s":return r*BT;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=UT)return HT(e,t,UT,"day");if(t>=FT)return HT(e,t,FT,"hour");if(t>=KT)return HT(e,t,KT,"minute");if(t>=BT)return HT(e,t,BT,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=UT)return Math.round(e/UT)+"d";if(t>=FT)return Math.round(e/FT)+"h";if(t>=KT)return Math.round(e/KT)+"m";if(t>=BT)return Math.round(e/BT)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))},RI=function(e,t){var r=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var n=TI(e);if(void 0===n)return;return Math.floor(r+n/1e3)}return"number"==typeof e?r+e:void 0},II={exports:{}};var xI={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};var jI="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=xI,s=jI,o=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],l=t.t={};let u=0;const d="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",i],[d,n]],p=(e,t,r)=>{const n=(e=>{for(const[t,r]of f)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=u++;s(e,i,t),l[e]=i,c[i]=t,o[i]=new RegExp(t,r?"g":void 0),a[i]=new RegExp(n,r?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),p("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${c[l.NUMERICIDENTIFIER]}|${c[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NUMERICIDENTIFIERLOOSE]}|${c[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${d}+`),p("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),p("FULL",`^${c[l.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),p("LOOSE",`^${c[l.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),p("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),p("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?`+`(?:${c[l.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",c[l.COERCE],!0),p("COERCERTLFULL",c[l.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(II,II.exports);var PI=II.exports;const NI=Object.freeze({loose:!0}),$I=Object.freeze({});var MI=e=>e?"object"!=typeof e?NI:e:$I;const DI=/^[0-9]+$/,LI=(e,t)=>{const r=DI.test(e),n=DI.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1};var BI={compareIdentifiers:LI,rcompareIdentifiers:(e,t)=>LI(t,e)};const KI=jI,{MAX_LENGTH:FI,MAX_SAFE_INTEGER:UI}=xI,{safeRe:WI,t:JI}=PI,HI=MI,{compareIdentifiers:GI}=BI;var zI=class e{constructor(t,r){if(r=HI(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>FI)throw new TypeError(`version is longer than ${FI} characters`);KI("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?WI[JI.LOOSE]:WI[JI.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>UI||this.major<0)throw new TypeError("Invalid major version");if(this.minor>UI||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>UI||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<UI)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(KI("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),GI(this.major,t.major)||GI(this.minor,t.minor)||GI(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const e=this.prerelease[r],n=t.prerelease[r];if(KI("prerelease compare",r,e,n),void 0===e&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===e)return-1;if(e!==n)return GI(e,n)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{const e=this.build[r],n=t.build[r];if(KI("build compare",r,e,n),void 0===e&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===e)return-1;if(e!==n)return GI(e,n)}while(++r)}inc(e,t,r){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===GI(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const VI=zI;var qI=(e,t,r=!1)=>{if(e instanceof VI)return e;try{return new VI(e,t)}catch(e){if(!r)return null;throw e}};const XI=qI;var YI=(e,t)=>{const r=XI(e,t);return r?r.version:null};const ZI=qI;var QI=(e,t)=>{const r=ZI(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const ex=zI;var tx=(e,t,r,n,i)=>{"string"==typeof r&&(i=n,n=r,r=void 0);try{return new ex(e instanceof ex?e.version:e,r).inc(t,n,i).version}catch(e){return null}};const rx=qI;var nx=(e,t)=>{const r=rx(e,null,!0),n=rx(t,null,!0),i=r.compare(n);if(0===i)return null;const s=i>0,o=s?r:n,a=s?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c)return a.patch||a.minor?o.patch?"patch":o.minor?"minor":"major":"major";const l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};const ix=zI;var sx=(e,t)=>new ix(e,t).major;const ox=zI;var ax=(e,t)=>new ox(e,t).minor;const cx=zI;var lx=(e,t)=>new cx(e,t).patch;const ux=qI;var dx=(e,t)=>{const r=ux(e,t);return r&&r.prerelease.length?r.prerelease:null};const fx=zI;var px=(e,t,r)=>new fx(e,r).compare(new fx(t,r));const hx=px;var mx=(e,t,r)=>hx(t,e,r);const yx=px;var gx=(e,t)=>yx(e,t,!0);const _x=zI;var vx=(e,t,r)=>{const n=new _x(e,r),i=new _x(t,r);return n.compare(i)||n.compareBuild(i)};const bx=vx;var wx=(e,t)=>e.sort(((e,r)=>bx(e,r,t)));const Sx=vx;var Ex=(e,t)=>e.sort(((e,r)=>Sx(r,e,t)));const kx=px;var Ax=(e,t,r)=>kx(e,t,r)>0;const Ox=px;var Cx=(e,t,r)=>Ox(e,t,r)<0;const Tx=px;var Rx=(e,t,r)=>0===Tx(e,t,r);const Ix=px;var xx=(e,t,r)=>0!==Ix(e,t,r);const jx=px;var Px=(e,t,r)=>jx(e,t,r)>=0;const Nx=px;var $x=(e,t,r)=>Nx(e,t,r)<=0;const Mx=Rx,Dx=xx,Lx=Ax,Bx=Px,Kx=Cx,Fx=$x;var Ux=(e,t,r,n)=>{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 Mx(e,r,n);case"!=":return Dx(e,r,n);case">":return Lx(e,r,n);case">=":return Bx(e,r,n);case"<":return Kx(e,r,n);case"<=":return Fx(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};const Wx=zI,Jx=qI,{safeRe:Hx,t:Gx}=PI;var zx=(e,t)=>{if(e instanceof Wx)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const n=t.includePrerelease?Hx[Gx.COERCERTLFULL]:Hx[Gx.COERCERTL];let i;for(;(i=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&i.index+i[0].length===r.index+r[0].length||(r=i),n.lastIndex=i.index+i[1].length+i[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?Hx[Gx.COERCEFULL]:Hx[Gx.COERCE]);if(null===r)return null;const n=r[2],i=r[3]||"0",s=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Jx(`${n}.${i}.${s}${o}${a}`,t)};var Vx,qx,Xx,Yx,Zx=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}};function Qx(){if(qx)return Vx;qx=1;class e{constructor(t,i){if(i=r(i),t instanceof e)return t.loose===!!i.loose&&t.includePrerelease===!!i.includePrerelease?t:new e(t.raw,i);if(t instanceof n)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&h(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const r=((this.options.includePrerelease&&d)|(this.options.loose&&f))+":"+e,s=t.get(r);if(s)return s;const h=this.options.loose,m=h?o[a.HYPHENRANGELOOSE]:o[a.HYPHENRANGE];e=e.replace(m,O(this.options.includePrerelease)),i("hyphen replace",e),e=e.replace(o[a.COMPARATORTRIM],c),i("comparator trim",e),e=e.replace(o[a.TILDETRIM],l),i("tilde trim",e),e=e.replace(o[a.CARETTRIM],u),i("caret trim",e);let g=e.split(" ").map((e=>y(e,this.options))).join(" ").split(/\s+/).map((e=>A(e,this.options)));h&&(g=g.filter((e=>(i("loose invalid filter",e,this.options),!!e.match(o[a.COMPARATORLOOSE]))))),i("range list",g);const _=new Map,v=g.map((e=>new n(e,this.options)));for(const e of v){if(p(e))return[e];_.set(e.value,e)}_.size>1&&_.has("")&&_.delete("");const b=[..._.values()];return t.set(r,b),b}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some((e=>m(e,r)&&t.set.some((t=>m(t,r)&&e.every((e=>t.every((t=>e.intersects(t,r)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new s(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(C(this.set[t],e,this.options))return!0;return!1}}Vx=e;const t=new Zx,r=MI,n=ej(),i=jI,s=zI,{safeRe:o,t:a,comparatorTrimReplace:c,tildeTrimReplace:l,caretTrimReplace:u}=PI,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:f}=xI,p=e=>"<0.0.0-0"===e.value,h=e=>""===e.value,m=(e,t)=>{let r=!0;const n=e.slice();let i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},y=(e,t)=>(i("comp",e,t),e=b(e,t),i("caret",e),e=_(e,t),i("tildes",e),e=S(e,t),i("xrange",e),e=k(e,t),i("stars",e),e),g=e=>!e||"x"===e.toLowerCase()||"*"===e,_=(e,t)=>e.trim().split(/\s+/).map((e=>v(e,t))).join(" "),v=(e,t)=>{const r=t.loose?o[a.TILDELOOSE]:o[a.TILDE];return e.replace(r,((t,r,n,s,o)=>{let a;return i("tilde",e,t,r,n,s,o),g(r)?a="":g(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:g(s)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:o?(i("replaceTilde pr",o),a=`>=${r}.${n}.${s}-${o} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${s} <${r}.${+n+1}.0-0`,i("tilde return",a),a}))},b=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{i("caret",e,t);const r=t.loose?o[a.CARETLOOSE]:o[a.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,s,o,a)=>{let c;return i("caret",e,t,r,s,o,a),g(r)?c="":g(s)?c=`>=${r}.0.0${n} <${+r+1}.0.0-0`:g(o)?c="0"===r?`>=${r}.${s}.0${n} <${r}.${+s+1}.0-0`:`>=${r}.${s}.0${n} <${+r+1}.0.0-0`:a?(i("replaceCaret pr",a),c="0"===r?"0"===s?`>=${r}.${s}.${o}-${a} <${r}.${s}.${+o+1}-0`:`>=${r}.${s}.${o}-${a} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${o}-${a} <${+r+1}.0.0-0`):(i("no pr"),c="0"===r?"0"===s?`>=${r}.${s}.${o}${n} <${r}.${s}.${+o+1}-0`:`>=${r}.${s}.${o}${n} <${r}.${+s+1}.0-0`:`>=${r}.${s}.${o} <${+r+1}.0.0-0`),i("caret return",c),c}))},S=(e,t)=>(i("replaceXRanges",e,t),e.split(/\s+/).map((e=>E(e,t))).join(" ")),E=(e,t)=>{e=e.trim();const r=t.loose?o[a.XRANGELOOSE]:o[a.XRANGE];return e.replace(r,((r,n,s,o,a,c)=>{i("xRange",e,r,n,s,o,a,c);const l=g(s),u=l||g(o),d=u||g(a),f=d;return"="===n&&f&&(n=""),c=t.includePrerelease?"-0":"",l?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&f?(u&&(o=0),a=0,">"===n?(n=">=",u?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):"<="===n&&(n="<",u?s=+s+1:o=+o+1),"<"===n&&(c="-0"),r=`${n+s}.${o}.${a}${c}`):u?r=`>=${s}.0.0${c} <${+s+1}.0.0-0`:d&&(r=`>=${s}.${o}.0${c} <${s}.${+o+1}.0-0`),i("xRange return",r),r}))},k=(e,t)=>(i("replaceStars",e,t),e.trim().replace(o[a.STAR],"")),A=(e,t)=>(i("replaceGTE0",e,t),e.trim().replace(o[t.includePrerelease?a.GTE0PRE:a.GTE0],"")),O=e=>(t,r,n,i,s,o,a,c,l,u,d,f)=>`${r=g(n)?"":g(i)?`>=${n}.0.0${e?"-0":""}`:g(s)?`>=${n}.${i}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=g(l)?"":g(u)?`<${+l+1}.0.0-0`:g(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`}`.trim(),C=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(i(e[r].semver),e[r].semver!==n.ANY&&e[r].semver.prerelease.length>0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0};return Vx}function ej(){if(Yx)return Xx;Yx=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(n,i){if(i=r(i),n instanceof t){if(n.loose===!!i.loose)return n;n=n.value}n=n.trim().split(/\s+/).join(" "),o("comparator",n,i),this.options=i,this.loose=!!i.loose,this.parse(n),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(t){const r=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],s=t.match(r);if(!s)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==s[1]?s[1]:"","="===this.operator&&(this.operator=""),s[2]?this.semver=new a(s[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(o("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new a(t,this.options)}catch(e){return!1}return s(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new c(e.value,n).test(this.value):""===e.operator?""===e.value||new c(this.value,n).test(e.semver):(!(n=r(n)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(s(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(s(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}Xx=t;const r=MI,{safeRe:n,t:i}=PI,s=Ux,o=jI,a=zI,c=Qx();return Xx}const tj=Qx();var rj=(e,t,r)=>{try{t=new tj(t,r)}catch(e){return!1}return t.test(e)};const nj=Qx();var ij=(e,t)=>new nj(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const sj=zI,oj=Qx();var aj=(e,t,r)=>{let n=null,i=null,s=null;try{s=new oj(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(n&&-1!==i.compare(e)||(n=e,i=new sj(n,r)))})),n};const cj=zI,lj=Qx();var uj=(e,t,r)=>{let n=null,i=null,s=null;try{s=new lj(t,r)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(n&&1!==i.compare(e)||(n=e,i=new cj(n,r)))})),n};const dj=zI,fj=Qx(),pj=Ax;var hj=(e,t)=>{e=new fj(e,t);let r=new dj("0.0.0");if(e.test(r))return r;if(r=new dj("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const n=e.set[t];let i=null;n.forEach((e=>{const t=new dj(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":i&&!pj(t,i)||(i=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!i||r&&!pj(r,i)||(r=i)}return r&&e.test(r)?r:null};const mj=Qx();var yj=(e,t)=>{try{return new mj(e,t).range||"*"}catch(e){return null}};const gj=zI,_j=ej(),{ANY:vj}=_j,bj=Qx(),wj=rj,Sj=Ax,Ej=Cx,kj=$x,Aj=Px;var Oj=(e,t,r,n)=>{let i,s,o,a,c;switch(e=new gj(e,n),t=new bj(t,n),r){case">":i=Sj,s=kj,o=Ej,a=">",c=">=";break;case"<":i=Ej,s=Aj,o=Sj,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(wj(e,t,n))return!1;for(let r=0;r<t.set.length;++r){const l=t.set[r];let u=null,d=null;if(l.forEach((e=>{e.semver===vj&&(e=new _j(">=0.0.0")),u=u||e,d=d||e,i(e.semver,u.semver,n)?u=e:o(e.semver,d.semver,n)&&(d=e)})),u.operator===a||u.operator===c)return!1;if((!d.operator||d.operator===a)&&s(e,d.semver))return!1;if(d.operator===c&&o(e,d.semver))return!1}return!0};const Cj=Oj;var Tj=(e,t,r)=>Cj(e,t,">",r);const Rj=Oj;var Ij=(e,t,r)=>Rj(e,t,"<",r);const xj=Qx();var jj=(e,t,r)=>(e=new xj(e,r),t=new xj(t,r),e.intersects(t,r));const Pj=rj,Nj=px;const $j=Qx(),Mj=ej(),{ANY:Dj}=Mj,Lj=rj,Bj=px,Kj=[new Mj(">=0.0.0-0")],Fj=[new Mj(">=0.0.0")],Uj=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===Dj){if(1===t.length&&t[0].semver===Dj)return!0;e=r.includePrerelease?Kj:Fj}if(1===t.length&&t[0].semver===Dj){if(r.includePrerelease)return!0;t=Fj}const n=new Set;let i,s,o,a,c,l,u;for(const t of e)">"===t.operator||">="===t.operator?i=Wj(i,t,r):"<"===t.operator||"<="===t.operator?s=Jj(s,t,r):n.add(t.semver);if(n.size>1)return null;if(i&&s){if(o=Bj(i.semver,s.semver,r),o>0)return null;if(0===o&&(">="!==i.operator||"<="!==s.operator))return null}for(const e of n){if(i&&!Lj(e,String(i),r))return null;if(s&&!Lj(e,String(s),r))return null;for(const n of t)if(!Lj(e,String(n),r))return!1;return!0}let d=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver,f=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver;d&&1===d.prerelease.length&&"<"===s.operator&&0===d.prerelease[0]&&(d=!1);for(const e of t){if(u=u||">"===e.operator||">="===e.operator,l=l||"<"===e.operator||"<="===e.operator,i)if(f&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===f.major&&e.semver.minor===f.minor&&e.semver.patch===f.patch&&(f=!1),">"===e.operator||">="===e.operator){if(a=Wj(i,e,r),a===e&&a!==i)return!1}else if(">="===i.operator&&!Lj(i.semver,String(e),r))return!1;if(s)if(d&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===d.major&&e.semver.minor===d.minor&&e.semver.patch===d.patch&&(d=!1),"<"===e.operator||"<="===e.operator){if(c=Jj(s,e,r),c===e&&c!==s)return!1}else if("<="===s.operator&&!Lj(s.semver,String(e),r))return!1;if(!e.operator&&(s||i)&&0!==o)return!1}return!(i&&l&&!s&&0!==o)&&(!(s&&u&&!i&&0!==o)&&(!f&&!d))},Wj=(e,t,r)=>{if(!e)return t;const n=Bj(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},Jj=(e,t,r)=>{if(!e)return t;const n=Bj(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};var Hj=(e,t,r={})=>{if(e===t)return!0;e=new $j(e,r),t=new $j(t,r);let n=!1;e:for(const i of e.set){for(const e of t.set){const t=Uj(i,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0};const Gj=PI,zj=xI,Vj=zI,qj=BI,Xj=(e,t,r)=>{const n=[];let i=null,s=null;const o=e.sort(((e,t)=>Nj(e,t,r)));for(const e of o){Pj(e,t,r)?(s=e,i||(i=e)):(s&&n.push([i,s]),s=null,i=null)}i&&n.push([i,null]);const a=[];for(const[e,t]of n)e===t?a.push(e):t||e!==o[0]?t?e===o[0]?a.push(`<=${t}`):a.push(`${e} - ${t}`):a.push(`>=${e}`):a.push("*");const c=a.join(" || "),l="string"==typeof t.raw?t.raw:String(t);return c.length<l.length?c:t};var Yj={parse:qI,valid:YI,clean:QI,inc:tx,diff:nx,major:sx,minor:ax,patch:lx,prerelease:dx,compare:px,rcompare:mx,compareLoose:gx,compareBuild:vx,sort:wx,rsort:Ex,gt:Ax,lt:Cx,eq:Rx,neq:xx,gte:Px,lte:$x,cmp:Ux,coerce:zx,Comparator:ej(),Range:Qx(),satisfies:rj,toComparators:ij,maxSatisfying:aj,minSatisfying:uj,minVersion:hj,validRange:yj,outside:Oj,gtr:Tj,ltr:Ij,intersects:jj,simplifyRange:Xj,subset:Hj,SemVer:Vj,re:Gj.re,src:Gj.src,tokens:Gj.t,SEMVER_SPEC_VERSION:zj.SEMVER_SPEC_VERSION,RELEASE_TYPES:zj.RELEASE_TYPES,compareIdentifiers:qj.compareIdentifiers,rcompareIdentifiers:qj.rcompareIdentifiers};var Zj=Yj.satisfies(process.version,">=15.7.0");var Qj=Yj.satisfies(process.version,">=16.9.0");const eP=Zj,tP=Qj,rP={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},nP={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};var iP=function(e,t){if(!e||!t)return;const r=t.asymmetricKeyType;if(!r)return;const n=rP[r];if(!n)throw new Error(`Unknown key type "${r}".`);if(!n.includes(e))throw new Error(`"alg" parameter for "${r}" key type must be one of: ${n.join(", ")}.`);if(eP)switch(r){case"ec":const r=t.asymmetricKeyDetails.namedCurve,n=nP[e];if(r!==n)throw new Error(`"alg" parameter "${e}" requires curve "${n}".`);break;case"rsa-pss":if(tP){const r=parseInt(e.slice(-3),10),{hashAlgorithm:n,mgf1HashAlgorithm:i,saltLength:s}=t.asymmetricKeyDetails;if(n!==`sha${r}`||i!==n)throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(void 0!==s&&s>r>>3)throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}}},sP=Yj.satisfies(process.version,"^6.12.0 || >=8.0.0");const oP=wI,aP=kI,cP=CI,lP=vI,uP=RI,dP=iP,fP=sP,pP=YT,{KeyObject:hP,createSecretKey:mP,createPublicKey:yP}=s,gP=["RS256","RS384","RS512"],_P=["ES256","ES384","ES512"],vP=["RS256","RS384","RS512"],bP=["HS256","HS384","HS512"];fP&&(gP.splice(gP.length,0,"PS256","PS384","PS512"),vP.splice(vP.length,0,"PS256","PS384","PS512"));var wP=1/0,SP=9007199254740991,EP=17976931348623157e292,kP=NaN,AP="[object Arguments]",OP="[object Function]",CP="[object GeneratorFunction]",TP="[object String]",RP="[object Symbol]",IP=/^\s+|\s+$/g,xP=/^[-+]0x[0-9a-f]+$/i,jP=/^0b[01]+$/i,PP=/^0o[0-7]+$/i,NP=/^(?:0|[1-9]\d*)$/,$P=parseInt;function MP(e){return e!=e}function DP(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}var LP,BP,KP=Object.prototype,FP=KP.hasOwnProperty,UP=KP.toString,WP=KP.propertyIsEnumerable,JP=(LP=Object.keys,BP=Object,function(e){return LP(BP(e))}),HP=Math.max;function GP(e,t){var r=qP(e)||function(e){return function(e){return ZP(e)&&XP(e)}(e)&&FP.call(e,"callee")&&(!WP.call(e,"callee")||UP.call(e)==AP)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var s in e)!t&&!FP.call(e,s)||i&&("length"==s||VP(s,n))||r.push(s);return r}function zP(e){if(r=(t=e)&&t.constructor,n="function"==typeof r&&r.prototype||KP,t!==n)return JP(e);var t,r,n,i=[];for(var s in Object(e))FP.call(e,s)&&"constructor"!=s&&i.push(s);return i}function VP(e,t){return!!(t=null==t?SP:t)&&("number"==typeof e||NP.test(e))&&e>-1&&e%1==0&&e<t}var qP=Array.isArray;function XP(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=SP}(e.length)&&!function(e){var t=YP(e)?UP.call(e):"";return t==OP||t==CP}(e)}function YP(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ZP(e){return!!e&&"object"==typeof e}var QP=function(e,t,r,n){e=XP(e)?e:function(e){return e?DP(e,function(e){return XP(e)?GP(e):zP(e)}(e)):[]}(e),r=r&&!n?function(e){var t=function(e){if(!e)return 0===e?e:0;if(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||ZP(e)&&UP.call(e)==RP}(e))return kP;if(YP(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=YP(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(IP,"");var r=jP.test(e);return r||PP.test(e)?$P(e.slice(2),r?2:8):xP.test(e)?kP:+e}(e),e===wP||e===-wP){return(e<0?-1:1)*EP}return e==e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(r):0;var i=e.length;return r<0&&(r=HP(i+r,0)),function(e){return"string"==typeof e||!qP(e)&&ZP(e)&&UP.call(e)==TP}(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&function(e,t,r){if(t!=t)return function(e,t,r,n){for(var i=e.length,s=r+(n?1:-1);n?s--:++s<i;)if(t(e[s],s,e))return s;return-1}(e,MP,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r)>-1},eN=Object.prototype.toString;var tN=function(e){return!0===e||!1===e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Boolean]"==eN.call(e)},rN=1/0,nN=17976931348623157e292,iN=NaN,sN="[object Symbol]",oN=/^\s+|\s+$/g,aN=/^[-+]0x[0-9a-f]+$/i,cN=/^0b[01]+$/i,lN=/^0o[0-7]+$/i,uN=parseInt,dN=Object.prototype.toString;function fN(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var pN=function(e){return"number"==typeof e&&e==function(e){var t=function(e){if(!e)return 0===e?e:0;if(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&dN.call(e)==sN}(e))return iN;if(fN(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=fN(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(oN,"");var r=cN.test(e);return r||lN.test(e)?uN(e.slice(2),r?2:8):aN.test(e)?iN:+e}(e),e===rN||e===-rN){return(e<0?-1:1)*nN}return e==e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(e)},hN=Object.prototype.toString;var mN=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Number]"==hN.call(e)};var yN=Function.prototype,gN=Object.prototype,_N=yN.toString,vN=gN.hasOwnProperty,bN=_N.call(Object),wN=gN.toString,SN=function(e,t){return function(r){return e(t(r))}}(Object.getPrototypeOf,Object);var EN=function(e){if(!function(e){return!!e&&"object"==typeof e}(e)||"[object Object]"!=wN.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=SN(e);if(null===t)return!0;var r=vN.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&_N.call(r)==bN},kN=Object.prototype.toString,AN=Array.isArray;var ON=function(e){return"string"==typeof e||!AN(e)&&function(e){return!!e&&"object"==typeof e}(e)&&"[object String]"==kN.call(e)},CN="Expected a function",TN=1/0,RN=17976931348623157e292,IN=NaN,xN="[object Symbol]",jN=/^\s+|\s+$/g,PN=/^[-+]0x[0-9a-f]+$/i,NN=/^0b[01]+$/i,$N=/^0o[0-7]+$/i,MN=parseInt,DN=Object.prototype.toString;function LN(e,t){var r;if("function"!=typeof t)throw new TypeError(CN);return e=function(e){var t=function(e){if(!e)return 0===e?e:0;if(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&DN.call(e)==xN}(e))return IN;if(BN(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=BN(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(jN,"");var r=NN.test(e);return r||$N.test(e)?MN(e.slice(2),r?2:8):PN.test(e)?IN:+e}(e),e===TN||e===-TN){return(e<0?-1:1)*RN}return e==e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}}function BN(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var KN=function(e){return LN(2,e)};const FN=RI,UN=sP,WN=iP,JN=YT,HN=QP,GN=tN,zN=pN,VN=mN,qN=EN,XN=ON,YN=KN,{KeyObject:ZN,createSecretKey:QN,createPrivateKey:e$}=s,t$=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];UN&&t$.splice(3,0,"PS256","PS384","PS512");const r$={expiresIn:{isValid:function(e){return zN(e)||XN(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return zN(e)||XN(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return XN(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:HN.bind(null,t$),message:'"algorithm" must be a valid string enum value'},header:{isValid:qN,message:'"header" must be an object'},encoding:{isValid:XN,message:'"encoding" must be a string'},issuer:{isValid:XN,message:'"issuer" must be a string'},subject:{isValid:XN,message:'"subject" must be a string'},jwtid:{isValid:XN,message:'"jwtid" must be a string'},noTimestamp:{isValid:GN,message:'"noTimestamp" must be a boolean'},keyid:{isValid:XN,message:'"keyid" must be a string'},mutatePayload:{isValid:GN,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:GN,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:GN,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},n$={iat:{isValid:VN,message:'"iat" should be a number of seconds'},exp:{isValid:VN,message:'"exp" should be a number of seconds'},nbf:{isValid:VN,message:'"nbf" should be a number of seconds'}};function i$(e,t,r,n){if(!qN(r))throw new Error('Expected "'+n+'" to be a plain object.');Object.keys(r).forEach((function(i){const s=e[i];if(s){if(!s.isValid(r[i]))throw new Error(s.message)}else if(!t)throw new Error('"'+i+'" is not allowed in "'+n+'"')}))}const s$={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},o$=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];var a$={decode:vI,verify:function(e,t,r,n){let i;if("function"!=typeof r||n||(n=r,r={}),r||(r={}),r=Object.assign({},r),i=n||function(e,t){if(e)throw e;return t},r.clockTimestamp&&"number"!=typeof r.clockTimestamp)return i(new oP("clockTimestamp must be a number"));if(void 0!==r.nonce&&("string"!=typeof r.nonce||""===r.nonce.trim()))return i(new oP("nonce must be a non-empty string"));if(void 0!==r.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof r.allowInvalidAsymmetricKeyTypes)return i(new oP("allowInvalidAsymmetricKeyTypes must be a boolean"));const s=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return i(new oP("jwt must be provided"));if("string"!=typeof e)return i(new oP("jwt must be a string"));const o=e.split(".");if(3!==o.length)return i(new oP("jwt malformed"));let a;try{a=lP(e,{complete:!0})}catch(e){return i(e)}if(!a)return i(new oP("invalid token"));const c=a.header;let l;if("function"==typeof t){if(!n)return i(new oP("verify must be called asynchronous if secret or public key is provided as a callback"));l=t}else l=function(e,r){return r(null,t)};return l(c,(function(t,n){if(t)return i(new oP("error in secret or public key callback: "+t.message));const l=""!==o[2].trim();if(!l&&n)return i(new oP("jwt signature is required"));if(l&&!n)return i(new oP("secret or public key must be provided"));if(!l&&!r.algorithms)return i(new oP('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=n&&!(n instanceof hP))try{n=yP(n)}catch(e){try{n=mP("string"==typeof n?Buffer.from(n):n)}catch(e){return i(new oP("secretOrPublicKey is not valid key material"))}}if(r.algorithms||("secret"===n.type?r.algorithms=bP:["rsa","rsa-pss"].includes(n.asymmetricKeyType)?r.algorithms=vP:"ec"===n.asymmetricKeyType?r.algorithms=_P:r.algorithms=gP),-1===r.algorithms.indexOf(a.header.alg))return i(new oP("invalid algorithm"));if(c.alg.startsWith("HS")&&"secret"!==n.type)return i(new oP(`secretOrPublicKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)&&"public"!==n.type)return i(new oP(`secretOrPublicKey must be an asymmetric key when using ${c.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{dP(c.alg,n)}catch(e){return i(e)}let u;try{u=pP.verify(e,a.header.alg,n)}catch(e){return i(e)}if(!u)return i(new oP("invalid signature"));const d=a.payload;if(void 0!==d.nbf&&!r.ignoreNotBefore){if("number"!=typeof d.nbf)return i(new oP("invalid nbf value"));if(d.nbf>s+(r.clockTolerance||0))return i(new aP("jwt not active",new Date(1e3*d.nbf)))}if(void 0!==d.exp&&!r.ignoreExpiration){if("number"!=typeof d.exp)return i(new oP("invalid exp value"));if(s>=d.exp+(r.clockTolerance||0))return i(new cP("jwt expired",new Date(1e3*d.exp)))}if(r.audience){const e=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(d.aud)?d.aud:[d.aud]).some((function(t){return e.some((function(e){return e instanceof RegExp?e.test(t):e===t}))})))return i(new oP("jwt audience invalid. expected: "+e.join(" or ")))}if(r.issuer){if("string"==typeof r.issuer&&d.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(d.iss))return i(new oP("jwt issuer invalid. expected: "+r.issuer))}if(r.subject&&d.sub!==r.subject)return i(new oP("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&d.jti!==r.jwtid)return i(new oP("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&d.nonce!==r.nonce)return i(new oP("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof d.iat)return i(new oP("iat required when maxAge is specified"));const e=uP(r.maxAge,d.iat);if(void 0===e)return i(new oP('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(s>=e+(r.clockTolerance||0))return i(new cP("maxAge exceeded",new Date(1e3*e)))}if(!0===r.complete){const e=a.signature;return i(null,{header:c,payload:d,signature:e})}return i(null,d)}))},sign:function(e,t,r,n){"function"==typeof r?(n=r,r={}):r=r||{};const i="object"==typeof e&&!Buffer.isBuffer(e),s=Object.assign({alg:r.algorithm||"HS256",typ:i?"JWT":void 0,kid:r.keyid},r.header);function o(e){if(n)return n(e);throw e}if(!t&&"none"!==r.algorithm)return o(new Error("secretOrPrivateKey must have a value"));if(null!=t&&!(t instanceof ZN))try{t=e$(t)}catch(e){try{t=QN("string"==typeof t?Buffer.from(t):t)}catch(e){return o(new Error("secretOrPrivateKey is not valid key material"))}}if(s.alg.startsWith("HS")&&"secret"!==t.type)return o(new Error(`secretOrPrivateKey must be a symmetric key when using ${s.alg}`));if(/^(?:RS|PS|ES)/.test(s.alg)){if("private"!==t.type)return o(new Error(`secretOrPrivateKey must be an asymmetric key when using ${s.alg}`));if(!r.allowInsecureKeySizes&&!s.alg.startsWith("ES")&&void 0!==t.asymmetricKeyDetails&&t.asymmetricKeyDetails.modulusLength<2048)return o(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${s.alg}`))}if(void 0===e)return o(new Error("payload is required"));if(i){try{!function(e){i$(n$,!0,e,"payload")}(e)}catch(e){return o(e)}r.mutatePayload||(e=Object.assign({},e))}else{const t=o$.filter((function(e){return void 0!==r[e]}));if(t.length>0)return o(new Error("invalid "+t.join(",")+" option for "+typeof e+" payload"))}if(void 0!==e.exp&&void 0!==r.expiresIn)return o(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==e.nbf&&void 0!==r.notBefore)return o(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{!function(e){i$(r$,!1,e,"options")}(r)}catch(e){return o(e)}if(!r.allowInvalidAsymmetricKeyTypes)try{WN(s.alg,t)}catch(e){return o(e)}const a=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:i&&(e.iat=a),void 0!==r.notBefore){try{e.nbf=FN(r.notBefore,a)}catch(e){return o(e)}if(void 0===e.nbf)return o(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==r.expiresIn&&"object"==typeof e){try{e.exp=FN(r.expiresIn,a)}catch(e){return o(e)}if(void 0===e.exp)return o(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(s$).forEach((function(t){const n=s$[t];if(void 0!==r[t]){if(void 0!==e[n])return o(new Error('Bad "options.'+t+'" option. The payload already has an "'+n+'" property.'));e[n]=r[t]}}));const c=r.encoding||"utf8";if("function"!=typeof n){let n=JN.sign({header:s,payload:e,secret:t,encoding:c});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(s.alg)&&n.length<256)throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${s.alg}`);return n}n=n&&YN(n),JN.createSign({header:s,privateKey:t,payload:e,encoding:c}).once("error",n).once("done",(function(e){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(s.alg)&&e.length<256)return n(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${s.alg}`));n(null,e)}))},JsonWebTokenError:wI,NotBeforeError:kI,TokenExpiredError:CI},c$=Pr(a$);var l$={stringify:function e(t){if(void 0===t)return t;if(t&&Buffer.isBuffer(t))return JSON.stringify(":base64:"+t.toString("base64"));if(t&&t.toJSON&&(t=t.toJSON()),t&&"object"==typeof t){var r="",n=Array.isArray(t);r=n?"[":"{";var i=!0;for(var s in t){var o="function"==typeof t[s]||!n&&void 0===t[s];Object.hasOwnProperty.call(t,s)&&!o&&(i||(r+=","),i=!1,n?null==t[s]?r+="null":r+=e(t[s]):void 0!==t[s]&&(r+=e(s)+":"+e(t[s])))}return r+=n?"]":"}"}return"string"==typeof t?JSON.stringify(/^:/.test(t)?":"+t:t):void 0===t?"null":JSON.stringify(t)},parse:function(e){return JSON.parse(e,(function(e,t){return"string"==typeof t?/^:base64:/.test(t)?Buffer.from(t.substring(8),"base64"):/^:/.test(t)?t.substring(1):t:t}))}};const u$=l,d$=l$,f$=e=>{const t={redis:"@keyv/redis",rediss:"@keyv/redis",mongodb:"@keyv/mongo",mongo:"@keyv/mongo",sqlite:"@keyv/sqlite",postgresql:"@keyv/postgres",postgres:"@keyv/postgres",mysql:"@keyv/mysql",etcd:"@keyv/etcd",offline:"@keyv/offline",tiered:"@keyv/tiered"};if(e.adapter||e.uri){return new(function(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}(t[e.adapter||/^[^:+]*/.exec(e.uri)[0]]))(e)}return new Map},p$=["sqlite","postgres","mysql","mongo","redis","tiered"];var h$=class extends u${constructor(e,{emitErrors:t=!0,...r}={}){if(super(),this.opts={namespace:"keyv",serialize:d$.stringify,deserialize:d$.parse,..."string"==typeof e?{uri:e}:e,...r},!this.opts.store){const e={...this.opts};this.opts.store=f$(e)}if(this.opts.compression){const e=this.opts.compression;this.opts.serialize=e.serialize.bind(e),this.opts.deserialize=e.deserialize.bind(e)}"function"==typeof this.opts.store.on&&t&&this.opts.store.on("error",(e=>this.emit("error",e))),this.opts.store.namespace=this.opts.namespace;const n=e=>async function*(){for await(const[t,r]of"function"==typeof e?e(this.opts.store.namespace):e){const e=await this.opts.deserialize(r);this.opts.store.namespace&&!t.includes(this.opts.store.namespace)||("number"==typeof e.expires&&Date.now()>e.expires?this.delete(t):yield[this._getKeyUnprefix(t),e.value])}};"function"==typeof this.opts.store[Symbol.iterator]&&this.opts.store instanceof Map?this.iterator=n(this.opts.store):"function"==typeof this.opts.store.iterator&&this.opts.store.opts&&this._checkIterableAdaptar()&&(this.iterator=n(this.opts.store.iterator.bind(this.opts.store)))}_checkIterableAdaptar(){return p$.includes(this.opts.store.opts.dialect)||p$.findIndex((e=>this.opts.store.opts.url.includes(e)))>=0}_getKeyPrefix(e){return`${this.opts.namespace}:${e}`}_getKeyPrefixArray(e){return e.map((e=>`${this.opts.namespace}:${e}`))}_getKeyUnprefix(e){return e.split(":").splice(1).join(":")}get(e,t){const{store:r}=this.opts,n=Array.isArray(e),i=n?this._getKeyPrefixArray(e):this._getKeyPrefix(e);if(n&&void 0===r.getMany){const e=[];for(const n of i)e.push(Promise.resolve().then((()=>r.get(n))).then((e=>"string"==typeof e||this.opts.compression?this.opts.deserialize(e):e)).then((e=>{if(null!=e)return"number"==typeof e.expires&&Date.now()>e.expires?this.delete(n).then((()=>{})):t&&t.raw?e:e.value})));return Promise.allSettled(e).then((e=>{const t=[];for(const r of e)t.push(r.value);return t}))}return Promise.resolve().then((()=>n?r.getMany(i):r.get(i))).then((e=>"string"==typeof e||this.opts.compression?this.opts.deserialize(e):e)).then((r=>{if(null!=r)return n?r.map(((r,n)=>{if("string"==typeof r&&(r=this.opts.deserialize(r)),null!=r){if(!("number"==typeof r.expires&&Date.now()>r.expires))return t&&t.raw?r:r.value;this.delete(e[n]).then((()=>{}))}})):"number"==typeof r.expires&&Date.now()>r.expires?this.delete(e).then((()=>{})):t&&t.raw?r:r.value}))}set(e,t,r){const n=this._getKeyPrefix(e);void 0===r&&(r=this.opts.ttl),0===r&&(r=void 0);const{store:i}=this.opts;return Promise.resolve().then((()=>{const e="number"==typeof r?Date.now()+r:null;return"symbol"==typeof t&&this.emit("error","symbol cannot be serialized"),t={value:t,expires:e},this.opts.serialize(t)})).then((e=>i.set(n,e,r))).then((()=>!0))}delete(e){const{store:t}=this.opts;if(Array.isArray(e)){const r=this._getKeyPrefixArray(e);if(void 0===t.deleteMany){const e=[];for(const n of r)e.push(t.delete(n));return Promise.allSettled(e).then((e=>e.every((e=>!0===e.value))))}return Promise.resolve().then((()=>t.deleteMany(r)))}const r=this._getKeyPrefix(e);return Promise.resolve().then((()=>t.delete(r)))}clear(){const{store:e}=this.opts;return Promise.resolve().then((()=>e.clear()))}has(e){const t=this._getKeyPrefix(e),{store:r}=this.opts;return Promise.resolve().then((async()=>{if("function"==typeof r.has)return r.has(t);return void 0!==await r.get(t)}))}disconnect(){const{store:e}=this.opts;if("function"==typeof e.disconnect)return e.disconnect()}},m$=Pr(h$),y$={exports:{}},g$={},_$={},v$={acl:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},append:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},asking:{arity:1,flags:["fast"],keyStart:0,keyStop:0,step:0},auth:{arity:-2,flags:["noscript","loading","stale","fast","no_auth","allow_busy"],keyStart:0,keyStop:0,step:0},bgrewriteaof:{arity:1,flags:["admin","noscript","no_async_loading"],keyStart:0,keyStop:0,step:0},bgsave:{arity:-1,flags:["admin","noscript","no_async_loading"],keyStart:0,keyStop:0,step:0},bitcount:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},bitfield:{arity:-2,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},bitfield_ro:{arity:-2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},bitop:{arity:-4,flags:["write","denyoom"],keyStart:2,keyStop:-1,step:1},bitpos:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},blmove:{arity:6,flags:["write","denyoom","noscript","blocking"],keyStart:1,keyStop:2,step:1},blmpop:{arity:-5,flags:["write","blocking","movablekeys"],keyStart:0,keyStop:0,step:0},blpop:{arity:-3,flags:["write","noscript","blocking"],keyStart:1,keyStop:-2,step:1},brpop:{arity:-3,flags:["write","noscript","blocking"],keyStart:1,keyStop:-2,step:1},brpoplpush:{arity:4,flags:["write","denyoom","noscript","blocking"],keyStart:1,keyStop:2,step:1},bzmpop:{arity:-5,flags:["write","blocking","movablekeys"],keyStart:0,keyStop:0,step:0},bzpopmax:{arity:-3,flags:["write","noscript","blocking","fast"],keyStart:1,keyStop:-2,step:1},bzpopmin:{arity:-3,flags:["write","noscript","blocking","fast"],keyStart:1,keyStop:-2,step:1},client:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},cluster:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},command:{arity:-1,flags:["loading","stale"],keyStart:0,keyStop:0,step:0},config:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},copy:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},dbsize:{arity:1,flags:["readonly","fast"],keyStart:0,keyStop:0,step:0},debug:{arity:-2,flags:["admin","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},decr:{arity:2,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},decrby:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},del:{arity:-2,flags:["write"],keyStart:1,keyStop:-1,step:1},discard:{arity:1,flags:["noscript","loading","stale","fast","allow_busy"],keyStart:0,keyStop:0,step:0},dump:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},echo:{arity:2,flags:["fast"],keyStart:0,keyStop:0,step:0},eval:{arity:-3,flags:["noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},eval_ro:{arity:-3,flags:["readonly","noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},evalsha:{arity:-3,flags:["noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},evalsha_ro:{arity:-3,flags:["readonly","noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},exec:{arity:1,flags:["noscript","loading","stale","skip_slowlog"],keyStart:0,keyStop:0,step:0},exists:{arity:-2,flags:["readonly","fast"],keyStart:1,keyStop:-1,step:1},expire:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},expireat:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},expiretime:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},failover:{arity:-1,flags:["admin","noscript","stale"],keyStart:0,keyStop:0,step:0},fcall:{arity:-3,flags:["noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},fcall_ro:{arity:-3,flags:["readonly","noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},flushall:{arity:-1,flags:["write"],keyStart:0,keyStop:0,step:0},flushdb:{arity:-1,flags:["write"],keyStart:0,keyStop:0,step:0},function:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},geoadd:{arity:-5,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},geodist:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},geohash:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},geopos:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},georadius:{arity:-6,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},georadius_ro:{arity:-6,flags:["readonly"],keyStart:1,keyStop:1,step:1},georadiusbymember:{arity:-5,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},georadiusbymember_ro:{arity:-5,flags:["readonly"],keyStart:1,keyStop:1,step:1},geosearch:{arity:-7,flags:["readonly"],keyStart:1,keyStop:1,step:1},geosearchstore:{arity:-8,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},get:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},getbit:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},getdel:{arity:2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},getex:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},getrange:{arity:4,flags:["readonly"],keyStart:1,keyStop:1,step:1},getset:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hdel:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},hello:{arity:-1,flags:["noscript","loading","stale","fast","no_auth","allow_busy"],keyStart:0,keyStop:0,step:0},hexists:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hget:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hgetall:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},hincrby:{arity:4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hincrbyfloat:{arity:4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hkeys:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},hlen:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hmget:{arity:-3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hmset:{arity:-4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hrandfield:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},hscan:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},hset:{arity:-4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hsetnx:{arity:4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hstrlen:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hvals:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},incr:{arity:2,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},incrby:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},incrbyfloat:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},info:{arity:-1,flags:["loading","stale"],keyStart:0,keyStop:0,step:0},keys:{arity:2,flags:["readonly"],keyStart:0,keyStop:0,step:0},lastsave:{arity:1,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},latency:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},lcs:{arity:-3,flags:["readonly"],keyStart:1,keyStop:2,step:1},lindex:{arity:3,flags:["readonly"],keyStart:1,keyStop:1,step:1},linsert:{arity:5,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},llen:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},lmove:{arity:5,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},lmpop:{arity:-4,flags:["write","movablekeys"],keyStart:0,keyStop:0,step:0},lolwut:{arity:-1,flags:["readonly","fast"],keyStart:0,keyStop:0,step:0},lpop:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},lpos:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},lpush:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},lpushx:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},lrange:{arity:4,flags:["readonly"],keyStart:1,keyStop:1,step:1},lrem:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},lset:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},ltrim:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},memory:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},mget:{arity:-2,flags:["readonly","fast"],keyStart:1,keyStop:-1,step:1},migrate:{arity:-6,flags:["write","movablekeys"],keyStart:3,keyStop:3,step:1},module:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},monitor:{arity:1,flags:["admin","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},move:{arity:3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},mset:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:2},msetnx:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:2},multi:{arity:1,flags:["noscript","loading","stale","fast","allow_busy"],keyStart:0,keyStop:0,step:0},object:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},persist:{arity:2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},pexpire:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},pexpireat:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},pexpiretime:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},pfadd:{arity:-2,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},pfcount:{arity:-2,flags:["readonly"],keyStart:1,keyStop:-1,step:1},pfdebug:{arity:3,flags:["write","denyoom","admin"],keyStart:2,keyStop:2,step:1},pfmerge:{arity:-2,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:1},pfselftest:{arity:1,flags:["admin"],keyStart:0,keyStop:0,step:0},ping:{arity:-1,flags:["fast"],keyStart:0,keyStop:0,step:0},psetex:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},psubscribe:{arity:-2,flags:["pubsub","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},psync:{arity:-3,flags:["admin","noscript","no_async_loading","no_multi"],keyStart:0,keyStop:0,step:0},pttl:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},publish:{arity:3,flags:["pubsub","loading","stale","fast"],keyStart:0,keyStop:0,step:0},pubsub:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},punsubscribe:{arity:-1,flags:["pubsub","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},quit:{arity:-1,flags:["noscript","loading","stale","fast","no_auth","allow_busy"],keyStart:0,keyStop:0,step:0},randomkey:{arity:1,flags:["readonly"],keyStart:0,keyStop:0,step:0},readonly:{arity:1,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},readwrite:{arity:1,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},rename:{arity:3,flags:["write"],keyStart:1,keyStop:2,step:1},renamenx:{arity:3,flags:["write","fast"],keyStart:1,keyStop:2,step:1},replconf:{arity:-1,flags:["admin","noscript","loading","stale","allow_busy"],keyStart:0,keyStop:0,step:0},replicaof:{arity:3,flags:["admin","noscript","stale","no_async_loading"],keyStart:0,keyStop:0,step:0},reset:{arity:1,flags:["noscript","loading","stale","fast","no_auth","allow_busy"],keyStart:0,keyStop:0,step:0},restore:{arity:-4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},"restore-asking":{arity:-4,flags:["write","denyoom","asking"],keyStart:1,keyStop:1,step:1},role:{arity:1,flags:["noscript","loading","stale","fast"],keyStart:0,keyStop:0,step:0},rpop:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},rpoplpush:{arity:3,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},rpush:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},rpushx:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},sadd:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},save:{arity:1,flags:["admin","noscript","no_async_loading","no_multi"],keyStart:0,keyStop:0,step:0},scan:{arity:-2,flags:["readonly"],keyStart:0,keyStop:0,step:0},scard:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},script:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},sdiff:{arity:-2,flags:["readonly"],keyStart:1,keyStop:-1,step:1},sdiffstore:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:1},select:{arity:2,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},set:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},setbit:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},setex:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},setnx:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},setrange:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},shutdown:{arity:-1,flags:["admin","noscript","loading","stale","no_multi","allow_busy"],keyStart:0,keyStop:0,step:0},sinter:{arity:-2,flags:["readonly"],keyStart:1,keyStop:-1,step:1},sintercard:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},sinterstore:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:1},sismember:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},slaveof:{arity:3,flags:["admin","noscript","stale","no_async_loading"],keyStart:0,keyStop:0,step:0},slowlog:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},smembers:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},smismember:{arity:-3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},smove:{arity:4,flags:["write","fast"],keyStart:1,keyStop:2,step:1},sort:{arity:-2,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},sort_ro:{arity:-2,flags:["readonly","movablekeys"],keyStart:1,keyStop:1,step:1},spop:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},spublish:{arity:3,flags:["pubsub","loading","stale","fast"],keyStart:1,keyStop:1,step:1},srandmember:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},srem:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},sscan:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},ssubscribe:{arity:-2,flags:["pubsub","noscript","loading","stale"],keyStart:1,keyStop:-1,step:1},strlen:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},subscribe:{arity:-2,flags:["pubsub","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},substr:{arity:4,flags:["readonly"],keyStart:1,keyStop:1,step:1},sunion:{arity:-2,flags:["readonly"],keyStart:1,keyStop:-1,step:1},sunionstore:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:1},sunsubscribe:{arity:-1,flags:["pubsub","noscript","loading","stale"],keyStart:1,keyStop:-1,step:1},swapdb:{arity:3,flags:["write","fast"],keyStart:0,keyStop:0,step:0},sync:{arity:1,flags:["admin","noscript","no_async_loading","no_multi"],keyStart:0,keyStop:0,step:0},time:{arity:1,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},touch:{arity:-2,flags:["readonly","fast"],keyStart:1,keyStop:-1,step:1},ttl:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},type:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},unlink:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:-1,step:1},unsubscribe:{arity:-1,flags:["pubsub","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},unwatch:{arity:1,flags:["noscript","loading","stale","fast","allow_busy"],keyStart:0,keyStop:0,step:0},wait:{arity:3,flags:["noscript"],keyStart:0,keyStop:0,step:0},watch:{arity:-2,flags:["noscript","loading","stale","fast","allow_busy"],keyStart:1,keyStop:-1,step:1},xack:{arity:-4,flags:["write","fast"],keyStart:1,keyStop:1,step:1},xadd:{arity:-5,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},xautoclaim:{arity:-6,flags:["write","fast"],keyStart:1,keyStop:1,step:1},xclaim:{arity:-6,flags:["write","fast"],keyStart:1,keyStop:1,step:1},xdel:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},xgroup:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},xinfo:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},xlen:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},xpending:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},xrange:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},xread:{arity:-4,flags:["readonly","blocking","movablekeys"],keyStart:0,keyStop:0,step:0},xreadgroup:{arity:-7,flags:["write","blocking","movablekeys"],keyStart:0,keyStop:0,step:0},xrevrange:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},xsetid:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},xtrim:{arity:-4,flags:["write"],keyStart:1,keyStop:1,step:1},zadd:{arity:-4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},zcard:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zcount:{arity:4,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zdiff:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},zdiffstore:{arity:-4,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},zincrby:{arity:4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},zinter:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},zintercard:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},zinterstore:{arity:-4,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},zlexcount:{arity:4,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zmpop:{arity:-4,flags:["write","movablekeys"],keyStart:0,keyStop:0,step:0},zmscore:{arity:-3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zpopmax:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},zpopmin:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},zrandmember:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrange:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrangebylex:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrangebyscore:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrangestore:{arity:-5,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},zrank:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zrem:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},zremrangebylex:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},zremrangebyrank:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},zremrangebyscore:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},zrevrange:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrevrangebylex:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrevrangebyscore:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrevrank:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zscan:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},zscore:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zunion:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},zunionstore:{arity:-4,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1}};!function(e){var t=jr&&jr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.getKeyIndexes=e.hasFlag=e.exists=e.list=void 0;const r=t(v$);e.list=Object.keys(r.default);const n={};function i(e){"string"!=typeof e&&(e=String(e));const t=e.indexOf("->");return-1===t?e.length:t}e.list.forEach((e=>{n[e]=r.default[e].flags.reduce((function(e,t){return e[t]=!0,e}),{})})),e.exists=function(e){return Boolean(r.default[e])},e.hasFlag=function(e,t){if(!n[e])throw new Error("Unknown command "+e);return Boolean(n[e][t])},e.getKeyIndexes=function(e,t,n){const s=r.default[e];if(!s)throw new Error("Unknown command "+e);if(!Array.isArray(t))throw new Error("Expect args to be an array");const o=[],a=Boolean(n&&n.parseExternalKey),c=(e,t)=>{const r=[],n=Number(e[t]);for(let e=0;e<n;e++)r.push(e+t+1);return r},l=(e,t,r)=>{for(let n=t;n<e.length-1;n+=1)if(String(e[n]).toLowerCase()===r.toLowerCase())return n+1;return null};switch(e){case"zunionstore":case"zinterstore":case"zdiffstore":o.push(0,...c(t,1));break;case"eval":case"evalsha":case"eval_ro":case"evalsha_ro":case"fcall":case"fcall_ro":case"blmpop":case"bzmpop":o.push(...c(t,1));break;case"sintercard":case"lmpop":case"zunion":case"zinter":case"zmpop":case"zintercard":case"zdiff":o.push(...c(t,0));break;case"georadius":{o.push(0);const e=l(t,5,"STORE");e&&o.push(e);const r=l(t,5,"STOREDIST");r&&o.push(r);break}case"georadiusbymember":{o.push(0);const e=l(t,4,"STORE");e&&o.push(e);const r=l(t,4,"STOREDIST");r&&o.push(r);break}case"sort":case"sort_ro":o.push(0);for(let e=1;e<t.length-1;e++){let r=t[e];if("string"!=typeof r)continue;const n=r.toUpperCase();"GET"===n?(e+=1,r=t[e],"#"!==r&&(a?o.push([e,i(r)]):o.push(e))):"BY"===n?(e+=1,a?o.push([e,i(t[e])]):o.push(e)):"STORE"===n&&(e+=1,o.push(e))}break;case"migrate":if(""===t[2])for(let e=5;e<t.length-1;e++){const r=t[e];if("string"==typeof r&&"KEYS"===r.toUpperCase()){for(let r=e+1;r<t.length;r++)o.push(r);break}}else o.push(2);break;case"xreadgroup":case"xread":for(let r="xread"===e?0:3;r<t.length-1;r++)if("STREAMS"===String(t[r]).toUpperCase()){for(let e=r+1;e<=r+(t.length-1-r)/2;e++)o.push(e);break}break;default:if(s.step>0){const e=s.keyStart-1,r=s.keyStop>0?s.keyStop:t.length+s.keyStop+1;for(let t=e;t<r;t+=s.step)o.push(t)}}return o}}(_$);var b$={},w$={};!function(e){let t;function r(r,n){try{const e=t;return t=null,e.apply(this,arguments)}catch(t){return e.errorObj.e=t,e.errorObj}}Object.defineProperty(e,"__esModule",{value:!0}),e.tryCatch=e.errorObj=void 0,e.errorObj={e:{}},e.tryCatch=function(e){return t=e,r}}(w$),Object.defineProperty(b$,"__esModule",{value:!0});const S$=w$;function E$(e){setTimeout((function(){throw e}),0)}b$.default=function(e,t,r){return"function"==typeof t&&e.then((e=>{let n;n=void 0!==r&&Object(r).spread&&Array.isArray(e)?S$.tryCatch(t).apply(void 0,[null].concat(e)):void 0===e?S$.tryCatch(t)(null):S$.tryCatch(t)(null,e),n===S$.errorObj&&E$(n.e)}),(e=>{if(!e){const t=new Error(e+"");Object.assign(t,{cause:e}),e=t}const r=S$.tryCatch(t)(e);r===S$.errorObj&&E$(r.e)})),e};var k$,A$,O$,C$,T$={};const R$=process.version.charCodeAt(1)<55&&46===process.version.charCodeAt(2)?function(){if(A$)return k$;A$=1;const e=u,r=t;function n(e){Object.defineProperty(this,"message",{value:e||"",configurable:!0,writable:!0}),Error.captureStackTrace(this,this.constructor)}function i(t,r,n){e(r),e.strictEqual(typeof n,"number"),Object.defineProperty(this,"message",{value:t||"",configurable:!0,writable:!0});const i=Error.stackTraceLimit;Error.stackTraceLimit=2,Error.captureStackTrace(this,this.constructor),Error.stackTraceLimit=i,this.offset=n,this.buffer=r}function s(e){Object.defineProperty(this,"message",{value:e||"",configurable:!0,writable:!0});const t=Error.stackTraceLimit;Error.stackTraceLimit=2,Error.captureStackTrace(this,this.constructor),Error.stackTraceLimit=t}function o(e){Object.defineProperty(this,"message",{value:e||"",configurable:!0,writable:!0}),Error.captureStackTrace(this,this.constructor)}function a(e){Object.defineProperty(this,"message",{value:e||"",configurable:!0,writable:!0}),Error.captureStackTrace(this,this.constructor)}return r.inherits(n,Error),Object.defineProperty(n.prototype,"name",{value:"RedisError",configurable:!0,writable:!0}),r.inherits(i,n),Object.defineProperty(i.prototype,"name",{value:"ParserError",configurable:!0,writable:!0}),r.inherits(s,n),Object.defineProperty(s.prototype,"name",{value:"ReplyError",configurable:!0,writable:!0}),r.inherits(o,n),Object.defineProperty(o.prototype,"name",{value:"AbortError",configurable:!0,writable:!0}),r.inherits(a,o),Object.defineProperty(a.prototype,"name",{value:"InterruptError",configurable:!0,writable:!0}),k$={RedisError:n,ParserError:i,ReplyError:s,AbortError:o,InterruptError:a}}():function(){if(C$)return O$;C$=1;const e=u;class t extends Error{get name(){return this.constructor.name}}class r extends t{get name(){return this.constructor.name}}return O$={RedisError:t,ParserError:class extends t{constructor(t,r,n){e(r),e.strictEqual(typeof n,"number");const i=Error.stackTraceLimit;Error.stackTraceLimit=2,super(t),Error.stackTraceLimit=i,this.offset=n,this.buffer=r}get name(){return this.constructor.name}},ReplyError:class extends t{constructor(e){const t=Error.stackTraceLimit;Error.stackTraceLimit=2,super(e),Error.stackTraceLimit=t}get name(){return this.constructor.name}},AbortError:r,InterruptError:class extends r{get name(){return this.constructor.name}}},O$}();var I$=R$,x$={},j$={exports:{}},P$=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920],N$=j$.exports=function(e){for(var t,r=0,n=-1,i=0,s=0,o="string"==typeof e?function(e){for(var t,r=0,n=0,i=[],s=e.length;r<s;r++)(t=e.charCodeAt(r))<128?i[n++]=t:t<2048?(i[n++]=t>>6|192,i[n++]=63&t|128):55296==(64512&t)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(t=65536+((1023&t)<<10)+(1023&e.charCodeAt(++r)),i[n++]=t>>18|240,i[n++]=t>>12&63|128,i[n++]=t>>6&63|128,i[n++]=63&t|128):(i[n++]=t>>12|224,i[n++]=t>>6&63|128,i[n++]=63&t|128);return i}(e):e,a=o.length;r<a;){if(t=o[r++],-1===n)123===t&&(n=r);else if(125!==t)s=P$[255&(t^s>>8)]^s<<8;else if(r-1!==n)return 16383&s;i=P$[255&(t^i>>8)]^i<<8}return 16383&i};j$.exports.generateMulti=function(e){for(var t=1,r=e.length,n=N$(e[0]);t<r;)if(N$(e[t++])!==n)return-1;return n};var $$=j$.exports,M$={},D$={},L$=9007199254740991,B$="[object Arguments]",K$="[object Function]",F$="[object GeneratorFunction]",U$=/^(?:0|[1-9]\d*)$/;function W$(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var J$=Object.prototype,H$=J$.hasOwnProperty,G$=J$.toString,z$=J$.propertyIsEnumerable,V$=Math.max;function q$(e,t){var r=rM(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&nM(e)}(e)&&H$.call(e,"callee")&&(!z$.call(e,"callee")||G$.call(e)==B$)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,i=!!n;for(var s in e)!t&&!H$.call(e,s)||i&&("length"==s||eM(s,n))||r.push(s);return r}function X$(e,t,r,n){return void 0===e||tM(e,J$[r])&&!H$.call(n,r)?t:e}function Y$(e,t,r){var n=e[t];H$.call(e,t)&&tM(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function Z$(e){if(!iM(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t,r,n,i=(r=(t=e)&&t.constructor,n="function"==typeof r&&r.prototype||J$,t===n),s=[];for(var o in e)("constructor"!=o||!i&&H$.call(e,o))&&s.push(o);return s}function Q$(e,t){return t=V$(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,i=V$(r.length-t,0),s=Array(i);++n<i;)s[n]=r[t+n];n=-1;for(var o=Array(t+1);++n<t;)o[n]=r[n];return o[t]=s,W$(e,this,o)}}function eM(e,t){return!!(t=null==t?L$:t)&&("number"==typeof e||U$.test(e))&&e>-1&&e%1==0&&e<t}function tM(e,t){return e===t||e!=e&&t!=t}var rM=Array.isArray;function nM(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=L$}(e.length)&&!function(e){var t=iM(e)?G$.call(e):"";return t==K$||t==F$}(e)}function iM(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var sM,oM=(sM=function(e,t,r,n){!function(e,t,r,n){r||(r={});for(var i=-1,s=t.length;++i<s;){var o=t[i],a=n?n(r[o],e[o],o,r,e):void 0;Y$(r,o,void 0===a?e[o]:a)}}(t,function(e){return nM(e)?q$(e,!0):Z$(e)}(t),e,n)},Q$((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,s=n>2?t[2]:void 0;for(i=sM.length>3&&"function"==typeof i?(n--,i):void 0,s&&function(e,t,r){if(!iM(r))return!1;var n=typeof t;return!!("number"==n?nM(r)&&eM(t,r.length):"string"==n&&t in r)&&tM(r[t],e)}(t[0],t[1],s)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var o=t[r];o&&sM(e,o,r,i)}return e})));var aM=Q$((function(e){return e.push(void 0,X$),W$(oM,void 0,e)})),cM=9007199254740991,lM="[object Function]",uM="[object GeneratorFunction]",dM=Object.prototype,fM=dM.hasOwnProperty,pM=dM.toString,hM=dM.propertyIsEnumerable;var mM=function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&function(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=cM}(e.length)&&!function(e){var t=function(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}(e)?pM.call(e):"";return t==lM||t==uM}(e)}(e)}(e)&&fM.call(e,"callee")&&(!hM.call(e,"callee")||"[object Arguments]"==pM.call(e))};Object.defineProperty(D$,"__esModule",{value:!0}),D$.isArguments=D$.defaults=D$.noop=void 0;const yM=aM;D$.defaults=yM;const gM=mM;D$.isArguments=gM,D$.noop=function(){};var _M={};Object.defineProperty(_M,"__esModule",{value:!0}),_M.genRedactedString=_M.getStringValue=_M.MAX_ARGUMENT_LENGTH=void 0;const vM=Qn;_M.MAX_ARGUMENT_LENGTH=200;function bM(e){if(null!==e)switch(typeof e){case"boolean":case"number":return;case"object":if(Buffer.isBuffer(e))return e.toString("hex");if(Array.isArray(e))return e.join(",");try{return JSON.stringify(e)}catch(e){return}case"string":return e}}function wM(e,t){const{length:r}=e;return r<=t?e:e.slice(0,t)+' ... <REDACTED full-length="'+r+'">'}_M.getStringValue=bM,_M.genRedactedString=wM,_M.default=function(e){const t=(0,vM.default)(`ioredis:${e}`);function r(...e){if(t.enabled){for(let t=1;t<e.length;t++){const r=bM(e[t]);"string"==typeof r&&r.length>200&&(e[t]=wM(r,200))}return t.apply(null,e)}}return Object.defineProperties(r,{namespace:{get:()=>t.namespace},enabled:{get:()=>t.enabled},destroy:{get:()=>t.destroy},log:{get:()=>t.log,set(e){t.log=e}}}),r};var SM={};Object.defineProperty(SM,"__esModule",{value:!0});const EM="-----BEGIN CERTIFICATE-----\nMIIDTzCCAjegAwIBAgIJAKSVpiDswLcwMA0GCSqGSIb3DQEBBQUAMD4xFjAUBgNV\nBAoMDUdhcmFudGlhIERhdGExJDAiBgNVBAMMG1NTTCBDZXJ0aWZpY2F0aW9uIEF1\ndGhvcml0eTAeFw0xMzEwMDExMjE0NTVaFw0yMzA5MjkxMjE0NTVaMD4xFjAUBgNV\nBAoMDUdhcmFudGlhIERhdGExJDAiBgNVBAMMG1NTTCBDZXJ0aWZpY2F0aW9uIEF1\ndGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALZqkh/DczWP\nJnxnHLQ7QL0T4B4CDKWBKCcisriGbA6ZePWVNo4hfKQC6JrzfR+081NeD6VcWUiz\nrmd+jtPhIY4c+WVQYm5PKaN6DT1imYdxQw7aqO5j2KUCEh/cznpLxeSHoTxlR34E\nQwF28Wl3eg2vc5ct8LjU3eozWVk3gb7alx9mSA2SgmuX5lEQawl++rSjsBStemY2\nBDwOpAMXIrdEyP/cVn8mkvi/BDs5M5G+09j0gfhyCzRWMQ7Hn71u1eolRxwVxgi3\nTMn+/vTaFSqxKjgck6zuAYjBRPaHe7qLxHNr1So/Mc9nPy+3wHebFwbIcnUojwbp\n4nctkWbjb2cCAwEAAaNQME4wHQYDVR0OBBYEFP1whtcrydmW3ZJeuSoKZIKjze3w\nMB8GA1UdIwQYMBaAFP1whtcrydmW3ZJeuSoKZIKjze3wMAwGA1UdEwQFMAMBAf8w\nDQYJKoZIhvcNAQEFBQADggEBAG2erXhwRAa7+ZOBs0B6X57Hwyd1R4kfmXcs0rta\nlbPpvgULSiB+TCbf3EbhJnHGyvdCY1tvlffLjdA7HJ0PCOn+YYLBA0pTU/dyvrN6\nSu8NuS5yubnt9mb13nDGYo1rnt0YRfxN+8DM3fXIVr038A30UlPX2Ou1ExFJT0MZ\nuFKY6ZvLdI6/1cbgmguMlAhM+DhKyV6Sr5699LM3zqeI816pZmlREETYkGr91q7k\nBpXJu/dtHaGxg1ZGu6w/PCsYGUcECWENYD4VQPd8N32JjOfu6vEgoEAwfPP+3oGp\nZ4m3ewACcWOAenqflb+cQYC4PsF7qbXDmRaWrbKntOlZ3n0=\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIGMTCCBBmgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwajELMAkGA1UEBhMCVVMx\nCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJDQTESMBAGA1UECgwJUmVkaXNMYWJzMS0w\nKwYDVQQDDCRSZWRpc0xhYnMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN\nMTgwMjI1MTUzNzM3WhcNMjgwMjIzMTUzNzM3WjBfMQswCQYDVQQGEwJVUzELMAkG\nA1UECAwCQ0ExEjAQBgNVBAoMCVJlZGlzTGFiczEvMC0GA1UEAwwmUkNQIEludGVy\nbWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA\nA4ICDwAwggIKAoICAQDf9dqbxc8Bq7Ctq9rWcxrGNKKHivqLAFpPq02yLPx6fsOv\nTq7GsDChAYBBc4v7Y2Ap9RD5Vs3dIhEANcnolf27QwrG9RMnnvzk8pCvp1o6zSU4\nVuOE1W66/O1/7e2rVxyrnTcP7UgK43zNIXu7+tiAqWsO92uSnuMoGPGpeaUm1jym\nhjWKtkAwDFSqvHY+XL5qDVBEjeUe+WHkYUg40cAXjusAqgm2hZt29c2wnVrxW25W\nP0meNlzHGFdA2AC5z54iRiqj57dTfBTkHoBczQxcyw6hhzxZQ4e5I5zOKjXXEhZN\nr0tA3YC14CTabKRus/JmZieyZzRgEy2oti64tmLYTqSlAD78pRL40VNoaSYetXLw\nhhNsXCHgWaY6d5bLOc/aIQMAV5oLvZQKvuXAF1IDmhPA+bZbpWipp0zagf1P1H3s\nUzsMdn2KM0ejzgotbtNlj5TcrVwpmvE3ktvUAuA+hi3FkVx1US+2Gsp5x4YOzJ7u\nP1WPk6ShF0JgnJH2ILdj6kttTWwFzH17keSFICWDfH/+kM+k7Y1v3EXMQXE7y0T9\nMjvJskz6d/nv+sQhY04xt64xFMGTnZjlJMzfQNi7zWFLTZnDD0lPowq7l3YiPoTT\nt5Xky83lu0KZsZBo0WlWaDG00gLVdtRgVbcuSWxpi5BdLb1kRab66JptWjxwXQID\nAQABo4HrMIHoMDoGA1UdHwQzMDEwL6AtoCuGKWh0dHBzOi8vcmwtY2Etc2VydmVy\nLnJlZGlzbGFicy5jb20vdjEvY3JsMEYGCCsGAQUFBwEBBDowODA2BggrBgEFBQcw\nAYYqaHR0cHM6Ly9ybC1jYS1zZXJ2ZXIucmVkaXNsYWJzLmNvbS92MS9vY3NwMB0G\nA1UdDgQWBBQHar5OKvQUpP2qWt6mckzToeCOHDAfBgNVHSMEGDAWgBQi42wH6hM4\nL2sujEvLM0/u8lRXTzASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIB\nhjANBgkqhkiG9w0BAQsFAAOCAgEAirEn/iTsAKyhd+pu2W3Z5NjCko4NPU0EYUbr\nAP7+POK2rzjIrJO3nFYQ/LLuC7KCXG+2qwan2SAOGmqWst13Y+WHp44Kae0kaChW\nvcYLXXSoGQGC8QuFSNUdaeg3RbMDYFT04dOkqufeWVccoHVxyTSg9eD8LZuHn5jw\n7QDLiEECBmIJHk5Eeo2TAZrx4Yx6ufSUX5HeVjlAzqwtAqdt99uCJ/EL8bgpWbe+\nXoSpvUv0SEC1I1dCAhCKAvRlIOA6VBcmzg5Am12KzkqTul12/VEFIgzqu0Zy2Jbc\nAUPrYVu/+tOGXQaijy7YgwH8P8n3s7ZeUa1VABJHcxrxYduDDJBLZi+MjheUDaZ1\njQRHYevI2tlqeSBqdPKG4zBY5lS0GiAlmuze5oENt0P3XboHoZPHiqcK3VECgTVh\n/BkJcuudETSJcZDmQ8YfoKfBzRQNg2sv/hwvUv73Ss51Sco8GEt2lD8uEdib1Q6z\nzDT5lXJowSzOD5ZA9OGDjnSRL+2riNtKWKEqvtEG3VBJoBzu9GoxbAc7wIZLxmli\niF5a/Zf5X+UXD3s4TMmy6C4QZJpAA2egsSQCnraWO2ULhh7iXMysSkF/nzVfZn43\niqpaB8++9a37hWq14ZmOv0TJIDz//b2+KC4VFXWQ5W5QC6whsjT+OlG4p5ZYG0jo\n616pxqo=\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIFujCCA6KgAwIBAgIJAJ1aTT1lu2ScMA0GCSqGSIb3DQEBCwUAMGoxCzAJBgNV\nBAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCQ0ExEjAQBgNVBAoMCVJlZGlz\nTGFiczEtMCsGA1UEAwwkUmVkaXNMYWJzIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9y\naXR5MB4XDTE4MDIyNTE1MjA0MloXDTM4MDIyMDE1MjA0MlowajELMAkGA1UEBhMC\nVVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJDQTESMBAGA1UECgwJUmVkaXNMYWJz\nMS0wKwYDVQQDDCRSZWRpc0xhYnMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkw\nggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDLEjXy7YrbN5Waau5cd6g1\nG5C2tMmeTpZ0duFAPxNU4oE3RHS5gGiok346fUXuUxbZ6QkuzeN2/2Z+RmRcJhQY\nDm0ZgdG4x59An1TJfnzKKoWj8ISmoHS/TGNBdFzXV7FYNLBuqZouqePI6ReC6Qhl\npp45huV32Q3a6IDrrvx7Wo5ZczEQeFNbCeCOQYNDdTmCyEkHqc2AGo8eoIlSTutT\nULOC7R5gzJVTS0e1hesQ7jmqHjbO+VQS1NAL4/5K6cuTEqUl+XhVhPdLWBXJQ5ag\n54qhX4v+ojLzeU1R/Vc6NjMvVtptWY6JihpgplprN0Yh2556ewcXMeturcKgXfGJ\nxeYzsjzXerEjrVocX5V8BNrg64NlifzTMKNOOv4fVZszq1SIHR8F9ROrqiOdh8iC\nJpUbLpXH9hWCSEO6VRMB2xJoKu3cgl63kF30s77x7wLFMEHiwsQRKxooE1UhgS9K\n2sO4TlQ1eWUvFvHSTVDQDlGQ6zu4qjbOpb3Q8bQwoK+ai2alkXVR4Ltxe9QlgYK3\nStsnPhruzZGA0wbXdpw0bnM+YdlEm5ffSTpNIfgHeaa7Dtb801FtA71ZlH7A6TaI\nSIQuUST9EKmv7xrJyx0W1pGoPOLw5T029aTjnICSLdtV9bLwysrLhIYG5bnPq78B\ncS+jZHFGzD7PUVGQD01nOQIDAQABo2MwYTAdBgNVHQ4EFgQUIuNsB+oTOC9rLoxL\nyzNP7vJUV08wHwYDVR0jBBgwFoAUIuNsB+oTOC9rLoxLyzNP7vJUV08wDwYDVR0T\nAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAHfg\nz5pMNUAKdMzK1aS1EDdK9yKz4qicILz5czSLj1mC7HKDRy8cVADUxEICis++CsCu\nrYOvyCVergHQLREcxPq4rc5Nq1uj6J6649NEeh4WazOOjL4ZfQ1jVznMbGy+fJm3\n3Hoelv6jWRG9iqeJZja7/1s6YC6bWymI/OY1e4wUKeNHAo+Vger7MlHV+RuabaX+\nhSJ8bJAM59NCM7AgMTQpJCncrcdLeceYniGy5Q/qt2b5mJkQVkIdy4TPGGB+AXDJ\nD0q3I/JDRkDUFNFdeW0js7fHdsvCR7O3tJy5zIgEV/o/BCkmJVtuwPYOrw/yOlKj\nTY/U7ATAx9VFF6/vYEOMYSmrZlFX+98L6nJtwDqfLB5VTltqZ4H/KBxGE3IRSt9l\nFXy40U+LnXzhhW+7VBAvyYX8GEXhHkKU8Gqk1xitrqfBXY74xKgyUSTolFSfFVgj\nmcM/X4K45bka+qpkj7Kfv/8D4j6aZekwhN2ly6hhC1SmQ8qjMjpG/mrWOSSHZFmf\nybu9iD2AYHeIOkshIl6xYIa++Q/00/vs46IzAbQyriOi0XxlSMMVtPx0Q3isp+ji\nn8Mq9eOuxYOEQ4of8twUkUDd528iwGtEdwf0Q01UyT84S62N8AySl1ZBKXJz6W4F\nUhWfa/HQYOAPDdEjNgnVwLI23b8t0TozyCWw7q8h\n-----END CERTIFICATE-----\n\n-----BEGIN CERTIFICATE-----\nMIIEjzCCA3egAwIBAgIQe55B/ALCKJDZtdNT8kD6hTANBgkqhkiG9w0BAQsFADBM\nMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xv\nYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjAeFw0yMjAxMjYxMjAwMDBaFw0y\nNTAxMjYwMDAwMDBaMFgxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWdu\nIG52LXNhMS4wLAYDVQQDEyVHbG9iYWxTaWduIEF0bGFzIFIzIE9WIFRMUyBDQSAy\nMDIyIFEyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmGmg1LW9b7Lf\n8zDD83yBDTEkt+FOxKJZqF4veWc5KZsQj9HfnUS2e5nj/E+JImlGPsQuoiosLuXD\nBVBNAMcUFa11buFMGMeEMwiTmCXoXRrXQmH0qjpOfKgYc5gHG3BsRGaRrf7VR4eg\nofNMG9wUBw4/g/TT7+bQJdA4NfE7Y4d5gEryZiBGB/swaX6Jp/8MF4TgUmOWmalK\ndZCKyb4sPGQFRTtElk67F7vU+wdGcrcOx1tDcIB0ncjLPMnaFicagl+daWGsKqTh\ncounQb6QJtYHa91KvCfKWocMxQ7OIbB5UARLPmC4CJ1/f8YFm35ebfzAeULYdGXu\njE9CLor0OwIDAQABo4IBXzCCAVswDgYDVR0PAQH/BAQDAgGGMB0GA1UdJQQWMBQG\nCCsGAQUFBwMBBggrBgEFBQcDAjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQW\nBBSH5Zq7a7B/t95GfJWkDBpA8HHqdjAfBgNVHSMEGDAWgBSP8Et/qC5FJK5NUPpj\nmove4t0bvDB7BggrBgEFBQcBAQRvMG0wLgYIKwYBBQUHMAGGImh0dHA6Ly9vY3Nw\nMi5nbG9iYWxzaWduLmNvbS9yb290cjMwOwYIKwYBBQUHMAKGL2h0dHA6Ly9zZWN1\ncmUuZ2xvYmFsc2lnbi5jb20vY2FjZXJ0L3Jvb3QtcjMuY3J0MDYGA1UdHwQvMC0w\nK6ApoCeGJWh0dHA6Ly9jcmwuZ2xvYmFsc2lnbi5jb20vcm9vdC1yMy5jcmwwIQYD\nVR0gBBowGDAIBgZngQwBAgIwDAYKKwYBBAGgMgoBAjANBgkqhkiG9w0BAQsFAAOC\nAQEAKRic9/f+nmhQU/wz04APZLjgG5OgsuUOyUEZjKVhNGDwxGTvKhyXGGAMW2B/\n3bRi+aElpXwoxu3pL6fkElbX3B0BeS5LoDtxkyiVEBMZ8m+sXbocwlPyxrPbX6mY\n0rVIvnuUeBH8X0L5IwfpNVvKnBIilTbcebfHyXkPezGwz7E1yhUULjJFm2bt0SdX\ny+4X/WeiiYIv+fTVgZZgl+/2MKIsu/qdBJc3f3TvJ8nz+Eax1zgZmww+RSQWeOj3\n15Iw6Z5FX+NwzY/Ab+9PosR5UosSeq+9HhtaxZttXG1nVh+avYPGYddWmiMT90J5\nZgKnO/Fx2hBgTxhOTMYaD312kg==\n-----END CERTIFICATE-----\n\n-----BEGIN CERTIFICATE-----\nMIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G\nA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp\nZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4\nMTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG\nA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI\nhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8\nRgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT\ngHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm\nKPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd\nQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ\nXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw\nDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o\nLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU\nRUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp\njjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK\n6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX\nmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs\nMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH\nWD9f\n-----END CERTIFICATE-----",kM={RedisCloudFixed:{ca:EM},RedisCloudFlexible:{ca:EM}};SM.default=kM,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.noop=t.defaults=t.Debug=t.zipMap=t.CONNECTION_CLOSED_ERROR_MSG=t.shuffle=t.sample=t.resolveTLSProfile=t.parseURL=t.optimizeErrorStack=t.toArg=t.convertMapToArray=t.convertObjectToArray=t.timeout=t.packObject=t.isInt=t.wrapMultiResult=t.convertBufferToString=void 0;const r=e,n=D$;Object.defineProperty(t,"defaults",{enumerable:!0,get:function(){return n.defaults}}),Object.defineProperty(t,"noop",{enumerable:!0,get:function(){return n.noop}});const i=_M;t.Debug=i.default;const s=SM;function o(e){const t=parseFloat(e);return!isNaN(e)&&(0|t)===t}t.convertBufferToString=function e(t,r){if(t instanceof Buffer)return t.toString(r);if(Array.isArray(t)){const n=t.length,i=Array(n);for(let s=0;s<n;++s)i[s]=t[s]instanceof Buffer&&"utf8"===r?t[s].toString():e(t[s],r);return i}return t},t.wrapMultiResult=function(e){if(!e)return null;const t=[],r=e.length;for(let n=0;n<r;++n){const r=e[n];r instanceof Error?t.push([r]):t.push([null,r])}return t},t.isInt=o,t.packObject=function(e){const t={},r=e.length;for(let n=1;n<r;n+=2)t[e[n-1]]=e[n];return t},t.timeout=function(e,t){let r=null;const n=function(){r&&(clearTimeout(r),r=null,e.apply(this,arguments))};return r=setTimeout(n,t,new Error("timeout")),n},t.convertObjectToArray=function(e){const t=[],r=Object.keys(e);for(let n=0,i=r.length;n<i;n++)t.push(r[n],e[r[n]]);return t},t.convertMapToArray=function(e){const t=[];let r=0;return e.forEach((function(e,n){t[r]=n,t[r+1]=e,r+=2})),t},t.toArg=function(e){return null==e?"":String(e)},t.optimizeErrorStack=function(e,t,r){const n=t.split("\n");let i,s="";for(i=1;i<n.length&&-1!==n[i].indexOf(r);++i);for(let e=i;e<n.length;++e)s+="\n"+n[e];if(e.stack){const t=e.stack.indexOf("\n");e.stack=e.stack.slice(0,t)+s}return e},t.parseURL=function(e){if(o(e))return{port:e};let t=(0,r.parse)(e,!0,!0);t.slashes||"/"===e[0]||(e="//"+e,t=(0,r.parse)(e,!0,!0));const i=t.query||{},s={};if(t.auth){const e=t.auth.indexOf(":");s.username=-1===e?t.auth:t.auth.slice(0,e),s.password=-1===e?"":t.auth.slice(e+1)}if(t.pathname&&("redis:"===t.protocol||"rediss:"===t.protocol?t.pathname.length>1&&(s.db=t.pathname.slice(1)):s.path=t.pathname),t.host&&(s.host=t.hostname),t.port&&(s.port=t.port),"string"==typeof i.family){const e=Number.parseInt(i.family,10);Number.isNaN(e)||(s.family=e)}return(0,n.defaults)(s,i),s},t.resolveTLSProfile=function(e){let t=null==e?void 0:e.tls;"string"==typeof t&&(t={profile:t});const r=s.default[null==t?void 0:t.profile];return r&&(t=Object.assign({},r,t),delete t.profile,e=Object.assign({},e,{tls:t})),e},t.sample=function(e,t=0){const r=e.length;return t>=r?null:e[t+Math.floor(Math.random()*(r-t))]},t.shuffle=function(e){let t=e.length;for(;t>0;){const r=Math.floor(Math.random()*t);t--,[e[t],e[r]]=[e[r],e[t]]}return e},t.CONNECTION_CLOSED_ERROR_MSG="Connection is closed.",t.zipMap=function(e,t){const r=new Map;return e.forEach(((e,n)=>{r.set(e,t[n])})),r}}(M$),Object.defineProperty(x$,"__esModule",{value:!0});const AM=_$,OM=$$,CM=b$,TM=M$;class RM{constructor(e,t=[],r={},n){if(this.name=e,this.inTransaction=!1,this.isResolved=!1,this.transformed=!1,this.replyEncoding=r.replyEncoding,this.errorStack=r.errorStack,this.args=t.flat(),this.callback=n,this.initPromise(),r.keyPrefix){const e=r.keyPrefix instanceof Buffer;let t=e?r.keyPrefix:null;this._iterateKeys((n=>n instanceof Buffer?(null===t&&(t=Buffer.from(r.keyPrefix)),Buffer.concat([t,n])):e?Buffer.concat([r.keyPrefix,Buffer.from(String(n))]):r.keyPrefix+n))}r.readOnly&&(this.isReadOnly=!0)}static checkFlag(e,t){return!!this.getFlagMap()[e][t]}static setArgumentTransformer(e,t){this._transformer.argument[e]=t}static setReplyTransformer(e,t){this._transformer.reply[e]=t}static getFlagMap(){return this.flagMap||(this.flagMap=Object.keys(RM.FLAGS).reduce(((e,t)=>(e[t]={},RM.FLAGS[t].forEach((r=>{e[t][r]=!0})),e)),{})),this.flagMap}getSlot(){if(void 0===this.slot){const e=this.getKeys()[0];this.slot=null==e?null:OM(e)}return this.slot}getKeys(){return this._iterateKeys()}toWritable(e){let t;const r="*"+(this.args.length+1)+"\r\n$"+Buffer.byteLength(this.name)+"\r\n"+this.name+"\r\n";if(this.bufferMode){const e=new jM;e.push(r);for(let t=0;t<this.args.length;++t){const r=this.args[t];r instanceof Buffer?0===r.length?e.push("$0\r\n\r\n"):(e.push("$"+r.length+"\r\n"),e.push(r),e.push("\r\n")):e.push("$"+Buffer.byteLength(r)+"\r\n"+r+"\r\n")}t=e.toBuffer()}else{t=r;for(let e=0;e<this.args.length;++e){const r=this.args[e];t+="$"+Buffer.byteLength(r)+"\r\n"+r+"\r\n"}}return t}stringifyArguments(){for(let e=0;e<this.args.length;++e){const t=this.args[e];"string"==typeof t||(t instanceof Buffer?this.bufferMode=!0:this.args[e]=(0,TM.toArg)(t))}}transformReply(e){this.replyEncoding&&(e=(0,TM.convertBufferToString)(e,this.replyEncoding));const t=RM._transformer.reply[this.name];return t&&(e=t(e)),e}setTimeout(e){this._commandTimeoutTimer||(this._commandTimeoutTimer=setTimeout((()=>{this.isResolved||this.reject(new Error("Command timed out"))}),e))}initPromise(){const e=new Promise(((e,t)=>{if(!this.transformed){this.transformed=!0;const e=RM._transformer.argument[this.name];e&&(this.args=e(this.args)),this.stringifyArguments()}this.resolve=this._convertValue(e),this.errorStack?this.reject=e=>{t((0,TM.optimizeErrorStack)(e,this.errorStack.stack,__dirname))}:this.reject=t}));this.promise=(0,CM.default)(e,this.callback)}_iterateKeys(e=(e=>e)){if(void 0===this.keys&&(this.keys=[],(0,AM.exists)(this.name))){const t=(0,AM.getKeyIndexes)(this.name,this.args);for(const r of t)this.args[r]=e(this.args[r]),this.keys.push(this.args[r])}return this.keys}_convertValue(e){return t=>{try{const r=this._commandTimeoutTimer;r&&(clearTimeout(r),delete this._commandTimeoutTimer),e(this.transformReply(t)),this.isResolved=!0}catch(e){this.reject(e)}return this.promise}}}x$.default=RM,RM.FLAGS={VALID_IN_SUBSCRIBER_MODE:["subscribe","psubscribe","unsubscribe","punsubscribe","ssubscribe","sunsubscribe","ping","quit"],VALID_IN_MONITOR_MODE:["monitor","auth"],ENTER_SUBSCRIBER_MODE:["subscribe","psubscribe","ssubscribe"],EXIT_SUBSCRIBER_MODE:["unsubscribe","punsubscribe","sunsubscribe"],WILL_DISCONNECT:["quit"]},RM._transformer={argument:{},reply:{}};const IM=function(e){if(1===e.length){if(e[0]instanceof Map)return(0,TM.convertMapToArray)(e[0]);if("object"==typeof e[0]&&null!==e[0])return(0,TM.convertObjectToArray)(e[0])}return e},xM=function(e){if(2===e.length){if(e[1]instanceof Map)return[e[0]].concat((0,TM.convertMapToArray)(e[1]));if("object"==typeof e[1]&&null!==e[1])return[e[0]].concat((0,TM.convertObjectToArray)(e[1]))}return e};RM.setArgumentTransformer("mset",IM),RM.setArgumentTransformer("msetnx",IM),RM.setArgumentTransformer("hset",xM),RM.setArgumentTransformer("hmset",xM),RM.setReplyTransformer("hgetall",(function(e){if(Array.isArray(e)){const t={};for(let r=0;r<e.length;r+=2){const n=e[r],i=e[r+1];n in t?Object.defineProperty(t,n,{value:i,configurable:!0,enumerable:!0,writable:!0}):t[n]=i}return t}return e}));class jM{constructor(){this.length=0,this.items=[]}push(e){this.length+=Buffer.byteLength(e),this.items.push(e)}toBuffer(){const e=Buffer.allocUnsafe(this.length);let t=0;for(const r of this.items){const n=Buffer.byteLength(r);Buffer.isBuffer(r)?r.copy(e,t):e.write(r,t,n),t+=n}return e}}var PM={};Object.defineProperty(PM,"__esModule",{value:!0});const NM=I$;class $M extends NM.RedisError{constructor(e,t){super(e),this.lastNodeError=t,Error.captureStackTrace(this,this.constructor)}get name(){return this.constructor.name}}PM.default=$M,$M.defaultMessage="Failed to refresh slots cache.";var MM={};Object.defineProperty(MM,"__esModule",{value:!0});const DM=m;class LM extends DM.Readable{constructor(e){super(e),this.opt=e,this._redisCursor="0",this._redisDrained=!1}_read(){if(this._redisDrained)return void this.push(null);const e=[this._redisCursor];this.opt.key&&e.unshift(this.opt.key),this.opt.match&&e.push("MATCH",this.opt.match),this.opt.type&&e.push("TYPE",this.opt.type),this.opt.count&&e.push("COUNT",String(this.opt.count)),this.opt.redis[this.opt.command](e,((e,t)=>{e?this.emit("error",e):(this._redisCursor=t[0]instanceof Buffer?t[0].toString():t[0],"0"===this._redisCursor&&(this._redisDrained=!0),this.push(t[1]))}))}close(){this._redisDrained=!0}}MM.default=LM;var BM={},KM={},FM={},UM={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.executeWithAutoPipelining=e.getFirstValueInFlattenedArray=e.shouldUseAutoPipelining=e.notAllowedAutoPipelineCommands=e.kCallbacks=e.kExec=void 0;const t=D$,r=$$,n=b$;function i(t,r){if(t._runningAutoPipelines.has(r))return;if(!t._autoPipelines.has(r))return;t._runningAutoPipelines.add(r);const n=t._autoPipelines.get(r);t._autoPipelines.delete(r);const s=n[e.kCallbacks];n[e.kCallbacks]=null,n.exec((function(e,n){if(t._runningAutoPipelines.delete(r),e)for(let t=0;t<s.length;t++)process.nextTick(s[t],e);else for(let e=0;e<s.length;e++)process.nextTick(s[e],...n[e]);t._autoPipelines.has(r)&&i(t,r)}))}function s(e){for(let r=0;r<e.length;r++){const n=e[r];if("string"==typeof n)return n;if(Array.isArray(n)||(0,t.isArguments)(n)){if(0===n.length)continue;return n[0]}const i=[n].flat();if(i.length>0)return i[0]}}e.kExec=Symbol("exec"),e.kCallbacks=Symbol("callbacks"),e.notAllowedAutoPipelineCommands=["auth","info","script","quit","cluster","pipeline","multi","subscribe","psubscribe","unsubscribe","unpsubscribe","select"],e.shouldUseAutoPipelining=function(t,r,n){return r&&t.options.enableAutoPipelining&&!t.isPipeline&&!e.notAllowedAutoPipelineCommands.includes(n)&&!t.options.autoPipeliningIgnoredCommands.includes(n)},e.getFirstValueInFlattenedArray=s,e.executeWithAutoPipelining=function o(a,c,l,u,d){if(a.isCluster&&!a.slots.length)return"wait"===a.status&&a.connect().catch(t.noop),(0,n.default)(new Promise((function(e,t){a.delayUntilReady((r=>{r?t(r):o(a,c,l,u,null).then(e,t)}))})),d);const f=a.options.keyPrefix||"",p=a.isCluster?a.slots[r(`${f}${s(u)}`)].join(","):"main";if(!a._autoPipelines.has(p)){const t=a.pipeline();t[e.kExec]=!1,t[e.kCallbacks]=[],a._autoPipelines.set(p,t)}const h=a._autoPipelines.get(p);h[e.kExec]||(h[e.kExec]=!0,setImmediate(i,a,p));const m=new Promise((function(t,r){h[e.kCallbacks].push((function(e,n){e?r(e):t(n)})),"call"===c&&u.unshift(l),h[c](...u)}));return(0,n.default)(m,d)}}(UM);var WM={};Object.defineProperty(WM,"__esModule",{value:!0});const JM=s,HM=x$,GM=b$;WM.default=class{constructor(e,t=null,r="",n=!1){this.lua=e,this.numberOfKeys=t,this.keyPrefix=r,this.readOnly=n,this.sha=(0,JM.createHash)("sha1").update(e).digest("hex");const i=this.sha,s=new WeakSet;this.Command=class extends HM.default{toWritable(t){const r=this.reject;return this.reject=e=>{-1!==e.message.indexOf("NOSCRIPT")&&s.delete(t),r.call(this,e)},s.has(t)?"eval"===this.name&&(this.name="evalsha",this.args[0]=i):(s.add(t),this.name="eval",this.args[0]=e),super.toWritable(t)}}}execute(e,t,r,n){"number"==typeof this.numberOfKeys&&t.unshift(this.numberOfKeys),this.keyPrefix&&(r.keyPrefix=this.keyPrefix),this.readOnly&&(r.readOnly=!0);const i=new this.Command("evalsha",[this.sha,...t],r);return i.promise=i.promise.catch((n=>{if(-1===n.message.indexOf("NOSCRIPT"))throw n;const i=new this.Command("evalsha",[this.sha,...t],r);return(e.isPipeline?e.redis:e).sendCommand(i)})),(0,GM.default)(i.promise,n),e.sendCommand(i)}},Object.defineProperty(FM,"__esModule",{value:!0});const zM=_$,VM=UM,qM=x$,XM=WM;class YM{constructor(){this.options={},this.scriptsSet={},this.addedBuiltinSet=new Set}getBuiltinCommands(){return ZM.slice(0)}createBuiltinCommand(e){return{string:QM(null,e,"utf8"),buffer:QM(null,e,null)}}addBuiltinCommand(e){this.addedBuiltinSet.add(e),this[e]=QM(e,e,"utf8"),this[e+"Buffer"]=QM(e+"Buffer",e,null)}defineCommand(e,t){const r=new XM.default(t.lua,t.numberOfKeys,this.options.keyPrefix,t.readOnly);this.scriptsSet[e]=r,this[e]=eD(e,e,r,"utf8"),this[e+"Buffer"]=eD(e+"Buffer",e,r,null)}sendCommand(e,t,r){throw new Error('"sendCommand" is not implemented')}}const ZM=zM.list.filter((e=>"monitor"!==e));function QM(e,t,r){return void 0===r&&(r=t,t=null),function(...n){const i=t||n.shift();let s=n[n.length-1];"function"==typeof s?n.pop():s=void 0;const o={errorStack:this.options.showFriendlyErrorStack?new Error:void 0,keyPrefix:this.options.keyPrefix,replyEncoding:r};return(0,VM.shouldUseAutoPipelining)(this,e,i)?(0,VM.executeWithAutoPipelining)(this,e,i,n,s):this.sendCommand(new qM.default(i,n,o,s))}}function eD(e,t,r,n){return function(...i){const s="function"==typeof i[i.length-1]?i.pop():void 0,o={replyEncoding:n};return this.options.showFriendlyErrorStack&&(o.errorStack=new Error),(0,VM.shouldUseAutoPipelining)(this,e,t)?(0,VM.executeWithAutoPipelining)(this,e,t,i,s):r.execute(this,i,o,s)}}ZM.push("sentinel"),ZM.forEach((function(e){YM.prototype[e]=QM(e,e,"utf8"),YM.prototype[e+"Buffer"]=QM(e+"Buffer",e,null)})),YM.prototype.call=QM("call","utf8"),YM.prototype.callBuffer=QM("callBuffer",null),YM.prototype.send_command=YM.prototype.call,FM.default=YM,Object.defineProperty(KM,"__esModule",{value:!0});const tD=$$,rD=_$,nD=b$,iD=t,sD=x$,oD=M$,aD=FM;class cD extends aD.default{constructor(e){super(),this.redis=e,this.isPipeline=!0,this.replyPending=0,this._queue=[],this._result=[],this._transactions=0,this._shaToScript={},this.isCluster="Cluster"===this.redis.constructor.name||this.redis.isCluster,this.options=e.options,Object.keys(e.scriptsSet).forEach((t=>{const r=e.scriptsSet[t];this._shaToScript[r.sha]=r,this[t]=e[t],this[t+"Buffer"]=e[t+"Buffer"]})),e.addedBuiltinSet.forEach((t=>{this[t]=e[t],this[t+"Buffer"]=e[t+"Buffer"]})),this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}));const t=this;Object.defineProperty(this,"length",{get:function(){return t._queue.length}})}fillResult(e,t){if("exec"===this._queue[t].name&&Array.isArray(e[1])){const r=e[1].length;for(let n=0;n<r;n++){if(e[1][n]instanceof Error)continue;const i=this._queue[t-(r-n)];try{e[1][n]=i.transformReply(e[1][n])}catch(t){e[1][n]=t}}}if(this._result[t]=e,--this.replyPending)return;if(this.isCluster){let e,t=!0;for(let r=0;r<this._result.length;++r){const n=this._result[r][0],i=this._queue[r];if(n){if("exec"===i.name&&"EXECABORT Transaction discarded because of previous errors."===n.message)continue;if(e){if(e.name!==n.name||e.message!==n.message){t=!1;break}}else e={name:n.name,message:n.message}}else if(!i.inTransaction){if(!((0,rD.exists)(i.name)&&(0,rD.hasFlag)(i.name,"readonly"))){t=!1;break}}}if(e&&t){const t=this,r=e.message.split(" "),n=this._queue;let i=!1;this._queue=[];for(let e=0;e<n.length;++e){if(!("ASK"!==r[0]||i||"asking"===n[e].name||n[e-1]&&"asking"===n[e-1].name)){const e=new sD.default("asking");e.ignore=!0,this.sendCommand(e)}n[e].initPromise(),this.sendCommand(n[e]),i=n[e].inTransaction}let s=!0;void 0===this.leftRedirections&&(this.leftRedirections={});const o=function(){t.exec()},a=this.redis;if(a.handleError(e,this.leftRedirections,{moved:function(e,n){t.preferKey=n,a.slots[r[1]]=[n],a._groupsBySlot[r[1]]=a._groupsIds[a.slots[r[1]].join(";")],a.refreshSlotsCache(),t.exec()},ask:function(e,r){t.preferKey=r,t.exec()},tryagain:o,clusterDown:o,connectionClosed:o,maxRedirections:()=>{s=!1},defaults:()=>{s=!1}}),s)return}}let r=0;for(let e=0;e<this._queue.length-r;++e)this._queue[e+r].ignore&&(r+=1),this._result[e]=this._result[e+r];this.resolve(this._result.slice(0,this._result.length-r))}sendCommand(e){this._transactions>0&&(e.inTransaction=!0);const t=this._queue.length;return e.pipelineIndex=t,e.promise.then((e=>{this.fillResult([null,e],t)})).catch((e=>{this.fillResult([e],t)})),this._queue.push(e),this}addBatch(e){let t,r,n;for(let i=0;i<e.length;++i)t=e[i],r=t[0],n=t.slice(1),this[r].apply(this,n);return this}}KM.default=cD;const lD=cD.prototype.multi;cD.prototype.multi=function(){return this._transactions+=1,lD.apply(this,arguments)};const uD=cD.prototype.execBuffer;cD.prototype.execBuffer=(0,iD.deprecate)((function(){return this._transactions>0&&(this._transactions-=1),uD.apply(this,arguments)}),"Pipeline#execBuffer: Use Pipeline#exec instead"),cD.prototype.exec=function(e){if(this.isCluster&&!this.redis.slots.length)return"wait"===this.redis.status&&this.redis.connect().catch(oD.noop),e&&!this.nodeifiedPromise&&(this.nodeifiedPromise=!0,(0,nD.default)(this.promise,e)),this.redis.delayUntilReady((t=>{t?this.reject(t):this.exec(e)})),this.promise;if(this._transactions>0)return this._transactions-=1,uD.apply(this,arguments);let t;if(this.nodeifiedPromise||(this.nodeifiedPromise=!0,(0,nD.default)(this.promise,e)),this._queue.length||this.resolve([]),this.isCluster){const e=[];for(let t=0;t<this._queue.length;t++){const r=this._queue[t].getKeys();if(r.length&&e.push(r[0]),r.length&&tD.generateMulti(r)<0)return this.reject(new Error("All the keys in a pipeline command should belong to the same slot")),this.promise}if(e.length){if(t=function(e,t){const r=tD(t[0]),n=e._groupsBySlot[r];for(let r=1;r<t.length;r++)if(e._groupsBySlot[tD(t[r])]!==n)return-1;return r}(this.redis,e),t<0)return this.reject(new Error("All keys in the pipeline should belong to the same slots allocation group")),this.promise}else t=16384*Math.random()|0}const r=this;return function(){let e,n=r.replyPending=r._queue.length;r.isCluster&&(e={slot:t,redis:r.redis.connectionPool.nodes.all[r.preferKey]});let i,s="";const o={isPipeline:!0,destination:r.isCluster?e:{redis:r.redis},write(e){"string"!=typeof e?(i||(i=[]),s&&(i.push(Buffer.from(s,"utf8")),s=""),i.push(e)):s+=e,--n||(i?(s&&i.push(Buffer.from(s,"utf8")),o.destination.redis.stream.write(Buffer.concat(i))):o.destination.redis.stream.write(s),n=r._queue.length,s="",i=void 0)}};for(let t=0;t<r._queue.length;++t)r.redis.sendCommand(r._queue[t],o,e);r.promise}(),this.promise},Object.defineProperty(BM,"__esModule",{value:!0}),BM.addTransactionSupport=void 0;const dD=M$,fD=b$,pD=KM;BM.addTransactionSupport=function(e){e.pipeline=function(e){const t=new pD.default(this);return Array.isArray(e)&&t.addBatch(e),t};const{multi:t}=e;e.multi=function(e,r){if(void 0!==r||Array.isArray(e)||(r=e,e=null),r&&!1===r.pipeline)return t.call(this);const n=new pD.default(this);n.multi(),Array.isArray(e)&&n.addBatch(e);const i=n.exec;n.exec=function(e){if(this.isCluster&&!this.redis.slots.length)return"wait"===this.redis.status&&this.redis.connect().catch(dD.noop),(0,fD.default)(new Promise(((e,t)=>{this.redis.delayUntilReady((r=>{r?t(r):this.exec(n).then(e,t)}))})),e);if(this._transactions>0&&i.call(n),this.nodeifiedPromise)return i.call(n);const t=i.call(n);return(0,fD.default)(t.then((function(e){const t=e[e.length-1];if(void 0===t)throw new Error("Pipeline cannot be used to send any commands when the `exec()` has been called on it.");if(t[0]){t[0].previousErrors=[];for(let r=0;r<e.length-1;++r)e[r][0]&&t[0].previousErrors.push(e[r][0]);throw t[0]}return(0,dD.wrapMultiResult)(t[1])})),e)};const{execBuffer:s}=n;return n.execBuffer=function(e){return this._transactions>0&&s.call(n),n.exec(e)},n};const{exec:r}=e;e.exec=function(e){return(0,fD.default)(r.call(this).then((function(e){return Array.isArray(e)&&(e=(0,dD.wrapMultiResult)(e)),e})),e)}};var hD={};Object.defineProperty(hD,"__esModule",{value:!0}),hD.default=function(e,t){Object.getOwnPropertyNames(t.prototype).forEach((r=>{Object.defineProperty(e.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r))}))};var mD={};Object.defineProperty(mD,"__esModule",{value:!0}),mD.DEFAULT_CLUSTER_OPTIONS=void 0;const yD=y;mD.DEFAULT_CLUSTER_OPTIONS={clusterRetryStrategy:e=>Math.min(100+2*e,2e3),enableOfflineQueue:!0,enableReadyCheck:!0,scaleReads:"master",maxRedirections:16,retryDelayOnMoved:0,retryDelayOnFailover:100,retryDelayOnClusterDown:100,retryDelayOnTryAgain:100,slotsRefreshTimeout:1e3,useSRVRecords:!1,resolveSrv:yD.resolveSrv,dnsLookup:yD.lookup,enableAutoPipelining:!1,autoPipeliningIgnoredCommands:[]};var gD={},_D={};Object.defineProperty(_D,"__esModule",{value:!0}),_D.getConnectionName=_D.weightSrvRecords=_D.groupSrvRecords=_D.getUniqueHostnamesFromOptions=_D.normalizeNodeOptions=_D.nodeKeyToRedisOptions=_D.getNodeKey=void 0;const vD=M$,bD=g;var wD;_D.getNodeKey=function(e){return e.port=e.port||6379,e.host=e.host||"127.0.0.1",e.host+":"+e.port},_D.nodeKeyToRedisOptions=function(e){const t=e.lastIndexOf(":");if(-1===t)throw new Error(`Invalid node key ${e}`);return{host:e.slice(0,t),port:Number(e.slice(t+1))}},_D.normalizeNodeOptions=function(e){return e.map((e=>{const t={};if("object"==typeof e)Object.assign(t,e);else if("string"==typeof e)Object.assign(t,(0,vD.parseURL)(e));else{if("number"!=typeof e)throw new Error("Invalid argument "+e);t.port=e}return"string"==typeof t.port&&(t.port=parseInt(t.port,10)),delete t.db,t.port||(t.port=6379),t.host||(t.host="127.0.0.1"),(0,vD.resolveTLSProfile)(t)}))},_D.getUniqueHostnamesFromOptions=function(e){const t={};return e.forEach((e=>{t[e.host]=!0})),Object.keys(t).filter((e=>!(0,bD.isIP)(e)))},_D.groupSrvRecords=function(e){const t={};for(const r of e)t.hasOwnProperty(r.priority)?(t[r.priority].totalWeight+=r.weight,t[r.priority].records.push(r)):t[r.priority]={totalWeight:r.weight,records:[r]};return t},_D.weightSrvRecords=function(e){if(1===e.records.length)return e.totalWeight=0,e.records.shift();const t=Math.floor(Math.random()*(e.totalWeight+e.records.length));let r=0;for(const[n,i]of e.records.entries())if(r+=1+i.weight,r>t)return e.totalWeight-=i.weight,e.records.splice(n,1),i},_D.getConnectionName=function(e,t){const r=`ioredis-cluster(${e})`;return t?`${r}:${t}`:r};var SD,ED={};var kD={};function AD(e,t){t=t||{};this._capacity=t.capacity,this._head=0,this._tail=0,Array.isArray(e)?this._fromArray(e):(this._capacityMask=3,this._list=new Array(4))}AD.prototype.peekAt=function(e){var t=e;if(t===(0|t)){var r=this.size();if(!(t>=r||t<-r))return t<0&&(t+=r),t=this._head+t&this._capacityMask,this._list[t]}},AD.prototype.get=function(e){return this.peekAt(e)},AD.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},AD.prototype.peekFront=function(){return this.peek()},AD.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(AD.prototype,"length",{get:function(){return this.size()}}),AD.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},AD.prototype.unshift=function(e){if(0===arguments.length)return this.size();var t=this._list.length;return this._head=this._head-1+t&this._capacityMask,this._list[this._head]=e,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.pop(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},AD.prototype.shift=function(){var e=this._head;if(e!==this._tail){var t=this._list[e];return this._list[e]=void 0,this._head=e+1&this._capacityMask,e<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},AD.prototype.push=function(e){if(0===arguments.length)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},AD.prototype.pop=function(){var e=this._tail;if(e!==this._head){var t=this._list.length;this._tail=e-1+t&this._capacityMask;var r=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=t>>>2&&this._shrinkArray(),r}},AD.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var r=this.size(),n=this._list.length;if(!(t>=r||t<-r)){t<0&&(t+=r),t=this._head+t&this._capacityMask;var i,s=this._list[t];if(e<r/2){for(i=e;i>0;i--)this._list[t]=this._list[t=t-1+n&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+n&this._capacityMask}else{for(i=r-1-e;i>0;i--)this._list[t]=this._list[t=t+1+n&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+n&this._capacityMask}return s}}},AD.prototype.remove=function(e,t){var r,n=e,i=t;if(n===(0|n)&&this._head!==this._tail){var s=this.size(),o=this._list.length;if(!(n>=s||n<-s||t<1)){if(n<0&&(n+=s),1===t||!t)return(r=new Array(1))[0]=this.removeOne(n),r;if(0===n&&n+t>=s)return r=this.toArray(),this.clear(),r;var a;for(n+t>s&&(t=s-n),r=new Array(t),a=0;a<t;a++)r[a]=this._list[this._head+n+a&this._capacityMask];if(n=this._head+n&this._capacityMask,e+t===s){for(this._tail=this._tail-t+o&this._capacityMask,a=t;a>0;a--)this._list[n=n+1+o&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+o&this._capacityMask,a=t-1;a>0;a--)this._list[n=n+1+o&this._capacityMask]=void 0;return r}if(n<s/2){for(this._head=this._head+e+t+o&this._capacityMask,a=e;a>0;a--)this.unshift(this._list[n=n-1+o&this._capacityMask]);for(n=this._head-1+o&this._capacityMask;i>0;)this._list[n=n-1+o&this._capacityMask]=void 0,i--;e<0&&(this._tail=n)}else{for(this._tail=n,n=n+t+o&this._capacityMask,a=s-(t+e);a>0;a--)this.push(this._list[n++]);for(n=this._tail;i>0;)this._list[n=n+1+o&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=o>>>2&&this._shrinkArray(),r}}},AD.prototype.splice=function(e,t){var r=e;if(r===(0|r)){var n=this.size();if(r<0&&(r+=n),!(r>n)){if(arguments.length>2){var i,s,o,a=arguments.length,c=this._list.length,l=2;if(!n||r<n/2){for(s=new Array(r),i=0;i<r;i++)s[i]=this._list[this._head+i&this._capacityMask];for(0===t?(o=[],r>0&&(this._head=this._head+r+c&this._capacityMask)):(o=this.remove(r,t),this._head=this._head+r+c&this._capacityMask);a>l;)this.unshift(arguments[--a]);for(i=r;i>0;i--)this.unshift(s[i-1])}else{var u=(s=new Array(n-(r+t))).length;for(i=0;i<u;i++)s[i]=this._list[this._head+r+t+i&this._capacityMask];for(0===t?(o=[],r!=n&&(this._tail=this._head+r+c&this._capacityMask)):(o=this.remove(r,t),this._tail=this._tail-u+c&this._capacityMask);l<a;)this.push(arguments[l++]);for(i=0;i<u;i++)this.push(s[i])}return o}return this.remove(r,t)}}},AD.prototype.clear=function(){this._list=new Array(this._list.length),this._head=0,this._tail=0},AD.prototype.isEmpty=function(){return this._head===this._tail},AD.prototype.toArray=function(){return this._copyArray(!1)},AD.prototype._fromArray=function(e){var t=e.length,r=this._nextPowerOf2(t);this._list=new Array(r),this._capacityMask=r-1,this._tail=t;for(var n=0;n<t;n++)this._list[n]=e[n]},AD.prototype._copyArray=function(e,t){var r=this._list,n=r.length,i=this.length;if((t|=i)==i&&this._head<this._tail)return this._list.slice(this._head,this._tail);var s,o=new Array(t),a=0;if(e||this._head>this._tail){for(s=this._head;s<n;s++)o[a++]=r[s];for(s=0;s<this._tail;s++)o[a++]=r[s]}else for(s=this._head;s<this._tail;s++)o[a++]=r[s];return o},AD.prototype._growArray=function(){if(0!=this._head){var e=this._copyArray(!0,this._list.length<<1);this._tail=this._list.length,this._head=0,this._list=e}else this._tail=this._list.length,this._list.length<<=1;this._capacityMask=this._capacityMask<<1|1},AD.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1},AD.prototype._nextPowerOf2=function(e){var t=1<<Math.log(e)/Math.log(2)+1;return Math.max(t,4)};var OD=AD;Object.defineProperty(kD,"__esModule",{value:!0});const CD=OD,TD=(0,M$.Debug)("delayqueue");var RD;function ID(){if(RD)return T$;RD=1,Object.defineProperty(T$,"__esModule",{value:!0});const e=_$,t=l,r=I$,n=b$,i=x$,s=PM,o=PL(),a=MM,c=BM,u=M$,d=hD,f=FM,p=mD,h=function(){if(wD)return gD;wD=1,Object.defineProperty(gD,"__esModule",{value:!0});const e=_D,t=M$,r=PL(),n=(0,t.Debug)("cluster:subscriber");return gD.default=class{constructor(t,r){this.connectionPool=t,this.emitter=r,this.started=!1,this.subscriber=null,this.onSubscriberEnd=()=>{this.started?(n("subscriber has disconnected, selecting a new one..."),this.selectSubscriber()):n("subscriber has disconnected, but ClusterSubscriber is not started, so not reconnecting.")},this.connectionPool.on("-node",((t,r)=>{this.started&&this.subscriber&&(0,e.getNodeKey)(this.subscriber.options)===r&&(n("subscriber has left, selecting a new one..."),this.selectSubscriber())})),this.connectionPool.on("+node",(()=>{this.started&&!this.subscriber&&(n("a new node is discovered and there is no subscriber, selecting a new one..."),this.selectSubscriber())}))}getInstance(){return this.subscriber}start(){this.started=!0,this.selectSubscriber(),n("started")}stop(){this.started=!1,this.subscriber&&(this.subscriber.disconnect(),this.subscriber=null),n("stopped")}selectSubscriber(){const i=this.lastActiveSubscriber;i&&(i.off("end",this.onSubscriberEnd),i.disconnect()),this.subscriber&&(this.subscriber.off("end",this.onSubscriberEnd),this.subscriber.disconnect());const s=(0,t.sample)(this.connectionPool.getNodes());if(!s)return n("selecting subscriber failed since there is no node discovered in the cluster yet"),void(this.subscriber=null);const{options:o}=s;n("selected a subscriber %s:%s",o.host,o.port),this.subscriber=new r.default({port:o.port,host:o.host,username:o.username,password:o.password,enableReadyCheck:!0,connectionName:(0,e.getConnectionName)("subscriber",o.connectionName),lazyConnect:!0,tls:o.tls,retryStrategy:null}),this.subscriber.on("error",t.noop),this.subscriber.once("end",this.onSubscriberEnd);const a={subscribe:[],psubscribe:[],ssubscribe:[]};if(i){const e=i.condition||i.prevCondition;e&&e.subscriber&&(a.subscribe=e.subscriber.channels("subscribe"),a.psubscribe=e.subscriber.channels("psubscribe"),a.ssubscribe=e.subscriber.channels("ssubscribe"))}if(a.subscribe.length||a.psubscribe.length||a.ssubscribe.length){let e=0;for(const t of["subscribe","psubscribe","ssubscribe"]){const r=a[t];r.length&&(e+=1,n("%s %d channels",t,r.length),this.subscriber[t](r).then((()=>{--e||(this.lastActiveSubscriber=this.subscriber)})).catch((()=>{n("failed to %s %d channels",t,r.length)})))}}else this.lastActiveSubscriber=this.subscriber;for(const e of["message","messageBuffer","smessage","smessageBuffer"])this.subscriber.on(e,((t,r)=>{this.emitter.emit(e,t,r)}));for(const e of["pmessage","pmessageBuffer"])this.subscriber.on(e,((t,r,n)=>{this.emitter.emit(e,t,r,n)}))}},gD}(),m=function(){if(SD)return ED;SD=1,Object.defineProperty(ED,"__esModule",{value:!0});const e=l,t=M$,r=_D,n=PL(),i=(0,t.Debug)("cluster:connectionPool");let s=class extends e.EventEmitter{constructor(e){super(),this.redisOptions=e,this.nodes={all:{},master:{},slave:{}},this.specifiedOptions={}}getNodes(e="all"){const t=this.nodes[e];return Object.keys(t).map((e=>t[e]))}getInstanceByKey(e){return this.nodes.all[e]}getSampleInstance(e){const r=Object.keys(this.nodes[e]),n=(0,t.sample)(r);return this.nodes[e][n]}findOrCreate(e,s=!1){const o=(0,r.getNodeKey)(e);let a;return s=Boolean(s),this.specifiedOptions[o]?Object.assign(e,this.specifiedOptions[o]):this.specifiedOptions[o]=e,this.nodes.all[o]?(a=this.nodes.all[o],a.options.readOnly!==s&&(a.options.readOnly=s,i("Change role of %s to %s",o,s?"slave":"master"),a[s?"readonly":"readwrite"]().catch(t.noop),s?(delete this.nodes.master[o],this.nodes.slave[o]=a):(delete this.nodes.slave[o],this.nodes.master[o]=a))):(i("Connecting to %s as %s",o,s?"slave":"master"),a=new n.default((0,t.defaults)({retryStrategy:null,enableOfflineQueue:!0,readOnly:s},e,this.redisOptions,{lazyConnect:!0})),this.nodes.all[o]=a,this.nodes[s?"slave":"master"][o]=a,a.once("end",(()=>{this.removeNode(o),this.emit("-node",a,o),Object.keys(this.nodes.all).length||this.emit("drain")})),this.emit("+node",a,o),a.on("error",(function(e){this.emit("nodeError",e,o)}))),a}reset(e){i("Reset with %O",e);const t={};e.forEach((e=>{const n=(0,r.getNodeKey)(e);e.readOnly&&t[n]||(t[n]=e)})),Object.keys(this.nodes.all).forEach((e=>{t[e]||(i("Disconnect %s because the node does not hold any slot",e),this.nodes.all[e].disconnect(),this.removeNode(e))})),Object.keys(t).forEach((e=>{const r=t[e];this.findOrCreate(r,r.readOnly)}))}removeNode(e){const{nodes:t}=this;t.all[e]&&(i("Remove %s from the pool",e),delete t.all[e]),delete t.master[e],delete t.slave[e]}};return ED.default=s,ED}(),y=kD,g=_D,_=OD,v=(0,u.Debug)("cluster"),b=new WeakSet;class w extends f.default{constructor(e,r={}){if(super(),this.slots=[],this._groupsIds={},this._groupsBySlot=Array(16384),this.isCluster=!0,this.retryAttempts=0,this.delayQueue=new y.default,this.offlineQueue=new _,this.isRefreshing=!1,this._refreshSlotsCacheCallbacks=[],this._autoPipelines=new Map,this._runningAutoPipelines=new Set,this._readyDelayedCallbacks=[],this.connectionEpoch=0,t.EventEmitter.call(this),this.startupNodes=e,this.options=(0,u.defaults)({},r,p.DEFAULT_CLUSTER_OPTIONS,this.options),this.options.redisOptions&&this.options.redisOptions.keyPrefix&&!this.options.keyPrefix&&(this.options.keyPrefix=this.options.redisOptions.keyPrefix),"function"!=typeof this.options.scaleReads&&-1===["all","master","slave"].indexOf(this.options.scaleReads))throw new Error('Invalid option scaleReads "'+this.options.scaleReads+'". Expected "all", "master", "slave" or a custom function');this.connectionPool=new m.default(this.options.redisOptions),this.connectionPool.on("-node",((e,t)=>{this.emit("-node",e)})),this.connectionPool.on("+node",(e=>{this.emit("+node",e)})),this.connectionPool.on("drain",(()=>{this.setStatus("close")})),this.connectionPool.on("nodeError",((e,t)=>{this.emit("node error",e,t)})),this.subscriber=new h.default(this.connectionPool,this),this.options.scripts&&Object.entries(this.options.scripts).forEach((([e,t])=>{this.defineCommand(e,t)})),this.options.lazyConnect?this.setStatus("wait"):this.connect().catch((e=>{v("connecting failed: %s",e)}))}connect(){return new Promise(((e,t)=>{if("connecting"===this.status||"connect"===this.status||"ready"===this.status)return void t(new Error("Redis is already connecting/connected"));const n=++this.connectionEpoch;this.setStatus("connecting"),this.resolveStartupNodeHostnames().then((i=>{if(this.connectionEpoch!==n)return v("discard connecting after resolving startup nodes because epoch not match: %d != %d",n,this.connectionEpoch),void t(new r.RedisError("Connection is discarded because a new connection is made"));if("connecting"!==this.status)return v("discard connecting after resolving startup nodes because the status changed to %s",this.status),void t(new r.RedisError("Connection is aborted"));this.connectionPool.reset(i);const a=()=>{this.setStatus("ready"),this.retryAttempts=0,this.executeOfflineCommands(),this.resetNodesRefreshInterval(),e()};let c;const l=()=>{this.invokeReadyDelayedCallbacks(void 0),this.removeListener("close",c),this.manuallyClosing=!1,this.setStatus("connect"),this.options.enableReadyCheck?this.readyCheck(((e,t)=>{e||t?(v("Ready check failed (%s). Reconnecting...",e||t),"connect"===this.status&&this.disconnect(!0)):a()})):a()};c=()=>{const e=new Error("None of startup nodes is available");this.removeListener("refresh",l),this.invokeReadyDelayedCallbacks(e),t(e)},this.once("refresh",l),this.once("close",c),this.once("close",this.handleCloseEvent.bind(this)),this.refreshSlotsCache((e=>{e&&e.message===s.default.defaultMessage&&(o.default.prototype.silentEmit.call(this,"error",e),this.connectionPool.reset([]))})),this.subscriber.start()})).catch((e=>{this.setStatus("close"),this.handleCloseEvent(e),this.invokeReadyDelayedCallbacks(e),t(e)}))}))}disconnect(e=!1){const t=this.status;this.setStatus("disconnecting"),e||(this.manuallyClosing=!0),this.reconnectTimeout&&!e&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null,v("Canceled reconnecting attempts")),this.clearNodesRefreshInterval(),this.subscriber.stop(),"wait"===t?(this.setStatus("close"),this.handleCloseEvent()):this.connectionPool.reset([])}quit(e){const t=this.status;if(this.setStatus("disconnecting"),this.manuallyClosing=!0,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.clearNodesRefreshInterval(),this.subscriber.stop(),"wait"===t){const t=(0,n.default)(Promise.resolve("OK"),e);return setImmediate(function(){this.setStatus("close"),this.handleCloseEvent()}.bind(this)),t}return(0,n.default)(Promise.all(this.nodes().map((e=>e.quit().catch((e=>{if(e.message===u.CONNECTION_CLOSED_ERROR_MSG)return"OK";throw e}))))).then((()=>"OK")),e)}duplicate(e=[],t={}){const r=e.length>0?e:this.startupNodes.slice(0),n=Object.assign({},this.options,t);return new w(r,n)}nodes(e="all"){if("all"!==e&&"master"!==e&&"slave"!==e)throw new Error('Invalid role "'+e+'". Expected "all", "master" or "slave"');return this.connectionPool.getNodes(e)}delayUntilReady(e){this._readyDelayedCallbacks.push(e)}get autoPipelineQueueSize(){let e=0;for(const t of this._autoPipelines.values())e+=t.length;return e}refreshSlotsCache(e){if(e&&this._refreshSlotsCacheCallbacks.push(e),this.isRefreshing)return;this.isRefreshing=!0;const t=this,r=e=>{this.isRefreshing=!1;for(const t of this._refreshSlotsCacheCallbacks)t(e);this._refreshSlotsCacheCallbacks=[]},n=(0,u.shuffle)(this.connectionPool.getNodes());let i=null;!function e(o){if(o===n.length){const e=new s.default(s.default.defaultMessage,i);return r(e)}const a=n[o],c=`${a.options.host}:${a.options.port}`;v("getting slot cache from %s",c),t.getInfoFromNode(a,(function(n){switch(t.status){case"close":case"end":return r(new Error("Cluster is disconnected."));case"disconnecting":return r(new Error("Cluster is disconnecting."))}n?(t.emit("node error",n,c),i=n,e(o+1)):(t.emit("refresh"),r())}))}(0)}sendCommand(t,n,s){if("wait"===this.status&&this.connect().catch(u.noop),"end"===this.status)return t.reject(new Error(u.CONNECTION_CLOSED_ERROR_MSG)),t.promise;let o=this.options.scaleReads;if("master"!==o){t.isReadOnly||(0,e.exists)(t.name)&&(0,e.hasFlag)(t.name,"readonly")||(o="master")}let a=s?s.slot:t.getSlot();const c={},l=this;if(!s&&!b.has(t)){b.add(t);const e=t.reject;t.reject=function(r){const n=d.bind(null,!0);l.handleError(r,c,{moved:function(e,r){v("command %s is moved to %s",t.name,r),a=Number(e),l.slots[e]?l.slots[e][0]=r:l.slots[e]=[r],l._groupsBySlot[e]=l._groupsIds[l.slots[e].join(";")],l.connectionPool.findOrCreate(l.natMapper(r)),d(),v("refreshing slot caches... (triggered by MOVED error)"),l.refreshSlotsCache()},ask:function(e,r){v("command %s is required to ask %s:%s",t.name,r);const n=l.natMapper(r);l.connectionPool.findOrCreate(n),d(!1,`${n.host}:${n.port}`)},tryagain:n,clusterDown:n,connectionClosed:n,maxRedirections:function(r){e.call(t,r)},defaults:function(){e.call(t,r)}})}}function d(e,c){if("end"===l.status)return void t.reject(new r.AbortError("Cluster is ended."));let d;if("ready"===l.status||"cluster"===t.name){if(s&&s.redis)d=s.redis;else if(i.default.checkFlag("ENTER_SUBSCRIBER_MODE",t.name)||i.default.checkFlag("EXIT_SUBSCRIBER_MODE",t.name)){if(d=l.subscriber.getInstance(),!d)return void t.reject(new r.AbortError("No subscriber for the cluster"))}else{if(!e){if("number"==typeof a&&l.slots[a]){const e=l.slots[a];if("function"==typeof o){const r=e.map((function(e){return l.connectionPool.getInstanceByKey(e)}));d=o(r,t),Array.isArray(d)&&(d=(0,u.sample)(d)),d||(d=r[0])}else{let t;t="all"===o?(0,u.sample)(e):"slave"===o&&e.length>1?(0,u.sample)(e,1):e[0],d=l.connectionPool.getInstanceByKey(t)}}c&&(d=l.connectionPool.getInstanceByKey(c),d.asking())}d||(d=("function"==typeof o?null:l.connectionPool.getSampleInstance(o))||l.connectionPool.getSampleInstance("all"))}s&&!s.redis&&(s.redis=d)}d?d.sendCommand(t,n):l.options.enableOfflineQueue?l.offlineQueue.push({command:t,stream:n,node:s}):t.reject(new Error("Cluster isn't ready and enableOfflineQueue options is false"))}return d(),t.promise}sscanStream(e,t){return this.createScanStream("sscan",{key:e,options:t})}sscanBufferStream(e,t){return this.createScanStream("sscanBuffer",{key:e,options:t})}hscanStream(e,t){return this.createScanStream("hscan",{key:e,options:t})}hscanBufferStream(e,t){return this.createScanStream("hscanBuffer",{key:e,options:t})}zscanStream(e,t){return this.createScanStream("zscan",{key:e,options:t})}zscanBufferStream(e,t){return this.createScanStream("zscanBuffer",{key:e,options:t})}handleError(e,t,r){if(void 0===t.value?t.value=this.options.maxRedirections:t.value-=1,t.value<=0)return void r.maxRedirections(new Error("Too many Cluster redirections. Last error: "+e));const n=e.message.split(" ");if("MOVED"===n[0]){const e=this.options.retryDelayOnMoved;e&&"number"==typeof e?this.delayQueue.push("moved",r.moved.bind(null,n[1],n[2]),{timeout:e}):r.moved(n[1],n[2])}else"ASK"===n[0]?r.ask(n[1],n[2]):"TRYAGAIN"===n[0]?this.delayQueue.push("tryagain",r.tryagain,{timeout:this.options.retryDelayOnTryAgain}):"CLUSTERDOWN"===n[0]&&this.options.retryDelayOnClusterDown>0?this.delayQueue.push("clusterdown",r.connectionClosed,{timeout:this.options.retryDelayOnClusterDown,callback:this.refreshSlotsCache.bind(this)}):e.message===u.CONNECTION_CLOSED_ERROR_MSG&&this.options.retryDelayOnFailover>0&&"ready"===this.status?this.delayQueue.push("failover",r.connectionClosed,{timeout:this.options.retryDelayOnFailover,callback:this.refreshSlotsCache.bind(this)}):r.defaults()}resetOfflineQueue(){this.offlineQueue=new _}clearNodesRefreshInterval(){this.slotsTimer&&(clearTimeout(this.slotsTimer),this.slotsTimer=null)}resetNodesRefreshInterval(){if(this.slotsTimer||!this.options.slotsRefreshInterval)return;const e=()=>{this.slotsTimer=setTimeout((()=>{v('refreshing slot caches... (triggered by "slotsRefreshInterval" option)'),this.refreshSlotsCache((()=>{e()}))}),this.options.slotsRefreshInterval)};e()}setStatus(e){v("status: %s -> %s",this.status||"[empty]",e),this.status=e,process.nextTick((()=>{this.emit(e)}))}handleCloseEvent(e){let t;e&&v("closed because %s",e),this.manuallyClosing||"function"!=typeof this.options.clusterRetryStrategy||(t=this.options.clusterRetryStrategy.call(this,++this.retryAttempts,e)),"number"==typeof t?(this.setStatus("reconnecting"),this.reconnectTimeout=setTimeout((()=>{this.reconnectTimeout=null,v("Cluster is disconnected. Retrying after %dms",t),this.connect().catch((function(e){v("Got error %s when reconnecting. Ignoring...",e)}))}),t)):(this.setStatus("end"),this.flushQueue(new Error("None of startup nodes is available")))}flushQueue(e){let t;for(;t=this.offlineQueue.shift();)t.command.reject(e)}executeOfflineCommands(){if(this.offlineQueue.length){v("send %d commands in offline queue",this.offlineQueue.length);const e=this.offlineQueue;let t;for(this.resetOfflineQueue();t=e.shift();)this.sendCommand(t.command,t.stream,t.node)}}natMapper(e){if(this.options.natMap&&"object"==typeof this.options.natMap){const t="string"==typeof e?e:`${e.host}:${e.port}`,r=this.options.natMap[t];if(r)return v("NAT mapping %s -> %O",t,r),Object.assign({},r)}return"string"==typeof e?(0,g.nodeKeyToRedisOptions)(e):e}getInfoFromNode(e,t){if(!e)return t(new Error("Node is disconnected"));const r=e.duplicate({enableOfflineQueue:!0,enableReadyCheck:!1,retryStrategy:null,connectionName:(0,g.getConnectionName)("refresher",this.options.redisOptions&&this.options.redisOptions.connectionName)});r.on("error",u.noop),r.cluster("SLOTS",(0,u.timeout)(((e,n)=>{if(r.disconnect(),e)return t(e);if("disconnecting"===this.status||"close"===this.status||"end"===this.status)return v("ignore CLUSTER.SLOTS results (count: %d) since cluster status is %s",n.length,this.status),void t();const i=[];v("cluster slots result count: %d",n.length);for(let e=0;e<n.length;++e){const t=n[e],r=t[0],s=t[1],o=[];for(let e=2;e<t.length;e++){if(!t[e][0])continue;const r=this.natMapper({host:t[e][0],port:t[e][1]});r.readOnly=2!==e,i.push(r),o.push(r.host+":"+r.port)}v("cluster slots result [%d]: slots %d~%d served by %s",e,r,s,o);for(let e=r;e<=s;e++)this.slots[e]=o}this._groupsIds=Object.create(null);let s=0;for(let e=0;e<16384;e++){const t=(this.slots[e]||[]).join(";");t.length?(this._groupsIds[t]||(this._groupsIds[t]=++s),this._groupsBySlot[e]=this._groupsIds[t]):this._groupsBySlot[e]=void 0}this.connectionPool.reset(i),t()}),this.options.slotsRefreshTimeout))}invokeReadyDelayedCallbacks(e){for(const t of this._readyDelayedCallbacks)process.nextTick(t,e);this._readyDelayedCallbacks=[]}readyCheck(e){this.cluster("INFO",((t,r)=>{if(t)return e(t);if("string"!=typeof r)return e();let n;const i=r.split("\r\n");for(let e=0;e<i.length;++e){const t=i[e].split(":");if("cluster_state"===t[0]){n=t[1];break}}"fail"===n?(v("cluster state not ok (%s)",n),e(null,n)):e()}))}resolveSrv(e){return new Promise(((t,r)=>{this.options.resolveSrv(e,((e,n)=>{if(e)return r(e);const i=this,s=(0,g.groupSrvRecords)(n),o=Object.keys(s).sort(((e,t)=>parseInt(e)-parseInt(t)));!function e(n){if(!o.length)return r(n);const a=o[0],c=s[a],l=(0,g.weightSrvRecords)(c);c.records.length||o.shift(),i.dnsLookup(l.name).then((e=>t({host:e,port:l.port})),e)}()}))}))}dnsLookup(e){return new Promise(((t,r)=>{this.options.dnsLookup(e,((n,i)=>{n?(v("failed to resolve hostname %s to IP: %s",e,n.message),r(n)):(v("resolved hostname %s to IP %s",e,i),t(i))}))}))}async resolveStartupNodeHostnames(){if(!Array.isArray(this.startupNodes)||0===this.startupNodes.length)throw new Error("`startupNodes` should contain at least one node.");const e=(0,g.normalizeNodeOptions)(this.startupNodes),t=(0,g.getUniqueHostnamesFromOptions)(e);if(0===t.length)return e;const r=await Promise.all(t.map((this.options.useSRVRecords?this.resolveSrv:this.dnsLookup).bind(this))),n=(0,u.zipMap)(t,r);return e.map((e=>{const t=n.get(e.host);return t?this.options.useSRVRecords?Object.assign({},e,t):Object.assign({},e,{host:t}):e}))}createScanStream(e,{key:t,options:r={}}){return new a.default({objectMode:!0,key:t,redis:this,command:e,...r})}}return(0,d.default)(w,t.EventEmitter),(0,c.addTransactionSupport)(w.prototype),T$.default=w,T$}kD.default=class{constructor(){this.queues={},this.timeouts={}}push(e,t,r){const n=r.callback||process.nextTick;this.queues[e]||(this.queues[e]=new CD);this.queues[e].push(t),this.timeouts[e]||(this.timeouts[e]=setTimeout((()=>{n((()=>{this.timeouts[e]=null,this.execute(e)}))}),r.timeout))}execute(e){const t=this.queues[e];if(!t)return;const{length:r}=t;if(r)for(TD("send %d commands in %s queue",r,e),this.queues[e]=null;t.length>0;)t.shift()()}};var xD={},jD={},PD={};Object.defineProperty(PD,"__esModule",{value:!0});const ND=(0,M$.Debug)("AbstractConnector");PD.default=class{constructor(e){this.connecting=!1,this.disconnectTimeout=e}check(e){return!0}disconnect(){if(this.connecting=!1,this.stream){const e=this.stream,t=setTimeout((()=>{ND("stream %s:%s still open, destroying it",e.remoteAddress,e.remotePort),e.destroy()}),this.disconnectTimeout);e.on("close",(()=>clearTimeout(t))),e.end()}}},Object.defineProperty(jD,"__esModule",{value:!0});const $D=g,MD=_,DD=M$,LD=PD;class BD extends LD.default{constructor(e){super(e.disconnectTimeout),this.options=e}connect(e){const{options:t}=this;let r;return this.connecting=!0,"path"in t&&t.path?r={path:t.path}:(r={},"port"in t&&null!=t.port&&(r.port=t.port),"host"in t&&null!=t.host&&(r.host=t.host),"family"in t&&null!=t.family&&(r.family=t.family)),t.tls&&Object.assign(r,t.tls),new Promise(((e,n)=>{process.nextTick((()=>{if(this.connecting){try{t.tls?this.stream=(0,MD.connect)(r):this.stream=(0,$D.createConnection)(r)}catch(e){return void n(e)}this.stream.once("error",(e=>{this.firstError=e})),e(this.stream)}else n(new Error(DD.CONNECTION_CLOSED_ERROR_MSG))}))}))}}jD.default=BD;var KD={},FD={};function UD(e,t){return(e.host||"127.0.0.1")===(t.host||"127.0.0.1")&&(e.port||26379)===(t.port||26379)}Object.defineProperty(FD,"__esModule",{value:!0});FD.default=class{constructor(e){this.cursor=0,this.sentinels=e.slice(0)}next(){const e=this.cursor>=this.sentinels.length;return{done:e,value:e?void 0:this.sentinels[this.cursor++]}}reset(e){e&&this.sentinels.length>1&&1!==this.cursor&&this.sentinels.unshift(...this.sentinels.splice(this.cursor-1)),this.cursor=0}add(e){for(let t=0;t<this.sentinels.length;t++)if(UD(e,this.sentinels[t]))return!1;return this.sentinels.push(e),!0}toString(){return`${JSON.stringify(this.sentinels)} @${this.cursor}`}};var WD={};Object.defineProperty(WD,"__esModule",{value:!0}),WD.FailoverDetector=void 0;const JD=(0,M$.Debug)("FailoverDetector"),HD="+switch-master";var GD,zD;function VD(){if(GD)return KD;GD=1,Object.defineProperty(KD,"__esModule",{value:!0}),KD.SentinelIterator=void 0;const e=g,t=M$,r=_,n=FD;KD.SentinelIterator=n.default;const i=PD,s=PL(),o=WD,a=(0,t.Debug)("SentinelConnector");let c=class extends i.default{constructor(e){if(super(e.disconnectTimeout),this.options=e,this.emitter=null,this.failoverDetector=null,!this.options.sentinels.length)throw new Error("Requires at least one sentinel to connect to.");if(!this.options.name)throw new Error("Requires the name of master.");this.sentinelIterator=new n.default(this.options.sentinels)}check(e){const t=!e.role||this.options.role===e.role;return t||(a("role invalid, expected %s, but got %s",this.options.role,e.role),this.sentinelIterator.next(),this.sentinelIterator.next(),this.sentinelIterator.reset(!0)),t}disconnect(){super.disconnect(),this.failoverDetector&&this.failoverDetector.cleanup()}connect(n){let i;this.connecting=!0,this.retryAttempts=0;const s=async()=>{const o=this.sentinelIterator.next();if(o.done){this.sentinelIterator.reset(!1);const e="function"==typeof this.options.sentinelRetryStrategy?this.options.sentinelRetryStrategy(++this.retryAttempts):null;let t="number"!=typeof e?"All sentinels are unreachable and retry is disabled.":`All sentinels are unreachable. Retrying from scratch after ${e}ms.`;i&&(t+=` Last error: ${i.message}`),a(t);const r=new Error(t);if("number"==typeof e)return n("error",r),await new Promise((t=>setTimeout(t,e))),s();throw r}let c=null,l=null;try{c=await this.resolve(o.value)}catch(e){l=e}if(!this.connecting)throw new Error(t.CONNECTION_CLOSED_ERROR_MSG);const u=o.value.host+":"+o.value.port;if(c)return a("resolved: %s:%s from sentinel %s",c.host,c.port,u),this.options.enableTLSForSentinelMode&&this.options.tls?(Object.assign(c,this.options.tls),this.stream=(0,r.connect)(c),this.stream.once("secureConnect",this.initFailoverDetector.bind(this))):(this.stream=(0,e.createConnection)(c),this.stream.once("connect",this.initFailoverDetector.bind(this))),this.stream.once("error",(e=>{this.firstError=e})),this.stream;{const e=l?"failed to connect to sentinel "+u+" because "+l.message:"connected to sentinel "+u+" successfully, but got an invalid reply: "+c;return a(e),n("sentinelError",new Error(e)),l&&(i=l),s()}};return s()}async updateSentinels(e){if(!this.options.updateSentinels)return;const r=await e.sentinel("sentinels",this.options.name);Array.isArray(r)&&(r.map(t.packObject).forEach((e=>{if(-1===(e.flags?e.flags.split(","):[]).indexOf("disconnected")&&e.ip&&e.port){const t=this.sentinelNatResolve(l(e));this.sentinelIterator.add(t)&&a("adding sentinel %s:%s",t.host,t.port)}})),a("Updated internal sentinels: %s",this.sentinelIterator))}async resolveMaster(e){const t=await e.sentinel("get-master-addr-by-name",this.options.name);return await this.updateSentinels(e),this.sentinelNatResolve(Array.isArray(t)?{host:t[0],port:Number(t[1])}:null)}async resolveSlave(e){const r=await e.sentinel("slaves",this.options.name);if(!Array.isArray(r))return null;const n=r.map(t.packObject).filter((e=>e.flags&&!e.flags.match(/(disconnected|s_down|o_down)/)));return this.sentinelNatResolve(function(e,r){if(0===e.length)return null;let n;if("function"==typeof r)n=r(e);else if(null!==r&&"object"==typeof r){const t=Array.isArray(r)?r:[r];t.sort(((e,t)=>(e.prio||(e.prio=1),t.prio||(t.prio=1),e.prio<t.prio?-1:e.prio>t.prio?1:0)));for(let r=0;r<t.length;r++){for(let i=0;i<e.length;i++){const s=e[i];if(s.ip===t[r].ip&&s.port===t[r].port){n=s;break}}if(n)break}}n||(n=(0,t.sample)(e));return l(n)}(n,this.options.preferredSlaves))}sentinelNatResolve(e){return e&&this.options.natMap&&this.options.natMap[`${e.host}:${e.port}`]||e}connectToSentinel(e,t){return new s.default({port:e.port||26379,host:e.host,username:this.options.sentinelUsername||null,password:this.options.sentinelPassword||null,family:e.family||("path"in this.options&&this.options.path?void 0:this.options.family),tls:this.options.sentinelTLS,retryStrategy:null,enableReadyCheck:!1,connectTimeout:this.options.connectTimeout,commandTimeout:this.options.sentinelCommandTimeout,...t})}async resolve(e){const t=this.connectToSentinel(e);t.on("error",u);try{return"slave"===this.options.role?await this.resolveSlave(t):await this.resolveMaster(t)}finally{t.disconnect()}}async initFailoverDetector(){var e;if(!this.options.failoverDetector)return;this.sentinelIterator.reset(!0);const t=[];for(;t.length<this.options.sentinelMaxConnections;){const{done:e,value:r}=this.sentinelIterator.next();if(e)break;const n=this.connectToSentinel(r,{lazyConnect:!0,retryStrategy:this.options.sentinelReconnectStrategy});n.on("reconnecting",(()=>{var e;null===(e=this.emitter)||void 0===e||e.emit("sentinelReconnecting")})),t.push({address:r,client:n})}this.sentinelIterator.reset(!1),this.failoverDetector&&this.failoverDetector.cleanup(),this.failoverDetector=new o.FailoverDetector(this,t),await this.failoverDetector.subscribe(),null===(e=this.emitter)||void 0===e||e.emit("failoverSubscribed")}};function l(e){return{host:e.ip,port:Number(e.port)}}function u(){}return KD.default=c,KD}WD.FailoverDetector=class{constructor(e,t){this.isDisconnected=!1,this.connector=e,this.sentinels=t}cleanup(){this.isDisconnected=!0;for(const e of this.sentinels)e.client.disconnect()}async subscribe(){JD("Starting FailoverDetector");const e=[];for(const t of this.sentinels){const r=t.client.subscribe(HD).catch((e=>{JD("Failed to subscribe to failover messages on sentinel %s:%s (%s)",t.address.host||"127.0.0.1",t.address.port||26739,e.message)}));e.push(r),t.client.on("message",(e=>{this.isDisconnected||e!==HD||this.disconnect()}))}await Promise.all(e)}disconnect(){this.isDisconnected=!0,JD("Failover detected, disconnecting"),this.connector.disconnect()}};var qD={},XD={},YD={};Object.defineProperty(YD,"__esModule",{value:!0});const ZD=I$;class QD extends ZD.AbortError{constructor(e){super(`Reached the max retries per request limit (which is ${e}). Refer to "maxRetriesPerRequest" option for details.`),Error.captureStackTrace(this,this.constructor)}get name(){return this.constructor.name}}YD.default=QD,Object.defineProperty(XD,"__esModule",{value:!0}),XD.MaxRetriesPerRequestError=void 0;const eL=YD;XD.MaxRetriesPerRequestError=eL.default;var tL={};const rL=i.Buffer,nL=new(0,v.StringDecoder),iL=I$,sL=iL.ReplyError,oL=iL.ParserError;var aL=rL.allocUnsafe(32768),cL=0,lL=null,uL=0,dL=0;function fL(e){const t=e.offset,r=e.buffer,n=r.length-1;for(var i=t;i<n;)if(13===r[i++])return e.offset=i+1,!0===e.optionReturnBuffers?e.buffer.slice(t,i-1):e.buffer.toString("utf8",t,i-1)}function pL(e){const t=e.buffer.length-1;for(var r=e.offset,n=0;r<t;){const t=e.buffer[r++];if(13===t)return e.offset=r+1,n;n=10*n+(t-48)}}function hL(e,t,r){e.arrayCache.push(t),e.arrayPos.push(r)}function mL(e){const t=e.arrayCache.pop();var r=e.arrayPos.pop();if(e.arrayCache.length){const n=mL(e);if(void 0===n)return void hL(e,t,r);t[r++]=n}return yL(e,t,r)}function yL(e,t,r){const n=e.buffer.length;for(;r<t.length;){const i=e.offset;if(e.offset>=n)return void hL(e,t,r);const s=gL(e,e.buffer[e.offset++]);if(void 0===s)return e.arrayCache.length||e.bufferCache.length||(e.offset=i),void hL(e,t,r);t[r]=s,r++}return t}function gL(e,t){switch(t){case 36:return function(e){const t=pL(e);if(void 0===t)return;if(t<0)return null;const r=e.offset+t;if(r+2>e.buffer.length)return e.bigStrSize=r+2,e.totalChunkSize=e.buffer.length,void e.bufferCache.push(e.buffer);const n=e.offset;return e.offset=r+2,!0===e.optionReturnBuffers?e.buffer.slice(n,r):e.buffer.toString("utf8",n,r)}(e);case 43:return fL(e);case 42:return function(e){const t=pL(e);if(void 0===t)return;return t<0?null:yL(e,new Array(t),0)}(e);case 58:return function(e){return!0===e.optionStringNumbers?function(e){const t=e.buffer.length-1;var r=e.offset,n=0,i="";for(45===e.buffer[r]&&(i+="-",r++);r<t;){var s=e.buffer[r++];if(13===s)return e.offset=r+1,0!==n&&(i+=n),i;n>429496728?(i+=10*n+(s-48),n=0):48===s&&0===n?i+=0:n=10*n+(s-48)}}(e):function(e){const t=e.buffer.length-1;var r=e.offset,n=0,i=1;for(45===e.buffer[r]&&(i=-1,r++);r<t;){const t=e.buffer[r++];if(13===t)return e.offset=r+1,i*n;n=10*n+(t-48)}}(e)}(e);case 45:return function(e){var t=fL(e);if(void 0!==t)return!0===e.optionReturnBuffers&&(t=t.toString()),new sL(t)}(e);default:return function(e,t){const r=new oL("Protocol error, got "+JSON.stringify(String.fromCharCode(t))+" as reply type byte",JSON.stringify(e.buffer),e.offset);e.buffer=null,e.returnFatalError(r)}(e,t)}}function _L(){if(aL.length>51200)if(1===uL||dL>2*uL){const e=Math.floor(aL.length/10),t=e<cL?cL:e;cL=0,aL=aL.slice(t,aL.length)}else dL++,uL--;else clearInterval(lL),uL=0,dL=0,lL=null}function vL(e){const t=e.bufferCache,r=e.offset,n=e.bigStrSize-r-2;var i=t.length,s=e.bigStrSize-e.totalChunkSize;if(e.offset=s,s<=2){if(2===i)return t[0].slice(r,t[0].length+s-2);i--,s=t[t.length-2].length+s}!function(e){if(aL.length<e+cL){const t=e>78643200?2:3;cL>116391936&&(cL=52428800),aL=rL.allocUnsafe(e*t+cL),cL=0,uL++,null===lL&&(lL=setInterval(_L,50))}}(n);const o=cL;t[0].copy(aL,o,r,t[0].length),cL+=t[0].length-r;for(var a=1;a<i-1;a++)t[a].copy(aL,cL),cL+=t[a].length;return t[a].copy(aL,cL,0,s-2),cL+=s-2,aL.slice(o,cL)}var bL=class{constructor(e){if(!e)throw new TypeError("Options are mandatory.");if("function"!=typeof e.returnError||"function"!=typeof e.returnReply)throw new TypeError("The returnReply and returnError options have to be functions.");this.setReturnBuffers(!!e.returnBuffers),this.setStringNumbers(!!e.stringNumbers),this.returnError=e.returnError,this.returnFatalError=e.returnFatalError||e.returnError,this.returnReply=e.returnReply,this.reset()}reset(){this.offset=0,this.buffer=null,this.bigStrSize=0,this.totalChunkSize=0,this.bufferCache=[],this.arrayCache=[],this.arrayPos=[]}setReturnBuffers(e){if("boolean"!=typeof e)throw new TypeError("The returnBuffers argument has to be a boolean");this.optionReturnBuffers=e}setStringNumbers(e){if("boolean"!=typeof e)throw new TypeError("The stringNumbers argument has to be a boolean");this.optionStringNumbers=e}execute(e){if(null===this.buffer)this.buffer=e,this.offset=0;else if(0===this.bigStrSize){const t=this.buffer.length,r=t-this.offset,n=rL.allocUnsafe(r+e.length);if(this.buffer.copy(n,0,this.offset,t),e.copy(n,r,0,e.length),this.buffer=n,this.offset=0,this.arrayCache.length){const e=mL(this);if(void 0===e)return;this.returnReply(e)}}else{if(!(this.totalChunkSize+e.length>=this.bigStrSize))return this.bufferCache.push(e),void(this.totalChunkSize+=e.length);this.bufferCache.push(e);var t=this.optionReturnBuffers?vL(this):function(e){const t=e.bufferCache,r=e.offset;var n=t.length,i=e.bigStrSize-e.totalChunkSize;if(e.offset=i,i<=2){if(2===n)return t[0].toString("utf8",r,t[0].length+i-2);n--,i=t[t.length-2].length+i}for(var s=nL.write(t[0].slice(r)),o=1;o<n-1;o++)s+=nL.write(t[o]);return s+nL.end(t[o].slice(0,i-2))}(this);if(this.bigStrSize=0,this.bufferCache=[],this.buffer=e,this.arrayCache.length&&(this.arrayCache[0][this.arrayPos[0]++]=t,void 0===(t=mL(this))))return;this.returnReply(t)}for(;this.offset<this.buffer.length;){const e=this.offset,t=this.buffer[this.offset++],r=gL(this,t);if(void 0===r)return void(this.arrayCache.length||this.bufferCache.length||(this.offset=e));45===t?this.returnError(r):this.returnReply(r)}this.buffer=null}},wL=bL,SL={};Object.defineProperty(SL,"__esModule",{value:!0});function EL(e){return"unsubscribe"===e?"subscribe":"punsubscribe"===e?"psubscribe":"sunsubscribe"===e?"ssubscribe":e}SL.default=class{constructor(){this.set={subscribe:{},psubscribe:{},ssubscribe:{}}}add(e,t){this.set[EL(e)][t]=!0}del(e,t){delete this.set[EL(e)][t]}channels(e){return Object.keys(this.set[EL(e)])}isEmpty(){return 0===this.channels("subscribe").length&&0===this.channels("psubscribe").length&&0===this.channels("ssubscribe").length}},Object.defineProperty(tL,"__esModule",{value:!0});const kL=x$,AL=wL,OL=SL,CL=(0,M$.Debug)("dataHandler");tL.default=class{constructor(e,t){this.redis=e;const r=new AL({stringNumbers:t.stringNumbers,returnBuffers:!0,returnError:e=>{this.returnError(e)},returnFatalError:e=>{this.returnFatalError(e)},returnReply:e=>{this.returnReply(e)}});e.stream.on("data",(e=>{r.execute(e)}))}returnFatalError(e){e.message+=". Please report this.",this.redis.recoverFromFatalError(e,e,{offlineQueue:!1})}returnError(e){const t=this.shiftCommand(e);t&&(e.command={name:t.command.name,args:t.command.args},this.redis.handleReconnection(e,t))}returnReply(e){if(this.handleMonitorReply(e))return;if(this.handleSubscriberReply(e))return;const t=this.shiftCommand(e);t&&(kL.default.checkFlag("ENTER_SUBSCRIBER_MODE",t.command.name)?(this.redis.condition.subscriber=new OL.default,this.redis.condition.subscriber.add(t.command.name,e[1].toString()),RL(t.command,e[2])||this.redis.commandQueue.unshift(t)):kL.default.checkFlag("EXIT_SUBSCRIBER_MODE",t.command.name)?IL(t.command,e[2])||this.redis.commandQueue.unshift(t):t.command.resolve(e))}handleSubscriberReply(e){if(!this.redis.condition.subscriber)return!1;const t=Array.isArray(e)?e[0].toString():null;switch(CL('receive reply "%s" in subscriber mode',t),t){case"message":this.redis.listeners("message").length>0&&this.redis.emit("message",e[1].toString(),e[2]?e[2].toString():""),this.redis.emit("messageBuffer",e[1],e[2]);break;case"pmessage":{const t=e[1].toString();this.redis.listeners("pmessage").length>0&&this.redis.emit("pmessage",t,e[2].toString(),e[3].toString()),this.redis.emit("pmessageBuffer",t,e[2],e[3]);break}case"smessage":this.redis.listeners("smessage").length>0&&this.redis.emit("smessage",e[1].toString(),e[2]?e[2].toString():""),this.redis.emit("smessageBuffer",e[1],e[2]);break;case"ssubscribe":case"subscribe":case"psubscribe":{const r=e[1].toString();this.redis.condition.subscriber.add(t,r);const n=this.shiftCommand(e);if(!n)return;RL(n.command,e[2])||this.redis.commandQueue.unshift(n);break}case"sunsubscribe":case"unsubscribe":case"punsubscribe":{const r=e[1]?e[1].toString():null;r&&this.redis.condition.subscriber.del(t,r);const n=e[2];0===Number(n)&&(this.redis.condition.subscriber=!1);const i=this.shiftCommand(e);if(!i)return;IL(i.command,n)||this.redis.commandQueue.unshift(i);break}default:{const t=this.shiftCommand(e);if(!t)return;t.command.resolve(e)}}return!0}handleMonitorReply(e){if("monitoring"!==this.redis.status)return!1;const t=e.toString();if("OK"===t)return!1;const r=t.indexOf(" "),n=t.slice(0,r),i=t.indexOf('"'),s=t.slice(i+1,-1).split('" "').map((e=>e.replace(/\\"/g,'"'))),o=t.slice(r+2,i-2).split(" ");return this.redis.emit("monitor",n,s,o[1],o[0]),!0}shiftCommand(e){const t=this.redis.commandQueue.shift();if(!t){const t=new Error("Command queue state error. If you can reproduce this, please report it."+(e instanceof Error?` Last error: ${e.message}`:` Last reply: ${e.toString()}`));return this.redis.emit("error",t),null}return t}};const TL=new WeakMap;function RL(e,t){let r=TL.has(e)?TL.get(e):e.args.length;return r-=1,r<=0?(e.resolve(t),TL.delete(e),!0):(TL.set(e,r),!1)}function IL(e,t){let r=TL.has(e)?TL.get(e):e.args.length;return 0===r?0===Number(t)&&(TL.delete(e),e.resolve(t),!0):(r-=1,r<=0?(e.resolve(t),!0):(TL.set(e,r),!1))}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.readyHandler=e.errorHandler=e.closeHandler=e.connectHandler=void 0;const t=I$,r=x$,n=XD,i=M$,s=tL,o=(0,i.Debug)("connection");function a(e){const r=new t.AbortError("Command aborted due to connection close");return r.command={name:e.name,args:e.args},r}e.connectHandler=function(t){return function(){t.setStatus("connect"),t.resetCommandQueue();let r=!1;const{connectionEpoch:n}=t;t.condition.auth&&t.auth(t.condition.auth,(function(e){n===t.connectionEpoch&&e&&(-1!==e.message.indexOf("no password is set")?console.warn("[WARN] Redis server does not require a password, but a password was supplied."):-1!==e.message.indexOf("without any password configured for the default user")?console.warn("[WARN] This Redis server's `default` user does not require a password, but a password was supplied"):-1!==e.message.indexOf("wrong number of arguments for 'auth' command")?console.warn("[ERROR] The server returned \"wrong number of arguments for 'auth' command\". You are probably passing both username and password to Redis version 5 or below. You should only pass the 'password' option for Redis version 5 and under."):(r=!0,t.recoverFromFatalError(e,e)))})),t.condition.select&&t.select(t.condition.select).catch((e=>{t.silentEmit("error",e)})),t.options.enableReadyCheck||e.readyHandler(t)(),new s.default(t,{stringNumbers:t.options.stringNumbers}),t.options.enableReadyCheck&&t._readyCheck((function(i,s){n===t.connectionEpoch&&(i?r||t.recoverFromFatalError(new Error("Ready check failed: "+i.message),i):t.connector.check(s)?e.readyHandler(t)():t.disconnect(!0))}))}},e.closeHandler=function(e){return function(){const r=e.status;if(e.setStatus("close"),e.commandQueue.length&&function(e){var t;let r=0;for(let n=0;n<e.length;){const i=null===(t=e.peekAt(n))||void 0===t?void 0:t.command,s=i.pipelineIndex;void 0!==s&&0!==s||(r=0),void 0===s||s===r++?n++:(e.remove(n,1),i.reject(a(i)))}}(e.commandQueue),e.offlineQueue.length&&function(e){var t;for(let r=0;r<e.length;){const n=null===(t=e.peekAt(r))||void 0===t?void 0:t.command;if("multi"===n.name)break;if("exec"===n.name){e.remove(r,1),n.reject(a(n));break}n.inTransaction?(e.remove(r,1),n.reject(a(n))):r++}}(e.offlineQueue),"ready"===r&&(e.prevCondition||(e.prevCondition=e.condition),e.commandQueue.length&&(e.prevCommandQueue=e.commandQueue)),e.manuallyClosing)return e.manuallyClosing=!1,o("skip reconnecting since the connection is manually closed."),t();if("function"!=typeof e.options.retryStrategy)return o("skip reconnecting because `retryStrategy` is not a function"),t();const s=e.options.retryStrategy(++e.retryAttempts);if("number"!=typeof s)return o("skip reconnecting because `retryStrategy` doesn't return a number"),t();o("reconnect in %sms",s),e.setStatus("reconnecting",s),e.reconnectTimeout=setTimeout((function(){e.reconnectTimeout=null,e.connect().catch(i.noop)}),s);const{maxRetriesPerRequest:c}=e.options;if("number"==typeof c)if(c<0)o("maxRetriesPerRequest is negative, ignoring...");else{0===e.retryAttempts%(c+1)&&(o("reach maxRetriesPerRequest limitation, flushing command queue..."),e.flushQueue(new n.MaxRetriesPerRequestError(c)))}};function t(){e.setStatus("end"),e.flushQueue(new Error(i.CONNECTION_CLOSED_ERROR_MSG))}},e.errorHandler=function(e){return function(t){o("error: %s",t),e.silentEmit("error",t)}},e.readyHandler=function(e){return function(){if(e.setStatus("ready"),e.retryAttempts=0,e.options.monitor){e.call("monitor").then((()=>e.setStatus("monitoring")),(t=>e.emit("error",t)));const{sendCommand:t}=e;return e.sendCommand=function(n){return r.default.checkFlag("VALID_IN_MONITOR_MODE",n.name)?t.call(e,n):(n.reject(new Error("Connection is in monitoring mode, can't process commands.")),n.promise)},void e.once("close",(function(){delete e.sendCommand}))}const t=e.prevCondition?e.prevCondition.select:e.condition.select;if(e.options.connectionName&&(o("set the connection name [%s]",e.options.connectionName),e.client("setname",e.options.connectionName).catch(i.noop)),e.options.readOnly&&(o("set the connection to readonly mode"),e.readonly().catch(i.noop)),e.prevCondition){const r=e.prevCondition;if(e.prevCondition=null,r.subscriber&&e.options.autoResubscribe){e.condition.select!==t&&(o("connect to db [%d]",t),e.select(t));const n=r.subscriber.channels("subscribe");n.length&&(o("subscribe %d channels",n.length),e.subscribe(n));const i=r.subscriber.channels("psubscribe");i.length&&(o("psubscribe %d channels",i.length),e.psubscribe(i));const s=r.subscriber.channels("ssubscribe");s.length&&(o("ssubscribe %d channels",s.length),e.ssubscribe(s))}}if(e.prevCommandQueue)if(e.options.autoResendUnfulfilledCommands)for(o("resend %d unfulfilled commands",e.prevCommandQueue.length);e.prevCommandQueue.length>0;){const t=e.prevCommandQueue.shift();t.select!==e.condition.select&&"select"!==t.command.name&&e.select(t.select),e.sendCommand(t.command,t.stream)}else e.prevCommandQueue=null;if(e.offlineQueue.length){o("send %d commands in offline queue",e.offlineQueue.length);const t=e.offlineQueue;for(e.resetOfflineQueue();t.length>0;){const r=t.shift();r.select!==e.condition.select&&"select"!==r.command.name&&e.select(r.select),e.sendCommand(r.command,r.stream)}}e.condition.select!==t&&(o("connect to db [%d]",t),e.select(t))}}}(qD);var xL,jL={};function PL(){if(xL)return g$;xL=1,Object.defineProperty(g$,"__esModule",{value:!0});const e=_$,t=l,r=b$,n=ID(),i=x$,s=function(){if(zD)return xD;zD=1,Object.defineProperty(xD,"__esModule",{value:!0}),xD.SentinelConnector=xD.StandaloneConnector=void 0;const e=jD;xD.StandaloneConnector=e.default;const t=VD();return xD.SentinelConnector=t.default,xD}(),o=VD(),a=qD,c=jL,u=MM,d=BM,f=M$,p=hD,h=FM,m=D$,y=OD,g=(0,f.Debug)("redis");let _=class n extends h.default{constructor(e,r,n){if(super(),this.status="wait",this.isCluster=!1,this.reconnectTimeout=null,this.connectionEpoch=0,this.retryAttempts=0,this.manuallyClosing=!1,this._autoPipelines=new Map,this._runningAutoPipelines=new Set,this.parseOptions(e,r,n),t.EventEmitter.call(this),this.resetCommandQueue(),this.resetOfflineQueue(),this.options.Connector)this.connector=new this.options.Connector(this.options);else if(this.options.sentinels){const e=new o.default(this.options);e.emitter=this,this.connector=e}else this.connector=new s.StandaloneConnector(this.options);this.options.scripts&&Object.entries(this.options.scripts).forEach((([e,t])=>{this.defineCommand(e,t)})),this.options.lazyConnect?this.setStatus("wait"):this.connect().catch(m.noop)}static createClient(...e){return new n(...e)}get autoPipelineQueueSize(){let e=0;for(const t of this._autoPipelines.values())e+=t.length;return e}connect(e){const t=new Promise(((e,t)=>{if("connecting"===this.status||"connect"===this.status||"ready"===this.status)return void t(new Error("Redis is already connecting/connected"));this.connectionEpoch+=1,this.setStatus("connecting");const{options:n}=this;this.condition={select:n.db,auth:n.username?[n.username,n.password]:n.password,subscriber:!1};const i=this;(0,r.default)(this.connector.connect((function(e,t){i.silentEmit(e,t)})),(function(r,s){if(r)return i.flushQueue(r),i.silentEmit("error",r),t(r),void i.setStatus("end");let o=n.tls?"secureConnect":"connect";if("sentinels"in n&&n.sentinels&&!n.enableTLSForSentinelMode&&(o="connect"),i.stream=s,n.noDelay&&s.setNoDelay(!0),"number"==typeof n.keepAlive&&(s.connecting?s.once(o,(()=>{s.setKeepAlive(!0,n.keepAlive)})):s.setKeepAlive(!0,n.keepAlive)),s.connecting){if(s.once(o,a.connectHandler(i)),n.connectTimeout){let e=!1;s.setTimeout(n.connectTimeout,(function(){if(e)return;s.setTimeout(0),s.destroy();const t=new Error("connect ETIMEDOUT");t.errorno="ETIMEDOUT",t.code="ETIMEDOUT",t.syscall="connect",a.errorHandler(i)(t)})),s.once(o,(function(){e=!0,s.setTimeout(0)}))}}else if(s.destroyed){const e=i.connector.firstError;e&&process.nextTick((()=>{a.errorHandler(i)(e)})),process.nextTick(a.closeHandler(i))}else process.nextTick(a.connectHandler(i));s.destroyed||(s.once("error",a.errorHandler(i)),s.once("close",a.closeHandler(i)));const c=function(){i.removeListener("close",l),e()};var l=function(){i.removeListener("ready",c),t(new Error(f.CONNECTION_CLOSED_ERROR_MSG))};i.once("ready",c),i.once("close",l)}))}));return(0,r.default)(t,e)}disconnect(e=!1){e||(this.manuallyClosing=!0),this.reconnectTimeout&&!e&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),"wait"===this.status?a.closeHandler(this)():this.connector.disconnect()}end(){this.disconnect()}duplicate(e){return new n({...this.options,...e})}get mode(){var e;return this.options.monitor?"monitor":(null===(e=this.condition)||void 0===e?void 0:e.subscriber)?"subscriber":"normal"}monitor(e){const t=this.duplicate({monitor:!0,lazyConnect:!1});return(0,r.default)(new Promise((function(e,r){t.once("error",r),t.once("monitoring",(function(){e(t)}))})),e)}sendCommand(t,r){var n,s;if("wait"===this.status&&this.connect().catch(m.noop),"end"===this.status)return t.reject(new Error(f.CONNECTION_CLOSED_ERROR_MSG)),t.promise;if((null===(n=this.condition)||void 0===n?void 0:n.subscriber)&&!i.default.checkFlag("VALID_IN_SUBSCRIBER_MODE",t.name))return t.reject(new Error("Connection in subscriber mode, only subscriber commands may be used")),t.promise;"number"==typeof this.options.commandTimeout&&t.setTimeout(this.options.commandTimeout);let o="ready"===this.status||!r&&"connect"===this.status&&(0,e.exists)(t.name)&&(0,e.hasFlag)(t.name,"loading");if(this.stream&&this.stream.writable?this.stream._writableState&&this.stream._writableState.ended&&(o=!1):o=!1,o)g.enabled&&g("write command[%s]: %d -> %s(%o)",this._getDescription(),null===(s=this.condition)||void 0===s?void 0:s.select,t.name,t.args),r?"isPipeline"in r&&r.isPipeline?r.write(t.toWritable(r.destination.redis.stream)):r.write(t.toWritable(r)):this.stream.write(t.toWritable(this.stream)),this.commandQueue.push({command:t,stream:r,select:this.condition.select}),i.default.checkFlag("WILL_DISCONNECT",t.name)&&(this.manuallyClosing=!0),void 0!==this.options.socketTimeout&&void 0===this.socketTimeoutTimer&&this.setSocketTimeout();else{if(!this.options.enableOfflineQueue)return t.reject(new Error("Stream isn't writeable and enableOfflineQueue options is false")),t.promise;if("quit"===t.name&&0===this.offlineQueue.length)return this.disconnect(),t.resolve(Buffer.from("OK")),t.promise;g.enabled&&g("queue command[%s]: %d -> %s(%o)",this._getDescription(),this.condition.select,t.name,t.args),this.offlineQueue.push({command:t,stream:r,select:this.condition.select})}if("select"===t.name&&(0,f.isInt)(t.args[0])){const e=parseInt(t.args[0],10);this.condition.select!==e&&(this.condition.select=e,this.emit("select",e),g("switch to db [%d]",this.condition.select))}return t.promise}setSocketTimeout(){this.socketTimeoutTimer=setTimeout((()=>{this.stream.destroy(new Error(`Socket timeout. Expecting data, but didn't receive any in ${this.options.socketTimeout}ms.`)),this.socketTimeoutTimer=void 0}),this.options.socketTimeout),this.stream.once("data",(()=>{clearTimeout(this.socketTimeoutTimer),this.socketTimeoutTimer=void 0,0!==this.commandQueue.length&&this.setSocketTimeout()}))}scanStream(e){return this.createScanStream("scan",{options:e})}scanBufferStream(e){return this.createScanStream("scanBuffer",{options:e})}sscanStream(e,t){return this.createScanStream("sscan",{key:e,options:t})}sscanBufferStream(e,t){return this.createScanStream("sscanBuffer",{key:e,options:t})}hscanStream(e,t){return this.createScanStream("hscan",{key:e,options:t})}hscanBufferStream(e,t){return this.createScanStream("hscanBuffer",{key:e,options:t})}zscanStream(e,t){return this.createScanStream("zscan",{key:e,options:t})}zscanBufferStream(e,t){return this.createScanStream("zscanBuffer",{key:e,options:t})}silentEmit(e,t){let r;if("error"===e){if(r=t,"end"===this.status)return;if(this.manuallyClosing&&r instanceof Error&&(r.message===f.CONNECTION_CLOSED_ERROR_MSG||"connect"===r.syscall||"read"===r.syscall))return}return this.listeners(e).length>0?this.emit.apply(this,arguments):(r&&r instanceof Error&&console.error("[ioredis] Unhandled error event:",r.stack),!1)}recoverFromFatalError(e,t,r){this.flushQueue(t,r),this.silentEmit("error",t),this.disconnect(!0)}handleReconnection(e,t){var r;let n=!1;switch(this.options.reconnectOnError&&(n=this.options.reconnectOnError(e)),n){case 1:case!0:"reconnecting"!==this.status&&this.disconnect(!0),t.command.reject(e);break;case 2:"reconnecting"!==this.status&&this.disconnect(!0),(null===(r=this.condition)||void 0===r?void 0:r.select)!==t.select&&"select"!==t.command.name&&this.select(t.select),this.sendCommand(t.command);break;default:t.command.reject(e)}}_getDescription(){let e;return e="path"in this.options&&this.options.path?this.options.path:this.stream&&this.stream.remoteAddress&&this.stream.remotePort?this.stream.remoteAddress+":"+this.stream.remotePort:"host"in this.options&&this.options.host?this.options.host+":"+this.options.port:"",this.options.connectionName&&(e+=` (${this.options.connectionName})`),e}resetCommandQueue(){this.commandQueue=new y}resetOfflineQueue(){this.offlineQueue=new y}parseOptions(...e){const t={};let r=!1;for(let n=0;n<e.length;++n){const i=e[n];if(null!=i)if("object"==typeof i)(0,m.defaults)(t,i);else if("string"==typeof i)(0,m.defaults)(t,(0,f.parseURL)(i)),i.startsWith("rediss://")&&(r=!0);else{if("number"!=typeof i)throw new Error("Invalid argument "+i);t.port=i}}r&&(0,m.defaults)(t,{tls:!0}),(0,m.defaults)(t,n.defaultOptions),"string"==typeof t.port&&(t.port=parseInt(t.port,10)),"string"==typeof t.db&&(t.db=parseInt(t.db,10)),this.options=(0,f.resolveTLSProfile)(t)}setStatus(e,t){g.enabled&&g("status[%s]: %s -> %s",this._getDescription(),this.status||"[empty]",e),this.status=e,process.nextTick(this.emit.bind(this,e,t))}createScanStream(e,{key:t,options:r={}}){return new u.default({objectMode:!0,key:t,redis:this,command:e,...r})}flushQueue(e,t){let r;if((t=(0,m.defaults)({},t,{offlineQueue:!0,commandQueue:!0})).offlineQueue)for(;r=this.offlineQueue.shift();)r.command.reject(e);if(t.commandQueue&&this.commandQueue.length>0)for(this.stream&&this.stream.removeAllListeners("data");r=this.commandQueue.shift();)r.command.reject(e)}_readyCheck(e){const t=this;this.info((function(r,n){if(r)return r.message&&r.message.includes("NOPERM")?(console.warn(`Skipping the ready check because INFO command fails: "${r.message}". You can disable ready check with "enableReadyCheck". More: https://github.com/luin/ioredis/wiki/Disable-ready-check.`),e(null,{})):e(r);if("string"!=typeof n)return e(null,n);const i={},s=n.split("\r\n");for(let e=0;e<s.length;++e){const[t,...r]=s[e].split(":"),n=r.join(":");n&&(i[t]=n)}if(i.loading&&"0"!==i.loading){const r=1e3*(i.loading_eta_seconds||1),n=t.options.maxLoadingRetryTime&&t.options.maxLoadingRetryTime<r?t.options.maxLoadingRetryTime:r;g("Redis server still loading, trying again in "+n+"ms"),setTimeout((function(){t._readyCheck(e)}),n)}else e(null,i)})).catch(m.noop)}};return _.Cluster=n.default,_.Command=i.default,_.defaultOptions=c.DEFAULT_REDIS_OPTIONS,(0,p.default)(_,t.EventEmitter),(0,d.addTransactionSupport)(_.prototype),g$.default=_,g$}Object.defineProperty(jL,"__esModule",{value:!0}),jL.DEFAULT_REDIS_OPTIONS=void 0,jL.DEFAULT_REDIS_OPTIONS={port:6379,host:"localhost",family:4,connectTimeout:1e4,disconnectTimeout:2e3,retryStrategy:function(e){return Math.min(50*e,2e3)},keepAlive:0,noDelay:!0,connectionName:null,sentinels:null,name:null,role:"master",sentinelRetryStrategy:function(e){return Math.min(10*e,1e3)},sentinelReconnectStrategy:function(){return 6e4},natMap:null,enableTLSForSentinelMode:!1,updateSentinels:!0,failoverDetector:!1,username:null,password:null,db:0,enableOfflineQueue:!0,enableReadyCheck:!0,autoResubscribe:!0,autoResendUnfulfilledCommands:!0,lazyConnect:!1,keyPrefix:"",reconnectOnError:null,readOnly:!1,stringNumbers:!1,maxRetriesPerRequest:20,maxLoadingRetryTime:1e4,enableAutoPipelining:!1,autoPipeliningIgnoredCommands:[],sentinelMaxConnections:10},function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.print=t.ReplyError=t.SentinelIterator=t.SentinelConnector=t.AbstractConnector=t.Pipeline=t.ScanStream=t.Command=t.Cluster=t.Redis=t.default=void 0,t=e.exports=PL().default;var r=PL();Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r.default}});var n=PL();Object.defineProperty(t,"Redis",{enumerable:!0,get:function(){return n.default}});var i=ID();Object.defineProperty(t,"Cluster",{enumerable:!0,get:function(){return i.default}});var s=x$;Object.defineProperty(t,"Command",{enumerable:!0,get:function(){return s.default}});var o=MM;Object.defineProperty(t,"ScanStream",{enumerable:!0,get:function(){return o.default}});var a=KM;Object.defineProperty(t,"Pipeline",{enumerable:!0,get:function(){return a.default}});var c=PD;Object.defineProperty(t,"AbstractConnector",{enumerable:!0,get:function(){return c.default}});var l=VD();Object.defineProperty(t,"SentinelConnector",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"SentinelIterator",{enumerable:!0,get:function(){return l.SentinelIterator}}),t.ReplyError=I$.ReplyError,Object.defineProperty(t,"Promise",{get:()=>(console.warn("ioredis v5 does not support plugging third-party Promise library anymore. Native Promise will be used."),Promise),set(e){console.warn("ioredis v5 does not support plugging third-party Promise library anymore. Native Promise will be used.")}}),t.print=function(e,t){e?console.log("Error: "+e):console.log("Reply: "+t)}}(y$,y$.exports);var NL=y$.exports,$L=jr&&jr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const ML=$L(l),DL=$L(NL);class LL extends ML.default{constructor(e,t){super(),this.ttlSupport=!0,this._getKeyName=e=>this.opts.useRedisSets?e:`sets:${this._getNamespace()}:${e}`,this.opts={},this.opts.useRedisSets=!0,this.opts.dialect="redis","string"!=typeof e&&e.options&&("family"in e.options||e.isCluster)?this.redis=e:(t={..."string"==typeof e?{uri:e}:e,...t},this.redis=new DL.default(t.uri,t)),void 0!==t&&!1===t.useRedisSets&&(this.opts.useRedisSets=!1),this.redis.on("error",(e=>this.emit("error",e)))}_getNamespace(){return`namespace:${this.namespace}`}async get(e){e=this._getKeyName(e);const t=await this.redis.get(e);if(null!==t)return t}async getMany(e){return e=e.map(this._getKeyName),this.redis.mget(e)}async set(e,t,r){if(void 0===t)return;e=this._getKeyName(e);const n=async n=>{"number"==typeof r?await n.set(e,t,"PX",r):await n.set(e,t)};if(this.opts.useRedisSets){const t=await this.redis.multi();await n(t),await t.sadd(this._getNamespace(),e),await t.exec()}else await n(this.redis)}async delete(e){e=this._getKeyName(e);let t=0;const r=async t=>t.unlink(e);if(this.opts.useRedisSets){const n=this.redis.multi();await r(n),await n.srem(this._getNamespace(),e);t=(await n.exec())[0][1]}else t=await r(this.redis);return t>0}async deleteMany(e){const t=e.map((async e=>this.delete(e)));return(await Promise.allSettled(t)).every((e=>e.value))}async clear(){if(this.opts.useRedisSets){const e=await this.redis.smembers(this._getNamespace());e.length>0&&await Promise.all([this.redis.unlink([...e]),this.redis.srem(this._getNamespace(),[...e])])}else{const e=`sets:${this._getNamespace()}:*`,t=await this.redis.keys(e);t.length>0&&await this.redis.unlink(t)}}async*iterator(e){const t=this.redis.scan.bind(this.redis),r=this.redis.mget.bind(this.redis);let n="0";do{const[i,s]=await t(n,"MATCH",`${e}:*`);if(n=i,s.length>0){const e=await r(s);for(const[t]of s.entries()){const r=s[t],n=e[t];yield[r,n]}}}while("0"!==n)}async has(e){return 0!==await this.redis.exists(e)}async disconnect(){return this.redis.disconnect()}}var BL=Pr(LL);const KL=function(){if(!0!==NT.CACHE_ENABLED)return null;let e=NT.CACHE_JWT_NAMESPACE;null!=e&&""!==e||(e="exjwt");let t=NT.CACHE_JWT_TTL;null!=t&&""!==t||(t=5e3);let r,n="";if("redis"===NT.CACHE_STORE){n=NT.REDIS,null!=n&&""!==n||(n=`redis://${NT.REDIS_USERNAME||""}:${NT.REDIS_PASSWORD||""}@${NT.REDIS_HOST}:${NT.REDIS_PORT||"6379"} /${NT.REDIS_JWT_DB||"2"}`);try{r=new BL(n)}catch(e){throw new Error("CACHE: could not connect to database: "+e)}}try{const i=new m$(n,{namespace:e,ttl:t,store:r});return i.on("error",(e=>{throw new Error("CACHE: could not connect: "+e)})),i}catch(e){throw new Error("CACHE: could not connect to database: "+e)}}();function FL(){return null!==KL}const UL=await async function(){return console.log("calling auth providers"),new Promise(((e,t)=>{const r=Ic(NT.AUTH_PROVIDERS).filter((e=>e&&"openid"===NT[`AUTH_${e.toUpperCase()}_DRIVER`])).map((e=>({name:e,label:NT[`AUTH_${e.toUpperCase()}_LABEL`],driver:NT[`AUTH_${e.toUpperCase()}_DRIVER`],icon:NT[`AUTH_${e.toUpperCase()}_ICON`],trusted:NT[`AUTH_${e.toUpperCase()}_TRUSTED`],jwks_url:NT[`AUTH_${e.toUpperCase()}_JWKS_URL`],jwks_keys:NT[`AUTH_${e.toUpperCase()}_JWKS_KEYS`],issuer_url:NT[`AUTH_${e.toUpperCase()}_ISSUER_URL`],admin_key:NT[`AUTH_${e.toUpperCase()}_JWT_ADMIN_KEY`],app_key:NT[`AUTH_${e.toUpperCase()}_JWT_APP_KEY`],role_key:NT[`AUTH_${e.toUpperCase()}_JWT_ROLE_KEY`],client_id:NT[`AUTH_${e.toUpperCase()}_CLIENT_ID`],client_secret:NT[`AUTH_${e.toUpperCase()}_CLIENT_SECRET`],use_database:NT[`AUTH_${e.toUpperCase()}_JWT_USEDB`]})));if(0===r.length)return e([]);const n=[];for(const e of r)switch(e.driver){case"openid":case"oauth2":if(!e.trusted||null==e.issuer_url&&null==e.jwks_url&&null==e.jwks_keys)break;n.push(XT(e))}Promise.all(n).then((t=>{e(t)})).catch((e=>{t(e)}))}))}();async function WL(e,t,r,n){if(null==r&&(r={user:null,role:null,admin:!1,app:!1}),null==e||null==t)return r;const i=UL.filter((e=>e.issuer_url&&t.includes(e.issuer_url)));if(0===i.length)return r;if(i.length>1)return r;const s=i[0];try{const t=await function(e,t){return new Promise(((r,n)=>{if(void 0===e.JWKSClient)return n("JWKSClient not initialized");c$.verify(t,((t,r)=>{e.JWKSClient?.getSigningKey(t.kid,((e,t)=>{const n=t?.getPublicKey();r(e,n)}))}),{complete:!1},((e,t)=>e||void 0===t||"string"==typeof t?n(e):r(t)))}))}(s,e);if(s.use_database){if(FL()&&t.sub){const e=await async function(e){return null===KL?null:KL.get(e)}(t.sub);if(e)return e}const e=await n.select("directus_users.id","directus_users.role","directus_roles.admin_access","directus_roles.app_access").from("directus_users").leftJoin("directus_roles","directus_users.role","directus_roles.id").where({"directus_users.external_identifier":t.sub,"directus_users.provider":s.name}).first();return e?(r.user=e.id,r.role=e.role,r.admin=!0===e.admin_access||1==e.admin_access,r.app=!0===e.app_access||1==e.app_access,FL()&&t.sub&&async function(e,t){null!==KL&&KL.set(e,t)}(t.sub,r),r):r}null!=s.role_key&&("string"==typeof t[s.role_key]&&(r.role=t[s.role_key]),"object"==typeof t[s.role_key]&&(r.role=""),t[s.role_key].instanceOf(Array)&&(r.role=t[s.role_key][0])),null!=s.admin_key&&(r.admin=t[s.admin_key]),null!=s.app_key&&(r.app=t[s.app_key]),r.user=t.sub}catch(e){return r}return r}var JL=({filter:e})=>{e("authenticate",((e,t,r)=>{const n=t.req;if(!n.token)return e;if(!r.database)return e;const i=c$.decode(n.token);return"string"==typeof i||null==i||"directus"==i?.iss?e:WL(n.token,i?.iss,r.accountability,r.database)}))};export{JL as default};