1?ye.slice(0,-1).join(", ")+" or "+ye[X.length-1]:ye[0],Pe=ue?'"'+ve(ue)+'"':"end of input","Expected "+Re+" but "+Pe+" found."}var P=wc(x),$=xp?(P=n.charAt(p),p++):(P=r,N===0&&V(y)),P!==r?(E=[E,P],v=E):(p=v,v=c)):(p=v,v=c);v!==r;)x.push(v),v=p,E=p,N++,P=qt(),P===r&&(P=io()),N--,P===r?E=g:(p=E,E=c),E!==r?(n.length>p?(P=n.charAt(p),p++):(P=r,N===0&&V(y)),P!==r?(E=[E,P],v=E):(p=v,v=c)):(p=v,v=c);x!==r?(m=[m,x],l=m):(p=l,l=c);}else p=l,l=c;return z[$]={nextPos:p,result:l},l}function dC(){var l,m,x,v,E,P,$=p*49+4,X=z[$];if(X)return p=X.nextPos,X.result;if(l=p,n.charCodeAt(p)===91?(m=b,p++):(m=r,N===0&&V(A)),m!==r){for(x=[],v=te();v!==r;)x.push(v),v=te();if(x!==r)if(v=Ld(),v!==r){for(E=[],P=te();P!==r;)E.push(P),P=te();E!==r?(n.charCodeAt(p)===93?(P=_,p++):(P=r,N===0&&V(S)),P!==r?(ee=l,m=C(v),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}else p=l,l=c;return z[$]={nextPos:p,result:l},l}function mC(){var l,m,x,v,E,P,$,X,ue=p*49+5,ve=z[ue];if(ve)return p=ve.nextPos,ve.result;if(l=p,n.charCodeAt(p)===91?(m=b,p++):(m=r,N===0&&V(A)),m!==r)if(n.charCodeAt(p)===91?(x=b,p++):(x=r,N===0&&V(A)),x!==r){for(v=[],E=te();E!==r;)v.push(E),E=te();if(v!==r)if(E=Ld(),E!==r){for(P=[],$=te();$!==r;)P.push($),$=te();P!==r?(n.charCodeAt(p)===93?($=_,p++):($=r,N===0&&V(S)),$!==r?(n.charCodeAt(p)===93?(X=_,p++):(X=r,N===0&&V(S)),X!==r?(ee=l,m=I(E),l=m):(p=l,l=c)):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}else p=l,l=c;else p=l,l=c;return z[ue]={nextPos:p,result:l},l}function Ld(){var l,m,x,v=p*49+6,E=z[v];if(E)return p=E.nextPos,E.result;if(l=p,m=[],x=jd(),x!==r)for(;x!==r;)m.push(x),x=jd();else m=c;return m!==r?(x=qd(),x!==r?(ee=l,m=q(m,x),l=m):(p=l,l=c)):(p=l,l=c),l===r&&(l=p,m=qd(),m!==r&&(ee=l,m=J(m)),l=m),z[v]={nextPos:p,result:l},l}function qd(){var l,m,x,v,E,P=p*49+7,$=z[P];if($)return p=$.nextPos,$.result;for(l=p,m=[],x=te();x!==r;)m.push(x),x=te();if(m!==r)if(x=Nr(),x!==r){for(v=[],E=te();E!==r;)v.push(E),E=te();v!==r?(ee=l,m=W(x),l=m):(p=l,l=c);}else p=l,l=c;else p=l,l=c;if(l===r){for(l=p,m=[],x=te();x!==r;)m.push(x),x=te();if(m!==r)if(x=Ec(),x!==r){for(v=[],E=te();E!==r;)v.push(E),E=te();v!==r?(ee=l,m=W(x),l=m):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}return z[P]={nextPos:p,result:l},l}function jd(){var l,m,x,v,E,P,$,X=p*49+8,ue=z[X];if(ue)return p=ue.nextPos,ue.result;for(l=p,m=[],x=te();x!==r;)m.push(x),x=te();if(m!==r)if(x=Nr(),x!==r){for(v=[],E=te();E!==r;)v.push(E),E=te();if(v!==r)if(n.charCodeAt(p)===46?(E=B,p++):(E=r,N===0&&V(j)),E!==r){for(P=[],$=te();$!==r;)P.push($),$=te();P!==r?(ee=l,m=W(x),l=m):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}else p=l,l=c;else p=l,l=c;if(l===r){for(l=p,m=[],x=te();x!==r;)m.push(x),x=te();if(m!==r)if(x=Ec(),x!==r){for(v=[],E=te();E!==r;)v.push(E),E=te();if(v!==r)if(n.charCodeAt(p)===46?(E=B,p++):(E=r,N===0&&V(j)),E!==r){for(P=[],$=te();$!==r;)P.push($),$=te();P!==r?(ee=l,m=W(x),l=m):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}else p=l,l=c;else p=l,l=c;}return z[X]={nextPos:p,result:l},l}function hC(){var l,m,x,v,E,P,$=p*49+9,X=z[$];if(X)return p=X.nextPos,X.result;if(l=p,m=Nr(),m!==r){for(x=[],v=te();v!==r;)x.push(v),v=te();if(x!==r)if(n.charCodeAt(p)===61?(v=G,p++):(v=r,N===0&&V(T)),v!==r){for(E=[],P=te();P!==r;)E.push(P),P=te();E!==r?(P=qn(),P!==r?(ee=l,m=Y(m,P),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}else p=l,l=c;if(l===r)if(l=p,m=Ec(),m!==r){for(x=[],v=te();v!==r;)x.push(v),v=te();if(x!==r)if(n.charCodeAt(p)===61?(v=G,p++):(v=r,N===0&&V(T)),v!==r){for(E=[],P=te();P!==r;)E.push(P),P=te();E!==r?(P=qn(),P!==r?(ee=l,m=Y(m,P),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}else p=l,l=c;return z[$]={nextPos:p,result:l},l}function Nr(){var l,m,x,v=p*49+10,E=z[v];if(E)return p=E.nextPos,E.result;if(l=p,m=[],x=Jd(),x!==r)for(;x!==r;)m.push(x),x=Jd();else m=c;return m!==r&&(ee=l,m=Z(m)),l=m,z[v]={nextPos:p,result:l},l}function Ec(){var l,m,x=p*49+11,v=z[x];return v?(p=v.nextPos,v.result):(l=p,m=$d(),m!==r&&(ee=l,m=re(m)),l=m,l===r&&(l=p,m=Bd(),m!==r&&(ee=l,m=re(m)),l=m),z[x]={nextPos:p,result:l},l)}function qn(){var l,m=p*49+12,x=z[m];return x?(p=x.nextPos,x.result):(l=gC(),l===r&&(l=CC(),l===r&&(l=bC(),l===r&&(l=wC(),l===r&&(l=SC(),l===r&&(l=EC(),l===r&&(l=AC())))))),z[m]={nextPos:p,result:l},l)}function gC(){var l,m=p*49+13,x=z[m];return x?(p=x.nextPos,x.result):(l=yC(),l===r&&(l=$d(),l===r&&(l=xC(),l===r&&(l=Bd()))),z[m]={nextPos:p,result:l},l)}function yC(){var l,m,x,v,E,P=p*49+14,$=z[P];if($)return p=$.nextPos,$.result;if(l=p,n.substr(p,3)===k?(m=k,p+=3):(m=r,N===0&&V(F)),m!==r)if(x=qt(),x===r&&(x=U),x!==r){for(v=[],E=Ud();E!==r;)v.push(E),E=Ud();v!==r?(n.substr(p,3)===k?(E=k,p+=3):(E=r,N===0&&V(F)),E!==r?(ee=l,m=M(v),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;else p=l,l=c;return z[P]={nextPos:p,result:l},l}function $d(){var l,m,x,v,E=p*49+15,P=z[E];if(P)return p=P.nextPos,P.result;if(l=p,n.charCodeAt(p)===34?(m=ae,p++):(m=r,N===0&&V(Le)),m!==r){for(x=[],v=Dd();v!==r;)x.push(v),v=Dd();x!==r?(n.charCodeAt(p)===34?(v=ae,p++):(v=r,N===0&&V(Le)),v!==r?(ee=l,m=M(x),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;return z[E]={nextPos:p,result:l},l}function xC(){var l,m,x,v,E,P=p*49+16,$=z[P];if($)return p=$.nextPos,$.result;if(l=p,n.substr(p,3)===he?(m=he,p+=3):(m=r,N===0&&V(St)),m!==r)if(x=qt(),x===r&&(x=U),x!==r){for(v=[],E=zd();E!==r;)v.push(E),E=zd();v!==r?(n.substr(p,3)===he?(E=he,p+=3):(E=r,N===0&&V(St)),E!==r?(ee=l,m=M(v),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;else p=l,l=c;return z[P]={nextPos:p,result:l},l}function Bd(){var l,m,x,v,E=p*49+17,P=z[E];if(P)return p=P.nextPos,P.result;if(l=p,n.charCodeAt(p)===39?(m=sn,p++):(m=r,N===0&&V(ot)),m!==r){for(x=[],v=Nd();v!==r;)x.push(v),v=Nd();x!==r?(n.charCodeAt(p)===39?(v=sn,p++):(v=r,N===0&&V(ot)),v!==r?(ee=l,m=M(x),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;return z[E]={nextPos:p,result:l},l}function Dd(){var l,m,x,v=p*49+18,E=z[v];return E?(p=E.nextPos,E.result):(l=Yd(),l===r&&(l=p,m=p,N++,n.charCodeAt(p)===34?(x=ae,p++):(x=r,N===0&&V(Le)),N--,x===r?m=g:(p=m,m=c),m!==r?(n.length>p?(x=n.charAt(p),p++):(x=r,N===0&&V(y)),x!==r?(ee=l,m=Oe(x),l=m):(p=l,l=c)):(p=l,l=c)),z[v]={nextPos:p,result:l},l)}function Nd(){var l,m,x,v=p*49+19,E=z[v];return E?(p=E.nextPos,E.result):(l=p,m=p,N++,n.charCodeAt(p)===39?(x=sn,p++):(x=r,N===0&&V(ot)),N--,x===r?m=g:(p=m,m=c),m!==r?(n.length>p?(x=n.charAt(p),p++):(x=r,N===0&&V(y)),x!==r?(ee=l,m=Oe(x),l=m):(p=l,l=c)):(p=l,l=c),z[v]={nextPos:p,result:l},l)}function Ud(){var l,m,x,v=p*49+20,E=z[v];return E?(p=E.nextPos,E.result):(l=Yd(),l===r&&(l=vC(),l===r&&(l=p,m=p,N++,n.substr(p,3)===k?(x=k,p+=3):(x=r,N===0&&V(F)),N--,x===r?m=g:(p=m,m=c),m!==r?(n.length>p?(x=n.charAt(p),p++):(x=r,N===0&&V(y)),x!==r?(ee=l,m=pe(x),l=m):(p=l,l=c)):(p=l,l=c))),z[v]={nextPos:p,result:l},l)}function vC(){var l,m,x,v,E,P=p*49+21,$=z[P];if($)return p=$.nextPos,$.result;if(l=p,n.charCodeAt(p)===92?(m=ii,p++):(m=r,N===0&&V(qe)),m!==r)if(x=qt(),x!==r){for(v=[],E=Kd();E!==r;)v.push(E),E=Kd();v!==r?(ee=l,m=Q(),l=m):(p=l,l=c);}else p=l,l=c;else p=l,l=c;return z[P]={nextPos:p,result:l},l}function zd(){var l,m,x,v=p*49+22,E=z[v];return E?(p=E.nextPos,E.result):(l=p,m=p,N++,n.substr(p,3)===he?(x=he,p+=3):(x=r,N===0&&V(St)),N--,x===r?m=g:(p=m,m=c),m!==r?(n.length>p?(x=n.charAt(p),p++):(x=r,N===0&&V(y)),x!==r?(ee=l,m=Oe(x),l=m):(p=l,l=c)):(p=l,l=c),z[v]={nextPos:p,result:l},l)}function bC(){var l,m,x,v,E=p*49+23,P=z[E];return P?(p=P.nextPos,P.result):(l=p,m=Md(),m===r&&(m=Ac()),m!==r?(n.charCodeAt(p)===101?(x=we,p++):(x=r,N===0&&V(K)),x===r&&(n.charCodeAt(p)===69?(x=de,p++):(x=r,N===0&&V(Ee))),x!==r?(v=Ac(),v!==r?(ee=l,m=Ke(m,v),l=m):(p=l,l=c)):(p=l,l=c)):(p=l,l=c),l===r&&(l=p,m=Md(),m!==r&&(ee=l,m=ke(m)),l=m),z[E]={nextPos:p,result:l},l)}function Md(){var l,m,x,v,E,P,$=p*49+24,X=z[$];return X?(p=X.nextPos,X.result):(l=p,n.charCodeAt(p)===43?(m=on,p++):(m=r,N===0&&V(Pi)),m===r&&(m=U),m!==r?(x=p,v=Ur(),v!==r?(n.charCodeAt(p)===46?(E=B,p++):(E=r,N===0&&V(j)),E!==r?(P=Ur(),P!==r?(v=[v,E,P],x=v):(p=x,x=c)):(p=x,x=c)):(p=x,x=c),x!==r?(ee=l,m=ld(x),l=m):(p=l,l=c)):(p=l,l=c),l===r&&(l=p,n.charCodeAt(p)===45?(m=qr,p++):(m=r,N===0&&V(jr)),m!==r?(x=p,v=Ur(),v!==r?(n.charCodeAt(p)===46?(E=B,p++):(E=r,N===0&&V(j)),E!==r?(P=Ur(),P!==r?(v=[v,E,P],x=v):(p=x,x=c)):(p=x,x=c)):(p=x,x=c),x!==r?(ee=l,m=ud(x),l=m):(p=l,l=c)):(p=l,l=c)),z[$]={nextPos:p,result:l},l)}function wC(){var l,m,x=p*49+25,v=z[x];return v?(p=v.nextPos,v.result):(l=p,m=Ac(),m!==r&&(ee=l,m=gR(m)),l=m,z[x]={nextPos:p,result:l},l)}function Ac(){var l,m,x,v,E,P=p*49+26,$=z[P];if($)return p=$.nextPos,$.result;if(l=p,n.charCodeAt(p)===43?(m=on,p++):(m=r,N===0&&V(Pi)),m===r&&(m=U),m!==r){if(x=[],v=xe(),v!==r)for(;v!==r;)x.push(v),v=xe();else x=c;x!==r?(v=p,N++,n.charCodeAt(p)===46?(E=B,p++):(E=r,N===0&&V(j)),N--,E===r?v=g:(p=v,v=c),v!==r?(ee=l,m=ld(x),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;if(l===r)if(l=p,n.charCodeAt(p)===45?(m=qr,p++):(m=r,N===0&&V(jr)),m!==r){if(x=[],v=xe(),v!==r)for(;v!==r;)x.push(v),v=xe();else x=c;x!==r?(v=p,N++,n.charCodeAt(p)===46?(E=B,p++):(E=r,N===0&&V(j)),N--,E===r?v=g:(p=v,v=c),v!==r?(ee=l,m=ud(x),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;return z[P]={nextPos:p,result:l},l}function SC(){var l,m,x=p*49+27,v=z[x];return v?(p=v.nextPos,v.result):(l=p,n.substr(p,4)===pd?(m=pd,p+=4):(m=r,N===0&&V(yR)),m!==r&&(ee=l,m=xR()),l=m,l===r&&(l=p,n.substr(p,5)===fd?(m=fd,p+=5):(m=r,N===0&&V(vR)),m!==r&&(ee=l,m=bR()),l=m),z[x]={nextPos:p,result:l},l)}function EC(){var l,m,x,v,E,P=p*49+28,$=z[P];if($)return p=$.nextPos,$.result;if(l=p,n.charCodeAt(p)===91?(m=b,p++):(m=r,N===0&&V(A)),m!==r){for(x=[],v=Lt();v!==r;)x.push(v),v=Lt();x!==r?(n.charCodeAt(p)===93?(v=_,p++):(v=r,N===0&&V(S)),v!==r?(ee=l,m=wR(),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;if(l===r&&(l=p,n.charCodeAt(p)===91?(m=b,p++):(m=r,N===0&&V(A)),m!==r?(x=Hd(),x===r&&(x=U),x!==r?(n.charCodeAt(p)===93?(v=_,p++):(v=r,N===0&&V(S)),v!==r?(ee=l,m=SR(x),l=m):(p=l,l=c)):(p=l,l=c)):(p=l,l=c),l===r)){if(l=p,n.charCodeAt(p)===91?(m=b,p++):(m=r,N===0&&V(A)),m!==r){if(x=[],v=to(),v!==r)for(;v!==r;)x.push(v),v=to();else x=c;x!==r?(n.charCodeAt(p)===93?(v=_,p++):(v=r,N===0&&V(S)),v!==r?(ee=l,m=ER(x),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;if(l===r)if(l=p,n.charCodeAt(p)===91?(m=b,p++):(m=r,N===0&&V(A)),m!==r){if(x=[],v=to(),v!==r)for(;v!==r;)x.push(v),v=to();else x=c;x!==r?(v=Hd(),v!==r?(n.charCodeAt(p)===93?(E=_,p++):(E=r,N===0&&V(S)),E!==r?(ee=l,m=AR(x,v),l=m):(p=l,l=c)):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;}return z[P]={nextPos:p,result:l},l}function Hd(){var l,m,x,v,E,P=p*49+29,$=z[P];if($)return p=$.nextPos,$.result;for(l=p,m=[],x=Lt();x!==r;)m.push(x),x=Lt();if(m!==r)if(x=qn(),x!==r){for(v=[],E=Lt();E!==r;)v.push(E),E=Lt();v!==r?(ee=l,m=dd(x),l=m):(p=l,l=c);}else p=l,l=c;else p=l,l=c;return z[P]={nextPos:p,result:l},l}function to(){var l,m,x,v,E,P,$,X=p*49+30,ue=z[X];if(ue)return p=ue.nextPos,ue.result;for(l=p,m=[],x=Lt();x!==r;)m.push(x),x=Lt();if(m!==r)if(x=qn(),x!==r){for(v=[],E=Lt();E!==r;)v.push(E),E=Lt();if(v!==r)if(n.charCodeAt(p)===44?(E=md,p++):(E=r,N===0&&V(hd)),E!==r){for(P=[],$=Lt();$!==r;)P.push($),$=Lt();P!==r?(ee=l,m=dd(x),l=m):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}else p=l,l=c;else p=l,l=c;return z[X]={nextPos:p,result:l},l}function Lt(){var l,m=p*49+31,x=z[m];return x?(p=x.nextPos,x.result):(l=te(),l===r&&(l=qt(),l===r&&(l=eo())),z[m]={nextPos:p,result:l},l)}function AC(){var l,m,x,v,E,P,$=p*49+32,X=z[$];if(X)return p=X.nextPos,X.result;if(l=p,n.charCodeAt(p)===123?(m=_R,p++):(m=r,N===0&&V(RR)),m!==r){for(x=[],v=te();v!==r;)x.push(v),v=te();if(x!==r){for(v=[],E=Wd();E!==r;)v.push(E),E=Wd();if(v!==r){for(E=[],P=te();P!==r;)E.push(P),P=te();E!==r?(n.charCodeAt(p)===125?(P=CR,p++):(P=r,N===0&&V(TR)),P!==r?(ee=l,m=OR(v),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;}else p=l,l=c;}else p=l,l=c;return z[$]={nextPos:p,result:l},l}function Wd(){var l,m,x,v,E,P,$,X,ue,ve,ye,Re=p*49+33,Pe=z[Re];if(Pe)return p=Pe.nextPos,Pe.result;for(l=p,m=[],x=te();x!==r;)m.push(x),x=te();if(m!==r)if(x=Nr(),x!==r){for(v=[],E=te();E!==r;)v.push(E),E=te();if(v!==r)if(n.charCodeAt(p)===61?(E=G,p++):(E=r,N===0&&V(T)),E!==r){for(P=[],$=te();$!==r;)P.push($),$=te();if(P!==r)if($=qn(),$!==r){for(X=[],ue=te();ue!==r;)X.push(ue),ue=te();if(X!==r)if(n.charCodeAt(p)===44?(ue=md,p++):(ue=r,N===0&&V(hd)),ue!==r){for(ve=[],ye=te();ye!==r;)ve.push(ye),ye=te();ve!==r?(ee=l,m=gd(x,$),l=m):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}else p=l,l=c;else p=l,l=c;}else p=l,l=c;else p=l,l=c;}else p=l,l=c;else p=l,l=c;if(l===r){for(l=p,m=[],x=te();x!==r;)m.push(x),x=te();if(m!==r)if(x=Nr(),x!==r){for(v=[],E=te();E!==r;)v.push(E),E=te();if(v!==r)if(n.charCodeAt(p)===61?(E=G,p++):(E=r,N===0&&V(T)),E!==r){for(P=[],$=te();$!==r;)P.push($),$=te();P!==r?($=qn(),$!==r?(ee=l,m=gd(x,$),l=m):(p=l,l=c)):(p=l,l=c);}else p=l,l=c;else p=l,l=c;}else p=l,l=c;else p=l,l=c;}return z[Re]={nextPos:p,result:l},l}function Gd(){var l,m,x,v=p*49+34,E=z[v];return E?(p=E.nextPos,E.result):(l=p,n.charCodeAt(p)===46?(m=B,p++):(m=r,N===0&&V(j)),m!==r?(x=Ur(),x!==r?(ee=l,m=kR(x),l=m):(p=l,l=c)):(p=l,l=c),z[v]={nextPos:p,result:l},l)}function Vd(){var l,m,x,v,E,P,$,X,ue,ve,ye,Re,Pe=p*49+35,Et=z[Pe];return Et?(p=Et.nextPos,Et.result):(l=p,m=p,x=xe(),x!==r?(v=xe(),v!==r?(E=xe(),E!==r?(P=xe(),P!==r?(n.charCodeAt(p)===45?($=qr,p++):($=r,N===0&&V(jr)),$!==r?(X=xe(),X!==r?(ue=xe(),ue!==r?(n.charCodeAt(p)===45?(ve=qr,p++):(ve=r,N===0&&V(jr)),ve!==r?(ye=xe(),ye!==r?(Re=xe(),Re!==r?(x=[x,v,E,P,$,X,ue,ve,ye,Re],m=x):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c),m!==r&&(ee=l,m=PR(m)),l=m,z[Pe]={nextPos:p,result:l},l)}function _C(){var l,m,x,v,E,P,$,X,ue,ve,ye,Re=p*49+36,Pe=z[Re];return Pe?(p=Pe.nextPos,Pe.result):(l=p,m=p,x=xe(),x!==r?(v=xe(),v!==r?(n.charCodeAt(p)===58?(E=$r,p++):(E=r,N===0&&V(Br)),E!==r?(P=xe(),P!==r?($=xe(),$!==r?(n.charCodeAt(p)===58?(X=$r,p++):(X=r,N===0&&V(Br)),X!==r?(ue=xe(),ue!==r?(ve=xe(),ve!==r?(ye=Gd(),ye===r&&(ye=U),ye!==r?(x=[x,v,E,P,$,X,ue,ve,ye],m=x):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c),m!==r&&(ee=l,m=yd(m)),l=m,z[Re]={nextPos:p,result:l},l)}function RC(){var l,m,x,v,E,P,$,X,ue,ve,ye,Re,Pe,Et,jn,Fi,At,Qd=p*49+37,Rc=z[Qd];return Rc?(p=Rc.nextPos,Rc.result):(l=p,m=p,x=xe(),x!==r?(v=xe(),v!==r?(n.charCodeAt(p)===58?(E=$r,p++):(E=r,N===0&&V(Br)),E!==r?(P=xe(),P!==r?($=xe(),$!==r?(n.charCodeAt(p)===58?(X=$r,p++):(X=r,N===0&&V(Br)),X!==r?(ue=xe(),ue!==r?(ve=xe(),ve!==r?(ye=Gd(),ye===r&&(ye=U),ye!==r?(n.charCodeAt(p)===45?(Re=qr,p++):(Re=r,N===0&&V(jr)),Re===r&&(n.charCodeAt(p)===43?(Re=on,p++):(Re=r,N===0&&V(Pi))),Re!==r?(Pe=xe(),Pe!==r?(Et=xe(),Et!==r?(n.charCodeAt(p)===58?(jn=$r,p++):(jn=r,N===0&&V(Br)),jn!==r?(Fi=xe(),Fi!==r?(At=xe(),At!==r?(x=[x,v,E,P,$,X,ue,ve,ye,Re,Pe,Et,jn,Fi,At],m=x):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c)):(p=m,m=c),m!==r&&(ee=l,m=yd(m)),l=m,z[Qd]={nextPos:p,result:l},l)}function CC(){var l,m,x,v,E,P=p*49+38,$=z[P];return $?(p=$.nextPos,$.result):(l=p,m=Vd(),m!==r?(n.charCodeAt(p)===84?(x=xd,p++):(x=r,N===0&&V(vd)),x!==r?(v=_C(),v!==r?(n.charCodeAt(p)===90?(E=FR,p++):(E=r,N===0&&V(IR)),E!==r?(ee=l,m=LR(m,v),l=m):(p=l,l=c)):(p=l,l=c)):(p=l,l=c)):(p=l,l=c),l===r&&(l=p,m=Vd(),m!==r?(n.charCodeAt(p)===84?(x=xd,p++):(x=r,N===0&&V(vd)),x!==r?(v=RC(),v!==r?(ee=l,m=qR(m,v),l=m):(p=l,l=c)):(p=l,l=c)):(p=l,l=c)),z[P]={nextPos:p,result:l},l)}function te(){var l,m=p*49+39,x=z[m];return x?(p=x.nextPos,x.result):(jR.test(n.charAt(p))?(l=n.charAt(p),p++):(l=r,N===0&&V($R)),z[m]={nextPos:p,result:l},l)}function qt(){var l,m,x,v=p*49+40,E=z[v];return E?(p=E.nextPos,E.result):(n.charCodeAt(p)===10?(l=bd,p++):(l=r,N===0&&V(wd)),l===r&&(l=p,n.charCodeAt(p)===13?(m=BR,p++):(m=r,N===0&&V(DR)),m!==r?(n.charCodeAt(p)===10?(x=bd,p++):(x=r,N===0&&V(wd)),x!==r?(m=[m,x],l=m):(p=l,l=c)):(p=l,l=c)),z[v]={nextPos:p,result:l},l)}function Kd(){var l,m=p*49+41,x=z[m];return x?(p=x.nextPos,x.result):(l=qt(),l===r&&(l=te()),z[m]={nextPos:p,result:l},l)}function io(){var l,m,x=p*49+42,v=z[x];return v?(p=v.nextPos,v.result):(l=p,N++,n.length>p?(m=n.charAt(p),p++):(m=r,N===0&&V(y)),N--,m===r?l=g:(p=l,l=c),z[x]={nextPos:p,result:l},l)}function jt(){var l,m=p*49+43,x=z[m];return x?(p=x.nextPos,x.result):(NR.test(n.charAt(p))?(l=n.charAt(p),p++):(l=r,N===0&&V(UR)),z[m]={nextPos:p,result:l},l)}function xe(){var l,m,x=p*49+44,v=z[x];return v?(p=v.nextPos,v.result):(zR.test(n.charAt(p))?(l=n.charAt(p),p++):(l=r,N===0&&V(MR)),l===r&&(l=p,n.charCodeAt(p)===95?(m=HR,p++):(m=r,N===0&&V(WR)),m!==r&&(ee=l,m=GR()),l=m),z[x]={nextPos:p,result:l},l)}function Jd(){var l,m=p*49+45,x=z[m];return x?(p=x.nextPos,x.result):(VR.test(n.charAt(p))?(l=n.charAt(p),p++):(l=r,N===0&&V(KR)),z[m]={nextPos:p,result:l},l)}function Ur(){var l,m,x,v=p*49+46,E=z[v];if(E)return p=E.nextPos,E.result;if(l=p,m=[],x=xe(),x!==r)for(;x!==r;)m.push(x),x=xe();else m=c;return m!==r&&(ee=l,m=JR(m)),l=m,z[v]={nextPos:p,result:l},l}function Yd(){var l,m,x=p*49+47,v=z[x];return v?(p=v.nextPos,v.result):(l=p,n.substr(p,2)===Sd?(m=Sd,p+=2):(m=r,N===0&&V(YR)),m!==r&&(ee=l,m=XR()),l=m,l===r&&(l=p,n.substr(p,2)===Ed?(m=Ed,p+=2):(m=r,N===0&&V(QR)),m!==r&&(ee=l,m=ZR()),l=m,l===r&&(l=p,n.substr(p,2)===Ad?(m=Ad,p+=2):(m=r,N===0&&V(eC)),m!==r&&(ee=l,m=tC()),l=m,l===r&&(l=p,n.substr(p,2)===_d?(m=_d,p+=2):(m=r,N===0&&V(iC)),m!==r&&(ee=l,m=nC()),l=m,l===r&&(l=p,n.substr(p,2)===Rd?(m=Rd,p+=2):(m=r,N===0&&V(rC)),m!==r&&(ee=l,m=sC()),l=m,l===r&&(l=p,n.substr(p,2)===Cd?(m=Cd,p+=2):(m=r,N===0&&V(oC)),m!==r&&(ee=l,m=aC()),l=m,l===r&&(l=p,n.substr(p,2)===Td?(m=Td,p+=2):(m=r,N===0&&V(cC)),m!==r&&(ee=l,m=lC()),l=m,l===r&&(l=TC()))))))),z[x]={nextPos:p,result:l},l)}function TC(){var l,m,x,v,E,P,$,X,ue,ve,ye,Re=p*49+48,Pe=z[Re];return Pe?(p=Pe.nextPos,Pe.result):(l=p,n.substr(p,2)===Od?(m=Od,p+=2):(m=r,N===0&&V(uC)),m!==r?(x=p,v=jt(),v!==r?(E=jt(),E!==r?(P=jt(),P!==r?($=jt(),$!==r?(X=jt(),X!==r?(ue=jt(),ue!==r?(ve=jt(),ve!==r?(ye=jt(),ye!==r?(v=[v,E,P,$,X,ue,ve,ye],x=v):(p=x,x=c)):(p=x,x=c)):(p=x,x=c)):(p=x,x=c)):(p=x,x=c)):(p=x,x=c)):(p=x,x=c)):(p=x,x=c),x!==r?(ee=l,m=kd(x),l=m):(p=l,l=c)):(p=l,l=c),l===r&&(l=p,n.substr(p,2)===Pd?(m=Pd,p+=2):(m=r,N===0&&V(pC)),m!==r?(x=p,v=jt(),v!==r?(E=jt(),E!==r?(P=jt(),P!==r?($=jt(),$!==r?(v=[v,E,P,$],x=v):(p=x,x=c)):(p=x,x=c)):(p=x,x=c)):(p=x,x=c),x!==r?(ee=l,m=kd(x),l=m):(p=l,l=c)):(p=l,l=c)),z[Re]={nextPos:p,result:l},l)}var Xd=[];function OC(l,m,x){var v=new Error(l);throw v.line=m,v.column=x,v}function _c(l){Xd.push(l);}function Xe(l,m,x,v,E){var P={type:l,value:m,line:x(),column:v()};return E&&(P.key=E),P}function kC(l,m,x){var v=parseInt("0x"+l);if(!isFinite(v)||Math.floor(v)!=v||v<0||v>1114111||v>55295&&v<57344)OC("Invalid Unicode escape code: "+l,m,x);else return PC(v)}function PC(){var l=16384,m=[],x,v,E=-1,P=arguments.length;if(!P)return "";for(var $="";++E>10)+55296,v=X%1024+56320,m.push(x,v)),(E+1==P||m.length>l)&&($+=String.fromCharCode.apply(null,m),m.length=0);}return $}if(Zs=a(),Zs!==r&&p===n.length)return Zs;throw Zs!==r&&p{function ED(t){var e=[],i=[],n="",s=Object.create(null),r=s;return a(t);function a(S){for(var C,I=0;I"u"?T===C.length-1?G[Y]=I:G[Y]=Object.create(null):T!==C.length-1&&i.indexOf(B)>-1&&u("Cannot redefine existing key '"+B+"'.",q,J),G=G[Y],G instanceof Array&&G.length&&T-1?'"'+S+'"':S}}gE.exports={compile:ED};});var vE=R((fG,xE)=>{var AD=hE(),_D=yE();xE.exports={parse:function(t){var e=AD.parse(t.toString());return _D.compile(e)}};});var Os=R((dG,AE)=>{var RD=H("path"),pi="\\\\/",bE=`[^${pi}]`,Ai="\\.",CD="\\+",TD="\\?",Ua="\\/",OD="(?=.)",wE="[^/]",Mp=`(?:${Ua}|$)`,SE=`(?:^|${Ua})`,Hp=`${Ai}{1,2}${Mp}`,kD=`(?!${Ai})`,PD=`(?!${SE}${Hp})`,FD=`(?!${Ai}{0,1}${Mp})`,ID=`(?!${Hp})`,LD=`[^.${Ua}]`,qD=`${wE}*?`,EE={DOT_LITERAL:Ai,PLUS_LITERAL:CD,QMARK_LITERAL:TD,SLASH_LITERAL:Ua,ONE_CHAR:OD,QMARK:wE,END_ANCHOR:Mp,DOTS_SLASH:Hp,NO_DOT:kD,NO_DOTS:PD,NO_DOT_SLASH:FD,NO_DOTS_SLASH:ID,QMARK_NO_DOT:LD,STAR:qD,START_ANCHOR:SE},jD={...EE,SLASH_LITERAL:`[${pi}]`,QMARK:bE,STAR:`${bE}*?`,DOTS_SLASH:`${Ai}{1,2}(?:[${pi}]|$)`,NO_DOT:`(?!${Ai})`,NO_DOTS:`(?!(?:^|[${pi}])${Ai}{1,2}(?:[${pi}]|$))`,NO_DOT_SLASH:`(?!${Ai}{0,1}(?:[${pi}]|$))`,NO_DOTS_SLASH:`(?!${Ai}{1,2}(?:[${pi}]|$))`,QMARK_NO_DOT:`[^.${pi}]`,START_ANCHOR:`(?:^|[${pi}])`,END_ANCHOR:`(?:[${pi}]|$)`},$D={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};AE.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:$D,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:RD.sep,extglobChars(t){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?jD:EE}};});var za=R(vt=>{var BD=H("path"),DD=process.platform==="win32",{REGEX_BACKSLASH:ND,REGEX_REMOVE_BACKSLASH:UD,REGEX_SPECIAL_CHARS:zD,REGEX_SPECIAL_CHARS_GLOBAL:MD}=Os();vt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);vt.hasRegexChars=t=>zD.test(t);vt.isRegexChar=t=>t.length===1&&vt.hasRegexChars(t);vt.escapeRegex=t=>t.replace(MD,"\\$1");vt.toPosixSlashes=t=>t.replace(ND,"/");vt.removeBackslashes=t=>t.replace(UD,e=>e==="\\"?"":e);vt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};vt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:DD===!0||BD.sep==="\\";vt.escapeLast=(t,e,i)=>{let n=t.lastIndexOf(e,i);return n===-1?t:t[n-1]==="\\"?vt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};vt.removePrefix=(t,e={})=>{let i=t;return i.startsWith("./")&&(i=i.slice(2),e.prefix="./"),i};vt.wrapOutput=(t,e={},i={})=>{let n=i.contains?"":"^",s=i.contains?"":"$",r=`${n}(?:${t})${s}`;return e.negated===!0&&(r=`(?:^(?!${r}).*$)`),r};});var FE=R((hG,PE)=>{var _E=za(),{CHAR_ASTERISK:Wp,CHAR_AT:HD,CHAR_BACKWARD_SLASH:ks,CHAR_COMMA:WD,CHAR_DOT:Gp,CHAR_EXCLAMATION_MARK:Vp,CHAR_FORWARD_SLASH:kE,CHAR_LEFT_CURLY_BRACE:Kp,CHAR_LEFT_PARENTHESES:Jp,CHAR_LEFT_SQUARE_BRACKET:GD,CHAR_PLUS:VD,CHAR_QUESTION_MARK:RE,CHAR_RIGHT_CURLY_BRACE:KD,CHAR_RIGHT_PARENTHESES:CE,CHAR_RIGHT_SQUARE_BRACKET:JD}=Os(),TE=t=>t===kE||t===ks,OE=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1);},YD=(t,e)=>{let i=e||{},n=t.length-1,s=i.parts===!0||i.scanToEnd===!0,r=[],o=[],a=[],u=t,f=-1,c=0,d=0,h=!1,g=!1,y=!1,b=!1,A=!1,_=!1,S=!1,C=!1,I=!1,q=!1,J=0,W,B,j={value:"",depth:0,isGlob:!1},G=()=>f>=n,T=()=>u.charCodeAt(f+1),Y=()=>(W=B,u.charCodeAt(++f));for(;f0&&(re=u.slice(0,c),u=u.slice(c),d-=c),Z&&y===!0&&d>0?(Z=u.slice(0,d),k=u.slice(d)):y===!0?(Z="",k=u):Z=u,Z&&Z!==""&&Z!=="/"&&Z!==u&&TE(Z.charCodeAt(Z.length-1))&&(Z=Z.slice(0,-1)),i.unescape===!0&&(k&&(k=_E.removeBackslashes(k)),Z&&S===!0&&(Z=_E.removeBackslashes(Z)));let F={prefix:re,input:t,start:c,base:Z,glob:k,isBrace:h,isBracket:g,isGlob:y,isExtglob:b,isGlobstar:A,negated:C,negatedExtglob:I};if(i.tokens===!0&&(F.maxDepth=0,TE(B)||o.push(j),F.tokens=o),i.parts===!0||i.tokens===!0){let U;for(let M=0;M{var Ma=Os(),Ot=za(),{MAX_LENGTH:Ha,POSIX_REGEX_SOURCE:XD,REGEX_NON_SPECIAL_CHARS:QD,REGEX_SPECIAL_CHARS_BACKREF:ZD,REPLACEMENTS:IE}=Ma,eN=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let i=`[${t.join("-")}]`;return i},xr=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Yp=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=IE[t]||t;let i={...e},n=typeof i.maxLength=="number"?Math.min(Ha,i.maxLength):Ha,s=t.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);let r={type:"bos",value:"",output:i.prepend||""},o=[r],a=i.capture?"":"?:",u=Ot.isWindows(e),f=Ma.globChars(u),c=Ma.extglobChars(f),{DOT_LITERAL:d,PLUS_LITERAL:h,SLASH_LITERAL:g,ONE_CHAR:y,DOTS_SLASH:b,NO_DOT:A,NO_DOT_SLASH:_,NO_DOTS_SLASH:S,QMARK:C,QMARK_NO_DOT:I,STAR:q,START_ANCHOR:J}=f,W=Q=>`(${a}(?:(?!${J}${Q.dot?b:d}).)*?)`,B=i.dot?"":A,j=i.dot?C:I,G=i.bash===!0?W(i):q;i.capture&&(G=`(${G})`),typeof i.noext=="boolean"&&(i.noextglob=i.noext);let T={input:t,index:-1,start:0,dot:i.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=Ot.removePrefix(t,T),s=t.length;let Y=[],Z=[],re=[],k=r,F,U=()=>T.index===s-1,M=T.peek=(Q=1)=>t[T.index+Q],ae=T.advance=()=>t[++T.index]||"",Le=()=>t.slice(T.index+1),he=(Q="",we=0)=>{T.consumed+=Q,T.index+=we;},St=Q=>{T.output+=Q.output!=null?Q.output:Q.value,he(Q.value);},sn=()=>{let Q=1;for(;M()==="!"&&(M(2)!=="("||M(3)==="?");)ae(),T.start++,Q++;return Q%2===0?!1:(T.negated=!0,T.start++,!0)},ot=Q=>{T[Q]++,re.push(Q);},Oe=Q=>{T[Q]--,re.pop();},pe=Q=>{if(k.type==="globstar"){let we=T.braces>0&&(Q.type==="comma"||Q.type==="brace"),K=Q.extglob===!0||Y.length&&(Q.type==="pipe"||Q.type==="paren");Q.type!=="slash"&&Q.type!=="paren"&&!we&&!K&&(T.output=T.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=G,T.output+=k.output);}if(Y.length&&Q.type!=="paren"&&(Y[Y.length-1].inner+=Q.value),(Q.value||Q.output)&&St(Q),k&&k.type==="text"&&Q.type==="text"){k.value+=Q.value,k.output=(k.output||"")+Q.value;return}Q.prev=k,o.push(Q),k=Q;},ii=(Q,we)=>{let K={...c[we],conditions:1,inner:""};K.prev=k,K.parens=T.parens,K.output=T.output;let de=(i.capture?"(":"")+K.open;ot("parens"),pe({type:Q,value:we,output:T.output?"":y}),pe({type:"paren",extglob:!0,value:ae(),output:de}),Y.push(K);},qe=Q=>{let we=Q.close+(i.capture?")":""),K;if(Q.type==="negate"){let de=G;if(Q.inner&&Q.inner.length>1&&Q.inner.includes("/")&&(de=W(i)),(de!==G||U()||/^\)+$/.test(Le()))&&(we=Q.close=`)$))${de}`),Q.inner.includes("*")&&(K=Le())&&/^\.[^\\/.]+$/.test(K)){let Ee=Yp(K,{...e,fastpaths:!1}).output;we=Q.close=`)${Ee})${de})`;}Q.prev.type==="bos"&&(T.negatedExtglob=!0);}pe({type:"paren",extglob:!0,value:F,output:we}),Oe("parens");};if(i.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let Q=!1,we=t.replace(ZD,(K,de,Ee,Ke,ke,on)=>Ke==="\\"?(Q=!0,K):Ke==="?"?de?de+Ke+(ke?C.repeat(ke.length):""):on===0?j+(ke?C.repeat(ke.length):""):C.repeat(Ee.length):Ke==="."?d.repeat(Ee.length):Ke==="*"?de?de+Ke+(ke?G:""):G:de?K:`\\${K}`);return Q===!0&&(i.unescape===!0?we=we.replace(/\\/g,""):we=we.replace(/\\+/g,K=>K.length%2===0?"\\\\":K?"\\":"")),we===t&&i.contains===!0?(T.output=t,T):(T.output=Ot.wrapOutput(we,T,e),T)}for(;!U();){if(F=ae(),F==="\0")continue;if(F==="\\"){let K=M();if(K==="/"&&i.bash!==!0||K==="."||K===";")continue;if(!K){F+="\\",pe({type:"text",value:F});continue}let de=/^\\+/.exec(Le()),Ee=0;if(de&&de[0].length>2&&(Ee=de[0].length,T.index+=Ee,Ee%2!==0&&(F+="\\")),i.unescape===!0?F=ae():F+=ae(),T.brackets===0){pe({type:"text",value:F});continue}}if(T.brackets>0&&(F!=="]"||k.value==="["||k.value==="[^")){if(i.posix!==!1&&F===":"){let K=k.value.slice(1);if(K.includes("[")&&(k.posix=!0,K.includes(":"))){let de=k.value.lastIndexOf("["),Ee=k.value.slice(0,de),Ke=k.value.slice(de+2),ke=XD[Ke];if(ke){k.value=Ee+ke,T.backtrack=!0,ae(),!r.output&&o.indexOf(k)===1&&(r.output=y);continue}}}(F==="["&&M()!==":"||F==="-"&&M()==="]")&&(F=`\\${F}`),F==="]"&&(k.value==="["||k.value==="[^")&&(F=`\\${F}`),i.posix===!0&&F==="!"&&k.value==="["&&(F="^"),k.value+=F,St({value:F});continue}if(T.quotes===1&&F!=='"'){F=Ot.escapeRegex(F),k.value+=F,St({value:F});continue}if(F==='"'){T.quotes=T.quotes===1?0:1,i.keepQuotes===!0&&pe({type:"text",value:F});continue}if(F==="("){ot("parens"),pe({type:"paren",value:F});continue}if(F===")"){if(T.parens===0&&i.strictBrackets===!0)throw new SyntaxError(xr("opening","("));let K=Y[Y.length-1];if(K&&T.parens===K.parens+1){qe(Y.pop());continue}pe({type:"paren",value:F,output:T.parens?")":"\\)"}),Oe("parens");continue}if(F==="["){if(i.nobracket===!0||!Le().includes("]")){if(i.nobracket!==!0&&i.strictBrackets===!0)throw new SyntaxError(xr("closing","]"));F=`\\${F}`;}else ot("brackets");pe({type:"bracket",value:F});continue}if(F==="]"){if(i.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){pe({type:"text",value:F,output:`\\${F}`});continue}if(T.brackets===0){if(i.strictBrackets===!0)throw new SyntaxError(xr("opening","["));pe({type:"text",value:F,output:`\\${F}`});continue}Oe("brackets");let K=k.value.slice(1);if(k.posix!==!0&&K[0]==="^"&&!K.includes("/")&&(F=`/${F}`),k.value+=F,St({value:F}),i.literalBrackets===!1||Ot.hasRegexChars(K))continue;let de=Ot.escapeRegex(k.value);if(T.output=T.output.slice(0,-k.value.length),i.literalBrackets===!0){T.output+=de,k.value=de;continue}k.value=`(${a}${de}|${k.value})`,T.output+=k.value;continue}if(F==="{"&&i.nobrace!==!0){ot("braces");let K={type:"brace",value:F,output:"(",outputIndex:T.output.length,tokensIndex:T.tokens.length};Z.push(K),pe(K);continue}if(F==="}"){let K=Z[Z.length-1];if(i.nobrace===!0||!K){pe({type:"text",value:F,output:F});continue}let de=")";if(K.dots===!0){let Ee=o.slice(),Ke=[];for(let ke=Ee.length-1;ke>=0&&(o.pop(),Ee[ke].type!=="brace");ke--)Ee[ke].type!=="dots"&&Ke.unshift(Ee[ke].value);de=eN(Ke,i),T.backtrack=!0;}if(K.comma!==!0&&K.dots!==!0){let Ee=T.output.slice(0,K.outputIndex),Ke=T.tokens.slice(K.tokensIndex);K.value=K.output="\\{",F=de="\\}",T.output=Ee;for(let ke of Ke)T.output+=ke.output||ke.value;}pe({type:"brace",value:F,output:de}),Oe("braces"),Z.pop();continue}if(F==="|"){Y.length>0&&Y[Y.length-1].conditions++,pe({type:"text",value:F});continue}if(F===","){let K=F,de=Z[Z.length-1];de&&re[re.length-1]==="braces"&&(de.comma=!0,K="|"),pe({type:"comma",value:F,output:K});continue}if(F==="/"){if(k.type==="dot"&&T.index===T.start+1){T.start=T.index+1,T.consumed="",T.output="",o.pop(),k=r;continue}pe({type:"slash",value:F,output:g});continue}if(F==="."){if(T.braces>0&&k.type==="dot"){k.value==="."&&(k.output=d);let K=Z[Z.length-1];k.type="dots",k.output+=F,k.value+=F,K.dots=!0;continue}if(T.braces+T.parens===0&&k.type!=="bos"&&k.type!=="slash"){pe({type:"text",value:F,output:d});continue}pe({type:"dot",value:F,output:d});continue}if(F==="?"){if(!(k&&k.value==="(")&&i.noextglob!==!0&&M()==="("&&M(2)!=="?"){ii("qmark",F);continue}if(k&&k.type==="paren"){let de=M(),Ee=F;if(de==="<"&&!Ot.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(k.value==="("&&!/[!=<:]/.test(de)||de==="<"&&!/<([!=]|\w+>)/.test(Le()))&&(Ee=`\\${F}`),pe({type:"text",value:F,output:Ee});continue}if(i.dot!==!0&&(k.type==="slash"||k.type==="bos")){pe({type:"qmark",value:F,output:I});continue}pe({type:"qmark",value:F,output:C});continue}if(F==="!"){if(i.noextglob!==!0&&M()==="("&&(M(2)!=="?"||!/[!=<:]/.test(M(3)))){ii("negate",F);continue}if(i.nonegate!==!0&&T.index===0){sn();continue}}if(F==="+"){if(i.noextglob!==!0&&M()==="("&&M(2)!=="?"){ii("plus",F);continue}if(k&&k.value==="("||i.regex===!1){pe({type:"plus",value:F,output:h});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||T.parens>0){pe({type:"plus",value:F});continue}pe({type:"plus",value:h});continue}if(F==="@"){if(i.noextglob!==!0&&M()==="("&&M(2)!=="?"){pe({type:"at",extglob:!0,value:F,output:""});continue}pe({type:"text",value:F});continue}if(F!=="*"){(F==="$"||F==="^")&&(F=`\\${F}`);let K=QD.exec(Le());K&&(F+=K[0],T.index+=K[0].length),pe({type:"text",value:F});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=F,k.output=G,T.backtrack=!0,T.globstar=!0,he(F);continue}let Q=Le();if(i.noextglob!==!0&&/^\([^?]/.test(Q)){ii("star",F);continue}if(k.type==="star"){if(i.noglobstar===!0){he(F);continue}let K=k.prev,de=K.prev,Ee=K.type==="slash"||K.type==="bos",Ke=de&&(de.type==="star"||de.type==="globstar");if(i.bash===!0&&(!Ee||Q[0]&&Q[0]!=="/")){pe({type:"star",value:F,output:""});continue}let ke=T.braces>0&&(K.type==="comma"||K.type==="brace"),on=Y.length&&(K.type==="pipe"||K.type==="paren");if(!Ee&&K.type!=="paren"&&!ke&&!on){pe({type:"star",value:F,output:""});continue}for(;Q.slice(0,3)==="/**";){let Pi=t[T.index+4];if(Pi&&Pi!=="/")break;Q=Q.slice(3),he("/**",3);}if(K.type==="bos"&&U()){k.type="globstar",k.value+=F,k.output=W(i),T.output=k.output,T.globstar=!0,he(F);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&!Ke&&U()){T.output=T.output.slice(0,-(K.output+k.output).length),K.output=`(?:${K.output}`,k.type="globstar",k.output=W(i)+(i.strictSlashes?")":"|$)"),k.value+=F,T.globstar=!0,T.output+=K.output+k.output,he(F);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&Q[0]==="/"){let Pi=Q[1]!==void 0?"|$":"";T.output=T.output.slice(0,-(K.output+k.output).length),K.output=`(?:${K.output}`,k.type="globstar",k.output=`${W(i)}${g}|${g}${Pi})`,k.value+=F,T.output+=K.output+k.output,T.globstar=!0,he(F+ae()),pe({type:"slash",value:"/",output:""});continue}if(K.type==="bos"&&Q[0]==="/"){k.type="globstar",k.value+=F,k.output=`(?:^|${g}|${W(i)}${g})`,T.output=k.output,T.globstar=!0,he(F+ae()),pe({type:"slash",value:"/",output:""});continue}T.output=T.output.slice(0,-k.output.length),k.type="globstar",k.output=W(i),k.value+=F,T.output+=k.output,T.globstar=!0,he(F);continue}let we={type:"star",value:F,output:G};if(i.bash===!0){we.output=".*?",(k.type==="bos"||k.type==="slash")&&(we.output=B+we.output),pe(we);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&i.regex===!0){we.output=F,pe(we);continue}(T.index===T.start||k.type==="slash"||k.type==="dot")&&(k.type==="dot"?(T.output+=_,k.output+=_):i.dot===!0?(T.output+=S,k.output+=S):(T.output+=B,k.output+=B),M()!=="*"&&(T.output+=y,k.output+=y)),pe(we);}for(;T.brackets>0;){if(i.strictBrackets===!0)throw new SyntaxError(xr("closing","]"));T.output=Ot.escapeLast(T.output,"["),Oe("brackets");}for(;T.parens>0;){if(i.strictBrackets===!0)throw new SyntaxError(xr("closing",")"));T.output=Ot.escapeLast(T.output,"("),Oe("parens");}for(;T.braces>0;){if(i.strictBrackets===!0)throw new SyntaxError(xr("closing","}"));T.output=Ot.escapeLast(T.output,"{"),Oe("braces");}if(i.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket")&&pe({type:"maybe_slash",value:"",output:`${g}?`}),T.backtrack===!0){T.output="";for(let Q of T.tokens)T.output+=Q.output!=null?Q.output:Q.value,Q.suffix&&(T.output+=Q.suffix);}return T};Yp.fastpaths=(t,e)=>{let i={...e},n=typeof i.maxLength=="number"?Math.min(Ha,i.maxLength):Ha,s=t.length;if(s>n)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);t=IE[t]||t;let r=Ot.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:u,DOTS_SLASH:f,NO_DOT:c,NO_DOTS:d,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:y}=Ma.globChars(r),b=i.dot?d:c,A=i.dot?h:c,_=i.capture?"":"?:",S={negated:!1,prefix:""},C=i.bash===!0?".*?":g;i.capture&&(C=`(${C})`);let I=B=>B.noglobstar===!0?C:`(${_}(?:(?!${y}${B.dot?f:o}).)*?)`,q=B=>{switch(B){case"*":return `${b}${u}${C}`;case".*":return `${o}${u}${C}`;case"*.*":return `${b}${C}${o}${u}${C}`;case"*/*":return `${b}${C}${a}${u}${A}${C}`;case"**":return b+I(i);case"**/*":return `(?:${b}${I(i)}${a})?${A}${u}${C}`;case"**/*.*":return `(?:${b}${I(i)}${a})?${A}${C}${o}${u}${C}`;case"**/.*":return `(?:${b}${I(i)}${a})?${o}${u}${C}`;default:{let j=/^(.*?)\.(\w+)$/.exec(B);if(!j)return;let G=q(j[1]);return G?G+o+j[2]:void 0}}},J=Ot.removePrefix(t,S),W=q(J);return W&&i.strictSlashes!==!0&&(W+=`${a}?`),W};LE.exports=Yp;});var $E=R((yG,jE)=>{var tN=H("path"),iN=FE(),Xp=qE(),Qp=za(),nN=Os(),rN=t=>t&&typeof t=="object"&&!Array.isArray(t),Fe=(t,e,i=!1)=>{if(Array.isArray(t)){let c=t.map(h=>Fe(h,e,i));return h=>{for(let g of c){let y=g(h);if(y)return y}return !1}}let n=rN(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let s=e||{},r=Qp.isWindows(e),o=n?Fe.compileRe(t,e):Fe.makeRe(t,e,!1,!0),a=o.state;delete o.state;let u=()=>!1;if(s.ignore){let c={...e,ignore:null,onMatch:null,onResult:null};u=Fe(s.ignore,c,i);}let f=(c,d=!1)=>{let{isMatch:h,match:g,output:y}=Fe.test(c,o,e,{glob:t,posix:r}),b={glob:t,state:a,regex:o,posix:r,input:c,output:y,match:g,isMatch:h};return typeof s.onResult=="function"&&s.onResult(b),h===!1?(b.isMatch=!1,d?b:!1):u(c)?(typeof s.onIgnore=="function"&&s.onIgnore(b),b.isMatch=!1,d?b:!1):(typeof s.onMatch=="function"&&s.onMatch(b),d?b:!0)};return i&&(f.state=a),f};Fe.test=(t,e,i,{glob:n,posix:s}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return {isMatch:!1,output:""};let r=i||{},o=r.format||(s?Qp.toPosixSlashes:null),a=t===n,u=a&&o?o(t):t;return a===!1&&(u=o?o(t):t,a=u===n),(a===!1||r.capture===!0)&&(r.matchBase===!0||r.basename===!0?a=Fe.matchBase(t,e,i,s):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};Fe.matchBase=(t,e,i,n=Qp.isWindows(i))=>(e instanceof RegExp?e:Fe.makeRe(e,i)).test(tN.basename(t));Fe.isMatch=(t,e,i)=>Fe(e,i)(t);Fe.parse=(t,e)=>Array.isArray(t)?t.map(i=>Fe.parse(i,e)):Xp(t,{...e,fastpaths:!1});Fe.scan=(t,e)=>iN(t,e);Fe.compileRe=(t,e,i=!1,n=!1)=>{if(i===!0)return t.output;let s=e||{},r=s.contains?"":"^",o=s.contains?"":"$",a=`${r}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let u=Fe.toRegex(a,e);return n===!0&&(u.state=t),u};Fe.makeRe=(t,e={},i=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let s={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(s.output=Xp.fastpaths(t,e)),s.output||(s=Xp(t,e)),Fe.compileRe(s,e,i,n)};Fe.toRegex=(t,e)=>{try{let i=e||{};return new RegExp(t,i.flags||(i.nocase?"i":""))}catch(i){if(e&&e.debug===!0)throw i;return /$^/}};Fe.constants=nN;jE.exports=Fe;});var Zp=R((xG,BE)=>{BE.exports=$E();});var GE=R((vG,WE)=>{var Fs=H("fs"),{Readable:sN}=H("stream"),Ps=H("path"),{promisify:Ka}=H("util"),ef=Zp(),oN=Ka(Fs.readdir),aN=Ka(Fs.stat),DE=Ka(Fs.lstat),cN=Ka(Fs.realpath),lN="!",ME="READDIRP_RECURSIVE_ERROR",uN=new Set(["ENOENT","EPERM","EACCES","ELOOP",ME]),tf="files",HE="directories",Ga="files_directories",Wa="all",NE=[tf,HE,Ga,Wa],pN=t=>uN.has(t.code),[UE,fN]=process.versions.node.split(".").slice(0,2).map(t=>Number.parseInt(t,10)),dN=process.platform==="win32"&&(UE>10||UE===10&&fN>=5),zE=t=>{if(t!==void 0){if(typeof t=="function")return t;if(typeof t=="string"){let e=ef(t.trim());return i=>e(i.basename)}if(Array.isArray(t)){let e=[],i=[];for(let n of t){let s=n.trim();s.charAt(0)===lN?i.push(ef(s.slice(1))):e.push(ef(s));}return i.length>0?e.length>0?n=>e.some(s=>s(n.basename))&&!i.some(s=>s(n.basename)):n=>!i.some(s=>s(n.basename)):n=>e.some(s=>s(n.basename))}}},Va=class t extends sN{static get defaultOptions(){return {root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:tf,lstat:!1,depth:2147483648,alwaysStat:!1}}constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark||4096});let i={...t.defaultOptions,...e},{root:n,type:s}=i;this._fileFilter=zE(i.fileFilter),this._directoryFilter=zE(i.directoryFilter);let r=i.lstat?DE:aN;dN?this._stat=o=>r(o,{bigint:!0}):this._stat=r,this._maxDepth=i.depth,this._wantsDir=[HE,Ga,Wa].includes(s),this._wantsFile=[tf,Ga,Wa].includes(s),this._wantsEverything=s===Wa,this._root=Ps.resolve(n),this._isDirent="Dirent"in Fs&&!i.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0;}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let{path:i,depth:n,files:s=[]}=this.parent||{};if(s.length>0){let r=s.splice(0,e).map(o=>this._formatEntry(o,i));for(let o of await Promise.all(r)){if(this.destroyed)return;let a=await this._getEntryType(o);a==="directory"&&this._directoryFilter(o)?(n<=this._maxDepth&&this.parents.push(this._exploreDir(o.fullPath,n+1)),this._wantsDir&&(this.push(o),e--)):(a==="file"||this._includeAsFile(o))&&this._fileFilter(o)&&this._wantsFile&&(this.push(o),e--);}}else {let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(i){this.destroy(i);}finally{this.reading=!1;}}}async _exploreDir(e,i){let n;try{n=await oN(e,this._rdOptions);}catch(s){this._onError(s);}return {files:n,depth:i,path:e}}async _formatEntry(e,i){let n;try{let s=this._isDirent?e.name:e,r=Ps.resolve(Ps.join(i,s));n={path:Ps.relative(this._root,r),fullPath:r,basename:s},n[this._statsProp]=this._isDirent?e:await this._stat(r);}catch(s){this._onError(s);}return n}_onError(e){pN(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e);}async _getEntryType(e){let i=e&&e[this._statsProp];if(i){if(i.isFile())return "file";if(i.isDirectory())return "directory";if(i&&i.isSymbolicLink()){let n=e.fullPath;try{let s=await cN(n),r=await DE(s);if(r.isFile())return "file";if(r.isDirectory()){let o=s.length;if(n.startsWith(s)&&n.substr(o,1)===Ps.sep){let a=new Error(`Circular symlink detected: "${n}" points to "${s}"`);return a.code=ME,this._onError(a)}return "directory"}}catch(s){this._onError(s);}}}}_includeAsFile(e){let i=e&&e[this._statsProp];return i&&this._wantsEverything&&!i.isDirectory()}},vr=(t,e={})=>{let i=e.entryType||e.type;if(i==="both"&&(i=Ga),i&&(e.type=i),t){if(typeof t!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(i&&!NE.includes(i))throw new Error(`readdirp: Invalid type passed. Use one of ${NE.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=t,new Va(e)},mN=(t,e={})=>new Promise((i,n)=>{let s=[];vr(t,e).on("data",r=>s.push(r)).on("end",()=>i(s)).on("error",r=>n(r));});vr.promise=mN;vr.ReaddirpStream=Va;vr.default=vr;WE.exports=vr;});var nf=R((bG,VE)=>{VE.exports=function(t,e){if(typeof t!="string")throw new TypeError("expected path to be a string");if(t==="\\"||t==="/")return "/";var i=t.length;if(i<=1)return t;var n="";if(i>4&&t[3]==="\\"){var s=t[2];(s==="?"||s===".")&&t.slice(0,2)==="\\\\"&&(t=t.slice(2),n="//");}var r=t.split(/[/\\]+/);return e!==!1&&r[r.length-1]===""&&r.pop(),n+r.join("/")};});var ZE=R((XE,QE)=>{Object.defineProperty(XE,"__esModule",{value:!0});var YE=Zp(),hN=nf(),KE="!",gN={returnIndex:!1},yN=t=>Array.isArray(t)?t:[t],xN=(t,e)=>{if(typeof t=="function")return t;if(typeof t=="string"){let i=YE(t,e);return n=>t===n||i(n)}return t instanceof RegExp?i=>t.test(i):i=>!1},JE=(t,e,i,n)=>{let s=Array.isArray(i),r=s?i[0]:i;if(!s&&typeof r!="string")throw new TypeError("anymatch: second argument must be a string: got "+Object.prototype.toString.call(r));let o=hN(r,!1);for(let u=0;u{if(t==null)throw new TypeError("anymatch: specify first argument");let n=typeof i=="boolean"?{returnIndex:i}:i,s=n.returnIndex||!1,r=yN(t),o=r.filter(u=>typeof u=="string"&&u.charAt(0)===KE).map(u=>u.slice(1)).map(u=>YE(u,n)),a=r.filter(u=>typeof u!="string"||typeof u=="string"&&u.charAt(0)!==KE).map(u=>xN(u,n));return e==null?(u,f=!1)=>JE(a,o,u,typeof f=="boolean"?f:!1):JE(a,o,e,s)};rf.default=rf;QE.exports=rf;});var tA=R((wG,eA)=>{eA.exports=function(e){if(typeof e!="string"||e==="")return !1;for(var i;i=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(i[2])return !0;e=e.slice(i.index+i[0].length);}return !1};});var sf=R((SG,nA)=>{var vN=tA(),iA={"{":"}","(":")","[":"]"},bN=function(t){if(t[0]==="!")return !0;for(var e=0,i=-2,n=-2,s=-2,r=-2,o=-2;ee&&(o===-1||o>n||(o=t.indexOf("\\",e),o===-1||o>n)))||s!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(s=t.indexOf("}",e),s>e&&(o=t.indexOf("\\",e),o===-1||o>s))||r!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(r=t.indexOf(")",e),r>e&&(o=t.indexOf("\\",e),o===-1||o>r))||i!==-1&&t[e]==="("&&t[e+1]!=="|"&&(ii&&(o=t.indexOf("\\",i),o===-1||o>r))))return !0;if(t[e]==="\\"){var a=t[e+1];e+=2;var u=iA[a];if(u){var f=t.indexOf(u,e);f!==-1&&(e=f+1);}if(t[e]==="!")return !0}else e++;}return !1},wN=function(t){if(t[0]==="!")return !0;for(var e=0;e{var SN=sf(),EN=H("path").posix.dirname,AN=H("os").platform()==="win32",of="/",_N=/\\/g,RN=/[\{\[].*[\}\]]$/,CN=/(^|[^\\])([\{\[]|\([^\)]+$)/,TN=/\\([\!\*\?\|\[\]\(\)\{\}])/g;rA.exports=function(e,i){var n=Object.assign({flipBackslashes:!0},i);n.flipBackslashes&&AN&&e.indexOf(of)<0&&(e=e.replace(_N,of)),RN.test(e)&&(e+=of),e+="a";do e=EN(e);while(SN(e)||CN.test(e));return e.replace(TN,"$1")};});var Ja=R(Dt=>{Dt.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Dt.find=(t,e)=>t.nodes.find(i=>i.type===e);Dt.exceedsLimit=(t,e,i=1,n)=>n===!1||!Dt.isInteger(t)||!Dt.isInteger(e)?!1:(Number(e)-Number(t))/Number(i)>=n;Dt.escapeNode=(t,e=0,i)=>{let n=t.nodes[e];n&&(i&&n.type===i||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0);};Dt.encloseBrace=t=>t.type!=="brace"||t.commas>>0+t.ranges>>0?!1:(t.invalid=!0,!0);Dt.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:!(t.commas>>0+t.ranges>>0)||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Dt.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Dt.reduce=t=>t.reduce((e,i)=>(i.type==="text"&&e.push(i.value),i.type==="range"&&(i.type="text"),e),[]);Dt.flatten=(...t)=>{let e=[],i=n=>{for(let s=0;s{var oA=Ja();aA.exports=(t,e={})=>{let i=(n,s={})=>{let r=e.escapeInvalid&&oA.isInvalidBrace(s),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return (r||o)&&oA.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)a+=i(u);return a};return i(t)};});var lA=R((RG,cA)=>{cA.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1};});var xA=R((CG,yA)=>{var uA=lA(),_n=(t,e,i)=>{if(uA(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(uA(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...i};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let s=String(n.relaxZeros),r=String(n.shorthand),o=String(n.capture),a=String(n.wrap),u=t+":"+e+"="+s+r+o+a;if(_n.cache.hasOwnProperty(u))return _n.cache[u].result;let f=Math.min(t,e),c=Math.max(t,e);if(Math.abs(f-c)===1){let b=t+"|"+e;return n.capture?`(${b})`:n.wrap===!1?b:`(?:${b})`}let d=gA(t)||gA(e),h={min:t,max:e,a:f,b:c},g=[],y=[];if(d&&(h.isPadded=d,h.maxLen=String(h.max).length),f<0){let b=c<0?Math.abs(c):1;y=pA(b,Math.abs(f),h,n),f=h.a=0;}return c>=0&&(g=pA(f,c,h,n)),h.negatives=y,h.positives=g,h.result=ON(y,g),n.capture===!0?h.result=`(${h.result})`:n.wrap!==!1&&g.length+y.length>1&&(h.result=`(?:${h.result})`),_n.cache[u]=h,h.result};function ON(t,e,i){let n=af(t,e,"-",!1)||[],s=af(e,t,"",!1)||[],r=af(t,e,"-?",!0)||[];return n.concat(r).concat(s).join("|")}function kN(t,e){let i=1,n=1,s=dA(t,i),r=new Set([e]);for(;t<=s&&s<=e;)r.add(s),i+=1,s=dA(t,i);for(s=mA(e+1,n)-1;t1&&a.count.pop(),a.count.push(c.count[0]),a.string=a.pattern+hA(a.count),o=f+1;continue}i.isPadded&&(d=qN(f,i,n)),c.string=d+c.pattern+hA(c.count),r.push(c),o=f+1,a=c;}return r}function af(t,e,i,n,s){let r=[];for(let o of t){let{string:a}=o;!n&&!fA(e,"string",a)&&r.push(i+a),n&&fA(e,"string",a)&&r.push(i+a);}return r}function FN(t,e){let i=[];for(let n=0;ne?1:e>t?-1:0}function fA(t,e,i){return t.some(n=>n[e]===i)}function dA(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function mA(t,e){return t-t%Math.pow(10,e)}function hA(t){let[e=0,i=""]=t;return i||e>1?`{${e+(i?","+i:"")}}`:""}function LN(t,e,i){return `[${t}${e-t===1?"":"-"}${e}]`}function gA(t){return /^-?(0+)\d/.test(t)}function qN(t,e,i){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),s=i.relaxZeros!==!1;switch(n){case 0:return "";case 1:return s?"0?":"0";case 2:return s?"0{0,2}":"00";default:return s?`0{0,${n}}`:`0{${n}}`}}_n.cache={};_n.clearCache=()=>_n.cache={};yA.exports=_n;});var uf=R((TG,RA)=>{var jN=H("util"),wA=xA(),vA=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),$N=t=>e=>t===!0?Number(e):String(e),cf=t=>typeof t=="number"||typeof t=="string"&&t!=="",Is=t=>Number.isInteger(+t),lf=t=>{let e=`${t}`,i=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return !1;for(;e[++i]==="0";);return i>0},BN=(t,e,i)=>typeof t=="string"||typeof e=="string"?!0:i.stringify===!0,DN=(t,e,i)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0");}return i===!1?String(t):t},bA=(t,e)=>{let i=t[0]==="-"?"-":"";for(i&&(t=t.slice(1),e--);t.length{t.negatives.sort((o,a)=>oa?1:0),t.positives.sort((o,a)=>o a?1:0);let i=e.capture?"":"?:",n="",s="",r;return t.positives.length&&(n=t.positives.join("|")),t.negatives.length&&(s=`-(${i}${t.negatives.join("|")})`),n&&s?r=`${n}|${s}`:r=n||s,e.wrap?`(${i}${r})`:r},SA=(t,e,i,n)=>{if(i)return wA(t,e,{wrap:!1,...n});let s=String.fromCharCode(t);if(t===e)return s;let r=String.fromCharCode(e);return `[${s}-${r}]`},EA=(t,e,i)=>{if(Array.isArray(t)){let n=i.wrap===!0,s=i.capture?"":"?:";return n?`(${s}${t.join("|")})`:t.join("|")}return wA(t,e,i)},AA=(...t)=>new RangeError("Invalid range arguments: "+jN.inspect(...t)),_A=(t,e,i)=>{if(i.strictRanges===!0)throw AA([t,e]);return []},UN=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return []},zN=(t,e,i=1,n={})=>{let s=Number(t),r=Number(e);if(!Number.isInteger(s)||!Number.isInteger(r)){if(n.strictRanges===!0)throw AA([t,e]);return []}s===0&&(s=0),r===0&&(r=0);let o=s>r,a=String(t),u=String(e),f=String(i);i=Math.max(Math.abs(i),1);let c=lf(a)||lf(u)||lf(f),d=c?Math.max(a.length,u.length,f.length):0,h=c===!1&&BN(t,e,n)===!1,g=n.transform||$N(h);if(n.toRegex&&i===1)return SA(bA(t,d),bA(e,d),!0,n);let y={negatives:[],positives:[]},b=S=>y[S<0?"negatives":"positives"].push(Math.abs(S)),A=[],_=0;for(;o?s>=r:s<=r;)n.toRegex===!0&&i>1?b(s):A.push(DN(g(s,_),d,h)),s=o?s-i:s+i,_++;return n.toRegex===!0?i>1?NN(y,n):EA(A,null,{wrap:!1,...n}):A},MN=(t,e,i=1,n={})=>{if(!Is(t)&&t.length>1||!Is(e)&&e.length>1)return _A(t,e,n);let s=n.transform||(h=>String.fromCharCode(h)),r=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=r>o,u=Math.min(r,o),f=Math.max(r,o);if(n.toRegex&&i===1)return SA(u,f,!1,n);let c=[],d=0;for(;a?r>=o:r<=o;)c.push(s(r,d)),r=a?r-i:r+i,d++;return n.toRegex===!0?EA(c,null,{wrap:!1,options:n}):c},Xa=(t,e,i,n={})=>{if(e==null&&cf(t))return [t];if(!cf(t)||!cf(e))return _A(t,e,n);if(typeof i=="function")return Xa(t,e,1,{transform:i});if(vA(i))return Xa(t,e,0,i);let s={...n};return s.capture===!0&&(s.wrap=!0),i=i||s.step||1,Is(i)?Is(t)&&Is(e)?zN(t,e,i,s):MN(t,e,Math.max(Math.abs(i),1),s):i!=null&&!vA(i)?UN(i,s):Xa(t,e,1,i)};RA.exports=Xa;});var OA=R((OG,TA)=>{var HN=uf(),CA=Ja(),WN=(t,e={})=>{let i=(n,s={})=>{let r=CA.isInvalidBrace(s),o=n.invalid===!0&&e.escapeInvalid===!0,a=r===!0||o===!0,u=e.escapeInvalid===!0?"\\":"",f="";if(n.isOpen===!0||n.isClose===!0)return u+n.value;if(n.type==="open")return a?u+n.value:"(";if(n.type==="close")return a?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let c=CA.reduce(n.nodes),d=HN(...c,{...e,wrap:!1,toRegex:!0});if(d.length!==0)return c.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let c of n.nodes)f+=i(c,n);return f};return i(t)};TA.exports=WN;});var FA=R((kG,PA)=>{var GN=uf(),kA=Ya(),br=Ja(),Rn=(t="",e="",i=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return i?br.flatten(e).map(s=>`{${s}}`):e;for(let s of t)if(Array.isArray(s))for(let r of s)n.push(Rn(r,e,i));else for(let r of e)i===!0&&typeof r=="string"&&(r=`{${r}}`),n.push(Array.isArray(r)?Rn(s,r,i):s+r);return br.flatten(n)},VN=(t,e={})=>{let i=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(s,r={})=>{s.queue=[];let o=r,a=r.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(s.invalid||s.dollar){a.push(Rn(a.pop(),kA(s,e)));return}if(s.type==="brace"&&s.invalid!==!0&&s.nodes.length===2){a.push(Rn(a.pop(),["{}"]));return}if(s.nodes&&s.ranges>0){let d=br.reduce(s.nodes);if(br.exceedsLimit(...d,e.step,i))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let h=GN(...d,e);h.length===0&&(h=kA(s,e)),a.push(Rn(a.pop(),h)),s.nodes=[];return}let u=br.encloseBrace(s),f=s.queue,c=s;for(;c.type!=="brace"&&c.type!=="root"&&c.parent;)c=c.parent,f=c.queue;for(let d=0;d{IA.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
+`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"};});var DA=R((FG,BA)=>{var KN=Ya(),{MAX_LENGTH:qA,CHAR_BACKSLASH:pf,CHAR_BACKTICK:JN,CHAR_COMMA:YN,CHAR_DOT:XN,CHAR_LEFT_PARENTHESES:QN,CHAR_RIGHT_PARENTHESES:ZN,CHAR_LEFT_CURLY_BRACE:e3,CHAR_RIGHT_CURLY_BRACE:t3,CHAR_LEFT_SQUARE_BRACKET:jA,CHAR_RIGHT_SQUARE_BRACKET:$A,CHAR_DOUBLE_QUOTE:i3,CHAR_SINGLE_QUOTE:n3,CHAR_NO_BREAK_SPACE:r3,CHAR_ZERO_WIDTH_NOBREAK_SPACE:s3}=LA(),o3=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let i=e||{},n=typeof i.maxLength=="number"?Math.min(qA,i.maxLength):qA;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let s={type:"root",input:t,nodes:[]},r=[s],o=s,a=s,u=0,f=t.length,c=0,d=0,h,y=()=>t[c++],b=A=>{if(A.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&A.type==="text"){a.value+=A.value;return}return o.nodes.push(A),A.parent=o,A.prev=a,a=A,A};for(b({type:"bos"});c0){if(o.ranges>0){o.ranges=0;let A=o.nodes.shift();o.nodes=[A,{type:"text",value:KN(o)}];}b({type:"comma",value:h}),o.commas++;continue}if(h===XN&&d>0&&o.commas===0){let A=o.nodes;if(d===0||A.length===0){b({type:"text",value:h});continue}if(a.type==="dot"){if(o.range=[],a.value+=h,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){A.pop();let _=A[A.length-1];_.value+=a.value+h,a=_,o.ranges--;continue}b({type:"dot",value:h});continue}b({type:"text",value:h});}do if(o=r.pop(),o.type!=="root"){o.nodes.forEach(S=>{S.nodes||(S.type==="open"&&(S.isOpen=!0),S.type==="close"&&(S.isClose=!0),S.nodes||(S.type="text"),S.invalid=!0);});let A=r[r.length-1],_=A.nodes.indexOf(o);A.nodes.splice(_,1,...o.nodes);}while(r.length>0);return b({type:"eos"}),s};BA.exports=o3;});var zA=R((IG,UA)=>{var NA=Ya(),a3=OA(),c3=FA(),l3=DA(),kt=(t,e={})=>{let i=[];if(Array.isArray(t))for(let n of t){let s=kt.create(n,e);Array.isArray(s)?i.push(...s):i.push(s);}else i=[].concat(kt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(i=[...new Set(i)]),i};kt.parse=(t,e={})=>l3(t,e);kt.stringify=(t,e={})=>NA(typeof t=="string"?kt.parse(t,e):t,e);kt.compile=(t,e={})=>(typeof t=="string"&&(t=kt.parse(t,e)),a3(t,e));kt.expand=(t,e={})=>{typeof t=="string"&&(t=kt.parse(t,e));let i=c3(t,e);return e.noempty===!0&&(i=i.filter(Boolean)),e.nodupes===!0&&(i=[...new Set(i)]),i};kt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?kt.compile(t,e):kt.expand(t,e);UA.exports=kt;});var MA=R((LG,u3)=>{u3.exports=["3dm","3ds","3g2","3gp","7z","a","aac","adp","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];});var WA=R((qG,HA)=>{HA.exports=MA();});var VA=R((jG,GA)=>{var p3=H("path"),f3=WA(),d3=new Set(f3);GA.exports=t=>d3.has(p3.extname(t).slice(1).toLowerCase());});var Qa=R(se=>{var{sep:m3}=H("path"),{platform:ff}=process,h3=H("os");se.EV_ALL="all";se.EV_READY="ready";se.EV_ADD="add";se.EV_CHANGE="change";se.EV_ADD_DIR="addDir";se.EV_UNLINK="unlink";se.EV_UNLINK_DIR="unlinkDir";se.EV_RAW="raw";se.EV_ERROR="error";se.STR_DATA="data";se.STR_END="end";se.STR_CLOSE="close";se.FSEVENT_CREATED="created";se.FSEVENT_MODIFIED="modified";se.FSEVENT_DELETED="deleted";se.FSEVENT_MOVED="moved";se.FSEVENT_CLONED="cloned";se.FSEVENT_UNKNOWN="unknown";se.FSEVENT_TYPE_FILE="file";se.FSEVENT_TYPE_DIRECTORY="directory";se.FSEVENT_TYPE_SYMLINK="symlink";se.KEY_LISTENERS="listeners";se.KEY_ERR="errHandlers";se.KEY_RAW="rawEmitters";se.HANDLER_KEYS=[se.KEY_LISTENERS,se.KEY_ERR,se.KEY_RAW];se.DOT_SLASH=`.${m3}`;se.BACK_SLASH_RE=/\\/g;se.DOUBLE_SLASH_RE=/\/\//;se.SLASH_OR_BACK_SLASH_RE=/[/\\]/;se.DOT_RE=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/;se.REPLACER_RE=/^\.[/\\]/;se.SLASH="/";se.SLASH_SLASH="//";se.BRACE_START="{";se.BANG="!";se.ONE_DOT=".";se.TWO_DOTS="..";se.STAR="*";se.GLOBSTAR="**";se.ROOT_GLOBSTAR="/**/*";se.SLASH_GLOBSTAR="/**";se.DIR_SUFFIX="Dir";se.ANYMATCH_OPTS={dot:!0};se.STRING_TYPE="string";se.FUNCTION_TYPE="function";se.EMPTY_STR="";se.EMPTY_FN=()=>{};se.IDENTITY_FN=t=>t;se.isWindows=ff==="win32";se.isMacos=ff==="darwin";se.isLinux=ff==="linux";se.isIBMi=h3.type()==="OS400";});var ZA=R((BG,QA)=>{var _i=H("fs"),He=H("path"),{promisify:$s}=H("util"),g3=VA(),{isWindows:y3,isLinux:x3,EMPTY_FN:v3,EMPTY_STR:b3,KEY_LISTENERS:wr,KEY_ERR:df,KEY_RAW:Ls,HANDLER_KEYS:w3,EV_CHANGE:ec,EV_ADD:Za,EV_ADD_DIR:S3,EV_ERROR:JA,STR_DATA:E3,STR_END:A3,BRACE_START:_3,STAR:R3}=Qa(),C3="watch",T3=$s(_i.open),YA=$s(_i.stat),O3=$s(_i.lstat),k3=$s(_i.close),mf=$s(_i.realpath),P3={lstat:O3,stat:YA},gf=(t,e)=>{t instanceof Set?t.forEach(e):e(t);},qs=(t,e,i)=>{let n=t[e];n instanceof Set||(t[e]=n=new Set([n])),n.add(i);},F3=t=>e=>{let i=t[e];i instanceof Set?i.clear():delete t[e];},js=(t,e,i)=>{let n=t[e];n instanceof Set?n.delete(i):n===i&&delete t[e];},XA=t=>t instanceof Set?t.size===0:!t,tc=new Map;function KA(t,e,i,n,s){let r=(o,a)=>{i(t),s(o,a,{watchedPath:t}),a&&t!==a&&ic(He.resolve(t,a),wr,He.join(t,a));};try{return _i.watch(t,e,r)}catch(o){n(o);}}var ic=(t,e,i,n,s)=>{let r=tc.get(t);r&&gf(r[e],o=>{o(i,n,s);});},I3=(t,e,i,n)=>{let{listener:s,errHandler:r,rawEmitter:o}=n,a=tc.get(e),u;if(!i.persistent)return u=KA(t,i,s,r,o),u.close.bind(u);if(a)qs(a,wr,s),qs(a,df,r),qs(a,Ls,o);else {if(u=KA(t,i,ic.bind(null,e,wr),r,ic.bind(null,e,Ls)),!u)return;u.on(JA,async f=>{let c=ic.bind(null,e,df);if(a.watcherUnusable=!0,y3&&f.code==="EPERM")try{let d=await T3(t,"r");await k3(d),c(f);}catch{}else c(f);}),a={listeners:s,errHandlers:r,rawEmitters:o,watcher:u},tc.set(e,a);}return ()=>{js(a,wr,s),js(a,df,r),js(a,Ls,o),XA(a.listeners)&&(a.watcher.close(),tc.delete(e),w3.forEach(F3(a)),a.watcher=void 0,Object.freeze(a));}},hf=new Map,L3=(t,e,i,n)=>{let {listener:s,rawEmitter:r}=n,o=hf.get(e),f=o&&o.options;return f&&(f.persistenti.interval)&&(_i.unwatchFile(e),o=void 0),o?(qs(o,wr,s),qs(o,Ls,r)):(o={listeners:s,rawEmitters:r,options:i,watcher:_i.watchFile(e,i,(c,d)=>{gf(o.rawEmitters,g=>{g(ec,e,{curr:c,prev:d});});let h=c.mtimeMs;(c.size!==d.size||h>d.mtimeMs||h===0)&&gf(o.listeners,g=>g(t,c));})},hf.set(e,o)),()=>{js(o,wr,s),js(o,Ls,r),XA(o.listeners)&&(hf.delete(e),_i.unwatchFile(e),o.options=o.watcher=void 0,Object.freeze(o));}},yf=class{constructor(e){this.fsw=e,this._boundHandleError=i=>e._handleError(i);}_watchWithNodeFs(e,i){let n=this.fsw.options,s=He.dirname(e),r=He.basename(e);this.fsw._getWatchedDir(s).add(r);let a=He.resolve(e),u={persistent:n.persistent};i||(i=v3);let f;return n.usePolling?(u.interval=n.enableBinaryInterval&&g3(r)?n.binaryInterval:n.interval,f=L3(e,a,u,{listener:i,rawEmitter:this.fsw._emitRaw})):f=I3(e,a,u,{listener:i,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),f}_handleFile(e,i,n){if(this.fsw.closed)return;let s=He.dirname(e),r=He.basename(e),o=this.fsw._getWatchedDir(s),a=i;if(o.has(r))return;let u=async(c,d)=>{if(this.fsw._throttle(C3,e,5)){if(!d||d.mtimeMs===0)try{let h=await YA(e);if(this.fsw.closed)return;let g=h.atimeMs,y=h.mtimeMs;(!g||g<=y||y!==a.mtimeMs)&&this.fsw._emit(ec,e,h),x3&&a.ino!==h.ino?(this.fsw._closeFile(c),a=h,this.fsw._addPathCloser(c,this._watchWithNodeFs(e,u))):a=h;}catch{this.fsw._remove(s,r);}else if(o.has(r)){let h=d.atimeMs,g=d.mtimeMs;(!h||h<=g||g!==a.mtimeMs)&&this.fsw._emit(ec,e,d),a=d;}}},f=this._watchWithNodeFs(e,u);if(!(n&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(Za,e,0))return;this.fsw._emit(Za,e,i);}return f}async _handleSymlink(e,i,n,s){if(this.fsw.closed)return;let r=e.fullPath,o=this.fsw._getWatchedDir(i);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await mf(n);}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(o.has(s)?this.fsw._symlinkPaths.get(r)!==a&&(this.fsw._symlinkPaths.set(r,a),this.fsw._emit(ec,n,e.stats)):(o.add(s),this.fsw._symlinkPaths.set(r,a),this.fsw._emit(Za,n,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(r))return !0;this.fsw._symlinkPaths.set(r,!0);}_handleRead(e,i,n,s,r,o,a){if(e=He.join(e,b3),!n.hasGlob&&(a=this.fsw._throttle("readdir",e,1e3),!a))return;let u=this.fsw._getWatchedDir(n.path),f=new Set,c=this.fsw._readdirp(e,{fileFilter:d=>n.filterPath(d),directoryFilter:d=>n.filterDir(d),depth:0}).on(E3,async d=>{if(this.fsw.closed){c=void 0;return}let h=d.path,g=He.join(e,h);if(f.add(h),!(d.stats.isSymbolicLink()&&await this._handleSymlink(d,e,g,h))){if(this.fsw.closed){c=void 0;return}(h===s||!s&&!u.has(h))&&(this.fsw._incrReadyCount(),g=He.join(r,He.relative(r,g)),this._addToNodeFs(g,i,n,o+1));}}).on(JA,this._boundHandleError);return new Promise(d=>c.once(A3,()=>{if(this.fsw.closed){c=void 0;return}let h=a?a.clear():!1;d(),u.getChildren().filter(g=>g!==e&&!f.has(g)&&(!n.hasGlob||n.filterPath({fullPath:He.resolve(e,g)}))).forEach(g=>{this.fsw._remove(e,g);}),c=void 0,h&&this._handleRead(e,!1,n,s,r,o,a);}))}async _handleDir(e,i,n,s,r,o,a){let u=this.fsw._getWatchedDir(He.dirname(e)),f=u.has(He.basename(e));!(n&&this.fsw.options.ignoreInitial)&&!r&&!f&&(!o.hasGlob||o.globFilter(e))&&this.fsw._emit(S3,e,i),u.add(He.basename(e)),this.fsw._getWatchedDir(e);let c,d,h=this.fsw.options.depth;if((h==null||s<=h)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(e,n,o,r,e,s,c),this.fsw.closed))return;d=this._watchWithNodeFs(e,(g,y)=>{y&&y.mtimeMs===0||this._handleRead(g,!1,o,r,e,s,c);});}return d}async _addToNodeFs(e,i,n,s,r){let o=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return o(),!1;let a=this.fsw._getWatchHelpers(e,s);!a.hasGlob&&n&&(a.hasGlob=n.hasGlob,a.globFilter=n.globFilter,a.filterPath=u=>n.filterPath(u),a.filterDir=u=>n.filterDir(u));try{let u=await P3[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,u))return o(),!1;let f=this.fsw.options.followSymlinks&&!e.includes(R3)&&!e.includes(_3),c;if(u.isDirectory()){let d=He.resolve(e),h=f?await mf(e):e;if(this.fsw.closed||(c=await this._handleDir(a.watchPath,u,i,s,r,a,h),this.fsw.closed))return;d!==h&&h!==void 0&&this.fsw._symlinkPaths.set(d,h);}else if(u.isSymbolicLink()){let d=f?await mf(e):e;if(this.fsw.closed)return;let h=He.dirname(a.watchPath);if(this.fsw._getWatchedDir(h).add(a.watchPath),this.fsw._emit(Za,a.watchPath,u),c=await this._handleDir(h,u,i,s,e,a,d),this.fsw.closed)return;d!==void 0&&this.fsw._symlinkPaths.set(He.resolve(e),d);}else c=this._handleFile(a.watchPath,u,i);return o(),this.fsw._addPathCloser(e,c),!1}catch(u){if(this.fsw._handleError(u))return o(),e}}};QA.exports=yf;});var o_=R((DG,_f)=>{var Ef=H("fs"),We=H("path"),{promisify:Af}=H("util"),Sr;try{Sr=H("fsevents");}catch(t){process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR&&console.error(t);}if(Sr){let t=process.version.match(/v(\d+)\.(\d+)/);if(t&&t[1]&&t[2]){let e=Number.parseInt(t[1],10),i=Number.parseInt(t[2],10);e===8&&i<16&&(Sr=void 0);}}var{EV_ADD:xf,EV_CHANGE:q3,EV_ADD_DIR:e_,EV_UNLINK:nc,EV_ERROR:j3,STR_DATA:$3,STR_END:B3,FSEVENT_CREATED:D3,FSEVENT_MODIFIED:N3,FSEVENT_DELETED:U3,FSEVENT_MOVED:z3,FSEVENT_UNKNOWN:M3,FSEVENT_TYPE_FILE:H3,FSEVENT_TYPE_DIRECTORY:Bs,FSEVENT_TYPE_SYMLINK:s_,ROOT_GLOBSTAR:t_,DIR_SUFFIX:W3,DOT_SLASH:i_,FUNCTION_TYPE:vf,EMPTY_FN:G3,IDENTITY_FN:V3}=Qa(),K3=t=>isNaN(t)?{}:{depth:t},wf=Af(Ef.stat),J3=Af(Ef.lstat),n_=Af(Ef.realpath),Y3={stat:wf,lstat:J3},Cn=new Map,X3=10,Q3=new Set([69888,70400,71424,72704,73472,131328,131840,262912]),Z3=(t,e)=>({stop:Sr.watch(t,e)});function eU(t,e,i,n){let s=We.extname(e)?We.dirname(e):e,r=We.dirname(s),o=Cn.get(s);tU(r)&&(s=r);let a=We.resolve(t),u=a!==e,f=(d,h,g)=>{u&&(d=d.replace(e,a)),(d===a||!d.indexOf(a+We.sep))&&i(d,h,g);},c=!1;for(let d of Cn.keys())if(e.indexOf(We.resolve(d)+We.sep)===0){s=d,o=Cn.get(s),c=!0;break}return o||c?o.listeners.add(f):(o={listeners:new Set([f]),rawEmitter:n,watcher:Z3(s,(d,h)=>{if(!o.listeners.size)return;let g=Sr.getInfo(d,h);o.listeners.forEach(y=>{y(d,h,g);}),o.rawEmitter(g.event,d,g);})},Cn.set(s,o)),()=>{let d=o.listeners;if(d.delete(f),!d.size&&(Cn.delete(s),o.watcher))return o.watcher.stop().then(()=>{o.rawEmitter=o.watcher=void 0,Object.freeze(o);})}}var tU=t=>{let e=0;for(let i of Cn.keys())if(i.indexOf(t)===0&&(e++,e>=X3))return !0;return !1},iU=()=>Sr&&Cn.size<128,bf=(t,e)=>{let i=0;for(;!t.indexOf(e)&&(t=We.dirname(t))!==e;)i++;return i},r_=(t,e)=>t.type===Bs&&e.isDirectory()||t.type===s_&&e.isSymbolicLink()||t.type===H3&&e.isFile(),Sf=class{constructor(e){this.fsw=e;}checkIgnored(e,i){let n=this.fsw._ignoredPaths;if(this.fsw._isIgnored(e,i))return n.add(e),i&&i.isDirectory()&&n.add(e+t_),!0;n.delete(e),n.delete(e+t_);}addOrChange(e,i,n,s,r,o,a,u){let f=r.has(o)?q3:xf;this.handleEvent(f,e,i,n,s,r,o,a,u);}async checkExists(e,i,n,s,r,o,a,u){try{let f=await wf(e);if(this.fsw.closed)return;r_(a,f)?this.addOrChange(e,i,n,s,r,o,a,u):this.handleEvent(nc,e,i,n,s,r,o,a,u);}catch(f){f.code==="EACCES"?this.addOrChange(e,i,n,s,r,o,a,u):this.handleEvent(nc,e,i,n,s,r,o,a,u);}}handleEvent(e,i,n,s,r,o,a,u,f){if(!(this.fsw.closed||this.checkIgnored(i)))if(e===nc){let c=u.type===Bs;(c||o.has(a))&&this.fsw._remove(r,a,c);}else {if(e===xf){if(u.type===Bs&&this.fsw._getWatchedDir(i),u.type===s_&&f.followSymlinks){let d=f.depth===void 0?void 0:bf(n,s)+1;return this._addToFsEvents(i,!1,!0,d)}this.fsw._getWatchedDir(r).add(a);}let c=u.type===Bs?e+W3:e;this.fsw._emit(c,i),c===e_&&this._addToFsEvents(i,!1,!0);}}_watchWithFsEvents(e,i,n,s){if(this.fsw.closed||this.fsw._isIgnored(e))return;let r=this.fsw.options,a=eU(e,i,async(u,f,c)=>{if(this.fsw.closed||r.depth!==void 0&&bf(u,i)>r.depth)return;let d=n(We.join(e,We.relative(e,u)));if(s&&!s(d))return;let h=We.dirname(d),g=We.basename(d),y=this.fsw._getWatchedDir(c.type===Bs?d:h);if(Q3.has(f)||c.event===M3)if(typeof r.ignored===vf){let b;try{b=await wf(d);}catch{}if(this.fsw.closed||this.checkIgnored(d,b))return;r_(c,b)?this.addOrChange(d,u,i,h,y,g,c,r):this.handleEvent(nc,d,u,i,h,y,g,c,r);}else this.checkExists(d,u,i,h,y,g,c,r);else switch(c.event){case D3:case N3:return this.addOrChange(d,u,i,h,y,g,c,r);case U3:case z3:return this.checkExists(d,u,i,h,y,g,c,r)}},this.fsw._emitRaw);return this.fsw._emitReady(),a}async _handleFsEventsSymlink(e,i,n,s){if(!(this.fsw.closed||this.fsw._symlinkPaths.has(i))){this.fsw._symlinkPaths.set(i,!0),this.fsw._incrReadyCount();try{let r=await n_(e);if(this.fsw.closed)return;if(this.fsw._isIgnored(r))return this.fsw._emitReady();this.fsw._incrReadyCount(),this._addToFsEvents(r||e,o=>{let a=e;return r&&r!==i_?a=o.replace(r,e):o!==i_&&(a=We.join(e,o)),n(a)},!1,s);}catch(r){if(this.fsw._handleError(r))return this.fsw._emitReady()}}}emitAdd(e,i,n,s,r){let o=n(e),a=i.isDirectory(),u=this.fsw._getWatchedDir(We.dirname(o)),f=We.basename(o);a&&this.fsw._getWatchedDir(o),!u.has(f)&&(u.add(f),(!s.ignoreInitial||r===!0)&&this.fsw._emit(a?e_:xf,o,i));}initWatch(e,i,n,s){if(this.fsw.closed)return;let r=this._watchWithFsEvents(n.watchPath,We.resolve(e||n.watchPath),s,n.globFilter);this.fsw._addPathCloser(i,r);}async _addToFsEvents(e,i,n,s){if(this.fsw.closed)return;let r=this.fsw.options,o=typeof i===vf?i:V3,a=this.fsw._getWatchHelpers(e);try{let u=await Y3[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,u))throw null;if(u.isDirectory()){if(a.globFilter||this.emitAdd(o(e),u,o,r,n),s&&s>r.depth)return;this.fsw._readdirp(a.watchPath,{fileFilter:f=>a.filterPath(f),directoryFilter:f=>a.filterDir(f),...K3(r.depth-(s||0))}).on($3,f=>{if(this.fsw.closed||f.stats.isDirectory()&&!a.filterPath(f))return;let c=We.join(a.watchPath,f.path),{fullPath:d}=f;if(a.followSymlinks&&f.stats.isSymbolicLink()){let h=r.depth===void 0?void 0:bf(c,We.resolve(a.watchPath))+1;this._handleFsEventsSymlink(c,d,o,h);}else this.emitAdd(c,f.stats,o,r,n);}).on(j3,G3).on(B3,()=>{this.fsw._emitReady();});}else this.emitAdd(a.watchPath,u,o,r,n),this.fsw._emitReady();}catch(u){(!u||this.fsw._handleError(u))&&(this.fsw._emitReady(),this.fsw._emitReady());}if(r.persistent&&n!==!0)if(typeof i===vf)this.initWatch(void 0,e,a,o);else {let u;try{u=await n_(a.watchPath);}catch{}this.initWatch(u,e,a,o);}}};_f.exports=Sf;_f.exports.canUse=iU;});var y_=R(Nf=>{var{EventEmitter:nU}=H("events"),Bf=H("fs"),be=H("path"),{promisify:d_}=H("util"),rU=GE(),Pf=ZE().default,sU=sA(),Rf=sf(),oU=zA(),aU=nf(),cU=ZA(),a_=o_(),{EV_ALL:Cf,EV_READY:lU,EV_ADD:rc,EV_CHANGE:Ds,EV_UNLINK:c_,EV_ADD_DIR:uU,EV_UNLINK_DIR:pU,EV_RAW:fU,EV_ERROR:Tf,STR_CLOSE:dU,STR_END:mU,BACK_SLASH_RE:hU,DOUBLE_SLASH_RE:l_,SLASH_OR_BACK_SLASH_RE:gU,DOT_RE:yU,REPLACER_RE:xU,SLASH:Of,SLASH_SLASH:vU,BRACE_START:bU,BANG:Ff,ONE_DOT:m_,TWO_DOTS:wU,GLOBSTAR:SU,SLASH_GLOBSTAR:kf,ANYMATCH_OPTS:If,STRING_TYPE:Df,FUNCTION_TYPE:EU,EMPTY_STR:Lf,EMPTY_FN:AU,isWindows:_U,isMacos:RU,isIBMi:CU}=Qa(),TU=d_(Bf.stat),OU=d_(Bf.readdir),qf=(t=[])=>Array.isArray(t)?t:[t],h_=(t,e=[])=>(t.forEach(i=>{Array.isArray(i)?h_(i,e):e.push(i);}),e),u_=t=>{let e=h_(qf(t));if(!e.every(i=>typeof i===Df))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(g_)},p_=t=>{let e=t.replace(hU,Of),i=!1;for(e.startsWith(vU)&&(i=!0);e.match(l_);)e=e.replace(l_,Of);return i&&(e=Of+e),e},g_=t=>p_(be.normalize(p_(t))),f_=(t=Lf)=>e=>typeof e!==Df?e:g_(be.isAbsolute(e)?e:be.join(t,e)),kU=(t,e)=>be.isAbsolute(t)?t:t.startsWith(Ff)?Ff+be.join(e,t.slice(1)):be.join(e,t),Yt=(t,e)=>t[e]===void 0,jf=class{constructor(e,i){this.path=e,this._removeWatcher=i,this.items=new Set;}add(e){let{items:i}=this;i&&e!==m_&&e!==wU&&i.add(e);}async remove(e){let{items:i}=this;if(!i||(i.delete(e),i.size>0))return;let n=this.path;try{await OU(n);}catch{this._removeWatcher&&this._removeWatcher(be.dirname(n),be.basename(n));}}has(e){let{items:i}=this;if(i)return i.has(e)}getChildren(){let{items:e}=this;if(e)return [...e.values()]}dispose(){this.items.clear(),delete this.path,delete this._removeWatcher,delete this.items,Object.freeze(this);}},PU="stat",FU="lstat",$f=class{constructor(e,i,n,s){this.fsw=s,this.path=e=e.replace(xU,Lf),this.watchPath=i,this.fullWatchPath=be.resolve(i),this.hasGlob=i!==e,e===Lf&&(this.hasGlob=!1),this.globSymlink=this.hasGlob&&n?void 0:!1,this.globFilter=this.hasGlob?Pf(e,void 0,If):!1,this.dirParts=this.getDirParts(e),this.dirParts.forEach(r=>{r.length>1&&r.pop();}),this.followSymlinks=n,this.statMethod=n?PU:FU;}checkGlobSymlink(e){return this.globSymlink===void 0&&(this.globSymlink=e.fullParentDir===this.fullWatchPath?!1:{realPath:e.fullParentDir,linkPath:this.fullWatchPath}),this.globSymlink?e.fullPath.replace(this.globSymlink.realPath,this.globSymlink.linkPath):e.fullPath}entryPath(e){return be.join(this.watchPath,be.relative(this.watchPath,this.checkGlobSymlink(e)))}filterPath(e){let{stats:i}=e;if(i&&i.isSymbolicLink())return this.filterDir(e);let n=this.entryPath(e);return (this.hasGlob&&typeof this.globFilter===EU?this.globFilter(n):!0)&&this.fsw._isntIgnored(n,i)&&this.fsw._hasReadPermissions(i)}getDirParts(e){if(!this.hasGlob)return [];let i=[];return (e.includes(bU)?oU.expand(e):[e]).forEach(s=>{i.push(be.relative(this.watchPath,s).split(gU));}),i}filterDir(e){if(this.hasGlob){let i=this.getDirParts(this.checkGlobSymlink(e)),n=!1;this.unmatchedGlob=!this.dirParts.some(s=>s.every((r,o)=>(r===SU&&(n=!0),n||!i[0][o]||Pf(r,i[0][o],If))));}return !this.unmatchedGlob&&this.fsw._isntIgnored(this.entryPath(e),e.stats)}},sc=class extends nU{constructor(e){super();let i={};e&&Object.assign(i,e),this._watched=new Map,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._symlinkPaths=new Map,this._streams=new Set,this.closed=!1,Yt(i,"persistent")&&(i.persistent=!0),Yt(i,"ignoreInitial")&&(i.ignoreInitial=!1),Yt(i,"ignorePermissionErrors")&&(i.ignorePermissionErrors=!1),Yt(i,"interval")&&(i.interval=100),Yt(i,"binaryInterval")&&(i.binaryInterval=300),Yt(i,"disableGlobbing")&&(i.disableGlobbing=!1),i.enableBinaryInterval=i.binaryInterval!==i.interval,Yt(i,"useFsEvents")&&(i.useFsEvents=!i.usePolling),a_.canUse()||(i.useFsEvents=!1),Yt(i,"usePolling")&&!i.useFsEvents&&(i.usePolling=RU),CU&&(i.usePolling=!0);let s=process.env.CHOKIDAR_USEPOLLING;if(s!==void 0){let u=s.toLowerCase();u==="false"||u==="0"?i.usePolling=!1:u==="true"||u==="1"?i.usePolling=!0:i.usePolling=!!u;}let r=process.env.CHOKIDAR_INTERVAL;r&&(i.interval=Number.parseInt(r,10)),Yt(i,"atomic")&&(i.atomic=!i.usePolling&&!i.useFsEvents),i.atomic&&(this._pendingUnlinks=new Map),Yt(i,"followSymlinks")&&(i.followSymlinks=!0),Yt(i,"awaitWriteFinish")&&(i.awaitWriteFinish=!1),i.awaitWriteFinish===!0&&(i.awaitWriteFinish={});let o=i.awaitWriteFinish;o&&(o.stabilityThreshold||(o.stabilityThreshold=2e3),o.pollInterval||(o.pollInterval=100),this._pendingWrites=new Map),i.ignored&&(i.ignored=qf(i.ignored));let a=0;this._emitReady=()=>{a++,a>=this._readyCount&&(this._emitReady=AU,this._readyEmitted=!0,process.nextTick(()=>this.emit(lU)));},this._emitRaw=(...u)=>this.emit(fU,...u),this._readyEmitted=!1,this.options=i,i.useFsEvents?this._fsEventsHandler=new a_(this):this._nodeFsHandler=new cU(this),Object.freeze(i);}add(e,i,n){let{cwd:s,disableGlobbing:r}=this.options;this.closed=!1;let o=u_(e);return s&&(o=o.map(a=>{let u=kU(a,s);return r||!Rf(a)?u:aU(u)})),o=o.filter(a=>a.startsWith(Ff)?(this._ignoredPaths.add(a.slice(1)),!1):(this._ignoredPaths.delete(a),this._ignoredPaths.delete(a+kf),this._userIgnored=void 0,!0)),this.options.useFsEvents&&this._fsEventsHandler?(this._readyCount||(this._readyCount=o.length),this.options.persistent&&(this._readyCount*=2),o.forEach(a=>this._fsEventsHandler._addToFsEvents(a))):(this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let u=await this._nodeFsHandler._addToNodeFs(a,!n,0,0,i);return u&&this._emitReady(),u})).then(a=>{this.closed||a.filter(u=>u).forEach(u=>{this.add(be.dirname(u),be.basename(i||u));});})),this}unwatch(e){if(this.closed)return this;let i=u_(e),{cwd:n}=this.options;return i.forEach(s=>{!be.isAbsolute(s)&&!this._closers.has(s)&&(n&&(s=be.join(n,s)),s=be.resolve(s)),this._closePath(s),this._ignoredPaths.add(s),this._watched.has(s)&&this._ignoredPaths.add(s+kf),this._userIgnored=void 0;}),this}close(){if(this.closed)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(i=>i.forEach(n=>{let s=n();s instanceof Promise&&e.push(s);})),this._streams.forEach(i=>i.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(i=>i.dispose()),["closers","watched","streams","symlinkPaths","throttled"].forEach(i=>{this[`_${i}`].clear();}),this._closePromise=e.length?Promise.all(e).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((i,n)=>{let s=this.options.cwd?be.relative(this.options.cwd,n):n;e[s||m_]=i.getChildren().sort();}),e}emitWithAll(e,i){this.emit(...i),e!==Tf&&this.emit(Cf,...i);}async _emit(e,i,n,s,r){if(this.closed)return;let o=this.options;_U&&(i=be.normalize(i)),o.cwd&&(i=be.relative(o.cwd,i));let a=[e,i];r!==void 0?a.push(n,s,r):s!==void 0?a.push(n,s):n!==void 0&&a.push(n);let u=o.awaitWriteFinish,f;if(u&&(f=this._pendingWrites.get(i)))return f.lastChange=new Date,this;if(o.atomic){if(e===c_)return this._pendingUnlinks.set(i,a),setTimeout(()=>{this._pendingUnlinks.forEach((c,d)=>{this.emit(...c),this.emit(Cf,...c),this._pendingUnlinks.delete(d);});},typeof o.atomic=="number"?o.atomic:100),this;e===rc&&this._pendingUnlinks.has(i)&&(e=a[0]=Ds,this._pendingUnlinks.delete(i));}if(u&&(e===rc||e===Ds)&&this._readyEmitted){let c=(d,h)=>{d?(e=a[0]=Tf,a[1]=d,this.emitWithAll(e,a)):h&&(a.length>2?a[2]=h:a.push(h),this.emitWithAll(e,a));};return this._awaitWriteFinish(i,u.stabilityThreshold,e,c),this}if(e===Ds&&!this._throttle(Ds,i,50))return this;if(o.alwaysStat&&n===void 0&&(e===rc||e===uU||e===Ds)){let c=o.cwd?be.join(o.cwd,i):i,d;try{d=await TU(c);}catch{}if(!d||this.closed)return;a.push(d);}return this.emitWithAll(e,a),this}_handleError(e){let i=e&&e.code;return e&&i!=="ENOENT"&&i!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||i!=="EPERM"&&i!=="EACCES")&&this.emit(Tf,e),e||this.closed}_throttle(e,i,n){this._throttled.has(e)||this._throttled.set(e,new Map);let s=this._throttled.get(e),r=s.get(i);if(r)return r.count++,!1;let o,a=()=>{let f=s.get(i),c=f?f.count:0;return s.delete(i),clearTimeout(o),f&&clearTimeout(f.timeoutObject),c};o=setTimeout(a,n);let u={timeoutObject:o,clear:a,count:0};return s.set(i,u),u}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,i,n,s){let r,o=e;this.options.cwd&&!be.isAbsolute(e)&&(o=be.join(this.options.cwd,e));let a=new Date,u=f=>{Bf.stat(o,(c,d)=>{if(c||!this._pendingWrites.has(e)){c&&c.code!=="ENOENT"&&s(c);return}let h=Number(new Date);f&&d.size!==f.size&&(this._pendingWrites.get(e).lastChange=h);let g=this._pendingWrites.get(e);h-g.lastChange>=i?(this._pendingWrites.delete(e),s(void 0,d)):r=setTimeout(u,this.options.awaitWriteFinish.pollInterval,d);});};this._pendingWrites.has(e)||(this._pendingWrites.set(e,{lastChange:a,cancelWait:()=>(this._pendingWrites.delete(e),clearTimeout(r),n)}),r=setTimeout(u,this.options.awaitWriteFinish.pollInterval));}_getGlobIgnored(){return [...this._ignoredPaths.values()]}_isIgnored(e,i){if(this.options.atomic&&yU.test(e))return !0;if(!this._userIgnored){let{cwd:n}=this.options,s=this.options.ignored,r=s&&s.map(f_(n)),o=qf(r).filter(u=>typeof u===Df&&!Rf(u)).map(u=>u+kf),a=this._getGlobIgnored().map(f_(n)).concat(r,o);this._userIgnored=Pf(a,void 0,If);}return this._userIgnored([e,i])}_isntIgnored(e,i){return !this._isIgnored(e,i)}_getWatchHelpers(e,i){let n=i||this.options.disableGlobbing||!Rf(e)?e:sU(e),s=this.options.followSymlinks;return new $f(e,n,s,this)}_getWatchedDir(e){this._boundRemove||(this._boundRemove=this._remove.bind(this));let i=be.resolve(e);return this._watched.has(i)||this._watched.set(i,new jf(i,this._boundRemove)),this._watched.get(i)}_hasReadPermissions(e){if(this.options.ignorePermissionErrors)return !0;let n=(e&&Number.parseInt(e.mode,10))&511;return !!(4&Number.parseInt(n.toString(8)[0],10))}_remove(e,i,n){let s=be.join(e,i),r=be.resolve(s);if(n=n??(this._watched.has(s)||this._watched.has(r)),!this._throttle("remove",s,100))return;!n&&!this.options.useFsEvents&&this._watched.size===1&&this.add(e,i,!0),this._getWatchedDir(s).getChildren().forEach(h=>this._remove(s,h));let u=this._getWatchedDir(e),f=u.has(i);u.remove(i),this._symlinkPaths.has(r)&&this._symlinkPaths.delete(r);let c=s;if(this.options.cwd&&(c=be.relative(this.options.cwd,s)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===rc)return;this._watched.delete(s),this._watched.delete(r);let d=n?pU:c_;f&&!this._isIgnored(s)&&this._emit(d,s),this.options.useFsEvents||this._closePath(s);}_closePath(e){this._closeFile(e);let i=be.dirname(e);this._getWatchedDir(i).remove(be.basename(e));}_closeFile(e){let i=this._closers.get(e);i&&(i.forEach(n=>n()),this._closers.delete(e));}_addPathCloser(e,i){if(!i)return;let n=this._closers.get(e);n||(n=[],this._closers.set(e,n)),n.push(i);}_readdirp(e,i){if(this.closed)return;let n={type:Cf,alwaysStat:!0,lstat:!0,...i},s=rU(e,n);return this._streams.add(s),s.once(dU,()=>{s=void 0;}),s.once(mU,()=>{s&&(this._streams.delete(s),s=void 0);}),s}};Nf.FSWatcher=sc;var IU=(t,e)=>{let i=new sc(e);return i.add(t),i};Nf.watch=IU;});var T_=R((Fn,C_)=>{var Kf=H("crypto");Fn=C_.exports=Vs;function Vs(t,e){return e=__(t,e),qU(t,e)}Fn.sha1=function(t){return Vs(t)};Fn.keys=function(t){return Vs(t,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})};Fn.MD5=function(t){return Vs(t,{algorithm:"md5",encoding:"hex"})};Fn.keysMD5=function(t){return Vs(t,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var kr=Kf.getHashes?Kf.getHashes().slice():["sha1","md5"];kr.push("passthrough");var E_=["buffer","hex","binary","base64"];function __(t,e){e=e||{};var i={};if(i.algorithm=e.algorithm||"sha1",i.encoding=e.encoding||"hex",i.excludeValues=!!e.excludeValues,i.algorithm=i.algorithm.toLowerCase(),i.encoding=i.encoding.toLowerCase(),i.ignoreUnknown=e.ignoreUnknown===!0,i.respectType=e.respectType!==!1,i.respectFunctionNames=e.respectFunctionNames!==!1,i.respectFunctionProperties=e.respectFunctionProperties!==!1,i.unorderedArrays=e.unorderedArrays===!0,i.unorderedSets=e.unorderedSets!==!1,i.unorderedObjects=e.unorderedObjects!==!1,i.replacer=e.replacer||void 0,i.excludeKeys=e.excludeKeys||void 0,typeof t>"u")throw new Error("Object argument required.");for(var n=0;n"u"&&(i.write=i.update,i.end=i.update);var n=Jf(e,i);if(n.dispatch(t),i.update||i.end(""),i.digest)return i.digest(e.encoding==="buffer"?void 0:e.encoding);var s=i.read();return e.encoding==="buffer"?s:s.toString(e.encoding)}Fn.writeToStream=function(t,e,i){return typeof i>"u"&&(i=e,e={}),e=__(t,e),Jf(e,i).dispatch(t)};function Jf(t,e,i){i=i||[];var n=function(s){return e.update?e.update(s,"utf8"):e.write(s,"utf8")};return {dispatch:function(s){t.replacer&&(s=t.replacer(s));var r=typeof s;return s===null&&(r="null"),this["_"+r](s)},_object:function(s){var r=/\[object (.*)\]/i,o=Object.prototype.toString.call(s),a=r.exec(o);a?a=a[1]:a="unknown:["+o+"]",a=a.toLowerCase();var u=null;if((u=i.indexOf(s))>=0)return this.dispatch("[CIRCULAR:"+u+"]");if(i.push(s),typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(s))return n("buffer:"),n(s);if(a!=="object"&&a!=="function"&&a!=="asyncfunction")if(this["_"+a])this["_"+a](s);else {if(t.ignoreUnknown)return n("["+a+"]");throw new Error('Unknown object type "'+a+'"')}else {var f=Object.keys(s);t.unorderedObjects&&(f=f.sort()),t.respectType!==!1&&!A_(s)&&f.splice(0,0,"prototype","__proto__","constructor"),t.excludeKeys&&(f=f.filter(function(d){return !t.excludeKeys(d)})),n("object:"+f.length+":");var c=this;return f.forEach(function(d){c.dispatch(d),n(":"),t.excludeValues||c.dispatch(s[d]),n(",");})}},_array:function(s,r){r=typeof r<"u"?r:t.unorderedArrays!==!1;var o=this;if(n("array:"+s.length+":"),!r||s.length<=1)return s.forEach(function(f){return o.dispatch(f)});var a=[],u=s.map(function(f){var c=new R_,d=i.slice(),h=Jf(t,c,d);return h.dispatch(f),a=a.concat(d.slice(i.length)),c.read().toString()});return i=i.concat(a),u.sort(),this._array(u,!1)},_date:function(s){return n("date:"+s.toJSON())},_symbol:function(s){return n("symbol:"+s.toString())},_error:function(s){return n("error:"+s.toString())},_boolean:function(s){return n("bool:"+s.toString())},_string:function(s){n("string:"+s.length+":"),n(s.toString());},_function:function(s){n("fn:"),A_(s)?this.dispatch("[native]"):this.dispatch(s.toString()),t.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(s.name)),t.respectFunctionProperties&&this._object(s);},_number:function(s){return n("number:"+s.toString())},_xml:function(s){return n("xml:"+s.toString())},_null:function(){return n("Null")},_undefined:function(){return n("Undefined")},_regexp:function(s){return n("regex:"+s.toString())},_uint8array:function(s){return n("uint8array:"),this.dispatch(Array.prototype.slice.call(s))},_uint8clampedarray:function(s){return n("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(s))},_int8array:function(s){return n("int8array:"),this.dispatch(Array.prototype.slice.call(s))},_uint16array:function(s){return n("uint16array:"),this.dispatch(Array.prototype.slice.call(s))},_int16array:function(s){return n("int16array:"),this.dispatch(Array.prototype.slice.call(s))},_uint32array:function(s){return n("uint32array:"),this.dispatch(Array.prototype.slice.call(s))},_int32array:function(s){return n("int32array:"),this.dispatch(Array.prototype.slice.call(s))},_float32array:function(s){return n("float32array:"),this.dispatch(Array.prototype.slice.call(s))},_float64array:function(s){return n("float64array:"),this.dispatch(Array.prototype.slice.call(s))},_arraybuffer:function(s){return n("arraybuffer:"),this.dispatch(new Uint8Array(s))},_url:function(s){return n("url:"+s.toString())},_map:function(s){n("map:");var r=Array.from(s);return this._array(r,t.unorderedSets!==!1)},_set:function(s){n("set:");var r=Array.from(s);return this._array(r,t.unorderedSets!==!1)},_file:function(s){return n("file:"),this.dispatch([s.name,s.size,s.type,s.lastModfied])},_blob:function(){if(t.ignoreUnknown)return n("[blob]");throw Error(`Hashing Blob objects is currently not supported
+(see https://github.com/puleos/object-hash/issues/26)
+Use "options.replacer" or "options.ignoreUnknown"
+`)},_domwindow:function(){return n("domwindow")},_bigint:function(s){return n("bigint:"+s.toString())},_process:function(){return n("process")},_timer:function(){return n("timer")},_pipe:function(){return n("pipe")},_tcp:function(){return n("tcp")},_udp:function(){return n("udp")},_tty:function(){return n("tty")},_statwatcher:function(){return n("statwatcher")},_securecontext:function(){return n("securecontext")},_connection:function(){return n("connection")},_zlib:function(){return n("zlib")},_context:function(){return n("context")},_nodescript:function(){return n("nodescript")},_httpparser:function(){return n("httpparser")},_dataview:function(){return n("dataview")},_signal:function(){return n("signal")},_fsevent:function(){return n("fsevent")},_tlswrap:function(){return n("tlswrap")}}}function R_(){return {buf:"",write:function(t){this.buf+=t;},end:function(t){this.buf+=t;},read:function(){return this.buf}}}});var k_=R((KG,O_)=>{O_.exports={STRING:2,BOOLEAN:4,BYTES:4,NUMBER:8,Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8};});var I_=R(pc=>{pc.byteLength=$U;pc.toByteArray=DU;pc.fromByteArray=zU;var gi=[],Nt=[],jU=typeof Uint8Array<"u"?Uint8Array:Array,Yf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(In=0,P_=Yf.length;In0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");i===-1&&(i=e);var n=i===e?0:4-i%4;return [i,n]}function $U(t){var e=F_(t),i=e[0],n=e[1];return (i+n)*3/4-n}function BU(t,e,i){return (e+i)*3/4-i}function DU(t){var e,i=F_(t),n=i[0],s=i[1],r=new jU(BU(t,n,s)),o=0,a=s>0?n-4:n,u;for(u=0;u>16&255,r[o++]=e>>8&255,r[o++]=e&255;return s===2&&(e=Nt[t.charCodeAt(u)]<<2|Nt[t.charCodeAt(u+1)]>>4,r[o++]=e&255),s===1&&(e=Nt[t.charCodeAt(u)]<<10|Nt[t.charCodeAt(u+1)]<<4|Nt[t.charCodeAt(u+2)]>>2,r[o++]=e>>8&255,r[o++]=e&255),r}function NU(t){return gi[t>>18&63]+gi[t>>12&63]+gi[t>>6&63]+gi[t&63]}function UU(t,e,i){for(var n,s=[],r=e;ra?a:o+r));return n===1?(e=t[i-1],s.push(gi[e>>2]+gi[e<<4&63]+"==")):n===2&&(e=(t[i-2]<<8)+t[i-1],s.push(gi[e>>10]+gi[e>>4&63]+gi[e<<2&63]+"=")),s.join("")}});var L_=R(Xf=>{Xf.read=function(t,e,i,n,s){var r,o,a=s*8-n-1,u=(1<>1,c=-7,d=i?s-1:0,h=i?-1:1,g=t[e+d];for(d+=h,r=g&(1<<-c)-1,g>>=-c,c+=a;c>0;r=r*256+t[e+d],d+=h,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=n;c>0;o=o*256+t[e+d],d+=h,c-=8);if(r===0)r=1-f;else {if(r===u)return o?NaN:(g?-1:1)*(1/0);o=o+Math.pow(2,n),r=r-f;}return (g?-1:1)*o*Math.pow(2,r-n)};Xf.write=function(t,e,i,n,s,r){var o,a,u,f=r*8-s-1,c=(1<>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:r-1,y=n?1:-1,b=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=h/u:e+=h*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=c?(a=0,o=c):o+d>=1?(a=(e*u-1)*Math.pow(2,s),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;t[i+g]=a&255,g+=y,a/=256,s-=8);for(o=o<0;t[i+g]=o&255,g+=y,o/=256,f-=8);t[i+g-y]|=b*128;};});var X_=R(Lr=>{var Qf=I_(),Fr=L_(),q_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Lr.Buffer=L;Lr.SlowBuffer=KU;Lr.INSPECT_MAX_BYTES=50;var fc=2147483647;Lr.kMaxLength=fc;L.TYPED_ARRAY_SUPPORT=MU();!L.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function MU(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return !1}}Object.defineProperty(L.prototype,"parent",{enumerable:!0,get:function(){if(L.isBuffer(this))return this.buffer}});Object.defineProperty(L.prototype,"offset",{enumerable:!0,get:function(){if(L.isBuffer(this))return this.byteOffset}});function Oi(t){if(t>fc)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,L.prototype),e}function L(t,e,i){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return id(t)}return D_(t,e,i)}L.poolSize=8192;function D_(t,e,i){if(typeof t=="string")return WU(t,e);if(ArrayBuffer.isView(t))return GU(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(yi(t,ArrayBuffer)||t&&yi(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(yi(t,SharedArrayBuffer)||t&&yi(t.buffer,SharedArrayBuffer)))return ed(t,e,i);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return L.from(n,e,i);let s=VU(t);if(s)return s;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return L.from(t[Symbol.toPrimitive]("string"),e,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}L.from=function(t,e,i){return D_(t,e,i)};Object.setPrototypeOf(L.prototype,Uint8Array.prototype);Object.setPrototypeOf(L,Uint8Array);function N_(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function HU(t,e,i){return N_(t),t<=0?Oi(t):e!==void 0?typeof i=="string"?Oi(t).fill(e,i):Oi(t).fill(e):Oi(t)}L.alloc=function(t,e,i){return HU(t,e,i)};function id(t){return N_(t),Oi(t<0?0:nd(t)|0)}L.allocUnsafe=function(t){return id(t)};L.allocUnsafeSlow=function(t){return id(t)};function WU(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!L.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let i=U_(t,e)|0,n=Oi(i),s=n.write(t,e);return s!==i&&(n=n.slice(0,s)),n}function Zf(t){let e=t.length<0?0:nd(t.length)|0,i=Oi(e);for(let n=0;n=fc)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+fc.toString(16)+" bytes");return t|0}function KU(t){return +t!=t&&(t=0),L.alloc(+t)}L.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==L.prototype};L.compare=function(e,i){if(yi(e,Uint8Array)&&(e=L.from(e,e.offset,e.byteLength)),yi(i,Uint8Array)&&(i=L.from(i,i.offset,i.byteLength)),!L.isBuffer(e)||!L.isBuffer(i))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===i)return 0;let n=e.length,s=i.length;for(let r=0,o=Math.min(n,s);rs.length?(L.isBuffer(o)||(o=L.from(o)),o.copy(s,r)):Uint8Array.prototype.set.call(s,o,r);else if(L.isBuffer(o))o.copy(s,r);else throw new TypeError('"list" argument must be an Array of Buffers');r+=o.length;}return s};function U_(t,e){if(L.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||yi(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let i=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&i===0)return 0;let s=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return td(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return Y_(t).length;default:if(s)return n?-1:td(t).length;e=(""+e).toLowerCase(),s=!0;}}L.byteLength=U_;function JU(t,e,i){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,e>>>=0,i<=e))return "";for(t||(t="utf8");;)switch(t){case"hex":return sz(this,e,i);case"utf8":case"utf-8":return M_(this,e,i);case"ascii":return nz(this,e,i);case"latin1":case"binary":return rz(this,e,i);case"base64":return tz(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oz(this,e,i);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0;}}L.prototype._isBuffer=!0;function Ln(t,e,i){let n=t[e];t[e]=t[i],t[i]=n;}L.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let i=0;ii&&(e+=" ... "),""};q_&&(L.prototype[q_]=L.prototype.inspect);L.prototype.compare=function(e,i,n,s,r){if(yi(e,Uint8Array)&&(e=L.from(e,e.offset,e.byteLength)),!L.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(i===void 0&&(i=0),n===void 0&&(n=e?e.length:0),s===void 0&&(s=0),r===void 0&&(r=this.length),i<0||n>e.length||s<0||r>this.length)throw new RangeError("out of range index");if(s>=r&&i>=n)return 0;if(s>=r)return -1;if(i>=n)return 1;if(i>>>=0,n>>>=0,s>>>=0,r>>>=0,this===e)return 0;let o=r-s,a=n-i,u=Math.min(o,a),f=this.slice(s,r),c=e.slice(i,n);for(let d=0;d2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,sd(i)&&(i=s?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(s)return -1;i=t.length-1;}else if(i<0)if(s)i=0;else return -1;if(typeof e=="string"&&(e=L.from(e,n)),L.isBuffer(e))return e.length===0?-1:j_(t,e,i,n,s);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?s?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):j_(t,[e],i,n,s);throw new TypeError("val must be string, number or Buffer")}function j_(t,e,i,n,s){let r=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return -1;r=2,o/=2,a/=2,i/=2;}function u(c,d){return r===1?c[d]:c.readUInt16BE(d*r)}let f;if(s){let c=-1;for(f=i;fo&&(i=o-a),f=i;f>=0;f--){let c=!0;for(let d=0;ds&&(n=s)):n=s;let r=e.length;n>r/2&&(n=r/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,s===void 0&&(s="utf8")):(s=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let r=this.length-i;if((n===void 0||n>r)&&(n=r),e.length>0&&(n<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");s||(s="utf8");let o=!1;for(;;)switch(s){case"hex":return YU(this,e,i,n);case"utf8":case"utf-8":return XU(this,e,i,n);case"ascii":case"latin1":case"binary":return QU(this,e,i,n);case"base64":return ZU(this,e,i,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ez(this,e,i,n);default:if(o)throw new TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),o=!0;}};L.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function tz(t,e,i){return e===0&&i===t.length?Qf.fromByteArray(t):Qf.fromByteArray(t.slice(e,i))}function M_(t,e,i){i=Math.min(t.length,i);let n=[],s=e;for(;s239?4:r>223?3:r>191?2:1;if(s+a<=i){let u,f,c,d;switch(a){case 1:r<128&&(o=r);break;case 2:u=t[s+1],(u&192)===128&&(d=(r&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[s+1],f=t[s+2],(u&192)===128&&(f&192)===128&&(d=(r&15)<<12|(u&63)<<6|f&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[s+1],f=t[s+2],c=t[s+3],(u&192)===128&&(f&192)===128&&(c&192)===128&&(d=(r&15)<<18|(u&63)<<12|(f&63)<<6|c&63,d>65535&&d<1114112&&(o=d));}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),s+=a;}return iz(n)}var $_=4096;function iz(t){let e=t.length;if(e<=$_)return String.fromCharCode.apply(String,t);let i="",n=0;for(;nn)&&(i=n);let s="";for(let r=e;rn&&(e=n),i<0?(i+=n,i<0&&(i=0)):i>n&&(i=n),ii)throw new RangeError("Trying to access beyond buffer length")}L.prototype.readUintLE=L.prototype.readUIntLE=function(e,i,n){e=e>>>0,i=i>>>0,n||Ve(e,i,this.length);let s=this[e],r=1,o=0;for(;++o>>0,i=i>>>0,n||Ve(e,i,this.length);let s=this[e+--i],r=1;for(;i>0&&(r*=256);)s+=this[e+--i]*r;return s};L.prototype.readUint8=L.prototype.readUInt8=function(e,i){return e=e>>>0,i||Ve(e,1,this.length),this[e]};L.prototype.readUint16LE=L.prototype.readUInt16LE=function(e,i){return e=e>>>0,i||Ve(e,2,this.length),this[e]|this[e+1]<<8};L.prototype.readUint16BE=L.prototype.readUInt16BE=function(e,i){return e=e>>>0,i||Ve(e,2,this.length),this[e]<<8|this[e+1]};L.prototype.readUint32LE=L.prototype.readUInt32LE=function(e,i){return e=e>>>0,i||Ve(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};L.prototype.readUint32BE=L.prototype.readUInt32BE=function(e,i){return e=e>>>0,i||Ve(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};L.prototype.readBigUInt64LE=rn(function(e){e=e>>>0,Ir(e,"offset");let i=this[e],n=this[e+7];(i===void 0||n===void 0)&&Ks(e,this.length-8);let s=i+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,r=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(s)+(BigInt(r)<>>0,Ir(e,"offset");let i=this[e],n=this[e+7];(i===void 0||n===void 0)&&Ks(e,this.length-8);let s=i*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],r=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return (BigInt(s)<>>0,i=i>>>0,n||Ve(e,i,this.length);let s=this[e],r=1,o=0;for(;++o=r&&(s-=Math.pow(2,8*i)),s};L.prototype.readIntBE=function(e,i,n){e=e>>>0,i=i>>>0,n||Ve(e,i,this.length);let s=i,r=1,o=this[e+--s];for(;s>0&&(r*=256);)o+=this[e+--s]*r;return r*=128,o>=r&&(o-=Math.pow(2,8*i)),o};L.prototype.readInt8=function(e,i){return e=e>>>0,i||Ve(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};L.prototype.readInt16LE=function(e,i){e=e>>>0,i||Ve(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};L.prototype.readInt16BE=function(e,i){e=e>>>0,i||Ve(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};L.prototype.readInt32LE=function(e,i){return e=e>>>0,i||Ve(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};L.prototype.readInt32BE=function(e,i){return e=e>>>0,i||Ve(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};L.prototype.readBigInt64LE=rn(function(e){e=e>>>0,Ir(e,"offset");let i=this[e],n=this[e+7];(i===void 0||n===void 0)&&Ks(e,this.length-8);let s=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(s)<>>0,Ir(e,"offset");let i=this[e],n=this[e+7];(i===void 0||n===void 0)&&Ks(e,this.length-8);let s=(i<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(s)<>>0,i||Ve(e,4,this.length),Fr.read(this,e,!0,23,4)};L.prototype.readFloatBE=function(e,i){return e=e>>>0,i||Ve(e,4,this.length),Fr.read(this,e,!1,23,4)};L.prototype.readDoubleLE=function(e,i){return e=e>>>0,i||Ve(e,8,this.length),Fr.read(this,e,!0,52,8)};L.prototype.readDoubleBE=function(e,i){return e=e>>>0,i||Ve(e,8,this.length),Fr.read(this,e,!1,52,8)};function wt(t,e,i,n,s,r){if(!L.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||et.length)throw new RangeError("Index out of range")}L.prototype.writeUintLE=L.prototype.writeUIntLE=function(e,i,n,s){if(e=+e,i=i>>>0,n=n>>>0,!s){let a=Math.pow(2,8*n)-1;wt(this,e,i,n,a,0);}let r=1,o=0;for(this[i]=e&255;++o>>0,n=n>>>0,!s){let a=Math.pow(2,8*n)-1;wt(this,e,i,n,a,0);}let r=n-1,o=1;for(this[i+r]=e&255;--r>=0&&(o*=256);)this[i+r]=e/o&255;return i+n};L.prototype.writeUint8=L.prototype.writeUInt8=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,1,255,0),this[i]=e&255,i+1};L.prototype.writeUint16LE=L.prototype.writeUInt16LE=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,2,65535,0),this[i]=e&255,this[i+1]=e>>>8,i+2};L.prototype.writeUint16BE=L.prototype.writeUInt16BE=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,2,65535,0),this[i]=e>>>8,this[i+1]=e&255,i+2};L.prototype.writeUint32LE=L.prototype.writeUInt32LE=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,4,4294967295,0),this[i+3]=e>>>24,this[i+2]=e>>>16,this[i+1]=e>>>8,this[i]=e&255,i+4};L.prototype.writeUint32BE=L.prototype.writeUInt32BE=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,4,4294967295,0),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4};function H_(t,e,i,n,s){J_(e,n,s,t,i,7);let r=Number(e&BigInt(4294967295));t[i++]=r,r=r>>8,t[i++]=r,r=r>>8,t[i++]=r,r=r>>8,t[i++]=r;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[i++]=o,o=o>>8,t[i++]=o,o=o>>8,t[i++]=o,o=o>>8,t[i++]=o,i}function W_(t,e,i,n,s){J_(e,n,s,t,i,7);let r=Number(e&BigInt(4294967295));t[i+7]=r,r=r>>8,t[i+6]=r,r=r>>8,t[i+5]=r,r=r>>8,t[i+4]=r;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[i+3]=o,o=o>>8,t[i+2]=o,o=o>>8,t[i+1]=o,o=o>>8,t[i]=o,i+8}L.prototype.writeBigUInt64LE=rn(function(e,i=0){return H_(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))});L.prototype.writeBigUInt64BE=rn(function(e,i=0){return W_(this,e,i,BigInt(0),BigInt("0xffffffffffffffff"))});L.prototype.writeIntLE=function(e,i,n,s){if(e=+e,i=i>>>0,!s){let u=Math.pow(2,8*n-1);wt(this,e,i,n,u-1,-u);}let r=0,o=1,a=0;for(this[i]=e&255;++r>0)-a&255;return i+n};L.prototype.writeIntBE=function(e,i,n,s){if(e=+e,i=i>>>0,!s){let u=Math.pow(2,8*n-1);wt(this,e,i,n,u-1,-u);}let r=n-1,o=1,a=0;for(this[i+r]=e&255;--r>=0&&(o*=256);)e<0&&a===0&&this[i+r+1]!==0&&(a=1),this[i+r]=(e/o>>0)-a&255;return i+n};L.prototype.writeInt8=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,1,127,-128),e<0&&(e=255+e+1),this[i]=e&255,i+1};L.prototype.writeInt16LE=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,2,32767,-32768),this[i]=e&255,this[i+1]=e>>>8,i+2};L.prototype.writeInt16BE=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,2,32767,-32768),this[i]=e>>>8,this[i+1]=e&255,i+2};L.prototype.writeInt32LE=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,4,2147483647,-2147483648),this[i]=e&255,this[i+1]=e>>>8,this[i+2]=e>>>16,this[i+3]=e>>>24,i+4};L.prototype.writeInt32BE=function(e,i,n){return e=+e,i=i>>>0,n||wt(this,e,i,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[i]=e>>>24,this[i+1]=e>>>16,this[i+2]=e>>>8,this[i+3]=e&255,i+4};L.prototype.writeBigInt64LE=rn(function(e,i=0){return H_(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});L.prototype.writeBigInt64BE=rn(function(e,i=0){return W_(this,e,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function G_(t,e,i,n,s,r){if(i+n>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function V_(t,e,i,n,s){return e=+e,i=i>>>0,s||G_(t,e,i,4),Fr.write(t,e,i,n,23,4),i+4}L.prototype.writeFloatLE=function(e,i,n){return V_(this,e,i,!0,n)};L.prototype.writeFloatBE=function(e,i,n){return V_(this,e,i,!1,n)};function K_(t,e,i,n,s){return e=+e,i=i>>>0,s||G_(t,e,i,8),Fr.write(t,e,i,n,52,8),i+8}L.prototype.writeDoubleLE=function(e,i,n){return K_(this,e,i,!0,n)};L.prototype.writeDoubleBE=function(e,i,n){return K_(this,e,i,!1,n)};L.prototype.copy=function(e,i,n,s){if(!L.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!s&&s!==0&&(s=this.length),i>=e.length&&(i=e.length),i||(i=0),s>0&&s=this.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-i>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let r;if(typeof e=="number")for(r=i;r2**32?s=B_(String(i)):typeof i=="bigint"&&(s=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(s=B_(s)),s+="n"),n+=` It must be ${e}. Received ${s}`,n},RangeError);function B_(t){let e="",i=t.length,n=t[0]==="-"?1:0;for(;i>=n+4;i-=3)e=`_${t.slice(i-3,i)}${e}`;return `${t.slice(0,i)}${e}`}function az(t,e,i){Ir(e,"offset"),(t[e]===void 0||t[e+i]===void 0)&&Ks(e,t.length-(i+1));}function J_(t,e,i,n,s,r){if(t>i||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(r+1)*8}${o}`:a=`>= -(2${o} ** ${(r+1)*8-1}${o}) and < 2 ** ${(r+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${i}${o}`,new Pr.ERR_OUT_OF_RANGE("value",a,t)}az(n,s,r);}function Ir(t,e){if(typeof t!="number")throw new Pr.ERR_INVALID_ARG_TYPE(e,"number",t)}function Ks(t,e,i){throw Math.floor(t)!==t?(Ir(t,i),new Pr.ERR_OUT_OF_RANGE(i||"offset","an integer",t)):e<0?new Pr.ERR_BUFFER_OUT_OF_BOUNDS:new Pr.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${e}`,t)}var cz=/[^+/0-9A-Za-z-_]/g;function lz(t){if(t=t.split("=")[0],t=t.trim().replace(cz,""),t.length<2)return "";for(;t.length%4!==0;)t=t+"=";return t}function td(t,e){e=e||1/0;let i,n=t.length,s=null,r=[];for(let o=0;o55295&&i<57344){if(!s){if(i>56319){(e-=3)>-1&&r.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&r.push(239,191,189);continue}s=i;continue}if(i<56320){(e-=3)>-1&&r.push(239,191,189),s=i;continue}i=(s-55296<<10|i-56320)+65536;}else s&&(e-=3)>-1&&r.push(239,191,189);if(s=null,i<128){if((e-=1)<0)break;r.push(i);}else if(i<2048){if((e-=2)<0)break;r.push(i>>6|192,i&63|128);}else if(i<65536){if((e-=3)<0)break;r.push(i>>12|224,i>>6&63|128,i&63|128);}else if(i<1114112){if((e-=4)<0)break;r.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128);}else throw new Error("Invalid code point")}return r}function uz(t){let e=[];for(let i=0;i>8,s=i%256,r.push(s),r.push(n);return r}function Y_(t){return Qf.toByteArray(lz(t))}function dc(t,e,i,n){let s;for(s=0;s=e.length||s>=t.length);++s)e[s+i]=t[s];return s}function yi(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function sd(t){return t!==t}var fz=function(){let t="0123456789abcdef",e=new Array(256);for(let i=0;i<16;++i){let n=i*16;for(let s=0;s<16;++s)e[n+s]=t[i]+t[s];}return e}();function rn(t){return typeof BigInt>"u"?dz:t}function dz(){throw new Error("BigInt not supported")}});var eR=R((ZG,Z_)=>{var Js=k_(),Q_=X_().Buffer;function mz(t){return 12+4*Math.ceil(t.length/4)}function hz(){return !(typeof window<"u"&&typeof document<"u")}function gz(t){return t.BYTES_PER_ELEMENT?t.length*t.BYTES_PER_ELEMENT:-1}function yz(t){let e=0,i=-1;try{let n=t;if(t instanceof Map?n=Object.fromEntries(t):t instanceof Set&&(n=Array.from(t)),ArrayBuffer.isView(t))return gz(t);let s=JSON.stringify(n,(r,o)=>typeof o=="bigint"||typeof o=="function"?o.toString():typeof o>"u"?"undefined":typeof o=="symbol"||o instanceof RegExp?o.toString():o);e=Q_.byteLength(s,"utf8");}catch(n){return console.error("Error detected, returning "+i,n),i}return e}function xz(t){let e=[],i=[t],n=0;for(;i.length;){let s=i.pop();if(typeof s=="boolean")n+=Js.BYTES;else if(typeof s=="string")hz()?n+=mz(s):n+=s.length*Js.STRING;else if(typeof s=="number")n+=Js.NUMBER;else if(typeof s=="symbol")Symbol.keyFor&&Symbol.keyFor(t)?n+=Symbol.keyFor(t).length*Js.STRING:n+=(t.toString().length-8)*Js.STRING;else if(typeof s=="bigint")n+=Q_.from(s.toString()).byteLength;else if(typeof s=="function")n+=s.toString().length;else if(typeof s=="object"&&e.indexOf(s)===-1){e.push(s);for(let r in s)i.push(s[r]);}}return n}Z_.exports=function(t){let e=0;return t!==null&&typeof t=="object"?e=yz(t):e=xz(t),e};});var oo=new Uint8Array(256),so=oo.length;function kc(){return so>oo.length-16&&(BC__default.default.randomFillSync(oo),so=0),oo.slice(so,so+=16)}var Qe=[];for(let t=0;t<256;++t)Qe.push((t+256).toString(16).slice(1));function em(t,e=0){return (Qe[t[e+0]]+Qe[t[e+1]]+Qe[t[e+2]]+Qe[t[e+3]]+"-"+Qe[t[e+4]]+Qe[t[e+5]]+"-"+Qe[t[e+6]]+Qe[t[e+7]]+"-"+Qe[t[e+8]]+Qe[t[e+9]]+"-"+Qe[t[e+10]]+Qe[t[e+11]]+Qe[t[e+12]]+Qe[t[e+13]]+Qe[t[e+14]]+Qe[t[e+15]]).toLowerCase()}var Pc={randomUUID:BC__default.default.randomUUID};function NC(t,e,i){if(Pc.randomUUID&&!e&&!t)return Pc.randomUUID();t=t||{};let n=t.random||(t.rng||kc)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){i=i||0;for(let s=0;s<16;++s)e[i+s]=n[s];return e}return em(n)}var $n=NC;var cd=ni(Hy()),gc=ni(Ky());var Qr=class{constructor(e){this.config=e;}};function Zr(t,e){return function(){return t.apply(e,arguments)}}var{toString:Tk}=Object.prototype,{getPrototypeOf:Nl}=Object,Do=(t=>e=>{let i=Tk.call(e);return t[i]||(t[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),oi=t=>(t=t.toLowerCase(),e=>Do(e)===t),No=t=>e=>typeof e===t,{isArray:Jn}=Array,es=No("undefined");function Ok(t){return t!==null&&!es(t)&&t.constructor!==null&&!es(t.constructor)&&$t(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var Xy=oi("ArrayBuffer");function kk(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Xy(t.buffer),e}var Pk=No("string"),$t=No("function"),Qy=No("number"),Uo=t=>t!==null&&typeof t=="object",Fk=t=>t===!0||t===!1,Bo=t=>{if(Do(t)!=="object")return !1;let e=Nl(t);return (e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Ik=oi("Date"),Lk=oi("File"),qk=oi("Blob"),jk=oi("FileList"),$k=t=>Uo(t)&&$t(t.pipe),Bk=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||$t(t.append)&&((e=Do(t))==="formdata"||e==="object"&&$t(t.toString)&&t.toString()==="[object FormData]"))},Dk=oi("URLSearchParams"),Nk=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ts(t,e,{allOwnKeys:i=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Jn(t))for(n=0,s=t.length;n0;)if(s=i[n],e===s.toLowerCase())return s;return null}var ex=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),tx=t=>!es(t)&&t!==ex;function Dl(){let{caseless:t}=tx(this)&&this||{},e={},i=(n,s)=>{let r=t&&Zy(e,s)||s;Bo(e[r])&&Bo(n)?e[r]=Dl(e[r],n):Bo(n)?e[r]=Dl({},n):Jn(n)?e[r]=n.slice():e[r]=n;};for(let n=0,s=arguments.length;n(ts(e,(s,r)=>{i&&$t(s)?t[r]=Zr(s,i):t[r]=s;},{allOwnKeys:n}),t),zk=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Mk=(t,e,i,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),i&&Object.assign(t.prototype,i);},Hk=(t,e,i,n)=>{let s,r,o,a={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),r=s.length;r-- >0;)o=s[r],(!n||n(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=i!==!1&&Nl(t);}while(t&&(!i||i(t,e))&&t!==Object.prototype);return e},Wk=(t,e,i)=>{t=String(t),(i===void 0||i>t.length)&&(i=t.length),i-=e.length;let n=t.indexOf(e,i);return n!==-1&&n===i},Gk=t=>{if(!t)return null;if(Jn(t))return t;let e=t.length;if(!Qy(e))return null;let i=new Array(e);for(;e-- >0;)i[e]=t[e];return i},Vk=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Nl(Uint8Array)),Kk=(t,e)=>{let n=(t&&t[Symbol.iterator]).call(t),s;for(;(s=n.next())&&!s.done;){let r=s.value;e.call(t,r[0],r[1]);}},Jk=(t,e)=>{let i,n=[];for(;(i=t.exec(e))!==null;)n.push(i);return n},Yk=oi("HTMLFormElement"),Xk=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,n,s){return n.toUpperCase()+s}),Jy=(({hasOwnProperty:t})=>(e,i)=>t.call(e,i))(Object.prototype),Qk=oi("RegExp"),ix=(t,e)=>{let i=Object.getOwnPropertyDescriptors(t),n={};ts(i,(s,r)=>{e(s,r,t)!==!1&&(n[r]=s);}),Object.defineProperties(t,n);},Zk=t=>{ix(t,(e,i)=>{if($t(t)&&["arguments","caller","callee"].indexOf(i)!==-1)return !1;let n=t[i];if($t(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")});}});},eP=(t,e)=>{let i={},n=s=>{s.forEach(r=>{i[r]=!0;});};return Jn(t)?n(t):n(String(t).split(e)),i},tP=()=>{},iP=(t,e)=>(t=+t,Number.isFinite(t)?t:e),Bl="abcdefghijklmnopqrstuvwxyz",Yy="0123456789",nx={DIGIT:Yy,ALPHA:Bl,ALPHA_DIGIT:Bl+Bl.toUpperCase()+Yy},nP=(t=16,e=nx.ALPHA_DIGIT)=>{let i="",{length:n}=e;for(;t--;)i+=e[Math.random()*n|0];return i};function rP(t){return !!(t&&$t(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}var sP=t=>{let e=new Array(10),i=(n,s)=>{if(Uo(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[s]=n;let r=Jn(n)?[]:{};return ts(n,(o,a)=>{let u=i(o,s+1);!es(u)&&(r[a]=u);}),e[s]=void 0,r}}return n};return i(t,0)},oP=oi("AsyncFunction"),aP=t=>t&&(Uo(t)||$t(t))&&$t(t.then)&&$t(t.catch),O={isArray:Jn,isArrayBuffer:Xy,isBuffer:Ok,isFormData:Bk,isArrayBufferView:kk,isString:Pk,isNumber:Qy,isBoolean:Fk,isObject:Uo,isPlainObject:Bo,isUndefined:es,isDate:Ik,isFile:Lk,isBlob:qk,isRegExp:Qk,isFunction:$t,isStream:$k,isURLSearchParams:Dk,isTypedArray:Vk,isFileList:jk,forEach:ts,merge:Dl,extend:Uk,trim:Nk,stripBOM:zk,inherits:Mk,toFlatObject:Hk,kindOf:Do,kindOfTest:oi,endsWith:Wk,toArray:Gk,forEachEntry:Kk,matchAll:Jk,isHTMLForm:Yk,hasOwnProperty:Jy,hasOwnProp:Jy,reduceDescriptors:ix,freezeMethods:Zk,toObjectSet:eP,toCamelCase:Xk,noop:tP,toFiniteNumber:iP,findKey:Zy,global:ex,isContextDefined:tx,ALPHABET:nx,generateString:nP,isSpecCompliantForm:rP,toJSONObject:sP,isAsyncFn:oP,isThenable:aP};function Yn(t,e,i,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),i&&(this.config=i),n&&(this.request=n),s&&(this.response=s);}O.inherits(Yn,Error,{toJSON:function(){return {message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:O.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var rx=Yn.prototype,sx={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{sx[t]={value:t};});Object.defineProperties(Yn,sx);Object.defineProperty(rx,"isAxiosError",{value:!0});Yn.from=(t,e,i,n,s,r)=>{let o=Object.create(rx);return O.toFlatObject(t,o,function(u){return u!==Error.prototype},a=>a!=="isAxiosError"),Yn.call(o,t.message,e,i,n,s),o.cause=t,o.name=t.name,r&&Object.assign(o,r),o};var ie=Yn;var Nx=ni(Xl(),1),Ho=Nx.default;function Ql(t){return O.isPlainObject(t)||O.isArray(t)}function zx(t){return O.endsWith(t,"[]")?t.slice(0,-2):t}function Ux(t,e,i){return t?t.concat(e).map(function(s,r){return s=zx(s),!i&&r?"["+s+"]":s}).join(i?".":""):e}function HP(t){return O.isArray(t)&&!t.some(Ql)}var WP=O.toFlatObject(O,{},null,function(e){return /^is[A-Z]/.test(e)});function GP(t,e,i){if(!O.isObject(t))throw new TypeError("target must be an object");e=e||new(Ho||FormData),i=O.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,A){return !O.isUndefined(A[b])});let n=i.metaTokens,s=i.visitor||c,r=i.dots,o=i.indexes,u=(i.Blob||typeof Blob<"u"&&Blob)&&O.isSpecCompliantForm(e);if(!O.isFunction(s))throw new TypeError("visitor must be a function");function f(y){if(y===null)return "";if(O.isDate(y))return y.toISOString();if(!u&&O.isBlob(y))throw new ie("Blob is not supported. Use a Buffer instead.");return O.isArrayBuffer(y)||O.isTypedArray(y)?u&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function c(y,b,A){let _=y;if(y&&!A&&typeof y=="object"){if(O.endsWith(b,"{}"))b=n?b:b.slice(0,-2),y=JSON.stringify(y);else if(O.isArray(y)&&HP(y)||(O.isFileList(y)||O.endsWith(b,"[]"))&&(_=O.toArray(y)))return b=zx(b),_.forEach(function(C,I){!(O.isUndefined(C)||C===null)&&e.append(o===!0?Ux([b],I,r):o===null?b:b+"[]",f(C));}),!1}return Ql(y)?!0:(e.append(Ux(A,b,r),f(y)),!1)}let d=[],h=Object.assign(WP,{defaultVisitor:c,convertValue:f,isVisitable:Ql});function g(y,b){if(!O.isUndefined(y)){if(d.indexOf(y)!==-1)throw Error("Circular reference detected in "+b.join("."));d.push(y),O.forEach(y,function(_,S){(!(O.isUndefined(_)||_===null)&&s.call(e,_,O.isString(S)?S.trim():S,b,h))===!0&&g(_,b?b.concat(S):[S]);}),d.pop();}}if(!O.isObject(t))throw new TypeError("data must be an object");return g(t),e}var $i=GP;function Mx(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Hx(t,e){this._pairs=[],t&&$i(t,this,e);}var Wx=Hx.prototype;Wx.append=function(e,i){this._pairs.push([e,i]);};Wx.toString=function(e){let i=e?function(n){return e.call(this,n,Mx)}:Mx;return this._pairs.map(function(s){return i(s[0])+"="+i(s[1])},"").join("&")};var Gx=Hx;function VP(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function un(t,e,i){if(!e)return t;let n=i&&i.encode||VP,s=i&&i.serialize,r;if(s?r=s(e,i):r=O.isURLSearchParams(e)?e.toString():new Gx(e,i).toString(n),r){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+r;}return t}var Zl=class{constructor(){this.handlers=[];}use(e,i,n){return this.handlers.push({fulfilled:e,rejected:i,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null);}clear(){this.handlers&&(this.handlers=[]);}forEach(e){O.forEach(this.handlers,function(n){n!==null&&e(n);});}},eu=Zl;var Xn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Vx=KP__default.default.URLSearchParams;var Ie={isNode:!0,classes:{URLSearchParams:Vx,FormData:Ho,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]};function tu(t,e){return $i(t,new Ie.classes.URLSearchParams,Object.assign({visitor:function(i,n,s,r){return O.isBuffer(i)?(this.append(n,i.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}function JP(t){return O.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function YP(t){let e={},i=Object.keys(t),n,s=i.length,r;for(n=0;n=i.length;return o=!o&&O.isArray(s)?s.length:o,u?(O.hasOwnProp(s,o)?s[o]=[s[o],n]:s[o]=n,!a):((!s[o]||!O.isObject(s[o]))&&(s[o]=[]),e(i,n,s[o],r)&&O.isArray(s[o])&&(s[o]=YP(s[o])),!a)}if(O.isFormData(t)&&O.isFunction(t.entries)){let i={};return O.forEachEntry(t,(n,s)=>{e(JP(n),s,i,0);}),i}return null}var Wo=XP;var QP={"Content-Type":void 0};function ZP(t,e,i){if(O.isString(t))try{return (e||JSON.parse)(t),O.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return (i||JSON.stringify)(t)}var Go={transitional:Xn,adapter:["xhr","http"],transformRequest:[function(e,i){let n=i.getContentType()||"",s=n.indexOf("application/json")>-1,r=O.isObject(e);if(r&&O.isHTMLForm(e)&&(e=new FormData(e)),O.isFormData(e))return s&&s?JSON.stringify(Wo(e)):e;if(O.isArrayBuffer(e)||O.isBuffer(e)||O.isStream(e)||O.isFile(e)||O.isBlob(e))return e;if(O.isArrayBufferView(e))return e.buffer;if(O.isURLSearchParams(e))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(r){if(n.indexOf("application/x-www-form-urlencoded")>-1)return tu(e,this.formSerializer).toString();if((a=O.isFileList(e))||n.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return $i(a?{"files[]":e}:e,u&&new u,this.formSerializer)}}return r||s?(i.setContentType("application/json",!1),ZP(e)):e}],transformResponse:[function(e){let i=this.transitional||Go.transitional,n=i&&i.forcedJSONParsing,s=this.responseType==="json";if(e&&O.isString(e)&&(n&&!this.responseType||s)){let o=!(i&&i.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?ie.from(a,ie.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ie.classes.FormData,Blob:Ie.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};O.forEach(["delete","get","head"],function(e){Go.headers[e]={};});O.forEach(["post","put","patch"],function(e){Go.headers[e]=O.merge(QP);});var Qn=Go;var eF=O.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Kx=t=>{let e={},i,n,s;return t&&t.split(`
+`).forEach(function(o){s=o.indexOf(":"),i=o.substring(0,s).trim().toLowerCase(),n=o.substring(s+1).trim(),!(!i||e[i]&&eF[i])&&(i==="set-cookie"?e[i]?e[i].push(n):e[i]=[n]:e[i]=e[i]?e[i]+", "+n:n);}),e};var Jx=Symbol("internals");function is(t){return t&&String(t).trim().toLowerCase()}function Vo(t){return t===!1||t==null?t:O.isArray(t)?t.map(Vo):String(t)}function tF(t){let e=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=i.exec(t);)e[n[1]]=n[2];return e}var iF=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function iu(t,e,i,n,s){if(O.isFunction(n))return n.call(this,e,i);if(s&&(e=i),!!O.isString(e)){if(O.isString(n))return e.indexOf(n)!==-1;if(O.isRegExp(n))return n.test(e)}}function nF(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,i,n)=>i.toUpperCase()+n)}function rF(t,e){let i=O.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+i,{value:function(s,r,o){return this[n].call(this,e,s,r,o)},configurable:!0});});}var Zn=class{constructor(e){e&&this.set(e);}set(e,i,n){let s=this;function r(a,u,f){let c=is(u);if(!c)throw new Error("header name must be a non-empty string");let d=O.findKey(s,c);(!d||s[d]===void 0||f===!0||f===void 0&&s[d]!==!1)&&(s[d||u]=Vo(a));}let o=(a,u)=>O.forEach(a,(f,c)=>r(f,c,u));return O.isPlainObject(e)||e instanceof this.constructor?o(e,i):O.isString(e)&&(e=e.trim())&&!iF(e)?o(Kx(e),i):e!=null&&r(i,e,n),this}get(e,i){if(e=is(e),e){let n=O.findKey(this,e);if(n){let s=this[n];if(!i)return s;if(i===!0)return tF(s);if(O.isFunction(i))return i.call(this,s,n);if(O.isRegExp(i))return i.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,i){if(e=is(e),e){let n=O.findKey(this,e);return !!(n&&this[n]!==void 0&&(!i||iu(this,this[n],n,i)))}return !1}delete(e,i){let n=this,s=!1;function r(o){if(o=is(o),o){let a=O.findKey(n,o);a&&(!i||iu(n,n[a],a,i))&&(delete n[a],s=!0);}}return O.isArray(e)?e.forEach(r):r(e),s}clear(e){let i=Object.keys(this),n=i.length,s=!1;for(;n--;){let r=i[n];(!e||iu(this,this[r],r,e,!0))&&(delete this[r],s=!0);}return s}normalize(e){let i=this,n={};return O.forEach(this,(s,r)=>{let o=O.findKey(n,r);if(o){i[o]=Vo(s),delete i[r];return}let a=e?nF(r):String(r).trim();a!==r&&delete i[r],i[a]=Vo(s),n[a]=!0;}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let i=Object.create(null);return O.forEach(this,(n,s)=>{n!=null&&n!==!1&&(i[s]=e&&O.isArray(n)?n.join(", "):n);}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,i])=>e+": "+i).join(`
+`)}get[Symbol.toStringTag](){return "AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...i){let n=new this(e);return i.forEach(s=>n.set(s)),n}static accessor(e){let n=(this[Jx]=this[Jx]={accessors:{}}).accessors,s=this.prototype;function r(o){let a=is(o);n[a]||(rF(s,o),n[a]=!0);}return O.isArray(e)?e.forEach(r):r(e),this}};Zn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);O.freezeMethods(Zn.prototype);O.freezeMethods(Zn);var je=Zn;function ns(t,e){let i=this||Qn,n=e||i,s=je.from(n.headers),r=n.data;return O.forEach(t,function(a){r=a.call(i,r,s.normalize(),e?e.status:void 0);}),s.normalize(),r}function rs(t){return !!(t&&t.__CANCEL__)}function Yx(t,e,i){ie.call(this,t??"canceled",ie.ERR_CANCELED,e,i),this.name="CanceledError";}O.inherits(Yx,ie,{__CANCEL__:!0});var Ht=Yx;function Bi(t,e,i){let n=i.config.validateStatus;!i.status||!n||n(i.status)?t(i):e(new ie("Request failed with status code "+i.status,[ie.ERR_BAD_REQUEST,ie.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i));}function nu(t){return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function ru(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function pn(t,e){return t&&!nu(e)?ru(t,e):e}var Tv=ni(Qx(),1),Ov=ni(vv(),1);var hn="1.4.0";function cs(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}var zF=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function du(t,e,i){let n=i&&i.Blob||Ie.classes.Blob,s=cs(t);if(e===void 0&&n&&(e=!0),s==="data"){t=s.length?t.slice(s.length+1):t;let r=zF.exec(t);if(!r)throw new ie("Invalid URL",ie.ERR_INVALID_URL);let o=r[1],a=r[2],u=r[3],f=Buffer.from(decodeURIComponent(u),a?"base64":"utf8");if(e){if(!n)throw new ie("Blob is not supported",ie.ERR_NOT_SUPPORT);return new n([f],{type:o})}return f}throw new ie("Unsupported protocol "+s,ie.ERR_NOT_SUPPORT)}function MF(t,e){let i=0,n=1e3/e,s=null;return function(o,a){let u=Date.now();if(o||u-i>n)return s&&(clearTimeout(s),s=null),i=u,t.apply(null,a);s||(s=setTimeout(()=>(s=null,i=Date.now(),t.apply(null,a)),n-(u-i)));}}var bv=MF;function HF(t,e){t=t||10;let i=new Array(t),n=new Array(t),s=0,r=0,o;return e=e!==void 0?e:1e3,function(u){let f=Date.now(),c=n[r];o||(o=f),i[s]=u,n[s]=f;let d=r,h=0;for(;d!==s;)h+=i[d++],d=d%t;if(s=(s+1)%t,s===r&&(r=(r+1)%t),f-o!O.isUndefined(u[a])),super({readableHighWaterMark:e.chunkSize});let i=this,n=this[Zo]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},s=Qo(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",a=>{a==="progress"&&(n.isCaptured||(n.isCaptured=!0));});let r=0;n.updateProgress=bv(function(){let u=n.length,f=n.bytesSeen,c=f-r;if(!c||i.destroyed)return;let d=s(c);r=f,process.nextTick(()=>{i.emit("progress",{loaded:f,total:u,progress:u?f/u:void 0,bytes:c,rate:d||void 0,estimated:d&&u&&f<=u?(u-f)/d:void 0});});},n.ticksRate);let o=()=>{n.updateProgress(!0);};this.once("end",o),this.once("error",o);}_read(e){let i=this[Zo];return i.onReadCallback&&i.onReadCallback(),super._read(e)}_transform(e,i,n){let s=this,r=this[Zo],o=r.maxRate,a=this.readableHighWaterMark,u=r.timeWindow,f=1e3/u,c=o/f,d=r.minChunkSize!==!1?Math.max(r.minChunkSize,c*.01):0;function h(y,b){let A=Buffer.byteLength(y);r.bytesSeen+=A,r.bytes+=A,r.isCaptured&&r.updateProgress(),s.push(y)?process.nextTick(b):r.onReadCallback=()=>{r.onReadCallback=null,process.nextTick(b);};}let g=(y,b)=>{let A=Buffer.byteLength(y),_=null,S=a,C,I=0;if(o){let q=Date.now();(!r.ts||(I=q-r.ts)>=u)&&(r.ts=q,C=c-r.bytes,r.bytes=C<0?-C:0,I=0),C=c-r.bytes;}if(o){if(C<=0)return setTimeout(()=>{b(null,y);},u-I);CS&&A-S>d&&(_=y.subarray(S),y=y.subarray(0,S)),h(y,_?()=>{process.nextTick(b,null,_);}:b);};g(e,function y(b,A){if(b)return n(b);A?g(A,y):n(null);});}setLength(e){return this[Zo].length=+e,this}},hu=mu;var{asyncIterator:wv}=Symbol,GF=async function*(t){t.stream?yield*t.stream():t.arrayBuffer?yield await t.arrayBuffer():t[wv]?yield*t[wv]():yield t;},ea=GF;var JF=O.ALPHABET.ALPHA_DIGIT+"-_",ls=new nI.TextEncoder,Di=`\r
+`,YF=ls.encode(Di),XF=2,gu=class{constructor(e,i){let{escapeName:n}=this.constructor,s=O.isString(i),r=`Content-Disposition: form-data; name="${n(e)}"${!s&&i.name?`; filename="${n(i.name)}"`:""}${Di}`;s?i=ls.encode(String(i).replace(/\r?\n|\r\n?/g,Di)):r+=`Content-Type: ${i.type||"application/octet-stream"}${Di}`,this.headers=ls.encode(r+Di),this.contentLength=s?i.byteLength:i.size,this.size=this.headers.byteLength+this.contentLength+XF,this.name=e,this.value=i;}async*encode(){yield this.headers;let{value:e}=this;O.isTypedArray(e)?yield e:yield*ea(e),yield YF;}static escapeName(e){return String(e).replace(/[\r\n"]/g,i=>({"\r":"%0D","\n":"%0A",'"':"%22"})[i])}},QF=(t,e,i)=>{let{tag:n="form-data-boundary",size:s=25,boundary:r=n+"-"+O.generateString(s,JF)}=i||{};if(!O.isFormData(t))throw TypeError("FormData instance required");if(r.length<1||r.length>70)throw Error("boundary must be 10-70 characters long");let o=ls.encode("--"+r+Di),a=ls.encode("--"+r+"--"+Di+Di),u=a.byteLength,f=Array.from(t.entries()).map(([d,h])=>{let g=new gu(d,h);return u+=g.size,g});u+=o.byteLength*f.length,u=O.toFiniteNumber(u);let c={"Content-Type":`multipart/form-data; boundary=${r}`};return Number.isFinite(u)&&(c["Content-Length"]=u),e&&e(c),sr.Readable.from(async function*(){for(let d of f)yield o,yield*d.encode();yield a;}())},Sv=QF;var yu=class extends sr__default.default.Transform{__transform(e,i,n){this.push(e),n();}_transform(e,i,n){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let s=Buffer.alloc(2);s[0]=120,s[1]=156,this.push(s,i);}this.__transform(e,i,n);}},Ev=yu;var eI=(t,e)=>O.isAsyncFn(t)?function(...i){let n=i.pop();t.apply(this,i).then(s=>{try{e?n(null,...e(s)):n(null,s);}catch(r){n(r);}},n);}:t,Av=eI;var _v={flush:Ni__default.default.constants.Z_SYNC_FLUSH,finishFlush:Ni__default.default.constants.Z_SYNC_FLUSH},sI={flush:Ni__default.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Ni__default.default.constants.BROTLI_OPERATION_FLUSH},Rv=O.isFunction(Ni__default.default.createBrotliDecompress),{http:oI,https:aI}=Ov.default,cI=/https:?/,Cv=Ie.protocols.map(t=>t+":");function lI(t){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t);}function kv(t,e,i){let n=e;if(!n&&n!==!1){let s=(0, Tv.getProxyForUrl)(i);s&&(n=new URL(s));}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let r=Buffer.from(n.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+r;}t.headers.host=t.hostname+(t.port?":"+t.port:"");let s=n.hostname||n.host;t.hostname=s,t.host=s,t.port=n.port,t.path=i,n.protocol&&(t.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`);}t.beforeRedirects.proxy=function(r){kv(r,e,r.href);};}var uI=typeof process<"u"&&O.kindOf(process)==="process",pI=t=>new Promise((e,i)=>{let n,s,r=(u,f)=>{s||(s=!0,n&&n(u,f));},o=u=>{r(u),e(u);},a=u=>{r(u,!0),i(u);};t(o,a,u=>n=u).catch(a);}),Pv=uI&&function(e){return pI(async function(n,s,r){let{data:o,lookup:a,family:u}=e,{responseType:f,responseEncoding:c}=e,d=e.method.toUpperCase(),h,g=!1,y;a&&O.isAsyncFn(a)&&(a=Av(a,U=>{if(O.isString(U))U=[U,U.indexOf(".")<0?6:4];else if(!O.isArray(U))throw new TypeError("lookup async function must return an array [ip: string, family: number]]");return U}));let b=new rI__default.default,A=()=>{e.cancelToken&&e.cancelToken.unsubscribe(_),e.signal&&e.signal.removeEventListener("abort",_),b.removeAllListeners();};r((U,M)=>{h=!0,M&&(g=!0,A());});function _(U){b.emit("abort",!U||U.type?new Ht(null,e,y):U);}b.once("abort",s),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(_),e.signal&&(e.signal.aborted?_():e.signal.addEventListener("abort",_)));let S=pn(e.baseURL,e.url),C=new URL(S,"http://localhost"),I=C.protocol||Cv[0];if(I==="data:"){let U;if(d!=="GET")return Bi(n,s,{status:405,statusText:"method not allowed",headers:{},config:e});try{U=du(e.url,f==="blob",{Blob:e.env&&e.env.Blob});}catch(M){throw ie.from(M,ie.ERR_BAD_REQUEST,e)}return f==="text"?(U=U.toString(c),(!c||c==="utf8")&&(U=O.stripBOM(U))):f==="stream"&&(U=sr__default.default.Readable.from(U)),Bi(n,s,{data:U,status:200,statusText:"OK",headers:new je,config:e})}if(Cv.indexOf(I)===-1)return s(new ie("Unsupported protocol "+I,ie.ERR_BAD_REQUEST,e));let q=je.from(e.headers).normalize();q.set("User-Agent","axios/"+hn,!1);let J=e.onDownloadProgress,W=e.onUploadProgress,B=e.maxRate,j,G;if(O.isSpecCompliantForm(o)){let U=q.getContentType(/boundary=([-_\w\d]{10,70})/i);o=Sv(o,M=>{q.set(M);},{tag:`axios-${hn}-boundary`,boundary:U&&U[1]||void 0});}else if(O.isFormData(o)&&O.isFunction(o.getHeaders)){if(q.set(o.getHeaders()),!q.hasContentLength())try{let U=await nI__default.default.promisify(o.getLength).call(o);Number.isFinite(U)&&U>=0&&q.setContentLength(U);}catch{}}else if(O.isBlob(o))o.size&&q.setContentType(o.type||"application/octet-stream"),q.setContentLength(o.size||0),o=sr__default.default.Readable.from(ea(o));else if(o&&!O.isStream(o)){if(!Buffer.isBuffer(o))if(O.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(O.isString(o))o=Buffer.from(o,"utf-8");else return s(new ie("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",ie.ERR_BAD_REQUEST,e));if(q.setContentLength(o.length,!1),e.maxBodyLength>-1&&o.length>e.maxBodyLength)return s(new ie("Request body larger than maxBodyLength limit",ie.ERR_BAD_REQUEST,e))}let T=O.toFiniteNumber(q.getContentLength());O.isArray(B)?(j=B[0],G=B[1]):j=G=B,o&&(W||j)&&(O.isStream(o)||(o=sr__default.default.Readable.from(o,{objectMode:!1})),o=sr__default.default.pipeline([o,new hu({length:T,maxRate:O.toFiniteNumber(j)})],O.noop),W&&o.on("progress",U=>{W(Object.assign(U,{upload:!0}));}));let Y;if(e.auth){let U=e.auth.username||"",M=e.auth.password||"";Y=U+":"+M;}if(!Y&&C.username){let U=C.username,M=C.password;Y=U+":"+M;}Y&&q.delete("authorization");let Z;try{Z=un(C.pathname+C.search,e.params,e.paramsSerializer).replace(/^\?/,"");}catch(U){let M=new Error(U.message);return M.config=e,M.url=e.url,M.exists=!0,s(M)}q.set("Accept-Encoding","gzip, compress, deflate"+(Rv?", br":""),!1);let re={path:Z,method:d,headers:q.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:Y,protocol:I,family:u,lookup:a,beforeRedirect:lI,beforeRedirects:{}};e.socketPath?re.socketPath=e.socketPath:(re.hostname=C.hostname,re.port=C.port,kv(re,e.proxy,I+"//"+C.hostname+(C.port?":"+C.port:"")+re.path));let k,F=cI.test(re.protocol);if(re.agent=F?e.httpsAgent:e.httpAgent,e.transport?k=e.transport:e.maxRedirects===0?k=F?iI__default.default:tI__default.default:(e.maxRedirects&&(re.maxRedirects=e.maxRedirects),e.beforeRedirect&&(re.beforeRedirects.config=e.beforeRedirect),k=F?aI:oI),e.maxBodyLength>-1?re.maxBodyLength=e.maxBodyLength:re.maxBodyLength=1/0,e.insecureHTTPParser&&(re.insecureHTTPParser=e.insecureHTTPParser),y=k.request(re,function(M){if(y.destroyed)return;let ae=[M],Le=+M.headers["content-length"];if(J){let Oe=new hu({length:O.toFiniteNumber(Le),maxRate:O.toFiniteNumber(G)});J&&Oe.on("progress",pe=>{J(Object.assign(pe,{download:!0}));}),ae.push(Oe);}let he=M,St=M.req||y;if(e.decompress!==!1&&M.headers["content-encoding"])switch((d==="HEAD"||M.statusCode===204)&&delete M.headers["content-encoding"],M.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":ae.push(Ni__default.default.createUnzip(_v)),delete M.headers["content-encoding"];break;case"deflate":ae.push(new Ev),ae.push(Ni__default.default.createUnzip(_v)),delete M.headers["content-encoding"];break;case"br":Rv&&(ae.push(Ni__default.default.createBrotliDecompress(sI)),delete M.headers["content-encoding"]);}he=ae.length>1?sr__default.default.pipeline(ae,O.noop):ae[0];let sn=sr__default.default.finished(he,()=>{sn(),A();}),ot={status:M.statusCode,statusText:M.statusMessage,headers:new je(M.headers),config:e,request:St};if(f==="stream")ot.data=he,Bi(n,s,ot);else {let Oe=[],pe=0;he.on("data",function(qe){Oe.push(qe),pe+=qe.length,e.maxContentLength>-1&&pe>e.maxContentLength&&(g=!0,he.destroy(),s(new ie("maxContentLength size of "+e.maxContentLength+" exceeded",ie.ERR_BAD_RESPONSE,e,St)));}),he.on("aborted",function(){if(g)return;let qe=new ie("maxContentLength size of "+e.maxContentLength+" exceeded",ie.ERR_BAD_RESPONSE,e,St);he.destroy(qe),s(qe);}),he.on("error",function(qe){y.destroyed||s(ie.from(qe,null,e,St));}),he.on("end",function(){try{let qe=Oe.length===1?Oe[0]:Buffer.concat(Oe);f!=="arraybuffer"&&(qe=qe.toString(c),(!c||c==="utf8")&&(qe=O.stripBOM(qe))),ot.data=qe;}catch(qe){s(ie.from(qe,null,e,ot.request,ot));}Bi(n,s,ot);});}b.once("abort",Oe=>{he.destroyed||(he.emit("error",Oe),he.destroy());});}),b.once("abort",U=>{s(U),y.destroy(U);}),y.on("error",function(M){s(ie.from(M,null,e,y));}),y.on("socket",function(M){M.setKeepAlive(!0,1e3*60);}),e.timeout){let U=parseInt(e.timeout,10);if(isNaN(U)){s(new ie("error trying to parse `config.timeout` to int",ie.ERR_BAD_OPTION_VALUE,e,y));return}y.setTimeout(U,function(){if(h)return;let ae=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",Le=e.transitional||Xn;e.timeoutErrorMessage&&(ae=e.timeoutErrorMessage),s(new ie(ae,Le.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,e,y)),_();});}if(O.isStream(o)){let U=!1,M=!1;o.on("end",()=>{U=!0;}),o.once("error",ae=>{M=!0,y.destroy(ae);}),o.on("close",()=>{!U&&!M&&_(new Ht("Request stream has been aborted",e,y));}),o.pipe(y);}else y.end(o);})};var Fv=Ie.isStandardBrowserEnv?function(){return {write:function(i,n,s,r,o,a){let u=[];u.push(i+"="+encodeURIComponent(n)),O.isNumber(s)&&u.push("expires="+new Date(s).toGMTString()),O.isString(r)&&u.push("path="+r),O.isString(o)&&u.push("domain="+o),a===!0&&u.push("secure"),document.cookie=u.join("; ");},read:function(i){let n=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(i){this.write(i,"",Date.now()-864e5);}}}():function(){return {write:function(){},read:function(){return null},remove:function(){}}}();var Iv=Ie.isStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),n;function s(r){let o=r;return e&&(i.setAttribute("href",o),o=i.href),i.setAttribute("href",o),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return n=s(window.location.href),function(o){let a=O.isString(o)?s(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return !0}}();function Lv(t,e){let i=0,n=Qo(50,250);return s=>{let r=s.loaded,o=s.lengthComputable?s.total:void 0,a=r-i,u=n(a),f=r<=o;i=r;let c={loaded:r,total:o,progress:o?r/o:void 0,bytes:a,rate:u||void 0,estimated:u&&o&&f?(o-r)/u:void 0,event:s};c[e?"download":"upload"]=!0,t(c);}}var fI=typeof XMLHttpRequest<"u",qv=fI&&function(t){return new Promise(function(i,n){let s=t.data,r=je.from(t.headers).normalize(),o=t.responseType,a;function u(){t.cancelToken&&t.cancelToken.unsubscribe(a),t.signal&&t.signal.removeEventListener("abort",a);}O.isFormData(s)&&(Ie.isStandardBrowserEnv||Ie.isStandardBrowserWebWorkerEnv?r.setContentType(!1):r.setContentType("multipart/form-data;",!1));let f=new XMLHttpRequest;if(t.auth){let g=t.auth.username||"",y=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";r.set("Authorization","Basic "+btoa(g+":"+y));}let c=pn(t.baseURL,t.url);f.open(t.method.toUpperCase(),un(c,t.params,t.paramsSerializer),!0),f.timeout=t.timeout;function d(){if(!f)return;let g=je.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),b={data:!o||o==="text"||o==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:g,config:t,request:f};Bi(function(_){i(_),u();},function(_){n(_),u();},b),f=null;}if("onloadend"in f?f.onloadend=d:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(d);},f.onabort=function(){f&&(n(new ie("Request aborted",ie.ECONNABORTED,t,f)),f=null);},f.onerror=function(){n(new ie("Network Error",ie.ERR_NETWORK,t,f)),f=null;},f.ontimeout=function(){let y=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",b=t.transitional||Xn;t.timeoutErrorMessage&&(y=t.timeoutErrorMessage),n(new ie(y,b.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,t,f)),f=null;},Ie.isStandardBrowserEnv){let g=(t.withCredentials||Iv(c))&&t.xsrfCookieName&&Fv.read(t.xsrfCookieName);g&&r.set(t.xsrfHeaderName,g);}s===void 0&&r.setContentType(null),"setRequestHeader"in f&&O.forEach(r.toJSON(),function(y,b){f.setRequestHeader(b,y);}),O.isUndefined(t.withCredentials)||(f.withCredentials=!!t.withCredentials),o&&o!=="json"&&(f.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&f.addEventListener("progress",Lv(t.onDownloadProgress,!0)),typeof t.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",Lv(t.onUploadProgress)),(t.cancelToken||t.signal)&&(a=g=>{f&&(n(!g||g.type?new Ht(null,t,f):g),f.abort(),f=null);},t.cancelToken&&t.cancelToken.subscribe(a),t.signal&&(t.signal.aborted?a():t.signal.addEventListener("abort",a)));let h=cs(c);if(h&&Ie.protocols.indexOf(h)===-1){n(new ie("Unsupported protocol "+h+":",ie.ERR_BAD_REQUEST,t));return}f.send(s||null);})};var ta={http:Pv,xhr:qv};O.forEach(ta,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e});}catch{}Object.defineProperty(t,"adapterName",{value:e});}});var jv={getAdapter:t=>{t=O.isArray(t)?t:[t];let{length:e}=t,i,n;for(let s=0;st instanceof je?t.toJSON():t;function bi(t,e){e=e||{};let i={};function n(f,c,d){return O.isPlainObject(f)&&O.isPlainObject(c)?O.merge.call({caseless:d},f,c):O.isPlainObject(c)?O.merge({},c):O.isArray(c)?c.slice():c}function s(f,c,d){if(O.isUndefined(c)){if(!O.isUndefined(f))return n(void 0,f,d)}else return n(f,c,d)}function r(f,c){if(!O.isUndefined(c))return n(void 0,c)}function o(f,c){if(O.isUndefined(c)){if(!O.isUndefined(f))return n(void 0,f)}else return n(void 0,c)}function a(f,c,d){if(d in e)return n(f,c);if(d in t)return n(void 0,f)}let u={url:r,method:r,data:r,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(f,c)=>s($v(f),$v(c),!0)};return O.forEach(Object.keys(Object.assign({},t,e)),function(c){let d=u[c]||s,h=d(t[c],e[c],c);O.isUndefined(h)&&d!==a||(i[c]=h);}),i}var vu={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{vu[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t};});var Bv={};vu.transitional=function(e,i,n){function s(r,o){return "[Axios v"+hn+"] Transitional option '"+r+"'"+o+(n?". "+n:"")}return (r,o,a)=>{if(e===!1)throw new ie(s(o," has been removed"+(i?" in "+i:"")),ie.ERR_DEPRECATED);return i&&!Bv[o]&&(Bv[o]=!0,console.warn(s(o," has been deprecated since v"+i+" and will be removed in the near future"))),e?e(r,o,a):!0}};function dI(t,e,i){if(typeof t!="object")throw new ie("options must be an object",ie.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),s=n.length;for(;s-- >0;){let r=n[s],o=e[r];if(o){let a=t[r],u=a===void 0||o(a,r,t);if(u!==!0)throw new ie("option "+r+" must be "+u,ie.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new ie("Unknown option "+r,ie.ERR_BAD_OPTION)}}var na={assertOptions:dI,validators:vu};var Ui=na.validators,or=class{constructor(e){this.defaults=e,this.interceptors={request:new eu,response:new eu};}request(e,i){typeof e=="string"?(i=i||{},i.url=e):i=e||{},i=bi(this.defaults,i);let{transitional:n,paramsSerializer:s,headers:r}=i;n!==void 0&&na.assertOptions(n,{silentJSONParsing:Ui.transitional(Ui.boolean),forcedJSONParsing:Ui.transitional(Ui.boolean),clarifyTimeoutError:Ui.transitional(Ui.boolean)},!1),s!=null&&(O.isFunction(s)?i.paramsSerializer={serialize:s}:na.assertOptions(s,{encode:Ui.function,serialize:Ui.function},!0)),i.method=(i.method||this.defaults.method||"get").toLowerCase();let o;o=r&&O.merge(r.common,r[i.method]),o&&O.forEach(["delete","get","head","post","put","patch","common"],y=>{delete r[y];}),i.headers=je.concat(o,r);let a=[],u=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(i)===!1||(u=u&&b.synchronous,a.unshift(b.fulfilled,b.rejected));});let f=[];this.interceptors.response.forEach(function(b){f.push(b.fulfilled,b.rejected);});let c,d=0,h;if(!u){let y=[ia.bind(this),void 0];for(y.unshift.apply(y,a),y.push.apply(y,f),h=y.length,c=Promise.resolve(i);d{if(!n._listeners)return;let r=n._listeners.length;for(;r-- >0;)n._listeners[r](s);n._listeners=null;}),this.promise.then=s=>{let r,o=new Promise(a=>{n.subscribe(a),r=a;}).then(s);return o.cancel=function(){n.unsubscribe(r);},o},e(function(r,o,a){n.reason||(n.reason=new Ht(r,o,a),i(n.reason));});}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e];}unsubscribe(e){if(!this._listeners)return;let i=this._listeners.indexOf(e);i!==-1&&this._listeners.splice(i,1);}static source(){let e;return {token:new t(function(s){e=s;}),cancel:e}}},Dv=bu;function wu(t){return function(i){return t.apply(null,i)}}function Su(t){return O.isObject(t)&&t.isAxiosError===!0}var Eu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Eu).forEach(([t,e])=>{Eu[e]=t;});var Nv=Eu;function Uv(t){let e=new us(t),i=Zr(us.prototype.request,e);return O.extend(i,us.prototype,e,{allOwnKeys:!0}),O.extend(i,e,null,{allOwnKeys:!0}),i.create=function(s){return Uv(bi(t,s))},i}var $e=Uv(Qn);$e.Axios=us;$e.CanceledError=Ht;$e.CancelToken=Dv;$e.isCancel=rs;$e.VERSION=hn;$e.toFormData=$i;$e.AxiosError=ie;$e.Cancel=$e.CanceledError;$e.all=function(e){return Promise.all(e)};$e.spread=wu;$e.isAxiosError=Su;$e.mergeConfig=bi;$e.AxiosHeaders=je;$e.formToJSON=t=>Wo(O.isHTMLForm(t)?new FormData(t):t);$e.HttpStatusCode=Nv;$e.default=$e;var ps=$e;var _u=ni(Xl());var wi=class extends Error{constructor(i,n,s){super(s);this.name="ApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.body=n.body,this.request=i;}};var ra=class extends Error{constructor(e){super(e),this.name="CancelError";}get isCancelled(){return !0}},ai,ci,Gt,zi,gn,fs,ar,ft=class{constructor(e){ce(this,ai,void 0);ce(this,ci,void 0);ce(this,Gt,void 0);ce(this,zi,void 0);ce(this,gn,void 0);ce(this,fs,void 0);ce(this,ar,void 0);ne(this,ai,!1),ne(this,ci,!1),ne(this,Gt,!1),ne(this,zi,[]),ne(this,gn,new Promise((i,n)=>{ne(this,fs,i),ne(this,ar,n);let s=a=>{var u;w(this,ai)||w(this,ci)||w(this,Gt)||(ne(this,ai,!0),(u=w(this,fs))==null||u.call(this,a));},r=a=>{var u;w(this,ai)||w(this,ci)||w(this,Gt)||(ne(this,ci,!0),(u=w(this,ar))==null||u.call(this,a));},o=a=>{w(this,ai)||w(this,ci)||w(this,Gt)||w(this,zi).push(a);};return Object.defineProperty(o,"isResolved",{get:()=>w(this,ai)}),Object.defineProperty(o,"isRejected",{get:()=>w(this,ci)}),Object.defineProperty(o,"isCancelled",{get:()=>w(this,Gt)}),e(s,r,o)}));}get[Symbol.toStringTag](){return "Cancellable Promise"}then(e,i){return w(this,gn).then(e,i)}catch(e){return w(this,gn).catch(e)}finally(e){return w(this,gn).finally(e)}cancel(){var e;if(!(w(this,ai)||w(this,ci)||w(this,Gt))){if(ne(this,Gt,!0),w(this,zi).length)try{for(let i of w(this,zi))i();}catch(i){console.warn("Cancellation threw an error",i);return}w(this,zi).length=0,(e=w(this,ar))==null||e.call(this,new ra("Request aborted"));}}get isCancelled(){return w(this,Gt)}};ai=new WeakMap,ci=new WeakMap,Gt=new WeakMap,zi=new WeakMap,gn=new WeakMap,fs=new WeakMap,ar=new WeakMap;var Ru=t=>t!=null,oa=t=>typeof t=="string",Au=t=>oa(t)&&t!=="",zv=t=>typeof t=="object"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.arrayBuffer=="function"&&typeof t.constructor=="function"&&typeof t.constructor.name=="string"&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag]),mI=t=>t instanceof _u.default,hI=t=>t>=200&&t<300,gI=t=>{try{return btoa(t)}catch{return Buffer.from(t).toString("base64")}},yI=t=>{let e=[],i=(s,r)=>{e.push(`${encodeURIComponent(s)}=${encodeURIComponent(String(r))}`);},n=(s,r)=>{Ru(r)&&(Array.isArray(r)?r.forEach(o=>{n(s,o);}):typeof r=="object"?Object.entries(r).forEach(([o,a])=>{n(`${s}[${o}]`,a);}):i(s,r));};return Object.entries(t).forEach(([s,r])=>{n(s,r);}),e.length>0?`?${e.join("&")}`:""},xI=(t,e)=>{let i=t.ENCODE_PATH||encodeURI,n=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(r,o)=>e.path?.hasOwnProperty(o)?i(String(e.path[o])):r),s=`${t.BASE}${n}`;return e.query?`${s}${yI(e.query)}`:s},vI=t=>{if(t.formData){let e=new _u.default,i=(n,s)=>{oa(s)||zv(s)?e.append(n,s):e.append(n,JSON.stringify(s));};return Object.entries(t.formData).filter(([n,s])=>Ru(s)).forEach(([n,s])=>{Array.isArray(s)?s.forEach(r=>i(n,r)):i(n,s);}),e}},sa=async(t,e)=>typeof e=="function"?e(t):e,bI=async(t,e,i)=>{let n=await sa(e,t.TOKEN),s=await sa(e,t.USERNAME),r=await sa(e,t.PASSWORD),o=await sa(e,t.HEADERS),a=typeof i?.getHeaders=="function"&&i?.getHeaders()||{},u=Object.entries({Accept:"application/json",...o,...e.headers,...a}).filter(([f,c])=>Ru(c)).reduce((f,[c,d])=>({...f,[c]:String(d)}),{});if(Au(n)&&(u.Authorization=`Bearer ${n}`),Au(s)&&Au(r)){let f=gI(`${s}:${r}`);u.Authorization=`Basic ${f}`;}return e.body&&(e.mediaType?u["Content-Type"]=e.mediaType:zv(e.body)?u["Content-Type"]=e.body.type||"application/octet-stream":oa(e.body)?u["Content-Type"]="text/plain":mI(e.body)||(u["Content-Type"]="application/json")),u},wI=t=>{if(t.body)return t.body},SI=async(t,e,i,n,s,r,o)=>{let a=ps.CancelToken.source(),u={url:i,headers:r,data:n??s,method:e.method,withCredentials:t.WITH_CREDENTIALS,cancelToken:a.token};o(()=>a.cancel("The user aborted a request."));try{return await ps.request(u)}catch(f){let c=f;if(c.response)return c.response;throw f}},EI=(t,e)=>{if(e){let i=t.headers[e];if(oa(i))return i}},AI=t=>{if(t.status!==204)return t.data},_I=(t,e)=>{let n={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...t.errors}[e.status];if(n)throw new wi(t,e,n);if(!e.ok)throw new wi(t,e,"Generic Error")},Mv=(t,e)=>new ft(async(i,n,s)=>{try{let r=xI(t,e),o=vI(e),a=wI(e),u=await bI(t,e,o);if(!s.isCancelled){let f=await SI(t,e,r,a,o,u,s),c=AI(f),d=EI(f,e.responseHeader),h={url:r,ok:hI(f.status),status:f.status,statusText:f.statusText,body:d??c};_I(e,h),i(h.body);}}catch(r){n(r);}});var cr=class extends Qr{constructor(e){super(e);}request(e){return Mv(this.config,e)}};var ds=class{constructor(e){this.httpRequest=e;}completion(e){return this.httpRequest.request({method:"POST",url:"/v1/completions",body:e,mediaType:"application/json",errors:{400:"Bad Request"}})}event(e){return this.httpRequest.request({method:"POST",url:"/v1/events",body:e,mediaType:"application/json",errors:{400:"Bad Request"}})}health(){return this.httpRequest.request({method:"POST",url:"/v1/health"})}};var ms=class{constructor(e,i=cr){this.request=new i({BASE:e?.BASE??"https://playground.app.tabbyml.com",VERSION:e?.VERSION??"0.1.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH}),this.v1=new ds(this.request);}};var Kv=ni(Vv());function Ue(t){return t.match(/.*(?:$|\r?\n)/g).filter(Boolean)}function Tu(t){return t.match(/\w+|\W+/g).filter(Boolean)}function ze(t){return t.trim().length===0}function lr(t,e){return Kv.get(t,e)}function Mi(t,e){return new ft((i,n,s)=>{t.then(r=>{i(r);}).catch(r=>{n(r);}),s(()=>{e();});})}function Ou(t){this.message=t;}Ou.prototype=new Error,Ou.prototype.name="InvalidCharacterError";var Jv=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new Ou("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,n,s=0,r=0,o="";n=e.charAt(r++);~n&&(i=s%4?64*i+n:n,s++%4)?o+=String.fromCharCode(255&i>>(-2*s&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return o};function OI(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw "Illegal base64url string!"}try{return function(i){return decodeURIComponent(Jv(i).replace(/(.)/g,function(n,s){var r=s.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}(e)}catch{return Jv(e)}}function aa(t){this.message=t;}function kI(t,e){if(typeof t!="string")throw new aa("Invalid token specified");var i=(e=e||{}).header===!0?0:1;try{return JSON.parse(OI(t.split(".")[i]))}catch(n){throw new aa("Invalid token specified: "+n.message)}}aa.prototype=new Error,aa.prototype.name="InvalidTokenError";var ca=kI;var gs=class{constructor(e){this.httpRequest=e;}deviceToken(e){return this.httpRequest.request({method:"POST",url:"/device-token",body:e})}deviceTokenAccept(e){return this.httpRequest.request({method:"POST",url:"/device-token/accept",query:e})}deviceTokenRefresh(e){return this.httpRequest.request({method:"POST",url:"/device-token/refresh",headers:{Authorization:`Bearer ${e}`}})}usage(e){return this.httpRequest.request({method:"POST",url:"/usage",body:e})}};var yn=class{constructor(e,i=cr){this.request=new i({BASE:e?.BASE??"https://app.tabbyml.com/api",VERSION:e?.VERSION??"0.0.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH}),this.api=new gs(this.request);}};ys();var ba=(()=>{let t=H("path").join(H("os").homedir(),".tabby","agent","data.json"),e=Vu();return {data:{},load:async function(){this.data=await e.readJson(t,{throws:!1})||{};},save:async function(){await e.outputJson(t,this.data);}}})();Qi();var Tt=class Tt extends rI.EventEmitter{constructor(i){super();this.logger=rt.child({component:"Auth"});this.dataStore=null;this.refreshTokenTimer=null;this.authApi=null;this.jwt=null;this.endpoint=i.endpoint,this.dataStore=i.dataStore||ba,this.authApi=new yn,this.scheduleRefreshToken();}static async create(i){let n=new Tt(i);return await n.load(),n}get token(){return this.jwt?.token}get user(){return this.jwt?.payload.email}async load(){if(this.dataStore)try{await this.dataStore.load();let i=this.dataStore.data.auth?.[this.endpoint]?.jwt;if(typeof i=="string"&&this.jwt?.token!==i){this.logger.debug({storedJwt:i},"Load jwt from data store.");let n={token:i,payload:ca(i)};n.payload.exp*1e3-Date.now()"u")return;delete this.dataStore.data.auth[this.endpoint];}await this.dataStore.save(),this.logger.debug("Save changes to data store.");}catch(i){this.logger.error({error:i},"Error when saving auth");}}async reset(){this.jwt&&(this.jwt=null,await this.save());}requestAuthUrl(){return new ft(async(i,n,s)=>{let r;s(()=>{r?.cancel();});try{if(await this.reset(),s.isCancelled)return;this.logger.debug("Start to request device token"),r=this.authApi.api.deviceToken({auth_url:this.endpoint});let o=await r;this.logger.debug({deviceToken:o},"Request device token response");let a=new URL(Tt.authPageUrl);a.searchParams.append("code",o.data.code),i({authUrl:a.toString(),code:o.data.code});}catch(o){this.logger.error({error:o},"Error when requesting token"),n(o);}})}pollingToken(i){return new ft((n,s,r)=>{let o,a=setInterval(async()=>{try{o=this.authApi.api.deviceTokenAccept({code:i});let u=await o;this.logger.debug({response:u},"Poll jwt response"),this.jwt={token:u.data.jwt,payload:ca(u.data.jwt)},super.emit("updated",this.jwt),await this.save(),clearInterval(a),n(!0);}catch(u){u instanceof wi&&[400,401,403,405].indexOf(u.status)!==-1?this.logger.debug({error:u},"Expected error when polling jwt"):this.logger.error({error:u},"Error when polling jwt");}},Tt.tokenStrategy.polling.interval);setTimeout(()=>{clearInterval(a),s(new Error("Timeout when polling token"));},Tt.tokenStrategy.polling.timeout),r(()=>{o?.cancel(),clearInterval(a);});})}async refreshToken(i,n={maxTry:1,retryDelay:1e3},s=0){try{this.logger.debug({retry:s},"Start to refresh token");let r=await this.authApi.api.deviceTokenRefresh(i.token);return this.logger.debug({refreshedJwt:r},"Refresh token response"),{token:r.data.jwt,payload:ca(r.data.jwt)}}catch(r){if(r instanceof wi&&[400,401,403,405].indexOf(r.status)!==-1)this.logger.debug({error:r},"Error when refreshing jwt");else if(this.logger.error({error:r},"Unknown error when refreshing jwt"),ssetTimeout(o,n.retryDelay)),this.refreshToken(i,n,s+1);throw {...r,retry:s}}}scheduleRefreshToken(){this.refreshTokenTimer=setInterval(async()=>{if(!this.jwt)return null;if(this.jwt.payload.exp*1e3-Date.now(){let t=H("events"),e=Vu(),i=vE(),n=y_();class s extends t{constructor(u){super();this.data={};this.watcher=null;this.logger=(Qi(),Tc(dE)).rootLogger.child({component:"ConfigFile"});this.filepath=u;}get config(){return this.data}async load(){try{let u=await e.readFile(this.filepath,"utf8");this.data=i.parse(u),super.emit("updated",this.data);}catch(u){this.logger.error({error:u},"Failed to load config file");}}watch(){this.watcher=n.watch(this.filepath,{interval:1e3}),this.watcher.on("add",this.load.bind(this)),this.watcher.on("change",this.load.bind(this));}}let r=H("path").join(H("os").homedir(),".tabby","agent","config.toml");return new s(r)})();var Ns=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,v_=new Set,zf=typeof process=="object"&&process?process:{},b_=(t,e,i,n)=>{typeof zf.emitWarning=="function"?zf.emitWarning(t,e,i,n):console.error(`[${i}] ${e}: ${t}`);},cc=globalThis.AbortController,x_=globalThis.AbortSignal;if(typeof cc>"u"){x_=class{constructor(){le(this,"onabort");le(this,"_onabort",[]);le(this,"reason");le(this,"aborted",!1);}addEventListener(n,s){this._onabort.push(s);}},cc=class{constructor(){le(this,"signal",new x_);e();}abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n);}}};let t=zf.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,b_("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var LU=t=>!v_.has(t),Zi=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),w_=t=>Zi(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Ar:null:null,Ar=class extends Array{constructor(e){super(e),this.fill(0);}},_r,Tn=class Tn{constructor(e,i){le(this,"heap");le(this,"length");if(!w(Tn,_r))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=w_(e);if(!i)return [];ne(Tn,_r,!0);let n=new Tn(e,i);return ne(Tn,_r,!1),n}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};_r=new WeakMap,ce(Tn,_r,!1);var Mf=Tn,Xt,Pt,fi,Qt,Rr,Be,Zt,De,Ae,fe,ut,Ft,st,Ge,ei,tt,Ri,Ci,ti,di,nn,bt,zs,Hf,On,Ti,Ms,It,uc,S_,kn,Cr,Hs,mi,en,hi,tn,Ws,Wf,Tr,oc,Or,ac,Se,_e,Gs,Gf,Pn,Us,Vf=class Vf{constructor(e){ce(this,zs);ce(this,uc);ce(this,mi);ce(this,hi);ce(this,Ws);ce(this,Tr);ce(this,Or);ce(this,Se);ce(this,Gs);ce(this,Pn);ce(this,Xt,void 0);ce(this,Pt,void 0);ce(this,fi,void 0);ce(this,Qt,void 0);ce(this,Rr,void 0);le(this,"ttl");le(this,"ttlResolution");le(this,"ttlAutopurge");le(this,"updateAgeOnGet");le(this,"updateAgeOnHas");le(this,"allowStale");le(this,"noDisposeOnSet");le(this,"noUpdateTTL");le(this,"maxEntrySize");le(this,"sizeCalculation");le(this,"noDeleteOnFetchRejection");le(this,"noDeleteOnStaleGet");le(this,"allowStaleOnFetchAbort");le(this,"allowStaleOnFetchRejection");le(this,"ignoreFetchAbort");ce(this,Be,void 0);ce(this,Zt,void 0);ce(this,De,void 0);ce(this,Ae,void 0);ce(this,fe,void 0);ce(this,ut,void 0);ce(this,Ft,void 0);ce(this,st,void 0);ce(this,Ge,void 0);ce(this,ei,void 0);ce(this,tt,void 0);ce(this,Ri,void 0);ce(this,Ci,void 0);ce(this,ti,void 0);ce(this,di,void 0);ce(this,nn,void 0);ce(this,bt,void 0);ce(this,On,()=>{});ce(this,Ti,()=>{});ce(this,Ms,()=>{});ce(this,It,()=>!1);ce(this,kn,e=>{});ce(this,Cr,(e,i,n)=>{});ce(this,Hs,(e,i,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});let{max:i=0,ttl:n,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:u,dispose:f,disposeAfter:c,noDisposeOnSet:d,noUpdateTTL:h,maxSize:g=0,maxEntrySize:y=0,sizeCalculation:b,fetchMethod:A,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:C,allowStaleOnFetchAbort:I,ignoreFetchAbort:q}=e;if(i!==0&&!Zi(i))throw new TypeError("max option must be a nonnegative integer");let J=i?w_(i):Array;if(!J)throw new Error("invalid max value: "+i);if(ne(this,Xt,i),ne(this,Pt,g),this.maxEntrySize=y||w(this,Pt),this.sizeCalculation=b,this.sizeCalculation){if(!w(this,Pt)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(A!==void 0&&typeof A!="function")throw new TypeError("fetchMethod must be a function if specified");if(ne(this,Rr,A),ne(this,nn,!!A),ne(this,De,new Map),ne(this,Ae,new Array(i).fill(void 0)),ne(this,fe,new Array(i).fill(void 0)),ne(this,ut,new J(i)),ne(this,Ft,new J(i)),ne(this,st,0),ne(this,Ge,0),ne(this,ei,Mf.create(i)),ne(this,Be,0),ne(this,Zt,0),typeof f=="function"&&ne(this,fi,f),typeof c=="function"?(ne(this,Qt,c),ne(this,tt,[])):(ne(this,Qt,void 0),ne(this,tt,void 0)),ne(this,di,!!w(this,fi)),ne(this,bt,!!w(this,Qt)),this.noDisposeOnSet=!!d,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!C,this.allowStaleOnFetchAbort=!!I,this.ignoreFetchAbort=!!q,this.maxEntrySize!==0){if(w(this,Pt)!==0&&!Zi(w(this,Pt)))throw new TypeError("maxSize must be a positive integer if specified");if(!Zi(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");oe(this,uc,S_).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Zi(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=n||0,this.ttl){if(!Zi(this.ttl))throw new TypeError("ttl must be a positive integer if specified");oe(this,zs,Hf).call(this);}if(w(this,Xt)===0&&this.ttl===0&&w(this,Pt)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!w(this,Xt)&&!w(this,Pt)){let W="LRU_CACHE_UNBOUNDED";LU(W)&&(v_.add(W),b_("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",W,Vf));}}static unsafeExposeInternals(e){return {starts:w(e,Ci),ttls:w(e,ti),sizes:w(e,Ri),keyMap:w(e,De),keyList:w(e,Ae),valList:w(e,fe),next:w(e,ut),prev:w(e,Ft),get head(){return w(e,st)},get tail(){return w(e,Ge)},free:w(e,ei),isBackgroundFetch:i=>{var n;return oe(n=e,Se,_e).call(n,i)},backgroundFetch:(i,n,s,r)=>{var o;return oe(o=e,Or,ac).call(o,i,n,s,r)},moveToTail:i=>{var n;return oe(n=e,Pn,Us).call(n,i)},indexes:i=>{var n;return oe(n=e,mi,en).call(n,i)},rindexes:i=>{var n;return oe(n=e,hi,tn).call(n,i)},isStale:i=>{var n;return w(n=e,It).call(n,i)}}}get max(){return w(this,Xt)}get maxSize(){return w(this,Pt)}get calculatedSize(){return w(this,Zt)}get size(){return w(this,Be)}get fetchMethod(){return w(this,Rr)}get dispose(){return w(this,fi)}get disposeAfter(){return w(this,Qt)}getRemainingTTL(e){return w(this,De).has(e)?1/0:0}*entries(){for(let e of oe(this,mi,en).call(this))w(this,fe)[e]!==void 0&&w(this,Ae)[e]!==void 0&&!oe(this,Se,_e).call(this,w(this,fe)[e])&&(yield [w(this,Ae)[e],w(this,fe)[e]]);}*rentries(){for(let e of oe(this,hi,tn).call(this))w(this,fe)[e]!==void 0&&w(this,Ae)[e]!==void 0&&!oe(this,Se,_e).call(this,w(this,fe)[e])&&(yield [w(this,Ae)[e],w(this,fe)[e]]);}*keys(){for(let e of oe(this,mi,en).call(this)){let i=w(this,Ae)[e];i!==void 0&&!oe(this,Se,_e).call(this,w(this,fe)[e])&&(yield i);}}*rkeys(){for(let e of oe(this,hi,tn).call(this)){let i=w(this,Ae)[e];i!==void 0&&!oe(this,Se,_e).call(this,w(this,fe)[e])&&(yield i);}}*values(){for(let e of oe(this,mi,en).call(this))w(this,fe)[e]!==void 0&&!oe(this,Se,_e).call(this,w(this,fe)[e])&&(yield w(this,fe)[e]);}*rvalues(){for(let e of oe(this,hi,tn).call(this))w(this,fe)[e]!==void 0&&!oe(this,Se,_e).call(this,w(this,fe)[e])&&(yield w(this,fe)[e]);}[Symbol.iterator](){return this.entries()}find(e,i={}){for(let n of oe(this,mi,en).call(this)){let s=w(this,fe)[n],r=oe(this,Se,_e).call(this,s)?s.__staleWhileFetching:s;if(r!==void 0&&e(r,w(this,Ae)[n],this))return this.get(w(this,Ae)[n],i)}}forEach(e,i=this){for(let n of oe(this,mi,en).call(this)){let s=w(this,fe)[n],r=oe(this,Se,_e).call(this,s)?s.__staleWhileFetching:s;r!==void 0&&e.call(i,r,w(this,Ae)[n],this);}}rforEach(e,i=this){for(let n of oe(this,hi,tn).call(this)){let s=w(this,fe)[n],r=oe(this,Se,_e).call(this,s)?s.__staleWhileFetching:s;r!==void 0&&e.call(i,r,w(this,Ae)[n],this);}}purgeStale(){let e=!1;for(let i of oe(this,hi,tn).call(this,{allowStale:!0}))w(this,It).call(this,i)&&(this.delete(w(this,Ae)[i]),e=!0);return e}dump(){let e=[];for(let i of oe(this,mi,en).call(this,{allowStale:!0})){let n=w(this,Ae)[i],s=w(this,fe)[i],r=oe(this,Se,_e).call(this,s)?s.__staleWhileFetching:s;if(r===void 0||n===void 0)continue;let o={value:r};if(w(this,ti)&&w(this,Ci)){o.ttl=w(this,ti)[i];let a=Ns.now()-w(this,Ci)[i];o.start=Math.floor(Date.now()-a);}w(this,Ri)&&(o.size=w(this,Ri)[i]),e.unshift([n,o]);}return e}load(e){this.clear();for(let[i,n]of e){if(n.start){let s=Date.now()-n.start;n.start=Ns.now()-s;}this.set(i,n.value,n);}}set(e,i,n={}){var h,g;if(i===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:u}=n,{noUpdateTTL:f=this.noUpdateTTL}=n,c=w(this,Hs).call(this,e,i,n.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.delete(e),this;let d=w(this,Be)===0?void 0:w(this,De).get(e);if(d===void 0)d=w(this,Be)===0?w(this,Ge):w(this,ei).length!==0?w(this,ei).pop():w(this,Be)===w(this,Xt)?oe(this,Tr,oc).call(this,!1):w(this,Be),w(this,Ae)[d]=e,w(this,fe)[d]=i,w(this,De).set(e,d),w(this,ut)[w(this,Ge)]=d,w(this,Ft)[d]=w(this,Ge),ne(this,Ge,d),ro(this,Be)._++,w(this,Cr).call(this,d,c,u),u&&(u.set="add"),f=!1;else {oe(this,Pn,Us).call(this,d);let y=w(this,fe)[d];if(i!==y){if(w(this,nn)&&oe(this,Se,_e).call(this,y)?y.__abortController.abort(new Error("replaced")):o||(w(this,di)&&((h=w(this,fi))==null||h.call(this,y,e,"set")),w(this,bt)&&w(this,tt)?.push([y,e,"set"])),w(this,kn).call(this,d),w(this,Cr).call(this,d,c,u),w(this,fe)[d]=i,u){u.set="replace";let b=y&&oe(this,Se,_e).call(this,y)?y.__staleWhileFetching:y;b!==void 0&&(u.oldValue=b);}}else u&&(u.set="update");}if(s!==0&&!w(this,ti)&&oe(this,zs,Hf).call(this),w(this,ti)&&(f||w(this,Ms).call(this,d,s,r),u&&w(this,Ti).call(this,u,d)),!o&&w(this,bt)&&w(this,tt)){let y=w(this,tt),b;for(;b=y?.shift();)(g=w(this,Qt))==null||g.call(this,...b);}return this}pop(){var e;try{for(;w(this,Be);){let i=w(this,fe)[w(this,st)];if(oe(this,Tr,oc).call(this,!0),oe(this,Se,_e).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(w(this,bt)&&w(this,tt)){let i=w(this,tt),n;for(;n=i?.shift();)(e=w(this,Qt))==null||e.call(this,...n);}}}has(e,i={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=i,r=w(this,De).get(e);if(r!==void 0){let o=w(this,fe)[r];if(oe(this,Se,_e).call(this,o)&&o.__staleWhileFetching===void 0)return !1;if(w(this,It).call(this,r))s&&(s.has="stale",w(this,Ti).call(this,s,r));else return n&&w(this,On).call(this,r),s&&(s.has="hit",w(this,Ti).call(this,s,r)),!0}else s&&(s.has="miss");return !1}peek(e,i={}){let{allowStale:n=this.allowStale}=i,s=w(this,De).get(e);if(s!==void 0&&(n||!w(this,It).call(this,s))){let r=w(this,fe)[s];return oe(this,Se,_e).call(this,r)?r.__staleWhileFetching:r}}async fetch(e,i={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:u=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:g=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:b,forceRefresh:A=!1,status:_,signal:S}=i;if(!w(this,nn))return _&&(_.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:_});let C={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:a,size:u,sizeCalculation:f,noUpdateTTL:c,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:y,ignoreFetchAbort:g,status:_,signal:S},I=w(this,De).get(e);if(I===void 0){_&&(_.fetch="miss");let q=oe(this,Or,ac).call(this,e,I,C,b);return q.__returned=q}else {let q=w(this,fe)[I];if(oe(this,Se,_e).call(this,q)){let G=n&&q.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",G&&(_.returnedStale=!0)),G?q.__staleWhileFetching:q.__returned=q}let J=w(this,It).call(this,I);if(!A&&!J)return _&&(_.fetch="hit"),oe(this,Pn,Us).call(this,I),s&&w(this,On).call(this,I),_&&w(this,Ti).call(this,_,I),q;let W=oe(this,Or,ac).call(this,e,I,C,b),j=W.__staleWhileFetching!==void 0&&n;return _&&(_.fetch=J?"stale":"refresh",j&&J&&(_.returnedStale=!0)),j?W.__staleWhileFetching:W.__returned=W}}get(e,i={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=i,a=w(this,De).get(e);if(a!==void 0){let u=w(this,fe)[a],f=oe(this,Se,_e).call(this,u);return o&&w(this,Ti).call(this,o,a),w(this,It).call(this,a)?(o&&(o.get="stale"),f?(o&&n&&u.__staleWhileFetching!==void 0&&(o.returnedStale=!0),n?u.__staleWhileFetching:void 0):(r||this.delete(e),o&&n&&(o.returnedStale=!0),n?u:void 0)):(o&&(o.get="hit"),f?u.__staleWhileFetching:(oe(this,Pn,Us).call(this,a),s&&w(this,On).call(this,a),u))}else o&&(o.get="miss");}delete(e){var n,s;let i=!1;if(w(this,Be)!==0){let r=w(this,De).get(e);if(r!==void 0)if(i=!0,w(this,Be)===1)this.clear();else {w(this,kn).call(this,r);let o=w(this,fe)[r];oe(this,Se,_e).call(this,o)?o.__abortController.abort(new Error("deleted")):(w(this,di)||w(this,bt))&&(w(this,di)&&((n=w(this,fi))==null||n.call(this,o,e,"delete")),w(this,bt)&&w(this,tt)?.push([o,e,"delete"])),w(this,De).delete(e),w(this,Ae)[r]=void 0,w(this,fe)[r]=void 0,r===w(this,Ge)?ne(this,Ge,w(this,Ft)[r]):r===w(this,st)?ne(this,st,w(this,ut)[r]):(w(this,ut)[w(this,Ft)[r]]=w(this,ut)[r],w(this,Ft)[w(this,ut)[r]]=w(this,Ft)[r]),ro(this,Be)._--,w(this,ei).push(r);}}if(w(this,bt)&&w(this,tt)?.length){let r=w(this,tt),o;for(;o=r?.shift();)(s=w(this,Qt))==null||s.call(this,...o);}return i}clear(){var e,i;for(let n of oe(this,hi,tn).call(this,{allowStale:!0})){let s=w(this,fe)[n];if(oe(this,Se,_e).call(this,s))s.__abortController.abort(new Error("deleted"));else {let r=w(this,Ae)[n];w(this,di)&&((e=w(this,fi))==null||e.call(this,s,r,"delete")),w(this,bt)&&w(this,tt)?.push([s,r,"delete"]);}}if(w(this,De).clear(),w(this,fe).fill(void 0),w(this,Ae).fill(void 0),w(this,ti)&&w(this,Ci)&&(w(this,ti).fill(0),w(this,Ci).fill(0)),w(this,Ri)&&w(this,Ri).fill(0),ne(this,st,0),ne(this,Ge,0),w(this,ei).length=0,ne(this,Zt,0),ne(this,Be,0),w(this,bt)&&w(this,tt)){let n=w(this,tt),s;for(;s=n?.shift();)(i=w(this,Qt))==null||i.call(this,...s);}}};Xt=new WeakMap,Pt=new WeakMap,fi=new WeakMap,Qt=new WeakMap,Rr=new WeakMap,Be=new WeakMap,Zt=new WeakMap,De=new WeakMap,Ae=new WeakMap,fe=new WeakMap,ut=new WeakMap,Ft=new WeakMap,st=new WeakMap,Ge=new WeakMap,ei=new WeakMap,tt=new WeakMap,Ri=new WeakMap,Ci=new WeakMap,ti=new WeakMap,di=new WeakMap,nn=new WeakMap,bt=new WeakMap,zs=new WeakSet,Hf=function(){let e=new Ar(w(this,Xt)),i=new Ar(w(this,Xt));ne(this,ti,e),ne(this,Ci,i),ne(this,Ms,(r,o,a=Ns.now())=>{if(i[r]=o!==0?a:0,e[r]=o,o!==0&&this.ttlAutopurge){let u=setTimeout(()=>{w(this,It).call(this,r)&&this.delete(w(this,Ae)[r]);},o+1);u.unref&&u.unref();}}),ne(this,On,r=>{i[r]=e[r]!==0?Ns.now():0;}),ne(this,Ti,(r,o)=>{if(e[o]){let a=e[o],u=i[o];r.ttl=a,r.start=u,r.now=n||s();let f=r.now-u;r.remainingTTL=a-f;}});let n=0,s=()=>{let r=Ns.now();if(this.ttlResolution>0){n=r;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref();}return r};this.getRemainingTTL=r=>{let o=w(this,De).get(r);if(o===void 0)return 0;let a=e[o],u=i[o];if(a===0||u===0)return 1/0;let f=(n||s())-u;return a-f},ne(this,It,r=>e[r]!==0&&i[r]!==0&&(n||s())-i[r]>e[r]);},On=new WeakMap,Ti=new WeakMap,Ms=new WeakMap,It=new WeakMap,uc=new WeakSet,S_=function(){let e=new Ar(w(this,Xt));ne(this,Zt,0),ne(this,Ri,e),ne(this,kn,i=>{ne(this,Zt,w(this,Zt)-e[i]),e[i]=0;}),ne(this,Hs,(i,n,s,r)=>{if(oe(this,Se,_e).call(this,n))return 0;if(!Zi(s))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(n,i),!Zi(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s}),ne(this,Cr,(i,n,s)=>{if(e[i]=n,w(this,Pt)){let r=w(this,Pt)-e[i];for(;w(this,Zt)>r;)oe(this,Tr,oc).call(this,!0);}ne(this,Zt,w(this,Zt)+e[i]),s&&(s.entrySize=n,s.totalCalculatedSize=w(this,Zt));});},kn=new WeakMap,Cr=new WeakMap,Hs=new WeakMap,mi=new WeakSet,en=function*({allowStale:e=this.allowStale}={}){if(w(this,Be))for(let i=w(this,Ge);!(!oe(this,Ws,Wf).call(this,i)||((e||!w(this,It).call(this,i))&&(yield i),i===w(this,st)));)i=w(this,Ft)[i];},hi=new WeakSet,tn=function*({allowStale:e=this.allowStale}={}){if(w(this,Be))for(let i=w(this,st);!(!oe(this,Ws,Wf).call(this,i)||((e||!w(this,It).call(this,i))&&(yield i),i===w(this,Ge)));)i=w(this,ut)[i];},Ws=new WeakSet,Wf=function(e){return e!==void 0&&w(this,De).get(w(this,Ae)[e])===e},Tr=new WeakSet,oc=function(e){var r;let i=w(this,st),n=w(this,Ae)[i],s=w(this,fe)[i];return w(this,nn)&&oe(this,Se,_e).call(this,s)?s.__abortController.abort(new Error("evicted")):(w(this,di)||w(this,bt))&&(w(this,di)&&((r=w(this,fi))==null||r.call(this,s,n,"evict")),w(this,bt)&&w(this,tt)?.push([s,n,"evict"])),w(this,kn).call(this,i),e&&(w(this,Ae)[i]=void 0,w(this,fe)[i]=void 0,w(this,ei).push(i)),w(this,Be)===1?(ne(this,st,ne(this,Ge,0)),w(this,ei).length=0):ne(this,st,w(this,ut)[i]),w(this,De).delete(n),ro(this,Be)._--,i},Or=new WeakSet,ac=function(e,i,n,s){let r=i===void 0?void 0:w(this,fe)[i];if(oe(this,Se,_e).call(this,r))return r;let o=new cc,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let u={signal:o.signal,options:n,context:s},f=(b,A=!1)=>{let{aborted:_}=o.signal,S=n.ignoreFetchAbort&&b!==void 0;if(n.status&&(_&&!A?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,S&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),_&&!S&&!A)return d(o.signal.reason);let C=g;return w(this,fe)[i]===g&&(b===void 0?C.__staleWhileFetching?w(this,fe)[i]=C.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,b,u.options))),b},c=b=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=b),d(b)),d=b=>{let{aborted:A}=o.signal,_=A&&n.allowStaleOnFetchAbort,S=_||n.allowStaleOnFetchRejection,C=S||n.noDeleteOnFetchRejection,I=g;if(w(this,fe)[i]===g&&(!C||I.__staleWhileFetching===void 0?this.delete(e):_||(w(this,fe)[i]=I.__staleWhileFetching)),S)return n.status&&I.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),I.__staleWhileFetching;if(I.__returned===I)throw b},h=(b,A)=>{var S;let _=(S=w(this,Rr))==null?void 0:S.call(this,e,r,u);_&&_ instanceof Promise&&_.then(C=>b(C),A),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(b(),n.allowStaleOnFetchAbort&&(b=C=>f(C,!0)));});};n.status&&(n.status.fetchDispatched=!0);let g=new Promise(h).then(f,c),y=Object.assign(g,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return i===void 0?(this.set(e,y,{...u.options,status:void 0}),i=w(this,De).get(e)):w(this,fe)[i]=y,y},Se=new WeakSet,_e=function(e){if(!w(this,nn))return !1;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof cc},Gs=new WeakSet,Gf=function(e,i){w(this,Ft)[i]=e,w(this,ut)[e]=i;},Pn=new WeakSet,Us=function(e){e!==w(this,Ge)&&(e===w(this,st)?ne(this,st,w(this,ut)[e]):oe(this,Gs,Gf).call(this,w(this,Ft)[e],w(this,ut)[e]),oe(this,Gs,Gf).call(this,w(this,Ge),e),ne(this,Ge,e));};var lc=Vf;var tR=ni(T_()),iR=ni(eR());Qi();var mc=class{constructor(){this.logger=rt.child({component:"CompletionCache"});this.options={maxSize:1*1024*1024,partiallyAcceptedCacheGeneration:{enabled:!0,perCharacter:{lines:1,words:10,max:30},perWord:{lines:1,max:20},perLine:{max:3}}};this.cache=new lc({maxSize:this.options.maxSize,sizeCalculation:iR.default});}has(e){return this.cache.has(this.hash(e))}set(e,i){for(let n of this.createCacheEntries(e,i))this.logger.debug({entry:n},"Setting cache entry"),this.cache.set(this.hash(n.key),n.value);this.logger.debug({size:this.cache.calculatedSize},"Cache size");}get(e){return this.cache.get(this.hash(e))}hash(e){return (0, tR.default)(e)}createCacheEntries(e,i){let n=[{key:e,value:i}];if(this.options.partiallyAcceptedCacheGeneration.enabled){let s=i.choices.map(r=>this.calculatePartiallyAcceptedPositions(r.text).map(o=>({prefix:r.text.slice(0,o),suffix:r.text.slice(o),choiceIndex:r.index}))).flat().reduce((r,o)=>(r[o.prefix]=r[o.prefix]||[],r[o.prefix].push({suffix:o.suffix,choiceIndex:o.choiceIndex}),r),{});for(let r in s){let o={...e,text:e.text.slice(0,e.position)+r+e.text.slice(e.position),position:e.position+r.length},a={...i,choices:s[r].map(u=>({index:u.choiceIndex,text:u.suffix}))};n.push({key:o,value:a});}}return n}calculatePartiallyAcceptedPositions(e){let i=[],n=this.options.partiallyAcceptedCacheGeneration,s=Ue(e),r=0,o=0;for(;rd.indexOf(f)===c).sort((f,c)=>f-c)}};Qi();var Ut=rt.child({component:"Postprocess"});function od(t){let e=t.text.slice(0,t.position),i=t.text.slice(t.position),n=Ue(e),s=Ue(i);return {request:t,prefix:e,suffix:i,prefixLines:n,suffixLines:s}}Array.prototype.distinct||(Array.prototype.distinct=function(t){return [...new Map(this.map(e=>[t?.(e)??e,e])).values()]});function ki(t){return async e=>(e.choices=(await Promise.all(e.choices.map(async i=>(i.text=await t(i.text),i)))).filter(i=>!!i.text).distinct(i=>i.text),e)}function vz(t){return /\n(\s*)\n/g}var nR=t=>e=>{let i=e.split(vz()),n=0,s=2,r=i.length-2;for(;r>=1;){if(ze(i[r])){r--;continue}let o=r-1;for(;o>=0&&ze(i[o]);)o--;if(o<0)break;let a=i[r].trim(),u=i[o].trim(),f=Math.max(3,.1*a.length,.1*u.length);if(lr(a,u)<=f)n++,r--;else break}return n>=s?(Ut.debug({inputBlocks:i,repetitionCount:n},"Remove repetitive blocks."),i.slice(0,r+1).join("").trimEnd()):e};var rR=()=>t=>{let e=Ue(t),i=0,n=5,s=e.length-2;for(;s>=1;){if(ze(e[s])){s--;continue}let r=s-1;for(;r>=0&&ze(e[r]);)r--;if(r<0)break;let o=e[s].trim(),a=e[r].trim(),u=Math.max(3,.1*o.length,.1*a.length);if(lr(o,a)<=u)i++,s=r;else break}return i>=n?(Ut.debug({inputLines:e,repetitionCount:i},"Remove repetitive lines."),e.slice(0,s+1).join("").trimEnd()):t};var bz=[/(.{3,}?)\1{5,}$/g,/(.{10,}?)\1{3,}$/g],sR=()=>t=>{let e=Ue(t),i=e.length-1;for(;i>=0&&ze(e[i]);)i--;if(i<0)return t;for(let n of bz){let s=e[i].match(n);if(s)return Ut.debug({inputLines:e,lineNumber:i,match:s},"Remove line ends with repetition."),i<1?null:e.slice(0,i).join("").trimEnd()}return t};function Ys(t){return t.match(/^[ \t]*/)?.[0]?.length||0}function wz(t,e){let i=1;for(;i=e.length?!0:Ys(e[i])=t.length-1?!1:Ys(t[e])e=>{let{prefix:i,suffix:n,prefixLines:s,suffixLines:r}=t,o=Ue(e),a=Ys(s[s.length-1]),u;for(u=1;ue=>{let i=t.request,n=i.text.slice(i.position);for(let s=Math.max(0,e.length-n.length);se=>{let{suffixLines:i}=t,n=Ue(e),s=0;for(;st=>ze(t)?null:t;async function lR(t,e){let i=od(t);return Promise.resolve(e).then(ki(sR())).then(ki(aR(i))).then(ki(cR(i))).then(ki(ad()))}async function uR(t,e){let i=od(t);return Promise.resolve(e).then(ki(nR())).then(ki(rR())).then(ki(oR(i))).then(ki(ad()))}Qi();var fR="tabby-agent",dR="0.0.1";ys();Qi();var hc=class t{constructor(){this.anonymousUsageTrackingApi=new yn;this.logger=rt.child({component:"AnonymousUsage"});this.systemData={agent:`${fR}, ${dR}`,browser:void 0,node:`${process.version} ${process.platform} ${H("os").arch()} ${H("os").release()}`};this.dataStore=null;}static async create(e){let i=new t;return i.dataStore=e.dataStore||ba,await i.checkAnonymousId(),i}async checkAnonymousId(){if(this.dataStore){try{await this.dataStore.load();}catch(e){this.logger.debug({error:e},"Error when loading anonymousId");}if(typeof this.dataStore.data.anonymousId=="string")this.anonymousId=this.dataStore.data.anonymousId;else {this.anonymousId=$n(),this.dataStore.data.anonymousId=this.anonymousId;try{await this.dataStore.save();}catch(e){this.logger.debug({error:e},"Error when saving anonymousId");}}}else this.anonymousId=$n();}async event(e,i){this.disabled||await this.anonymousUsageTrackingApi.api.usage({distinctId:this.anonymousId,event:e,properties:{...this.systemData,...i}}).catch(n=>{this.logger.error({error:n},"Error when sending anonymous usage data");});}};var Xs=class Xs extends rI.EventEmitter{constructor(){super();this.logger=rt.child({component:"TabbyAgent"});this.config=Uf;this.userConfig={};this.clientConfig={};this.status="notInitialized";this.dataStore=null;this.completionCache=new mc;this.tryingConnectTimer=null;this.tryingConnectTimer=setInterval(async()=>{this.status==="disconnected"&&(this.logger.debug("Trying to connect..."),await this.healthCheck());},Xs.tryConnectInterval);}static async create(i){let n=new Xs;return n.dataStore=i?.dataStore,n.anonymousUsageLogger=await hc.create({dataStore:i?.dataStore}),n}async applyConfig(){this.config=gc.default.all([Uf,this.userConfig,this.clientConfig]),Ts.forEach(i=>i.level=this.config.logs.level),this.anonymousUsageLogger.disabled=this.config.anonymousUsageTracking.disable,this.config.server.endpoint!==this.auth?.endpoint&&(this.auth=await Na.create({endpoint:this.config.server.endpoint,dataStore:this.dataStore}),this.auth.on("updated",this.setupApi.bind(this))),await this.setupApi();}async setupApi(){this.api=new ms({BASE:this.config.server.endpoint.replace(/\/+$/,""),TOKEN:this.auth?.token}),await this.healthCheck();}changeStatus(i){if(this.status!=i){this.status=i;let n={event:"statusChanged",status:i};this.logger.debug({event:n},"Status changed"),super.emit("statusChanged",n);}}callApi(i,n){this.logger.debug({api:i.name,request:n},"API request");let s=i.call(this.api.v1,n);return Mi(s.then(r=>(this.logger.debug({api:i.name,response:r},"API response"),this.changeStatus("ready"),r)).catch(r=>{throw r.isCancelled?this.logger.debug({api:i.name,error:r},"API request canceled"):r.name==="ApiError"&&[401,403,405].indexOf(r.status)!==-1?(this.logger.debug({api:i.name,error:r},"API unauthorized"),this.changeStatus("unauthorized")):r.name==="ApiError"?(this.logger.error({api:i.name,error:r},"API error"),this.changeStatus("disconnected")):(this.logger.error({api:i.name,error:r},"API request failed with unknown error"),this.changeStatus("disconnected")),r}),()=>{s.cancel();})}healthCheck(){return this.callApi(this.api.v1.health,{}).catch(()=>{})}createSegments(i){let n=i.maxPrefixLines??this.config.completion.maxPrefixLines,s=i.maxSuffixLines??this.config.completion.maxSuffixLines,r=i.text.slice(0,i.position),o=Ue(r),a=i.text.slice(i.position),u=Ue(a);return {prefix:o.slice(Math.max(o.length-n,0)).join(""),suffix:u.slice(0,s).join("")}}async initialize(i){if(i.client&&Ts.forEach(n=>n.setBindings?.({client:i.client})),Er&&(await Er.load(),this.userConfig=Er.config,Er.on("updated",async n=>{this.userConfig=n,await this.applyConfig();}),Er.watch()),i.config&&(this.clientConfig=(0, gc.default)(this.clientConfig,i.config)),await this.applyConfig(),this.status==="unauthorized"){let n={event:"authRequired",server:this.config.server};super.emit("authRequired",n);}return await this.anonymousUsageLogger.event("AgentInitialized",{client:i.client}),this.logger.debug({options:i},"Initialized"),this.status!=="notInitialized"}async updateConfig(i){let n=(0, gc.default)(this.clientConfig,i);if(!(0, cd.default)(this.clientConfig,n)){let s=!(0, cd.default)(this.config.server,n.server);this.clientConfig=n,await this.applyConfig();let r={event:"configUpdated",config:this.config};if(this.logger.debug({event:r},"Config updated"),super.emit("configUpdated",r),s&&this.status==="unauthorized"){let o={event:"authRequired",server:this.config.server};super.emit("authRequired",o);}}return !0}getConfig(){return this.config}getStatus(){return this.status}requestAuthUrl(){return this.status==="notInitialized"?Mi(Promise.reject("Agent is not initialized"),()=>{}):new ft(async(i,n,s)=>{let r;s(()=>{r?.cancel();}),await this.healthCheck(),!s.isCancelled&&(this.status==="unauthorized"&&(r=this.auth.requestAuthUrl(),i(r)),i(null));})}waitForAuthToken(i){if(this.status==="notInitialized")return Mi(Promise.reject("Agent is not initialized"),()=>{});let n=this.auth.pollingToken(i);return Mi(n.then(()=>this.setupApi()),()=>{n.cancel();})}getCompletions(i){if(this.status==="notInitialized")return Mi(Promise.reject("Agent is not initialized"),()=>{});let n=[];return Mi(Promise.resolve(null).then(s=>{if(s)return s;if(this.completionCache.has(i))return this.logger.debug({request:i},"Completion cache hit"),this.completionCache.get(i)}).then(s=>{if(s)return s;let r=this.createSegments(i);if(ze(r.prefix))return this.logger.debug("Segment prefix is blank, returning empty completion response"),{id:"agent-"+$n(),choices:[]};let o=this.callApi(this.api.v1.completion,{language:i.language,segments:r,user:this.auth?.user});return n.push(o),o.then(a=>lR(i,a)).then(a=>(this.completionCache.set(i,a),a))}).then(s=>uR(i,s)),()=>{n.forEach(s=>s.cancel());})}postEvent(i){return this.status==="notInitialized"?Mi(Promise.reject("Agent is not initialized"),()=>{}):this.callApi(this.api.v1.event,i)}};Xs.tryConnectInterval=1e3*30;var yc=Xs;var mR=["statusChanged","configUpdated","authRequired"];Qi();var xc=class{constructor(){this.inStream=process.stdin;this.outStream=process.stdout;this.logger=rt.child({component:"StdIO"});this.buffer="";this.ongoingRequests={};this.agent=null;}handleInput(e){let i=e.toString();this.buffer+=i;let n=Ue(this.buffer);if(!(n.length<1)){n[n.length-1].endsWith(`
+`)?this.buffer="":this.buffer=n.pop();for(let s of n){let r=null;try{r=JSON.parse(s);}catch(o){this.logger.error({error:o},`Failed to parse request: ${s}`);continue}this.logger.debug({request:r},"Received request"),this.handleRequest(r).then(o=>{this.sendResponse(o),this.logger.debug({response:o},"Sent response");});}}}async handleRequest(e){let i=[0,null];try{if(!this.agent)throw new Error(`Agent not bound.
+`);i[0]=e[0];let n=e[1].func;if(n==="cancelRequest")i[1]=this.cancelRequest(e);else {let s=this.agent[n];if(!s)throw new Error(`Unknown function: ${n}`);let r=s.apply(this.agent,e[1].args);typeof r=="object"&&typeof r.then=="function"?(this.ongoingRequests[e[0]]=r,i[1]=await r,delete this.ongoingRequests[e[0]]):i[1]=r;}}catch(n){this.logger.error({error:n,request:e},"Failed to handle request");}finally{return i}}cancelRequest(e){let i=this.ongoingRequests[e[1].args[0]];return i?(i instanceof ft&&i.cancel(),delete this.ongoingRequests[e[1].args[0]],!0):!1}sendResponse(e){this.outStream.write(JSON.stringify(e)+`
+`);}bind(e){this.agent=e;for(let i of mR)this.agent.on(i,n=>{this.sendResponse([0,n]);});}listen(){this.inStream.on("data",this.handleInput.bind(this));}};var hR=new xc;yc.create().then(t=>{hR.bind(t),hR.listen();});
+/*! Bundled license information:
+
+mime-db/index.js:
+ (*!
+ * mime-db
+ * Copyright(c) 2014 Jonathan Ong
+ * Copyright(c) 2015-2022 Douglas Christopher Wilson
+ * MIT Licensed
+ *)
+
+mime-types/index.js:
+ (*!
+ * mime-types
+ * Copyright(c) 2014 Jonathan Ong
+ * Copyright(c) 2015 Douglas Christopher Wilson
+ * MIT Licensed
+ *)
+
+normalize-path/index.js:
+ (*!
+ * normalize-path
+ *
+ * Copyright (c) 2014-2018, Jon Schlinkert.
+ * Released under the MIT License.
+ *)
+
+is-extglob/index.js:
+ (*!
+ * is-extglob
+ *
+ * Copyright (c) 2014-2016, Jon Schlinkert.
+ * Licensed under the MIT License.
+ *)
+
+is-glob/index.js:
+ (*!
+ * is-glob
+ *
+ * Copyright (c) 2014-2017, Jon Schlinkert.
+ * Released under the MIT License.
+ *)
+
+is-number/index.js:
+ (*!
+ * is-number
+ *
+ * Copyright (c) 2014-present, Jon Schlinkert.
+ * Released under the MIT License.
+ *)
+
+to-regex-range/index.js:
+ (*!
+ * to-regex-range
+ *
+ * Copyright (c) 2015-present, Jon Schlinkert.
+ * Released under the MIT License.
+ *)
+
+fill-range/index.js:
+ (*!
+ * fill-range
+ *
+ * Copyright (c) 2014-present, Jon Schlinkert.
+ * Licensed under the MIT License.
+ *)
+
+ieee754/index.js:
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *)
+
+buffer/index.js:
+ (*!
+ * The buffer module from node.js, for the browser.
+ *
+ * @author Feross Aboukhadijeh
+ * @license MIT
+ *)
+*/
+//# sourceMappingURL=out.js.map
+//# sourceMappingURL=cli.js.map
\ No newline at end of file
diff --git a/clients/intellij/package.json b/clients/intellij/package.json
new file mode 100644
index 0000000..9eb8d7f
--- /dev/null
+++ b/clients/intellij/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "intellij-tabby",
+ "version": "0.0.1",
+ "description": "IntelliJ plugin for Tabby AI coding assistant.",
+ "repository": "https://github.com/TabbyML/tabby",
+ "scripts": {
+ "preupgrade-agent": "cd ../tabby-agent && yarn build",
+ "upgrade-agent": "rimraf ./node_scripts && cpy ../tabby-agent/dist/cli.js ./node_scripts/ --flat --rename=tabby-agent.js"
+ },
+ "devDependencies": {
+ "cpy-cli": "^4.2.0",
+ "rimraf": "^5.0.1",
+ "tabby-agent": "0.0.1"
+ }
+}
diff --git a/clients/intellij/settings.gradle.kts b/clients/intellij/settings.gradle.kts
new file mode 100644
index 0000000..96df5c8
--- /dev/null
+++ b/clients/intellij/settings.gradle.kts
@@ -0,0 +1,8 @@
+pluginManagement {
+ repositories {
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+
+rootProject.name = "intellij-tabby"
\ No newline at end of file
diff --git a/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/actions/AcceptCompletion.kt b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/actions/AcceptCompletion.kt
new file mode 100644
index 0000000..940bae2
--- /dev/null
+++ b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/actions/AcceptCompletion.kt
@@ -0,0 +1,28 @@
+package com.tabbyml.intellijtabby.actions
+
+import com.intellij.openapi.actionSystem.ActionUpdateThread
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import com.intellij.openapi.actionSystem.CommonDataKeys
+import com.intellij.openapi.components.service
+import com.tabbyml.intellijtabby.editor.InlineCompletionService
+
+
+class AcceptCompletion : AnAction() {
+ override fun actionPerformed(e: AnActionEvent) {
+ val inlineCompletionService = service()
+ val editor = e.getRequiredData(CommonDataKeys.EDITOR)
+ inlineCompletionService.accept(editor)
+ }
+
+ override fun update(e: AnActionEvent) {
+ val inlineCompletionService = service()
+ e.presentation.isEnabled = e.getData(CommonDataKeys.EDITOR) != null
+ && e.project != null
+ && inlineCompletionService.currentText != null
+ }
+
+ override fun getActionUpdateThread(): ActionUpdateThread {
+ return ActionUpdateThread.EDT
+ }
+}
diff --git a/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/actions/DismissCompletion.kt b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/actions/DismissCompletion.kt
new file mode 100644
index 0000000..60d345f
--- /dev/null
+++ b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/actions/DismissCompletion.kt
@@ -0,0 +1,27 @@
+package com.tabbyml.intellijtabby.actions
+
+import com.intellij.openapi.actionSystem.ActionUpdateThread
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import com.intellij.openapi.actionSystem.CommonDataKeys
+import com.intellij.openapi.components.service
+import com.tabbyml.intellijtabby.editor.InlineCompletionService
+
+
+class DismissCompletion : AnAction() {
+ override fun actionPerformed(e: AnActionEvent) {
+ val inlineCompletionService = service()
+ inlineCompletionService.dismiss()
+ }
+
+ override fun update(e: AnActionEvent) {
+ val inlineCompletionService = service()
+ e.presentation.isEnabled = e.getData(CommonDataKeys.EDITOR) != null
+ && e.project != null
+ && inlineCompletionService.currentText != null
+ }
+
+ override fun getActionUpdateThread(): ActionUpdateThread {
+ return ActionUpdateThread.EDT
+ }
+}
diff --git a/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/actions/TriggerCompletion.kt b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/actions/TriggerCompletion.kt
new file mode 100644
index 0000000..0062ff0
--- /dev/null
+++ b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/actions/TriggerCompletion.kt
@@ -0,0 +1,40 @@
+package com.tabbyml.intellijtabby.actions
+
+import com.intellij.openapi.actionSystem.ActionUpdateThread
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import com.intellij.openapi.actionSystem.CommonDataKeys
+import com.intellij.openapi.application.invokeLater
+import com.intellij.openapi.components.service
+import com.tabbyml.intellijtabby.agent.AgentService
+import com.tabbyml.intellijtabby.editor.InlineCompletionService
+
+
+class TriggerCompletion : AnAction() {
+ override fun actionPerformed(e: AnActionEvent) {
+ val agentService = service()
+ val inlineCompletionService = service()
+ val editor = e.getRequiredData(CommonDataKeys.EDITOR)
+ val file = e.getRequiredData(CommonDataKeys.PSI_FILE)
+ val offset = editor.caretModel.primaryCaret.offset
+
+ inlineCompletionService.dismiss()
+ agentService.getCompletion(editor, file, offset)?.thenAccept {
+ invokeLater {
+ inlineCompletionService.show(editor, offset, it)
+ }
+ }
+ }
+
+ override fun update(e: AnActionEvent) {
+ val inlineCompletionService = service()
+ e.presentation.isEnabled = e.project != null
+ && e.getData(CommonDataKeys.EDITOR) != null
+ && e.getData(CommonDataKeys.PSI_FILE) != null
+ && inlineCompletionService.currentText == null
+ }
+
+ override fun getActionUpdateThread(): ActionUpdateThread {
+ return ActionUpdateThread.BGT
+ }
+}
diff --git a/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/agent/Agent.kt b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/agent/Agent.kt
new file mode 100644
index 0000000..e3de992
--- /dev/null
+++ b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/agent/Agent.kt
@@ -0,0 +1,146 @@
+package com.tabbyml.intellijtabby.agent
+
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.intellij.execution.configurations.GeneralCommandLine
+import com.intellij.execution.configurations.PathEnvironmentVariableUtil
+import com.intellij.execution.process.KillableProcessHandler
+import com.intellij.execution.process.ProcessAdapter
+import com.intellij.execution.process.ProcessEvent
+import com.intellij.execution.process.ProcessOutputTypes
+import com.intellij.ide.plugins.PluginManagerCore
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.extensions.PluginId
+import com.intellij.openapi.util.Key
+import com.intellij.util.EnvironmentUtil
+import com.intellij.util.io.BaseOutputReader
+import java.io.OutputStreamWriter
+import java.util.concurrent.CompletableFuture
+
+class Agent : ProcessAdapter() {
+ private val logger = Logger.getInstance(Agent::class.java)
+ private val gson = Gson()
+ private val process: KillableProcessHandler
+ private val streamWriter: OutputStreamWriter
+
+ var status = "notInitialized"
+ private set
+
+ init {
+ logger.info("Agent init.")
+ logger.info("Environment variables: PATH: ${EnvironmentUtil.getValue("PATH")}")
+
+ val node = PathEnvironmentVariableUtil.findExecutableInPathOnAnyOS("node")
+ if (node?.exists() == true) {
+ logger.info("Node bin path: ${node.absolutePath}")
+ } else {
+ logger.error("Node bin not found")
+ throw Error("Node bin not found")
+ }
+
+ val script =
+ PluginManagerCore.getPlugin(PluginId.getId("com.tabbyml.intellij-tabby"))?.pluginPath?.resolve("node_scripts/tabby-agent.js")
+ ?.toFile()
+ if (script?.exists() == true) {
+ logger.info("Node script path: ${script.absolutePath}")
+ } else {
+ logger.error("Node script not found")
+ throw Error("Node script not found")
+ }
+
+ val cmd = GeneralCommandLine(node.absolutePath, script.absolutePath)
+ process = object: KillableProcessHandler(cmd) {
+ override fun readerOptions(): BaseOutputReader.Options {
+ return BaseOutputReader.Options.forMostlySilentProcess()
+ }
+ }
+ process.startNotify()
+ process.addProcessListener(this)
+ streamWriter = process.processInput.writer()
+ }
+
+ fun initialize(): CompletableFuture {
+ return request("initialize", listOf(mapOf("client" to "intellij-tabby")))
+ }
+
+ fun updateConfig(): CompletableFuture {
+ return request("updateConfig", listOf(emptyMap()))
+ }
+
+ data class CompletionRequest(
+ val filepath: String,
+ val language: String,
+ val text: String,
+ val position: Int,
+ )
+
+ data class CompletionResponse(
+ val id: String,
+ val choices: List,
+ ) {
+ data class Choice(
+ val index: Int,
+ val text: String,
+ )
+ }
+
+ fun getCompletions(request: CompletionRequest): CompletableFuture {
+ return request("getCompletions", listOf(request))
+ }
+
+ private var requestId = 1
+ private var ongoingRequest = mutableMapOf Unit>()
+
+ private inline fun request(func: String, args: List = emptyList()): CompletableFuture {
+ val id = requestId++
+ val data = listOf(id, mapOf("func" to func, "args" to args))
+ val json = gson.toJson(data)
+ streamWriter.write(json + "\n")
+ streamWriter.flush()
+ logger.info("Agent request: $json")
+ val future = CompletableFuture()
+ ongoingRequest[id] = { response ->
+ logger.info("Agent response: $response")
+ val result = gson.fromJson(response, object : TypeToken() {}.type)
+ future.complete(result)
+ }
+ return future
+ }
+
+ private var outputBuffer: String = ""
+
+ override fun onTextAvailable(event: ProcessEvent, outputType: Key<*>) {
+ logger.info("Output received: $outputType: ${event.text}")
+ if (outputType !== ProcessOutputTypes.STDOUT) return
+ val lines = (outputBuffer + event.text).split("\n")
+ lines.subList(0, lines.size - 1).forEach { string -> handleOutput(string) }
+ outputBuffer = lines.last()
+ }
+
+ private fun handleOutput(output: String) {
+ val data = try {
+ gson.fromJson(output, Array::class.java).toList()
+ } catch (e: Exception) {
+ logger.error("Failed to parse agent output: $output")
+ return
+ }
+ if (data.size != 2 || data[0] !is Number) {
+ logger.error("Failed to parse agent output: $output")
+ return
+ }
+ logger.info("Parsed agent output: $data")
+ val id = (data[0] as Number).toInt()
+ if (id == 0) {
+ handleNotification(gson.toJson(data[1]))
+ } else {
+ ongoingRequest[id]?.let { callback ->
+ callback(gson.toJson(data[1]))
+ }
+ ongoingRequest.remove(id)
+ }
+ }
+
+ private fun handleNotification(event: String) {
+ logger.info("Agent notification: $event")
+ }
+}
\ No newline at end of file
diff --git a/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/agent/AgentService.kt b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/agent/AgentService.kt
new file mode 100644
index 0000000..138b3af
--- /dev/null
+++ b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/agent/AgentService.kt
@@ -0,0 +1,36 @@
+package com.tabbyml.intellijtabby.agent
+
+import com.intellij.openapi.components.Service
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.editor.Editor
+import com.intellij.psi.PsiFile
+import java.util.concurrent.CompletableFuture
+
+@Service
+class AgentService {
+ private val logger = Logger.getInstance(AgentService::class.java)
+ private val agent: CompletableFuture = CompletableFuture()
+
+ init {
+ try {
+ val instance = Agent()
+ instance.initialize().thenApply {
+ logger.info("Agent init done: $it")
+ agent.complete(instance)
+ }
+ } catch (_: Error) {
+ agent.complete(null)
+ }
+ }
+
+ fun getCompletion(editor: Editor, file: PsiFile, offset: Int): CompletableFuture? {
+ return agent.thenCompose {
+ it?.getCompletions(Agent.CompletionRequest(
+ file.virtualFile.path,
+ file.language.id, // FIXME: map language id
+ editor.document.text,
+ offset
+ ))
+ }
+ }
+}
\ No newline at end of file
diff --git a/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/editor/InlineCompletionService.kt b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/editor/InlineCompletionService.kt
new file mode 100644
index 0000000..c0bbeae
--- /dev/null
+++ b/clients/intellij/src/main/kotlin/com/tabbyml/intellijtabby/editor/InlineCompletionService.kt
@@ -0,0 +1,81 @@
+package com.tabbyml.intellijtabby.editor
+
+import com.intellij.openapi.application.ReadAction
+import com.intellij.openapi.command.WriteCommandAction
+import com.intellij.openapi.components.Service
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.editor.Editor
+import com.intellij.openapi.editor.EditorCustomElementRenderer
+import com.intellij.openapi.editor.Inlay
+import com.intellij.openapi.editor.markup.TextAttributes
+import com.intellij.openapi.util.Disposer
+import com.intellij.ui.JBColor
+import com.tabbyml.intellijtabby.agent.Agent
+import java.awt.Graphics
+import java.awt.Rectangle
+
+@Service
+class InlineCompletionService {
+ private val logger = Logger.getInstance(InlineCompletionService::class.java)
+ var currentText: String? = null
+ private set
+ var currentOffset: Int? = null
+ private set
+ private var currentInlays: MutableList> = mutableListOf()
+
+ fun show(editor: Editor, offset: Int, completion: Agent.CompletionResponse) {
+ if (completion.choices.isEmpty()) {
+ return
+ }
+ val text = completion.choices.first().text
+ logger.info("Showing inline completion at $offset: $text")
+ val lines = text.split("\n")
+ lines.forEachIndexed { index, line -> addInlayLine(editor, offset, line, index) }
+ currentText = text
+ currentOffset = offset
+ }
+
+ fun accept(editor: Editor) {
+ currentText?.let {
+ WriteCommandAction.runWriteCommandAction(editor.project) {
+ editor.document.insertString(currentOffset!!, it)
+ editor.caretModel.moveToOffset(currentOffset!! + it.length)
+ }
+ currentText = null
+ currentOffset = null
+ currentInlays.forEach(Disposer::dispose)
+ currentInlays = mutableListOf()
+ }
+ }
+
+ fun dismiss() {
+ currentText?.let {
+ currentText = null
+ currentOffset = null
+ currentInlays.forEach(Disposer::dispose)
+ currentInlays = mutableListOf()
+ }
+ }
+
+ private fun addInlayLine(editor: Editor, offset: Int, line: String, index: Int) {
+ val renderer = object : EditorCustomElementRenderer {
+ override fun calcWidthInPixels(inlay: Inlay<*>): Int {
+ // FIXME: Calc width?
+ return 1
+ }
+
+ override fun paint(inlay: Inlay<*>, graphics: Graphics, targetRect: Rectangle, textAttributes: TextAttributes) {
+ graphics.color = JBColor.GRAY
+ graphics.drawString(line, targetRect.x, targetRect.y + inlay.editor.ascent)
+ }
+ }
+ val inlay = if (index == 0) {
+ editor.inlayModel.addInlineElement(offset, true, renderer)
+ } else {
+ editor.inlayModel.addBlockElement(offset, true, false, -index, renderer)
+ }
+ inlay?.let {
+ currentInlays.add(it)
+ }
+ }
+}
\ No newline at end of file
diff --git a/clients/intellij/src/main/resources/META-INF/plugin.xml b/clients/intellij/src/main/resources/META-INF/plugin.xml
new file mode 100644
index 0000000..1bbd904
--- /dev/null
+++ b/clients/intellij/src/main/resources/META-INF/plugin.xml
@@ -0,0 +1,50 @@
+
+
+
+ com.tabbyml.intellij-tabby
+
+
+ Tabby
+
+
+ TabbyML
+
+
+
+ Require Node.js 16.0+ installed and added to PATH.
+ ]]>
+
+
+ com.intellij.modules.platform
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/clients/intellij/src/main/resources/META-INF/pluginIcon.svg b/clients/intellij/src/main/resources/META-INF/pluginIcon.svg
new file mode 100644
index 0000000..dcf6b99
--- /dev/null
+++ b/clients/intellij/src/main/resources/META-INF/pluginIcon.svg
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/package.json b/package.json
index f14e02b..a7bf776 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,7 @@
"workspaces": [
"clients/tabby-agent",
"clients/vscode",
- "clients/vim"
+ "clients/vim",
+ "clients/intellij"
]
}