UNPKG

snyk-policy

Version:

Snyk's policy parser and matching logic

5 lines 118 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qo=require("url"),ve=require("fs"),Xr=require("path"),ea=require("util");function ta(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Q=ta(Xr);var Ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mr={exports:{}},$r,Dn;function ra(){if(Dn)return $r;Dn=1;var e=1e3,t=e*60,r=t*60,n=r*24,i=n*7,s=n*365.25;$r=function(c,f){f=f||{};var d=typeof c;if(d==="string"&&c.length>0)return o(c);if(d==="number"&&isFinite(c))return f.long?l(c):u(c);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(c))};function o(c){if(c=String(c),!(c.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(c);if(f){var d=parseFloat(f[1]),m=(f[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return d*s;case"weeks":case"week":case"w":return d*i;case"days":case"day":case"d":return d*n;case"hours":case"hour":case"hrs":case"hr":case"h":return d*r;case"minutes":case"minute":case"mins":case"min":case"m":return d*t;case"seconds":case"second":case"secs":case"sec":case"s":return d*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}}}function u(c){var f=Math.abs(c);return f>=n?Math.round(c/n)+"d":f>=r?Math.round(c/r)+"h":f>=t?Math.round(c/t)+"m":f>=e?Math.round(c/e)+"s":c+"ms"}function l(c){var f=Math.abs(c);return f>=n?p(c,f,n,"day"):f>=r?p(c,f,r,"hour"):f>=t?p(c,f,t,"minute"):f>=e?p(c,f,e,"second"):c+" ms"}function p(c,f,d,m){var w=f>=d*1.5;return Math.round(c/d)+" "+m+(w?"s":"")}return $r}function na(e){r.debug=r,r.default=r,r.coerce=l,r.disable=o,r.enable=i,r.enabled=u,r.humanize=ra(),r.destroy=p,Object.keys(e).forEach(c=>{r[c]=e[c]}),r.names=[],r.skips=[],r.formatters={};function t(c){let f=0;for(let d=0;d<c.length;d++)f=(f<<5)-f+c.charCodeAt(d),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=t;function r(c){let f,d=null,m,w;function v(...b){if(!v.enabled)return;const D=v,V=Number(new Date),j=V-(f||V);D.diff=j,D.prev=f,D.curr=V,f=V,b[0]=r.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let B=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(se,Me)=>{if(se==="%%")return"%";B++;const be=r.formatters[Me];if(typeof be=="function"){const Ue=b[B];se=be.call(D,Ue),b.splice(B,1),B--}return se}),r.formatArgs.call(D,b),(D.log||r.log).apply(D,b)}return v.namespace=c,v.useColors=r.useColors(),v.color=r.selectColor(c),v.extend=n,v.destroy=r.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(m!==r.namespaces&&(m=r.namespaces,w=r.enabled(c)),w),set:b=>{d=b}}),typeof r.init=="function"&&r.init(v),v}function n(c,f){const d=r(this.namespace+(typeof f>"u"?":":f)+c);return d.log=this.log,d}function i(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];const f=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(c,f){let d=0,m=0,w=-1,v=0;for(;d<c.length;)if(m<f.length&&(f[m]===c[d]||f[m]==="*"))f[m]==="*"?(w=m,v=d,m++):(d++,m++);else if(w!==-1)m=w+1,v++,d=v;else return!1;for(;m<f.length&&f[m]==="*";)m++;return m===f.length}function o(){const c=[...r.names,...r.skips.map(f=>"-"+f)].join(",");return r.enable(""),c}function u(c){for(const f of r.skips)if(s(c,f))return!1;for(const f of r.names)if(s(c,f))return!0;return!1}function l(c){return c instanceof Error?c.stack||c.message:c}function p(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var ia=na;(function(e,t){t.formatArgs=n,t.save=i,t.load=s,t.useColors=r,t.storage=o(),t.destroy=(()=>{let l=!1;return()=>{l||(l=!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"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const p="color: "+this.color;l.splice(1,0,p,"color: inherit");let c=0,f=0;l[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(c++,d==="%c"&&(f=c))}),l.splice(f,0,p)}t.log=console.debug||console.log||(()=>{});function i(l){try{l?t.storage.setItem("debug",l):t.storage.removeItem("debug")}catch{}}function s(){let l;try{l=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=process.env.DEBUG),l}function o(){try{return localStorage}catch{}}e.exports=ia(t);const{formatters:u}=e.exports;u.j=function(l){try{return JSON.stringify(l)}catch(p){return"[UnexpectedJSONParseError]: "+p.message}}})(Mr,Mr.exports);var nr=Mr.exports;const Ae=rr(nr);var Ur={exports:{}};const sa="2.0.0",wi=256,oa=Number.MAX_SAFE_INTEGER||9007199254740991,aa=16,la=wi-6,ca=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var ir={MAX_LENGTH:wi,MAX_SAFE_COMPONENT_LENGTH:aa,MAX_SAFE_BUILD_LENGTH:la,MAX_SAFE_INTEGER:oa,RELEASE_TYPES:ca,SEMVER_SPEC_VERSION:sa,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const ua=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var sr=ua;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=ir,s=sr;t=e.exports={};const o=t.re=[],u=t.safeRe=[],l=t.src=[],p=t.safeSrc=[],c=t.t={};let f=0;const d="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",i],[d,n]],w=b=>{for(const[D,V]of m)b=b.split(`${D}*`).join(`${D}{0,${V}}`).split(`${D}+`).join(`${D}{1,${V}}`);return b},v=(b,D,V)=>{const j=w(D),B=f++;s(b,B,D),c[b]=B,l[B]=D,p[B]=j,o[B]=new RegExp(D,V?"g":void 0),u[B]=new RegExp(j,V?"g":void 0)};v("NUMERICIDENTIFIER","0|[1-9]\\d*"),v("NUMERICIDENTIFIERLOOSE","\\d+"),v("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),v("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),v("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASEIDENTIFIER",`(?:${l[c.NONNUMERICIDENTIFIER]}|${l[c.NUMERICIDENTIFIER]})`),v("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NONNUMERICIDENTIFIER]}|${l[c.NUMERICIDENTIFIERLOOSE]})`),v("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),v("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),v("BUILDIDENTIFIER",`${d}+`),v("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),v("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),v("FULL",`^${l[c.FULLPLAIN]}$`),v("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),v("LOOSE",`^${l[c.LOOSEPLAIN]}$`),v("GTLT","((?:<|>)?=?)"),v("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),v("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),v("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),v("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),v("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),v("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),v("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),v("COERCE",`${l[c.COERCEPLAIN]}(?:$|[^\\d])`),v("COERCEFULL",l[c.COERCEPLAIN]+`(?:${l[c.PRERELEASE]})?(?:${l[c.BUILD]})?(?:$|[^\\d])`),v("COERCERTL",l[c.COERCE],!0),v("COERCERTLFULL",l[c.COERCEFULL],!0),v("LONETILDE","(?:~>?)"),v("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",v("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),v("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),v("LONECARET","(?:\\^)"),v("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",v("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),v("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),v("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),v("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),v("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",v("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),v("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),v("STAR","(<|>)?=?\\s*\\*"),v("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),v("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Ur,Ur.exports);var Et=Ur.exports;const fa=Object.freeze({loose:!0}),ha=Object.freeze({}),pa=e=>e?typeof e!="object"?fa:e:ha;var Wr=pa;const jn=/^[0-9]+$/,Oi=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;const r=jn.test(e),n=jn.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},da=(e,t)=>Oi(t,e);var Si={compareIdentifiers:Oi,rcompareIdentifiers:da};const kt=sr,{MAX_LENGTH:Pn,MAX_SAFE_INTEGER:Gt}=ir,{safeRe:Ht,t:Bt}=Et,ga=Wr,{compareIdentifiers:Cr}=Si;let ma=class oe{constructor(t,r){if(r=ga(r),t instanceof oe){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Pn)throw new TypeError(`version is longer than ${Pn} characters`);kt("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?Ht[Bt.LOOSE]:Ht[Bt.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>Gt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Gt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Gt||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s<Gt)return s}return i}):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(kt("SemVer.compare",this.version,this.options,t),!(t instanceof oe)){if(typeof t=="string"&&t===this.version)return 0;t=new oe(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof oe||(t=new oe(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof oe||(t=new oe(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 n=this.prerelease[r],i=t.prerelease[r];if(kt("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Cr(n,i)}while(++r)}compareBuild(t){t instanceof oe||(t=new oe(t,this.options));let r=0;do{const n=this.build[r],i=t.build[r];if(kt("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Cr(n,i)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){const i=`-${r}`.match(this.options.loose?Ht[Bt.PRERELEASELOOSE]:Ht[Bt.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Cr(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var xt=ma;const Mn=xt,va=(e,t,r=!1)=>{if(e instanceof Mn)return e;try{return new Mn(e,t)}catch(n){if(!r)return null;throw n}};var ya=va;const Ea=ya,xa=(e,t)=>{const r=Ea(e,t);return r?r.version:null};var Aa=xa;const ba=xt,$a=(e,t)=>new ba(e,t).major;var Ca=$a;const Un=xt,wa=(e,t,r)=>new Un(e,r).compare(new Un(t,r));var it=wa;const Oa=it,Sa=(e,t,r)=>Oa(e,t,r)>0;var _a=Sa;const Ta=it,Ia=(e,t,r)=>Ta(e,t,r)<0;var Ra=Ia;const Fa=it,Na=(e,t,r)=>Fa(e,t,r)===0;var La=Na;const Da=it,ja=(e,t,r)=>Da(e,t,r)!==0;var Pa=ja;const Ma=it,Ua=(e,t,r)=>Ma(e,t,r)>=0;var ka=Ua;const Ga=it,Ha=(e,t,r)=>Ga(e,t,r)<=0;var Ba=Ha;const Ya=La,qa=Pa,Xa=_a,Wa=ka,Va=Ra,Ka=Ba,za=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Ya(e,r,n);case"!=":return qa(e,r,n);case">":return Xa(e,r,n);case">=":return Wa(e,r,n);case"<":return Va(e,r,n);case"<=":return Ka(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var Ja=za;const{safeRe:Hh,t:Bh}=Et;let Za=class{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}};var Qa=Za,wr,kn;function ie(){if(kn)return wr;kn=1;const e=/\s+/g;class t{constructor(y,S){if(S=i(S),y instanceof t)return y.loose===!!S.loose&&y.includePrerelease===!!S.includePrerelease?y:new t(y.raw,S);if(y instanceof s)return this.raw=y.value,this.set=[[y]],this.formatted=void 0,this;if(this.options=S,this.loose=!!S.loose,this.includePrerelease=!!S.includePrerelease,this.raw=y.trim().replace(e," "),this.set=this.raw.split("||").map($=>this.parseRange($.trim())).filter($=>$.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const $=this.set[0];if(this.set=this.set.filter(_=>!v(_[0])),this.set.length===0)this.set=[$];else if(this.set.length>1){for(const _ of this.set)if(_.length===1&&b(_[0])){this.set=[_];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let y=0;y<this.set.length;y++){y>0&&(this.formatted+="||");const S=this.set[y];for(let $=0;$<S.length;$++)$>0&&(this.formatted+=" "),this.formatted+=S[$].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(y){const $=((this.options.includePrerelease&&m)|(this.options.loose&&w))+":"+y,_=n.get($);if(_)return _;const C=this.options.loose,x=C?l[p.HYPHENRANGELOOSE]:l[p.HYPHENRANGE];y=y.replace(x,Rt(this.options.includePrerelease)),o("hyphen replace",y),y=y.replace(l[p.COMPARATORTRIM],c),o("comparator trim",y),y=y.replace(l[p.TILDETRIM],f),o("tilde trim",y),y=y.replace(l[p.CARETTRIM],d),o("caret trim",y);let N=y.split(" ").map(P=>V(P,this.options)).join(" ").split(/\s+/).map(P=>It(P,this.options));C&&(N=N.filter(P=>(o("loose invalid filter",P,this.options),!!P.match(l[p.COMPARATORLOOSE])))),o("range list",N);const T=new Map,I=N.map(P=>new s(P,this.options));for(const P of I){if(v(P))return[P];T.set(P.value,P)}T.size>1&&T.has("")&&T.delete("");const X=[...T.values()];return n.set($,X),X}intersects(y,S){if(!(y instanceof t))throw new TypeError("a Range is required");return this.set.some($=>D($,S)&&y.set.some(_=>D(_,S)&&$.every(C=>_.every(x=>C.intersects(x,S)))))}test(y){if(!y)return!1;if(typeof y=="string")try{y=new u(y,this.options)}catch{return!1}for(let S=0;S<this.set.length;S++)if(Ft(this.set[S],y,this.options))return!0;return!1}}wr=t;const r=Qa,n=new r,i=Wr,s=or(),o=sr,u=xt,{safeRe:l,t:p,comparatorTrimReplace:c,tildeTrimReplace:f,caretTrimReplace:d}=Et,{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:w}=ir,v=E=>E.value==="<0.0.0-0",b=E=>E.value==="",D=(E,y)=>{let S=!0;const $=E.slice();let _=$.pop();for(;S&&$.length;)S=$.every(C=>_.intersects(C,y)),_=$.pop();return S},V=(E,y)=>(E=E.replace(l[p.BUILD],""),o("comp",E,y),E=se(E,y),o("caret",E),E=B(E,y),o("tildes",E),E=be(E,y),o("xrange",E),E=Tt(E,y),o("stars",E),E),j=E=>!E||E.toLowerCase()==="x"||E==="*",B=(E,y)=>E.trim().split(/\s+/).map(S=>at(S,y)).join(" "),at=(E,y)=>{const S=y.loose?l[p.TILDELOOSE]:l[p.TILDE];return E.replace(S,($,_,C,x,N)=>{o("tilde",E,$,_,C,x,N);let T;return j(_)?T="":j(C)?T=`>=${_}.0.0 <${+_+1}.0.0-0`:j(x)?T=`>=${_}.${C}.0 <${_}.${+C+1}.0-0`:N?(o("replaceTilde pr",N),T=`>=${_}.${C}.${x}-${N} <${_}.${+C+1}.0-0`):T=`>=${_}.${C}.${x} <${_}.${+C+1}.0-0`,o("tilde return",T),T})},se=(E,y)=>E.trim().split(/\s+/).map(S=>Me(S,y)).join(" "),Me=(E,y)=>{o("caret",E,y);const S=y.loose?l[p.CARETLOOSE]:l[p.CARET],$=y.includePrerelease?"-0":"";return E.replace(S,(_,C,x,N,T)=>{o("caret",E,_,C,x,N,T);let I;return j(C)?I="":j(x)?I=`>=${C}.0.0${$} <${+C+1}.0.0-0`:j(N)?C==="0"?I=`>=${C}.${x}.0${$} <${C}.${+x+1}.0-0`:I=`>=${C}.${x}.0${$} <${+C+1}.0.0-0`:T?(o("replaceCaret pr",T),C==="0"?x==="0"?I=`>=${C}.${x}.${N}-${T} <${C}.${x}.${+N+1}-0`:I=`>=${C}.${x}.${N}-${T} <${C}.${+x+1}.0-0`:I=`>=${C}.${x}.${N}-${T} <${+C+1}.0.0-0`):(o("no pr"),C==="0"?x==="0"?I=`>=${C}.${x}.${N}${$} <${C}.${x}.${+N+1}-0`:I=`>=${C}.${x}.${N}${$} <${C}.${+x+1}.0-0`:I=`>=${C}.${x}.${N} <${+C+1}.0.0-0`),o("caret return",I),I})},be=(E,y)=>(o("replaceXRanges",E,y),E.split(/\s+/).map(S=>Ue(S,y)).join(" ")),Ue=(E,y)=>{E=E.trim();const S=y.loose?l[p.XRANGELOOSE]:l[p.XRANGE];return E.replace(S,($,_,C,x,N,T)=>{o("xRange",E,$,_,C,x,N,T);const I=j(C),X=I||j(x),P=X||j(N),$e=P;return _==="="&&$e&&(_=""),T=y.includePrerelease?"-0":"",I?_===">"||_==="<"?$="<0.0.0-0":$="*":_&&$e?(X&&(x=0),N=0,_===">"?(_=">=",X?(C=+C+1,x=0,N=0):(x=+x+1,N=0)):_==="<="&&(_="<",X?C=+C+1:x=+x+1),_==="<"&&(T="-0"),$=`${_+C}.${x}.${N}${T}`):X?$=`>=${C}.0.0${T} <${+C+1}.0.0-0`:P&&($=`>=${C}.${x}.0${T} <${C}.${+x+1}.0-0`),o("xRange return",$),$})},Tt=(E,y)=>(o("replaceStars",E,y),E.trim().replace(l[p.STAR],"")),It=(E,y)=>(o("replaceGTE0",E,y),E.trim().replace(l[y.includePrerelease?p.GTE0PRE:p.GTE0],"")),Rt=E=>(y,S,$,_,C,x,N,T,I,X,P,$e)=>(j($)?S="":j(_)?S=`>=${$}.0.0${E?"-0":""}`:j(C)?S=`>=${$}.${_}.0${E?"-0":""}`:x?S=`>=${S}`:S=`>=${S}${E?"-0":""}`,j(I)?T="":j(X)?T=`<${+I+1}.0.0-0`:j(P)?T=`<${I}.${+X+1}.0-0`:$e?T=`<=${I}.${X}.${P}-${$e}`:E?T=`<${I}.${X}.${+P+1}-0`:T=`<=${T}`,`${S} ${T}`.trim()),Ft=(E,y,S)=>{for(let $=0;$<E.length;$++)if(!E[$].test(y))return!1;if(y.prerelease.length&&!S.includePrerelease){for(let $=0;$<E.length;$++)if(o(E[$].semver),E[$].semver!==s.ANY&&E[$].semver.prerelease.length>0){const _=E[$].semver;if(_.major===y.major&&_.minor===y.minor&&_.patch===y.patch)return!0}return!1}return!0};return wr}var Or,Gn;function or(){if(Gn)return Or;Gn=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(c,f){if(f=r(f),c instanceof t){if(c.loose===!!f.loose)return c;c=c.value}c=c.trim().split(/\s+/).join(" "),o("comparator",c,f),this.options=f,this.loose=!!f.loose,this.parse(c),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(c){const f=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],d=c.match(f);if(!d)throw new TypeError(`Invalid comparator: ${c}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new u(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(c){if(o("Comparator.test",c,this.options.loose),this.semver===e||c===e)return!0;if(typeof c=="string")try{c=new u(c,this.options)}catch{return!1}return s(c,this.operator,this.semver,this.options)}intersects(c,f){if(!(c instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new l(c.value,f).test(this.value):c.operator===""?c.value===""?!0:new l(this.value,f).test(c.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||c.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||c.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&c.operator.startsWith(">")||this.operator.startsWith("<")&&c.operator.startsWith("<")||this.semver.version===c.semver.version&&this.operator.includes("=")&&c.operator.includes("=")||s(this.semver,"<",c.semver,f)&&this.operator.startsWith(">")&&c.operator.startsWith("<")||s(this.semver,">",c.semver,f)&&this.operator.startsWith("<")&&c.operator.startsWith(">")))}}Or=t;const r=Wr,{safeRe:n,t:i}=Et,s=Ja,o=sr,u=xt,l=ie();return Or}const el=ie(),tl=(e,t,r)=>{try{t=new el(t,r)}catch{return!1}return t.test(e)};var rl=tl;ie();ie();ie();ie();ie();const nl=or(),{ANY:qh}=nl;ie();ie();ie();const Vr=or(),{ANY:Xh}=Vr;new Vr(">=0.0.0-0");new Vr(">=0.0.0");const Sr=Et,Hn=ir,Bn=Si,il=Aa,sl=Ca;or();ie();const ol=rl;var kr={valid:il,major:sl,satisfies:ol,re:Sr.re,src:Sr.src,tokens:Sr.t,SEMVER_SPEC_VERSION:Hn.SEMVER_SPEC_VERSION,RELEASE_TYPES:Hn.RELEASE_TYPES,compareIdentifiers:Bn.compareIdentifiers,rcompareIdentifiers:Bn.rcompareIdentifiers},et={},Kr={exports:{}};const L=(...e)=>e.every(t=>t)?e.join(""):"",q=e=>e?encodeURIComponent(e):"",At={sshtemplate:({domain:e,user:t,project:r,committish:n})=>`git@${e}:${t}/${r}.git${L("#",n)}`,sshurltemplate:({domain:e,user:t,project:r,committish:n})=>`git+ssh://git@${e}/${t}/${r}.git${L("#",n)}`,browsetemplate:({domain:e,user:t,project:r,committish:n,treepath:i})=>`https://${e}/${t}/${r}${L("/",i,"/",q(n))}`,browsefiletemplate:({domain:e,user:t,project:r,committish:n,treepath:i,path:s,fragment:o,hashformat:u})=>`https://${e}/${t}/${r}/${i}/${q(n||"master")}/${s}${L("#",u(o||""))}`,docstemplate:({domain:e,user:t,project:r,treepath:n,committish:i})=>`https://${e}/${t}/${r}${L("/",n,"/",q(i))}#readme`,httpstemplate:({auth:e,domain:t,user:r,project:n,committish:i})=>`git+https://${L(e,"@")}${t}/${r}/${n}.git${L("#",i)}`,filetemplate:({domain:e,user:t,project:r,committish:n,path:i})=>`https://${e}/${t}/${r}/raw/${q(n)||"master"}/${i}`,shortcuttemplate:({type:e,user:t,project:r,committish:n})=>`${e}:${t}/${r}${L("#",n)}`,pathtemplate:({user:e,project:t,committish:r})=>`${e}/${t}${L("#",r)}`,bugstemplate:({domain:e,user:t,project:r})=>`https://${e}/${t}/${r}/issues`,hashformat:_i},ee={};ee.github=Object.assign({},At,{protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",filetemplate:({auth:e,user:t,project:r,committish:n,path:i})=>`https://${L(e,"@")}raw.githubusercontent.com/${t}/${r}/${q(n)||"master"}/${i}`,gittemplate:({auth:e,domain:t,user:r,project:n,committish:i})=>`git://${L(e,"@")}${t}/${r}/${n}.git${L("#",i)}`,tarballtemplate:({domain:e,user:t,project:r,committish:n})=>`https://codeload.${e}/${t}/${r}/tar.gz/${q(n)||"master"}`,extract:e=>{let[,t,r,n,i]=e.pathname.split("/",5);if(!(n&&n!=="tree")&&(n||(i=e.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!t||!r)))return{user:t,project:r,committish:i}}});ee.bitbucket=Object.assign({},At,{protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",tarballtemplate:({domain:e,user:t,project:r,committish:n})=>`https://${e}/${t}/${r}/get/${q(n)||"master"}.tar.gz`,extract:e=>{let[,t,r,n]=e.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!t||!r)))return{user:t,project:r,committish:e.hash.slice(1)}}});ee.gitlab=Object.assign({},At,{protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",httpstemplate:({auth:e,domain:t,user:r,project:n,committish:i})=>`git+https://${L(e,"@")}${t}/${r}/${n}.git${L("#",i)}`,tarballtemplate:({domain:e,user:t,project:r,committish:n})=>`https://${e}/${t}/${r}/repository/archive.tar.gz?ref=${q(n)||"master"}`,extract:e=>{const t=e.pathname.slice(1);if(t.includes("/-/")||t.includes("/archive.tar.gz"))return;const r=t.split("/");let n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));const i=r.join("/");if(!(!i||!n))return{user:i,project:n,committish:e.hash.slice(1)}}});ee.gist=Object.assign({},At,{protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",sshtemplate:({domain:e,project:t,committish:r})=>`git@${e}:${t}.git${L("#",r)}`,sshurltemplate:({domain:e,project:t,committish:r})=>`git+ssh://git@${e}/${t}.git${L("#",r)}`,browsetemplate:({domain:e,project:t,committish:r})=>`https://${e}/${t}${L("/",q(r))}`,browsefiletemplate:({domain:e,project:t,committish:r,path:n,hashformat:i})=>`https://${e}/${t}${L("/",q(r))}${L("#",i(n))}`,docstemplate:({domain:e,project:t,committish:r})=>`https://${e}/${t}${L("/",q(r))}`,httpstemplate:({domain:e,project:t,committish:r})=>`git+https://${e}/${t}.git${L("#",r)}`,filetemplate:({user:e,project:t,committish:r,path:n})=>`https://gist.githubusercontent.com/${e}/${t}/raw${L("/",q(r))}/${n}`,shortcuttemplate:({type:e,project:t,committish:r})=>`${e}:${t}${L("#",r)}`,pathtemplate:({project:e,committish:t})=>`${e}${L("#",t)}`,bugstemplate:({domain:e,project:t})=>`https://${e}/${t}`,gittemplate:({domain:e,project:t,committish:r})=>`git://${e}/${t}.git${L("#",r)}`,tarballtemplate:({project:e,committish:t})=>`https://codeload.github.com/gist/${e}/tar.gz/${q(t)||"master"}`,extract:e=>{let[,t,r,n]=e.pathname.split("/",4);if(n!=="raw"){if(!r){if(!t)return;r=t,t=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:t,project:r,committish:e.hash.slice(1)}}},hashformat:function(e){return e&&"file-"+_i(e)}});ee.sourcehut=Object.assign({},At,{protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",browsefiletemplate:({domain:e,user:t,project:r,committish:n,treepath:i,path:s,fragment:o,hashformat:u})=>`https://${e}/${t}/${r}/${i}/${q(n||"main")}/${s}${L("#",u(o||""))}`,filetemplate:({domain:e,user:t,project:r,committish:n,path:i})=>`https://${e}/${t}/${r}/blob/${q(n)||"main"}/${i}`,httpstemplate:({domain:e,user:t,project:r,committish:n})=>`https://${e}/${t}/${r}.git${L("#",n)}`,tarballtemplate:({domain:e,user:t,project:r,committish:n})=>`https://${e}/${t}/${r}/archive/${q(n)||"main"}.tar.gz`,bugstemplate:({domain:e,user:t,project:r})=>`https://todo.sr.ht/${t}/${r}`,docstemplate:({domain:e,user:t,project:r,treepath:n,committish:i})=>`https://${e}/${t}/${r}${L("/",n,"/",q(i))}#readme`,extract:e=>{let[,t,r,n]=e.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),!(!t||!r)))return{user:t,project:r,committish:e.hash.slice(1)}}});const al=Object.keys(ee);ee.byShortcut={};ee.byDomain={};for(const e of al)ee.byShortcut[`${e}:`]=e,ee.byDomain[ee[e].domain]=e;function _i(e){return e.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}var Ti=ee;const ll=Ti;let cl=class{constructor(t,r,n,i,s,o,u={}){Object.assign(this,ll[t]),this.type=t,this.user=r,this.auth=n,this.project=i,this.committish=s,this.default=o,this.opts=u}hash(){return this.committish?`#${this.committish}`:""}ssh(t){return this._fill(this.sshtemplate,t)}_fill(t,r){if(typeof t=="function"){const n={...this,...this.opts,...r};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);const i=t(n);return n.noGitPlus&&i.startsWith("git+")?i.slice(4):i}return null}sshurl(t){return this._fill(this.sshurltemplate,t)}browse(t,r,n){return typeof t!="string"?this._fill(this.browsetemplate,t):(typeof r!="string"&&(n=r,r=null),this._fill(this.browsefiletemplate,{...n,fragment:r,path:t}))}docs(t){return this._fill(this.docstemplate,t)}bugs(t){return this._fill(this.bugstemplate,t)}https(t){return this._fill(this.httpstemplate,t)}git(t){return this._fill(this.gittemplate,t)}shortcut(t){return this._fill(this.shortcuttemplate,t)}path(t){return this._fill(this.pathtemplate,t)}tarball(t){return this._fill(this.tarballtemplate,{...t,noCommittish:!1})}file(t,r){return this._fill(this.filetemplate,{...r,path:t})}getDefaultRepresentation(){return this.default}toString(t){return this.default&&typeof this[this.default]=="function"?this[this.default](t):this.sshurl(t)}};var ul=cl,_r,Yn;function fl(){return Yn||(Yn=1,_r=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),_r}var hl=R;R.Node=De;R.create=R;function R(e){var t=this;if(t instanceof R||(t=new R),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach=="function")e.forEach(function(i){t.push(i)});else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)t.push(arguments[r]);return t}R.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};R.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++}};R.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++}};R.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)dl(this,arguments[e]);return this.length};R.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)gl(this,arguments[e]);return this.length};R.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}};R.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}};R.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,n=0;r!==null;n++)e.call(t,r.value,n,this),r=r.next};R.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,n=this.length-1;r!==null;n--)e.call(t,r.value,n,this),r=r.prev};R.prototype.get=function(e){for(var t=0,r=this.head;r!==null&&t<e;t++)r=r.next;if(t===e&&r!==null)return r.value};R.prototype.getReverse=function(e){for(var t=0,r=this.tail;r!==null&&t<e;t++)r=r.prev;if(t===e&&r!==null)return r.value};R.prototype.map=function(e,t){t=t||this;for(var r=new R,n=this.head;n!==null;)r.push(e.call(t,n.value,this)),n=n.next;return r};R.prototype.mapReverse=function(e,t){t=t||this;for(var r=new R,n=this.tail;n!==null;)r.push(e.call(t,n.value,this)),n=n.prev;return r};R.prototype.reduce=function(e,t){var r,n=this.head;if(arguments.length>1)r=t;else if(this.head)n=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var i=0;n!==null;i++)r=e(r,n.value,i),n=n.next;return r};R.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else if(this.tail)n=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var i=this.length-1;n!==null;i--)r=e(r,n.value,i),n=n.prev;return r};R.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;r!==null;t++)e[t]=r.value,r=r.next;return e};R.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;r!==null;t++)e[t]=r.value,r=r.prev;return e};R.prototype.slice=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new R;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=0,i=this.head;i!==null&&n<e;n++)i=i.next;for(;i!==null&&n<t;n++,i=i.next)r.push(i.value);return r};R.prototype.sliceReverse=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new R;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;i!==null&&n>t;n--)i=i.prev;for(;i!==null&&n>e;n--,i=i.prev)r.push(i.value);return r};R.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;i!==null&&n<e;n++)i=i.next;for(var s=[],n=0;i&&n<t;n++)s.push(i.value),i=this.removeNode(i);i===null&&(i=this.tail),i!==this.head&&i!==this.tail&&(i=i.prev);for(var n=0;n<r.length;n++)i=pl(this,i,r[n]);return s};R.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;r!==null;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=t,this.tail=e,this};function pl(e,t,r){var n=t===e.head?new De(r,null,t,e):new De(r,t,t.next,e);return n.next===null&&(e.tail=n),n.prev===null&&(e.head=n),e.length++,n}function dl(e,t){e.tail=new De(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function gl(e,t){e.head=new De(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function De(e,t,r,n){if(!(this instanceof De))return new De(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}try{fl()(R)}catch{}const ml=hl,Te=Symbol("max"),pe=Symbol("length"),Ye=Symbol("lengthCalculator"),dt=Symbol("allowStale"),Re=Symbol("maxAge"),fe=Symbol("dispose"),qn=Symbol("noDisposeOnSet"),k=Symbol("lruList"),re=Symbol("cache"),Ii=Symbol("updateAgeOnGet"),Tr=()=>1;let vl=class{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");this[Te]=t.max||1/0;const r=t.length||Tr;if(this[Ye]=typeof r!="function"?Tr:r,this[dt]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[Re]=t.maxAge||0,this[fe]=t.dispose,this[qn]=t.noDisposeOnSet||!1,this[Ii]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[Te]=t||1/0,ut(this)}get max(){return this[Te]}set allowStale(t){this[dt]=!!t}get allowStale(){return this[dt]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[Re]=t,ut(this)}get maxAge(){return this[Re]}set lengthCalculator(t){typeof t!="function"&&(t=Tr),t!==this[Ye]&&(this[Ye]=t,this[pe]=0,this[k].forEach(r=>{r.length=this[Ye](r.value,r.key),this[pe]+=r.length})),ut(this)}get lengthCalculator(){return this[Ye]}get length(){return this[pe]}get itemCount(){return this[k].length}rforEach(t,r){r=r||this;for(let n=this[k].tail;n!==null;){const i=n.prev;Xn(this,t,n,r),n=i}}forEach(t,r){r=r||this;for(let n=this[k].head;n!==null;){const i=n.next;Xn(this,t,n,r),n=i}}keys(){return this[k].toArray().map(t=>t.key)}values(){return this[k].toArray().map(t=>t.value)}reset(){this[fe]&&this[k]&&this[k].length&&this[k].forEach(t=>this[fe](t.key,t.value)),this[re]=new Map,this[k]=new ml,this[pe]=0}dump(){return this[k].map(t=>Kt(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[k]}set(t,r,n){if(n=n||this[Re],n&&typeof n!="number")throw new TypeError("maxAge must be a number");const i=n?Date.now():0,s=this[Ye](r,t);if(this[re].has(t)){if(s>this[Te])return Ze(this,this[re].get(t)),!1;const l=this[re].get(t).value;return this[fe]&&(this[qn]||this[fe](t,l.value)),l.now=i,l.maxAge=n,l.value=r,this[pe]+=s-l.length,l.length=s,this.get(t),ut(this),!0}const o=new yl(t,r,s,i,n);return o.length>this[Te]?(this[fe]&&this[fe](t,r),!1):(this[pe]+=o.length,this[k].unshift(o),this[re].set(t,this[k].head),ut(this),!0)}has(t){if(!this[re].has(t))return!1;const r=this[re].get(t).value;return!Kt(this,r)}get(t){return Ir(this,t,!0)}peek(t){return Ir(this,t,!1)}pop(){const t=this[k].tail;return t?(Ze(this,t),t.value):null}del(t){Ze(this,this[re].get(t))}load(t){this.reset();const r=Date.now();for(let n=t.length-1;n>=0;n--){const i=t[n],s=i.e||0;if(s===0)this.set(i.k,i.v);else{const o=s-r;o>0&&this.set(i.k,i.v,o)}}}prune(){this[re].forEach((t,r)=>Ir(this,r,!1))}};const Ir=(e,t,r)=>{const n=e[re].get(t);if(n){const i=n.value;if(Kt(e,i)){if(Ze(e,n),!e[dt])return}else r&&(e[Ii]&&(n.value.now=Date.now()),e[k].unshiftNode(n));return i.value}},Kt=(e,t)=>{if(!t||!t.maxAge&&!e[Re])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[Re]&&r>e[Re]},ut=e=>{if(e[pe]>e[Te])for(let t=e[k].tail;e[pe]>e[Te]&&t!==null;){const r=t.prev;Ze(e,t),t=r}},Ze=(e,t)=>{if(t){const r=t.value;e[fe]&&e[fe](r.key,r.value),e[pe]-=r.length,e[re].delete(r.key),e[k].removeNode(t)}};let yl=class{constructor(t,r,n,i,s){this.key=t,this.value=r,this.length=n,this.now=i,this.maxAge=s||0}};const Xn=(e,t,r,n)=>{let i=r.value;Kt(e,i)&&(Ze(e,r),e[dt]||(i=void 0)),i&&t.call(n,i.value,i.key,e)};var El=vl;const Wn=Qo,qt=Ti,xl=Kr.exports=ul,Al=El,Rr=new Al({max:1e3}),bl={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function $l(e){return bl[e]||e.slice(0,-1)}const Cl={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0},wl=Object.keys(qt.byShortcut).concat(["http:","https:","git:","git+ssh:","git+https:","ssh:"]);Kr.exports.fromUrl=function(e,t){if(typeof e!="string")return;const r=e+JSON.stringify(t||{});return Rr.has(r)||Rr.set(r,Ol(e,t)),Rr.get(r)};function Ol(e,t){if(!e)return;const r=_l(e)?"github:"+e:Sl(e),n=Il(r);if(!n)return n;const i=qt.byShortcut[n.protocol],s=qt.byDomain[n.hostname.startsWith("www.")?n.hostname.slice(4):n.hostname],o=i||s;if(!o)return;const u=qt[i||s];let l=null;Cl[n.protocol]&&(n.username||n.password)&&(l=`${n.username}${n.password?":"+n.password:""}`);let p=null,c=null,f=null,d=null;try{if(i){let m=n.pathname.startsWith("/")?n.pathname.slice(1):n.pathname;const w=m.indexOf("@");w>-1&&(m=m.slice(w+1));const v=m.lastIndexOf("/");v>-1?(c=decodeURIComponent(m.slice(0,v)),c||(c=null),f=decodeURIComponent(m.slice(v+1))):f=decodeURIComponent(m),f.endsWith(".git")&&(f=f.slice(0,-4)),n.hash&&(p=decodeURIComponent(n.hash.slice(1))),d="shortcut"}else{if(!u.protocols.includes(n.protocol))return;const m=u.extract(n);if(!m)return;c=m.user&&decodeURIComponent(m.user),f=decodeURIComponent(m.project),p=decodeURIComponent(m.committish),d=$l(n.protocol)}}catch(m){if(m instanceof URIError)return;throw m}return new xl(o,c,l,f,p,d,t)}const Sl=e=>{const t=e.indexOf(":"),r=e.slice(0,t+1);if(wl.includes(r))return e;const n=e.indexOf("@");return n>-1?n>t?`git+ssh://${e}`:e:e.indexOf("//")===t+1?e:e.slice(0,t+1)+"//"+e.slice(t+1)},_l=e=>{const t=e.indexOf("#"),r=e.indexOf("/"),n=e.indexOf("/",r+1),i=e.indexOf(":"),s=/\s/.exec(e),o=e.indexOf("@"),u=!s||t>-1&&s.index>t,l=o===-1||t>-1&&o>t,p=i===-1||t>-1&&i>t,c=n===-1||t>-1&&n>t,f=r>0,d=t>-1?e[t-1]!=="/":!e.endsWith("/"),m=!e.startsWith(".");return u&&f&&d&&m&&l&&p&&c},Tl=e=>{const t=e.indexOf("@"),r=e.lastIndexOf("#");let n=e.indexOf(":"),i=e.lastIndexOf(":",r>-1?r:1/0),s;return i>t&&(s=e.slice(0,i)+"/"+e.slice(i+1),n=s.indexOf(":"),i=s.lastIndexOf(":")),n===-1&&e.indexOf("//")===-1&&(s=`git+ssh://${s}`),s},Il=e=>{let t;try{t=new Wn.URL(e)}catch{}if(t)return t;const r=Tl(e);try{t=new Wn.URL(r)}catch{}return t};var Rl=Kr.exports;Object.defineProperty(et,"__esModule",{value:!0});et.encode=Ve=et.parsePackageString=void 0;const gt=nr("snyk:module"),Fl=Rl;gt.log=console.error.bind(console);et.default=Ri;function Ri(e,t,r){if(!e)throw new Error("requires string to parse into module");let n;t&&!r&&typeof t=="object"?r=t:n=t;let i=e;if(!n&&/^(?:(?:[a-z-]+)|(?:@[a-z-]+\/[a-z-]+)|(?:[a-z-]+\.[.a-z-]+:[a-z-]+))$/.test(i))return Yt(i,{name:i,version:"*"},r);n&&i.lastIndexOf("@")<1&&(gt("appending version onto string"),i+="@"+n);const s=Vn(i);if(s)return Yt(i,Kn(s),r);let o=i.split("@");i.indexOf("@")===0&&(o=o.slice(1),o[0]="@"+o[0]);const u=o[1]&&Vn(o[1]);if(u)return Yt(i,Kn(u),r);o.length===1&&o.push("*");const l={name:o[0],version:o.slice(1).join("@")};return Yt(i,l,r)}var Ve=et.parsePackageString=Ri;function Vn(e){if(e.slice(-1)==="/"&&(e=e.slice(0,-1)),e.toLowerCase().indexOf("://github.com/")!==-1&&e.indexOf("http")===0){const r=e.replace(/https?:\/\/github.com\//,"").split("/");e=r.shift()+"/"+r.shift(),r.length&&(e+="#"+r.pop())}return Fl.fromUrl(e)}function Kn(e){if(!e.project||!e.user){const r=new Error("not supported: failed to fully parse");throw r.code=501,r}const t={name:e.project,version:e.user+"/"+e.project};return e.committish&&(t.version+="#"+e.committish),t}function Nl(e){return e[0]+encodeURIComponent(e.slice(1))}et.encode=Nl;function Yt(e,t,r){if(r||(r={}),r.packageManager==="maven"){if(e.indexOf(":")===-1)throw new Error("invalid Maven package name: "+e);return t}return(t.version.match(/^(https?:)|(git[:+])/i)||t.name.indexOf("://")!==-1)&&(gt("not supported %s@%s (ext)",t.name,t.version),r.loose?delete t.version:gt("external module: "+Ll(t))),(t.version==="latest"||!t.version)&&(t.version="*"),gt('%s => { name: "%s", version: "%s" }',e,t.name,t.version),t}function Ll(e){return e.name+"@"+e.version}const Fi=Ae("snyk:policy");Fi.log=console.error.bind(console);const J=Ae("snyk:protect");J.log=console.error.bind(console);function Dl(e,t){const r=t.split(" > ");J("checking path: %s vs. %s",t,e);let n=0;const i=r.every((s,o)=>{J("for %s...(against %s)",s,e[o+n]);let u=e[o+n]?Ve(e[o+n]):{};if(s==="*"){if(J("star rule"),!r[o+1])return!0;const c=Ve(r[o+1]);if(c){J("next",c);for(let f=o;o<r.length;f++){if(!e[o+n])return!1;if(u=Ve(e[o+n]),J("fromPkg",u,c),c.name===u.name){n--,J("next has a match");break}J("pushing offset"),n++}}return!0}if(J("next test",s,u),s===e[o+n])return J("exact match"),!0;const l=Ve(s);let p=l.version;if(p==="*"&&(p=u.version),l.name===u.name){if(u.version===p)return J("exact version match"),!0;if(kr.valid(u.version)&&kr.satisfies(u.version,p))return J("semver match"),!0}return J("failed match"),!1});return J("result of path test %s: %s",t,i),i}function bt(e,t,r="packageManager"){return Object.keys(t).some(n=>jl(e,n,r))}function jl(e,t,r){if(r==="exact")return Pl(e,t);let n=!1;const i=e.from.slice(1);return t.indexOf(i.join(" > "))!==-1?(Fi("%s exact match from %s",e.id,i),n=!0):Dl(i,t)&&(n=!0),n}function Pl(e,t){const r=t.split(" > ");if(r[r.length-1]==="*"){const n=e.from.length-r.length;for(let i=0;i<n;i++)r.push("*")}if(r.length!==e.from.length)return!1;for(let n=0;n<r.length;n++)if(r[n]!==e.from[n]&&r[n]!=="*")return!1;return!0}function Ml(e,t){let r=null;if(!e||!t)return r;for(const n of["ignore","patch"])Object.keys(e[n]||[]).forEach(i=>{if(i===t.id){for(const s of e[n][i])if(bt(t,s)){const o=Object.keys(s).pop();r={type:n,id:t.id,rule:t.from,...s[o]}}}});return r}var M={},$t={},te={};function Ni(e){return typeof e>"u"||e===null}function Ul(e){return typeof e=="object"&&e!==null}function kl(e){return Array.isArray(e)?e:Ni(e)?[]:[e]}function Gl(e,t){var r,n,i,s;if(t)for(s=Object.keys(t),r=0,n=s.length;r<n;r+=1)i=s[r],e[i]=t[i];return e}function Hl(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function Bl(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}te.isNothing=Ni;te.isObject=Ul;te.toArray=kl;te.repeat=Hl;te.isNegativeZero=Bl;te.extend=Gl;function vt(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}vt.prototype=Object.create(Error.prototype);vt.prototype.constructor=vt;vt.prototype.toString=function(t){var r=this.name+": ";return r+=this.reason||"(unknown reason)",!t&&this.mark&&(r+=" "+this.mark.toString()),r};var Ct=vt,zn=te;function zr(e,t,r,n,i){this.name=e,this.buffer=t,this.position=r,this.line=n,this.column=i}zr.prototype.getSnippet=function(t,r){var n,i,s,o,u;if(!this.buffer)return null;for(t=t||4,r=r||75,n="",i=this.position;i>0&&`\0\r …\u2028\u2029`.indexOf(this.buffer.charAt(i-1))===-1;)if(i-=1,this.position-i>r/2-1){n=" ... ",i+=5;break}for(s="",o=this.position;o<this.buffer.length&&`\0\r …\u2028\u2029`.indexOf(this.buffer.charAt(o))===-1;)if(o+=1,o-this.position>r/2-1){s=" ... ",o-=5;break}return u=this.buffer.slice(i,o),zn.repeat(" ",t)+n+u+s+` `+zn.repeat(" ",t+this.position-i+n.length)+"^"};zr.prototype.toString=function(t){var r,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),t||(r=this.getSnippet(),r&&(n+=`: `+r)),n};var Yl=zr,Jn=Ct,ql=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],Xl=["scalar","sequence","mapping"];function Wl(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}function Vl(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(ql.indexOf(r)===-1)throw new Jn('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=Wl(t.styleAliases||null),Xl.indexOf(this.kind)===-1)throw new Jn('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var H=Vl,Zn=te,Xt=Ct,Kl=H;function Gr(e,t,r){var n=[];return e.include.forEach(function(i){r=Gr(i,t,r)}),e[t].forEach(function(i){r.forEach(function(s,o){s.tag===i.tag&&s.kind===i.kind&&n.push(o)}),r.push(i)}),r.filter(function(i,s){return n.indexOf(s)===-1})}function zl(){var e={scalar:{},sequence:{},mapping:{},fallback:{}},t,r;function n(i){e[i.kind][i.tag]=e.fallback[i.tag]=i}for(t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(n);return e}function Ke(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(t){if(t.loadKind&&t.loadKind!=="scalar")throw new Xt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=Gr(this,"implicit",[]),this.compiledExplicit=Gr(this,"explicit",[]),this.compiledTypeMap=zl(this.compiledImplicit,this.compiledExplicit)}Ke.DEFAULT=null;Ke.create=function(){var t,r;switch(arguments.length){case 1:t=Ke.DEFAULT,r=arguments[0];break;case 2:t=arguments[0],r=arguments[1];break;default:throw new Xt("Wrong number of arguments for Schema.create function")}if(t=Zn.toArray(t),r=Zn.toArray(r),!t.every(function(n){return n instanceof Ke}))throw new Xt("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!r.every(function(n){return n instanceof Kl}))throw new Xt("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new Ke({include:t,explicit:r})};var st=Ke,Jl=H,Zl=new Jl("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Ql=H,ec=new Ql("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),tc=H,rc=new tc("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),nc=st,Jr=new nc({explicit:[Zl,ec,rc]}),ic=H;function sc(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function oc(){return null}function ac(e){return e===null}var lc=new ic("t