@coalescesoftware/coa 7.41.4 → 7.41.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/coa.js CHANGED
@@ -7874,7 +7874,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}};(function(r)
7874
7874
  `,p),p}return i}});var b$o=m(($TC,xml)=>{"use strict";xml.exports=Oml;function Oml(r,t,n){r instanceof RegExp&&(r=Rml(r,n)),t instanceof RegExp&&(t=Rml(t,n));var i=wml(r,t,n);return i&&{start:i[0],end:i[1],pre:n.slice(0,i[0]),body:n.slice(i[0]+r.length,i[1]),post:n.slice(i[1]+t.length)}}function Rml(r,t){var n=t.match(r);return n?n[0]:null}Oml.range=wml;function wml(r,t,n){var i,o,s,a,u,p=n.indexOf(r),c=n.indexOf(t,p+1),l=p;if(p>=0&&c>0){if(r===t)return[p,c];for(i=[],s=n.length;l>=0&&!u;)l==p?(i.push(l),p=n.indexOf(r,l+1)):i.length==1?u=[i.pop(),c]:(o=i.pop(),o<s&&(s=o,a=c),c=n.indexOf(t,l+1)),l=p<c&&p>=0?p:c;i.length&&(u=[s,a])}return u}});var qml=m((XTC,kml)=>{var Mml=b$o();kml.exports=Fj1;var Pml="\0SLASH"+Math.random()+"\0",Nml="\0OPEN"+Math.random()+"\0",C$o="\0CLOSE"+Math.random()+"\0",Dml="\0COMMA"+Math.random()+"\0",Bml="\0PERIOD"+Math.random()+"\0";function E$o(r){return parseInt(r,10)==r?parseInt(r,10):r.charCodeAt(0)}function kj1(r){return r.split("\\\\").join(Pml).split("\\{").join(Nml).split("\\}").join(C$o).split("\\,").join(Dml).split("\\.").join(Bml)}function qj1(r){return r.split(Pml).join("\\").split(Nml).join("{").split(C$o).join("}").split(Dml).join(",").split(Bml).join(".")}function Lml(r){if(!r)return[""];var t=[],n=Mml("{","}",r);if(!n)return r.split(",");var i=n.pre,o=n.body,s=n.post,a=i.split(",");a[a.length-1]+="{"+o+"}";var u=Lml(s);return s.length&&(a[a.length-1]+=u.shift(),a.push.apply(a,u)),t.push.apply(t,a),t}function Fj1(r){return r?(r.substr(0,2)==="{}"&&(r="\\{\\}"+r.substr(2)),YNt(kj1(r),!0).map(qj1)):[]}function Uj1(r){return"{"+r+"}"}function zj1(r){return/^-?0\d/.test(r)}function Qj1(r,t){return r<=t}function jj1(r,t){return r>=t}function YNt(r,t){var n=[],i=Mml("{","}",r);if(!i)return[r];var o=i.pre,s=i.post.length?YNt(i.post,!1):[""];if(/\$$/.test(i.pre))for(var a=0;a<s.length;a++){var u=o+"{"+i.body+"}"+s[a];n.push(u)}else{var p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=p||c,d=i.body.indexOf(",")>=0;if(!l&&!d)return i.post.match(/,.*\}/)?(r=i.pre+"{"+i.body+C$o+i.post,YNt(r)):[r];var f;if(l)f=i.body.split(/\.\./);else if(f=Lml(i.body),f.length===1&&(f=YNt(f[0],!1).map(Uj1),f.length===1))return s.map(function($){return i.pre+f[0]+$});var h;if(l){var A=E$o(f[0]),E=E$o(f[1]),v=Math.max(f[0].length,f[1].length),T=f.length==3?Math.abs(E$o(f[2])):1,O=Qj1,D=E<A;D&&(T*=-1,O=jj1);var L=f.some(zj1);h=[];for(var k=A;O(k,E);k+=T){var U;if(c)U=String.fromCharCode(k),U==="\\"&&(U="");else if(U=String(k),L){var G=v-U.length;if(G>0){var H=new Array(G+1).join("0");k<0?U="-"+H+U.slice(1):U=H+U}}h.push(U)}}else{h=[];for(var W=0;W<f.length;W++)h.push.apply(h,YNt(f[W],!1))}for(var W=0;W<h.length;W++)for(var a=0;a<s.length;a++){var u=o+h[W]+s[a];(!t||l||u)&&n.push(u)}}return n}});var jml,B_,Gj1,Hj1,Vj1,Wj1,Kj1,Yj1,Jj1,$j1,Xj1,Zj1,eG1,tG1,rG1,nG1,iG1,oG1,sG1,aG1,zml,Qml,uG1,zOr,v$o,cG1,fz,Fml,T$o,S$o,lG1,pG1,Gml,Uml,dG1,fG1,WCe,hG1,Hml,gG1,QOr,UOr,AG1,I$o,mG1,yG1,bG1,EG1,grt,JNt=V(()=>{jml=gt(qml(),1),B_=(r,t,n={})=>(QOr(t),!n.nocomment&&t.charAt(0)==="#"?!1:new grt(t,n).match(r)),Gj1=/^\*+([^+@!?\*\[\(]*)$/,Hj1=r=>t=>!t.startsWith(".")&&t.endsWith(r),Vj1=r=>t=>t.endsWith(r),Wj1=r=>(r=r.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(r)),Kj1=r=>(r=r.toLowerCase(),t=>t.toLowerCase().endsWith(r)),Yj1=/^\*+\.\*+$/,Jj1=r=>!r.startsWith(".")&&r.includes("."),$j1=r=>r!=="."&&r!==".."&&r.includes("."),Xj1=/^\.\*+$/,Zj1=r=>r!=="."&&r!==".."&&r.startsWith("."),eG1=/^\*+$/,tG1=r=>r.length!==0&&!r.startsWith("."),rG1=r=>r.length!==0&&r!=="."&&r!=="..",nG1=/^\?+([^+@!?\*\[\(]*)?$/,iG1=([r,t=""])=>{let n=zml([r]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},oG1=([r,t=""])=>{let n=Qml([r]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},sG1=([r,t=""])=>{let n=Qml([r]);return t?i=>n(i)&&i.endsWith(t):n},aG1=([r,t=""])=>{let n=zml([r]);return t?i=>n(i)&&i.endsWith(t):n},zml=([r])=>{let t=r.length;return n=>n.length===t&&!n.startsWith(".")},Qml=([r])=>{let t=r.length;return n=>n.length===t&&n!=="."&&n!==".."},uG1=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",zOr=uG1==="win32",v$o=zOr?{sep:"\\"}:{sep:"/"},cG1=v$o.sep;B_.sep=cG1;fz=Symbol("globstar **");B_.GLOBSTAR=fz;Fml={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},T$o="[^/]",S$o=T$o+"*?",lG1="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",pG1="(?:(?!(?:\\/|^)\\.).)*?",Gml=r=>r.split("").reduce((t,n)=>(t[n]=!0,t),{}),Uml=Gml("().*{}+?[]^$\\!"),dG1=Gml("[.("),fG1=(r,t={})=>n=>B_(n,r,t);B_.filter=fG1;WCe=(r,t={})=>Object.assign({},r,t),hG1=r=>{if(!r||typeof r!="object"||!Object.keys(r).length)return B_;let t=B_;return Object.assign((i,o,s={})=>t(i,o,WCe(r,s)),{Minimatch:class extends t.Minimatch{constructor(o,s={}){super(o,WCe(r,s))}static defaults(o){return t.defaults(WCe(r,o)).Minimatch}},filter:(i,o={})=>t.filter(i,WCe(r,o)),defaults:i=>t.defaults(WCe(r,i)),makeRe:(i,o={})=>t.makeRe(i,WCe(r,o)),braceExpand:(i,o={})=>t.braceExpand(i,WCe(r,o)),match:(i,o,s={})=>t.match(i,o,WCe(r,s)),sep:t.sep,GLOBSTAR:fz})};B_.defaults=hG1;Hml=(r,t={})=>(QOr(r),t.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:(0,jml.default)(r));B_.braceExpand=Hml;gG1=1024*64,QOr=r=>{if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>gG1)throw new TypeError("pattern is too long")},UOr=Symbol("subparse"),AG1=(r,t={})=>new grt(r,t).makeRe();B_.makeRe=AG1;I$o=(r,t,n={})=>{let i=new grt(t,n);return r=r.filter(o=>i.match(o)),i.options.nonull&&!r.length&&r.push(t),r};B_.match=I$o;mG1=r=>r.replace(/\\(.)/g,"$1"),yG1=r=>r.replace(/\\([^-\]])/g,"$1"),bG1=r=>r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),EG1=r=>r.replace(/[[\]\\]/g,"\\$&"),grt=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;regexp;constructor(t,n={}){QOr(t),n=n||{},this.options=n,this.pattern=t,this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.globSet=[],this.globParts=[],this.set=[],this.make()}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=this.braceExpand(),n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(s=>this.slashSplit(s));if(this.options.noglobstar)this.globParts=i;else{for(let s of i){let a;do{a=!1;for(let u=0;u<s.length-1;u++)s[u]==="*"&&s[u-1]==="**"&&(s[u]="**",s[u-1]="*",a=!0)}while(a)}this.globParts=i.map(s=>(s=s.reduce((a,u)=>{let p=a[a.length-1];return u==="**"&&p==="**"?a:u===".."&&p&&p!==".."&&p!=="."&&p!=="**"?(a.pop(),a):(a.push(u),a)},[]),s.length===0?[""]:s))}this.debug(this.pattern,this.globParts);let o=this.globParts.map((s,a,u)=>s.map(p=>this.parse(p)));if(this.debug(this.pattern,o),this.set=o.filter(s=>s.indexOf(!1)===-1),zOr)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,i=0;for(let o=0;o<t.length&&t.charAt(o)==="!";o++)n=!n,i++;i&&(this.pattern=t.slice(i)),this.negate=n}matchOne(t,n,i=!1){let o=this.options;if(zOr){let A=t[0]===""&&t[1]===""&&t[2]==="?"&&typeof t[3]=="string"&&/^[a-z]:$/i.test(t[3]),E=n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]);if(A&&E){let v=t[3],T=n[3];v.toLowerCase()===T.toLowerCase()&&(t[3]=T)}else if(E&&typeof t[0]=="string"){let v=n[3],T=t[0];v.toLowerCase()===T.toLowerCase()&&(n[3]=T,n=n.slice(3))}else if(A&&typeof n[0]=="string"){let v=t[3];v.toLowerCase()===n[0].toLowerCase()&&(n[0]=v,t=t.slice(3))}}this.debug("matchOne",this,{file:t,pattern:n}),this.debug("matchOne",t.length,n.length);for(var s=0,a=0,u=t.length,p=n.length;s<u&&a<p;s++,a++){this.debug("matchOne loop");var c=n[a],l=t[s];if(this.debug(n,c,l),c===!1)return!1;if(c===fz){this.debug("GLOBSTAR",[n,c,l]);var d=s,f=a+1;if(f===p){for(this.debug("** at the end");s<u;s++)if(t[s]==="."||t[s]===".."||!o.dot&&t[s].charAt(0)===".")return!1;return!0}for(;d<u;){var h=t[d];if(this.debug(`
7875
7875
  globstar while`,t,d,n,f,h),this.matchOne(t.slice(d),n.slice(f),i))return this.debug("globstar found match!",d,u,h),!0;if(h==="."||h===".."||!o.dot&&h.charAt(0)==="."){this.debug("dot detected!",t,d,n,f);break}this.debug("globstar swallow a segment, and continue"),d++}return!!(i&&(this.debug(`
7876
7876
  >>> no match, partial?`,t,d,n,f),d===u))}let A;if(typeof c=="string"?(A=l===c,this.debug("string match",c,l,A)):(A=c.test(l),this.debug("pattern match",c,l,A)),!A)return!1}if(s===u&&a===p)return!0;if(s===u)return i;if(a===p)return s===u-1&&t[s]==="";throw new Error("wtf?")}braceExpand(){return Hml(this.pattern,this.options)}parse(t,n){QOr(t);let i=this.options;if(t==="**")if(i.noglobstar)t="*";else return fz;if(t==="")return"";let o,s=null;n!==UOr&&((o=t.match(eG1))?s=i.dot?rG1:tG1:(o=t.match(Gj1))?s=(i.nocase?i.dot?Kj1:Wj1:i.dot?Vj1:Hj1)(o[1]):(o=t.match(nG1))?s=(i.nocase?i.dot?oG1:iG1:i.dot?sG1:aG1)(o):(o=t.match(Yj1))?s=i.dot?$j1:Jj1:(o=t.match(Xj1))&&(s=Zj1));let a="",u=!1,p=!1,c=[],l=[],d=!1,f=!1,h=-1,A=-1,E,v,T,O=t.charAt(0)===".",D=i.dot||O,L=()=>O?"":D?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",k=W=>W.charAt(0)==="."?"":i.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",U=()=>{if(d){switch(d){case"*":a+=S$o,u=!0;break;case"?":a+=T$o,u=!0;break;default:a+="\\"+d;break}this.debug("clearStateChar %j %j",d,a),d=!1}};for(let W=0,$;W<t.length&&($=t.charAt(W));W++){if(this.debug("%s %s %s %j",t,W,a,$),p){if($==="/")return!1;Uml[$]&&(a+="\\"),a+=$,p=!1;continue}switch($){case"/":return!1;case"\\":if(f&&t.charAt(W+1)==="-"){a+=$;continue}U(),p=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",t,W,a,$),f){this.debug(" in class"),$==="!"&&W===A+1&&($="^"),a+=$;continue}this.debug("call clearStateChar %j",d),U(),d=$,i.noext&&U();continue;case"(":{if(f){a+="(";continue}if(!d){a+="\\(";continue}let q={type:d,start:W-1,reStart:a.length,open:Fml[d].open,close:Fml[d].close};this.debug(this.pattern," ",q),c.push(q),a+=q.open,q.start===0&&q.type!=="!"&&(O=!0,a+=k(t.slice(W+1))),this.debug("plType %j %j",d,a),d=!1;continue}case")":{let q=c[c.length-1];if(f||!q){a+="\\)";continue}c.pop(),U(),u=!0,v=q,a+=v.close,v.type==="!"&&l.push(Object.assign(v,{reEnd:a.length}));continue}case"|":{let q=c[c.length-1];if(f||!q){a+="\\|";continue}U(),a+="|",q.start===0&&q.type!=="!"&&(O=!0,a+=k(t.slice(W+1)));continue}case"[":if(U(),f){a+="\\"+$;continue}f=!0,A=W,h=a.length,a+=$;continue;case"]":if(W===A+1||!f){a+="\\"+$;continue}E=t.substring(A+1,W);try{RegExp("["+EG1(yG1(E))+"]"),a+=$}catch{a=a.substring(0,h)+"(?:$.)"}u=!0,f=!1;continue;default:U(),Uml[$]&&!($==="^"&&f)&&(a+="\\"),a+=$;break}}for(f&&(E=t.slice(A+1),T=this.parse(E,UOr),a=a.substring(0,h)+"\\["+T[0],u=u||T[1]),v=c.pop();v;v=c.pop()){let W;W=a.slice(v.reStart+v.open.length),this.debug(this.pattern,"setting tail",a,v),W=W.replace(/((?:\\{2}){0,64})(\\?)\|/g,(q,J,Y)=>(Y||(Y="\\"),J+J+Y+"|")),this.debug(`tail=%j
7877
- %s`,W,W,v,a);let $=v.type==="*"?S$o:v.type==="?"?T$o:"\\"+v.type;u=!0,a=a.slice(0,v.reStart)+$+"\\("+W}U(),p&&(a+="\\\\");let G=dG1[a.charAt(0)];for(let W=l.length-1;W>-1;W--){let $=l[W],q=a.slice(0,$.reStart),J=a.slice($.reStart,$.reEnd-8),Y=a.slice($.reEnd),z=a.slice($.reEnd-8,$.reEnd)+Y,Z=q.split(")").length,ee=q.split("(").length-Z,ne=Y;for(let te=0;te<ee;te++)ne=ne.replace(/\)[+*?]?/,"");Y=ne;let ae=Y===""&&n!==UOr?"(?:$|\\/)":"";a=q+J+Y+ae+z}if(a!==""&&u&&(a="(?=.)"+a),G&&(a=L()+a),n===UOr)return[a,u];if(i.nocase&&!u&&!i.nocaseMagicOnly&&(u=t.toUpperCase()!==t.toLowerCase()),!u)return mG1(t);let H=i.nocase?"i":"";try{let W=s?{_glob:t,_src:a,test:s}:{_glob:t,_src:a};return Object.assign(new RegExp("^"+a+"$",H),W)}catch(W){return this.debug("invalid regexp",W),new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,i=n.noglobstar?S$o:n.dot?lG1:pG1,o=n.nocase?"i":"",s=t.map(a=>{let u=a.map(p=>typeof p=="string"?bG1(p):p===fz?fz:p._src);return u.forEach((p,c)=>{let l=u[c+1],d=u[c-1];p!==fz||d===fz||(d===void 0?l!==void 0&&l!==fz?u[c+1]="(?:\\/|"+i+"\\/)?"+l:u[c]=i:l===void 0?u[c-1]=d+"(?:\\/|"+i+")?":l!==fz&&(u[c-1]=d+"(?:\\/|\\/"+i+"\\/)"+l,u[c+1]=fz))}),u.filter(p=>p!==fz).join("/")}).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,o)}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):zOr&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let i=this.options;v$o.sep!=="/"&&(t=t.split(v$o.sep).join("/"));let o=this.slashSplit(t);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let a=o[o.length-1];if(!a)for(let u=o.length-2;!a&&u>=0;u--)a=o[u];for(let u=0;u<s.length;u++){let p=s[u],c=o;if(i.matchBase&&p.length===1&&(c=[a]),this.matchOne(c,p,n))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return B_.defaults(t).Minimatch}};B_.Minimatch=grt});var Wml,Kml,Yml,Jml,$ml,Xml,Zml,eyl,tyl,ryl,nyl,Vml,Art,iyl=V(()=>{"use strict";JNt();Wml=2,Kml=1,Yml=3,Jml=2,$ml=8,Xml=5,Zml=6,eyl=new RegExp(/([\+]?){([\s\S]+)}([\+](?![\+]))?\s*/g),tyl=new RegExp(/((\w+):\s*((?:["])((([^\"\+\r\n\[/\\]+))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),ryl=new RegExp(/((\w+):\s*(((?:["])(((?:[^"]|"")*))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),nyl=new RegExp(/((?:[^\+\ \r\n\[\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+)\s*/g),Vml="",Art=(r,t)=>{if(t==="*")return r.some(o=>o!=null&&String(o).length>0);let n=r.map(o=>o!=null?String(o).replace(/\//g,Vml):""),i=t.replace(/\//g,Vml);return!!I$o(n,i).length}});var mrt,i3C,oyl,syl,ayl,jOr,uyl,GOr=V(()=>{"use strict";Zr();Yo();vd();z3();ar();y$o();iyl();mrt=$e("SEARCH"),i3C=x.object({include:x.string(),exclude:x.string(),enabled:x.boolean()}),oyl={name:{MatchFunction:Art,MatchList:r=>[r.operation.name]},location:{MatchFunction:Art,MatchList:r=>[r.operation.locationName]},nodeType:{MatchFunction:Art,MatchList:r=>[r.operation.sqlType]},subgraph:{MatchFunction:Art,MatchList:r=>[r?.id?.toString(),r.name]},nodeID:{MatchFunction:Art,MatchList:r=>[r]}},syl=r=>{let t=[];return r.forEach((n,i)=>{if(n==="+{"||n==="{"||n==="}"||n==="}+")return;let o=n,s=n.split(""),a=s[s.length-1],u=s[0];a!=="}"&&a!=="+"&&(o=o+r[i+1]),u!=="{"&&u!=="+"&&(o=r[i-1]+o),t.push(o)}),t},ayl=(r,t,n,i=!1)=>{let{steps:o,graphInformation:s,allSubgraphs:a,allStepTypesYAML:u}=n,p={},c=ZI()?Date.now():performance.now(),l=r;l||(l=t);let d=l.split(/(\}\+?)\s*(or|OR|\|\|)\s*(\+?\{)/).filter(A=>!(A==="OR"||A==="or"||A==="||")),f=syl(d);f.length||(f=[t]),mrt.debug("got unions",f,"searchStringTouse",l,"defaultSearchString",t,"steps",o),f.forEach(A=>{let E=A.split(/(\}\+?)\s*(and|AND|\,)\s*(\+?\{)/).filter(L=>!(L==="AND"||L==="and"||L===",")),v=syl(E),T=[];v.forEach(L=>{let k={};mrt.debug("Got intersection:",L);let U=[...L.matchAll(eyl)];if(mrt.debug("Got matches:",L,U),!U[0])return;let G=U[0][Wml],H={prefix:U[0][Kml]||"",postfix:U[0][Yml]||""};if(G.indexOf(":")>-1){let q=i?ryl:tyl,J=[...G.trim().matchAll(q)],Y=i?Zml:Xml;J.forEach(z=>{let Z=z[Jml],ee=z[$ml]||z[Y];H[Z]=ee})}else{let J=[...G.trim().matchAll(nyl)][0];J&&(H.name=J[0])}MM(H);let W=H;mrt.debug("Got groups ",L,W);let $=new Set;if(W.subgraph?Object.values(a).forEach(q=>{let J=oyl.subgraph,Y=J.MatchList(q);if(J.MatchFunction(Y,W.subgraph)){let{steps:Z}=q;Z.forEach(ee=>{$.add(ee.toString())})}else return}):$=new Set(Object.keys(o)),W.nodeType){let{nodeType:q}=W;if(!u[q]){let J=q;Object.entries(u).forEach(([Y,z])=>{z.name===q&&(J=Y)}),W.nodeType=J}}Object.keys(o).forEach(q=>{if(!W){mrt.emerg("got an unexpected undefined value for match",l,W,L);return}let J=$.has(q);if(Object.entries(W).forEach(([Y,z])=>{let Z=o[q];if(Y==="nodeID"&&(Z=q),Y==="subgraph"){J=$.has(q);return}let ee=oyl[Y];if(ee){let ne=ee.MatchList(Z).filter(ae=>ae!=null);J=J&&ee.MatchFunction(ne,z)}}),J){if(k[q]=!0,W.prefix&&s){let Y=m$o(s,q,"predecessors");Object.values(Y).forEach(z=>[...z.keys()].forEach(Z=>k[Z]=!0))}if(W.postfix&&s){let Y=m$o(s,q,"successors");Object.values(Y).forEach(z=>[...z.keys()].forEach(Z=>k[Z]=!0))}}}),T.push(k)}),T.length||T.push({});let O={};Object.keys(o).forEach(L=>{O[L]=!0});let D=T.reduce((L,k)=>Object.fromEntries(nLc(L,k).map(U=>[U,!0])),O);p={...p,...D}});let h=ZI()?Date.now():performance.now();return mrt.debug("Time that search took: ",h-c),p},jOr=(r,t,n,i=!1)=>{let o=ayl(`${r}`,"{ * }",n,i),s=ayl(`${t}`,"!*",n,i),a=o;return Object.keys(s).forEach(u=>{delete a[u]}),{stepsResult:a}},uyl=(r,t,n,i)=>{let o=[];return t.forEach(s=>{let a=i[s];if(a){let{name:u}=a,p=`{ subgraph: "${u}" }`;o.push(p)}}),r.forEach(s=>{let a=n[s];if(a){let{locationName:u,name:p}=a.operation,c=`{ location: "${u}" name: "${p}" }`;o.push(c)}}),o}});var SG1,cyl,_$o,lyl,HOr=V(()=>{"use strict";Ao();ar();GOr();SG1=$e("JOBS"),cyl=r=>!r?.hasOwnProperty("includeSelector")||!r?.hasOwnProperty("version"),_$o=(r,t,n)=>{let{steps:i,subgraphs:o,...s}=r,a={...s};if(a.hasOwnProperty("version")||(a.version=DZ),a.hasOwnProperty("includeSelector"))return a;a.includeSelector="",a.excludeSelector="";let u=new Set(i),p=new Set(o),d=uyl([...u],[...p].map(f=>`${f}`),n,t).map(f=>`+${f}`).join(" OR ");return a.includeSelector=d,SG1.info("Upgrading job v1 to v2",r,a),a},lyl=(r,t)=>{let{jobs:n,folders:i,steps:o}=r,s=n[t];return _$o(s,i,o)}});var f3C,pyl,dyl=V(()=>{"use strict";pr();Ac();ar();Hde();f3C=$e("PACKAGES_BACKEND"),pyl=(r,t,n)=>{let i=DVo(t)??"",o=r?.config?.entities?.nodeTypes[i];return o||(n.error(`No config found for node type ${t}`),{isDisabled:!1,defaultStorageLocation:null})}});var yrt,vG1,TG1,VOr=V(()=>{"use strict";ka();ar();lIr();dyl();yrt=(r,t={})=>Object.values(r).map(n=>vG1(n)).reduce((n,i)=>{for(let[o,s]of Object.entries(i))n[o]=s;return n},t),vG1=r=>Object.fromEntries(Object.entries(r?.contents?.nodeTypes??{}).map(([t,n])=>{let{id:i,nodeType:o}=TG1(r.alias,t,r,n);return[i,o]})),TG1=(r,t,n,i)=>{let o=bcl(r,t),{isDisabled:s,defaultStorageLocation:a}=pyl(n,o,$e("PACKAGES")),u={...Gc(i),id:o,isDisabled:s};return u.metadata.defaultStorageLocation=a,{id:o,nodeType:u}}});var $o,IG1,fyl,hyl,R$o,T3C,_G1,gyl,RG1,OG1,WOr,O$o=V(()=>{"use strict";$o=gt(zV());Ao();QV();wEr();$a();IG1=$o.Record({type:$o.Unknown,name:$o.String}),fyl=$o.Record({locationName:$o.String,nodeName:$o.String}),hyl=$o.Record({sql:$o.String,success:$o.Boolean,rows:$o.Array($o.Unknown),fields:$o.Array(IG1),error:$o.Union($o.Null,SEr).optional(),startTime:$o.Unknown,endTime:$o.Unknown,status:$o.String,name:$o.String,isRunning:$o.Boolean,exportedRefs:$o.Array(fyl),invalidExportedRefs:$o.Array(fyl),queryResultSequence:$o.Optional($o.Unknown),type:$o.Union($o.Literal("sql"),$o.Literal("sqlTest")).optional(),warehouse:$o.String.nullable().optional(),queryID:$o.String.nullable().optional()}),R$o=$o.Record({name:$o.String,queryResults:$o.Array(hyl),isRunning:$o.Boolean,renderQueryResults:$o.Optional(hyl)}),T3C=$o.Record({runExecutionSequenceID:$o.Number,runResultVersion:$o.Number,name:$o.String,queryResultSequence:R$o,runState:$o.String}),_G1=$o.Record({dataResult:$o.Unknown,name:$o.String,queryResultSequence:R$o,runExecutionSequenceID:$o.Number,runResultVersion:$o.Number,runState:$o.String,stepRunState:tXe(DLo)}),gyl=xM("RunResultFirestoreValidator",_G1),RG1=$o.Record({nodeID:$o.String,queryResultSequence:R$o,runState:$o.String,hasTestFailures:$o.Boolean.optional()}),OG1=$o.Record({runResults:$o.Record({runStartTime:$o.Unknown,runEndTime:$o.Unknown,runFailureReason:$o.Optional($o.String),runType:$o.String,runStatus:$o.String,runResults:$o.Array(RG1),runID:$o.Number,environmentID:$o.String,snowflakeAccount:$o.String.optional(),snowflakeWarehouse:$o.String.optional(),jobID:$o.Number.optional(),hasFailedTest:$o.Boolean.optional(),runTimeParameters:$o.Unknown.nullable(),includeNodesSelector:$o.String.optional(),excludeNodesSelector:$o.String.optional()})}),WOr=xM("TRunOutput",OG1)});var R3C,Ayl=V(()=>{"use strict";Ao();wEr();R3C=tXe(NLo)});var YBe,KOr=V(()=>{"use strict";ka();z3();ar();YBe=class{constructor(t,n,i,o){this.allNodes=t;this.renderResults=n;this.extraRefs=i;this.logContext=o;this.phasedRefUsage=n.map("phased ref usage",s=>s.map(a=>a.runDetails.ref_usage))}allNodes;renderResults;extraRefs;logContext;phasedRefUsage;buildPhase(t,n){let i="[DependencyBuilder.buildPhase()]",o=n.keys(),s=Object.keys(this.extraRefs),a=[...new Set([...o,...s])];if($e("PIPELINE").appContext(this.logContext,i,"Nodes present in both current-phase data AND extra non-phased (views & advanced deploy) data:",USo([...o],s)),this.noDependenciesPhases.includes(t))return Object.fromEntries(a.map(u=>[u,[]]));{let u=this.getNodeRefsInPhase(t,a),p=new gBe(CC(this.allNodes,a));return tT(u,(c,l)=>{let{nodeIDsToAdd:d}=$et(c,p);return[...new Set(d)].filter(f=>f!==l)})}}build(){return Object.fromEntries([...this.phasedRefUsage.entries()].map(([t,n])=>[t,this.buildPhase(t,n)]))}}});var L3C,w$o=V(()=>{"use strict";pr();ar();Ac();L3C=$e("DEBUG")});var myl=V(()=>{"use strict"});var YOr,x$o=V(()=>{"use strict";YOr=r=>{typeof r.stepCounter=="number"&&(r.stepCounter=`${r.stepCounter}`),typeof r.columnCounter=="number"&&(r.columnCounter=`${r.columnCounter}`)}});var KCe,ea,M$o=V(()=>{"use strict";Ns();OU();KCe=new Date("1980-01-01T00:00:00.000Z"),ea=(r,t,n)=>{let i=`${r}Entity`;return n||(n=oa(t)),{standard:Pr(i,n),strict:Pr(`${i} (strict)`,t)}}});var yyl,xG1,byl,JBe,$Nt,P$o,N$o,$u,D$o,L_,B$o=V(()=>{"use strict";ry();M$o();Lde();yyl=r=>{if(Array.isArray(r))for(let t=r.length-1;t>=0;t--)r[t]===void 0&&r.splice(t,1);if(r&&typeof r=="object")for(let t in r)r.hasOwnProperty(t)&&r[t]===void 0&&delete r[t];return[r,!1]},xG1=(r,t)=>{if(r&&typeof r=="object"){let n=r;if(n.toDate&&(!isNaN(n.seconds)&&!isNaN(n.nanoseconds)||!isNaN(n._seconds)&&!isNaN(n._nanoseconds))){let i=n.toDate();return i.getTime()===Nde.SENTINEL_DATE&&Gl().emerg(`Repository server timestamp sentinel value found in stored data at path ${t}`),[i,!0]}}return[r,!1]},byl=(r,t)=>r instanceof K6e?[t.getDeleteSentinel(),!0]:r instanceof Date&&r.getTime()===Nde.SENTINEL_DATE?[t.getServerTimestampSentinel(),!0]:[r,!1],JBe=(r,t,n)=>{let[i,o]=t(n,r);if(!o&&typeof i=="object"){if(Array.isArray(i))return i.map(s=>JBe(r,t,s));for(let s in i)i.hasOwnProperty(s)&&(i[s]=JBe(r,t,i[s]))}return i},$Nt=class{fromStorage(t,n,i,o,s){try{return this.transformFromStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Gl().debug(`Error transforming repository entity ${n} from storage: ${a}`),a}return i}toStorage(t,n,i,o,s){try{return this.transformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Gl().debug(`Error transforming repository entity ${n} to storage ${a}`),a}return i}mergeToStorage(t,n,i,o,s){try{return this.mergeTransformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Gl().debug(`Error merge transforming repository entity ${n} to storage ${a}`),a}return i}},P$o=class extends $Nt{constructor(n=!1){super();this.preserveID=n}preserveID;transformFromStorage(n,i,o){return"id"in o?o.id!=n&&(Gl().error(`'id' property does not match doc id on doc at path ${i}; doc id: ${n}, value.id: ${o.id}`),o.id=n):o.id=n,"createdAt"in o||(o.createdAt=KCe),"updatedAt"in o||(o.updatedAt=KCe),JBe(i,xG1,o)}transformToStorage(n,i,o,s){return this.preserveID||delete o.id,JBe(i,a=>{let[u,p]=byl(a,s);return p?[u,!0]:yyl(u)},o)}mergeTransformToStorage(n,i,o,s){return this.preserveID||delete o.id,JBe(i,a=>{let[u,p]=byl(a,s);return p?[u,!0]:yyl(u)},o)}},N$o=class extends $Nt{constructor(n){super();this.validators=n}validators;transformFromStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}transformToStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}mergeTransformToStorage(n,i,o,s,a){return o}getValidatorOptions(n,i,o=500){let s={...i,statusCode:o};return s.errorMessage||(s.errorMessage=a=>`Found ${a.failures.length} validation failure(s) for ${this.validators.standard.name} ${n}`),s}},$u=(r,t,n)=>{let i=[new P$o(n),new N$o(r)];return t&&i.unshift(t),new D$o(...i)},D$o=class{transforms;constructor(...t){this.transforms=t}fromStorage(t,n,i,o,s){return this.transforms.reduce((a,u)=>u.fromStorage(t,n,a,o,s),i)}toStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.toStorage(t,n,a,o,s),i)}mergeToStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.mergeToStorage(t,n,a,o,s),i)}},L_=class extends $Nt{transformToStorage(t,n,i){return i}mergeTransformToStorage(t,n,i){return i}}});var Of=V(()=>{"use strict";B$o()});var Eyl,brt,CW,L$o,XNt,hz,YCe,q$o,MG1,PG1,Cyl,k$o,JOr,Syl=V(()=>{"use strict";Ao();ar();Of();x$o();Eyl=r=>!!r&&typeof r=="object"&&!Array.isArray(r),brt=r=>Eyl(r)&&!(r instanceof Date)&&!(r instanceof RegExp),CW=r=>{if(typeof r=="string")return r;if(Eyl(r)&&r.constructor&&typeof r.constructor.name=="string")return`[class ${r.constructor.name}]`;if(r instanceof Date)return`[date ${r.toISOString()}]`;if(r instanceof RegExp)return`[regexp ${r.toString()}]`;if(typeof r=="function")return`[function ${r.name}]`;try{return JSON.stringify(r)}catch{return"Error: could not stringify unknown value"}},L$o=r=>r==null,XNt=(r,t,n,i)=>{t.filter((o,s)=>brt(o)?!0:(n.logError(`Invalid ${r} item detected at index ${s}: ${CW(o)}`),n.logPatch(`Removed invalid ${r} item at index ${s}`),!1)).forEach(i)},hz=(r,t,n)=>{r[t]=n},YCe=(r,t)=>{delete r[t]},q$o=(r,t,n)=>{let i=new k$o(r,$e("FIREBASE"),t),{logError:o,logPatch:s,report:a}=i,u=()=>(a(),n);if(!brt(n))return u();let p=n;if([["locationName",!p.locationName&&typeof p.locationName!="string"||typeof p.locationName!="string"],["description",typeof p.description!="string"]].forEach(([c,l])=>{l&&(s(`Set non-string property ${c} from ${CW(p[c])} to ""`),hz(p,c,""))}),["dependencies","isDataVault","locationID"].forEach(c=>{c in p&&(s(`Removed deprecated field ${c}`),YCe(p,c))}),p.type==="sql")s("-- data.type is sql --"),MG1(r,p,i);else if(p.type==="sourceInput")s("-- data.type is sourceInput --"),PG1(r,p,i);else return o(`Data type is of invalid type ${CW(p.type)}`),u();return p.version!==PZ&&(s(`Set version ${CW(p.version)} to ${PZ}`),hz(p,"version",PZ)),u()},MG1=(r,t,n)=>{let{logError:i,logPatch:o}=n;if(t.isMultisource===void 0&&(o("Set missing isMultisource to false"),hz(t,"isMultisource",!1)),brt(t.metadata)){let s=t.metadata;if(s.appliedNodeTests===null&&(o("Set metadata.appliedNodeTests from null to []"),hz(s,"appliedNodeTests",[])),!Array.isArray(s.sourceMapping)||!s.sourceMapping.length){o("Set non-array or empty metadata.sourceMapping to [ basicMapping ]");let a;typeof t.name=="string"?a=t.name:(o("Data has no name value, setting sourceMapping.name to empty string"),a=""),hz(s,"sourceMapping",[{name:a,join:{joinCondition:""},dependencies:[],noLinkRefs:[],aliases:{}}])}else XNt("sourceMapping",s.sourceMapping,n,(a,u)=>{let p=a;if(typeof p.join=="string"){let c={joinCondition:""};o(`Setting invalid string value metadata.sourceMapping[${u}].join to object: ${CW(c)}`),hz(p,"join",c)}if(p.name===void 0){let c=p.join?.name??"";o(`Set missing metadata.sourceMapping[${u}].name to "${c}"`),hz(p,"name",c),c||i(`metadata.sourceMapping[${u}].name is an empty string`)}Array.isArray(p.dependencies)&&XNt("sourceMapping dependency",p.dependencies,n,(c,l)=>{let d=c;for(let f of["locationName","nodeName"])L$o(d[f])&&(o(`Set metadata.sourceMapping[${u}].dependencies[${l}].${f} from ${CW(d[f])} to ""`),hz(d,f,""))})});Cyl(r,s.columns,n)}if(t.config&&typeof t.config=="object")for(let[s,a]of Object.entries(t.config))a===null&&(o(`Removing null config property "${s}"`),YCe(t.config,s))},PG1=(r,t,n)=>{let{logPatch:i,logError:o}=n;if(t.dataset!==void 0&&(i("Removed deprecated v0 property dataset"),YCe(t,"dataset")),t.table!==void 0&&(t.table!==t.name&&o(`source data properties 'table' and 'name' are different for source node ${r}, table: ${t.table}, name: ${t.name}`),i("Removed deprecated v0 property table"),YCe(t,"table")),brt(t.metadata)){let s=t.metadata;Array.isArray(s.columns)&&(s.columns.length&&Cyl(r,s.columns,n),Object.keys(s).length>1&&(i(`Removed deprecated metadata properties, keeping only columns. Was: ${CW(s)}`),hz(t,"metadata",{columns:s.columns})))}},Cyl=(r,t,n)=>{let{logPatch:i}=n;Array.isArray(t)&&XNt("column",t,n,(o,s)=>{let a=o;if(["ghostRecordValue","descendedFrom","hashColumns","columnsForHash"].forEach(c=>{a.hasOwnProperty(c)&&(i(`Removed deprecated property '${c}' from metadata.columns[${s}]`),YCe(a,c))}),brt(a.hashDetails)){let c=a.hashDetails;c.hashType&&(i(`Removed deprecated property 'hashType' from metadata.columns[${s}].hashDetails`),YCe(c,"hashType")),c.hubHashes&&(i(`Removed deprecated property 'hubHashes' from metadata.columns[${s}].hashDetails`),YCe(c,"hubHashes"))}[["appliedColumnTests",a.appliedColumnTests===null],["config",a.config===null],["hashDetails",typeof a.hashDetails=="string"]].forEach(([c,l])=>{l&&(i(`Deleted metadata.columns[${s}].${c} with invalid value ${CW(a[c])}`),YCe(a,c))}),[["dataType",typeof a.dataType!="string"],["transform",a.transform===null]].forEach(([c,l])=>{l&&(i(`Set ${c} from ${CW(a[c])} to "" in metadata.columns[${s}]`),hz(a,c,""))});let u=a.hashedColumns;if(Array.isArray(u))for(let c of u)YOr(c);let p=a.columnReference;if(brt(p)){YOr(p);let c=p;L$o(c.stepCounter)&&(i(`Set metadata.columns[${s}].columnReference.stepCounter from ${CW(c.stepCounter)} to ${r}`),hz(c,"stepCounter",r))}Array.isArray(a.sourceColumnReferences)&&XNt("sourceColumnReference",a.sourceColumnReferences,n,(c,l)=>{let d=c;Array.isArray(d.columnReferences)&&XNt("columnReference",d.columnReferences,n,(f,h)=>{YOr(f);let A=f;L$o(A.stepCounter)&&(i(`Set invalid metadata.columns[${s}].sourceColumnReferences[${l}].columnReferences[${h}].stepCounter to "" from ${CW(r)}`),hz(A,"stepCounter",""))})})})},k$o=class{constructor(t,n,i){this.id=t;this.logger=n;this.path=i}id;logger;path;patchMessages=[];errorMessages=[];logPatch=t=>{this.patchMessages.push(t)};logError=t=>{this.errorMessages.push(t)};reportErrors=()=>{this.errorMessages.length&&this.logger.error(`Error patching node data with id ${this.id} at path ${this.path}`,this.errorMessages)};reportPatches=()=>{this.patchMessages.length&&this.logger.debug(`Patched node data with id ${this.id} at path ${this.path}`,this.patchMessages)};report=()=>{this.reportErrors(),this.reportPatches()}},JOr=class extends L_{transformFromStorage(t,n,i){return q$o(t,n,i)}}});var ZNt=V(()=>{"use strict";myl();x$o();Syl()});var vyl=V(()=>{"use strict"});var IIC,_IC,RIC,Tyl,Iyl,_yl,JCe=V(()=>{"use strict";pr();hb();ar();w$o();Yet();Yo();ar();M2();hee();ZNt();hCe();hVo();vyl();R6();I6();aN();Gde();IIC=$e("FIREBASE"),_IC=$e("STEPS"),RIC=$e("METADATA_OPERATIONS"),Tyl=(r,t)=>t[r].runState==="running",Iyl=r=>(uy("STEPS",!!r,`Error converting API refs: argument apiRefLinks is ${r}.`),r.map(t=>({locationName:t.location_name,nodeName:t.node_name}))),_yl=r=>r?.deployEnabled??!0});var $Be,Ryl=V(()=>{"use strict";JCe();KOr();$Be=class extends YBe{noDependenciesPhases=["deletedTable"];getNodeRefsInPhase(t,n){return Object.fromEntries(n.map(i=>{let o,s=this.extraRefs[i];s?o=[s]:o=this.phasedRefUsage.get(t,i);let a=o.map(({ref:u,ref_no_link:p})=>Iyl([...u,...p]));return[i,[].concat(...a)]}))}}});var eDt,Oyl=V(()=>{"use strict";ka();p9();KOr();eDt=class extends YBe{noDependenciesPhases=[];getNodeRefsInPhase(t,n){let i=CC(this.allNodes,...n);return tT(i,o=>{if(mCe(o.operation))return[];let{sourceMapping:s}=o.operation.metadata;if(!s?.length)return[];let a=s.map(({dependencies:u})=>u);return[].concat(...a)})}}});var F$o=V(()=>{"use strict";KOr();Ryl();Oyl()});var wyl=V(()=>{"use strict"});var tDt,xyl=V(()=>{"use strict";EX();ry();tDt=async(r,t)=>{let{attempts:n,tags:i,waitSeconds:o}=t,s=Gl().child({retryOptions:{maxAttempts:n,waitSeconds:o},tags:["[withRetries]",...i]});E2(n>=2,`Retry attempts value must be at least '2', but was '${n}'`,s);try{let a=await r();return s.debug("Operation succeeded without retrying"),a}catch(a){s.error(`Operation initial attempt failed; retrying. Error: ${a}`);let u,p=n-1;do{p--,await new Promise(c=>setTimeout(c,o*(n-p)*1e3));try{let c=await r();return s.info(`Operation succeeded on retry (attempt ${n-p})`),c}catch(c){s.error(`Operation failed on retry (attempt ${n-p}). Error: ${c}`),u=c}}while(p);throw s.error("Exhausted all retry attempts; exiting"),u}}});var U$o=V(()=>{"use strict";wyl();xyl()});function Ert(r,t){let n=[];for(let i of r){let o=i.compiledSQL?itt(i.compiledSQL):[];if(o.length===0)t&&n.push({name:t,sql:"",type:"sql",continueOnFailure:!1,parsedStage:null});else for(let s of o)n.push({name:s.name,sql:s.code,type:s.type,continueOnFailure:s.continueOnFailure,parsedStage:s})}return n}function $Or(r,t){return r==="deletedTable"&&t?Myl:LG1}var LG1,Myl,rDt=V(()=>{"use strict";M2();LG1="Making metadata updates",Myl="Deleting metadata for source input"});var SW,nDt=V(()=>{"use strict";pr();SW=class extends rt{constructor(n,i,o="system"){super(i,`Failed node ${n}: ${i}`);this.nodeID=n;this.fault=o}nodeID;fault}});var iDt=m((JIC,Pyl)=>{var kG1="2.0.0",qG1=Number.MAX_SAFE_INTEGER||9007199254740991,FG1=16,UG1=250,zG1=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Pyl.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:FG1,MAX_SAFE_BUILD_LENGTH:UG1,MAX_SAFE_INTEGER:qG1,RELEASE_TYPES:zG1,SEMVER_SPEC_VERSION:kG1,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var oDt=m(($IC,Nyl)=>{var QG1=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Nyl.exports=QG1});var Crt=m((y0e,Dyl)=>{var{MAX_SAFE_COMPONENT_LENGTH:z$o,MAX_SAFE_BUILD_LENGTH:jG1,MAX_LENGTH:GG1}=iDt(),HG1=oDt();y0e=Dyl.exports={};var VG1=y0e.re=[],WG1=y0e.safeRe=[],_a=y0e.src=[],Ra=y0e.t={},KG1=0,Q$o="[a-zA-Z0-9-]",YG1=[["\\s",1],["\\d",GG1],[Q$o,jG1]],JG1=r=>{for(let[t,n]of YG1)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},od=(r,t,n)=>{let i=JG1(t),o=KG1++;HG1(r,o,t),Ra[r]=o,_a[o]=t,VG1[o]=new RegExp(t,n?"g":void 0),WG1[o]=new RegExp(i,n?"g":void 0)};od("NUMERICIDENTIFIER","0|[1-9]\\d*");od("NUMERICIDENTIFIERLOOSE","\\d+");od("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Q$o}*`);od("MAINVERSION",`(${_a[Ra.NUMERICIDENTIFIER]})\\.(${_a[Ra.NUMERICIDENTIFIER]})\\.(${_a[Ra.NUMERICIDENTIFIER]})`);od("MAINVERSIONLOOSE",`(${_a[Ra.NUMERICIDENTIFIERLOOSE]})\\.(${_a[Ra.NUMERICIDENTIFIERLOOSE]})\\.(${_a[Ra.NUMERICIDENTIFIERLOOSE]})`);od("PRERELEASEIDENTIFIER",`(?:${_a[Ra.NUMERICIDENTIFIER]}|${_a[Ra.NONNUMERICIDENTIFIER]})`);od("PRERELEASEIDENTIFIERLOOSE",`(?:${_a[Ra.NUMERICIDENTIFIERLOOSE]}|${_a[Ra.NONNUMERICIDENTIFIER]})`);od("PRERELEASE",`(?:-(${_a[Ra.PRERELEASEIDENTIFIER]}(?:\\.${_a[Ra.PRERELEASEIDENTIFIER]})*))`);od("PRERELEASELOOSE",`(?:-?(${_a[Ra.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${_a[Ra.PRERELEASEIDENTIFIERLOOSE]})*))`);od("BUILDIDENTIFIER",`${Q$o}+`);od("BUILD",`(?:\\+(${_a[Ra.BUILDIDENTIFIER]}(?:\\.${_a[Ra.BUILDIDENTIFIER]})*))`);od("FULLPLAIN",`v?${_a[Ra.MAINVERSION]}${_a[Ra.PRERELEASE]}?${_a[Ra.BUILD]}?`);od("FULL",`^${_a[Ra.FULLPLAIN]}$`);od("LOOSEPLAIN",`[v=\\s]*${_a[Ra.MAINVERSIONLOOSE]}${_a[Ra.PRERELEASELOOSE]}?${_a[Ra.BUILD]}?`);od("LOOSE",`^${_a[Ra.LOOSEPLAIN]}$`);od("GTLT","((?:<|>)?=?)");od("XRANGEIDENTIFIERLOOSE",`${_a[Ra.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);od("XRANGEIDENTIFIER",`${_a[Ra.NUMERICIDENTIFIER]}|x|X|\\*`);od("XRANGEPLAIN",`[v=\\s]*(${_a[Ra.XRANGEIDENTIFIER]})(?:\\.(${_a[Ra.XRANGEIDENTIFIER]})(?:\\.(${_a[Ra.XRANGEIDENTIFIER]})(?:${_a[Ra.PRERELEASE]})?${_a[Ra.BUILD]}?)?)?`);od("XRANGEPLAINLOOSE",`[v=\\s]*(${_a[Ra.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[Ra.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[Ra.XRANGEIDENTIFIERLOOSE]})(?:${_a[Ra.PRERELEASELOOSE]})?${_a[Ra.BUILD]}?)?)?`);od("XRANGE",`^${_a[Ra.GTLT]}\\s*${_a[Ra.XRANGEPLAIN]}$`);od("XRANGELOOSE",`^${_a[Ra.GTLT]}\\s*${_a[Ra.XRANGEPLAINLOOSE]}$`);od("COERCE",`(^|[^\\d])(\\d{1,${z$o}})(?:\\.(\\d{1,${z$o}}))?(?:\\.(\\d{1,${z$o}}))?(?:$|[^\\d])`);od("COERCERTL",_a[Ra.COERCE],!0);od("LONETILDE","(?:~>?)");od("TILDETRIM",`(\\s*)${_a[Ra.LONETILDE]}\\s+`,!0);y0e.tildeTrimReplace="$1~";od("TILDE",`^${_a[Ra.LONETILDE]}${_a[Ra.XRANGEPLAIN]}$`);od("TILDELOOSE",`^${_a[Ra.LONETILDE]}${_a[Ra.XRANGEPLAINLOOSE]}$`);od("LONECARET","(?:\\^)");od("CARETTRIM",`(\\s*)${_a[Ra.LONECARET]}\\s+`,!0);y0e.caretTrimReplace="$1^";od("CARET",`^${_a[Ra.LONECARET]}${_a[Ra.XRANGEPLAIN]}$`);od("CARETLOOSE",`^${_a[Ra.LONECARET]}${_a[Ra.XRANGEPLAINLOOSE]}$`);od("COMPARATORLOOSE",`^${_a[Ra.GTLT]}\\s*(${_a[Ra.LOOSEPLAIN]})$|^$`);od("COMPARATOR",`^${_a[Ra.GTLT]}\\s*(${_a[Ra.FULLPLAIN]})$|^$`);od("COMPARATORTRIM",`(\\s*)${_a[Ra.GTLT]}\\s*(${_a[Ra.LOOSEPLAIN]}|${_a[Ra.XRANGEPLAIN]})`,!0);y0e.comparatorTrimReplace="$1$2$3";od("HYPHENRANGE",`^\\s*(${_a[Ra.XRANGEPLAIN]})\\s+-\\s+(${_a[Ra.XRANGEPLAIN]})\\s*$`);od("HYPHENRANGELOOSE",`^\\s*(${_a[Ra.XRANGEPLAINLOOSE]})\\s+-\\s+(${_a[Ra.XRANGEPLAINLOOSE]})\\s*$`);od("STAR","(<|>)?=?\\s*\\*");od("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");od("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var XOr=m((XIC,Byl)=>{var $G1=Object.freeze({loose:!0}),XG1=Object.freeze({}),ZG1=r=>r?typeof r!="object"?$G1:r:XG1;Byl.exports=ZG1});var j$o=m((ZIC,qyl)=>{var Lyl=/^[0-9]+$/,kyl=(r,t)=>{let n=Lyl.test(r),i=Lyl.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},eH1=(r,t)=>kyl(t,r);qyl.exports={compareIdentifiers:kyl,rcompareIdentifiers:eH1}});var KM=m((e_C,Qyl)=>{var ZOr=oDt(),{MAX_LENGTH:Fyl,MAX_SAFE_INTEGER:ewr}=iDt(),{safeRe:Uyl,t:zyl}=Crt(),tH1=XOr(),{compareIdentifiers:Srt}=j$o(),G$o=class r{constructor(t,n){if(n=tH1(n),t instanceof r){if(t.loose===!!n.loose&&t.includePrerelease===!!n.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>Fyl)throw new TypeError(`version is longer than ${Fyl} characters`);ZOr("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?Uyl[zyl.LOOSE]:Uyl[zyl.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>ewr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ewr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ewr||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<ewr)return s}return o}):this.prerelease=[],this.build=i[5]?i[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(ZOr("SemVer.compare",this.version,this.options,t),!(t instanceof r)){if(typeof t=="string"&&t===this.version)return 0;t=new r(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof r||(t=new r(t,this.options)),Srt(this.major,t.major)||Srt(this.minor,t.minor)||Srt(this.patch,t.patch)}comparePre(t){if(t instanceof r||(t=new r(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 n=0;do{let i=this.prerelease[n],o=t.prerelease[n];if(ZOr("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return Srt(i,o)}while(++n)}compareBuild(t){t instanceof r||(t=new r(t,this.options));let n=0;do{let i=this.build[n],o=t.build[n];if(ZOr("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return Srt(i,o)}while(++n)}inc(t,n,i){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,i),this.inc("pre",n,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,i),this.inc("pre",n,i);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":{let o=Number(i)?1:0;if(!n&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let s=[n,o];i===!1&&(s=[n]),Srt(this.prerelease[0],n)===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}};Qyl.exports=G$o});var XBe=m((t_C,Gyl)=>{var jyl=KM(),rH1=(r,t,n=!1)=>{if(r instanceof jyl)return r;try{return new jyl(r,t)}catch(i){if(!n)return null;throw i}};Gyl.exports=rH1});var Vyl=m((r_C,Hyl)=>{var nH1=XBe(),iH1=(r,t)=>{let n=nH1(r,t);return n?n.version:null};Hyl.exports=iH1});var Kyl=m((n_C,Wyl)=>{var oH1=XBe(),sH1=(r,t)=>{let n=oH1(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};Wyl.exports=sH1});var $yl=m((i_C,Jyl)=>{var Yyl=KM(),aH1=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Yyl(r instanceof Yyl?r.version:r,n).inc(t,i,o).version}catch{return null}};Jyl.exports=aH1});var ebl=m((o_C,Zyl)=>{var Xyl=XBe(),uH1=(r,t)=>{let n=Xyl(r,null,!0),i=Xyl(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,u=s?i:n,p=!!a.prerelease.length;if(!!u.prerelease.length&&!p)return!u.patch&&!u.minor?"major":a.patch?"patch":a.minor?"minor":"major";let l=p?"pre":"";return n.major!==i.major?l+"major":n.minor!==i.minor?l+"minor":n.patch!==i.patch?l+"patch":"prerelease"};Zyl.exports=uH1});var rbl=m((s_C,tbl)=>{var cH1=KM(),lH1=(r,t)=>new cH1(r,t).major;tbl.exports=lH1});var ibl=m((a_C,nbl)=>{var pH1=KM(),dH1=(r,t)=>new pH1(r,t).minor;nbl.exports=dH1});var sbl=m((u_C,obl)=>{var fH1=KM(),hH1=(r,t)=>new fH1(r,t).patch;obl.exports=hH1});var ubl=m((c_C,abl)=>{var gH1=XBe(),AH1=(r,t)=>{let n=gH1(r,t);return n&&n.prerelease.length?n.prerelease:null};abl.exports=AH1});var gz=m((l_C,lbl)=>{var cbl=KM(),mH1=(r,t,n)=>new cbl(r,n).compare(new cbl(t,n));lbl.exports=mH1});var dbl=m((p_C,pbl)=>{var yH1=gz(),bH1=(r,t,n)=>yH1(t,r,n);pbl.exports=bH1});var hbl=m((d_C,fbl)=>{var EH1=gz(),CH1=(r,t)=>EH1(r,t,!0);fbl.exports=CH1});var twr=m((f_C,Abl)=>{var gbl=KM(),SH1=(r,t,n)=>{let i=new gbl(r,n),o=new gbl(t,n);return i.compare(o)||i.compareBuild(o)};Abl.exports=SH1});var ybl=m((h_C,mbl)=>{var vH1=twr(),TH1=(r,t)=>r.sort((n,i)=>vH1(n,i,t));mbl.exports=TH1});var Ebl=m((g_C,bbl)=>{var IH1=twr(),_H1=(r,t)=>r.sort((n,i)=>IH1(i,n,t));bbl.exports=_H1});var sDt=m((A_C,Cbl)=>{var RH1=gz(),OH1=(r,t,n)=>RH1(r,t,n)>0;Cbl.exports=OH1});var rwr=m((m_C,Sbl)=>{var wH1=gz(),xH1=(r,t,n)=>wH1(r,t,n)<0;Sbl.exports=xH1});var H$o=m((y_C,vbl)=>{var MH1=gz(),PH1=(r,t,n)=>MH1(r,t,n)===0;vbl.exports=PH1});var V$o=m((b_C,Tbl)=>{var NH1=gz(),DH1=(r,t,n)=>NH1(r,t,n)!==0;Tbl.exports=DH1});var nwr=m((E_C,Ibl)=>{var BH1=gz(),LH1=(r,t,n)=>BH1(r,t,n)>=0;Ibl.exports=LH1});var iwr=m((C_C,_bl)=>{var kH1=gz(),qH1=(r,t,n)=>kH1(r,t,n)<=0;_bl.exports=qH1});var W$o=m((S_C,Rbl)=>{var FH1=H$o(),UH1=V$o(),zH1=sDt(),QH1=nwr(),jH1=rwr(),GH1=iwr(),HH1=(r,t,n,i)=>{switch(t){case"===":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r===n;case"!==":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r!==n;case"":case"=":case"==":return FH1(r,n,i);case"!=":return UH1(r,n,i);case">":return zH1(r,n,i);case">=":return QH1(r,n,i);case"<":return jH1(r,n,i);case"<=":return GH1(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};Rbl.exports=HH1});var wbl=m((v_C,Obl)=>{var VH1=KM(),WH1=XBe(),{safeRe:owr,t:swr}=Crt(),KH1=(r,t)=>{if(r instanceof VH1)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;t=t||{};let n=null;if(!t.rtl)n=r.match(owr[swr.COERCE]);else{let i;for(;(i=owr[swr.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),owr[swr.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;owr[swr.COERCERTL].lastIndex=-1}return n===null?null:WH1(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};Obl.exports=KH1});var Mbl=m((T_C,xbl)=>{"use strict";xbl.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var K$o=m((I_C,Pbl)=>{"use strict";Pbl.exports=h1;h1.Node=ZBe;h1.create=h1;function h1(r){var t=this;if(t instanceof h1||(t=new h1),t.tail=null,t.head=null,t.length=0,r&&typeof r.forEach=="function")r.forEach(function(o){t.push(o)});else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}h1.prototype.removeNode=function(r){if(r.list!==this)throw new Error("removing node which does not belong to this list");var t=r.next,n=r.prev;return t&&(t.prev=n),n&&(n.next=t),r===this.head&&(this.head=t),r===this.tail&&(this.tail=n),r.list.length--,r.next=null,r.prev=null,r.list=null,t};h1.prototype.unshiftNode=function(r){if(r!==this.head){r.list&&r.list.removeNode(r);var t=this.head;r.list=this,r.next=t,t&&(t.prev=r),this.head=r,this.tail||(this.tail=r),this.length++}};h1.prototype.pushNode=function(r){if(r!==this.tail){r.list&&r.list.removeNode(r);var t=this.tail;r.list=this,r.prev=t,t&&(t.next=r),this.tail=r,this.head||(this.head=r),this.length++}};h1.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)JH1(this,arguments[r]);return this.length};h1.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)$H1(this,arguments[r]);return this.length};h1.prototype.pop=function(){if(this.tail){var r=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,r}};h1.prototype.shift=function(){if(this.head){var r=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,r}};h1.prototype.forEach=function(r,t){t=t||this;for(var n=this.head,i=0;n!==null;i++)r.call(t,n.value,i,this),n=n.next};h1.prototype.forEachReverse=function(r,t){t=t||this;for(var n=this.tail,i=this.length-1;n!==null;i--)r.call(t,n.value,i,this),n=n.prev};h1.prototype.get=function(r){for(var t=0,n=this.head;n!==null&&t<r;t++)n=n.next;if(t===r&&n!==null)return n.value};h1.prototype.getReverse=function(r){for(var t=0,n=this.tail;n!==null&&t<r;t++)n=n.prev;if(t===r&&n!==null)return n.value};h1.prototype.map=function(r,t){t=t||this;for(var n=new h1,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};h1.prototype.mapReverse=function(r,t){t=t||this;for(var n=new h1,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};h1.prototype.reduce=function(r,t){var n,i=this.head;if(arguments.length>1)n=t;else if(this.head)i=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;i!==null;o++)n=r(n,i.value,o),i=i.next;return n};h1.prototype.reduceReverse=function(r,t){var n,i=this.tail;if(arguments.length>1)n=t;else if(this.tail)i=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;i!==null;o--)n=r(n,i.value,o),i=i.prev;return n};h1.prototype.toArray=function(){for(var r=new Array(this.length),t=0,n=this.head;n!==null;t++)r[t]=n.value,n=n.next;return r};h1.prototype.toArrayReverse=function(){for(var r=new Array(this.length),t=0,n=this.tail;n!==null;t++)r[t]=n.value,n=n.prev;return r};h1.prototype.slice=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new h1;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(;o!==null&&i<t;i++,o=o.next)n.push(o.value);return n};h1.prototype.sliceReverse=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new h1;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;o!==null&&i>t;i--)o=o.prev;for(;o!==null&&i>r;i--,o=o.prev)n.push(o.value);return n};h1.prototype.splice=function(r,t,...n){r>this.length&&(r=this.length-1),r<0&&(r=this.length+r);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(var s=[],i=0;o&&i<t;i++)s.push(o.value),o=this.removeNode(o);o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(var i=0;i<n.length;i++)o=YH1(this,o,n[i]);return s};h1.prototype.reverse=function(){for(var r=this.head,t=this.tail,n=r;n!==null;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=r,this};function YH1(r,t,n){var i=t===r.head?new ZBe(n,null,t,r):new ZBe(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function JH1(r,t){r.tail=new ZBe(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function $H1(r,t){r.head=new ZBe(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function ZBe(r,t,n,i){if(!(this instanceof ZBe))return new ZBe(r,t,n,i);this.list=i,this.value=r,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{Mbl()(h1)}catch{}});var cDt=m((__C,Lbl)=>{"use strict";var XH1=K$o(),e8e=Symbol("max"),E0e=Symbol("length"),vrt=Symbol("lengthCalculator"),uDt=Symbol("allowStale"),t8e=Symbol("maxAge"),b0e=Symbol("dispose"),Nbl=Symbol("noDisposeOnSet"),k_=Symbol("lruList"),vW=Symbol("cache"),Bbl=Symbol("updateAgeOnGet"),Y$o=()=>1,$$o=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");let n=this[e8e]=t.max||1/0,i=t.length||Y$o;if(this[vrt]=typeof i!="function"?Y$o:i,this[uDt]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[t8e]=t.maxAge||0,this[b0e]=t.dispose,this[Nbl]=t.noDisposeOnSet||!1,this[Bbl]=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[e8e]=t||1/0,aDt(this)}get max(){return this[e8e]}set allowStale(t){this[uDt]=!!t}get allowStale(){return this[uDt]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[t8e]=t,aDt(this)}get maxAge(){return this[t8e]}set lengthCalculator(t){typeof t!="function"&&(t=Y$o),t!==this[vrt]&&(this[vrt]=t,this[E0e]=0,this[k_].forEach(n=>{n.length=this[vrt](n.value,n.key),this[E0e]+=n.length})),aDt(this)}get lengthCalculator(){return this[vrt]}get length(){return this[E0e]}get itemCount(){return this[k_].length}rforEach(t,n){n=n||this;for(let i=this[k_].tail;i!==null;){let o=i.prev;Dbl(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[k_].head;i!==null;){let o=i.next;Dbl(this,t,i,n),i=o}}keys(){return this[k_].toArray().map(t=>t.key)}values(){return this[k_].toArray().map(t=>t.value)}reset(){this[b0e]&&this[k_]&&this[k_].length&&this[k_].forEach(t=>this[b0e](t.key,t.value)),this[vW]=new Map,this[k_]=new XH1,this[E0e]=0}dump(){return this[k_].map(t=>awr(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,n,i){if(i=i||this[t8e],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[vrt](n,t);if(this[vW].has(t)){if(s>this[e8e])return Trt(this,this[vW].get(t)),!1;let p=this[vW].get(t).value;return this[b0e]&&(this[Nbl]||this[b0e](t,p.value)),p.now=o,p.maxAge=i,p.value=n,this[E0e]+=s-p.length,p.length=s,this.get(t),aDt(this),!0}let a=new X$o(t,n,s,o,i);return a.length>this[e8e]?(this[b0e]&&this[b0e](t,n),!1):(this[E0e]+=a.length,this[k_].unshift(a),this[vW].set(t,this[k_].head),aDt(this),!0)}has(t){if(!this[vW].has(t))return!1;let n=this[vW].get(t).value;return!awr(this,n)}get(t){return J$o(this,t,!0)}peek(t){return J$o(this,t,!1)}pop(){let t=this[k_].tail;return t?(Trt(this,t),t.value):null}del(t){Trt(this,this[vW].get(t))}load(t){this.reset();let n=Date.now();for(let i=t.length-1;i>=0;i--){let o=t[i],s=o.e||0;if(s===0)this.set(o.k,o.v);else{let a=s-n;a>0&&this.set(o.k,o.v,a)}}}prune(){this[vW].forEach((t,n)=>J$o(this,n,!1))}},J$o=(r,t,n)=>{let i=r[vW].get(t);if(i){let o=i.value;if(awr(r,o)){if(Trt(r,i),!r[uDt])return}else n&&(r[Bbl]&&(i.value.now=Date.now()),r[k_].unshiftNode(i));return o.value}},awr=(r,t)=>{if(!t||!t.maxAge&&!r[t8e])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[t8e]&&n>r[t8e]},aDt=r=>{if(r[E0e]>r[e8e])for(let t=r[k_].tail;r[E0e]>r[e8e]&&t!==null;){let n=t.prev;Trt(r,t),t=n}},Trt=(r,t)=>{if(t){let n=t.value;r[b0e]&&r[b0e](n.key,n.value),r[E0e]-=n.length,r[vW].delete(n.key),r[k_].removeNode(t)}},X$o=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},Dbl=(r,t,n,i)=>{let o=n.value;awr(r,o)&&(Trt(r,n),r[uDt]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};Lbl.exports=$$o});var Az=m((R_C,Ubl)=>{var Z$o=class r{constructor(t,n){if(n=eV1(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof eXo)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(o=>!qbl(o[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&aV1(o[0])){this.set=[o];break}}}this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){let i=((this.options.includePrerelease&&oV1)|(this.options.loose&&sV1))+":"+t,o=kbl.get(i);if(o)return o;let s=this.options.loose,a=s?L6[mN.HYPHENRANGELOOSE]:L6[mN.HYPHENRANGE];t=t.replace(a,mV1(this.options.includePrerelease)),Ib("hyphen replace",t),t=t.replace(L6[mN.COMPARATORTRIM],rV1),Ib("comparator trim",t),t=t.replace(L6[mN.TILDETRIM],nV1),Ib("tilde trim",t),t=t.replace(L6[mN.CARETTRIM],iV1),Ib("caret trim",t);let u=t.split(" ").map(d=>uV1(d,this.options)).join(" ").split(/\s+/).map(d=>AV1(d,this.options));s&&(u=u.filter(d=>(Ib("loose invalid filter",d,this.options),!!d.match(L6[mN.COMPARATORLOOSE])))),Ib("range list",u);let p=new Map,c=u.map(d=>new eXo(d,this.options));for(let d of c){if(qbl(d))return[d];p.set(d.value,d)}p.size>1&&p.has("")&&p.delete("");let l=[...p.values()];return kbl.set(i,l),l}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>Fbl(i,n)&&t.set.some(o=>Fbl(o,n)&&i.every(s=>o.every(a=>s.intersects(a,n)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new tV1(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(yV1(this.set[n],t,this.options))return!0;return!1}};Ubl.exports=Z$o;var ZH1=cDt(),kbl=new ZH1({max:1e3}),eV1=XOr(),eXo=lDt(),Ib=oDt(),tV1=KM(),{safeRe:L6,t:mN,comparatorTrimReplace:rV1,tildeTrimReplace:nV1,caretTrimReplace:iV1}=Crt(),{FLAG_INCLUDE_PRERELEASE:oV1,FLAG_LOOSE:sV1}=iDt(),qbl=r=>r.value==="<0.0.0-0",aV1=r=>r.value==="",Fbl=(r,t)=>{let n=!0,i=r.slice(),o=i.pop();for(;n&&i.length;)n=i.every(s=>o.intersects(s,t)),o=i.pop();return n},uV1=(r,t)=>(Ib("comp",r,t),r=pV1(r,t),Ib("caret",r),r=cV1(r,t),Ib("tildes",r),r=fV1(r,t),Ib("xrange",r),r=gV1(r,t),Ib("stars",r),r),yN=r=>!r||r.toLowerCase()==="x"||r==="*",cV1=(r,t)=>r.trim().split(/\s+/).map(n=>lV1(n,t)).join(" "),lV1=(r,t)=>{let n=t.loose?L6[mN.TILDELOOSE]:L6[mN.TILDE];return r.replace(n,(i,o,s,a,u)=>{Ib("tilde",r,i,o,s,a,u);let p;return yN(o)?p="":yN(s)?p=`>=${o}.0.0 <${+o+1}.0.0-0`:yN(a)?p=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:u?(Ib("replaceTilde pr",u),p=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`):p=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,Ib("tilde return",p),p})},pV1=(r,t)=>r.trim().split(/\s+/).map(n=>dV1(n,t)).join(" "),dV1=(r,t)=>{Ib("caret",r,t);let n=t.loose?L6[mN.CARETLOOSE]:L6[mN.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,u,p)=>{Ib("caret",r,o,s,a,u,p);let c;return yN(s)?c="":yN(a)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:yN(u)?s==="0"?c=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:p?(Ib("replaceCaret pr",p),s==="0"?a==="0"?c=`>=${s}.${a}.${u}-${p} <${s}.${a}.${+u+1}-0`:c=`>=${s}.${a}.${u}-${p} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${u}-${p} <${+s+1}.0.0-0`):(Ib("no pr"),s==="0"?a==="0"?c=`>=${s}.${a}.${u}${i} <${s}.${a}.${+u+1}-0`:c=`>=${s}.${a}.${u}${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${u} <${+s+1}.0.0-0`),Ib("caret return",c),c})},fV1=(r,t)=>(Ib("replaceXRanges",r,t),r.split(/\s+/).map(n=>hV1(n,t)).join(" ")),hV1=(r,t)=>{r=r.trim();let n=t.loose?L6[mN.XRANGELOOSE]:L6[mN.XRANGE];return r.replace(n,(i,o,s,a,u,p)=>{Ib("xRange",r,i,o,s,a,u,p);let c=yN(s),l=c||yN(a),d=l||yN(u),f=d;return o==="="&&f&&(o=""),p=t.includePrerelease?"-0":"",c?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&f?(l&&(a=0),u=0,o===">"?(o=">=",l?(s=+s+1,a=0,u=0):(a=+a+1,u=0)):o==="<="&&(o="<",l?s=+s+1:a=+a+1),o==="<"&&(p="-0"),i=`${o+s}.${a}.${u}${p}`):l?i=`>=${s}.0.0${p} <${+s+1}.0.0-0`:d&&(i=`>=${s}.${a}.0${p} <${s}.${+a+1}.0-0`),Ib("xRange return",i),i})},gV1=(r,t)=>(Ib("replaceStars",r,t),r.trim().replace(L6[mN.STAR],"")),AV1=(r,t)=>(Ib("replaceGTE0",r,t),r.trim().replace(L6[t.includePrerelease?mN.GTE0PRE:mN.GTE0],"")),mV1=r=>(t,n,i,o,s,a,u,p,c,l,d,f,h)=>(yN(i)?n="":yN(o)?n=`>=${i}.0.0${r?"-0":""}`:yN(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,yN(c)?p="":yN(l)?p=`<${+c+1}.0.0-0`:yN(d)?p=`<${c}.${+l+1}.0-0`:f?p=`<=${c}.${l}.${d}-${f}`:r?p=`<${c}.${l}.${+d+1}-0`:p=`<=${p}`,`${n} ${p}`.trim()),yV1=(r,t,n)=>{for(let i=0;i<r.length;i++)if(!r[i].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let i=0;i<r.length;i++)if(Ib(r[i].semver),r[i].semver!==eXo.ANY&&r[i].semver.prerelease.length>0){let o=r[i].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0}});var lDt=m((O_C,Vbl)=>{var pDt=Symbol("SemVer ANY"),nXo=class r{static get ANY(){return pDt}constructor(t,n){if(n=zbl(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),rXo("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===pDt?this.value="":this.value=this.operator+this.semver.version,rXo("comp",this)}parse(t){let n=this.options.loose?Qbl[jbl.COMPARATORLOOSE]:Qbl[jbl.COMPARATOR],i=t.match(n);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new Gbl(i[2],this.options.loose):this.semver=pDt}toString(){return this.value}test(t){if(rXo("Comparator.test",t,this.options.loose),this.semver===pDt||t===pDt)return!0;if(typeof t=="string")try{t=new Gbl(t,this.options)}catch{return!1}return tXo(t,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Hbl(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new Hbl(this.value,n).test(t.semver):(n=zbl(n),n.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||tXo(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||tXo(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Vbl.exports=nXo;var zbl=XOr(),{safeRe:Qbl,t:jbl}=Crt(),tXo=W$o(),rXo=oDt(),Gbl=KM(),Hbl=Az()});var dDt=m((w_C,Wbl)=>{var bV1=Az(),EV1=(r,t,n)=>{try{t=new bV1(t,n)}catch{return!1}return t.test(r)};Wbl.exports=EV1});var Ybl=m((x_C,Kbl)=>{var CV1=Az(),SV1=(r,t)=>new CV1(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));Kbl.exports=SV1});var $bl=m((M_C,Jbl)=>{var vV1=KM(),TV1=Az(),IV1=(r,t,n)=>{let i=null,o=null,s=null;try{s=new TV1(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new vV1(i,n))}),i};Jbl.exports=IV1});var Zbl=m((P_C,Xbl)=>{var _V1=KM(),RV1=Az(),OV1=(r,t,n)=>{let i=null,o=null,s=null;try{s=new RV1(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new _V1(i,n))}),i};Xbl.exports=OV1});var rEl=m((N_C,tEl)=>{var iXo=KM(),wV1=Az(),eEl=sDt(),xV1=(r,t)=>{r=new wV1(r,t);let n=new iXo("0.0.0");if(r.test(n)||(n=new iXo("0.0.0-0"),r.test(n)))return n;n=null;for(let i=0;i<r.set.length;++i){let o=r.set[i],s=null;o.forEach(a=>{let u=new iXo(a.semver.version);switch(a.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!s||eEl(u,s))&&(s=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||eEl(n,s))&&(n=s)}return n&&r.test(n)?n:null};tEl.exports=xV1});var iEl=m((D_C,nEl)=>{var MV1=Az(),PV1=(r,t)=>{try{return new MV1(r,t).range||"*"}catch{return null}};nEl.exports=PV1});var uwr=m((B_C,uEl)=>{var NV1=KM(),aEl=lDt(),{ANY:DV1}=aEl,BV1=Az(),LV1=dDt(),oEl=sDt(),sEl=rwr(),kV1=iwr(),qV1=nwr(),FV1=(r,t,n,i)=>{r=new NV1(r,i),t=new BV1(t,i);let o,s,a,u,p;switch(n){case">":o=oEl,s=kV1,a=sEl,u=">",p=">=";break;case"<":o=sEl,s=qV1,a=oEl,u="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(LV1(r,t,i))return!1;for(let c=0;c<t.set.length;++c){let l=t.set[c],d=null,f=null;if(l.forEach(h=>{h.semver===DV1&&(h=new aEl(">=0.0.0")),d=d||h,f=f||h,o(h.semver,d.semver,i)?d=h:a(h.semver,f.semver,i)&&(f=h)}),d.operator===u||d.operator===p||(!f.operator||f.operator===u)&&s(r,f.semver))return!1;if(f.operator===p&&a(r,f.semver))return!1}return!0};uEl.exports=FV1});var lEl=m((L_C,cEl)=>{var UV1=uwr(),zV1=(r,t,n)=>UV1(r,t,">",n);cEl.exports=zV1});var dEl=m((k_C,pEl)=>{var QV1=uwr(),jV1=(r,t,n)=>QV1(r,t,"<",n);pEl.exports=jV1});var gEl=m((q_C,hEl)=>{var fEl=Az(),GV1=(r,t,n)=>(r=new fEl(r,n),t=new fEl(t,n),r.intersects(t,n));hEl.exports=GV1});var mEl=m((F_C,AEl)=>{var HV1=dDt(),VV1=gz();AEl.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((l,d)=>VV1(l,d,n));for(let l of a)HV1(l,t,n)?(s=l,o||(o=l)):(s&&i.push([o,s]),s=null,o=null);o&&i.push([o,null]);let u=[];for(let[l,d]of i)l===d?u.push(l):!d&&l===a[0]?u.push("*"):d?l===a[0]?u.push(`<=${d}`):u.push(`${l} - ${d}`):u.push(`>=${l}`);let p=u.join(" || "),c=typeof t.raw=="string"?t.raw:String(t);return p.length<c.length?p:t}});var vEl=m((U_C,SEl)=>{var yEl=Az(),sXo=lDt(),{ANY:oXo}=sXo,fDt=dDt(),aXo=gz(),WV1=(r,t,n={})=>{if(r===t)return!0;r=new yEl(r,n),t=new yEl(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=YV1(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},KV1=[new sXo(">=0.0.0-0")],bEl=[new sXo(">=0.0.0")],YV1=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===oXo){if(t.length===1&&t[0].semver===oXo)return!0;n.includePrerelease?r=KV1:r=bEl}if(t.length===1&&t[0].semver===oXo){if(n.includePrerelease)return!0;t=bEl}let i=new Set,o,s;for(let h of r)h.operator===">"||h.operator===">="?o=EEl(o,h,n):h.operator==="<"||h.operator==="<="?s=CEl(s,h,n):i.add(h.semver);if(i.size>1)return null;let a;if(o&&s){if(a=aXo(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let h of i){if(o&&!fDt(h,String(o),n)||s&&!fDt(h,String(s),n))return null;for(let A of t)if(!fDt(h,String(A),n))return!1;return!0}let u,p,c,l,d=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&s.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let h of t){if(l=l||h.operator===">"||h.operator===">=",c=c||h.operator==="<"||h.operator==="<=",o){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(u=EEl(o,h,n),u===h&&u!==o)return!1}else if(o.operator===">="&&!fDt(o.semver,String(h),n))return!1}if(s){if(d&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===d.major&&h.semver.minor===d.minor&&h.semver.patch===d.patch&&(d=!1),h.operator==="<"||h.operator==="<="){if(p=CEl(s,h,n),p===h&&p!==s)return!1}else if(s.operator==="<="&&!fDt(s.semver,String(h),n))return!1}if(!h.operator&&(s||o)&&a!==0)return!1}return!(o&&c&&!s&&a!==0||s&&l&&!o&&a!==0||f||d)},EEl=(r,t,n)=>{if(!r)return t;let i=aXo(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},CEl=(r,t,n)=>{if(!r)return t;let i=aXo(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};SEl.exports=WV1});var Irt=m((z_C,_El)=>{var uXo=Crt(),TEl=iDt(),JV1=KM(),IEl=j$o(),$V1=XBe(),XV1=Vyl(),ZV1=Kyl(),eW1=$yl(),tW1=ebl(),rW1=rbl(),nW1=ibl(),iW1=sbl(),oW1=ubl(),sW1=gz(),aW1=dbl(),uW1=hbl(),cW1=twr(),lW1=ybl(),pW1=Ebl(),dW1=sDt(),fW1=rwr(),hW1=H$o(),gW1=V$o(),AW1=nwr(),mW1=iwr(),yW1=W$o(),bW1=wbl(),EW1=lDt(),CW1=Az(),SW1=dDt(),vW1=Ybl(),TW1=$bl(),IW1=Zbl(),_W1=rEl(),RW1=iEl(),OW1=uwr(),wW1=lEl(),xW1=dEl(),MW1=gEl(),PW1=mEl(),NW1=vEl();_El.exports={parse:$V1,valid:XV1,clean:ZV1,inc:eW1,diff:tW1,major:rW1,minor:nW1,patch:iW1,prerelease:oW1,compare:sW1,rcompare:aW1,compareLoose:uW1,compareBuild:cW1,sort:lW1,rsort:pW1,gt:dW1,lt:fW1,eq:hW1,neq:gW1,gte:AW1,lte:mW1,cmp:yW1,coerce:bW1,Comparator:EW1,Range:CW1,satisfies:SW1,toComparators:vW1,maxSatisfying:TW1,minSatisfying:IW1,minVersion:_W1,validRange:RW1,outside:OW1,gtr:wW1,ltr:xW1,intersects:MW1,simplifyRange:PW1,subset:NW1,SemVer:JV1,re:uXo.re,src:uXo.src,tokens:uXo.t,SEMVER_SPEC_VERSION:TEl.SEMVER_SPEC_VERSION,RELEASE_TYPES:TEl.RELEASE_TYPES,compareIdentifiers:IEl.compareIdentifiers,rcompareIdentifiers:IEl.rcompareIdentifiers}});var hDt,DW1,Q_C,BW1,qC,Qee=V(()=>{"use strict";hDt=gt(zV()),DW1=gt(Irt()),Q_C=(0,hDt.Record)({version:hDt.String,hash:hDt.String}),BW1=()=>{let r="7.41.4",t="334656eda83675fc7c98dcd02860dcbcd5a21036";return r&&t?{version:r,hash:t}:null},qC=BW1()});var $Ce,_rt,cwr=V(()=>{"use strict";pr();$Ce=class extends rt{constructor(n){super(`Run ${n} canceled by user`);this.runID=n}runID;fault="client"},_rt=class extends rt{constructor(n){super('Test failed with "continue on failure" set to false');this.result=n}result;fault="client"}});var REl,OEl,r8e,gDt,ADt,lwr,pwr=V(()=>{"use strict";gy();cwr();REl=(r,t,n)=>{switch(r){case"skipped":return"Skipped";case"error":return"Error";case"complete":switch(n){case"create":return t?"Validated":"Created";case"run":return t?"Validated":"DataLoaded";default:return"None"}default:return"None"}},OEl=r=>typeof r=="object"&&r instanceof _rt,r8e=r=>typeof r=="object"&&(r instanceof sm||r instanceof $Ce),gDt=r=>typeof r=="object"&&r instanceof dz&&r.isCancel(),ADt=r=>typeof r=="object"&&r instanceof zee&&r.isCancel(),lwr=r=>r8e(r)||gDt(r)||ADt(r)});var wEl,xEl,XCe,mDt=V(()=>{"use strict";pr();A0e();Yo();Ac();ar();pm();M_();xPt();Zd();Qee();rDt();cwr();pwr();wEl=5e5,xEl=500,XCe=class r{constructor(t,n,i,o,s){this.state=t;this.repository=n;this.logContext=i;this.operationType=o;this.analyticsCollector=s}state;repository;logContext;operationType;stepsInitialized=null;runResults={};flusher=null;wasCanceled=!1;nodeStageIndexTracker=new Map;analyticsCollector;get teamID(){return this.logContext.orgID}get runID(){return this.logContext.runID}get envID(){return this.logContext.workspaceID}GetLogContext=t=>({...this.logContext,nodeID:t});async runIsCanceled(){if(!this.repository)return!1;if(this.wasCanceled)return!0;try{let t=!!(await this.getRepositoryForRun().fetch({pendingWritesTimeoutMs:100})).runDetails.canceled;return t&&(this.wasCanceled=!0),t}catch(t){if(b2(t)){if(t instanceof KBe)return!1;if(t instanceof Wu)return!1}throw t}}async throwIfRunCanceled(){if(await this.runIsCanceled())throw new $Ce(this.runID)}updateNodeLocalRunResult({stepID:t,isPreview:n,runExecutionSequenceID:i},o){let s=this.runResults[t];s?(s.runState=o,s.queryResultSequence.isRunning=o==="running",s.stepRunState=this.getStepRunState(o,n),i!==void 0&&(s.runExecutionSequenceID=i),(o==="canceled"||o==="skipped"||o==="error")&&s.queryResultSequence.queryResults.forEach(a=>{!a.isRunning&&a.status==="Queued"&&(a.status="Canceled")})):this.Logger.errorContext(this.GetLogContext(t),"EventHandler updateNodeLocalRunResult: missing expected local run result for node",t)}getBulkSkipHandler=()=>async t=>{if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let[o,s]of Object.entries(t))if(this.runResults[o]){let a=i.get(o);this.updateNodeLocalRunResult({stepID:o,isPreview:!1,runExecutionSequenceID:s},"skipped");let u={...r.truncateRunResult(this.runResults[o]),version:2};await n.save(a,u)}await n.commit()};getCancelNodeHandler=()=>async t=>{try{if(!this.repository)return;if(this.runResults[t]){this.updateNodeLocalRunResult({stepID:t,isPreview:!1},"canceled");let i=this.getRepositoryForRun().runResults.get(t),o={...r.truncateRunResult(this.runResults[t]),version:2};await i.save(o)}else this.Logger.errorContext(this.GetLogContext(t),"EventHandler getCancelNodeHandler: missing expected local run result for node",t)}catch(n){this.Logger.errorContext(this.logContext,`Error canceling node ${t}`,n)}};async repositoryUpdateRunStatus({expectedStatus:t,newStatus:n}){if(!this.repository)return;let i=this.getRepositoryForRun();try{let o=await i.fetch();ig("RUNNER_BACKEND",t===o.runStatus,this.logContext,`EventHandler.repositoryUpdateRunStatus found unexpected run status - expected: ${t} / actual: ${o.runStatus}`)}catch(o){this.Logger.alertContext(this.logContext,"Error fetching runInfo",o)}await i.merge({runStatus:n})}async repositoryStampExecutorInfo(t){if(this.repository)try{await this.getRepositoryForRun().merge({platform:t,...qC?{softwareVersion:qC.version}:{}})}catch(n){this.Logger.errorContext(this.logContext,"[EventHandler.repositoryStampExecutorInfo] Error stamping executor info. Cannot update run document version/platform.",n)}}async repositoryUpdateRenderingProgress(t){if(this.repository)try{await this.getRepositoryForRun().merge({renderingProgress:{totalNodes:t.totalNodes,completedNodes:t.completedNodes}})}catch(n){this.Logger.errorContext(this.logContext,"[EventHandler.repositoryUpdateRenderingProgress] Error updating rendering progress. Cannot update run document renderingProgress.",n)}}getRepositoryRunsCollection(){if(!this.repository)throw new rt("No repository to get runs collection for!");return this.repository.orgs.get(this.logContext.orgID).runs}getRepositoryForRun(){return this.getRepositoryRunsCollection().get(this.runID)}formatError=(t,n=null,i=null,o=!1)=>{let s=Ia(t.error).error,a="";return t.error&&typeof t.error=="object"&&!(t.error instanceof Error)&&"runDetails"in t.error&&typeof t.error.runDetails=="object"&&(a=t.error?.runDetails?.compiledSQL??""),t.templateString&&(a=t.templateString),{success:!1,error:{errorString:s.errorString??"",errorDetail:s.errorDetail??""},rows:[],fields:[],name:"",exportedRefs:[],invalidExportedRefs:[],status:o?"Canceled":"Failure",sql:a??"",startTime:t.startTime,endTime:new Date,isRunning:!1,type:"sql",queryID:n,warehouse:i}};populateRunResults(t,n){let i="[EventHandler.populateRunResults()]",o=t.length+1;for(let s of t){let u=F1(s,this.state.nodes,`${i} state.nodes`).operation.name;this.runResults[s]={name:u,runExecutionSequenceID:o,dataResult:null,runState:n,stepRunState:"None",queryResultSequence:{name:u,queryResults:[],isRunning:!1},runResultVersion:2}}}async bulkSetRunResults(t){if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let o of t){let s=this.runResults[o];if(!s)throw new rt(`Run result for node ${o} does not exist for run ${this.runID}`);let a={...s,name:s.queryResultSequence.name,runExecutionSequenceID:s.runExecutionSequenceID,version:2},u=i.get(o);await n.save(u,a)}await n.commit()}async initializeRunResults(t,n="queued"){this.stepsInitialized=[...t],this.populateRunResults(t,n),await this.bulkSetRunResults(t)}setFlusher(t){this.flusher=t,t.startTimer()}async disposeFlusher(){await this.flusher?.stopAndFlush()}async populatePlaceholderStages(t,n){let i=new Set,o=new Set(t.keys());for(let s of n){if(!o.has(s))continue;let a=t.getPhaseItems(s);for(let[u,p]of a.entries()){let c=F1(u,this.runResults,"populateQueuedStages: this.runResults"),l=this.state.nodes[u],d=l?sN(l,void 0):!1,f=Ert(p,this.getNameForStageWithoutSQL(s,d));for(let h of f)c.queryResultSequence.queryResults.push(this.createQueuedStage(h));f.length>0&&!i.has(u)&&(i.add(u),this.nodeStageIndexTracker.set(u,0))}}await this.bulkSetQueuedStageResults(i)}createQueuedStage({name:t,sql:n,type:i}){return{name:t,status:"Queued",success:!0,sql:n,rows:[],fields:[],startTime:new Date,endTime:new Date,isRunning:!1,exportedRefs:[],invalidExportedRefs:[],type:i}}async bulkSetQueuedStageResults(t){if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let o of t){let s=this.runResults[o];if(!s)continue;let a=i.get(o);await n.save(a,r.buildRunResultEntitySave(s))}await n.commit()}formatErrorToResult(t,n){let i=null,o=null;return typeof t.error=="object"&&(i=t.error.queryID||null,o=t.error.warehouse||null),{...this.formatError(t,i,o,n),name:t.stageName,stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime}}ensureHasQueryResult(t){if(ig("DEPLOY",!!t.queryResult,this.GetLogContext(t.stepID),"query result should always be returned for stage execution"),!t.queryResult)throw new Error("Got an empty query result for stage execution")}updateStageResultAtTrackedIndex=(t,n)=>{let o=F1(t,this.runResults,"[EventHandler.setLastQueryResult()]").queryResultSequence.queryResults,s=this.getCurrentStageIndex(t);if(s<0||s>=o.length)throw this.Logger.errorContext(this.GetLogContext(t),"[EventHandler.setLastQueryResult] stage index out of bounds",{targetIndex:s,queryResultsLength:o.length,resultName:n.name}),new rt(`Stage index ${s} out of bounds (length: ${o.length}) for node ${t}`);o[s]=n};async dispatchQueryFailure(t,n){let i=this.formatErrorToResult(t,n),o=n?"client":C_(t.error)??"system";return WS(this.Logger,o,this.GetLogContext(t.stepID),"failed to execute run sql",n?"- canceled":"- errored",t.error,"stack: ",t.error.stack||"<none found>"),this.updateStageResultAtTrackedIndex(t.stepID,i),{error:i.error,fault:o}}getSingleStepData(t,n){let i=this.state.nodes[n];if(i)return i;let o=`(${this.runTypeName}) EventHandler: Could not get step data for step: ${n}`;throw this.Logger.errorContext(this.GetLogContext(n),o,n),new rt(o)}getUnrunSteps(){let t={},n=this.state.nodes,i=this.runResults;if(n&&this.stepsInitialized)for(let o of this.stepsInitialized){let s=i[o];if(s){let{runState:a}=s;(a==="waiting"||a==="queued")&&(n[o]?t[o]=0:this.Logger.alertContext(this.logContext,"Node ID from initialization not found in steps data",o))}else this.Logger.alertContext(this.logContext,"Node ID from initialization not found in run results",o)}return t}getStepContext=(t,n,i,o)=>{let s=this.getSingleStepData(t,n),{locationName:a}=s.operation,{database:u}=this.state.mappings[a]?.mappingDefinitions[this.state.currentWorkspace]??{},p=sN(s,void 0),c=s.operation.name;return{startTime:new Date,stepID:n,stepName:c,runExecutionSequenceID:i,phase:t,isPreview:o,isSource:p,database:u??""}};convertIQueryToCompletedQueryResult(t){return{...t,startTime:Vzo(t.startTime),endTime:Vzo(t.endTime)}}getCurrentStageIndex(t){let n=this.nodeStageIndexTracker.get(t);if(n===void 0)throw new rt(`[EventHandler.getCurrentStageIndex] Node ${t} not in stage tracker. Was populateQueuedStages called for this node?`);return n}advanceToNextStage(t){let n=this.getCurrentStageIndex(t);this.nodeStageIndexTracker.set(t,n+1)}getQueryResultForUpdateSuccess(t){return{...this.convertIQueryToCompletedQueryResult(t.queryResult),name:t.stageName,stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime}}getStepRunState(t,n){return REl(t,n,this.operationType)}async updateRunResult(t){if(!this.repository)return;let n=this.runResults[t];if(!n)throw new rt(`[EventHandler.updateRunResult()] run result for node ${t} does not exist for run ${this.runID}`);if(this.flusher)this.flusher.markDirty(t);else{let i=r.buildRunResultEntitySave(n);this.Logger.debugContext(this.GetLogContext(t),"updating run result",i),await this.getRepositoryForRun().runResults.get(t).save(i)}}isFinalRunForStep(t){return!0}async beforePhaseExecution(t,n){}async afterPhaseExecution(t){}async beforeStepExecution(t){this.runResults[t.stepID]&&(this.runResults[t.stepID].runExecutionSequenceID=t.runExecutionSequenceID),this.updateNodeLocalRunResult(t,"running"),await this.updateRunResult(t.stepID)}async afterFinalRunSuccessForNode(t){return Promise.resolve()}async afterStepExecutionSuccess(t){this.isFinalRunForStep(t)?(this.updateNodeLocalRunResult(t,"complete"),await this.afterFinalRunSuccessForNode(t)):this.updateNodeLocalRunResult(t,"waiting"),await this.updateRunResult(t.stepID)}async afterStepExecutionFailure(t){let n=await this.isCoalesceInitiatedCancel(t.error);this.markUnexecutedStagesAsCanceled(t.stepID),this.updateNodeLocalRunResult(t,n?"canceled":"error");try{this.flusher?await this.flusher.flushOne(t.stepID):await this.updateRunResult(t.stepID)}catch(i){this.Logger.emergContext(this.GetLogContext(t.stepID),`Error in firebaseUpdateStepResult for stepCounter:${t.stepID}:`,i)}}markUnexecutedStagesAsCanceled(t){let n=this.runResults[t];if(n)for(let i of n.queryResultSequence.queryResults)"status"in i&&i.status==="Queued"&&(i.status="Canceled")}sanityCheckContext(t){if(!t.stageType)throw this.Logger.emergContext(this.logContext,`No stage type on this ${this.runTypeName}!`,t),new Error(`Internal critical error: no stage type on this ${this.runTypeName}!`)}async beforeStageExecution(t){this.sanityCheckContext(t);let n=this.runResults[t.stepID];if(n){let i=n.queryResultSequence.queryResults,o=this.getCurrentStageIndex(t.stepID),s=i[o];if(!s||!("status"in s)||s.status!=="Queued"){let a=s&&"status"in s?s.status:"no-status";throw new rt(`[EventHandler.beforeStageExecution] Expected queued placeholder at index ${o} for node ${t.stepID}, but found: ${s?`status=${a}`:"undefined"}`)}s.status="Running",s.startTime=new Date,s.endTime=s.startTime,await this.updateRunResult(t.stepID)}}async updateRunWithHeartbeat(t){await this.getRepositoryForRun().updateHeartbeat(t)}async afterStageExecutionSuccess(t){let n="[EventHandler.afterStageExecutionSuccess()]";if(this.sanityCheckContext(t),!t.queryResult){let i="Got an empty query result for stage execution - query result should always be returned!";throw this.Logger.alertContext(this.GetLogContext(t.stepID),n,i),new rt(i)}if(t.stageExecutionStartTime&&t.stageExecutionEndTime){let i=t.stageExecutionEndTime.getTime()-t.stageExecutionStartTime.getTime();this.analyticsCollector.addQueryTiming(t.stepID,t.stageName,i,!0,t.stageExecutionStartTime)}if(wPt(t.queryResult)&&!t.queryResult.success){await this.updateRunWithHeartbeat({hasTestFailures:!0});let i=this.runResults[t.stepID];i&&(i.hasTestFailures=!0)}this.updateStageResultAtTrackedIndex(t.stepID,this.getQueryResultForUpdateSuccess(t)),await this.updateRunResult(t.stepID),this.advanceToNextStage(t.stepID)}async afterStageExecutionFailure(t){if(this.sanityCheckContext(t),t.stageExecutionStartTime&&t.stageExecutionEndTime){let o=t.stageExecutionEndTime.getTime()-t.stageExecutionStartTime.getTime();this.analyticsCollector.addQueryTiming(t.stepID,t.stageName,o,!1,t.stageExecutionStartTime)}let n=await this.isCoalesceInitiatedCancel(t.error),i=await this.dispatchQueryFailure(t,n);throw this.flusher?await this.flusher.flushOne(t.stepID):await this.updateRunResult(t.stepID),this.advanceToNextStage(t.stepID),n?t.error:i}async isCoalesceInitiatedCancel(t){return r8e(t)?!0:gDt(t)?this.runIsCanceled():ADt(t)?this.runIsCanceled():!1}static truncateQueryResult(t,n=wEl,i=xEl){let o=t.sql,s=t.rows,a,u;if(o){let p=new TextEncoder,c=new TextDecoder("utf8"),l=p.encode(o);if(l.length>n){let d=c.decode(l.slice(0,n));d.slice(-1)==="\uFFFD"&&(d=d.slice(0,-1)),a=`${d}...data truncated`}}return s?.length>i&&(u=s.slice(0,i),u.push({values:[`${s.length-i} rows truncated`]})),a||u?{...t,sql:a??o,rows:u??s}:t}static buildRunResultEntitySave(t){return{...r.truncateRunResult(t),name:t.queryResultSequence.name,runExecutionSequenceID:t.runExecutionSequenceID,version:2}}static truncateRunResult(t){let n=(t.dataResult?.sql?1:0)+(t.queryResultSequence?.renderQueryResults?.sql?1:0)+(t.queryResultSequence?.queryResults?.length??0),i=(t.dataResult?.rows?.length?1:0)+(t.queryResultSequence?.renderQueryResults?.rows?.length?1:0)+(t.queryResultSequence?.queryResults?.reduce((p,c)=>p+c?.rows?.length?1:0,0)??0);if(n===0&&i===0)return t;let o=Math.trunc(wEl/n)-100,s=xEl/(i??1),a={...t};t.dataResult?.sql&&(a.dataResult=r.truncateQueryResult(t.dataResult,o,s)??null);let u=t.queryResultSequence;return u&&(a.queryResultSequence={...u,queryResults:u.queryResults?.map(p=>r.truncateQueryResult(p,o,s))},u.renderQueryResults&&(a.queryResultSequence.renderQueryResults=r.truncateQueryResult(u.renderQueryResults,o,s))),a}}});var dwr,MEl=V(()=>{"use strict";ka();Yo();Ac();R6();rDt();nDt();mDt();dwr=class extends XCe{constructor(n,i,o,s,a){super(n,i,o,"create",a);this.phasedNodeData=s}phasedNodeData;getNameForStageWithoutSQL=(n,i)=>$Or(n,i);getNodeDataForUpdate=n=>{let i=this.getSingleStepData(n.phase,n.stepID),o=i.operation.locationName,s=rz(this.state.mappings,this.envID),a=this.GetLogContext(n.stepID),u;try{let p=s?.[o]?.database??i.operation.database,c=s?.[o]?.schema??i.operation.schema;return u={...i.operation,metadata:{...i.operation.metadata,columns:i.operation.metadata.columns.map(l=>({...l}))},database:p,schema:c,version:1,id:n.stepID,deployEnabled:!0},this.Logger.infoContext(a,"newStepData:",u,"stepCounter:",n.stepID),gLc("(Logging Only) Compare locations from context and workspace",a,()=>{let l=rz(this.state.mappings||{},this.state.currentWorkspace);ig("DEPLOY",OX(l[o],s[o]),a,`Location data for location ${o} for node ${i.operation.name} with id ${n.stepID} differs between data from context and data from workspace.`,"locationsFromWorkspace:",l,"locationsFromContext:",s)}),u}catch(p){let c=u?u.name:i.operation.name,l=`Error attempting to update the database/schema on deployed nodeID ${n.stepID}: ${c}`;throw this.Logger.emergContext(a,l,"locations:",s,"error:",p),new SW(n.stepID,l)}};async updateEnvironmentNodeMetadata(n){if(!this.repository)return;let i=this.repository.org(this.teamID).workspace(+this.envID).nodes.get(n.stepID);if(n.phase==="deletedTable")n.stepID in this.phasedNodeData.addedTable||await i.delete();else{let o=this.getNodeDataForUpdate(n);await i.save(o)}}isFinalRunForStep(n){let i=[];return n.phase==="deletedTable"&&(i.push(this.phasedNodeData.alteredTable),i.push(this.phasedNodeData.addedTable)),n.phase==="alteredTable"&&i.push(this.phasedNodeData.addedTable),!i.some(o=>n.stepID in o)}async afterFinalRunSuccessForNode(n){try{await this.updateEnvironmentNodeMetadata(n)}catch(i){let o=this.GetLogContext(n.stepID);this.Logger.errorContext(o,"Error updating node metadata -- nodeID:",n.stepID,"error:",i);let s=J$e(i),a="unknown location";try{a=this.getSingleStepData(n.phase,n.stepID).operation.locationName}catch(u){this.Logger.errorContext(o,`Error getting location name for node ${n.stepName} (${n.stepID}):`,u)}throw new SW(n.stepID,`Failed to update node metadata for ${n.stepName} (${a}): ${s}`)}}}});var PEl,fwr,cXo=V(()=>{"use strict";pr();PEl=(r,t)=>{let n=new Set(t);return n.delete(r),Array.from(n)},fwr=async(r,t,n)=>{if(!t)throw new rt(`Cannot get deploy run info since workspace ${r} has no currently running jobs`);if(t.length)return(await n.selectInBatches("id","in",t,[["runType","==","deploy"],["runStatus","==","running"]]))[0]}});var hwr,NEl=V(()=>{"use strict";hwr="No SQL to execute"});var yDt=V(()=>{"use strict";cXo();NEl()});var gwr,DEl=V(()=>{"use strict";yDt();mDt();gwr=class extends XCe{constructor(t,n,i,o){super(t,n,i,"run",o)}async initializeRunResults(t){await super.initializeRunResults(t,"waiting")}getNameForStageWithoutSQL=()=>hwr}});var BEl=V(()=>{"use strict"});var Awr,lXo=V(()=>{"use strict";Awr=class{constructor(t,n,i,o,s,a,u){this.repository=t;this.getRunRepository=n;this.buildEntitySave=i;this.runResults=o;this.logger=s;this.logContext=a;this.flushIntervalMs=u?.flushIntervalMs??3e3,this.flushThreshold=u?.flushThreshold??50}repository;getRunRepository;buildEntitySave;runResults;logger;logContext;dirtyNodes=new Set;timer=null;activeFlush=null;flushedDuringBatch=new Set;flushIntervalMs;flushThreshold;totalFlushes=0;totalNodeWrites=0;totalImmediateWrites=0;timerFlushes=0;thresholdFlushes=0;slowCommits=0;tag="[RunResultFlusher]";markDirty(t){this.dirtyNodes.add(t),this.dirtyNodes.size>=this.flushThreshold&&this.flush("threshold").catch(n=>{this.logger.errorContext(this.logContext,`${this.tag} threshold-triggered flush error`,n)})}async flush(t="dispose"){if(this.activeFlush||this.dirtyNodes.size===0){this.logger.debugContext(this.logContext,`${this.tag} flush skipped (activeFlush=${!!this.activeFlush}, dirtySetEmpty=${this.dirtyNodes.size===0}, trigger=${t})`);return}let n=new Set(this.dirtyNodes);this.dirtyNodes.clear(),this.activeFlush=this.doFlush(n,t);try{await this.activeFlush}finally{this.activeFlush=null}}async doFlush(t,n){try{let i=this.repository.batch();for(let a of t){let u=this.runResults[a];if(!u){this.logger.warnContext(this.logContext,`${this.tag} node ${a} no longer has a run result, skipping write`);continue}let p=this.buildEntitySave(u),c=this.getRunRepository().runResults.get(a);await i.save(c,p)}let o=Date.now();await i.commit();let s=Date.now()-o;if(this.flushedDuringBatch.size>0){let a=this.getRunRepository().runResults;for(let u of this.flushedDuringBatch)if(t.has(u)){let p=this.runResults[u];p&&await a.get(u).save(this.buildEntitySave(p))}this.flushedDuringBatch.clear()}this.totalFlushes++,this.totalNodeWrites+=t.size,n==="timer"&&this.timerFlushes++,n==="threshold"&&this.thresholdFlushes++,s>=2e3&&(this.slowCommits++,this.logger.warnContext(this.logContext,`${this.tag} slow commit: ${s}ms for ${t.size} nodes (possible write stream pressure)`)),this.logger.debugContext(this.logContext,`${this.tag} flushed ${t.size} run results in ${s}ms (${n}, threshold=${this.flushThreshold}, interval=${this.flushIntervalMs}ms)`)}catch(i){for(let o of t)this.dirtyNodes.add(o);throw this.logger.errorContext(this.logContext,`${this.tag} flush failed, ${t.size} nodes re-queued`,i),i}}async flushOne(t){this.dirtyNodes.delete(t);let n=this.runResults[t];if(!n){this.logger.warnContext(this.logContext,`${this.tag} node ${t} no longer has a run result, skipping write (flushOne)`);return}this.activeFlush&&this.flushedDuringBatch.add(t);let i=this.buildEntitySave(n);await this.getRunRepository().runResults.get(t).save(i),this.totalImmediateWrites++}startTimer(){this.timer||(this.timer=setInterval(()=>{this.flush("timer").catch(t=>{this.logger.errorContext(this.logContext,`${this.tag} timer-triggered flush error`,t)})},this.flushIntervalMs))}async stopAndFlush(){this.timer&&(clearInterval(this.timer),this.timer=null);try{if(this.activeFlush)try{await this.activeFlush}catch(t){this.logger.errorContext(this.logContext,`${this.tag} error waiting for in-flight flush (stopAndFlush)`,t)}this.logger.infoContext(this.logContext,`${this.tag} draining remaining dirty nodes (stopAndFlush)`),await this.flush("dispose")}catch(t){this.logger.errorContext(this.logContext,`${this.tag} error stopping and flushing (stopAndFlush)`,t)}finally{this.logger.infoContext(this.logContext,`${this.tag} done \u2014 ${this.totalFlushes} flushes (${this.thresholdFlushes} threshold, ${this.timerFlushes} timer, ${this.slowCommits} slow), ${this.totalNodeWrites} batched writes, ${this.totalImmediateWrites} immediate writes (threshold=${this.flushThreshold}, interval=${this.flushIntervalMs}ms)`)}}}});var mwr,ywr,ZCe=V(()=>{"use strict";ar();MEl();DEl();pwr();cwr();mDt();BEl();lXo();pwr();mwr=class extends dwr{constructor(t,n,i,o,s){super(t,n,i,o,s)}get Logger(){return $e("DEPLOY")}get runTypeName(){return"Deploy"}},ywr=class extends gwr{get Logger(){return $e("RUNNER")}get runTypeName(){return"Refresh"}afterStepExecutionSuccess=async t=>{await super.afterStepExecutionSuccess(t),this.repository&&super.isFinalRunForStep(t)&&!t.isSource&&await this.repository.org(this.logContext.orgID).workspace(this.logContext.workspaceID).nodeLastRefreshed(t.stepID).save({lastRefreshed:new Date().toISOString()})};getQueryResultForUpdateSuccess=t=>({...super.getQueryResultForUpdateSuccess(t),type:t.stageType});async dispatchQueryFailure(t,n){if(OEl(t.error)){let i=t.error,o=this.getCurrentStageIndex(t.stepID);t.stepID in this.runResults&&(this.runResults[t.stepID].queryResultSequence.queryResults[o]=this.convertIQueryToCompletedQueryResult(i.result));let s=this.runResults[t.stepID];return s&&(s.hasTestFailures=!0),await this.updateRunWithHeartbeat({hasTestFailures:!0}),{error:{errorString:t.error.message,errorDetail:t.error.message},fault:"client"}}else return super.dispatchQueryFailure(t,n)}}});var Rrt,Ort,n8e=V(()=>{"use strict";Rrt=["deletedTable","alteredTable","addedTable"],Ort=["refresh"]});var bwr,bDt,Ewr,LEl,kEl,kW1,qW1,FW1,UW1,qEl,wrt,Cwr,pXo,C0e,S0e=V(()=>{"use strict";ka();hb();Ao();ar();HVo();h$o();bwr=`{%- macro get_value_by_column_attribute(column_attribute, value="name") -%}
7877
+ %s`,W,W,v,a);let $=v.type==="*"?S$o:v.type==="?"?T$o:"\\"+v.type;u=!0,a=a.slice(0,v.reStart)+$+"\\("+W}U(),p&&(a+="\\\\");let G=dG1[a.charAt(0)];for(let W=l.length-1;W>-1;W--){let $=l[W],q=a.slice(0,$.reStart),J=a.slice($.reStart,$.reEnd-8),Y=a.slice($.reEnd),z=a.slice($.reEnd-8,$.reEnd)+Y,Z=q.split(")").length,ee=q.split("(").length-Z,ne=Y;for(let te=0;te<ee;te++)ne=ne.replace(/\)[+*?]?/,"");Y=ne;let ae=Y===""&&n!==UOr?"(?:$|\\/)":"";a=q+J+Y+ae+z}if(a!==""&&u&&(a="(?=.)"+a),G&&(a=L()+a),n===UOr)return[a,u];if(i.nocase&&!u&&!i.nocaseMagicOnly&&(u=t.toUpperCase()!==t.toLowerCase()),!u)return mG1(t);let H=i.nocase?"i":"";try{let W=s?{_glob:t,_src:a,test:s}:{_glob:t,_src:a};return Object.assign(new RegExp("^"+a+"$",H),W)}catch(W){return this.debug("invalid regexp",W),new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,i=n.noglobstar?S$o:n.dot?lG1:pG1,o=n.nocase?"i":"",s=t.map(a=>{let u=a.map(p=>typeof p=="string"?bG1(p):p===fz?fz:p._src);return u.forEach((p,c)=>{let l=u[c+1],d=u[c-1];p!==fz||d===fz||(d===void 0?l!==void 0&&l!==fz?u[c+1]="(?:\\/|"+i+"\\/)?"+l:u[c]=i:l===void 0?u[c-1]=d+"(?:\\/|"+i+")?":l!==fz&&(u[c-1]=d+"(?:\\/|\\/"+i+"\\/)"+l,u[c+1]=fz))}),u.filter(p=>p!==fz).join("/")}).join("|");s="^(?:"+s+")$",this.negate&&(s="^(?!"+s+").*$");try{this.regexp=new RegExp(s,o)}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):zOr&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let i=this.options;v$o.sep!=="/"&&(t=t.split(v$o.sep).join("/"));let o=this.slashSplit(t);this.debug(this.pattern,"split",o);let s=this.set;this.debug(this.pattern,"set",s);let a=o[o.length-1];if(!a)for(let u=o.length-2;!a&&u>=0;u--)a=o[u];for(let u=0;u<s.length;u++){let p=s[u],c=o;if(i.matchBase&&p.length===1&&(c=[a]),this.matchOne(c,p,n))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return B_.defaults(t).Minimatch}};B_.Minimatch=grt});var Wml,Kml,Yml,Jml,$ml,Xml,Zml,eyl,tyl,ryl,nyl,Vml,Art,iyl=V(()=>{"use strict";JNt();Wml=2,Kml=1,Yml=3,Jml=2,$ml=8,Xml=5,Zml=6,eyl=new RegExp(/([\+]?){([\s\S]+)}([\+](?![\+]))?\s*/g),tyl=new RegExp(/((\w+):\s*((?:["])((([^\"\+\r\n\[/\\]+))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),ryl=new RegExp(/((\w+):\s*(((?:["])(((?:[^"]|"")*))(?:["]))|(([^\"\ \+\r\n\[/\\]+))))/g),nyl=new RegExp(/((?:[^\+\ \r\n\[\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+)\s*/g),Vml="",Art=(r,t)=>{if(t==="*")return r.some(o=>o!=null&&String(o).length>0);let n=r.map(o=>o!=null?String(o).replace(/\//g,Vml):""),i=t.replace(/\//g,Vml);return!!I$o(n,i).length}});var mrt,i3C,oyl,syl,ayl,jOr,uyl,GOr=V(()=>{"use strict";Zr();Yo();vd();z3();ar();y$o();iyl();mrt=$e("SEARCH"),i3C=x.object({include:x.string(),exclude:x.string(),enabled:x.boolean()}),oyl={name:{MatchFunction:Art,MatchList:r=>[r.operation.name]},location:{MatchFunction:Art,MatchList:r=>[r.operation.locationName]},nodeType:{MatchFunction:Art,MatchList:r=>[r.operation.sqlType]},subgraph:{MatchFunction:Art,MatchList:r=>[r?.id?.toString(),r.name]},nodeID:{MatchFunction:Art,MatchList:r=>[r]}},syl=r=>{let t=[];return r.forEach((n,i)=>{if(n==="+{"||n==="{"||n==="}"||n==="}+")return;let o=n,s=n.split(""),a=s[s.length-1],u=s[0];a!=="}"&&a!=="+"&&(o=o+r[i+1]),u!=="{"&&u!=="+"&&(o=r[i-1]+o),t.push(o)}),t},ayl=(r,t,n,i=!1)=>{let{steps:o,graphInformation:s,allSubgraphs:a,allStepTypesYAML:u}=n,p={},c=ZI()?Date.now():performance.now(),l=r;l||(l=t);let d=l.split(/(\}\+?)\s*(or|OR|\|\|)\s*(\+?\{)/).filter(A=>!(A==="OR"||A==="or"||A==="||")),f=syl(d);f.length||(f=[t]),mrt.debug("got unions",f,"searchStringTouse",l,"defaultSearchString",t,"steps",o),f.forEach(A=>{let E=A.split(/(\}\+?)\s*(and|AND|\,)\s*(\+?\{)/).filter(L=>!(L==="AND"||L==="and"||L===",")),v=syl(E),T=[];v.forEach(L=>{let k={};mrt.debug("Got intersection:",L);let U=[...L.matchAll(eyl)];if(mrt.debug("Got matches:",L,U),!U[0])return;let G=U[0][Wml],H={prefix:U[0][Kml]||"",postfix:U[0][Yml]||""};if(G.indexOf(":")>-1){let q=i?ryl:tyl,J=[...G.trim().matchAll(q)],Y=i?Zml:Xml;J.forEach(z=>{let Z=z[Jml],ee=z[$ml]||z[Y];H[Z]=ee})}else{let J=[...G.trim().matchAll(nyl)][0];J&&(H.name=J[0])}MM(H);let W=H;mrt.debug("Got groups ",L,W);let $=new Set;if(W.subgraph?Object.values(a).forEach(q=>{let J=oyl.subgraph,Y=J.MatchList(q);if(J.MatchFunction(Y,W.subgraph)){let{steps:Z}=q;Z.forEach(ee=>{$.add(ee.toString())})}else return}):$=new Set(Object.keys(o)),W.nodeType){let{nodeType:q}=W;if(!u[q]){let J=q;Object.entries(u).forEach(([Y,z])=>{z.name===q&&(J=Y)}),W.nodeType=J}}Object.keys(o).forEach(q=>{if(!W){mrt.emerg("got an unexpected undefined value for match",l,W,L);return}let J=$.has(q);if(Object.entries(W).forEach(([Y,z])=>{let Z=o[q];if(Y==="nodeID"&&(Z=q),Y==="subgraph"){J=$.has(q);return}let ee=oyl[Y];if(ee){let ne=ee.MatchList(Z).filter(ae=>ae!=null);J=J&&ee.MatchFunction(ne,z)}}),J){if(k[q]=!0,W.prefix&&s){let Y=m$o(s,q,"predecessors");Object.values(Y).forEach(z=>[...z.keys()].forEach(Z=>k[Z]=!0))}if(W.postfix&&s){let Y=m$o(s,q,"successors");Object.values(Y).forEach(z=>[...z.keys()].forEach(Z=>k[Z]=!0))}}}),T.push(k)}),T.length||T.push({});let O={};Object.keys(o).forEach(L=>{O[L]=!0});let D=T.reduce((L,k)=>Object.fromEntries(nLc(L,k).map(U=>[U,!0])),O);p={...p,...D}});let h=ZI()?Date.now():performance.now();return mrt.debug("Time that search took: ",h-c),p},jOr=(r,t,n,i=!1)=>{let o=ayl(`${r}`,"{ * }",n,i),s=ayl(`${t}`,"!*",n,i),a=o;return Object.keys(s).forEach(u=>{delete a[u]}),{stepsResult:a}},uyl=(r,t,n,i)=>{let o=[];return t.forEach(s=>{let a=i[s];if(a){let{name:u}=a,p=`{ subgraph: "${u}" }`;o.push(p)}}),r.forEach(s=>{let a=n[s];if(a){let{locationName:u,name:p}=a.operation,c=`{ location: "${u}" name: "${p}" }`;o.push(c)}}),o}});var SG1,cyl,_$o,lyl,HOr=V(()=>{"use strict";Ao();ar();GOr();SG1=$e("JOBS"),cyl=r=>!r?.hasOwnProperty("includeSelector")||!r?.hasOwnProperty("version"),_$o=(r,t,n)=>{let{steps:i,subgraphs:o,...s}=r,a={...s};if(a.hasOwnProperty("version")||(a.version=DZ),a.hasOwnProperty("includeSelector"))return a;a.includeSelector="",a.excludeSelector="";let u=new Set(i),p=new Set(o),d=uyl([...u],[...p].map(f=>`${f}`),n,t).map(f=>`+${f}`).join(" OR ");return a.includeSelector=d,SG1.info("Upgrading job v1 to v2",r,a),a},lyl=(r,t)=>{let{jobs:n,folders:i,steps:o}=r,s=n[t];return _$o(s,i,o)}});var f3C,pyl,dyl=V(()=>{"use strict";pr();Ac();ar();Hde();f3C=$e("PACKAGES_BACKEND"),pyl=(r,t,n)=>{let i=DVo(t)??"",o=r?.config?.entities?.nodeTypes[i];return o||(n.error(`No config found for node type ${t}`),{isDisabled:!1,defaultStorageLocation:null})}});var yrt,vG1,TG1,VOr=V(()=>{"use strict";ka();ar();lIr();dyl();yrt=(r,t={})=>Object.values(r).map(n=>vG1(n)).reduce((n,i)=>{for(let[o,s]of Object.entries(i))n[o]=s;return n},t),vG1=r=>Object.fromEntries(Object.entries(r?.contents?.nodeTypes??{}).map(([t,n])=>{let{id:i,nodeType:o}=TG1(r.alias,t,r,n);return[i,o]})),TG1=(r,t,n,i)=>{let o=bcl(r,t),{isDisabled:s,defaultStorageLocation:a}=pyl(n,o,$e("PACKAGES")),u={...Gc(i),id:o,isDisabled:s};return u.metadata.defaultStorageLocation=a,{id:o,nodeType:u}}});var $o,IG1,fyl,hyl,R$o,T3C,_G1,gyl,RG1,OG1,WOr,O$o=V(()=>{"use strict";$o=gt(zV());Ao();QV();wEr();$a();IG1=$o.Record({type:$o.Unknown,name:$o.String}),fyl=$o.Record({locationName:$o.String,nodeName:$o.String}),hyl=$o.Record({sql:$o.String,success:$o.Boolean,rows:$o.Array($o.Unknown),fields:$o.Array(IG1),error:$o.Union($o.Null,SEr).optional(),startTime:$o.Unknown,endTime:$o.Unknown,status:$o.String,name:$o.String,isRunning:$o.Boolean,exportedRefs:$o.Array(fyl),invalidExportedRefs:$o.Array(fyl),queryResultSequence:$o.Optional($o.Unknown),type:$o.Union($o.Literal("sql"),$o.Literal("sqlTest")).optional(),warehouse:$o.String.nullable().optional(),queryID:$o.String.nullable().optional()}),R$o=$o.Record({name:$o.String,queryResults:$o.Array(hyl),isRunning:$o.Boolean,renderQueryResults:$o.Optional(hyl)}),T3C=$o.Record({runExecutionSequenceID:$o.Number,runResultVersion:$o.Number,name:$o.String,queryResultSequence:R$o,runState:$o.String}),_G1=$o.Record({dataResult:$o.Unknown,name:$o.String,queryResultSequence:R$o,runExecutionSequenceID:$o.Number,runResultVersion:$o.Number,runState:$o.String,stepRunState:tXe(DLo)}),gyl=xM("RunResultFirestoreValidator",_G1),RG1=$o.Record({nodeID:$o.String,queryResultSequence:R$o,runState:$o.String,hasTestFailures:$o.Boolean.optional()}),OG1=$o.Record({runResults:$o.Record({runStartTime:$o.Unknown,runEndTime:$o.Unknown,runFailureReason:$o.Optional($o.String),runType:$o.String,runStatus:$o.String,runResults:$o.Array(RG1),runID:$o.Number,environmentID:$o.String,snowflakeAccount:$o.String.optional(),snowflakeWarehouse:$o.String.optional(),jobID:$o.Number.optional(),hasFailedTest:$o.Boolean.optional(),runTimeParameters:$o.Unknown.nullable(),includeNodesSelector:$o.String.optional(),excludeNodesSelector:$o.String.optional()})}),WOr=xM("TRunOutput",OG1)});var R3C,Ayl=V(()=>{"use strict";Ao();wEr();R3C=tXe(NLo)});var YBe,KOr=V(()=>{"use strict";ka();z3();ar();YBe=class{constructor(t,n,i,o){this.allNodes=t;this.renderResults=n;this.extraRefs=i;this.logContext=o;this.phasedRefUsage=n.map("phased ref usage",s=>s.map(a=>a.runDetails.ref_usage))}allNodes;renderResults;extraRefs;logContext;phasedRefUsage;buildPhase(t,n){let i="[DependencyBuilder.buildPhase()]",o=n.keys(),s=Object.keys(this.extraRefs),a=[...new Set([...o,...s])];if($e("PIPELINE").appContext(this.logContext,i,"Nodes present in both current-phase data AND extra non-phased (views & advanced deploy) data:",USo([...o],s)),this.noDependenciesPhases.includes(t))return Object.fromEntries(a.map(u=>[u,[]]));{let u=this.getNodeRefsInPhase(t,a),p=new gBe(CC(this.allNodes,a));return tT(u,(c,l)=>{let{nodeIDsToAdd:d}=$et(c,p);return[...new Set(d)].filter(f=>f!==l)})}}build(){return Object.fromEntries([...this.phasedRefUsage.entries()].map(([t,n])=>[t,this.buildPhase(t,n)]))}}});var L3C,w$o=V(()=>{"use strict";pr();ar();Ac();L3C=$e("DEBUG")});var myl=V(()=>{"use strict"});var YOr,x$o=V(()=>{"use strict";YOr=r=>{typeof r.stepCounter=="number"&&(r.stepCounter=`${r.stepCounter}`),typeof r.columnCounter=="number"&&(r.columnCounter=`${r.columnCounter}`)}});var KCe,ea,M$o=V(()=>{"use strict";Ns();OU();KCe=new Date("1980-01-01T00:00:00.000Z"),ea=(r,t,n)=>{let i=`${r}Entity`;return n||(n=oa(t)),{standard:Pr(i,n),strict:Pr(`${i} (strict)`,t)}}});var yyl,xG1,byl,JBe,$Nt,P$o,N$o,$u,D$o,L_,B$o=V(()=>{"use strict";ry();M$o();Lde();yyl=r=>{if(Array.isArray(r))for(let t=r.length-1;t>=0;t--)r[t]===void 0&&r.splice(t,1);if(r&&typeof r=="object")for(let t in r)r.hasOwnProperty(t)&&r[t]===void 0&&delete r[t];return[r,!1]},xG1=(r,t)=>{if(r&&typeof r=="object"){let n=r;if(n.toDate&&(!isNaN(n.seconds)&&!isNaN(n.nanoseconds)||!isNaN(n._seconds)&&!isNaN(n._nanoseconds))){let i=n.toDate();return i.getTime()===Nde.SENTINEL_DATE&&Gl().emerg(`Repository server timestamp sentinel value found in stored data at path ${t}`),[i,!0]}}return[r,!1]},byl=(r,t)=>r instanceof K6e?[t.getDeleteSentinel(),!0]:r instanceof Date&&r.getTime()===Nde.SENTINEL_DATE?[t.getServerTimestampSentinel(),!0]:[r,!1],JBe=(r,t,n)=>{let[i,o]=t(n,r);if(!o&&typeof i=="object"){if(Array.isArray(i))return i.map(s=>JBe(r,t,s));for(let s in i)i.hasOwnProperty(s)&&(i[s]=JBe(r,t,i[s]))}return i},$Nt=class{fromStorage(t,n,i,o,s){try{return this.transformFromStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Gl().debug(`Error transforming repository entity ${n} from storage: ${a}`),a}return i}toStorage(t,n,i,o,s){try{return this.transformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Gl().debug(`Error transforming repository entity ${n} to storage ${a}`),a}return i}mergeToStorage(t,n,i,o,s){try{return this.mergeTransformToStorage(t,n,i,o,s)}catch(a){if(s?.onDataTransformError&&s.onDataTransformError(n,a),!s?.ignoreDataTransformErrors)throw Gl().debug(`Error merge transforming repository entity ${n} to storage ${a}`),a}return i}},P$o=class extends $Nt{constructor(n=!1){super();this.preserveID=n}preserveID;transformFromStorage(n,i,o){return"id"in o?o.id!=n&&(Gl().error(`'id' property does not match doc id on doc at path ${i}; doc id: ${n}, value.id: ${o.id}`),o.id=n):o.id=n,"createdAt"in o||(o.createdAt=KCe),"updatedAt"in o||(o.updatedAt=KCe),JBe(i,xG1,o)}transformToStorage(n,i,o,s){return this.preserveID||delete o.id,JBe(i,a=>{let[u,p]=byl(a,s);return p?[u,!0]:yyl(u)},o)}mergeTransformToStorage(n,i,o,s){return this.preserveID||delete o.id,JBe(i,a=>{let[u,p]=byl(a,s);return p?[u,!0]:yyl(u)},o)}},N$o=class extends $Nt{constructor(n){super();this.validators=n}validators;transformFromStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}transformToStorage(n,i,o,s,a){let u=this.getValidatorOptions(n,a?.validatorOptions);return a?.enableStrictValidation?this.validators.strict.assert(o,u):this.validators.standard.assert(o,u)}mergeTransformToStorage(n,i,o,s,a){return o}getValidatorOptions(n,i,o=500){let s={...i,statusCode:o};return s.errorMessage||(s.errorMessage=a=>`Found ${a.failures.length} validation failure(s) for ${this.validators.standard.name} ${n}`),s}},$u=(r,t,n)=>{let i=[new P$o(n),new N$o(r)];return t&&i.unshift(t),new D$o(...i)},D$o=class{transforms;constructor(...t){this.transforms=t}fromStorage(t,n,i,o,s){return this.transforms.reduce((a,u)=>u.fromStorage(t,n,a,o,s),i)}toStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.toStorage(t,n,a,o,s),i)}mergeToStorage(t,n,i,o,s){return this.transforms.reduceRight((a,u)=>u.mergeToStorage(t,n,a,o,s),i)}},L_=class extends $Nt{transformToStorage(t,n,i){return i}mergeTransformToStorage(t,n,i){return i}}});var Of=V(()=>{"use strict";B$o()});var Eyl,brt,CW,L$o,XNt,hz,YCe,q$o,MG1,PG1,Cyl,k$o,JOr,Syl=V(()=>{"use strict";Ao();ar();Of();x$o();Eyl=r=>!!r&&typeof r=="object"&&!Array.isArray(r),brt=r=>Eyl(r)&&!(r instanceof Date)&&!(r instanceof RegExp),CW=r=>{if(typeof r=="string")return r;if(Eyl(r)&&r.constructor&&typeof r.constructor.name=="string")return`[class ${r.constructor.name}]`;if(r instanceof Date)return`[date ${r.toISOString()}]`;if(r instanceof RegExp)return`[regexp ${r.toString()}]`;if(typeof r=="function")return`[function ${r.name}]`;try{return JSON.stringify(r)}catch{return"Error: could not stringify unknown value"}},L$o=r=>r==null,XNt=(r,t,n,i)=>{t.filter((o,s)=>brt(o)?!0:(n.logError(`Invalid ${r} item detected at index ${s}: ${CW(o)}`),n.logPatch(`Removed invalid ${r} item at index ${s}`),!1)).forEach(i)},hz=(r,t,n)=>{r[t]=n},YCe=(r,t)=>{delete r[t]},q$o=(r,t,n)=>{let i=new k$o(r,$e("FIREBASE"),t),{logError:o,logPatch:s,report:a}=i,u=()=>(a(),n);if(!brt(n))return u();let p=n;if([["locationName",!p.locationName&&typeof p.locationName!="string"||typeof p.locationName!="string"],["description",typeof p.description!="string"]].forEach(([c,l])=>{l&&(s(`Set non-string property ${c} from ${CW(p[c])} to ""`),hz(p,c,""))}),["dependencies","isDataVault","locationID"].forEach(c=>{c in p&&(s(`Removed deprecated field ${c}`),YCe(p,c))}),p.type==="sql")s("-- data.type is sql --"),MG1(r,p,i);else if(p.type==="sourceInput")s("-- data.type is sourceInput --"),PG1(r,p,i);else return o(`Data type is of invalid type ${CW(p.type)}`),u();return p.version!==PZ&&(s(`Set version ${CW(p.version)} to ${PZ}`),hz(p,"version",PZ)),u()},MG1=(r,t,n)=>{let{logError:i,logPatch:o}=n;if(t.isMultisource===void 0&&(o("Set missing isMultisource to false"),hz(t,"isMultisource",!1)),brt(t.metadata)){let s=t.metadata;if(s.appliedNodeTests===null&&(o("Set metadata.appliedNodeTests from null to []"),hz(s,"appliedNodeTests",[])),!Array.isArray(s.sourceMapping)||!s.sourceMapping.length){o("Set non-array or empty metadata.sourceMapping to [ basicMapping ]");let a;typeof t.name=="string"?a=t.name:(o("Data has no name value, setting sourceMapping.name to empty string"),a=""),hz(s,"sourceMapping",[{name:a,join:{joinCondition:""},dependencies:[],noLinkRefs:[],aliases:{}}])}else XNt("sourceMapping",s.sourceMapping,n,(a,u)=>{let p=a;if(typeof p.join=="string"){let c={joinCondition:""};o(`Setting invalid string value metadata.sourceMapping[${u}].join to object: ${CW(c)}`),hz(p,"join",c)}if(p.name===void 0){let c=p.join?.name??"";o(`Set missing metadata.sourceMapping[${u}].name to "${c}"`),hz(p,"name",c),c||i(`metadata.sourceMapping[${u}].name is an empty string`)}Array.isArray(p.dependencies)&&XNt("sourceMapping dependency",p.dependencies,n,(c,l)=>{let d=c;for(let f of["locationName","nodeName"])L$o(d[f])&&(o(`Set metadata.sourceMapping[${u}].dependencies[${l}].${f} from ${CW(d[f])} to ""`),hz(d,f,""))})});Cyl(r,s.columns,n)}if(t.config&&typeof t.config=="object")for(let[s,a]of Object.entries(t.config))a===null&&(o(`Removing null config property "${s}"`),YCe(t.config,s))},PG1=(r,t,n)=>{let{logPatch:i,logError:o}=n;if(t.dataset!==void 0&&(i("Removed deprecated v0 property dataset"),YCe(t,"dataset")),t.table!==void 0&&(t.table!==t.name&&o(`source data properties 'table' and 'name' are different for source node ${r}, table: ${t.table}, name: ${t.name}`),i("Removed deprecated v0 property table"),YCe(t,"table")),brt(t.metadata)){let s=t.metadata;Array.isArray(s.columns)&&(s.columns.length&&Cyl(r,s.columns,n),Object.keys(s).length>1&&(i(`Removed deprecated metadata properties, keeping only columns. Was: ${CW(s)}`),hz(t,"metadata",{columns:s.columns})))}},Cyl=(r,t,n)=>{let{logPatch:i}=n;Array.isArray(t)&&XNt("column",t,n,(o,s)=>{let a=o;if(["ghostRecordValue","descendedFrom","hashColumns","columnsForHash"].forEach(c=>{a.hasOwnProperty(c)&&(i(`Removed deprecated property '${c}' from metadata.columns[${s}]`),YCe(a,c))}),brt(a.hashDetails)){let c=a.hashDetails;c.hashType&&(i(`Removed deprecated property 'hashType' from metadata.columns[${s}].hashDetails`),YCe(c,"hashType")),c.hubHashes&&(i(`Removed deprecated property 'hubHashes' from metadata.columns[${s}].hashDetails`),YCe(c,"hubHashes"))}[["appliedColumnTests",a.appliedColumnTests===null],["config",a.config===null],["hashDetails",typeof a.hashDetails=="string"]].forEach(([c,l])=>{l&&(i(`Deleted metadata.columns[${s}].${c} with invalid value ${CW(a[c])}`),YCe(a,c))}),[["dataType",typeof a.dataType!="string"],["transform",a.transform===null]].forEach(([c,l])=>{l&&(i(`Set ${c} from ${CW(a[c])} to "" in metadata.columns[${s}]`),hz(a,c,""))});let u=a.hashedColumns;if(Array.isArray(u))for(let c of u)YOr(c);let p=a.columnReference;if(brt(p)){YOr(p);let c=p;L$o(c.stepCounter)&&(i(`Set metadata.columns[${s}].columnReference.stepCounter from ${CW(c.stepCounter)} to ${r}`),hz(c,"stepCounter",r))}Array.isArray(a.sourceColumnReferences)&&XNt("sourceColumnReference",a.sourceColumnReferences,n,(c,l)=>{let d=c;Array.isArray(d.columnReferences)&&XNt("columnReference",d.columnReferences,n,(f,h)=>{YOr(f);let A=f;L$o(A.stepCounter)&&(i(`Set invalid metadata.columns[${s}].sourceColumnReferences[${l}].columnReferences[${h}].stepCounter to "" from ${CW(r)}`),hz(A,"stepCounter",""))})})})},k$o=class{constructor(t,n,i){this.id=t;this.logger=n;this.path=i}id;logger;path;patchMessages=[];errorMessages=[];logPatch=t=>{this.patchMessages.push(t)};logError=t=>{this.errorMessages.push(t)};reportErrors=()=>{this.errorMessages.length&&this.logger.error(`Error patching node data with id ${this.id} at path ${this.path}`,this.errorMessages)};reportPatches=()=>{this.patchMessages.length&&this.logger.debug(`Patched node data with id ${this.id} at path ${this.path}`,this.patchMessages)};report=()=>{this.reportErrors(),this.reportPatches()}},JOr=class extends L_{transformFromStorage(t,n,i){return q$o(t,n,i)}}});var ZNt=V(()=>{"use strict";myl();x$o();Syl()});var vyl=V(()=>{"use strict"});var IIC,_IC,RIC,Tyl,Iyl,_yl,JCe=V(()=>{"use strict";pr();hb();ar();w$o();Yet();Yo();ar();M2();hee();ZNt();hCe();hVo();vyl();R6();I6();aN();Gde();IIC=$e("FIREBASE"),_IC=$e("STEPS"),RIC=$e("METADATA_OPERATIONS"),Tyl=(r,t)=>t[r].runState==="running",Iyl=r=>(uy("STEPS",!!r,`Error converting API refs: argument apiRefLinks is ${r}.`),r.map(t=>({locationName:t.location_name,nodeName:t.node_name}))),_yl=r=>r?.deployEnabled??!0});var $Be,Ryl=V(()=>{"use strict";JCe();KOr();$Be=class extends YBe{noDependenciesPhases=["deletedTable"];getNodeRefsInPhase(t,n){return Object.fromEntries(n.map(i=>{let o,s=this.extraRefs[i];s?o=[s]:o=this.phasedRefUsage.get(t,i);let a=o.map(({ref:u,ref_no_link:p})=>Iyl([...u,...p]));return[i,[].concat(...a)]}))}}});var eDt,Oyl=V(()=>{"use strict";ka();p9();KOr();eDt=class extends YBe{noDependenciesPhases=[];getNodeRefsInPhase(t,n){let i=CC(this.allNodes,...n);return tT(i,o=>{if(mCe(o.operation))return[];let{sourceMapping:s}=o.operation.metadata;if(!s?.length)return[];let a=s.map(({dependencies:u})=>u);return[].concat(...a)})}}});var F$o=V(()=>{"use strict";KOr();Ryl();Oyl()});var wyl=V(()=>{"use strict"});var tDt,xyl=V(()=>{"use strict";EX();ry();tDt=async(r,t)=>{let{attempts:n,tags:i,waitSeconds:o}=t,s=Gl().child({retryOptions:{maxAttempts:n,waitSeconds:o},tags:["[withRetries]",...i]});E2(n>=2,`Retry attempts value must be at least '2', but was '${n}'`,s);try{let a=await r();return s.debug("Operation succeeded without retrying"),a}catch(a){s.error(`Operation initial attempt failed; retrying. Error: ${a}`);let u,p=n-1;do{p--,await new Promise(c=>setTimeout(c,o*(n-p)*1e3));try{let c=await r();return s.info(`Operation succeeded on retry (attempt ${n-p})`),c}catch(c){s.error(`Operation failed on retry (attempt ${n-p}). Error: ${c}`),u=c}}while(p);throw s.error("Exhausted all retry attempts; exiting"),u}}});var U$o=V(()=>{"use strict";wyl();xyl()});function Ert(r,t){let n=[];for(let i of r){let o=i.compiledSQL?itt(i.compiledSQL):[];if(o.length===0)t&&n.push({name:t,sql:"",type:"sql",continueOnFailure:!1,parsedStage:null});else for(let s of o)n.push({name:s.name,sql:s.code,type:s.type,continueOnFailure:s.continueOnFailure,parsedStage:s})}return n}function $Or(r,t){return r==="deletedTable"&&t?Myl:LG1}var LG1,Myl,rDt=V(()=>{"use strict";M2();LG1="Making metadata updates",Myl="Deleting metadata for source input"});var SW,nDt=V(()=>{"use strict";pr();SW=class extends rt{constructor(n,i,o="system"){super(i,`Failed node ${n}: ${i}`);this.nodeID=n;this.fault=o}nodeID;fault}});var iDt=m((JIC,Pyl)=>{var kG1="2.0.0",qG1=Number.MAX_SAFE_INTEGER||9007199254740991,FG1=16,UG1=250,zG1=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Pyl.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:FG1,MAX_SAFE_BUILD_LENGTH:UG1,MAX_SAFE_INTEGER:qG1,RELEASE_TYPES:zG1,SEMVER_SPEC_VERSION:kG1,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var oDt=m(($IC,Nyl)=>{var QG1=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};Nyl.exports=QG1});var Crt=m((y0e,Dyl)=>{var{MAX_SAFE_COMPONENT_LENGTH:z$o,MAX_SAFE_BUILD_LENGTH:jG1,MAX_LENGTH:GG1}=iDt(),HG1=oDt();y0e=Dyl.exports={};var VG1=y0e.re=[],WG1=y0e.safeRe=[],_a=y0e.src=[],Ra=y0e.t={},KG1=0,Q$o="[a-zA-Z0-9-]",YG1=[["\\s",1],["\\d",GG1],[Q$o,jG1]],JG1=r=>{for(let[t,n]of YG1)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},od=(r,t,n)=>{let i=JG1(t),o=KG1++;HG1(r,o,t),Ra[r]=o,_a[o]=t,VG1[o]=new RegExp(t,n?"g":void 0),WG1[o]=new RegExp(i,n?"g":void 0)};od("NUMERICIDENTIFIER","0|[1-9]\\d*");od("NUMERICIDENTIFIERLOOSE","\\d+");od("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Q$o}*`);od("MAINVERSION",`(${_a[Ra.NUMERICIDENTIFIER]})\\.(${_a[Ra.NUMERICIDENTIFIER]})\\.(${_a[Ra.NUMERICIDENTIFIER]})`);od("MAINVERSIONLOOSE",`(${_a[Ra.NUMERICIDENTIFIERLOOSE]})\\.(${_a[Ra.NUMERICIDENTIFIERLOOSE]})\\.(${_a[Ra.NUMERICIDENTIFIERLOOSE]})`);od("PRERELEASEIDENTIFIER",`(?:${_a[Ra.NUMERICIDENTIFIER]}|${_a[Ra.NONNUMERICIDENTIFIER]})`);od("PRERELEASEIDENTIFIERLOOSE",`(?:${_a[Ra.NUMERICIDENTIFIERLOOSE]}|${_a[Ra.NONNUMERICIDENTIFIER]})`);od("PRERELEASE",`(?:-(${_a[Ra.PRERELEASEIDENTIFIER]}(?:\\.${_a[Ra.PRERELEASEIDENTIFIER]})*))`);od("PRERELEASELOOSE",`(?:-?(${_a[Ra.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${_a[Ra.PRERELEASEIDENTIFIERLOOSE]})*))`);od("BUILDIDENTIFIER",`${Q$o}+`);od("BUILD",`(?:\\+(${_a[Ra.BUILDIDENTIFIER]}(?:\\.${_a[Ra.BUILDIDENTIFIER]})*))`);od("FULLPLAIN",`v?${_a[Ra.MAINVERSION]}${_a[Ra.PRERELEASE]}?${_a[Ra.BUILD]}?`);od("FULL",`^${_a[Ra.FULLPLAIN]}$`);od("LOOSEPLAIN",`[v=\\s]*${_a[Ra.MAINVERSIONLOOSE]}${_a[Ra.PRERELEASELOOSE]}?${_a[Ra.BUILD]}?`);od("LOOSE",`^${_a[Ra.LOOSEPLAIN]}$`);od("GTLT","((?:<|>)?=?)");od("XRANGEIDENTIFIERLOOSE",`${_a[Ra.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);od("XRANGEIDENTIFIER",`${_a[Ra.NUMERICIDENTIFIER]}|x|X|\\*`);od("XRANGEPLAIN",`[v=\\s]*(${_a[Ra.XRANGEIDENTIFIER]})(?:\\.(${_a[Ra.XRANGEIDENTIFIER]})(?:\\.(${_a[Ra.XRANGEIDENTIFIER]})(?:${_a[Ra.PRERELEASE]})?${_a[Ra.BUILD]}?)?)?`);od("XRANGEPLAINLOOSE",`[v=\\s]*(${_a[Ra.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[Ra.XRANGEIDENTIFIERLOOSE]})(?:\\.(${_a[Ra.XRANGEIDENTIFIERLOOSE]})(?:${_a[Ra.PRERELEASELOOSE]})?${_a[Ra.BUILD]}?)?)?`);od("XRANGE",`^${_a[Ra.GTLT]}\\s*${_a[Ra.XRANGEPLAIN]}$`);od("XRANGELOOSE",`^${_a[Ra.GTLT]}\\s*${_a[Ra.XRANGEPLAINLOOSE]}$`);od("COERCE",`(^|[^\\d])(\\d{1,${z$o}})(?:\\.(\\d{1,${z$o}}))?(?:\\.(\\d{1,${z$o}}))?(?:$|[^\\d])`);od("COERCERTL",_a[Ra.COERCE],!0);od("LONETILDE","(?:~>?)");od("TILDETRIM",`(\\s*)${_a[Ra.LONETILDE]}\\s+`,!0);y0e.tildeTrimReplace="$1~";od("TILDE",`^${_a[Ra.LONETILDE]}${_a[Ra.XRANGEPLAIN]}$`);od("TILDELOOSE",`^${_a[Ra.LONETILDE]}${_a[Ra.XRANGEPLAINLOOSE]}$`);od("LONECARET","(?:\\^)");od("CARETTRIM",`(\\s*)${_a[Ra.LONECARET]}\\s+`,!0);y0e.caretTrimReplace="$1^";od("CARET",`^${_a[Ra.LONECARET]}${_a[Ra.XRANGEPLAIN]}$`);od("CARETLOOSE",`^${_a[Ra.LONECARET]}${_a[Ra.XRANGEPLAINLOOSE]}$`);od("COMPARATORLOOSE",`^${_a[Ra.GTLT]}\\s*(${_a[Ra.LOOSEPLAIN]})$|^$`);od("COMPARATOR",`^${_a[Ra.GTLT]}\\s*(${_a[Ra.FULLPLAIN]})$|^$`);od("COMPARATORTRIM",`(\\s*)${_a[Ra.GTLT]}\\s*(${_a[Ra.LOOSEPLAIN]}|${_a[Ra.XRANGEPLAIN]})`,!0);y0e.comparatorTrimReplace="$1$2$3";od("HYPHENRANGE",`^\\s*(${_a[Ra.XRANGEPLAIN]})\\s+-\\s+(${_a[Ra.XRANGEPLAIN]})\\s*$`);od("HYPHENRANGELOOSE",`^\\s*(${_a[Ra.XRANGEPLAINLOOSE]})\\s+-\\s+(${_a[Ra.XRANGEPLAINLOOSE]})\\s*$`);od("STAR","(<|>)?=?\\s*\\*");od("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");od("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var XOr=m((XIC,Byl)=>{var $G1=Object.freeze({loose:!0}),XG1=Object.freeze({}),ZG1=r=>r?typeof r!="object"?$G1:r:XG1;Byl.exports=ZG1});var j$o=m((ZIC,qyl)=>{var Lyl=/^[0-9]+$/,kyl=(r,t)=>{let n=Lyl.test(r),i=Lyl.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},eH1=(r,t)=>kyl(t,r);qyl.exports={compareIdentifiers:kyl,rcompareIdentifiers:eH1}});var KM=m((e_C,Qyl)=>{var ZOr=oDt(),{MAX_LENGTH:Fyl,MAX_SAFE_INTEGER:ewr}=iDt(),{safeRe:Uyl,t:zyl}=Crt(),tH1=XOr(),{compareIdentifiers:Srt}=j$o(),G$o=class r{constructor(t,n){if(n=tH1(n),t instanceof r){if(t.loose===!!n.loose&&t.includePrerelease===!!n.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>Fyl)throw new TypeError(`version is longer than ${Fyl} characters`);ZOr("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?Uyl[zyl.LOOSE]:Uyl[zyl.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>ewr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ewr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ewr||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<ewr)return s}return o}):this.prerelease=[],this.build=i[5]?i[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(ZOr("SemVer.compare",this.version,this.options,t),!(t instanceof r)){if(typeof t=="string"&&t===this.version)return 0;t=new r(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof r||(t=new r(t,this.options)),Srt(this.major,t.major)||Srt(this.minor,t.minor)||Srt(this.patch,t.patch)}comparePre(t){if(t instanceof r||(t=new r(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 n=0;do{let i=this.prerelease[n],o=t.prerelease[n];if(ZOr("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return Srt(i,o)}while(++n)}compareBuild(t){t instanceof r||(t=new r(t,this.options));let n=0;do{let i=this.build[n],o=t.build[n];if(ZOr("prerelease compare",n,i,o),i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(i===o)continue;return Srt(i,o)}while(++n)}inc(t,n,i){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",n,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",n,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",n,i),this.inc("pre",n,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",n,i),this.inc("pre",n,i);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":{let o=Number(i)?1:0;if(!n&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(n===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(n){let s=[n,o];i===!1&&(s=[n]),Srt(this.prerelease[0],n)===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}};Qyl.exports=G$o});var XBe=m((t_C,Gyl)=>{var jyl=KM(),rH1=(r,t,n=!1)=>{if(r instanceof jyl)return r;try{return new jyl(r,t)}catch(i){if(!n)return null;throw i}};Gyl.exports=rH1});var Vyl=m((r_C,Hyl)=>{var nH1=XBe(),iH1=(r,t)=>{let n=nH1(r,t);return n?n.version:null};Hyl.exports=iH1});var Kyl=m((n_C,Wyl)=>{var oH1=XBe(),sH1=(r,t)=>{let n=oH1(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};Wyl.exports=sH1});var $yl=m((i_C,Jyl)=>{var Yyl=KM(),aH1=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new Yyl(r instanceof Yyl?r.version:r,n).inc(t,i,o).version}catch{return null}};Jyl.exports=aH1});var ebl=m((o_C,Zyl)=>{var Xyl=XBe(),uH1=(r,t)=>{let n=Xyl(r,null,!0),i=Xyl(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,u=s?i:n,p=!!a.prerelease.length;if(!!u.prerelease.length&&!p)return!u.patch&&!u.minor?"major":a.patch?"patch":a.minor?"minor":"major";let l=p?"pre":"";return n.major!==i.major?l+"major":n.minor!==i.minor?l+"minor":n.patch!==i.patch?l+"patch":"prerelease"};Zyl.exports=uH1});var rbl=m((s_C,tbl)=>{var cH1=KM(),lH1=(r,t)=>new cH1(r,t).major;tbl.exports=lH1});var ibl=m((a_C,nbl)=>{var pH1=KM(),dH1=(r,t)=>new pH1(r,t).minor;nbl.exports=dH1});var sbl=m((u_C,obl)=>{var fH1=KM(),hH1=(r,t)=>new fH1(r,t).patch;obl.exports=hH1});var ubl=m((c_C,abl)=>{var gH1=XBe(),AH1=(r,t)=>{let n=gH1(r,t);return n&&n.prerelease.length?n.prerelease:null};abl.exports=AH1});var gz=m((l_C,lbl)=>{var cbl=KM(),mH1=(r,t,n)=>new cbl(r,n).compare(new cbl(t,n));lbl.exports=mH1});var dbl=m((p_C,pbl)=>{var yH1=gz(),bH1=(r,t,n)=>yH1(t,r,n);pbl.exports=bH1});var hbl=m((d_C,fbl)=>{var EH1=gz(),CH1=(r,t)=>EH1(r,t,!0);fbl.exports=CH1});var twr=m((f_C,Abl)=>{var gbl=KM(),SH1=(r,t,n)=>{let i=new gbl(r,n),o=new gbl(t,n);return i.compare(o)||i.compareBuild(o)};Abl.exports=SH1});var ybl=m((h_C,mbl)=>{var vH1=twr(),TH1=(r,t)=>r.sort((n,i)=>vH1(n,i,t));mbl.exports=TH1});var Ebl=m((g_C,bbl)=>{var IH1=twr(),_H1=(r,t)=>r.sort((n,i)=>IH1(i,n,t));bbl.exports=_H1});var sDt=m((A_C,Cbl)=>{var RH1=gz(),OH1=(r,t,n)=>RH1(r,t,n)>0;Cbl.exports=OH1});var rwr=m((m_C,Sbl)=>{var wH1=gz(),xH1=(r,t,n)=>wH1(r,t,n)<0;Sbl.exports=xH1});var H$o=m((y_C,vbl)=>{var MH1=gz(),PH1=(r,t,n)=>MH1(r,t,n)===0;vbl.exports=PH1});var V$o=m((b_C,Tbl)=>{var NH1=gz(),DH1=(r,t,n)=>NH1(r,t,n)!==0;Tbl.exports=DH1});var nwr=m((E_C,Ibl)=>{var BH1=gz(),LH1=(r,t,n)=>BH1(r,t,n)>=0;Ibl.exports=LH1});var iwr=m((C_C,_bl)=>{var kH1=gz(),qH1=(r,t,n)=>kH1(r,t,n)<=0;_bl.exports=qH1});var W$o=m((S_C,Rbl)=>{var FH1=H$o(),UH1=V$o(),zH1=sDt(),QH1=nwr(),jH1=rwr(),GH1=iwr(),HH1=(r,t,n,i)=>{switch(t){case"===":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r===n;case"!==":return typeof r=="object"&&(r=r.version),typeof n=="object"&&(n=n.version),r!==n;case"":case"=":case"==":return FH1(r,n,i);case"!=":return UH1(r,n,i);case">":return zH1(r,n,i);case">=":return QH1(r,n,i);case"<":return jH1(r,n,i);case"<=":return GH1(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};Rbl.exports=HH1});var wbl=m((v_C,Obl)=>{var VH1=KM(),WH1=XBe(),{safeRe:owr,t:swr}=Crt(),KH1=(r,t)=>{if(r instanceof VH1)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;t=t||{};let n=null;if(!t.rtl)n=r.match(owr[swr.COERCE]);else{let i;for(;(i=owr[swr.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),owr[swr.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;owr[swr.COERCERTL].lastIndex=-1}return n===null?null:WH1(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};Obl.exports=KH1});var Mbl=m((T_C,xbl)=>{"use strict";xbl.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var K$o=m((I_C,Pbl)=>{"use strict";Pbl.exports=h1;h1.Node=ZBe;h1.create=h1;function h1(r){var t=this;if(t instanceof h1||(t=new h1),t.tail=null,t.head=null,t.length=0,r&&typeof r.forEach=="function")r.forEach(function(o){t.push(o)});else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}h1.prototype.removeNode=function(r){if(r.list!==this)throw new Error("removing node which does not belong to this list");var t=r.next,n=r.prev;return t&&(t.prev=n),n&&(n.next=t),r===this.head&&(this.head=t),r===this.tail&&(this.tail=n),r.list.length--,r.next=null,r.prev=null,r.list=null,t};h1.prototype.unshiftNode=function(r){if(r!==this.head){r.list&&r.list.removeNode(r);var t=this.head;r.list=this,r.next=t,t&&(t.prev=r),this.head=r,this.tail||(this.tail=r),this.length++}};h1.prototype.pushNode=function(r){if(r!==this.tail){r.list&&r.list.removeNode(r);var t=this.tail;r.list=this,r.prev=t,t&&(t.next=r),this.tail=r,this.head||(this.head=r),this.length++}};h1.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)JH1(this,arguments[r]);return this.length};h1.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)$H1(this,arguments[r]);return this.length};h1.prototype.pop=function(){if(this.tail){var r=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,r}};h1.prototype.shift=function(){if(this.head){var r=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,r}};h1.prototype.forEach=function(r,t){t=t||this;for(var n=this.head,i=0;n!==null;i++)r.call(t,n.value,i,this),n=n.next};h1.prototype.forEachReverse=function(r,t){t=t||this;for(var n=this.tail,i=this.length-1;n!==null;i--)r.call(t,n.value,i,this),n=n.prev};h1.prototype.get=function(r){for(var t=0,n=this.head;n!==null&&t<r;t++)n=n.next;if(t===r&&n!==null)return n.value};h1.prototype.getReverse=function(r){for(var t=0,n=this.tail;n!==null&&t<r;t++)n=n.prev;if(t===r&&n!==null)return n.value};h1.prototype.map=function(r,t){t=t||this;for(var n=new h1,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};h1.prototype.mapReverse=function(r,t){t=t||this;for(var n=new h1,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};h1.prototype.reduce=function(r,t){var n,i=this.head;if(arguments.length>1)n=t;else if(this.head)i=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;i!==null;o++)n=r(n,i.value,o),i=i.next;return n};h1.prototype.reduceReverse=function(r,t){var n,i=this.tail;if(arguments.length>1)n=t;else if(this.tail)i=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;i!==null;o--)n=r(n,i.value,o),i=i.prev;return n};h1.prototype.toArray=function(){for(var r=new Array(this.length),t=0,n=this.head;n!==null;t++)r[t]=n.value,n=n.next;return r};h1.prototype.toArrayReverse=function(){for(var r=new Array(this.length),t=0,n=this.tail;n!==null;t++)r[t]=n.value,n=n.prev;return r};h1.prototype.slice=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new h1;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(;o!==null&&i<t;i++,o=o.next)n.push(o.value);return n};h1.prototype.sliceReverse=function(r,t){t=t||this.length,t<0&&(t+=this.length),r=r||0,r<0&&(r+=this.length);var n=new h1;if(t<r||t<0)return n;r<0&&(r=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;o!==null&&i>t;i--)o=o.prev;for(;o!==null&&i>r;i--,o=o.prev)n.push(o.value);return n};h1.prototype.splice=function(r,t,...n){r>this.length&&(r=this.length-1),r<0&&(r=this.length+r);for(var i=0,o=this.head;o!==null&&i<r;i++)o=o.next;for(var s=[],i=0;o&&i<t;i++)s.push(o.value),o=this.removeNode(o);o===null&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(var i=0;i<n.length;i++)o=YH1(this,o,n[i]);return s};h1.prototype.reverse=function(){for(var r=this.head,t=this.tail,n=r;n!==null;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=t,this.tail=r,this};function YH1(r,t,n){var i=t===r.head?new ZBe(n,null,t,r):new ZBe(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function JH1(r,t){r.tail=new ZBe(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function $H1(r,t){r.head=new ZBe(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function ZBe(r,t,n,i){if(!(this instanceof ZBe))return new ZBe(r,t,n,i);this.list=i,this.value=r,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{Mbl()(h1)}catch{}});var cDt=m((__C,Lbl)=>{"use strict";var XH1=K$o(),e8e=Symbol("max"),E0e=Symbol("length"),vrt=Symbol("lengthCalculator"),uDt=Symbol("allowStale"),t8e=Symbol("maxAge"),b0e=Symbol("dispose"),Nbl=Symbol("noDisposeOnSet"),k_=Symbol("lruList"),vW=Symbol("cache"),Bbl=Symbol("updateAgeOnGet"),Y$o=()=>1,$$o=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");let n=this[e8e]=t.max||1/0,i=t.length||Y$o;if(this[vrt]=typeof i!="function"?Y$o:i,this[uDt]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[t8e]=t.maxAge||0,this[b0e]=t.dispose,this[Nbl]=t.noDisposeOnSet||!1,this[Bbl]=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[e8e]=t||1/0,aDt(this)}get max(){return this[e8e]}set allowStale(t){this[uDt]=!!t}get allowStale(){return this[uDt]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[t8e]=t,aDt(this)}get maxAge(){return this[t8e]}set lengthCalculator(t){typeof t!="function"&&(t=Y$o),t!==this[vrt]&&(this[vrt]=t,this[E0e]=0,this[k_].forEach(n=>{n.length=this[vrt](n.value,n.key),this[E0e]+=n.length})),aDt(this)}get lengthCalculator(){return this[vrt]}get length(){return this[E0e]}get itemCount(){return this[k_].length}rforEach(t,n){n=n||this;for(let i=this[k_].tail;i!==null;){let o=i.prev;Dbl(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[k_].head;i!==null;){let o=i.next;Dbl(this,t,i,n),i=o}}keys(){return this[k_].toArray().map(t=>t.key)}values(){return this[k_].toArray().map(t=>t.value)}reset(){this[b0e]&&this[k_]&&this[k_].length&&this[k_].forEach(t=>this[b0e](t.key,t.value)),this[vW]=new Map,this[k_]=new XH1,this[E0e]=0}dump(){return this[k_].map(t=>awr(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,n,i){if(i=i||this[t8e],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[vrt](n,t);if(this[vW].has(t)){if(s>this[e8e])return Trt(this,this[vW].get(t)),!1;let p=this[vW].get(t).value;return this[b0e]&&(this[Nbl]||this[b0e](t,p.value)),p.now=o,p.maxAge=i,p.value=n,this[E0e]+=s-p.length,p.length=s,this.get(t),aDt(this),!0}let a=new X$o(t,n,s,o,i);return a.length>this[e8e]?(this[b0e]&&this[b0e](t,n),!1):(this[E0e]+=a.length,this[k_].unshift(a),this[vW].set(t,this[k_].head),aDt(this),!0)}has(t){if(!this[vW].has(t))return!1;let n=this[vW].get(t).value;return!awr(this,n)}get(t){return J$o(this,t,!0)}peek(t){return J$o(this,t,!1)}pop(){let t=this[k_].tail;return t?(Trt(this,t),t.value):null}del(t){Trt(this,this[vW].get(t))}load(t){this.reset();let n=Date.now();for(let i=t.length-1;i>=0;i--){let o=t[i],s=o.e||0;if(s===0)this.set(o.k,o.v);else{let a=s-n;a>0&&this.set(o.k,o.v,a)}}}prune(){this[vW].forEach((t,n)=>J$o(this,n,!1))}},J$o=(r,t,n)=>{let i=r[vW].get(t);if(i){let o=i.value;if(awr(r,o)){if(Trt(r,i),!r[uDt])return}else n&&(r[Bbl]&&(i.value.now=Date.now()),r[k_].unshiftNode(i));return o.value}},awr=(r,t)=>{if(!t||!t.maxAge&&!r[t8e])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[t8e]&&n>r[t8e]},aDt=r=>{if(r[E0e]>r[e8e])for(let t=r[k_].tail;r[E0e]>r[e8e]&&t!==null;){let n=t.prev;Trt(r,t),t=n}},Trt=(r,t)=>{if(t){let n=t.value;r[b0e]&&r[b0e](n.key,n.value),r[E0e]-=n.length,r[vW].delete(n.key),r[k_].removeNode(t)}},X$o=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},Dbl=(r,t,n,i)=>{let o=n.value;awr(r,o)&&(Trt(r,n),r[uDt]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};Lbl.exports=$$o});var Az=m((R_C,Ubl)=>{var Z$o=class r{constructor(t,n){if(n=eV1(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof eXo)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(o=>!qbl(o[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&aV1(o[0])){this.set=[o];break}}}this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){let i=((this.options.includePrerelease&&oV1)|(this.options.loose&&sV1))+":"+t,o=kbl.get(i);if(o)return o;let s=this.options.loose,a=s?L6[mN.HYPHENRANGELOOSE]:L6[mN.HYPHENRANGE];t=t.replace(a,mV1(this.options.includePrerelease)),Ib("hyphen replace",t),t=t.replace(L6[mN.COMPARATORTRIM],rV1),Ib("comparator trim",t),t=t.replace(L6[mN.TILDETRIM],nV1),Ib("tilde trim",t),t=t.replace(L6[mN.CARETTRIM],iV1),Ib("caret trim",t);let u=t.split(" ").map(d=>uV1(d,this.options)).join(" ").split(/\s+/).map(d=>AV1(d,this.options));s&&(u=u.filter(d=>(Ib("loose invalid filter",d,this.options),!!d.match(L6[mN.COMPARATORLOOSE])))),Ib("range list",u);let p=new Map,c=u.map(d=>new eXo(d,this.options));for(let d of c){if(qbl(d))return[d];p.set(d.value,d)}p.size>1&&p.has("")&&p.delete("");let l=[...p.values()];return kbl.set(i,l),l}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>Fbl(i,n)&&t.set.some(o=>Fbl(o,n)&&i.every(s=>o.every(a=>s.intersects(a,n)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new tV1(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(yV1(this.set[n],t,this.options))return!0;return!1}};Ubl.exports=Z$o;var ZH1=cDt(),kbl=new ZH1({max:1e3}),eV1=XOr(),eXo=lDt(),Ib=oDt(),tV1=KM(),{safeRe:L6,t:mN,comparatorTrimReplace:rV1,tildeTrimReplace:nV1,caretTrimReplace:iV1}=Crt(),{FLAG_INCLUDE_PRERELEASE:oV1,FLAG_LOOSE:sV1}=iDt(),qbl=r=>r.value==="<0.0.0-0",aV1=r=>r.value==="",Fbl=(r,t)=>{let n=!0,i=r.slice(),o=i.pop();for(;n&&i.length;)n=i.every(s=>o.intersects(s,t)),o=i.pop();return n},uV1=(r,t)=>(Ib("comp",r,t),r=pV1(r,t),Ib("caret",r),r=cV1(r,t),Ib("tildes",r),r=fV1(r,t),Ib("xrange",r),r=gV1(r,t),Ib("stars",r),r),yN=r=>!r||r.toLowerCase()==="x"||r==="*",cV1=(r,t)=>r.trim().split(/\s+/).map(n=>lV1(n,t)).join(" "),lV1=(r,t)=>{let n=t.loose?L6[mN.TILDELOOSE]:L6[mN.TILDE];return r.replace(n,(i,o,s,a,u)=>{Ib("tilde",r,i,o,s,a,u);let p;return yN(o)?p="":yN(s)?p=`>=${o}.0.0 <${+o+1}.0.0-0`:yN(a)?p=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:u?(Ib("replaceTilde pr",u),p=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`):p=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,Ib("tilde return",p),p})},pV1=(r,t)=>r.trim().split(/\s+/).map(n=>dV1(n,t)).join(" "),dV1=(r,t)=>{Ib("caret",r,t);let n=t.loose?L6[mN.CARETLOOSE]:L6[mN.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,u,p)=>{Ib("caret",r,o,s,a,u,p);let c;return yN(s)?c="":yN(a)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:yN(u)?s==="0"?c=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:p?(Ib("replaceCaret pr",p),s==="0"?a==="0"?c=`>=${s}.${a}.${u}-${p} <${s}.${a}.${+u+1}-0`:c=`>=${s}.${a}.${u}-${p} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${u}-${p} <${+s+1}.0.0-0`):(Ib("no pr"),s==="0"?a==="0"?c=`>=${s}.${a}.${u}${i} <${s}.${a}.${+u+1}-0`:c=`>=${s}.${a}.${u}${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${u} <${+s+1}.0.0-0`),Ib("caret return",c),c})},fV1=(r,t)=>(Ib("replaceXRanges",r,t),r.split(/\s+/).map(n=>hV1(n,t)).join(" ")),hV1=(r,t)=>{r=r.trim();let n=t.loose?L6[mN.XRANGELOOSE]:L6[mN.XRANGE];return r.replace(n,(i,o,s,a,u,p)=>{Ib("xRange",r,i,o,s,a,u,p);let c=yN(s),l=c||yN(a),d=l||yN(u),f=d;return o==="="&&f&&(o=""),p=t.includePrerelease?"-0":"",c?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&f?(l&&(a=0),u=0,o===">"?(o=">=",l?(s=+s+1,a=0,u=0):(a=+a+1,u=0)):o==="<="&&(o="<",l?s=+s+1:a=+a+1),o==="<"&&(p="-0"),i=`${o+s}.${a}.${u}${p}`):l?i=`>=${s}.0.0${p} <${+s+1}.0.0-0`:d&&(i=`>=${s}.${a}.0${p} <${s}.${+a+1}.0-0`),Ib("xRange return",i),i})},gV1=(r,t)=>(Ib("replaceStars",r,t),r.trim().replace(L6[mN.STAR],"")),AV1=(r,t)=>(Ib("replaceGTE0",r,t),r.trim().replace(L6[t.includePrerelease?mN.GTE0PRE:mN.GTE0],"")),mV1=r=>(t,n,i,o,s,a,u,p,c,l,d,f,h)=>(yN(i)?n="":yN(o)?n=`>=${i}.0.0${r?"-0":""}`:yN(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,yN(c)?p="":yN(l)?p=`<${+c+1}.0.0-0`:yN(d)?p=`<${c}.${+l+1}.0-0`:f?p=`<=${c}.${l}.${d}-${f}`:r?p=`<${c}.${l}.${+d+1}-0`:p=`<=${p}`,`${n} ${p}`.trim()),yV1=(r,t,n)=>{for(let i=0;i<r.length;i++)if(!r[i].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let i=0;i<r.length;i++)if(Ib(r[i].semver),r[i].semver!==eXo.ANY&&r[i].semver.prerelease.length>0){let o=r[i].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0}});var lDt=m((O_C,Vbl)=>{var pDt=Symbol("SemVer ANY"),nXo=class r{static get ANY(){return pDt}constructor(t,n){if(n=zbl(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),rXo("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===pDt?this.value="":this.value=this.operator+this.semver.version,rXo("comp",this)}parse(t){let n=this.options.loose?Qbl[jbl.COMPARATORLOOSE]:Qbl[jbl.COMPARATOR],i=t.match(n);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new Gbl(i[2],this.options.loose):this.semver=pDt}toString(){return this.value}test(t){if(rXo("Comparator.test",t,this.options.loose),this.semver===pDt||t===pDt)return!0;if(typeof t=="string")try{t=new Gbl(t,this.options)}catch{return!1}return tXo(t,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Hbl(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new Hbl(this.value,n).test(t.semver):(n=zbl(n),n.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!n.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||tXo(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||tXo(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Vbl.exports=nXo;var zbl=XOr(),{safeRe:Qbl,t:jbl}=Crt(),tXo=W$o(),rXo=oDt(),Gbl=KM(),Hbl=Az()});var dDt=m((w_C,Wbl)=>{var bV1=Az(),EV1=(r,t,n)=>{try{t=new bV1(t,n)}catch{return!1}return t.test(r)};Wbl.exports=EV1});var Ybl=m((x_C,Kbl)=>{var CV1=Az(),SV1=(r,t)=>new CV1(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));Kbl.exports=SV1});var $bl=m((M_C,Jbl)=>{var vV1=KM(),TV1=Az(),IV1=(r,t,n)=>{let i=null,o=null,s=null;try{s=new TV1(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new vV1(i,n))}),i};Jbl.exports=IV1});var Zbl=m((P_C,Xbl)=>{var _V1=KM(),RV1=Az(),OV1=(r,t,n)=>{let i=null,o=null,s=null;try{s=new RV1(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new _V1(i,n))}),i};Xbl.exports=OV1});var rEl=m((N_C,tEl)=>{var iXo=KM(),wV1=Az(),eEl=sDt(),xV1=(r,t)=>{r=new wV1(r,t);let n=new iXo("0.0.0");if(r.test(n)||(n=new iXo("0.0.0-0"),r.test(n)))return n;n=null;for(let i=0;i<r.set.length;++i){let o=r.set[i],s=null;o.forEach(a=>{let u=new iXo(a.semver.version);switch(a.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!s||eEl(u,s))&&(s=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||eEl(n,s))&&(n=s)}return n&&r.test(n)?n:null};tEl.exports=xV1});var iEl=m((D_C,nEl)=>{var MV1=Az(),PV1=(r,t)=>{try{return new MV1(r,t).range||"*"}catch{return null}};nEl.exports=PV1});var uwr=m((B_C,uEl)=>{var NV1=KM(),aEl=lDt(),{ANY:DV1}=aEl,BV1=Az(),LV1=dDt(),oEl=sDt(),sEl=rwr(),kV1=iwr(),qV1=nwr(),FV1=(r,t,n,i)=>{r=new NV1(r,i),t=new BV1(t,i);let o,s,a,u,p;switch(n){case">":o=oEl,s=kV1,a=sEl,u=">",p=">=";break;case"<":o=sEl,s=qV1,a=oEl,u="<",p="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(LV1(r,t,i))return!1;for(let c=0;c<t.set.length;++c){let l=t.set[c],d=null,f=null;if(l.forEach(h=>{h.semver===DV1&&(h=new aEl(">=0.0.0")),d=d||h,f=f||h,o(h.semver,d.semver,i)?d=h:a(h.semver,f.semver,i)&&(f=h)}),d.operator===u||d.operator===p||(!f.operator||f.operator===u)&&s(r,f.semver))return!1;if(f.operator===p&&a(r,f.semver))return!1}return!0};uEl.exports=FV1});var lEl=m((L_C,cEl)=>{var UV1=uwr(),zV1=(r,t,n)=>UV1(r,t,">",n);cEl.exports=zV1});var dEl=m((k_C,pEl)=>{var QV1=uwr(),jV1=(r,t,n)=>QV1(r,t,"<",n);pEl.exports=jV1});var gEl=m((q_C,hEl)=>{var fEl=Az(),GV1=(r,t,n)=>(r=new fEl(r,n),t=new fEl(t,n),r.intersects(t,n));hEl.exports=GV1});var mEl=m((F_C,AEl)=>{var HV1=dDt(),VV1=gz();AEl.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((l,d)=>VV1(l,d,n));for(let l of a)HV1(l,t,n)?(s=l,o||(o=l)):(s&&i.push([o,s]),s=null,o=null);o&&i.push([o,null]);let u=[];for(let[l,d]of i)l===d?u.push(l):!d&&l===a[0]?u.push("*"):d?l===a[0]?u.push(`<=${d}`):u.push(`${l} - ${d}`):u.push(`>=${l}`);let p=u.join(" || "),c=typeof t.raw=="string"?t.raw:String(t);return p.length<c.length?p:t}});var vEl=m((U_C,SEl)=>{var yEl=Az(),sXo=lDt(),{ANY:oXo}=sXo,fDt=dDt(),aXo=gz(),WV1=(r,t,n={})=>{if(r===t)return!0;r=new yEl(r,n),t=new yEl(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=YV1(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},KV1=[new sXo(">=0.0.0-0")],bEl=[new sXo(">=0.0.0")],YV1=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===oXo){if(t.length===1&&t[0].semver===oXo)return!0;n.includePrerelease?r=KV1:r=bEl}if(t.length===1&&t[0].semver===oXo){if(n.includePrerelease)return!0;t=bEl}let i=new Set,o,s;for(let h of r)h.operator===">"||h.operator===">="?o=EEl(o,h,n):h.operator==="<"||h.operator==="<="?s=CEl(s,h,n):i.add(h.semver);if(i.size>1)return null;let a;if(o&&s){if(a=aXo(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let h of i){if(o&&!fDt(h,String(o),n)||s&&!fDt(h,String(s),n))return null;for(let A of t)if(!fDt(h,String(A),n))return!1;return!0}let u,p,c,l,d=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=o&&!n.includePrerelease&&o.semver.prerelease.length?o.semver:!1;d&&d.prerelease.length===1&&s.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let h of t){if(l=l||h.operator===">"||h.operator===">=",c=c||h.operator==="<"||h.operator==="<=",o){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(u=EEl(o,h,n),u===h&&u!==o)return!1}else if(o.operator===">="&&!fDt(o.semver,String(h),n))return!1}if(s){if(d&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===d.major&&h.semver.minor===d.minor&&h.semver.patch===d.patch&&(d=!1),h.operator==="<"||h.operator==="<="){if(p=CEl(s,h,n),p===h&&p!==s)return!1}else if(s.operator==="<="&&!fDt(s.semver,String(h),n))return!1}if(!h.operator&&(s||o)&&a!==0)return!1}return!(o&&c&&!s&&a!==0||s&&l&&!o&&a!==0||f||d)},EEl=(r,t,n)=>{if(!r)return t;let i=aXo(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},CEl=(r,t,n)=>{if(!r)return t;let i=aXo(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};SEl.exports=WV1});var Irt=m((z_C,_El)=>{var uXo=Crt(),TEl=iDt(),JV1=KM(),IEl=j$o(),$V1=XBe(),XV1=Vyl(),ZV1=Kyl(),eW1=$yl(),tW1=ebl(),rW1=rbl(),nW1=ibl(),iW1=sbl(),oW1=ubl(),sW1=gz(),aW1=dbl(),uW1=hbl(),cW1=twr(),lW1=ybl(),pW1=Ebl(),dW1=sDt(),fW1=rwr(),hW1=H$o(),gW1=V$o(),AW1=nwr(),mW1=iwr(),yW1=W$o(),bW1=wbl(),EW1=lDt(),CW1=Az(),SW1=dDt(),vW1=Ybl(),TW1=$bl(),IW1=Zbl(),_W1=rEl(),RW1=iEl(),OW1=uwr(),wW1=lEl(),xW1=dEl(),MW1=gEl(),PW1=mEl(),NW1=vEl();_El.exports={parse:$V1,valid:XV1,clean:ZV1,inc:eW1,diff:tW1,major:rW1,minor:nW1,patch:iW1,prerelease:oW1,compare:sW1,rcompare:aW1,compareLoose:uW1,compareBuild:cW1,sort:lW1,rsort:pW1,gt:dW1,lt:fW1,eq:hW1,neq:gW1,gte:AW1,lte:mW1,cmp:yW1,coerce:bW1,Comparator:EW1,Range:CW1,satisfies:SW1,toComparators:vW1,maxSatisfying:TW1,minSatisfying:IW1,minVersion:_W1,validRange:RW1,outside:OW1,gtr:wW1,ltr:xW1,intersects:MW1,simplifyRange:PW1,subset:NW1,SemVer:JV1,re:uXo.re,src:uXo.src,tokens:uXo.t,SEMVER_SPEC_VERSION:TEl.SEMVER_SPEC_VERSION,RELEASE_TYPES:TEl.RELEASE_TYPES,compareIdentifiers:IEl.compareIdentifiers,rcompareIdentifiers:IEl.rcompareIdentifiers}});var hDt,DW1,Q_C,BW1,qC,Qee=V(()=>{"use strict";hDt=gt(zV()),DW1=gt(Irt()),Q_C=(0,hDt.Record)({version:hDt.String,hash:hDt.String}),BW1=()=>{let r="7.41.5",t="88a32e21d1b00aa42a1d0668a13325481a5cdc06";return r&&t?{version:r,hash:t}:null},qC=BW1()});var $Ce,_rt,cwr=V(()=>{"use strict";pr();$Ce=class extends rt{constructor(n){super(`Run ${n} canceled by user`);this.runID=n}runID;fault="client"},_rt=class extends rt{constructor(n){super('Test failed with "continue on failure" set to false');this.result=n}result;fault="client"}});var REl,OEl,r8e,gDt,ADt,lwr,pwr=V(()=>{"use strict";gy();cwr();REl=(r,t,n)=>{switch(r){case"skipped":return"Skipped";case"error":return"Error";case"complete":switch(n){case"create":return t?"Validated":"Created";case"run":return t?"Validated":"DataLoaded";default:return"None"}default:return"None"}},OEl=r=>typeof r=="object"&&r instanceof _rt,r8e=r=>typeof r=="object"&&(r instanceof sm||r instanceof $Ce),gDt=r=>typeof r=="object"&&r instanceof dz&&r.isCancel(),ADt=r=>typeof r=="object"&&r instanceof zee&&r.isCancel(),lwr=r=>r8e(r)||gDt(r)||ADt(r)});var wEl,xEl,XCe,mDt=V(()=>{"use strict";pr();A0e();Yo();Ac();ar();pm();M_();xPt();Zd();Qee();rDt();cwr();pwr();wEl=5e5,xEl=500,XCe=class r{constructor(t,n,i,o,s){this.state=t;this.repository=n;this.logContext=i;this.operationType=o;this.analyticsCollector=s}state;repository;logContext;operationType;stepsInitialized=null;runResults={};flusher=null;wasCanceled=!1;nodeStageIndexTracker=new Map;analyticsCollector;get teamID(){return this.logContext.orgID}get runID(){return this.logContext.runID}get envID(){return this.logContext.workspaceID}GetLogContext=t=>({...this.logContext,nodeID:t});async runIsCanceled(){if(!this.repository)return!1;if(this.wasCanceled)return!0;try{let t=!!(await this.getRepositoryForRun().fetch({pendingWritesTimeoutMs:100})).runDetails.canceled;return t&&(this.wasCanceled=!0),t}catch(t){if(b2(t)){if(t instanceof KBe)return!1;if(t instanceof Wu)return!1}throw t}}async throwIfRunCanceled(){if(await this.runIsCanceled())throw new $Ce(this.runID)}updateNodeLocalRunResult({stepID:t,isPreview:n,runExecutionSequenceID:i},o){let s=this.runResults[t];s?(s.runState=o,s.queryResultSequence.isRunning=o==="running",s.stepRunState=this.getStepRunState(o,n),i!==void 0&&(s.runExecutionSequenceID=i),(o==="canceled"||o==="skipped"||o==="error")&&s.queryResultSequence.queryResults.forEach(a=>{!a.isRunning&&a.status==="Queued"&&(a.status="Canceled")})):this.Logger.errorContext(this.GetLogContext(t),"EventHandler updateNodeLocalRunResult: missing expected local run result for node",t)}getBulkSkipHandler=()=>async t=>{if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let[o,s]of Object.entries(t))if(this.runResults[o]){let a=i.get(o);this.updateNodeLocalRunResult({stepID:o,isPreview:!1,runExecutionSequenceID:s},"skipped");let u={...r.truncateRunResult(this.runResults[o]),version:2};await n.save(a,u)}await n.commit()};getCancelNodeHandler=()=>async t=>{try{if(!this.repository)return;if(this.runResults[t]){this.updateNodeLocalRunResult({stepID:t,isPreview:!1},"canceled");let i=this.getRepositoryForRun().runResults.get(t),o={...r.truncateRunResult(this.runResults[t]),version:2};await i.save(o)}else this.Logger.errorContext(this.GetLogContext(t),"EventHandler getCancelNodeHandler: missing expected local run result for node",t)}catch(n){this.Logger.errorContext(this.logContext,`Error canceling node ${t}`,n)}};async repositoryUpdateRunStatus({expectedStatus:t,newStatus:n}){if(!this.repository)return;let i=this.getRepositoryForRun();try{let o=await i.fetch();ig("RUNNER_BACKEND",t===o.runStatus,this.logContext,`EventHandler.repositoryUpdateRunStatus found unexpected run status - expected: ${t} / actual: ${o.runStatus}`)}catch(o){this.Logger.alertContext(this.logContext,"Error fetching runInfo",o)}await i.merge({runStatus:n})}async repositoryStampExecutorInfo(t){if(this.repository)try{await this.getRepositoryForRun().merge({platform:t,...qC?{softwareVersion:qC.version}:{}})}catch(n){this.Logger.errorContext(this.logContext,"[EventHandler.repositoryStampExecutorInfo] Error stamping executor info. Cannot update run document version/platform.",n)}}async repositoryUpdateRenderingProgress(t){if(this.repository)try{await this.getRepositoryForRun().merge({renderingProgress:{totalNodes:t.totalNodes,completedNodes:t.completedNodes}})}catch(n){this.Logger.errorContext(this.logContext,"[EventHandler.repositoryUpdateRenderingProgress] Error updating rendering progress. Cannot update run document renderingProgress.",n)}}getRepositoryRunsCollection(){if(!this.repository)throw new rt("No repository to get runs collection for!");return this.repository.orgs.get(this.logContext.orgID).runs}getRepositoryForRun(){return this.getRepositoryRunsCollection().get(this.runID)}formatError=(t,n=null,i=null,o=!1)=>{let s=Ia(t.error).error,a="";return t.error&&typeof t.error=="object"&&!(t.error instanceof Error)&&"runDetails"in t.error&&typeof t.error.runDetails=="object"&&(a=t.error?.runDetails?.compiledSQL??""),t.templateString&&(a=t.templateString),{success:!1,error:{errorString:s.errorString??"",errorDetail:s.errorDetail??""},rows:[],fields:[],name:"",exportedRefs:[],invalidExportedRefs:[],status:o?"Canceled":"Failure",sql:a??"",startTime:t.startTime,endTime:new Date,isRunning:!1,type:"sql",queryID:n,warehouse:i}};populateRunResults(t,n){let i="[EventHandler.populateRunResults()]",o=t.length+1;for(let s of t){let u=F1(s,this.state.nodes,`${i} state.nodes`).operation.name;this.runResults[s]={name:u,runExecutionSequenceID:o,dataResult:null,runState:n,stepRunState:"None",queryResultSequence:{name:u,queryResults:[],isRunning:!1},runResultVersion:2}}}async bulkSetRunResults(t){if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let o of t){let s=this.runResults[o];if(!s)throw new rt(`Run result for node ${o} does not exist for run ${this.runID}`);let a={...s,name:s.queryResultSequence.name,runExecutionSequenceID:s.runExecutionSequenceID,version:2},u=i.get(o);await n.save(u,a)}await n.commit()}async initializeRunResults(t,n="queued"){this.stepsInitialized=[...t],this.populateRunResults(t,n),await this.bulkSetRunResults(t)}setFlusher(t){this.flusher=t,t.startTimer()}async disposeFlusher(){await this.flusher?.stopAndFlush()}async populatePlaceholderStages(t,n){let i=new Set,o=new Set(t.keys());for(let s of n){if(!o.has(s))continue;let a=t.getPhaseItems(s);for(let[u,p]of a.entries()){let c=F1(u,this.runResults,"populateQueuedStages: this.runResults"),l=this.state.nodes[u],d=l?sN(l,void 0):!1,f=Ert(p,this.getNameForStageWithoutSQL(s,d));for(let h of f)c.queryResultSequence.queryResults.push(this.createQueuedStage(h));f.length>0&&!i.has(u)&&(i.add(u),this.nodeStageIndexTracker.set(u,0))}}await this.bulkSetQueuedStageResults(i)}createQueuedStage({name:t,sql:n,type:i}){return{name:t,status:"Queued",success:!0,sql:n,rows:[],fields:[],startTime:new Date,endTime:new Date,isRunning:!1,exportedRefs:[],invalidExportedRefs:[],type:i}}async bulkSetQueuedStageResults(t){if(!this.repository)return;let n=this.repository.batch(),i=this.getRepositoryForRun().runResults;for(let o of t){let s=this.runResults[o];if(!s)continue;let a=i.get(o);await n.save(a,r.buildRunResultEntitySave(s))}await n.commit()}formatErrorToResult(t,n){let i=null,o=null;return typeof t.error=="object"&&(i=t.error.queryID||null,o=t.error.warehouse||null),{...this.formatError(t,i,o,n),name:t.stageName,stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime}}ensureHasQueryResult(t){if(ig("DEPLOY",!!t.queryResult,this.GetLogContext(t.stepID),"query result should always be returned for stage execution"),!t.queryResult)throw new Error("Got an empty query result for stage execution")}updateStageResultAtTrackedIndex=(t,n)=>{let o=F1(t,this.runResults,"[EventHandler.setLastQueryResult()]").queryResultSequence.queryResults,s=this.getCurrentStageIndex(t);if(s<0||s>=o.length)throw this.Logger.errorContext(this.GetLogContext(t),"[EventHandler.setLastQueryResult] stage index out of bounds",{targetIndex:s,queryResultsLength:o.length,resultName:n.name}),new rt(`Stage index ${s} out of bounds (length: ${o.length}) for node ${t}`);o[s]=n};async dispatchQueryFailure(t,n){let i=this.formatErrorToResult(t,n),o=n?"client":C_(t.error)??"system";return WS(this.Logger,o,this.GetLogContext(t.stepID),"failed to execute run sql",n?"- canceled":"- errored",t.error,"stack: ",t.error.stack||"<none found>"),this.updateStageResultAtTrackedIndex(t.stepID,i),{error:i.error,fault:o}}getSingleStepData(t,n){let i=this.state.nodes[n];if(i)return i;let o=`(${this.runTypeName}) EventHandler: Could not get step data for step: ${n}`;throw this.Logger.errorContext(this.GetLogContext(n),o,n),new rt(o)}getUnrunSteps(){let t={},n=this.state.nodes,i=this.runResults;if(n&&this.stepsInitialized)for(let o of this.stepsInitialized){let s=i[o];if(s){let{runState:a}=s;(a==="waiting"||a==="queued")&&(n[o]?t[o]=0:this.Logger.alertContext(this.logContext,"Node ID from initialization not found in steps data",o))}else this.Logger.alertContext(this.logContext,"Node ID from initialization not found in run results",o)}return t}getStepContext=(t,n,i,o)=>{let s=this.getSingleStepData(t,n),{locationName:a}=s.operation,{database:u}=this.state.mappings[a]?.mappingDefinitions[this.state.currentWorkspace]??{},p=sN(s,void 0),c=s.operation.name;return{startTime:new Date,stepID:n,stepName:c,runExecutionSequenceID:i,phase:t,isPreview:o,isSource:p,database:u??""}};convertIQueryToCompletedQueryResult(t){return{...t,startTime:Vzo(t.startTime),endTime:Vzo(t.endTime)}}getCurrentStageIndex(t){let n=this.nodeStageIndexTracker.get(t);if(n===void 0)throw new rt(`[EventHandler.getCurrentStageIndex] Node ${t} not in stage tracker. Was populateQueuedStages called for this node?`);return n}advanceToNextStage(t){let n=this.getCurrentStageIndex(t);this.nodeStageIndexTracker.set(t,n+1)}getQueryResultForUpdateSuccess(t){return{...this.convertIQueryToCompletedQueryResult(t.queryResult),name:t.stageName,stageExecutionStartTime:t.stageExecutionStartTime,stageExecutionEndTime:t.stageExecutionEndTime}}getStepRunState(t,n){return REl(t,n,this.operationType)}async updateRunResult(t){if(!this.repository)return;let n=this.runResults[t];if(!n)throw new rt(`[EventHandler.updateRunResult()] run result for node ${t} does not exist for run ${this.runID}`);if(this.flusher)this.flusher.markDirty(t);else{let i=r.buildRunResultEntitySave(n);this.Logger.debugContext(this.GetLogContext(t),"updating run result",i),await this.getRepositoryForRun().runResults.get(t).save(i)}}isFinalRunForStep(t){return!0}async beforePhaseExecution(t,n){}async afterPhaseExecution(t){}async beforeStepExecution(t){this.runResults[t.stepID]&&(this.runResults[t.stepID].runExecutionSequenceID=t.runExecutionSequenceID),this.updateNodeLocalRunResult(t,"running"),await this.updateRunResult(t.stepID)}async afterFinalRunSuccessForNode(t){return Promise.resolve()}async afterStepExecutionSuccess(t){this.isFinalRunForStep(t)?(this.updateNodeLocalRunResult(t,"complete"),await this.afterFinalRunSuccessForNode(t)):this.updateNodeLocalRunResult(t,"waiting"),await this.updateRunResult(t.stepID)}async afterStepExecutionFailure(t){let n=await this.isCoalesceInitiatedCancel(t.error);this.markUnexecutedStagesAsCanceled(t.stepID),this.updateNodeLocalRunResult(t,n?"canceled":"error");try{this.flusher?await this.flusher.flushOne(t.stepID):await this.updateRunResult(t.stepID)}catch(i){this.Logger.emergContext(this.GetLogContext(t.stepID),`Error in firebaseUpdateStepResult for stepCounter:${t.stepID}:`,i)}}markUnexecutedStagesAsCanceled(t){let n=this.runResults[t];if(n)for(let i of n.queryResultSequence.queryResults)"status"in i&&i.status==="Queued"&&(i.status="Canceled")}sanityCheckContext(t){if(!t.stageType)throw this.Logger.emergContext(this.logContext,`No stage type on this ${this.runTypeName}!`,t),new Error(`Internal critical error: no stage type on this ${this.runTypeName}!`)}async beforeStageExecution(t){this.sanityCheckContext(t);let n=this.runResults[t.stepID];if(n){let i=n.queryResultSequence.queryResults,o=this.getCurrentStageIndex(t.stepID),s=i[o];if(!s||!("status"in s)||s.status!=="Queued"){let a=s&&"status"in s?s.status:"no-status";throw new rt(`[EventHandler.beforeStageExecution] Expected queued placeholder at index ${o} for node ${t.stepID}, but found: ${s?`status=${a}`:"undefined"}`)}s.status="Running",s.startTime=new Date,s.endTime=s.startTime,await this.updateRunResult(t.stepID)}}async updateRunWithHeartbeat(t){await this.getRepositoryForRun().updateHeartbeat(t)}async afterStageExecutionSuccess(t){let n="[EventHandler.afterStageExecutionSuccess()]";if(this.sanityCheckContext(t),!t.queryResult){let i="Got an empty query result for stage execution - query result should always be returned!";throw this.Logger.alertContext(this.GetLogContext(t.stepID),n,i),new rt(i)}if(t.stageExecutionStartTime&&t.stageExecutionEndTime){let i=t.stageExecutionEndTime.getTime()-t.stageExecutionStartTime.getTime();this.analyticsCollector.addQueryTiming(t.stepID,t.stageName,i,!0,t.stageExecutionStartTime)}if(wPt(t.queryResult)&&!t.queryResult.success){await this.updateRunWithHeartbeat({hasTestFailures:!0});let i=this.runResults[t.stepID];i&&(i.hasTestFailures=!0)}this.updateStageResultAtTrackedIndex(t.stepID,this.getQueryResultForUpdateSuccess(t)),await this.updateRunResult(t.stepID),this.advanceToNextStage(t.stepID)}async afterStageExecutionFailure(t){if(this.sanityCheckContext(t),t.stageExecutionStartTime&&t.stageExecutionEndTime){let o=t.stageExecutionEndTime.getTime()-t.stageExecutionStartTime.getTime();this.analyticsCollector.addQueryTiming(t.stepID,t.stageName,o,!1,t.stageExecutionStartTime)}let n=await this.isCoalesceInitiatedCancel(t.error),i=await this.dispatchQueryFailure(t,n);throw this.flusher?await this.flusher.flushOne(t.stepID):await this.updateRunResult(t.stepID),this.advanceToNextStage(t.stepID),n?t.error:i}async isCoalesceInitiatedCancel(t){return r8e(t)?!0:gDt(t)?this.runIsCanceled():ADt(t)?this.runIsCanceled():!1}static truncateQueryResult(t,n=wEl,i=xEl){let o=t.sql,s=t.rows,a,u;if(o){let p=new TextEncoder,c=new TextDecoder("utf8"),l=p.encode(o);if(l.length>n){let d=c.decode(l.slice(0,n));d.slice(-1)==="\uFFFD"&&(d=d.slice(0,-1)),a=`${d}...data truncated`}}return s?.length>i&&(u=s.slice(0,i),u.push({values:[`${s.length-i} rows truncated`]})),a||u?{...t,sql:a??o,rows:u??s}:t}static buildRunResultEntitySave(t){return{...r.truncateRunResult(t),name:t.queryResultSequence.name,runExecutionSequenceID:t.runExecutionSequenceID,version:2}}static truncateRunResult(t){let n=(t.dataResult?.sql?1:0)+(t.queryResultSequence?.renderQueryResults?.sql?1:0)+(t.queryResultSequence?.queryResults?.length??0),i=(t.dataResult?.rows?.length?1:0)+(t.queryResultSequence?.renderQueryResults?.rows?.length?1:0)+(t.queryResultSequence?.queryResults?.reduce((p,c)=>p+c?.rows?.length?1:0,0)??0);if(n===0&&i===0)return t;let o=Math.trunc(wEl/n)-100,s=xEl/(i??1),a={...t};t.dataResult?.sql&&(a.dataResult=r.truncateQueryResult(t.dataResult,o,s)??null);let u=t.queryResultSequence;return u&&(a.queryResultSequence={...u,queryResults:u.queryResults?.map(p=>r.truncateQueryResult(p,o,s))},u.renderQueryResults&&(a.queryResultSequence.renderQueryResults=r.truncateQueryResult(u.renderQueryResults,o,s))),a}}});var dwr,MEl=V(()=>{"use strict";ka();Yo();Ac();R6();rDt();nDt();mDt();dwr=class extends XCe{constructor(n,i,o,s,a){super(n,i,o,"create",a);this.phasedNodeData=s}phasedNodeData;getNameForStageWithoutSQL=(n,i)=>$Or(n,i);getNodeDataForUpdate=n=>{let i=this.getSingleStepData(n.phase,n.stepID),o=i.operation.locationName,s=rz(this.state.mappings,this.envID),a=this.GetLogContext(n.stepID),u;try{let p=s?.[o]?.database??i.operation.database,c=s?.[o]?.schema??i.operation.schema;return u={...i.operation,metadata:{...i.operation.metadata,columns:i.operation.metadata.columns.map(l=>({...l}))},database:p,schema:c,version:1,id:n.stepID,deployEnabled:!0},this.Logger.infoContext(a,"newStepData:",u,"stepCounter:",n.stepID),gLc("(Logging Only) Compare locations from context and workspace",a,()=>{let l=rz(this.state.mappings||{},this.state.currentWorkspace);ig("DEPLOY",OX(l[o],s[o]),a,`Location data for location ${o} for node ${i.operation.name} with id ${n.stepID} differs between data from context and data from workspace.`,"locationsFromWorkspace:",l,"locationsFromContext:",s)}),u}catch(p){let c=u?u.name:i.operation.name,l=`Error attempting to update the database/schema on deployed nodeID ${n.stepID}: ${c}`;throw this.Logger.emergContext(a,l,"locations:",s,"error:",p),new SW(n.stepID,l)}};async updateEnvironmentNodeMetadata(n){if(!this.repository)return;let i=this.repository.org(this.teamID).workspace(+this.envID).nodes.get(n.stepID);if(n.phase==="deletedTable")n.stepID in this.phasedNodeData.addedTable||await i.delete();else{let o=this.getNodeDataForUpdate(n);await i.save(o)}}isFinalRunForStep(n){let i=[];return n.phase==="deletedTable"&&(i.push(this.phasedNodeData.alteredTable),i.push(this.phasedNodeData.addedTable)),n.phase==="alteredTable"&&i.push(this.phasedNodeData.addedTable),!i.some(o=>n.stepID in o)}async afterFinalRunSuccessForNode(n){try{await this.updateEnvironmentNodeMetadata(n)}catch(i){let o=this.GetLogContext(n.stepID);this.Logger.errorContext(o,"Error updating node metadata -- nodeID:",n.stepID,"error:",i);let s=J$e(i),a="unknown location";try{a=this.getSingleStepData(n.phase,n.stepID).operation.locationName}catch(u){this.Logger.errorContext(o,`Error getting location name for node ${n.stepName} (${n.stepID}):`,u)}throw new SW(n.stepID,`Failed to update node metadata for ${n.stepName} (${a}): ${s}`)}}}});var PEl,fwr,cXo=V(()=>{"use strict";pr();PEl=(r,t)=>{let n=new Set(t);return n.delete(r),Array.from(n)},fwr=async(r,t,n)=>{if(!t)throw new rt(`Cannot get deploy run info since workspace ${r} has no currently running jobs`);if(t.length)return(await n.selectInBatches("id","in",t,[["runType","==","deploy"],["runStatus","==","running"]]))[0]}});var hwr,NEl=V(()=>{"use strict";hwr="No SQL to execute"});var yDt=V(()=>{"use strict";cXo();NEl()});var gwr,DEl=V(()=>{"use strict";yDt();mDt();gwr=class extends XCe{constructor(t,n,i,o){super(t,n,i,"run",o)}async initializeRunResults(t){await super.initializeRunResults(t,"waiting")}getNameForStageWithoutSQL=()=>hwr}});var BEl=V(()=>{"use strict"});var Awr,lXo=V(()=>{"use strict";Awr=class{constructor(t,n,i,o,s,a,u){this.repository=t;this.getRunRepository=n;this.buildEntitySave=i;this.runResults=o;this.logger=s;this.logContext=a;this.flushIntervalMs=u?.flushIntervalMs??3e3,this.flushThreshold=u?.flushThreshold??50}repository;getRunRepository;buildEntitySave;runResults;logger;logContext;dirtyNodes=new Set;timer=null;activeFlush=null;flushedDuringBatch=new Set;flushIntervalMs;flushThreshold;totalFlushes=0;totalNodeWrites=0;totalImmediateWrites=0;timerFlushes=0;thresholdFlushes=0;slowCommits=0;tag="[RunResultFlusher]";markDirty(t){this.dirtyNodes.add(t),this.dirtyNodes.size>=this.flushThreshold&&this.flush("threshold").catch(n=>{this.logger.errorContext(this.logContext,`${this.tag} threshold-triggered flush error`,n)})}async flush(t="dispose"){if(this.activeFlush||this.dirtyNodes.size===0){this.logger.debugContext(this.logContext,`${this.tag} flush skipped (activeFlush=${!!this.activeFlush}, dirtySetEmpty=${this.dirtyNodes.size===0}, trigger=${t})`);return}let n=new Set(this.dirtyNodes);this.dirtyNodes.clear(),this.activeFlush=this.doFlush(n,t);try{await this.activeFlush}finally{this.activeFlush=null}}async doFlush(t,n){try{let i=this.repository.batch();for(let a of t){let u=this.runResults[a];if(!u){this.logger.warnContext(this.logContext,`${this.tag} node ${a} no longer has a run result, skipping write`);continue}let p=this.buildEntitySave(u),c=this.getRunRepository().runResults.get(a);await i.save(c,p)}let o=Date.now();await i.commit();let s=Date.now()-o;if(this.flushedDuringBatch.size>0){let a=this.getRunRepository().runResults;for(let u of this.flushedDuringBatch)if(t.has(u)){let p=this.runResults[u];p&&await a.get(u).save(this.buildEntitySave(p))}this.flushedDuringBatch.clear()}this.totalFlushes++,this.totalNodeWrites+=t.size,n==="timer"&&this.timerFlushes++,n==="threshold"&&this.thresholdFlushes++,s>=2e3&&(this.slowCommits++,this.logger.warnContext(this.logContext,`${this.tag} slow commit: ${s}ms for ${t.size} nodes (possible write stream pressure)`)),this.logger.debugContext(this.logContext,`${this.tag} flushed ${t.size} run results in ${s}ms (${n}, threshold=${this.flushThreshold}, interval=${this.flushIntervalMs}ms)`)}catch(i){for(let o of t)this.dirtyNodes.add(o);throw this.logger.errorContext(this.logContext,`${this.tag} flush failed, ${t.size} nodes re-queued`,i),i}}async flushOne(t){this.dirtyNodes.delete(t);let n=this.runResults[t];if(!n){this.logger.warnContext(this.logContext,`${this.tag} node ${t} no longer has a run result, skipping write (flushOne)`);return}this.activeFlush&&this.flushedDuringBatch.add(t);let i=this.buildEntitySave(n);await this.getRunRepository().runResults.get(t).save(i),this.totalImmediateWrites++}startTimer(){this.timer||(this.timer=setInterval(()=>{this.flush("timer").catch(t=>{this.logger.errorContext(this.logContext,`${this.tag} timer-triggered flush error`,t)})},this.flushIntervalMs))}async stopAndFlush(){this.timer&&(clearInterval(this.timer),this.timer=null);try{if(this.activeFlush)try{await this.activeFlush}catch(t){this.logger.errorContext(this.logContext,`${this.tag} error waiting for in-flight flush (stopAndFlush)`,t)}this.logger.infoContext(this.logContext,`${this.tag} draining remaining dirty nodes (stopAndFlush)`),await this.flush("dispose")}catch(t){this.logger.errorContext(this.logContext,`${this.tag} error stopping and flushing (stopAndFlush)`,t)}finally{this.logger.infoContext(this.logContext,`${this.tag} done \u2014 ${this.totalFlushes} flushes (${this.thresholdFlushes} threshold, ${this.timerFlushes} timer, ${this.slowCommits} slow), ${this.totalNodeWrites} batched writes, ${this.totalImmediateWrites} immediate writes (threshold=${this.flushThreshold}, interval=${this.flushIntervalMs}ms)`)}}}});var mwr,ywr,ZCe=V(()=>{"use strict";ar();MEl();DEl();pwr();cwr();mDt();BEl();lXo();pwr();mwr=class extends dwr{constructor(t,n,i,o,s){super(t,n,i,o,s)}get Logger(){return $e("DEPLOY")}get runTypeName(){return"Deploy"}},ywr=class extends gwr{get Logger(){return $e("RUNNER")}get runTypeName(){return"Refresh"}afterStepExecutionSuccess=async t=>{await super.afterStepExecutionSuccess(t),this.repository&&super.isFinalRunForStep(t)&&!t.isSource&&await this.repository.org(this.logContext.orgID).workspace(this.logContext.workspaceID).nodeLastRefreshed(t.stepID).save({lastRefreshed:new Date().toISOString()})};getQueryResultForUpdateSuccess=t=>({...super.getQueryResultForUpdateSuccess(t),type:t.stageType});async dispatchQueryFailure(t,n){if(OEl(t.error)){let i=t.error,o=this.getCurrentStageIndex(t.stepID);t.stepID in this.runResults&&(this.runResults[t.stepID].queryResultSequence.queryResults[o]=this.convertIQueryToCompletedQueryResult(i.result));let s=this.runResults[t.stepID];return s&&(s.hasTestFailures=!0),await this.updateRunWithHeartbeat({hasTestFailures:!0}),{error:{errorString:t.error.message,errorDetail:t.error.message},fault:"client"}}else return super.dispatchQueryFailure(t,n)}}});var Rrt,Ort,n8e=V(()=>{"use strict";Rrt=["deletedTable","alteredTable","addedTable"],Ort=["refresh"]});var bwr,bDt,Ewr,LEl,kEl,kW1,qW1,FW1,UW1,qEl,wrt,Cwr,pXo,C0e,S0e=V(()=>{"use strict";ka();hb();Ao();ar();HVo();h$o();bwr=`{%- macro get_value_by_column_attribute(column_attribute, value="name") -%}
7878
7878
  {%- set filtered_columns_by_attribute = columns | selectattr(column_attribute) | list -%}
7879
7879
  {%- if filtered_columns_by_attribute | length > 0 -%}
7880
7880
  {{- (filtered_columns_by_attribute | first)[value] -}}