@kelceyp/swic 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,18 @@
1
1
  #!/usr/bin/env node
2
- var K6=Object.create;var{getPrototypeOf:z6,defineProperty:Z0,getOwnPropertyNames:$6}=Object;var L6=Object.prototype.hasOwnProperty;var M6=(f,v,W)=>{W=f!=null?K6(z6(f)):{};let J=v||!f||!f.__esModule?Z0(W,"default",{value:f,enumerable:!0}):W;for(let Q of $6(f))if(!L6.call(J,Q))Z0(J,Q,{get:()=>f[Q],enumerable:!0});return J};var s=(f,v)=>()=>(v||f((v={exports:{}}).exports,v),v.exports);var v8=(f,v)=>{for(var W in v)Z0(f,W,{get:v[W],enumerable:!0,configurable:!0,set:(J)=>v[W]=()=>J})};var Ef=(f,v)=>()=>(f&&(v=f(f=0)),v);var k8=s((J0,R8)=>{(function(f,v){typeof J0==="object"&&typeof R8!=="undefined"?v(J0):typeof define==="function"&&define.amd?define(["exports"],v):v(f.URI=f.URI||{})})(J0,function(f){function v(){for(var D=arguments.length,P=Array(D),j=0;j<D;j++)P[j]=arguments[j];if(P.length>1){P[0]=P[0].slice(0,-1);var F=P.length-1;for(var A=1;A<F;++A)P[A]=P[A].slice(1,-1);return P[F]=P[F].slice(1),P.join("")}else return P[0]}function W(D){return"(?:"+D+")"}function J(D){return D===void 0?"undefined":D===null?"null":Object.prototype.toString.call(D).split(" ").pop().split("]").shift().toLowerCase()}function Q(D){return D.toUpperCase()}function X(D){return D!==void 0&&D!==null?D instanceof Array?D:typeof D.length!=="number"||D.split||D.setInterval||D.call?[D]:Array.prototype.slice.call(D):[]}function Y(D,P){var j=D;if(P)for(var F in P)j[F]=P[F];return j}function w(D){var P="[A-Za-z]",j="[\\x0D]",F="[0-9]",A="[\\x22]",r=v(F,"[A-Fa-f]"),e="[\\x0A]",Xv="[\\x20]",Bv=W(W("%[EFef]"+r+"%"+r+r+"%"+r+r)+"|"+W("%[89A-Fa-f]"+r+"%"+r+r)+"|"+W("%"+r+r)),Hv="[\\:\\/\\?\\#\\[\\]\\@]",Jv="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Nv=v(Hv,Jv),Fv=D?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Lv=D?"[\\uE000-\\uF8FF]":"[]",wv=v(P,F,"[\\-\\.\\_\\~]",Fv),Vv=W(P+v(P,F,"[\\+\\-\\.]")+"*"),qv=W(W(Bv+"|"+v(wv,Jv,"[\\:]"))+"*"),Sf=W(W("25[0-5]")+"|"+W("2[0-4]"+F)+"|"+W("1"+F+F)+"|"+W("[1-9]"+F)+"|"+F),mv=W(W("25[0-5]")+"|"+W("2[0-4]"+F)+"|"+W("1"+F+F)+"|"+W("0?[1-9]"+F)+"|0?0?"+F),cv=W(mv+"\\."+mv+"\\."+mv+"\\."+mv),Pv=W(r+"{1,4}"),rv=W(W(Pv+"\\:"+Pv)+"|"+cv),nv=W(W(Pv+"\\:")+"{6}"+rv),Yf=W("\\:\\:"+W(Pv+"\\:")+"{5}"+rv),yf=W(W(Pv)+"?\\:\\:"+W(Pv+"\\:")+"{4}"+rv),zf=W(W(W(Pv+"\\:")+"{0,1}"+Pv)+"?\\:\\:"+W(Pv+"\\:")+"{3}"+rv),L1=W(W(W(Pv+"\\:")+"{0,2}"+Pv)+"?\\:\\:"+W(Pv+"\\:")+"{2}"+rv),l1=W(W(W(Pv+"\\:")+"{0,3}"+Pv)+"?\\:\\:"+Pv+"\\:"+rv),I1=W(W(W(Pv+"\\:")+"{0,4}"+Pv)+"?\\:\\:"+rv),af=W(W(W(Pv+"\\:")+"{0,5}"+Pv)+"?\\:\\:"+Pv),cf=W(W(W(Pv+"\\:")+"{0,6}"+Pv)+"?\\:\\:"),$f=W([nv,Yf,yf,zf,L1,l1,I1,af,cf].join("|")),nf=W(W(wv+"|"+Bv)+"+"),l0=W($f+"\\%25"+nf),lf=W($f+W("\\%25|\\%(?!"+r+"{2})")+nf),X6=W("[vV]"+r+"+\\."+v(wv,Jv,"[\\:]")+"+"),Y6=W("\\["+W(lf+"|"+$f+"|"+X6)+"\\]"),oQ=W(W(Bv+"|"+v(wv,Jv))+"*"),M1=W(Y6+"|"+cv+"(?!"+oQ+")|"+oQ),N1=W(F+"*"),sQ=W(W(qv+"@")+"?"+M1+W("\\:"+N1)+"?"),V1=W(Bv+"|"+v(wv,Jv,"[\\:\\@]")),w6=W(V1+"*"),tQ=W(V1+"+"),G6=W(W(Bv+"|"+v(wv,Jv,"[\\@]"))+"+"),Lf=W(W("\\/"+w6)+"*"),pf=W("\\/"+W(tQ+Lf)+"?"),I0=W(G6+Lf),Z1=W(tQ+Lf),df="(?!"+V1+")",K2=W(Lf+"|"+pf+"|"+I0+"|"+Z1+"|"+df),of=W(W(V1+"|"+v("[\\/\\?]",Lv))+"*"),D1=W(W(V1+"|[\\/\\?]")+"*"),eQ=W(W("\\/\\/"+sQ+Lf)+"|"+pf+"|"+Z1+"|"+df),B6=W(Vv+"\\:"+eQ+W("\\?"+of)+"?"+W("\\#"+D1)+"?"),q6=W(W("\\/\\/"+sQ+Lf)+"|"+pf+"|"+I0+"|"+df),P6=W(q6+W("\\?"+of)+"?"+W("\\#"+D1)+"?"),z2=W(B6+"|"+P6),$2=W(Vv+"\\:"+eQ+W("\\?"+of)+"?"),L2="^("+Vv+")\\:"+W(W("\\/\\/("+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?)")+"?("+Lf+"|"+pf+"|"+Z1+"|"+df+")")+W("\\?("+of+")")+"?"+W("\\#("+D1+")")+"?$",M2="^(){0}"+W(W("\\/\\/("+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?)")+"?("+Lf+"|"+pf+"|"+I0+"|"+df+")")+W("\\?("+of+")")+"?"+W("\\#("+D1+")")+"?$",N2="^("+Vv+")\\:"+W(W("\\/\\/("+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?)")+"?("+Lf+"|"+pf+"|"+Z1+"|"+df+")")+W("\\?("+of+")")+"?$",V2="^"+W("\\#("+D1+")")+"?$",D2="^"+W("("+qv+")@")+"?("+M1+")"+W("\\:("+N1+")")+"?$";return{NOT_SCHEME:new RegExp(v("[^]",P,F,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(v("[^\\%\\:]",wv,Jv),"g"),NOT_HOST:new RegExp(v("[^\\%\\[\\]\\:]",wv,Jv),"g"),NOT_PATH:new RegExp(v("[^\\%\\/\\:\\@]",wv,Jv),"g"),NOT_PATH_NOSCHEME:new RegExp(v("[^\\%\\/\\@]",wv,Jv),"g"),NOT_QUERY:new RegExp(v("[^\\%]",wv,Jv,"[\\:\\@\\/\\?]",Lv),"g"),NOT_FRAGMENT:new RegExp(v("[^\\%]",wv,Jv,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(v("[^]",wv,Jv),"g"),UNRESERVED:new RegExp(wv,"g"),OTHER_CHARS:new RegExp(v("[^\\%]",wv,Nv),"g"),PCT_ENCODED:new RegExp(Bv,"g"),IPV4ADDRESS:new RegExp("^("+cv+")$"),IPV6ADDRESS:new RegExp("^\\[?("+$f+")"+W(W("\\%25|\\%(?!"+r+"{2})")+"("+nf+")")+"?\\]?$")}}var B=w(!1),z=w(!0),K=function(){function D(P,j){var F=[],A=!0,r=!1,e=void 0;try{for(var Xv=P[Symbol.iterator](),Bv;!(A=(Bv=Xv.next()).done);A=!0)if(F.push(Bv.value),j&&F.length===j)break}catch(Hv){r=!0,e=Hv}finally{try{if(!A&&Xv.return)Xv.return()}finally{if(r)throw e}}return F}return function(P,j){if(Array.isArray(P))return P;else if(Symbol.iterator in Object(P))return D(P,j);else throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),L=function(D){if(Array.isArray(D)){for(var P=0,j=Array(D.length);P<D.length;P++)j[P]=D[P];return j}else return Array.from(D)},V=2147483647,q=36,M=1,N=26,$=38,O=700,h=72,H=128,k="-",l=/^xn--/,T=/[^\0-\x7E]/,E=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},U=q-M,b=Math.floor,I=String.fromCharCode;function S(D){throw new RangeError(g[D])}function _(D,P){var j=[],F=D.length;while(F--)j[F]=P(D[F]);return j}function R(D,P){var j=D.split("@"),F="";if(j.length>1)F=j[0]+"@",D=j[1];D=D.replace(E,".");var A=D.split("."),r=_(A,P).join(".");return F+r}function y(D){var P=[],j=0,F=D.length;while(j<F){var A=D.charCodeAt(j++);if(A>=55296&&A<=56319&&j<F){var r=D.charCodeAt(j++);if((r&64512)==56320)P.push(((A&1023)<<10)+(r&1023)+65536);else P.push(A),j--}else P.push(A)}return P}var m=function D(P){return String.fromCodePoint.apply(String,L(P))},a=function D(P){if(P-48<10)return P-22;if(P-65<26)return P-65;if(P-97<26)return P-97;return q},i=function D(P,j){return P+22+75*(P<26)-((j!=0)<<5)},p=function D(P,j,F){var A=0;P=F?b(P/O):P>>1,P+=b(P/j);for(;P>U*N>>1;A+=q)P=b(P/U);return b(A+(U+1)*P/(P+$))},n=function D(P){var j=[],F=P.length,A=0,r=H,e=h,Xv=P.lastIndexOf(k);if(Xv<0)Xv=0;for(var Bv=0;Bv<Xv;++Bv){if(P.charCodeAt(Bv)>=128)S("not-basic");j.push(P.charCodeAt(Bv))}for(var Hv=Xv>0?Xv+1:0;Hv<F;){var Jv=A;for(var Nv=1,Fv=q;;Fv+=q){if(Hv>=F)S("invalid-input");var Lv=a(P.charCodeAt(Hv++));if(Lv>=q||Lv>b((V-A)/Nv))S("overflow");A+=Lv*Nv;var wv=Fv<=e?M:Fv>=e+N?N:Fv-e;if(Lv<wv)break;var Vv=q-wv;if(Nv>b(V/Vv))S("overflow");Nv*=Vv}var qv=j.length+1;if(e=p(A-Jv,qv,Jv==0),b(A/qv)>V-r)S("overflow");r+=b(A/qv),A%=qv,j.splice(A++,0,r)}return String.fromCodePoint.apply(String,j)},$v=function D(P){var j=[];P=y(P);var F=P.length,A=H,r=0,e=h,Xv=!0,Bv=!1,Hv=void 0;try{for(var Jv=P[Symbol.iterator](),Nv;!(Xv=(Nv=Jv.next()).done);Xv=!0){var Fv=Nv.value;if(Fv<128)j.push(I(Fv))}}catch(lf){Bv=!0,Hv=lf}finally{try{if(!Xv&&Jv.return)Jv.return()}finally{if(Bv)throw Hv}}var Lv=j.length,wv=Lv;if(Lv)j.push(k);while(wv<F){var Vv=V,qv=!0,Sf=!1,mv=void 0;try{for(var cv=P[Symbol.iterator](),Pv;!(qv=(Pv=cv.next()).done);qv=!0){var rv=Pv.value;if(rv>=A&&rv<Vv)Vv=rv}}catch(lf){Sf=!0,mv=lf}finally{try{if(!qv&&cv.return)cv.return()}finally{if(Sf)throw mv}}var nv=wv+1;if(Vv-A>b((V-r)/nv))S("overflow");r+=(Vv-A)*nv,A=Vv;var Yf=!0,yf=!1,zf=void 0;try{for(var L1=P[Symbol.iterator](),l1;!(Yf=(l1=L1.next()).done);Yf=!0){var I1=l1.value;if(I1<A&&++r>V)S("overflow");if(I1==A){var af=r;for(var cf=q;;cf+=q){var $f=cf<=e?M:cf>=e+N?N:cf-e;if(af<$f)break;var nf=af-$f,l0=q-$f;j.push(I(i($f+nf%l0,0))),af=b(nf/l0)}j.push(I(i(af,0))),e=p(r,nv,wv==Lv),r=0,++wv}}}catch(lf){yf=!0,zf=lf}finally{try{if(!Yf&&L1.return)L1.return()}finally{if(yf)throw zf}}++r,++A}return j.join("")},bv=function D(P){return R(P,function(j){return l.test(j)?n(j.slice(4).toLowerCase()):j})},Sv=function D(P){return R(P,function(j){return T.test(j)?"xn--"+$v(j):j})},Yv={version:"2.1.0",ucs2:{decode:y,encode:m},decode:n,encode:$v,toASCII:Sv,toUnicode:bv},Ov={};function gv(D){var P=D.charCodeAt(0),j=void 0;if(P<16)j="%0"+P.toString(16).toUpperCase();else if(P<128)j="%"+P.toString(16).toUpperCase();else if(P<2048)j="%"+(P>>6|192).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase();else j="%"+(P>>12|224).toString(16).toUpperCase()+"%"+(P>>6&63|128).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase();return j}function yv(D){var P="",j=0,F=D.length;while(j<F){var A=parseInt(D.substr(j+1,2),16);if(A<128)P+=String.fromCharCode(A),j+=3;else if(A>=194&&A<224){if(F-j>=6){var r=parseInt(D.substr(j+4,2),16);P+=String.fromCharCode((A&31)<<6|r&63)}else P+=D.substr(j,6);j+=6}else if(A>=224){if(F-j>=9){var e=parseInt(D.substr(j+4,2),16),Xv=parseInt(D.substr(j+7,2),16);P+=String.fromCharCode((A&15)<<12|(e&63)<<6|Xv&63)}else P+=D.substr(j,9);j+=9}else P+=D.substr(j,3),j+=3}return P}function Df(D,P){function j(F){var A=yv(F);return!A.match(P.UNRESERVED)?F:A}if(D.scheme)D.scheme=String(D.scheme).replace(P.PCT_ENCODED,j).toLowerCase().replace(P.NOT_SCHEME,"");if(D.userinfo!==void 0)D.userinfo=String(D.userinfo).replace(P.PCT_ENCODED,j).replace(P.NOT_USERINFO,gv).replace(P.PCT_ENCODED,Q);if(D.host!==void 0)D.host=String(D.host).replace(P.PCT_ENCODED,j).toLowerCase().replace(P.NOT_HOST,gv).replace(P.PCT_ENCODED,Q);if(D.path!==void 0)D.path=String(D.path).replace(P.PCT_ENCODED,j).replace(D.scheme?P.NOT_PATH:P.NOT_PATH_NOSCHEME,gv).replace(P.PCT_ENCODED,Q);if(D.query!==void 0)D.query=String(D.query).replace(P.PCT_ENCODED,j).replace(P.NOT_QUERY,gv).replace(P.PCT_ENCODED,Q);if(D.fragment!==void 0)D.fragment=String(D.fragment).replace(P.PCT_ENCODED,j).replace(P.NOT_FRAGMENT,gv).replace(P.PCT_ENCODED,Q);return D}function Pf(D){return D.replace(/^0*(.*)/,"$1")||"0"}function Uv(D,P){var j=D.match(P.IPV4ADDRESS)||[],F=K(j,2),A=F[1];if(A)return A.split(".").map(Pf).join(".");else return D}function jv(D,P){var j=D.match(P.IPV6ADDRESS)||[],F=K(j,3),A=F[1],r=F[2];if(A){var e=A.toLowerCase().split("::").reverse(),Xv=K(e,2),Bv=Xv[0],Hv=Xv[1],Jv=Hv?Hv.split(":").map(Pf):[],Nv=Bv.split(":").map(Pf),Fv=P.IPV4ADDRESS.test(Nv[Nv.length-1]),Lv=Fv?7:8,wv=Nv.length-Lv,Vv=Array(Lv);for(var qv=0;qv<Lv;++qv)Vv[qv]=Jv[qv]||Nv[wv+qv]||"";if(Fv)Vv[Lv-1]=Uv(Vv[Lv-1],P);var Sf=Vv.reduce(function(nv,Yf,yf){if(!Yf||Yf==="0"){var zf=nv[nv.length-1];if(zf&&zf.index+zf.length===yf)zf.length++;else nv.push({index:yf,length:1})}return nv},[]),mv=Sf.sort(function(nv,Yf){return Yf.length-nv.length})[0],cv=void 0;if(mv&&mv.length>1){var Pv=Vv.slice(0,mv.index),rv=Vv.slice(mv.index+mv.length);cv=Pv.join(":")+"::"+rv.join(":")}else cv=Vv.join(":");if(r)cv+="%"+r;return cv}else return D}var bf=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Rv="".match(/(){0}/)[1]===void 0;function Gv(D){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j={},F=P.iri!==!1?z:B;if(P.reference==="suffix")D=(P.scheme?P.scheme+":":"")+"//"+D;var A=D.match(bf);if(A){if(Rv){if(j.scheme=A[1],j.userinfo=A[3],j.host=A[4],j.port=parseInt(A[5],10),j.path=A[6]||"",j.query=A[7],j.fragment=A[8],isNaN(j.port))j.port=A[5]}else if(j.scheme=A[1]||void 0,j.userinfo=D.indexOf("@")!==-1?A[3]:void 0,j.host=D.indexOf("//")!==-1?A[4]:void 0,j.port=parseInt(A[5],10),j.path=A[6]||"",j.query=D.indexOf("?")!==-1?A[7]:void 0,j.fragment=D.indexOf("#")!==-1?A[8]:void 0,isNaN(j.port))j.port=D.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?A[4]:void 0;if(j.host)j.host=jv(Uv(j.host,F),F);if(j.scheme===void 0&&j.userinfo===void 0&&j.host===void 0&&j.port===void 0&&!j.path&&j.query===void 0)j.reference="same-document";else if(j.scheme===void 0)j.reference="relative";else if(j.fragment===void 0)j.reference="absolute";else j.reference="uri";if(P.reference&&P.reference!=="suffix"&&P.reference!==j.reference)j.error=j.error||"URI is not a "+P.reference+" reference.";var r=Ov[(P.scheme||j.scheme||"").toLowerCase()];if(!P.unicodeSupport&&(!r||!r.unicodeSupport)){if(j.host&&(P.domainHost||r&&r.domainHost))try{j.host=Yv.toASCII(j.host.replace(F.PCT_ENCODED,yv).toLowerCase())}catch(e){j.error=j.error||"Host's domain name can not be converted to ASCII via punycode: "+e}Df(j,B)}else Df(j,F);if(r&&r.parse)r.parse(j,P)}else j.error=j.error||"URI can not be parsed.";return j}function jf(D,P){var j=P.iri!==!1?z:B,F=[];if(D.userinfo!==void 0)F.push(D.userinfo),F.push("@");if(D.host!==void 0)F.push(jv(Uv(String(D.host),j),j).replace(j.IPV6ADDRESS,function(A,r,e){return"["+r+(e?"%25"+e:"")+"]"}));if(typeof D.port==="number"||typeof D.port==="string")F.push(":"),F.push(String(D.port));return F.length?F.join(""):void 0}var Kf=/^\.\.?\//,Rf=/^\/\.(\/|$)/,kf=/^\/\.\.(\/|$)/,_v=/^\/?(?:.|\n)*?(?=\/|$)/;function av(D){var P=[];while(D.length)if(D.match(Kf))D=D.replace(Kf,"");else if(D.match(Rf))D=D.replace(Rf,"/");else if(D.match(kf))D=D.replace(kf,"/"),P.pop();else if(D==="."||D==="..")D="";else{var j=D.match(_v);if(j){var F=j[0];D=D.slice(F.length),P.push(F)}else throw new Error("Unexpected dot segment condition")}return P.join("")}function Zv(D){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=P.iri?z:B,F=[],A=Ov[(P.scheme||D.scheme||"").toLowerCase()];if(A&&A.serialize)A.serialize(D,P);if(D.host){if(j.IPV6ADDRESS.test(D.host));else if(P.domainHost||A&&A.domainHost)try{D.host=!P.iri?Yv.toASCII(D.host.replace(j.PCT_ENCODED,yv).toLowerCase()):Yv.toUnicode(D.host)}catch(Xv){D.error=D.error||"Host's domain name can not be converted to "+(!P.iri?"ASCII":"Unicode")+" via punycode: "+Xv}}if(Df(D,j),P.reference!=="suffix"&&D.scheme)F.push(D.scheme),F.push(":");var r=jf(D,P);if(r!==void 0){if(P.reference!=="suffix")F.push("//");if(F.push(r),D.path&&D.path.charAt(0)!=="/")F.push("/")}if(D.path!==void 0){var e=D.path;if(!P.absolutePath&&(!A||!A.absolutePath))e=av(e);if(r===void 0)e=e.replace(/^\/\//,"/%2F");F.push(e)}if(D.query!==void 0)F.push("?"),F.push(D.query);if(D.fragment!==void 0)F.push("#"),F.push(D.fragment);return F.join("")}function lv(D,P){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},F=arguments[3],A={};if(!F)D=Gv(Zv(D,j),j),P=Gv(Zv(P,j),j);if(j=j||{},!j.tolerant&&P.scheme)A.scheme=P.scheme,A.userinfo=P.userinfo,A.host=P.host,A.port=P.port,A.path=av(P.path||""),A.query=P.query;else{if(P.userinfo!==void 0||P.host!==void 0||P.port!==void 0)A.userinfo=P.userinfo,A.host=P.host,A.port=P.port,A.path=av(P.path||""),A.query=P.query;else{if(!P.path)if(A.path=D.path,P.query!==void 0)A.query=P.query;else A.query=D.query;else{if(P.path.charAt(0)==="/")A.path=av(P.path);else{if((D.userinfo!==void 0||D.host!==void 0||D.port!==void 0)&&!D.path)A.path="/"+P.path;else if(!D.path)A.path=P.path;else A.path=D.path.slice(0,D.path.lastIndexOf("/")+1)+P.path;A.path=av(A.path)}A.query=P.query}A.userinfo=D.userinfo,A.host=D.host,A.port=D.port}A.scheme=D.scheme}return A.fragment=P.fragment,A}function Jf(D,P,j){var F=Y({scheme:"null"},j);return Zv(lv(Gv(D,F),Gv(P,F),F,!0),F)}function uv(D,P){if(typeof D==="string")D=Zv(Gv(D,P),P);else if(J(D)==="object")D=Gv(Zv(D,P),P);return D}function y1(D,P,j){if(typeof D==="string")D=Zv(Gv(D,j),j);else if(J(D)==="object")D=Zv(D,j);if(typeof P==="string")P=Zv(Gv(P,j),j);else if(J(P)==="object")P=Zv(P,j);return D===P}function S0(D,P){return D&&D.toString().replace(!P||!P.iri?B.ESCAPE:z.ESCAPE,gv)}function dv(D,P){return D&&D.toString().replace(!P||!P.iri?B.PCT_ENCODED:z.PCT_ENCODED,yv)}var z1={scheme:"http",domainHost:!0,parse:function D(P,j){if(!P.host)P.error=P.error||"HTTP URIs must have a host.";return P},serialize:function D(P,j){var F=String(P.scheme).toLowerCase()==="https";if(P.port===(F?443:80)||P.port==="")P.port=void 0;if(!P.path)P.path="/";return P}},mQ={scheme:"https",domainHost:z1.domainHost,parse:z1.parse,serialize:z1.serialize};function rQ(D){return typeof D.secure==="boolean"?D.secure:String(D.scheme).toLowerCase()==="wss"}var $1={scheme:"ws",domainHost:!0,parse:function D(P,j){var F=P;return F.secure=rQ(F),F.resourceName=(F.path||"/")+(F.query?"?"+F.query:""),F.path=void 0,F.query=void 0,F},serialize:function D(P,j){if(P.port===(rQ(P)?443:80)||P.port==="")P.port=void 0;if(typeof P.secure==="boolean")P.scheme=P.secure?"wss":"ws",P.secure=void 0;if(P.resourceName){var F=P.resourceName.split("?"),A=K(F,2),r=A[0],e=A[1];P.path=r&&r!=="/"?r:void 0,P.query=e,P.resourceName=void 0}return P.fragment=void 0,P}},aQ={scheme:"wss",domainHost:$1.domainHost,parse:$1.parse,serialize:$1.serialize},pJ={},iJ=!0,cQ="[A-Za-z0-9\\-\\.\\_\\~"+(iJ?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Xf="[0-9A-Fa-f]",dJ=W(W("%[EFef]"+Xf+"%"+Xf+Xf+"%"+Xf+Xf)+"|"+W("%[89A-Fa-f]"+Xf+"%"+Xf+Xf)+"|"+W("%"+Xf+Xf)),oJ="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",sJ="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",tJ=v(sJ,"[\\\"\\\\]"),eJ="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",v6=new RegExp(cQ,"g"),rf=new RegExp(dJ,"g"),f6=new RegExp(v("[^]",oJ,"[\\.]","[\\\"]",tJ),"g"),nQ=new RegExp(v("[^]",cQ,eJ),"g"),Q6=nQ;function y0(D){var P=yv(D);return!P.match(v6)?D:P}var pQ={scheme:"mailto",parse:function D(P,j){var F=P,A=F.to=F.path?F.path.split(","):[];if(F.path=void 0,F.query){var r=!1,e={},Xv=F.query.split("&");for(var Bv=0,Hv=Xv.length;Bv<Hv;++Bv){var Jv=Xv[Bv].split("=");switch(Jv[0]){case"to":var Nv=Jv[1].split(",");for(var Fv=0,Lv=Nv.length;Fv<Lv;++Fv)A.push(Nv[Fv]);break;case"subject":F.subject=dv(Jv[1],j);break;case"body":F.body=dv(Jv[1],j);break;default:r=!0,e[dv(Jv[0],j)]=dv(Jv[1],j);break}}if(r)F.headers=e}F.query=void 0;for(var wv=0,Vv=A.length;wv<Vv;++wv){var qv=A[wv].split("@");if(qv[0]=dv(qv[0]),!j.unicodeSupport)try{qv[1]=Yv.toASCII(dv(qv[1],j).toLowerCase())}catch(Sf){F.error=F.error||"Email address's domain name can not be converted to ASCII via punycode: "+Sf}else qv[1]=dv(qv[1],j).toLowerCase();A[wv]=qv.join("@")}return F},serialize:function D(P,j){var F=P,A=X(P.to);if(A){for(var r=0,e=A.length;r<e;++r){var Xv=String(A[r]),Bv=Xv.lastIndexOf("@"),Hv=Xv.slice(0,Bv).replace(rf,y0).replace(rf,Q).replace(f6,gv),Jv=Xv.slice(Bv+1);try{Jv=!j.iri?Yv.toASCII(dv(Jv,j).toLowerCase()):Yv.toUnicode(Jv)}catch(wv){F.error=F.error||"Email address's domain name can not be converted to "+(!j.iri?"ASCII":"Unicode")+" via punycode: "+wv}A[r]=Hv+"@"+Jv}F.path=A.join(",")}var Nv=P.headers=P.headers||{};if(P.subject)Nv.subject=P.subject;if(P.body)Nv.body=P.body;var Fv=[];for(var Lv in Nv)if(Nv[Lv]!==pJ[Lv])Fv.push(Lv.replace(rf,y0).replace(rf,Q).replace(nQ,gv)+"="+Nv[Lv].replace(rf,y0).replace(rf,Q).replace(Q6,gv));if(Fv.length)F.query=Fv.join("&");return F}},W6=/^([^\:]+)\:(.*)/,iQ={scheme:"urn",parse:function D(P,j){var F=P.path&&P.path.match(W6),A=P;if(F){var r=j.scheme||A.scheme||"urn",e=F[1].toLowerCase(),Xv=F[2],Bv=r+":"+(j.nid||e),Hv=Ov[Bv];if(A.nid=e,A.nss=Xv,A.path=void 0,Hv)A=Hv.parse(A,j)}else A.error=A.error||"URN can not be parsed.";return A},serialize:function D(P,j){var F=j.scheme||P.scheme||"urn",A=P.nid,r=F+":"+(j.nid||A),e=Ov[r];if(e)P=e.serialize(P,j);var Xv=P,Bv=P.nss;return Xv.path=(A||j.nid)+":"+Bv,Xv}},J6=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,dQ={scheme:"urn:uuid",parse:function D(P,j){var F=P;if(F.uuid=F.nss,F.nss=void 0,!j.tolerant&&(!F.uuid||!F.uuid.match(J6)))F.error=F.error||"UUID is not valid.";return F},serialize:function D(P,j){var F=P;return F.nss=(P.uuid||"").toLowerCase(),F}};Ov[z1.scheme]=z1,Ov[mQ.scheme]=mQ,Ov[$1.scheme]=$1,Ov[aQ.scheme]=aQ,Ov[pQ.scheme]=pQ,Ov[iQ.scheme]=iQ,Ov[dQ.scheme]=dQ,f.SCHEMES=Ov,f.pctEncChar=gv,f.pctDecChars=yv,f.parse=Gv,f.removeDotSegments=av,f.serialize=Zv,f.resolveComponents=lv,f.resolve=Jf,f.normalize=uv,f.equal=y1,f.escapeComponent=S0,f.unescapeComponent=dv,Object.defineProperty(f,"__esModule",{value:!0})})});var X0=s((J4,S8)=>{S8.exports=function f(v,W){if(v===W)return!0;if(v&&W&&typeof v=="object"&&typeof W=="object"){if(v.constructor!==W.constructor)return!1;var J,Q,X;if(Array.isArray(v)){if(J=v.length,J!=W.length)return!1;for(Q=J;Q--!==0;)if(!f(v[Q],W[Q]))return!1;return!0}if(v.constructor===RegExp)return v.source===W.source&&v.flags===W.flags;if(v.valueOf!==Object.prototype.valueOf)return v.valueOf()===W.valueOf();if(v.toString!==Object.prototype.toString)return v.toString()===W.toString();if(X=Object.keys(v),J=X.length,J!==Object.keys(W).length)return!1;for(Q=J;Q--!==0;)if(!Object.prototype.hasOwnProperty.call(W,X[Q]))return!1;for(Q=J;Q--!==0;){var Y=X[Q];if(!f(v[Y],W[Y]))return!1}return!0}return v!==v&&W!==W}});var l8=s((X4,y8)=>{y8.exports=function f(v){var W=0,J=v.length,Q=0,X;while(Q<J)if(W++,X=v.charCodeAt(Q++),X>=55296&&X<=56319&&Q<J){if(X=v.charCodeAt(Q),(X&64512)==56320)Q++}return W}});var uf=s((Y4,C8)=>{C8.exports={copy:NX,checkDataType:vQ,checkDataTypes:VX,coerceToTypes:DX,toHash:QQ,getProperty:WQ,escapeQuotes:JQ,equal:X0(),ucs2length:l8(),varOccurences:OX,varReplace:UX,schemaHasRules:HX,schemaHasRulesExcept:FX,schemaUnknownRules:AX,toQuotedString:fQ,getPathExpr:gX,getPath:_X,getData:RX,unescapeFragment:kX,unescapeJsonPointer:YQ,escapeFragment:SX,escapeJsonPointer:XQ};function NX(f,v){v=v||{};for(var W in f)v[W]=f[W];return v}function vQ(f,v,W,J){var Q=J?" !== ":" === ",X=J?" || ":" && ",Y=J?"!":"",w=J?"":"!";switch(f){case"null":return v+Q+"null";case"array":return Y+"Array.isArray("+v+")";case"object":return"("+Y+v+X+"typeof "+v+Q+'"object"'+X+w+"Array.isArray("+v+"))";case"integer":return"(typeof "+v+Q+'"number"'+X+w+"("+v+" % 1)"+X+v+Q+v+(W?X+Y+"isFinite("+v+")":"")+")";case"number":return"(typeof "+v+Q+'"'+f+'"'+(W?X+Y+"isFinite("+v+")":"")+")";default:return"typeof "+v+Q+'"'+f+'"'}}function VX(f,v,W){switch(f.length){case 1:return vQ(f[0],v,W,!0);default:var J="",Q=QQ(f);if(Q.array&&Q.object)J=Q.null?"(":"(!"+v+" || ",J+="typeof "+v+' !== "object")',delete Q.null,delete Q.array,delete Q.object;if(Q.number)delete Q.integer;for(var X in Q)J+=(J?" && ":"")+vQ(X,v,W,!0);return J}}var I8=QQ(["string","number","integer","boolean","null"]);function DX(f,v){if(Array.isArray(v)){var W=[];for(var J=0;J<v.length;J++){var Q=v[J];if(I8[Q])W[W.length]=Q;else if(f==="array"&&Q==="array")W[W.length]=Q}if(W.length)return W}else if(I8[v])return[v];else if(f==="array"&&v==="array")return["array"]}function QQ(f){var v={};for(var W=0;W<f.length;W++)v[f[W]]=!0;return v}var jX=/^[a-z$_][a-z$_0-9]*$/i,EX=/'|\\/g;function WQ(f){return typeof f=="number"?"["+f+"]":jX.test(f)?"."+f:"['"+JQ(f)+"']"}function JQ(f){return f.replace(EX,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function OX(f,v){v+="[^0-9]";var W=f.match(new RegExp(v,"g"));return W?W.length:0}function UX(f,v,W){return v+="([^0-9])",W=W.replace(/\$/g,"$$$$"),f.replace(new RegExp(v,"g"),W+"$1")}function HX(f,v){if(typeof f=="boolean")return!f;for(var W in f)if(v[W])return!0}function FX(f,v,W){if(typeof f=="boolean")return!f&&W!="not";for(var J in f)if(J!=W&&v[J])return!0}function AX(f,v){if(typeof f=="boolean")return;for(var W in f)if(!v[W])return W}function fQ(f){return"'"+JQ(f)+"'"}function gX(f,v,W,J){var Q=W?"'/' + "+v+(J?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):J?"'[' + "+v+" + ']'":"'[\\'' + "+v+" + '\\']'";return Z8(f,Q)}function _X(f,v,W){var J=W?fQ("/"+XQ(v)):fQ(WQ(v));return Z8(f,J)}var hX=/^\/(?:[^~]|~0|~1)*$/,bX=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function RX(f,v,W){var J,Q,X,Y;if(f==="")return"rootData";if(f[0]=="/"){if(!hX.test(f))throw new Error("Invalid JSON-pointer: "+f);Q=f,X="rootData"}else{if(Y=f.match(bX),!Y)throw new Error("Invalid JSON-pointer: "+f);if(J=+Y[1],Q=Y[2],Q=="#"){if(J>=v)throw new Error("Cannot access property/index "+J+" levels up, current level is "+v);return W[v-J]}if(J>v)throw new Error("Cannot access data "+J+" levels up, current level is "+v);if(X="data"+(v-J||""),!Q)return X}var w=X,B=Q.split("/");for(var z=0;z<B.length;z++){var K=B[z];if(K)X+=WQ(YQ(K)),w+=" && "+X}return w}function Z8(f,v){if(f=='""')return v;return(f+" + "+v).replace(/([^\\])' \+ '/g,"$1")}function kX(f){return YQ(decodeURIComponent(f))}function SX(f){return encodeURIComponent(XQ(f))}function XQ(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}function YQ(f){return f.replace(/~1/g,"/").replace(/~0/g,"~")}});var wQ=s((w4,T8)=>{var yX=uf();T8.exports=lX;function lX(f){yX.copy(f,this)}});var u8=s((G4,x8)=>{var gf=x8.exports=function(f,v,W){if(typeof v=="function")W=v,v={};W=v.cb||W;var J=typeof W=="function"?W:W.pre||function(){},Q=W.post||function(){};Y0(v,J,Q,f,"",f)};gf.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};gf.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};gf.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};gf.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Y0(f,v,W,J,Q,X,Y,w,B,z){if(J&&typeof J=="object"&&!Array.isArray(J)){v(J,Q,X,Y,w,B,z);for(var K in J){var L=J[K];if(Array.isArray(L)){if(K in gf.arrayKeywords)for(var V=0;V<L.length;V++)Y0(f,v,W,L[V],Q+"/"+K+"/"+V,X,Q,K,J,V)}else if(K in gf.propsKeywords){if(L&&typeof L=="object")for(var q in L)Y0(f,v,W,L[q],Q+"/"+K+"/"+IX(q),X,Q,K,J,q)}else if(K in gf.keywords||f.allKeys&&!(K in gf.skipKeywords))Y0(f,v,W,L,Q+"/"+K,X,Q,K,J)}W(J,Q,X,Y,w,B,z)}}function IX(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}});var K0=s((B4,c8)=>{var R1=k8(),m8=X0(),q0=uf(),w0=wQ(),ZX=u8();c8.exports=hf;hf.normalizeId=_f;hf.fullPath=G0;hf.url=B0;hf.ids=mX;hf.inlineRef=GQ;hf.schema=P0;function hf(f,v,W){var J=this._refs[W];if(typeof J=="string")if(this._refs[J])J=this._refs[J];else return hf.call(this,f,v,J);if(J=J||this._schemas[W],J instanceof w0)return GQ(J.schema,this._opts.inlineRefs)?J.schema:J.validate||this._compile(J);var Q=P0.call(this,v,W),X,Y,w;if(Q)X=Q.schema,v=Q.root,w=Q.baseId;if(X instanceof w0)Y=X.validate||f.call(this,X.schema,v,void 0,w);else if(X!==void 0)Y=GQ(X,this._opts.inlineRefs)?X:f.call(this,X,v,void 0,w);return Y}function P0(f,v){var W=R1.parse(v),J=a8(W),Q=G0(this._getId(f.schema));if(Object.keys(f.schema).length===0||J!==Q){var X=_f(J),Y=this._refs[X];if(typeof Y=="string")return CX.call(this,f,Y,W);else if(Y instanceof w0){if(!Y.validate)this._compile(Y);f=Y}else if(Y=this._schemas[X],Y instanceof w0){if(!Y.validate)this._compile(Y);if(X==_f(v))return{schema:Y,root:f,baseId:Q};f=Y}else return;if(!f.schema)return;Q=G0(this._getId(f.schema))}return r8.call(this,W,Q,f.schema,f)}function CX(f,v,W){var J=P0.call(this,f,v);if(J){var{schema:Q,baseId:X}=J;f=J.root;var Y=this._getId(Q);if(Y)X=B0(X,Y);return r8.call(this,W,X,Q,f)}}var TX=q0.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function r8(f,v,W,J){if(f.fragment=f.fragment||"",f.fragment.slice(0,1)!="/")return;var Q=f.fragment.split("/");for(var X=1;X<Q.length;X++){var Y=Q[X];if(Y){if(Y=q0.unescapeFragment(Y),W=W[Y],W===void 0)break;var w;if(!TX[Y]){if(w=this._getId(W),w)v=B0(v,w);if(W.$ref){var B=B0(v,W.$ref),z=P0.call(this,J,B);if(z)W=z.schema,J=z.root,v=z.baseId}}}}if(W!==void 0&&W!==J.schema)return{schema:W,root:J,baseId:v}}var xX=q0.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function GQ(f,v){if(v===!1)return!1;if(v===void 0||v===!0)return BQ(f);else if(v)return qQ(f)<=v}function BQ(f){var v;if(Array.isArray(f)){for(var W=0;W<f.length;W++)if(v=f[W],typeof v=="object"&&!BQ(v))return!1}else for(var J in f){if(J=="$ref")return!1;if(v=f[J],typeof v=="object"&&!BQ(v))return!1}return!0}function qQ(f){var v=0,W;if(Array.isArray(f))for(var J=0;J<f.length;J++){if(W=f[J],typeof W=="object")v+=qQ(W);if(v==1/0)return 1/0}else for(var Q in f){if(Q=="$ref")return 1/0;if(xX[Q])v++;else{if(W=f[Q],typeof W=="object")v+=qQ(W)+1;if(v==1/0)return 1/0}}return v}function G0(f,v){if(v!==!1)f=_f(f);var W=R1.parse(f);return a8(W)}function a8(f){return R1.serialize(f).split("#")[0]+"#"}var uX=/#\/?$/;function _f(f){return f?f.replace(uX,""):""}function B0(f,v){return v=_f(v),R1.resolve(f,v)}function mX(f){var v=_f(this._getId(f)),W={"":v},J={"":G0(v,!1)},Q={},X=this;return ZX(f,{allKeys:!0},function(Y,w,B,z,K,L,V){if(w==="")return;var q=X._getId(Y),M=W[z],N=J[z]+"/"+K;if(V!==void 0)N+="/"+(typeof V=="number"?V:q0.escapeFragment(V));if(typeof q=="string"){q=M=_f(M?R1.resolve(M,q):q);var $=X._refs[q];if(typeof $=="string")$=X._refs[$];if($&&$.schema){if(!m8(Y,$.schema))throw new Error('id "'+q+'" resolves to more than one schema')}else if(q!=_f(N))if(q[0]=="#"){if(Q[q]&&!m8(Y,Q[q]))throw new Error('id "'+q+'" resolves to more than one schema');Q[q]=Y}else X._refs[q]=N}W[w]=M,J[w]=N}),Q}});var z0=s((q4,p8)=>{var PQ=K0();p8.exports={Validation:n8(rX),MissingRef:n8(KQ)};function rX(f){this.message="validation failed",this.errors=f,this.ajv=this.validation=!0}KQ.message=function(f,v){return"can't resolve reference "+v+" from id "+f};function KQ(f,v,W){this.message=W||KQ.message(f,v),this.missingRef=PQ.url(f,v),this.missingSchema=PQ.normalizeId(PQ.fullPath(this.missingRef))}function n8(f){return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f}});var zQ=s((P4,i8)=>{i8.exports=function(f,v){if(!v)v={};if(typeof v==="function")v={cmp:v};var W=typeof v.cycles==="boolean"?v.cycles:!1,J=v.cmp&&function(X){return function(Y){return function(w,B){var z={key:w,value:Y[w]},K={key:B,value:Y[B]};return X(z,K)}}}(v.cmp),Q=[];return function X(Y){if(Y&&Y.toJSON&&typeof Y.toJSON==="function")Y=Y.toJSON();if(Y===void 0)return;if(typeof Y=="number")return isFinite(Y)?""+Y:"null";if(typeof Y!=="object")return JSON.stringify(Y);var w,B;if(Array.isArray(Y)){B="[";for(w=0;w<Y.length;w++){if(w)B+=",";B+=X(Y[w])||"null"}return B+"]"}if(Y===null)return"null";if(Q.indexOf(Y)!==-1){if(W)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var z=Q.push(Y)-1,K=Object.keys(Y).sort(J&&J(Y));B="";for(w=0;w<K.length;w++){var L=K[w],V=X(Y[L]);if(!V)continue;if(B)B+=",";B+=JSON.stringify(L)+":"+V}return Q.splice(z,1),"{"+B+"}"}(f)}});var $Q=s((K4,d8)=>{d8.exports=function f(v,W,J){var Q="",X=v.schema.$async===!0,Y=v.util.schemaHasRulesExcept(v.schema,v.RULES.all,"$ref"),w=v.self._getId(v.schema);if(v.opts.strictKeywords){var B=v.util.schemaUnknownRules(v.schema,v.RULES.keywords);if(B){var z="unknown keyword: "+B;if(v.opts.strictKeywords==="log")v.logger.warn(z);else throw new Error(z)}}if(v.isTop){if(Q+=" var validate = ",X)v.async=!0,Q+="async ";if(Q+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",w&&(v.opts.sourceCode||v.opts.processCode))Q+=" "+("/*# sourceURL="+w+" */")+" "}if(typeof v.schema=="boolean"||!(Y||v.schema.$ref)){var W="false schema",K=v.level,L=v.dataLevel,V=v.schema[W],q=v.schemaPath+v.util.getProperty(W),M=v.errSchemaPath+"/"+W,l=!v.opts.allErrors,g,N="data"+(L||""),k="valid"+K;if(v.schema===!1){if(v.isTop)l=!0;else Q+=" var "+k+" = false; ";var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"false schema")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'boolean schema is false' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(v.isTop)if(X)Q+=" return data; ";else Q+=" validate.errors = null; return true; ";else Q+=" var "+k+" = true; ";if(v.isTop)Q+=" }; return validate; ";return Q}if(v.isTop){var h=v.isTop,K=v.level=0,L=v.dataLevel=0,N="data";if(v.rootId=v.resolve.fullPath(v.self._getId(v.root.schema)),v.baseId=v.baseId||v.rootId,delete v.isTop,v.dataPathArr=[""],v.schema.default!==void 0&&v.opts.useDefaults&&v.opts.strictDefaults){var H="default is ignored in the schema root";if(v.opts.strictDefaults==="log")v.logger.warn(H);else throw new Error(H)}Q+=" var vErrors = null; ",Q+=" var errors = 0; ",Q+=" if (rootData === undefined) rootData = data; "}else{var{level:K,dataLevel:L}=v,N="data"+(L||"");if(w)v.baseId=v.resolve.url(v.baseId,w);if(X&&!v.async)throw new Error("async schema in sync schema");Q+=" var errs_"+K+" = errors;"}var k="valid"+K,l=!v.opts.allErrors,T="",E="",g,U=v.schema.type,b=Array.isArray(U);if(U&&v.opts.nullable&&v.schema.nullable===!0){if(b){if(U.indexOf("null")==-1)U=U.concat("null")}else if(U!="null")U=[U,"null"],b=!0}if(b&&U.length==1)U=U[0],b=!1;if(v.schema.$ref&&Y){if(v.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+v.errSchemaPath+'" (see option extendRefs)');else if(v.opts.extendRefs!==!0)Y=!1,v.logger.warn('$ref: keywords ignored in schema at path "'+v.errSchemaPath+'"')}if(v.schema.$comment&&v.opts.$comment)Q+=" "+v.RULES.all.$comment.code(v,"$comment");if(U){if(v.opts.coerceTypes)var I=v.util.coerceToTypes(v.opts.coerceTypes,U);var S=v.RULES.types[U];if(I||b||S===!0||S&&!_v(S)){var q=v.schemaPath+".type",M=v.errSchemaPath+"/type",q=v.schemaPath+".type",M=v.errSchemaPath+"/type",_=b?"checkDataTypes":"checkDataType";if(Q+=" if ("+v.util[_](U,N,v.opts.strictNumbers,!0)+") { ",I){var R="dataType"+K,y="coerced"+K;if(Q+=" var "+R+" = typeof "+N+"; var "+y+" = undefined; ",v.opts.coerceTypes=="array")Q+=" if ("+R+" == 'object' && Array.isArray("+N+") && "+N+".length == 1) { "+N+" = "+N+"[0]; "+R+" = typeof "+N+"; if ("+v.util.checkDataType(v.schema.type,N,v.opts.strictNumbers)+") "+y+" = "+N+"; } ";Q+=" if ("+y+" !== undefined) ; ";var m=I;if(m){var a,i=-1,p=m.length-1;while(i<p)if(a=m[i+=1],a=="string")Q+=" else if ("+R+" == 'number' || "+R+" == 'boolean') "+y+" = '' + "+N+"; else if ("+N+" === null) "+y+" = ''; ";else if(a=="number"||a=="integer"){if(Q+=" else if ("+R+" == 'boolean' || "+N+" === null || ("+R+" == 'string' && "+N+" && "+N+" == +"+N+" ",a=="integer")Q+=" && !("+N+" % 1)";Q+=")) "+y+" = +"+N+"; "}else if(a=="boolean")Q+=" else if ("+N+" === 'false' || "+N+" === 0 || "+N+" === null) "+y+" = false; else if ("+N+" === 'true' || "+N+" === 1) "+y+" = true; ";else if(a=="null")Q+=" else if ("+N+" === '' || "+N+" === 0 || "+N+" === false) "+y+" = null; ";else if(v.opts.coerceTypes=="array"&&a=="array")Q+=" else if ("+R+" == 'string' || "+R+" == 'number' || "+R+" == 'boolean' || "+N+" == null) "+y+" = ["+N+"]; "}Q+=" else { ";var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: { type: '",b)Q+=""+U.join(",");else Q+=""+U;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",b)Q+=""+U.join(",");else Q+=""+U;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } if ("+y+" !== undefined) { ";var n=L?"data"+(L-1||""):"parentData",$v=L?v.dataPathArr[L]:"parentDataProperty";if(Q+=" "+N+" = "+y+"; ",!L)Q+="if ("+n+" !== undefined)";Q+=" "+n+"["+$v+"] = "+y+"; } "}else{var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: { type: '",b)Q+=""+U.join(",");else Q+=""+U;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",b)Q+=""+U.join(",");else Q+=""+U;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}Q+=" } "}}if(v.schema.$ref&&!Y){if(Q+=" "+v.RULES.all.$ref.code(v,"$ref")+" ",l){if(Q+=" } if (errors === ",h)Q+="0";else Q+="errs_"+K;Q+=") { ",E+="}"}}else{var bv=v.RULES;if(bv){var S,Sv=-1,Yv=bv.length-1;while(Sv<Yv)if(S=bv[Sv+=1],_v(S)){if(S.type)Q+=" if ("+v.util.checkDataType(S.type,N,v.opts.strictNumbers)+") { ";if(v.opts.useDefaults){if(S.type=="object"&&v.schema.properties){var V=v.schema.properties,Ov=Object.keys(V),gv=Ov;if(gv){var yv,Df=-1,Pf=gv.length-1;while(Df<Pf){yv=gv[Df+=1];var Uv=V[yv];if(Uv.default!==void 0){var jv=N+v.util.getProperty(yv);if(v.compositeRule){if(v.opts.strictDefaults){var H="default is ignored for: "+jv;if(v.opts.strictDefaults==="log")v.logger.warn(H);else throw new Error(H)}}else{if(Q+=" if ("+jv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+jv+" === null || "+jv+" === '' ";if(Q+=" ) "+jv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Uv.default)+" ";else Q+=" "+JSON.stringify(Uv.default)+" ";Q+="; "}}}}}else if(S.type=="array"&&Array.isArray(v.schema.items)){var bf=v.schema.items;if(bf){var Uv,i=-1,Rv=bf.length-1;while(i<Rv)if(Uv=bf[i+=1],Uv.default!==void 0){var jv=N+"["+i+"]";if(v.compositeRule){if(v.opts.strictDefaults){var H="default is ignored for: "+jv;if(v.opts.strictDefaults==="log")v.logger.warn(H);else throw new Error(H)}}else{if(Q+=" if ("+jv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+jv+" === null || "+jv+" === '' ";if(Q+=" ) "+jv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Uv.default)+" ";else Q+=" "+JSON.stringify(Uv.default)+" ";Q+="; "}}}}}var Gv=S.rules;if(Gv){var jf,Kf=-1,Rf=Gv.length-1;while(Kf<Rf)if(jf=Gv[Kf+=1],av(jf)){var kf=jf.code(v,jf.keyword,S.type);if(kf){if(Q+=" "+kf+" ",l)T+="}"}}}if(l)Q+=" "+T+" ",T="";if(S.type){if(Q+=" } ",U&&U===S.type&&!I){Q+=" else { ";var q=v.schemaPath+".type",M=v.errSchemaPath+"/type",$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(g||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(M)+" , params: { type: '",b)Q+=""+U.join(",");else Q+=""+U;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",b)Q+=""+U.join(",");else Q+=""+U;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&l)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } "}}if(l){if(Q+=" if (errors === ",h)Q+="0";else Q+="errs_"+K;Q+=") { ",E+="}"}}}}if(l)Q+=" "+E+" ";if(h){if(X)Q+=" if (errors === 0) return data; ",Q+=" else throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; ",Q+=" return errors === 0; ";Q+=" }; return validate;"}else Q+=" var "+k+" = errors === errs_"+K+";";function _v(lv){var Jf=lv.rules;for(var uv=0;uv<Jf.length;uv++)if(av(Jf[uv]))return!0}function av(lv){return v.schema[lv.keyword]!==void 0||lv.implements&&Zv(lv)}function Zv(lv){var Jf=lv.implements;for(var uv=0;uv<Jf.length;uv++)if(v.schema[Jf[uv]]!==void 0)return!0}return Q}});var vW=s((z4,e8)=>{var $0=K0(),M0=uf(),s8=z0(),aX=zQ(),o8=$Q(),cX=M0.ucs2length,nX=X0(),pX=s8.Validation;e8.exports=LQ;function LQ(f,v,W,J){var Q=this,X=this._opts,Y=[void 0],w={},B=[],z={},K=[],L={},V=[];v=v||{schema:f,refVal:Y,refs:w};var q=iX.call(this,f,v,J),M=this._compilations[q.index];if(q.compiling)return M.callValidate=H;var N=this._formats,$=this.RULES;try{var O=k(f,v,W,J);M.validate=O;var h=M.callValidate;if(h){if(h.schema=O.schema,h.errors=null,h.refs=O.refs,h.refVal=O.refVal,h.root=O.root,h.$async=O.$async,X.sourceCode)h.source=O.source}return O}finally{dX.call(this,f,v,J)}function H(){var _=M.validate,R=_.apply(this,arguments);return H.errors=_.errors,R}function k(_,R,y,m){var a=!R||R&&R.schema==_;if(R.schema!=v.schema)return LQ.call(Q,_,R,y,m);var i=_.$async===!0,p=o8({isTop:!0,schema:_,isRoot:a,baseId:m,root:R,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:s8.MissingRef,RULES:$,validate:o8,util:M0,resolve:$0,resolveRef:l,usePattern:b,useDefault:I,useCustomRule:S,opts:X,formats:N,logger:Q.logger,self:Q});if(p=L0(Y,tX)+L0(B,oX)+L0(K,sX)+L0(V,eX)+p,X.processCode)p=X.processCode(p,_);var n;try{var $v=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",p);n=$v(Q,$,N,v,Y,K,V,nX,cX,pX),Y[0]=n}catch(bv){throw Q.logger.error("Error compiling schema, function code:",p),bv}if(n.schema=_,n.errors=null,n.refs=w,n.refVal=Y,n.root=a?n:R,i)n.$async=!0;if(X.sourceCode===!0)n.source={code:p,patterns:B,defaults:K};return n}function l(_,R,y){R=$0.url(_,R);var m=w[R],a,i;if(m!==void 0)return a=Y[m],i="refVal["+m+"]",U(a,i);if(!y&&v.refs){var p=v.refs[R];if(p!==void 0)return a=v.refVal[p],i=T(R,a),U(a,i)}i=T(R);var n=$0.call(Q,k,v,R);if(n===void 0){var $v=W&&W[R];if($v)n=$0.inlineRef($v,X.inlineRefs)?$v:LQ.call(Q,$v,v,W,_)}if(n===void 0)E(R);else return g(R,n),U(n,i)}function T(_,R){var y=Y.length;return Y[y]=R,w[_]=y,"refVal"+y}function E(_){delete w[_]}function g(_,R){var y=w[_];Y[y]=R}function U(_,R){return typeof _=="object"||typeof _=="boolean"?{code:R,schema:_,inline:!0}:{code:R,$async:_&&!!_.$async}}function b(_){var R=z[_];if(R===void 0)R=z[_]=B.length,B[R]=_;return"pattern"+R}function I(_){switch(typeof _){case"boolean":case"number":return""+_;case"string":return M0.toQuotedString(_);case"object":if(_===null)return"null";var R=aX(_),y=L[R];if(y===void 0)y=L[R]=K.length,K[y]=_;return"default"+y}}function S(_,R,y,m){if(Q._opts.validateSchema!==!1){var a=_.definition.dependencies;if(a&&!a.every(function(gv){return Object.prototype.hasOwnProperty.call(y,gv)}))throw new Error("parent schema must have all required keywords: "+a.join(","));var i=_.definition.validateSchema;if(i){var p=i(R);if(!p){var n="keyword schema is invalid: "+Q.errorsText(i.errors);if(Q._opts.validateSchema=="log")Q.logger.error(n);else throw new Error(n)}}}var $v=_.definition.compile,bv=_.definition.inline,Sv=_.definition.macro,Yv;if($v)Yv=$v.call(Q,R,y,m);else if(Sv){if(Yv=Sv.call(Q,R,y,m),X.validateSchema!==!1)Q.validateSchema(Yv,!0)}else if(bv)Yv=bv.call(Q,m,_.keyword,R,y);else if(Yv=_.definition.validate,!Yv)return;if(Yv===void 0)throw new Error('custom keyword "'+_.keyword+'"failed to compile');var Ov=V.length;return V[Ov]=Yv,{code:"customRule"+Ov,validate:Yv}}}function iX(f,v,W){var J=t8.call(this,f,v,W);if(J>=0)return{index:J,compiling:!0};return J=this._compilations.length,this._compilations[J]={schema:f,root:v,baseId:W},{index:J,compiling:!1}}function dX(f,v,W){var J=t8.call(this,f,v,W);if(J>=0)this._compilations.splice(J,1)}function t8(f,v,W){for(var J=0;J<this._compilations.length;J++){var Q=this._compilations[J];if(Q.schema==f&&Q.root==v&&Q.baseId==W)return J}return-1}function oX(f,v){return"var pattern"+f+" = new RegExp("+M0.toQuotedString(v[f])+");"}function sX(f){return"var default"+f+" = defaults["+f+"];"}function tX(f,v){return v[f]===void 0?"":"var refVal"+f+" = refVal["+f+"];"}function eX(f){return"var customRule"+f+" = customRules["+f+"];"}function L0(f,v){if(!f.length)return"";var W="";for(var J=0;J<f.length;J++)W+=v(J,f);return W}});var QW=s(($4,fW)=>{var N0=fW.exports=function f(){this._cache={}};N0.prototype.put=function f(v,W){this._cache[v]=W};N0.prototype.get=function f(v){return this._cache[v]};N0.prototype.del=function f(v){delete this._cache[v]};N0.prototype.clear=function f(){this._cache={}}});var $W=s((L4,zW)=>{var vY=uf(),fY=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,QY=[0,31,28,31,30,31,30,31,31,30,31,30,31],WY=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,WW=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,JY=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,XY=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,JW=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,XW=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,YW=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,wW=/^(?:\/(?:[^~/]|~0|~1)*)*$/,GW=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,BW=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;zW.exports=V0;function V0(f){return f=f=="full"?"full":"fast",vY.copy(V0[f])}V0.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":JW,url:XW,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:WW,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:KW,uuid:YW,"json-pointer":wW,"json-pointer-uri-fragment":GW,"relative-json-pointer":BW};V0.full={date:qW,time:PW,"date-time":GY,uri:qY,"uri-reference":XY,"uri-template":JW,url:XW,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:WW,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:KW,uuid:YW,"json-pointer":wW,"json-pointer-uri-fragment":GW,"relative-json-pointer":BW};function YY(f){return f%4===0&&(f%100!==0||f%400===0)}function qW(f){var v=f.match(fY);if(!v)return!1;var W=+v[1],J=+v[2],Q=+v[3];return J>=1&&J<=12&&Q>=1&&Q<=(J==2&&YY(W)?29:QY[J])}function PW(f,v){var W=f.match(WY);if(!W)return!1;var J=W[1],Q=W[2],X=W[3],Y=W[5];return(J<=23&&Q<=59&&X<=59||J==23&&Q==59&&X==60)&&(!v||Y)}var wY=/t|\s/i;function GY(f){var v=f.split(wY);return v.length==2&&qW(v[0])&&PW(v[1],!0)}var BY=/\/|:/;function qY(f){return BY.test(f)&&JY.test(f)}var PY=/[^\\]\\Z/;function KW(f){if(PY.test(f))return!1;try{return new RegExp(f),!0}catch(v){return!1}}});var MW=s((M4,LW)=>{LW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.errSchemaPath+"/"+W,z=!v.opts.allErrors,K="data"+(Y||""),L="valid"+X,V,q;if(w=="#"||w=="#/")if(v.isRoot)V=v.async,q="validate";else V=v.root.schema.$async===!0,q="root.refVal[0]";else{var M=v.resolveRef(v.baseId,w,v.isRoot);if(M===void 0){var N=v.MissingRefError.message(v.baseId,w);if(v.opts.missingRefs=="fail"){v.logger.error(N);var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(B)+" , params: { ref: '"+v.util.escapeQuotes(w)+"' } ",v.opts.messages!==!1)Q+=" , message: 'can\\'t resolve reference "+v.util.escapeQuotes(w)+"' ";if(v.opts.verbose)Q+=" , schema: "+v.util.toQuotedString(w)+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+K+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&z)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(z)Q+=" if (false) { "}else if(v.opts.missingRefs=="ignore"){if(v.logger.warn(N),z)Q+=" if (true) { "}else throw new v.MissingRefError(v.baseId,w,N)}else if(M.inline){var h=v.util.copy(v);h.level++;var H="valid"+h.level;h.schema=M.schema,h.schemaPath="",h.errSchemaPath=w;var k=v.validate(h).replace(/validate\.schema/g,M.code);if(Q+=" "+k+" ",z)Q+=" if ("+H+") { "}else V=M.$async===!0||v.async&&M.$async!==!1,q=M.code}if(q){var $=$||[];if($.push(Q),Q="",v.opts.passContext)Q+=" "+q+".call(this, ";else Q+=" "+q+"( ";if(Q+=" "+K+", (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var l=Y?"data"+(Y-1||""):"parentData",T=Y?v.dataPathArr[Y]:"parentDataProperty";Q+=" , "+l+" , "+T+", rootData) ";var E=Q;if(Q=$.pop(),V){if(!v.async)throw new Error("async schema referenced by sync schema");if(z)Q+=" var "+L+"; ";if(Q+=" try { await "+E+"; ",z)Q+=" "+L+" = true; ";if(Q+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",z)Q+=" "+L+" = false; ";if(Q+=" } ",z)Q+=" if ("+L+") { "}else if(Q+=" if (!"+E+") { if (vErrors === null) vErrors = "+q+".errors; else vErrors = vErrors.concat("+q+".errors); errors = vErrors.length; } ",z)Q+=" else { "}return Q}});var VW=s((N4,NW)=>{NW.exports=function f(v,W,J){var Q=" ",X=v.schema[W],Y=v.schemaPath+v.util.getProperty(W),w=v.errSchemaPath+"/"+W,B=!v.opts.allErrors,z=v.util.copy(v),K="";z.level++;var L="valid"+z.level,V=z.baseId,q=!0,M=X;if(M){var N,$=-1,O=M.length-1;while($<O)if(N=M[$+=1],v.opts.strictKeywords?typeof N=="object"&&Object.keys(N).length>0||N===!1:v.util.schemaHasRules(N,v.RULES.all)){if(q=!1,z.schema=N,z.schemaPath=Y+"["+$+"]",z.errSchemaPath=w+"/"+$,Q+=" "+v.validate(z)+" ",z.baseId=V,B)Q+=" if ("+L+") { ",K+="}"}}if(B)if(q)Q+=" if (true) { ";else Q+=" "+K.slice(0,-1)+" ";return Q}});var jW=s((V4,DW)=>{DW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O=w.every(function(g){return v.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:v.util.schemaHasRules(g,v.RULES.all)});if(O){var h=M.baseId;Q+=" var "+q+" = errors; var "+V+" = false; ";var H=v.compositeRule;v.compositeRule=M.compositeRule=!0;var k=w;if(k){var l,T=-1,E=k.length-1;while(T<E)l=k[T+=1],M.schema=l,M.schemaPath=B+"["+T+"]",M.errSchemaPath=z+"/"+T,Q+=" "+v.validate(M)+" ",M.baseId=h,Q+=" "+V+" = "+V+" || "+$+"; if (!"+V+") { ",N+="}"}if(v.compositeRule=M.compositeRule=H,Q+=" "+N+" if (!"+V+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should match some schema in anyOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } else { errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else if(K)Q+=" if (true) { ";return Q}});var OW=s((D4,EW)=>{EW.exports=function f(v,W,J){var Q=" ",X=v.schema[W],Y=v.errSchemaPath+"/"+W,w=!v.opts.allErrors,B=v.util.toQuotedString(X);if(v.opts.$comment===!0)Q+=" console.log("+B+");";else if(typeof v.opts.$comment=="function")Q+=" self._opts.$comment("+B+", "+v.util.toQuotedString(Y)+", validate.root.schema);";return Q}});var HW=s((j4,UW)=>{UW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;if(!q)Q+=" var schema"+X+" = validate.schema"+B+";";Q+="var "+V+" = equal("+L+", schema"+X+"); if (!"+V+") { ";var N=N||[];if(N.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'const' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { allowedValue: schema"+X+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to constant' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var $=Q;if(Q=N.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+$+"]); ";else Q+=" validate.errors = ["+$+"]; return false; ";else Q+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",K)Q+=" else { ";return Q}});var AW=s((E4,FW)=>{FW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O="i"+X,h=M.dataLevel=v.dataLevel+1,H="data"+h,k=v.baseId,l=v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all);if(Q+="var "+q+" = errors;var "+V+";",l){var T=v.compositeRule;v.compositeRule=M.compositeRule=!0,M.schema=w,M.schemaPath=B,M.errSchemaPath=z,Q+=" var "+$+" = false; for (var "+O+" = 0; "+O+" < "+L+".length; "+O+"++) { ",M.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers,!0);var E=L+"["+O+"]";M.dataPathArr[h]=O;var g=v.validate(M);if(M.baseId=k,v.util.varOccurences(g,H)<2)Q+=" "+v.util.varReplace(g,H,E)+" ";else Q+=" var "+H+" = "+E+"; "+g+" ";Q+=" if ("+$+") break; } ",v.compositeRule=M.compositeRule=T,Q+=" "+N+" if (!"+$+") {"}else Q+=" if ("+L+".length == 0) {";var U=U||[];if(U.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should contain a valid item' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var b=Q;if(Q=U.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+b+"]); ";else Q+=" validate.errors = ["+b+"]; return false; ";else Q+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { ",l)Q+=" errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ";if(v.opts.allErrors)Q+=" } ";return Q}});var _W=s((O4,gW)=>{gW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="errs__"+X,q=v.util.copy(v),M="";q.level++;var N="valid"+q.level,$={},O={},h=v.opts.ownProperties;for(T in w){if(T=="__proto__")continue;var H=w[T],k=Array.isArray(H)?O:$;k[T]=H}Q+="var "+V+" = errors;";var l=v.errorPath;Q+="var missing"+X+";";for(var T in O)if(k=O[T],k.length){if(Q+=" if ( "+L+v.util.getProperty(T)+" !== undefined ",h)Q+=" && Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(T)+"') ";if(K){Q+=" && ( ";var E=k;if(E){var g,U=-1,b=E.length-1;while(U<b){if(g=E[U+=1],U)Q+=" || ";var I=v.util.getProperty(g),S=L+I;if(Q+=" ( ( "+S+" === undefined ",h)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(g)+"') ";Q+=") && (missing"+X+" = "+v.util.toQuotedString(v.opts.jsonPointers?g:I)+") ) "}}Q+=")) { ";var _="missing"+X,R="' + "+_+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(l,_,!0):l+" + "+_;var y=y||[];if(y.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { property: '"+v.util.escapeQuotes(T)+"', missingProperty: '"+R+"', depsCount: "+k.length+", deps: '"+v.util.escapeQuotes(k.length==1?k[0]:k.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",k.length==1)Q+="property "+v.util.escapeQuotes(k[0]);else Q+="properties "+v.util.escapeQuotes(k.join(", "));Q+=" when property "+v.util.escapeQuotes(T)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var m=Q;if(Q=y.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+m+"]); ";else Q+=" validate.errors = ["+m+"]; return false; ";else Q+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{Q+=" ) { ";var a=k;if(a){var g,i=-1,p=a.length-1;while(i<p){g=a[i+=1];var I=v.util.getProperty(g),R=v.util.escapeQuotes(g),S=L+I;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(l,g,v.opts.jsonPointers);if(Q+=" if ( "+S+" === undefined ",h)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(g)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { property: '"+v.util.escapeQuotes(T)+"', missingProperty: '"+R+"', depsCount: "+k.length+", deps: '"+v.util.escapeQuotes(k.length==1?k[0]:k.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",k.length==1)Q+="property "+v.util.escapeQuotes(k[0]);else Q+="properties "+v.util.escapeQuotes(k.join(", "));Q+=" when property "+v.util.escapeQuotes(T)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(Q+=" } ",K)M+="}",Q+=" else { "}v.errorPath=l;var n=q.baseId;for(var T in $){var H=$[T];if(v.opts.strictKeywords?typeof H=="object"&&Object.keys(H).length>0||H===!1:v.util.schemaHasRules(H,v.RULES.all)){if(Q+=" "+N+" = true; if ( "+L+v.util.getProperty(T)+" !== undefined ",h)Q+=" && Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(T)+"') ";if(Q+=") { ",q.schema=H,q.schemaPath=B+v.util.getProperty(T),q.errSchemaPath=z+"/"+v.util.escapeFragment(T),Q+=" "+v.validate(q)+" ",q.baseId=n,Q+=" } ",K)Q+=" if ("+N+") { ",M+="}"}}if(K)Q+=" "+M+" if ("+V+" == errors) {";return Q}});var bW=s((U4,hW)=>{hW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;var N="i"+X,$="schema"+X;if(!q)Q+=" var "+$+" = validate.schema"+B+";";if(Q+="var "+V+";",q)Q+=" if (schema"+X+" === undefined) "+V+" = true; else if (!Array.isArray(schema"+X+")) "+V+" = false; else {";if(Q+=""+V+" = false;for (var "+N+"=0; "+N+"<"+$+".length; "+N+"++) if (equal("+L+", "+$+"["+N+"])) { "+V+" = true; break; }",q)Q+=" } ";Q+=" if (!"+V+") { ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { allowedValues: schema"+X+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to one of the allowed values' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var h=Q;if(Q=O.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+h+"]); ";else Q+=" validate.errors = ["+h+"]; return false; ";else Q+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",K)Q+=" else { ";return Q}});var kW=s((H4,RW)=>{RW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||"");if(v.opts.format===!1){if(K)Q+=" if (true) { ";return Q}var V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var M=v.opts.unknownFormats,N=Array.isArray(M);if(V){var $="format"+X,O="isObject"+X,h="formatType"+X;if(Q+=" var "+$+" = formats["+q+"]; var "+O+" = typeof "+$+" == 'object' && !("+$+" instanceof RegExp) && "+$+".validate; var "+h+" = "+O+" && "+$+".type || 'string'; if ("+O+") { ",v.async)Q+=" var async"+X+" = "+$+".async; ";if(Q+=" "+$+" = "+$+".validate; } if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'string') || ";if(Q+=" (",M!="ignore"){if(Q+=" ("+q+" && !"+$+" ",N)Q+=" && self._opts.unknownFormats.indexOf("+q+") == -1 ";Q+=") || "}if(Q+=" ("+$+" && "+h+" == '"+J+"' && !(typeof "+$+" == 'function' ? ",v.async)Q+=" (async"+X+" ? await "+$+"("+L+") : "+$+"("+L+")) ";else Q+=" "+$+"("+L+") ";Q+=" : "+$+".test("+L+"))))) {"}else{var $=v.formats[w];if(!$)if(M=="ignore"){if(v.logger.warn('unknown format "'+w+'" ignored in schema at path "'+v.errSchemaPath+'"'),K)Q+=" if (true) { ";return Q}else if(N&&M.indexOf(w)>=0){if(K)Q+=" if (true) { ";return Q}else throw new Error('unknown format "'+w+'" is used in schema at path "'+v.errSchemaPath+'"');var O=typeof $=="object"&&!($ instanceof RegExp)&&$.validate,h=O&&$.type||"string";if(O){var H=$.async===!0;$=$.validate}if(h!=J){if(K)Q+=" if (true) { ";return Q}if(H){if(!v.async)throw new Error("async format in sync schema");var k="formats"+v.util.getProperty(w)+".validate";Q+=" if (!(await "+k+"("+L+"))) { "}else{Q+=" if (! ";var k="formats"+v.util.getProperty(w);if(O)k+=".validate";if(typeof $=="function")Q+=" "+k+"("+L+") ";else Q+=" "+k+".test("+L+") ";Q+=") { "}}var l=l||[];if(l.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'format' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { format: ",V)Q+=""+q;else Q+=""+v.util.toQuotedString(w);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match format "`,V)Q+="' + "+q+" + '";else Q+=""+v.util.escapeQuotes(w);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(w);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var T=Q;if(Q=l.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+T+"]); ";else Q+=" validate.errors = ["+T+"]; return false; ";else Q+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",K)Q+=" else { ";return Q}});var yW=s((F4,SW)=>{SW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v);M.level++;var N="valid"+M.level,$=v.schema.then,O=v.schema.else,h=$!==void 0&&(v.opts.strictKeywords?typeof $=="object"&&Object.keys($).length>0||$===!1:v.util.schemaHasRules($,v.RULES.all)),H=O!==void 0&&(v.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:v.util.schemaHasRules(O,v.RULES.all)),k=M.baseId;if(h||H){var l;M.createErrors=!1,M.schema=w,M.schemaPath=B,M.errSchemaPath=z,Q+=" var "+q+" = errors; var "+V+" = true; ";var T=v.compositeRule;if(v.compositeRule=M.compositeRule=!0,Q+=" "+v.validate(M)+" ",M.baseId=k,M.createErrors=!0,Q+=" errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ",v.compositeRule=M.compositeRule=T,h){if(Q+=" if ("+N+") { ",M.schema=v.schema.then,M.schemaPath=v.schemaPath+".then",M.errSchemaPath=v.errSchemaPath+"/then",Q+=" "+v.validate(M)+" ",M.baseId=k,Q+=" "+V+" = "+N+"; ",h&&H)l="ifClause"+X,Q+=" var "+l+" = 'then'; ";else l="'then'";if(Q+=" } ",H)Q+=" else { "}else Q+=" if (!"+N+") { ";if(H){if(M.schema=v.schema.else,M.schemaPath=v.schemaPath+".else",M.errSchemaPath=v.errSchemaPath+"/else",Q+=" "+v.validate(M)+" ",M.baseId=k,Q+=" "+V+" = "+N+"; ",h&&H)l="ifClause"+X,Q+=" var "+l+" = 'else'; ";else l="'else'";Q+=" } "}if(Q+=" if (!"+V+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'if' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { failingKeyword: "+l+" } ",v.opts.messages!==!1)Q+=` , message: 'should match "' + `+l+` + '" schema' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } ",K)Q+=" else { "}else if(K)Q+=" if (true) { ";return Q}});var IW=s((A4,lW)=>{lW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O="i"+X,h=M.dataLevel=v.dataLevel+1,H="data"+h,k=v.baseId;if(Q+="var "+q+" = errors;var "+V+";",Array.isArray(w)){var l=v.schema.additionalItems;if(l===!1){Q+=" "+V+" = "+L+".length <= "+w.length+"; ";var T=z;z=v.errSchemaPath+"/additionalItems",Q+=" if (!"+V+") { ";var E=E||[];if(E.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+w.length+" } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have more than "+w.length+" items' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var g=Q;if(Q=E.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+g+"]); ";else Q+=" validate.errors = ["+g+"]; return false; ";else Q+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",z=T,K)N+="}",Q+=" else { "}var U=w;if(U){var b,I=-1,S=U.length-1;while(I<S)if(b=U[I+=1],v.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:v.util.schemaHasRules(b,v.RULES.all)){Q+=" "+$+" = true; if ("+L+".length > "+I+") { ";var _=L+"["+I+"]";M.schema=b,M.schemaPath=B+"["+I+"]",M.errSchemaPath=z+"/"+I,M.errorPath=v.util.getPathExpr(v.errorPath,I,v.opts.jsonPointers,!0),M.dataPathArr[h]=I;var R=v.validate(M);if(M.baseId=k,v.util.varOccurences(R,H)<2)Q+=" "+v.util.varReplace(R,H,_)+" ";else Q+=" var "+H+" = "+_+"; "+R+" ";if(Q+=" } ",K)Q+=" if ("+$+") { ",N+="}"}}if(typeof l=="object"&&(v.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:v.util.schemaHasRules(l,v.RULES.all))){M.schema=l,M.schemaPath=v.schemaPath+".additionalItems",M.errSchemaPath=v.errSchemaPath+"/additionalItems",Q+=" "+$+" = true; if ("+L+".length > "+w.length+") { for (var "+O+" = "+w.length+"; "+O+" < "+L+".length; "+O+"++) { ",M.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers,!0);var _=L+"["+O+"]";M.dataPathArr[h]=O;var R=v.validate(M);if(M.baseId=k,v.util.varOccurences(R,H)<2)Q+=" "+v.util.varReplace(R,H,_)+" ";else Q+=" var "+H+" = "+_+"; "+R+" ";if(K)Q+=" if (!"+$+") break; ";if(Q+=" } } ",K)Q+=" if ("+$+") { ",N+="}"}}else if(v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){M.schema=w,M.schemaPath=B,M.errSchemaPath=z,Q+=" for (var "+O+" = 0; "+O+" < "+L+".length; "+O+"++) { ",M.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers,!0);var _=L+"["+O+"]";M.dataPathArr[h]=O;var R=v.validate(M);if(M.baseId=k,v.util.varOccurences(R,H)<2)Q+=" "+v.util.varReplace(R,H,_)+" ";else Q+=" var "+H+" = "+_+"; "+R+" ";if(K)Q+=" if (!"+$+") break; ";Q+=" }"}if(K)Q+=" "+N+" if ("+q+" == errors) {";return Q}});var MQ=s((g4,ZW)=>{ZW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,k,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var M=W=="maximum",N=M?"exclusiveMaximum":"exclusiveMinimum",$=v.schema[N],O=v.opts.$data&&$&&$.$data,h=M?"<":">",H=M?">":"<",k=void 0;if(!(V||typeof w=="number"||w===void 0))throw new Error(W+" must be number");if(!(O||$===void 0||typeof $=="number"||typeof $=="boolean"))throw new Error(N+" must be number or boolean");if(O){var l=v.util.getData($.$data,Y,v.dataPathArr),T="exclusive"+X,E="exclType"+X,g="exclIsNumber"+X,U="op"+X,b="' + "+U+" + '";Q+=" var schemaExcl"+X+" = "+l+"; ",l="schemaExcl"+X,Q+=" var "+T+"; var "+E+" = typeof "+l+"; if ("+E+" != 'boolean' && "+E+" != 'undefined' && "+E+" != 'number') { ";var k=N,I=I||[];if(I.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(k||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: '"+N+" should be boolean' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var S=Q;if(Q=I.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+S+"]); ";else Q+=" validate.errors = ["+S+"]; return false; ";else Q+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";if(Q+=" "+E+" == 'number' ? ( ("+T+" = "+q+" === undefined || "+l+" "+h+"= "+q+") ? "+L+" "+H+"= "+l+" : "+L+" "+H+" "+q+" ) : ( ("+T+" = "+l+" === true) ? "+L+" "+H+"= "+q+" : "+L+" "+H+" "+q+" ) || "+L+" !== "+L+") { var op"+X+" = "+T+" ? '"+h+"' : '"+h+"='; ",w===void 0)k=N,z=v.errSchemaPath+"/"+N,q=l,V=O}else{var g=typeof $=="number",b=h;if(g&&V){var U="'"+b+"'";if(Q+=" if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" ( "+q+" === undefined || "+$+" "+h+"= "+q+" ? "+L+" "+H+"= "+$+" : "+L+" "+H+" "+q+" ) || "+L+" !== "+L+") { "}else{if(g&&w===void 0)T=!0,k=N,z=v.errSchemaPath+"/"+N,q=$,H+="=";else{if(g)q=Math[M?"min":"max"]($,w);if($===(g?q:!0))T=!0,k=N,z=v.errSchemaPath+"/"+N,H+="=";else T=!1,b+="="}var U="'"+b+"'";if(Q+=" if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" "+L+" "+H+" "+q+" || "+L+" !== "+L+") { "}}k=k||W;var I=I||[];if(I.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(k||"_limit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { comparison: "+U+", limit: "+q+", exclusive: "+T+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be "+b+" ",V)Q+="' + "+q;else Q+=""+q+"'";if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var S=Q;if(Q=I.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+S+"]); ";else Q+=" validate.errors = ["+S+"]; return false; ";else Q+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",K)Q+=" else { ";return Q}});var NQ=s((_4,CW)=>{CW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,N,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(V||typeof w=="number"))throw new Error(W+" must be number");var M=W=="maxItems"?">":"<";if(Q+="if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" "+L+".length "+M+" "+q+") { ";var N=W,$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(N||"_limitItems")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxItems")Q+="more";else Q+="fewer";if(Q+=" than ",V)Q+="' + "+q+" + '";else Q+=""+w;Q+=" items' "}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var VQ=s((h4,TW)=>{TW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,N,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(V||typeof w=="number"))throw new Error(W+" must be number");var M=W=="maxLength"?">":"<";if(Q+="if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";if(v.opts.unicode===!1)Q+=" "+L+".length ";else Q+=" ucs2length("+L+") ";Q+=" "+M+" "+q+") { ";var N=W,$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(N||"_limitLength")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT be ",W=="maxLength")Q+="longer";else Q+="shorter";if(Q+=" than ",V)Q+="' + "+q+" + '";else Q+=""+w;Q+=" characters' "}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var DQ=s((b4,xW)=>{xW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,N,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(V||typeof w=="number"))throw new Error(W+" must be number");var M=W=="maxProperties"?">":"<";if(Q+="if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" Object.keys("+L+").length "+M+" "+q+") { ";var N=W,$=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(N||"_limitProperties")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxProperties")Q+="more";else Q+="fewer";if(Q+=" than ",V)Q+="' + "+q+" + '";else Q+=""+w;Q+=" properties' "}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=$.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var mW=s((R4,uW)=>{uW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(V||typeof w=="number"))throw new Error(W+" must be number");if(Q+="var division"+X+";if (",V)Q+=" "+q+" !== undefined && ( typeof "+q+" != 'number' || ";if(Q+=" (division"+X+" = "+L+" / "+q+", ",v.opts.multipleOfPrecision)Q+=" Math.abs(Math.round(division"+X+") - division"+X+") > 1e-"+v.opts.multipleOfPrecision+" ";else Q+=" division"+X+" !== parseInt(division"+X+") ";if(Q+=" ) ",V)Q+=" ) ";Q+=" ) { ";var M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { multipleOf: "+q+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be multiple of ",V)Q+="' + "+q;else Q+=""+q+"'";if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var N=Q;if(Q=M.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+N+"]); ";else Q+=" validate.errors = ["+N+"]; return false; ";else Q+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var aW=s((k4,rW)=>{rW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="errs__"+X,q=v.util.copy(v);q.level++;var M="valid"+q.level;if(v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){q.schema=w,q.schemaPath=B,q.errSchemaPath=z,Q+=" var "+V+" = errors; ";var N=v.compositeRule;v.compositeRule=q.compositeRule=!0,q.createErrors=!1;var $;if(q.opts.allErrors)$=q.opts.allErrors,q.opts.allErrors=!1;if(Q+=" "+v.validate(q)+" ",q.createErrors=!0,$)q.opts.allErrors=$;v.compositeRule=q.compositeRule=N,Q+=" if ("+M+") { ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var h=Q;if(Q=O.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+h+"]); ";else Q+=" validate.errors = ["+h+"]; return false; ";else Q+=" var err = "+h+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { errors = "+V+"; if (vErrors !== null) { if ("+V+") vErrors.length = "+V+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else{if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",K)Q+=" if (false) { "}return Q}});var nW=s((S4,cW)=>{cW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q="errs__"+X,M=v.util.copy(v),N="";M.level++;var $="valid"+M.level,O=M.baseId,h="prevValid"+X,H="passingSchemas"+X;Q+="var "+q+" = errors , "+h+" = false , "+V+" = false , "+H+" = null; ";var k=v.compositeRule;v.compositeRule=M.compositeRule=!0;var l=w;if(l){var T,E=-1,g=l.length-1;while(E<g){if(T=l[E+=1],v.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:v.util.schemaHasRules(T,v.RULES.all))M.schema=T,M.schemaPath=B+"["+E+"]",M.errSchemaPath=z+"/"+E,Q+=" "+v.validate(M)+" ",M.baseId=O;else Q+=" var "+$+" = true; ";if(E)Q+=" if ("+$+" && "+h+") { "+V+" = false; "+H+" = ["+H+", "+E+"]; } else { ",N+="}";Q+=" if ("+$+") { "+V+" = "+h+" = true; "+H+" = "+E+"; }"}}if(v.compositeRule=M.compositeRule=k,Q+=""+N+"if (!"+V+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { passingSchemas: "+H+" } ",v.opts.messages!==!1)Q+=" , message: 'should match exactly one schema in oneOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+="} else { errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; }",v.opts.allErrors)Q+=" } ";return Q}});var iW=s((y4,pW)=>{pW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V=v.opts.$data&&w&&w.$data,q;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var M=V?"(new RegExp("+q+"))":v.usePattern(w);if(Q+="if ( ",V)Q+=" ("+q+" !== undefined && typeof "+q+" != 'string') || ";Q+=" !"+M+".test("+L+") ) { ";var N=N||[];if(N.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { pattern: ",V)Q+=""+q;else Q+=""+v.util.toQuotedString(w);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match pattern "`,V)Q+="' + "+q+" + '";else Q+=""+v.util.escapeQuotes(w);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",V)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(w);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var $=Q;if(Q=N.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+$+"]); ";else Q+=" validate.errors = ["+$+"]; return false; ";else Q+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",K)Q+=" else { ";return Q}});var oW=s((l4,dW)=>{dW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="errs__"+X,q=v.util.copy(v),M="";q.level++;var N="valid"+q.level,$="key"+X,O="idx"+X,h=q.dataLevel=v.dataLevel+1,H="data"+h,k="dataProperties"+X,l=Object.keys(w||{}).filter(i),T=v.schema.patternProperties||{},E=Object.keys(T).filter(i),g=v.schema.additionalProperties,U=l.length||E.length,b=g===!1,I=typeof g=="object"&&Object.keys(g).length,S=v.opts.removeAdditional,_=b||I||S,R=v.opts.ownProperties,y=v.baseId,m=v.schema.required;if(m&&!(v.opts.$data&&m.$data)&&m.length<v.opts.loopRequired)var a=v.util.toHash(m);function i(dv){return dv!=="__proto__"}if(Q+="var "+V+" = errors;var "+N+" = true;",R)Q+=" var "+k+" = undefined;";if(_){if(R)Q+=" "+k+" = "+k+" || Object.keys("+L+"); for (var "+O+"=0; "+O+"<"+k+".length; "+O+"++) { var "+$+" = "+k+"["+O+"]; ";else Q+=" for (var "+$+" in "+L+") { ";if(U){if(Q+=" var isAdditional"+X+" = !(false ",l.length)if(l.length>8)Q+=" || validate.schema"+B+".hasOwnProperty("+$+") ";else{var p=l;if(p){var n,$v=-1,bv=p.length-1;while($v<bv)n=p[$v+=1],Q+=" || "+$+" == "+v.util.toQuotedString(n)+" "}}if(E.length){var Sv=E;if(Sv){var Yv,Ov=-1,gv=Sv.length-1;while(Ov<gv)Yv=Sv[Ov+=1],Q+=" || "+v.usePattern(Yv)+".test("+$+") "}}Q+=" ); if (isAdditional"+X+") { "}if(S=="all")Q+=" delete "+L+"["+$+"]; ";else{var yv=v.errorPath,Df="' + "+$+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);if(b)if(S)Q+=" delete "+L+"["+$+"]; ";else{Q+=" "+N+" = false; ";var Pf=z;z=v.errSchemaPath+"/additionalProperties";var Uv=Uv||[];if(Uv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { additionalProperty: '"+Df+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is an invalid additional property";else Q+="should NOT have additional properties";Q+="' "}if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var jv=Q;if(Q=Uv.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+jv+"]); ";else Q+=" validate.errors = ["+jv+"]; return false; ";else Q+=" var err = "+jv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(z=Pf,K)Q+=" break; "}else if(I)if(S=="failing"){Q+=" var "+V+" = errors; ";var bf=v.compositeRule;v.compositeRule=q.compositeRule=!0,q.schema=g,q.schemaPath=v.schemaPath+".additionalProperties",q.errSchemaPath=v.errSchemaPath+"/additionalProperties",q.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);var Rv=L+"["+$+"]";q.dataPathArr[h]=$;var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2)Q+=" "+v.util.varReplace(Gv,H,Rv)+" ";else Q+=" var "+H+" = "+Rv+"; "+Gv+" ";Q+=" if (!"+N+") { errors = "+V+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+L+"["+$+"]; } ",v.compositeRule=q.compositeRule=bf}else{q.schema=g,q.schemaPath=v.schemaPath+".additionalProperties",q.errSchemaPath=v.errSchemaPath+"/additionalProperties",q.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);var Rv=L+"["+$+"]";q.dataPathArr[h]=$;var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2)Q+=" "+v.util.varReplace(Gv,H,Rv)+" ";else Q+=" var "+H+" = "+Rv+"; "+Gv+" ";if(K)Q+=" if (!"+N+") break; "}v.errorPath=yv}if(U)Q+=" } ";if(Q+=" } ",K)Q+=" if ("+N+") { ",M+="}"}var jf=v.opts.useDefaults&&!v.compositeRule;if(l.length){var Kf=l;if(Kf){var n,Rf=-1,kf=Kf.length-1;while(Rf<kf){n=Kf[Rf+=1];var _v=w[n];if(v.opts.strictKeywords?typeof _v=="object"&&Object.keys(_v).length>0||_v===!1:v.util.schemaHasRules(_v,v.RULES.all)){var av=v.util.getProperty(n),Rv=L+av,Zv=jf&&_v.default!==void 0;q.schema=_v,q.schemaPath=B+av,q.errSchemaPath=z+"/"+v.util.escapeFragment(n),q.errorPath=v.util.getPath(v.errorPath,n,v.opts.jsonPointers),q.dataPathArr[h]=v.util.toQuotedString(n);var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2){Gv=v.util.varReplace(Gv,H,Rv);var lv=Rv}else{var lv=H;Q+=" var "+H+" = "+Rv+"; "}if(Zv)Q+=" "+Gv+" ";else{if(a&&a[n]){if(Q+=" if ( "+lv+" === undefined ",R)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(n)+"') ";Q+=") { "+N+" = false; ";var yv=v.errorPath,Pf=z,Jf=v.util.escapeQuotes(n);if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(yv,n,v.opts.jsonPointers);z=v.errSchemaPath+"/required";var Uv=Uv||[];if(Uv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+Jf+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+Jf+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var jv=Q;if(Q=Uv.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+jv+"]); ";else Q+=" validate.errors = ["+jv+"]; return false; ";else Q+=" var err = "+jv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";z=Pf,v.errorPath=yv,Q+=" } else { "}else if(K){if(Q+=" if ( "+lv+" === undefined ",R)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(n)+"') ";Q+=") { "+N+" = true; } else { "}else{if(Q+=" if ("+lv+" !== undefined ",R)Q+=" && Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(n)+"') ";Q+=" ) { "}Q+=" "+Gv+" } "}}if(K)Q+=" if ("+N+") { ",M+="}"}}}if(E.length){var uv=E;if(uv){var Yv,y1=-1,S0=uv.length-1;while(y1<S0){Yv=uv[y1+=1];var _v=T[Yv];if(v.opts.strictKeywords?typeof _v=="object"&&Object.keys(_v).length>0||_v===!1:v.util.schemaHasRules(_v,v.RULES.all)){if(q.schema=_v,q.schemaPath=v.schemaPath+".patternProperties"+v.util.getProperty(Yv),q.errSchemaPath=v.errSchemaPath+"/patternProperties/"+v.util.escapeFragment(Yv),R)Q+=" "+k+" = "+k+" || Object.keys("+L+"); for (var "+O+"=0; "+O+"<"+k+".length; "+O+"++) { var "+$+" = "+k+"["+O+"]; ";else Q+=" for (var "+$+" in "+L+") { ";Q+=" if ("+v.usePattern(Yv)+".test("+$+")) { ",q.errorPath=v.util.getPathExpr(v.errorPath,$,v.opts.jsonPointers);var Rv=L+"["+$+"]";q.dataPathArr[h]=$;var Gv=v.validate(q);if(q.baseId=y,v.util.varOccurences(Gv,H)<2)Q+=" "+v.util.varReplace(Gv,H,Rv)+" ";else Q+=" var "+H+" = "+Rv+"; "+Gv+" ";if(K)Q+=" if (!"+N+") break; ";if(Q+=" } ",K)Q+=" else "+N+" = true; ";if(Q+=" } ",K)Q+=" if ("+N+") { ",M+="}"}}}}if(K)Q+=" "+M+" if ("+V+" == errors) {";return Q}});var tW=s((I4,sW)=>{sW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="errs__"+X,q=v.util.copy(v),M="";q.level++;var N="valid"+q.level;if(Q+="var "+V+" = errors;",v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){q.schema=w,q.schemaPath=B,q.errSchemaPath=z;var $="key"+X,O="idx"+X,h="i"+X,H="' + "+$+" + '",k=q.dataLevel=v.dataLevel+1,l="data"+k,T="dataProperties"+X,E=v.opts.ownProperties,g=v.baseId;if(E)Q+=" var "+T+" = undefined; ";if(E)Q+=" "+T+" = "+T+" || Object.keys("+L+"); for (var "+O+"=0; "+O+"<"+T+".length; "+O+"++) { var "+$+" = "+T+"["+O+"]; ";else Q+=" for (var "+$+" in "+L+") { ";Q+=" var startErrs"+X+" = errors; ";var U=$,b=v.compositeRule;v.compositeRule=q.compositeRule=!0;var I=v.validate(q);if(q.baseId=g,v.util.varOccurences(I,l)<2)Q+=" "+v.util.varReplace(I,l,U)+" ";else Q+=" var "+l+" = "+U+"; "+I+" ";if(v.compositeRule=q.compositeRule=b,Q+=" if (!"+N+") { for (var "+h+"=startErrs"+X+"; "+h+"<errors; "+h+"++) { vErrors["+h+"].propertyName = "+$+"; } var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { propertyName: '"+H+"' } ",v.opts.messages!==!1)Q+=" , message: 'property name \\'"+H+"\\' is invalid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(K)Q+=" break; ";Q+=" } }"}if(K)Q+=" "+M+" if ("+V+" == errors) {";return Q}});var v9=s((Z4,eW)=>{eW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;var N="schema"+X;if(!q)if(w.length<v.opts.loopRequired&&v.schema.properties&&Object.keys(v.schema.properties).length){var $=[],O=w;if(O){var h,H=-1,k=O.length-1;while(H<k){h=O[H+=1];var l=v.schema.properties[h];if(!(l&&(v.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:v.util.schemaHasRules(l,v.RULES.all))))$[$.length]=h}}}else var $=w;if(q||$.length){var T=v.errorPath,E=q||$.length>=v.opts.loopRequired,g=v.opts.ownProperties;if(K)if(Q+=" var missing"+X+"; ",E){if(!q)Q+=" var "+N+" = validate.schema"+B+"; ";var U="i"+X,b="schema"+X+"["+U+"]",I="' + "+b+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(T,b,v.opts.jsonPointers);if(Q+=" var "+V+" = true; ",q)Q+=" if (schema"+X+" === undefined) "+V+" = true; else if (!Array.isArray(schema"+X+")) "+V+" = false; else {";if(Q+=" for (var "+U+" = 0; "+U+" < "+N+".length; "+U+"++) { "+V+" = "+L+"["+N+"["+U+"]] !== undefined ",g)Q+=" && Object.prototype.hasOwnProperty.call("+L+", "+N+"["+U+"]) ";if(Q+="; if (!"+V+") break; } ",q)Q+=" } ";Q+=" if (!"+V+") { ";var S=S||[];if(S.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var _=Q;if(Q=S.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+_+"]); ";else Q+=" validate.errors = ["+_+"]; return false; ";else Q+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else{Q+=" if ( ";var R=$;if(R){var y,U=-1,m=R.length-1;while(U<m){if(y=R[U+=1],U)Q+=" || ";var a=v.util.getProperty(y),i=L+a;if(Q+=" ( ( "+i+" === undefined ",g)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(y)+"') ";Q+=") && (missing"+X+" = "+v.util.toQuotedString(v.opts.jsonPointers?y:a)+") ) "}}Q+=") { ";var b="missing"+X,I="' + "+b+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(T,b,!0):T+" + "+b;var S=S||[];if(S.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";var _=Q;if(Q=S.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+_+"]); ";else Q+=" validate.errors = ["+_+"]; return false; ";else Q+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else if(E){if(!q)Q+=" var "+N+" = validate.schema"+B+"; ";var U="i"+X,b="schema"+X+"["+U+"]",I="' + "+b+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(T,b,v.opts.jsonPointers);if(q){if(Q+=" if ("+N+" && !Array.isArray("+N+")) { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+N+" !== undefined) { "}if(Q+=" for (var "+U+" = 0; "+U+" < "+N+".length; "+U+"++) { if ("+L+"["+N+"["+U+"]] === undefined ",g)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", "+N+"["+U+"]) ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",q)Q+=" } "}else{var p=$;if(p){var y,n=-1,$v=p.length-1;while(n<$v){y=p[n+=1];var a=v.util.getProperty(y),I=v.util.escapeQuotes(y),i=L+a;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(T,y,v.opts.jsonPointers);if(Q+=" if ( "+i+" === undefined ",g)Q+=" || ! Object.prototype.hasOwnProperty.call("+L+", '"+v.util.escapeQuotes(y)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+I+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+I+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}v.errorPath=T}else if(K)Q+=" if (true) {";return Q}});var Q9=s((C4,f9)=>{f9.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L="data"+(Y||""),V="valid"+X,q=v.opts.$data&&w&&w.$data,M;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;if((w||q)&&v.opts.uniqueItems!==!1){if(q)Q+=" var "+V+"; if ("+M+" === false || "+M+" === undefined) "+V+" = true; else if (typeof "+M+" != 'boolean') "+V+" = false; else { ";Q+=" var i = "+L+".length , "+V+" = true , j; if (i > 1) { ";var N=v.schema.items&&v.schema.items.type,$=Array.isArray(N);if(!N||N=="object"||N=="array"||$&&(N.indexOf("object")>=0||N.indexOf("array")>=0))Q+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+L+"[i], "+L+"[j])) { "+V+" = false; break outer; } } } ";else{Q+=" var itemIndices = {}, item; for (;i--;) { var item = "+L+"[i]; ";var O="checkDataType"+($?"s":"");if(Q+=" if ("+v.util[O](N,"item",v.opts.strictNumbers,!0)+") continue; ",$)Q+=` if (typeof item == 'string') item = '"' + item; `;Q+=" if (typeof itemIndices[item] == 'number') { "+V+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(Q+=" } ",q)Q+=" } ";Q+=" if (!"+V+") { ";var h=h||[];if(h.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { i: i, j: j } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(v.opts.verbose){if(Q+=" , schema: ",q)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+L+" "}Q+=" } "}else Q+=" {} ";var H=Q;if(Q=h.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",K)Q+=" else { "}else if(K)Q+=" if (true) { ";return Q}});var J9=s((T4,W9)=>{W9.exports={$ref:MW(),allOf:VW(),anyOf:jW(),$comment:OW(),const:HW(),contains:AW(),dependencies:_W(),enum:bW(),format:kW(),if:yW(),items:IW(),maximum:MQ(),minimum:MQ(),maxItems:NQ(),minItems:NQ(),maxLength:VQ(),minLength:VQ(),maxProperties:DQ(),minProperties:DQ(),multipleOf:mW(),not:aW(),oneOf:nW(),pattern:iW(),properties:oW(),propertyNames:tW(),required:v9(),uniqueItems:Q9(),validate:$Q()}});var w9=s((x4,Y9)=>{var X9=J9(),jQ=uf().toHash;Y9.exports=function f(){var v=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],W=["type","$comment"],J=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],Q=["number","integer","string","array","object","boolean","null"];return v.all=jQ(W),v.types=jQ(Q),v.forEach(function(X){if(X.rules=X.rules.map(function(Y){var w;if(typeof Y=="object"){var B=Object.keys(Y)[0];w=Y[B],Y=B,w.forEach(function(K){W.push(K),v.all[K]=!0})}W.push(Y);var z=v.all[Y]={keyword:Y,code:X9[Y],implements:w};return z}),v.all.$comment={keyword:"$comment",code:X9.$comment},X.type)v.types[X.type]=X}),v.keywords=jQ(W.concat(J)),v.custom={},v}});var q9=s((u4,B9)=>{var G9=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];B9.exports=function(f,v){for(var W=0;W<v.length;W++){f=JSON.parse(JSON.stringify(f));var J=v[W].split("/"),Q=f,X;for(X=1;X<J.length;X++)Q=Q[J[X]];for(X=0;X<G9.length;X++){var Y=G9[X],w=Q[Y];if(w)Q[Y]={anyOf:[w,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return f}});var z9=s((m4,K9)=>{var KY=z0().MissingRef;K9.exports=P9;function P9(f,v,W){var J=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof v=="function")W=v,v=void 0;var Q=X(f).then(function(){var w=J._addSchema(f,void 0,v);return w.validate||Y(w)});if(W)Q.then(function(w){W(null,w)},W);return Q;function X(w){var B=w.$schema;return B&&!J.getSchema(B)?P9.call(J,{$ref:B},!0):Promise.resolve()}function Y(w){try{return J._compile(w)}catch(z){if(z instanceof KY)return B(z);throw z}function B(z){var K=z.missingSchema;if(q(K))throw new Error("Schema "+K+" is loaded but "+z.missingRef+" cannot be resolved");var L=J._loadingSchemas[K];if(!L)L=J._loadingSchemas[K]=J._opts.loadSchema(K),L.then(V,V);return L.then(function(M){if(!q(K))return X(M).then(function(){if(!q(K))J.addSchema(M,K,void 0,v)})}).then(function(){return Y(w)});function V(){delete J._loadingSchemas[K]}function q(M){return J._refs[M]||J._schemas[M]}}}}});var L9=s((r4,$9)=>{$9.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,K=!v.opts.allErrors,L,V="data"+(Y||""),q="valid"+X,M="errs__"+X,N=v.opts.$data&&w&&w.$data,$;if(N)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",$="schema"+X;else $=w;var O=this,h="definition"+X,H=O.definition,k="",l,T,E,g,U;if(N&&H.$data){U="keywordValidate"+X;var b=H.validateSchema;Q+=" var "+h+" = RULES.custom['"+W+"'].definition; var "+U+" = "+h+".validate;"}else{if(g=v.useCustomRule(O,w,v.schema,v),!g)return;$="validate.schema"+B,U=g.code,l=H.compile,T=H.inline,E=H.macro}var I=U+".errors",S="i"+X,_="ruleErr"+X,R=H.async;if(R&&!v.async)throw new Error("async keyword in sync schema");if(!(T||E))Q+=""+I+" = null;";if(Q+="var "+M+" = errors;var "+q+";",N&&H.$data){if(k+="}",Q+=" if ("+$+" === undefined) { "+q+" = true; } else { ",b)k+="}",Q+=" "+q+" = "+h+".validateSchema("+$+"); if ("+q+") { "}if(T)if(H.statements)Q+=" "+g.validate+" ";else Q+=" "+q+" = "+g.validate+"; ";else if(E){var y=v.util.copy(v),k="";y.level++;var m="valid"+y.level;y.schema=g.validate,y.schemaPath="";var a=v.compositeRule;v.compositeRule=y.compositeRule=!0;var i=v.validate(y).replace(/validate\.schema/g,U);v.compositeRule=y.compositeRule=a,Q+=" "+i}else{var p=p||[];if(p.push(Q),Q="",Q+=" "+U+".call( ",v.opts.passContext)Q+="this";else Q+="self";if(l||H.schema===!1)Q+=" , "+V+" ";else Q+=" , "+$+" , "+V+" , validate.schema"+v.schemaPath+" ";if(Q+=" , (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var n=Y?"data"+(Y-1||""):"parentData",$v=Y?v.dataPathArr[Y]:"parentDataProperty";Q+=" , "+n+" , "+$v+" , rootData ) ";var bv=Q;if(Q=p.pop(),H.errors===!1){if(Q+=" "+q+" = ",R)Q+="await ";Q+=""+bv+"; "}else if(R)I="customErrors"+X,Q+=" var "+I+" = null; try { "+q+" = await "+bv+"; } catch (e) { "+q+" = false; if (e instanceof ValidationError) "+I+" = e.errors; else throw e; } ";else Q+=" "+I+" = null; "+q+" = "+bv+"; "}if(H.modifying)Q+=" if ("+n+") "+V+" = "+n+"["+$v+"];";if(Q+=""+k,H.valid){if(K)Q+=" if (true) { "}else{if(Q+=" if ( ",H.valid===void 0)if(Q+=" !",E)Q+=""+m;else Q+=""+q;else Q+=" "+!H.valid+" ";Q+=") { ",L=O.keyword;var p=p||[];p.push(Q),Q="";var p=p||[];if(p.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(L||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { keyword: '"+O.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+O.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+V+" ";Q+=" } "}else Q+=" {} ";var Sv=Q;if(Q=p.pop(),!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(["+Sv+"]); ";else Q+=" validate.errors = ["+Sv+"]; return false; ";else Q+=" var err = "+Sv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Yv=Q;if(Q=p.pop(),T)if(H.errors){if(H.errors!="full"){if(Q+=" for (var "+S+"="+M+"; "+S+"<errors; "+S+"++) { var "+_+" = vErrors["+S+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+z+'"; } ',v.opts.verbose)Q+=" "+_+".schema = "+$+"; "+_+".data = "+V+"; ";Q+=" } "}}else if(H.errors===!1)Q+=" "+Yv+" ";else{if(Q+=" if ("+M+" == errors) { "+Yv+" } else { for (var "+S+"="+M+"; "+S+"<errors; "+S+"++) { var "+_+" = vErrors["+S+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+_+".schemaPath === undefined) { "+_+'.schemaPath = "'+z+'"; } ',v.opts.verbose)Q+=" "+_+".schema = "+$+"; "+_+".data = "+V+"; ";Q+=" } } "}else if(E){if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: '"+(L||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { keyword: '"+O.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+O.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+V+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&K)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; "}else if(H.errors===!1)Q+=" "+Yv+" ";else{if(Q+=" if (Array.isArray("+I+")) { if (vErrors === null) vErrors = "+I+"; else vErrors = vErrors.concat("+I+"); errors = vErrors.length; for (var "+S+"="+M+"; "+S+"<errors; "+S+"++) { var "+_+" = vErrors["+S+"]; if ("+_+".dataPath === undefined) "+_+".dataPath = (dataPath || '') + "+v.errorPath+"; "+_+'.schemaPath = "'+z+'"; ',v.opts.verbose)Q+=" "+_+".schema = "+$+"; "+_+".data = "+V+"; ";Q+=" } } else { "+Yv+" } "}if(Q+=" } ",K)Q+=" else { "}return Q}});var EQ=s((a4,zY)=>{zY.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var V9=s((c4,N9)=>{var M9=EQ();N9.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:M9.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:M9.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var j9=s((n4,D9)=>{var $Y=/^[a-z_$][a-z0-9_$-]*$/i,LY=L9(),MY=V9();D9.exports={add:NY,get:VY,remove:DY,validate:OQ};function NY(f,v){var W=this.RULES;if(W.keywords[f])throw new Error("Keyword "+f+" is already defined");if(!$Y.test(f))throw new Error("Keyword "+f+" is not a valid identifier");if(v){this.validateKeyword(v,!0);var J=v.type;if(Array.isArray(J))for(var Q=0;Q<J.length;Q++)Y(f,J[Q],v);else Y(f,J,v);var X=v.metaSchema;if(X){if(v.$data&&this._opts.$data)X={anyOf:[X,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};v.validateSchema=this.compile(X,!0)}}W.keywords[f]=W.all[f]=!0;function Y(w,B,z){var K;for(var L=0;L<W.length;L++){var V=W[L];if(V.type==B){K=V;break}}if(!K)K={type:B,rules:[]},W.push(K);var q={keyword:w,definition:z,custom:!0,code:LY,implements:z.implements};K.rules.push(q),W.custom[w]=q}return this}function VY(f){var v=this.RULES.custom[f];return v?v.definition:this.RULES.keywords[f]||!1}function DY(f){var v=this.RULES;delete v.keywords[f],delete v.all[f],delete v.custom[f];for(var W=0;W<v.length;W++){var J=v[W].rules;for(var Q=0;Q<J.length;Q++)if(J[Q].keyword==f){J.splice(Q,1);break}}return this}function OQ(f,v){OQ.errors=null;var W=this._validateKeyword=this._validateKeyword||this.compile(MY,!0);if(W(f))return!0;if(OQ.errors=W.errors,v)throw new Error("custom keyword definition is invalid: "+this.errorsText(W.errors));else return!1}});var E9=s((p4,jY)=>{jY.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var R9=s((i4,b9)=>{var U9=vW(),mf=K0(),EY=QW(),H9=wQ(),OY=zQ(),UY=$W(),HY=w9(),F9=q9(),A9=uf();b9.exports=Ev;Ev.prototype.validate=AY;Ev.prototype.compile=gY;Ev.prototype.addSchema=_Y;Ev.prototype.addMetaSchema=hY;Ev.prototype.validateSchema=bY;Ev.prototype.getSchema=kY;Ev.prototype.removeSchema=yY;Ev.prototype.addFormat=mY;Ev.prototype.errorsText=uY;Ev.prototype._addSchema=lY;Ev.prototype._compile=IY;Ev.prototype.compileAsync=z9();var E0=j9();Ev.prototype.addKeyword=E0.add;Ev.prototype.getKeyword=E0.get;Ev.prototype.removeKeyword=E0.remove;Ev.prototype.validateKeyword=E0.validate;var g9=z0();Ev.ValidationError=g9.Validation;Ev.MissingRefError=g9.MissingRef;Ev.$dataMetaSchema=F9;var j0="http://json-schema.org/draft-07/schema",O9=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],FY=["/properties"];function Ev(f){if(!(this instanceof Ev))return new Ev(f);if(f=this._opts=A9.copy(f)||{},iY(this),this._schemas={},this._refs={},this._fragments={},this._formats=UY(f.format),this._cache=f.cache||new EY,this._loadingSchemas={},this._compilations=[],this.RULES=HY(),this._getId=ZY(f),f.loopRequired=f.loopRequired||1/0,f.errorDataPath=="property")f._errorDataPathProperty=!0;if(f.serialize===void 0)f.serialize=OY;if(this._metaOpts=pY(this),f.formats)cY(this);if(f.keywords)nY(this);if(rY(this),typeof f.meta=="object")this.addMetaSchema(f.meta);if(f.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});aY(this)}function AY(f,v){var W;if(typeof f=="string"){if(W=this.getSchema(f),!W)throw new Error('no schema with key or ref "'+f+'"')}else{var J=this._addSchema(f);W=J.validate||this._compile(J)}var Q=W(v);if(W.$async!==!0)this.errors=W.errors;return Q}function gY(f,v){var W=this._addSchema(f,void 0,v);return W.validate||this._compile(W)}function _Y(f,v,W,J){if(Array.isArray(f)){for(var Q=0;Q<f.length;Q++)this.addSchema(f[Q],void 0,W,J);return this}var X=this._getId(f);if(X!==void 0&&typeof X!="string")throw new Error("schema id must be string");return v=mf.normalizeId(v||X),h9(this,v),this._schemas[v]=this._addSchema(f,W,J,!0),this}function hY(f,v,W){return this.addSchema(f,v,W,!0),this}function bY(f,v){var W=f.$schema;if(W!==void 0&&typeof W!="string")throw new Error("$schema must be a string");if(W=W||this._opts.defaultMeta||RY(this),!W)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var J=this.validate(W,f);if(!J&&v){var Q="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(Q);else throw new Error(Q)}return J}function RY(f){var v=f._opts.meta;return f._opts.defaultMeta=typeof v=="object"?f._getId(v)||v:f.getSchema(j0)?j0:void 0,f._opts.defaultMeta}function kY(f){var v=_9(this,f);switch(typeof v){case"object":return v.validate||this._compile(v);case"string":return this.getSchema(v);case"undefined":return SY(this,f)}}function SY(f,v){var W=mf.schema.call(f,{schema:{}},v);if(W){var{schema:J,root:Q,baseId:X}=W,Y=U9.call(f,J,Q,void 0,X);return f._fragments[v]=new H9({ref:v,fragment:!0,schema:J,root:Q,baseId:X,validate:Y}),Y}}function _9(f,v){return v=mf.normalizeId(v),f._schemas[v]||f._refs[v]||f._fragments[v]}function yY(f){if(f instanceof RegExp)return D0(this,this._schemas,f),D0(this,this._refs,f),this;switch(typeof f){case"undefined":return D0(this,this._schemas),D0(this,this._refs),this._cache.clear(),this;case"string":var v=_9(this,f);if(v)this._cache.del(v.cacheKey);return delete this._schemas[f],delete this._refs[f],this;case"object":var W=this._opts.serialize,J=W?W(f):f;this._cache.del(J);var Q=this._getId(f);if(Q)Q=mf.normalizeId(Q),delete this._schemas[Q],delete this._refs[Q]}return this}function D0(f,v,W){for(var J in v){var Q=v[J];if(!Q.meta&&(!W||W.test(J)))f._cache.del(Q.cacheKey),delete v[J]}}function lY(f,v,W,J){if(typeof f!="object"&&typeof f!="boolean")throw new Error("schema should be object or boolean");var Q=this._opts.serialize,X=Q?Q(f):f,Y=this._cache.get(X);if(Y)return Y;J=J||this._opts.addUsedSchema!==!1;var w=mf.normalizeId(this._getId(f));if(w&&J)h9(this,w);var B=this._opts.validateSchema!==!1&&!v,z;if(B&&!(z=w&&w==mf.normalizeId(f.$schema)))this.validateSchema(f,!0);var K=mf.ids.call(this,f),L=new H9({id:w,schema:f,localRefs:K,cacheKey:X,meta:W});if(w[0]!="#"&&J)this._refs[w]=L;if(this._cache.put(X,L),B&&z)this.validateSchema(f,!0);return L}function IY(f,v){if(f.compiling){if(f.validate=Q,Q.schema=f.schema,Q.errors=null,Q.root=v?v:Q,f.schema.$async===!0)Q.$async=!0;return Q}f.compiling=!0;var W;if(f.meta)W=this._opts,this._opts=this._metaOpts;var J;try{J=U9.call(this,f.schema,v,f.localRefs)}catch(X){throw delete f.validate,X}finally{if(f.compiling=!1,f.meta)this._opts=W}return f.validate=J,f.refs=J.refs,f.refVal=J.refVal,f.root=J.root,J;function Q(){var X=f.validate,Y=X.apply(this,arguments);return Q.errors=X.errors,Y}}function ZY(f){switch(f.schemaId){case"auto":return xY;case"id":return CY;default:return TY}}function CY(f){if(f.$id)this.logger.warn("schema $id ignored",f.$id);return f.id}function TY(f){if(f.id)this.logger.warn("schema id ignored",f.id);return f.$id}function xY(f){if(f.$id&&f.id&&f.$id!=f.id)throw new Error("schema $id is different from id");return f.$id||f.id}function uY(f,v){if(f=f||this.errors,!f)return"No errors";v=v||{};var W=v.separator===void 0?", ":v.separator,J=v.dataVar===void 0?"data":v.dataVar,Q="";for(var X=0;X<f.length;X++){var Y=f[X];if(Y)Q+=J+Y.dataPath+" "+Y.message+W}return Q.slice(0,-W.length)}function mY(f,v){if(typeof v=="string")v=new RegExp(v);return this._formats[f]=v,this}function rY(f){var v;if(f._opts.$data)v=E9(),f.addMetaSchema(v,v.$id,!0);if(f._opts.meta===!1)return;var W=EQ();if(f._opts.$data)W=F9(W,FY);f.addMetaSchema(W,j0,!0),f._refs["http://json-schema.org/schema"]=j0}function aY(f){var v=f._opts.schemas;if(!v)return;if(Array.isArray(v))f.addSchema(v);else for(var W in v)f.addSchema(v[W],W)}function cY(f){for(var v in f._opts.formats){var W=f._opts.formats[v];f.addFormat(v,W)}}function nY(f){for(var v in f._opts.keywords){var W=f._opts.keywords[v];f.addKeyword(v,W)}}function h9(f,v){if(f._schemas[v]||f._refs[v])throw new Error('schema with key or id "'+v+'" already exists')}function pY(f){var v=A9.copy(f._opts);for(var W=0;W<O9.length;W++)delete v[O9[W]];return v}function iY(f){var v=f._opts.logger;if(v===!1)f.logger={log:UQ,warn:UQ,error:UQ};else{if(v===void 0)v=console;if(!(typeof v=="object"&&v.log&&v.warn&&v.error))throw new Error("logger must implement log, warn and error methods");f.logger=v}}function UQ(){}});var P7=(f)=>{let{idPattern:v,entityName:W}=f,J=(B)=>{return v.test(B)};return Object.freeze({isId:J,validateId:(B)=>{return J(B)},resolve:(B)=>{if(J(B))return{kind:"id",value:B};return{kind:"path",value:B}},getPattern:()=>{return v},getEntityName:()=>{return W}})},K7,yQ;var MJ=Ef(()=>{K7=Object.freeze({create:P7}),yQ=K7});var h0,b0,lQ=(f)=>{if(h0.isId(f))return"project";if(b0.isId(f))return"shared";return},z7=(f)=>{return h0.isId(f)||b0.isId(f)},NJ=(f)=>{return f==="project"?h0:b0},$7=(f,v)=>{return NJ(v).validateId(f)},L7,xv;var K1=Ef(()=>{MJ();h0=yQ.create({idPattern:/^doc\d{3,}$/,entityName:"project-doc"}),b0=yQ.create({idPattern:/^sdoc\d{3,}$/,entityName:"shared-doc"}),L7=Object.freeze({project:h0,shared:b0,detectScopeFromId:lQ,isdocId:z7,getResolverForScope:NJ,validateIdForScope:$7}),xv=L7});import{resolve as HJ,relative as AJ,normalize as A7,isAbsolute as gJ}from"path";import{realpath as FJ,lstat as g7}from"fs/promises";var Wf=(f,v,W)=>{let J=new Error(v);return J.name=f,J.code=f,J.details=W,J},_J=(f)=>{if(!f)throw Wf("VALIDATION_ERROR","Empty path");if(gJ(f))throw Wf("VALIDATION_ERROR","Absolute path not allowed",{path:f});let v=A7(f).replaceAll("\\","/");if(v.split("/").some((J)=>J===".."))throw Wf("BOUNDARY_VIOLATION","Path contains ..",{path:f});return v},IQ=(f,v)=>{let W=AJ(f,v);return W!==""&&!W.startsWith("..")&&!gJ(W)},_7=async(f,v,W)=>{let J=_J(v),Q=HJ(f),X=HJ(Q,J);if(W?.followSymlinks)try{X=await FJ(X)}catch(w){if(w.code!=="ENOENT")throw w}else try{if((await g7(X)).isSymbolicLink()){let B=await FJ(X);if(!IQ(Q,B))throw Wf("BOUNDARY_VIOLATION",`Symlink target escapes boundary: '${v}' \u2192 '${B}'`,{path:v,resolved:X,target:B})}}catch(w){if(w.code!=="ENOENT"&&w.code!=="BOUNDARY_VIOLATION")throw w;if(w.code==="BOUNDARY_VIOLATION")throw w}if(!IQ(Q,X)&&X!==Q)throw Wf("BOUNDARY_VIOLATION",`Path escapes boundary: '${v}' \u2192 '${X}'`,{path:v,resolved:X,boundary:Q});let Y=AJ(Q,X).replaceAll("\\","/");return{abs:X,rel:Y}},h7=(f,v)=>{let W=f.code,J=v?.path?v.resolved?`'${v.path}' \u2192 '${v.resolved}'`:`'${v.path}'`:"";switch(W){case"ENOENT":return Wf("NOT_FOUND",`File or directory not found${J?`: ${J}`:""}`,{...v,originalCode:W});case"ENOTEMPTY":return Wf("DIRECTORY_NOT_EMPTY",`Directory not empty${J?`: ${J}`:""}`,{...v,originalCode:W});case"ENOTDIR":case"EISDIR":return Wf("VALIDATION_ERROR",`Invalid path type${J?`: ${J}`:""}`,{...v,originalCode:W,reason:W==="ENOTDIR"?"not a directory":"is a directory"});case"EACCES":case"EPERM":return Wf("FS_ERROR",`Permission denied${J?`: ${J}`:""}`,{...v,originalCode:W});case"EBUSY":return Wf("FS_ERROR",`Resource busy or locked${J?`: ${J}`:""}`,{...v,originalCode:W});default:if(v)f.context=v;return f}},b7,fv;var ZQ=Ef(()=>{b7=Object.freeze({fsError:Wf,validateRelative:_J,insideBoundary:IQ,resolveWithinBoundary:_7,mapOsError:h7}),fv=b7});import{readFile as R7,writeFile as k7,unlink as hJ,stat as CQ,rename as S7,access as y7,mkdir as l7}from"fs/promises";import{constants as I7}from"fs";import{createHash as bJ}from"crypto";import{resolve as Z7,dirname as TQ,isAbsolute as C7}from"path";var T7=(f)=>{let{boundaryDir:v}=f;if(!v)throw fv.fsError("VALIDATION_ERROR","boundaryDir is required (empty string)",{boundaryDir:v});if(!C7(v))throw fv.fsError("VALIDATION_ERROR",`boundaryDir must be an absolute path: '${v}'`,{boundaryDir:v});let W=Z7(v),J=async(N)=>{let{abs:$}=await fv.resolveWithinBoundary(W,N);return $},Q=(N,$,O=!1)=>{if(O&&N==="")return;if(!/^[a-f0-9]{64}$/.test(N)){let h=O?"empty string or 64-character lowercase hex SHA-256 hash":"64-character lowercase hex SHA-256 hash";throw fv.fsError("VALIDATION_ERROR",`Invalid ${$}: must be a ${h}`,{[$]:N})}},X=(N)=>{return bJ("sha256").update(N,"utf-8").digest("hex")},Y=(N)=>{return bJ("sha256").update(N).digest("hex")},w=async(N)=>{let $=await J(N);try{return await y7($,I7.F_OK),!0}catch{return!1}},B=async(N)=>{let $=await J(N);try{return await CQ($)}catch(O){throw fv.mapOsError(O,{path:N,resolved:$,operation:"stat"})}},z=async(N)=>{let $=await J(N),O;try{O=await CQ($)}catch(h){throw fv.mapOsError(h,{path:N,resolved:$,operation:"stat"})}if(!O.isFile())throw fv.fsError("VALIDATION_ERROR","Target is not a regular file",{path:N,resolved:$});try{let h=await R7($,"utf-8"),H=X(h);return{content:h,hash:H}}catch(h){throw fv.mapOsError(h,{path:N,resolved:$,operation:"readFile"})}},K=async(N,$,O)=>{Q($,"baseHash",!0);let h=await J(N),H=X(O),k;try{k=(await z(N)).hash}catch(T){if(T.code==="NOT_FOUND"){if($!=="")throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}' for new file, got '' (file does not exist)`,{path:N,expected:$,actual:""});let E;try{E=await CQ(h)}catch(g){if(g.code==="ENOENT")E=null;else throw fv.mapOsError(g,{path:N,resolved:h,operation:"stat"})}if(E&&!E.isFile())throw fv.fsError("VALIDATION_ERROR","Target path exists and is not a regular file",{path:N,resolved:h});try{await l7(TQ(h),{recursive:!0})}catch(g){throw fv.mapOsError(g,{path:TQ(N),resolved:TQ(h),operation:"mkdir"})}k=""}else throw T}if(k!==$)throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}', got '${k}'`,{path:N,expected:$,actual:k});if(H===$)return{newHash:$};let l=`${h}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{await k7(l,O,{encoding:"utf-8",mode:384}),await S7(l,h)}catch(T){try{await hJ(l)}catch{}throw fv.mapOsError(T,{path:N,resolved:h,operation:"writeTextAtomicIfUnchanged"})}return{newHash:H}},L=async(N,$)=>{Q($,"expectedHash",!1);let O=await J(N),h;try{h=(await z(N)).hash}catch(H){if(H.code==="NOT_FOUND")return{deleted:!1};throw H}if(h!==$)throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}', got '${h}'`,{path:N,expected:$,actual:h});try{return await hJ(O),{deleted:!0}}catch(H){throw fv.mapOsError(H,{path:N,resolved:O,operation:"deleteIfUnchanged"})}},V=(N,$,O)=>{for(let k=0;k<$.length;k++){let{oldText:l}=$[k];if(l.length===0)throw fv.fsError("VALIDATION_ERROR",`Empty oldText in replacement at index ${k} would cause infinite loop`,{index:k})}let h=N,H=0;for(let{oldText:k,newText:l}of $)if(h.includes(k))h=h.replace(k,l),H++;if(O?.requireAll&&H!==$.length)throw fv.fsError("VALIDATION_ERROR",`Only ${H} of ${$.length} replacements were applied (requireAll=true)`,{applied:H,total:$.length});return{wouldContent:h,wouldHash:X(h),applied:H}};return Object.freeze({exists:w,stat:B,readText:z,computeHashForText:X,computeHashForBytes:Y,resolveSafe:async(N)=>{return fv.resolveWithinBoundary(W,N)},writeTextAtomicIfUnchanged:K,deleteIfUnchanged:L,previewReplaceFirst:V,applyReplaceFirstIfUnchanged:async(N,$,O,h)=>{Q($,"expectedHash",!1);let{content:H,hash:k}=await z(N);if(k!==$)throw fv.fsError("HASH_MISMATCH",`Hash mismatch: expected '${$}', got '${k}'`,{path:N,expected:$,actual:k});let{wouldContent:l,wouldHash:T,applied:E}=V(H,O,h);if(E===0)return{newHash:k,applied:0};return await K(N,k,l),{newHash:T,applied:E}}})},x7,xQ;var RJ=Ef(()=>{ZQ();x7=Object.freeze({create:T7}),xQ=x7});import{mkdir as u7,rm as m7,rmdir as r7,stat as kJ,readdir as a7}from"fs/promises";import{resolve as SJ,dirname as c7,isAbsolute as yJ}from"path";var n7=(f)=>{let{boundaryDir:v}=f;if(!v)throw fv.fsError("VALIDATION_ERROR","boundaryDir is required (empty string)",{boundaryDir:v});if(!yJ(v))throw fv.fsError("VALIDATION_ERROR",`boundaryDir must be an absolute path: '${v}'`,{boundaryDir:v});let W=SJ(v),J=(K)=>{let L=K.toLowerCase().replace(/[^a-z0-9-_]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if(!L)throw fv.fsError("VALIDATION_ERROR",`normalizeName produced empty result from input: '${K}'`,{name:K,normalized:L});return L},Q=async(K,L)=>{return await fv.resolveWithinBoundary(W,K,L)};return Object.freeze({normalizeName:J,resolve:Q,isInsideBoundary:(K)=>{if(!yJ(K))throw fv.fsError("VALIDATION_ERROR",`targetAbs must be an absolute path: '${K}'`,{targetAbs:K});let L=SJ(K);return fv.insideBoundary(W,L)},ensureDir:async(K)=>{let{abs:L}=await Q(K);try{await u7(L,{recursive:!0})}catch(V){throw fv.mapOsError(V,{path:K,resolved:L,operation:"ensureDir"})}},parentDir:(K)=>{let L=fv.validateRelative(K),V=c7(L);return V==="."?V:V.replaceAll("\\","/")},stat:async(K)=>{let{abs:L}=await Q(K);try{return await kJ(L)}catch(V){throw fv.mapOsError(V,{path:K,resolved:L,operation:"stat"})}},deleteDir:async(K,L)=>{if(L?.requireEmpty&&L?.recursive)throw fv.fsError("VALIDATION_ERROR","requireEmpty and recursive are mutually exclusive",{path:K});let{abs:V}=await Q(K);if(V===W)throw fv.fsError("VALIDATION_ERROR",`Cannot delete boundary root: '${K}' \u2192 '${V}'`,{path:K,resolved:V,boundary:W});let q;try{q=await kJ(V)}catch(M){if(M.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};throw fv.mapOsError(M,{path:K,resolved:V,operation:"stat"})}if(!q.isDirectory())return{deleted:!1,reason:"NOT_DIR"};if(L?.requireEmpty){let M;try{M=await a7(V)}catch(N){throw fv.mapOsError(N,{path:K,resolved:V,operation:"readdir"})}if(M.length>0)throw fv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty: '${K}' \u2192 '${V}'`,{path:K,resolved:V});try{return await r7(V),{deleted:!0}}catch(N){if(N.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};if(N.code==="ENOTEMPTY")throw fv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty (race condition): '${K}' \u2192 '${V}'`,{path:K,resolved:V});throw fv.mapOsError(N,{path:K,resolved:V,operation:"rmdir"})}}try{return await m7(V,{recursive:L?.recursive??!1}),{deleted:!0}}catch(M){if(M.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};if(M.code==="ENOTEMPTY"||M.code==="EISDIR"||M.code==="EACCES")throw fv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty: '${K}' \u2192 '${V}'`,{path:K,resolved:V,originalCode:M.code});throw fv.mapOsError(M,{path:K,resolved:V,operation:"deleteDir"})}}})},p7,uQ;var lJ=Ef(()=>{ZQ();p7=Object.freeze({create:n7}),uQ=p7});import{dirname as i7}from"path";var IJ="---",Av=(f,v,W)=>{let J=new Error(v);if(J.code=f,W!==void 0)J.data=W;throw J},d7=(f)=>{let{fileServiceByScope:v,folderServiceByScope:W,indexFilename:J}=f,Q=(E)=>{if(E==="project")return v.project;if(E==="shared")return v.shared;return Av("INVALID_SCOPE",`Unknown scope '${E}'`,{scope:E})},X=(E)=>{if(E==="project")return W.project;if(E==="shared")return W.shared;return Av("INVALID_SCOPE",`Unknown scope '${E}'`,{scope:E})},Y=async(E)=>{if(E.scope)return{scope:E.scope};if(E.kind==="id"){let U=lQ(E.id);if(!U)Av("INVALID_ID_FORMAT",`Invalid doc ID format: '${E.id}'. Expected docNNN or sdocNNN`,{id:E.id});return{scope:U}}if(E.kind==="path"){try{let U=await B("project");if(Object.entries(U.index).find(([I,S])=>S===E.path))return{scope:"project"}}catch{}try{let U=await B("shared");if(Object.entries(U.index).find(([I,S])=>S===E.path))return{scope:"shared",fallback:!0}}catch{}return{scope:"project"}}let g=E;return Av("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(g)}`)},w=(E)=>{return J},B=async(E)=>{let g=w(E),U=Q(E);try{let{content:b,hash:I}=await U.readText(g);return{index:JSON.parse(b),hash:I}}catch(b){if(b.code==="NOT_FOUND")return{index:{},hash:""};throw b}},z=async(E,g,U)=>{let b=w(E),I=Q(E),S=JSON.stringify(g,null,2);try{let{newHash:_}=await I.writeTextAtomicIfUnchanged(b,U,S);return{hash:_}}catch(_){if(_.code==="HASH_MISMATCH"){let{index:R,hash:y}=await B(E),m={...R,...g},a=JSON.stringify(m,null,2),{newHash:i}=await I.writeTextAtomicIfUnchanged(b,y,a);return{hash:i}}throw _}},K=(E)=>{let g=E.split(`
3
- `);if(g.length<3||g[0].trim()!==IJ)return{bodyContent:E};let U=-1;for(let y=1;y<g.length;y++)if(g[y].trim()===IJ){U=y;break}if(U===-1)return{bodyContent:E};let b=g.slice(1,U),I=g.slice(0,U+1).join(`
4
- `),S=g.slice(U+1).join(`
5
- `).trim(),_=(y)=>{if(y.startsWith('"')&&y.endsWith('"')||y.startsWith("'")&&y.endsWith("'"))return y.slice(1,-1);return y},R={};for(let y of b){let m=y.indexOf(":");if(m===-1)continue;let a=y.slice(0,m).trim(),i=y.slice(m+1).trim();R[a]=_(i)}return{rawFrontMatter:I,frontMatter:Object.keys(R).length>0?R:void 0,bodyContent:S}},L=(E,g)=>{switch(g.op){case"replaceOnce":{let{oldText:U,newText:b}=g;if(!E.includes(U))return{newContent:E,applied:!1};return{newContent:E.replace(U,b),applied:!0}}case"replaceAll":{let{oldText:U,newText:b}=g;if(!E.includes(U))return{newContent:E,applied:!1};let I=new RegExp(U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");return{newContent:E.replace(I,b),applied:!0}}case"replaceRegex":{let{pattern:U,flags:b,replacement:I}=g,S=new RegExp(U,b);if(!S.test(E))return{newContent:E,applied:!1};return{newContent:E.replace(S,I),applied:!0}}case"replaceAllContent":{let{content:U}=g;return{newContent:U,applied:!0}}default:{let U=g;return Av("VALIDATION_ERROR",`Unknown edit operation: ${JSON.stringify(U)}`)}}},V=(E)=>{return xv.isdocId(E)},q=(E)=>{if(!E||E.trim().length===0)return{valid:!1,reason:"Path cannot be empty"};if(E.startsWith("/"))return{valid:!1,reason:"Path must be relative (no leading slash)"};if(E.includes(".."))return{valid:!1,reason:'Path cannot contain ".." segments'};let U=E.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");if(/[<>:"|?*\0]/.test(U))return{valid:!1,reason:"Path contains invalid characters"};return{valid:!0,normalized:U}},M=(E)=>{let{scope:g,path:U}=E;if(g!=="project"&&g!=="shared")Av("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${g}'`,{scope:g});let b=q(U);if(!b.valid)Av("INVALID_PATH_FORMAT",b.reason,{path:U});return{scope:g,path:b.normalized}},N=async(E)=>{let{scope:g}=await Y(E),U=X(g),b;if(E.kind==="path")b=M({...E,scope:g}).path;else{let{id:S}=E;if(!V(S))Av("INVALID_ID_FORMAT",`ID must match pattern doc\\d{3,} or sdoc\\d{3,}, got '${S}'`,{id:S});let{index:_}=await B(g);if(!_[S])Av("doc_NOT_FOUND",`No doc with ID '${S}' in scope '${g}'`,{id:S,scope:g});b=_[S]}return{...await U.resolve(b),scope:g}},$=async(E)=>{if(E!=="project"&&E!=="shared")Av("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${E}'`,{scope:E});let{index:g}=await B(E),U=E==="project"?"doc":"sdoc",b=new RegExp(`^${U}(\\d{3,})$`),I=0;for(let R of Object.keys(g)){let y=R.match(b);if(y){let m=parseInt(y[1],10);if(m>I)I=m}}let S=I+1;return`${U}${S.toString().padStart(3,"0")}`},O=async(E)=>{let{address:g,content:U}=E;if(g.kind!=="path")Av("VALIDATION_ERROR","Create requires path-based addressing");let b=g.scope??"project",I=M({...g,scope:b}),{path:S}=I;if(xv.isdocId(S))Av("INVALID_PATH_FORMAT",`Cannot create doc with path '${S}' - matches ID pattern`,{path:S,scope:b});let _=Q(b),R=X(b),y=await $(b);if(await _.exists(S))Av("doc_ALREADY_EXISTS",`doc already exists at path '${S}'`,{path:S,scope:b});let a=i7(S);if(a!==".")await R.ensureDir(a);let{newHash:i}=await _.writeTextAtomicIfUnchanged(S,"",U),{index:p,hash:n}=await B(b);return p[y]=S,await z(b,p,n),{id:y,hash:i,path:S}},h=async(E)=>{let{rel:g,scope:U}=await N(E),b=Q(U),{content:I,hash:S}=await b.readText(g),{frontMatter:_,bodyContent:R,rawFrontMatter:y}=K(I),m,a;if(E.kind==="path"){m=M({...E,scope:U}).path;let{index:p}=await B(U),n=Object.keys(p).find(($v)=>p[$v]===m);if(!n)return Av("doc_NOT_FOUND",`doc exists but not in index: '${m}'`,{path:m,scope:U});a=n}else if(E.kind==="id"){a=E.id;let{index:i}=await B(U),p=i[a];if(!p)return Av("doc_NOT_FOUND",`No doc with ID '${a}'`,{id:a,scope:U});m=p}else{let i=E;return Av("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(i)}`)}return{address:E,content:I,hash:S,frontMatter:_,bodyContent:R,path:m,id:a}},H=async(E,g,U)=>{let{rel:b,scope:I}=await N(E),S=Q(I),{content:_,hash:R}=await S.readText(b);if(R!==g)Av("HASH_MISMATCH",`Expected hash '${g}', got '${R}'`,{expected:g,actual:R});let y=_,m=0;for(let i of U){let{newContent:p,applied:n}=L(y,i);if(y=p,n)m++}if(m===0)return{newHash:R,applied:0};let{newHash:a}=await S.writeTextAtomicIfUnchanged(b,R,y);return{newHash:a,applied:m}},k=async(E,g)=>{let{rel:U,scope:b}=await N(E),I=await(async()=>{if(E.kind==="id")return E.id;else if(E.kind==="path"){let a=M({...E,scope:b}),{index:i}=await B(b),p=Object.keys(i).find((n)=>i[n]===a.path);if(!p)return Av("doc_NOT_FOUND",`doc not in index: '${a.path}'`,{path:a.path,scope:b});return p}else{let m=E;return Av("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(m)}`)}})(),S=Q(b),_=!1;try{_=(await S.deleteIfUnchanged(U,g)).deleted}catch(m){if(m.code==="NOT_FOUND")_=!1;else throw m}let{index:R,hash:y}=await B(b);if(R[I])delete R[I],await z(b,R,y);return{deleted:_}},l=async(E)=>{let{scope:g,pathPrefix:U,includeContent:b=!1}=E;if(g){if(g!=="project"&&g!=="shared")Av("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${g}'`,{scope:g});return await T(g,U,b)}let I=await T("project",U,b),S=await T("shared",U,b),_=new Set(I.map((m)=>m.path)),R=new Set(S.map((m)=>m.path));for(let m of I)if(R.has(m.path))m.override="overrides";for(let m of S)if(_.has(m.path))m.override="overridden";let y=[...I,...S];return y.sort((m,a)=>m.path.localeCompare(a.path)),y},T=async(E,g,U=!1)=>{let b=Q(E),I;try{I=(await B(E)).index}catch(_){if(_.code==="NOT_FOUND"||_.code==="ENOENT")return[];throw _}let S=[];for(let[_,R]of Object.entries(I)){if(g&&!R.startsWith(g))continue;try{if(U){let{content:y,hash:m}=await b.readText(R),a=await b.stat(R),{frontMatter:i}=K(y);S.push({scope:E,id:_,path:R,synopsis:i?.synopsis,hash:m,modifiedAt:a.mtime})}else{let y=await b.stat(R);S.push({scope:E,id:_,path:R,modifiedAt:y.mtime})}}catch{continue}}return S.sort((_,R)=>_.path.localeCompare(R.path)),S};return Object.freeze({create:O,read:h,editLatest:H,deleteLatest:k,list:l})},o7,ZJ;var CJ=Ef(()=>{K1();o7=Object.freeze({create:d7}),ZJ=o7});import{resolve as R0,dirname as s7}from"path";import{homedir as t7}from"os";import{existsSync as e7}from"fs";var v2=(f=process.cwd())=>{let v=R0(f),W=R0("/"),J=R0(t7(),".swic");while(v!==W){let Q=R0(v,".swic");if(Q===J)throw new Error("Not in a project directory (found ~/.swic instead). Run swic from within a project.");if(e7(Q))return Q;v=s7(v)}throw new Error("Could not find .swic directory. Are you in a SWIC project?")},TJ;var xJ=Ef(()=>{TJ=Object.freeze({findProjectRoot:v2})});var rJ={};v8(rJ,{default:()=>w2});import{mkdirSync as uJ}from"fs";import{resolve as mJ}from"path";import{homedir as f2}from"os";var k0="docs",Q2=".index.json",W2=(f,v)=>{try{uJ(f,{recursive:!0}),uJ(v,{recursive:!0})}catch(W){let J=W instanceof Error?W.message:String(W);throw new Error(`Failed to create swic directories. Please check permissions.
2
+ var P6=Object.create;var{getPrototypeOf:H6,defineProperty:Z0,getOwnPropertyNames:K6}=Object;var z6=Object.prototype.hasOwnProperty;var L6=(f,v,W)=>{W=f!=null?P6(H6(f)):{};let J=v||!f||!f.__esModule?Z0(W,"default",{value:f,enumerable:!0}):W;for(let Q of K6(f))if(!z6.call(J,Q))Z0(J,Q,{get:()=>f[Q],enumerable:!0});return J};var o=(f,v)=>()=>(v||f((v={exports:{}}).exports,v),v.exports);var v8=(f,v)=>{for(var W in v)Z0(f,W,{get:v[W],enumerable:!0,configurable:!0,set:(J)=>v[W]=()=>J})};var Df=(f,v)=>()=>(f&&(v=f(f=0)),v);var k8=o((J0,R8)=>{(function(f,v){typeof J0==="object"&&typeof R8!=="undefined"?v(J0):typeof define==="function"&&define.amd?define(["exports"],v):v(f.URI=f.URI||{})})(J0,function(f){function v(){for(var N=arguments.length,P=Array(N),E=0;E<N;E++)P[E]=arguments[E];if(P.length>1){P[0]=P[0].slice(0,-1);var U=P.length-1;for(var h=1;h<U;++h)P[h]=P[h].slice(1,-1);return P[U]=P[U].slice(1),P.join("")}else return P[0]}function W(N){return"(?:"+N+")"}function J(N){return N===void 0?"undefined":N===null?"null":Object.prototype.toString.call(N).split(" ").pop().split("]").shift().toLowerCase()}function Q(N){return N.toUpperCase()}function X(N){return N!==void 0&&N!==null?N instanceof Array?N:typeof N.length!=="number"||N.split||N.setInterval||N.call?[N]:Array.prototype.slice.call(N):[]}function Y(N,P){var E=N;if(P)for(var U in P)E[U]=P[U];return E}function w(N){var P="[A-Za-z]",E="[\\x0D]",U="[0-9]",h="[\\x22]",r=v(U,"[A-Fa-f]"),e="[\\x0A]",Xv="[\\x20]",Bv=W(W("%[EFef]"+r+"%"+r+r+"%"+r+r)+"|"+W("%[89A-Fa-f]"+r+"%"+r+r)+"|"+W("%"+r+r)),Uv="[\\:\\/\\?\\#\\[\\]\\@]",Jv="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",$v=v(Uv,Jv),hv=N?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",zv=N?"[\\uE000-\\uF8FF]":"[]",wv=v(P,U,"[\\-\\.\\_\\~]",hv),Mv=W(P+v(P,U,"[\\+\\-\\.]")+"*"),qv=W(W(Bv+"|"+v(wv,Jv,"[\\:]"))+"*"),Sf=W(W("25[0-5]")+"|"+W("2[0-4]"+U)+"|"+W("1"+U+U)+"|"+W("[1-9]"+U)+"|"+U),rv=W(W("25[0-5]")+"|"+W("2[0-4]"+U)+"|"+W("1"+U+U)+"|"+W("0?[1-9]"+U)+"|0?0?"+U),cv=W(rv+"\\."+rv+"\\."+rv+"\\."+rv),Pv=W(r+"{1,4}"),mv=W(W(Pv+"\\:"+Pv)+"|"+cv),nv=W(W(Pv+"\\:")+"{6}"+mv),Yf=W("\\:\\:"+W(Pv+"\\:")+"{5}"+mv),yf=W(W(Pv)+"?\\:\\:"+W(Pv+"\\:")+"{4}"+mv),Kf=W(W(W(Pv+"\\:")+"{0,1}"+Pv)+"?\\:\\:"+W(Pv+"\\:")+"{3}"+mv),L1=W(W(W(Pv+"\\:")+"{0,2}"+Pv)+"?\\:\\:"+W(Pv+"\\:")+"{2}"+mv),l1=W(W(W(Pv+"\\:")+"{0,3}"+Pv)+"?\\:\\:"+Pv+"\\:"+mv),I1=W(W(W(Pv+"\\:")+"{0,4}"+Pv)+"?\\:\\:"+mv),af=W(W(W(Pv+"\\:")+"{0,5}"+Pv)+"?\\:\\:"+Pv),cf=W(W(W(Pv+"\\:")+"{0,6}"+Pv)+"?\\:\\:"),zf=W([nv,Yf,yf,Kf,L1,l1,I1,af,cf].join("|")),nf=W(W(wv+"|"+Bv)+"+"),l0=W(zf+"\\%25"+nf),lf=W(zf+W("\\%25|\\%(?!"+r+"{2})")+nf),J6=W("[vV]"+r+"+\\."+v(wv,Jv,"[\\:]")+"+"),X6=W("\\["+W(lf+"|"+zf+"|"+J6)+"\\]"),oQ=W(W(Bv+"|"+v(wv,Jv))+"*"),$1=W(X6+"|"+cv+"(?!"+oQ+")|"+oQ),M1=W(U+"*"),sQ=W(W(qv+"@")+"?"+$1+W("\\:"+M1)+"?"),N1=W(Bv+"|"+v(wv,Jv,"[\\:\\@]")),Y6=W(N1+"*"),tQ=W(N1+"+"),w6=W(W(Bv+"|"+v(wv,Jv,"[\\@]"))+"+"),Lf=W(W("\\/"+Y6)+"*"),pf=W("\\/"+W(tQ+Lf)+"?"),I0=W(w6+Lf),Z1=W(tQ+Lf),df="(?!"+N1+")",P2=W(Lf+"|"+pf+"|"+I0+"|"+Z1+"|"+df),of=W(W(N1+"|"+v("[\\/\\?]",zv))+"*"),V1=W(W(N1+"|[\\/\\?]")+"*"),eQ=W(W("\\/\\/"+sQ+Lf)+"|"+pf+"|"+Z1+"|"+df),G6=W(Mv+"\\:"+eQ+W("\\?"+of)+"?"+W("\\#"+V1)+"?"),B6=W(W("\\/\\/"+sQ+Lf)+"|"+pf+"|"+I0+"|"+df),q6=W(B6+W("\\?"+of)+"?"+W("\\#"+V1)+"?"),H2=W(G6+"|"+q6),K2=W(Mv+"\\:"+eQ+W("\\?"+of)+"?"),z2="^("+Mv+")\\:"+W(W("\\/\\/("+W("("+qv+")@")+"?("+$1+")"+W("\\:("+M1+")")+"?)")+"?("+Lf+"|"+pf+"|"+Z1+"|"+df+")")+W("\\?("+of+")")+"?"+W("\\#("+V1+")")+"?$",L2="^(){0}"+W(W("\\/\\/("+W("("+qv+")@")+"?("+$1+")"+W("\\:("+M1+")")+"?)")+"?("+Lf+"|"+pf+"|"+I0+"|"+df+")")+W("\\?("+of+")")+"?"+W("\\#("+V1+")")+"?$",$2="^("+Mv+")\\:"+W(W("\\/\\/("+W("("+qv+")@")+"?("+$1+")"+W("\\:("+M1+")")+"?)")+"?("+Lf+"|"+pf+"|"+Z1+"|"+df+")")+W("\\?("+of+")")+"?$",M2="^"+W("\\#("+V1+")")+"?$",N2="^"+W("("+qv+")@")+"?("+$1+")"+W("\\:("+M1+")")+"?$";return{NOT_SCHEME:new RegExp(v("[^]",P,U,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(v("[^\\%\\:]",wv,Jv),"g"),NOT_HOST:new RegExp(v("[^\\%\\[\\]\\:]",wv,Jv),"g"),NOT_PATH:new RegExp(v("[^\\%\\/\\:\\@]",wv,Jv),"g"),NOT_PATH_NOSCHEME:new RegExp(v("[^\\%\\/\\@]",wv,Jv),"g"),NOT_QUERY:new RegExp(v("[^\\%]",wv,Jv,"[\\:\\@\\/\\?]",zv),"g"),NOT_FRAGMENT:new RegExp(v("[^\\%]",wv,Jv,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(v("[^]",wv,Jv),"g"),UNRESERVED:new RegExp(wv,"g"),OTHER_CHARS:new RegExp(v("[^\\%]",wv,$v),"g"),PCT_ENCODED:new RegExp(Bv,"g"),IPV4ADDRESS:new RegExp("^("+cv+")$"),IPV6ADDRESS:new RegExp("^\\[?("+zf+")"+W(W("\\%25|\\%(?!"+r+"{2})")+"("+nf+")")+"?\\]?$")}}var B=w(!1),z=w(!0),H=function(){function N(P,E){var U=[],h=!0,r=!1,e=void 0;try{for(var Xv=P[Symbol.iterator](),Bv;!(h=(Bv=Xv.next()).done);h=!0)if(U.push(Bv.value),E&&U.length===E)break}catch(Uv){r=!0,e=Uv}finally{try{if(!h&&Xv.return)Xv.return()}finally{if(r)throw e}}return U}return function(P,E){if(Array.isArray(P))return P;else if(Symbol.iterator in Object(P))return N(P,E);else throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),$=function(N){if(Array.isArray(N)){for(var P=0,E=Array(N.length);P<N.length;P++)E[P]=N[P];return E}else return Array.from(N)},K=2147483647,q=36,L=1,V=26,M=38,D=700,y=72,F=128,Z="-",C=/^xn--/,T=/[^\0-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,A={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},j=q-L,_=Math.floor,l=String.fromCharCode;function R(N){throw new RangeError(A[N])}function g(N,P){var E=[],U=N.length;while(U--)E[U]=P(N[U]);return E}function b(N,P){var E=N.split("@"),U="";if(E.length>1)U=E[0]+"@",N=E[1];N=N.replace(O,".");var h=N.split("."),r=g(h,P).join(".");return U+r}function k(N){var P=[],E=0,U=N.length;while(E<U){var h=N.charCodeAt(E++);if(h>=55296&&h<=56319&&E<U){var r=N.charCodeAt(E++);if((r&64512)==56320)P.push(((h&1023)<<10)+(r&1023)+65536);else P.push(h),E--}else P.push(h)}return P}var m=function N(P){return String.fromCodePoint.apply(String,$(P))},c=function N(P){if(P-48<10)return P-22;if(P-65<26)return P-65;if(P-97<26)return P-97;return q},d=function N(P,E){return P+22+75*(P<26)-((E!=0)<<5)},s=function N(P,E,U){var h=0;P=U?_(P/D):P>>1,P+=_(P/E);for(;P>j*V>>1;h+=q)P=_(P/j);return _(h+(j+1)*P/(P+M))},n=function N(P){var E=[],U=P.length,h=0,r=F,e=y,Xv=P.lastIndexOf(Z);if(Xv<0)Xv=0;for(var Bv=0;Bv<Xv;++Bv){if(P.charCodeAt(Bv)>=128)R("not-basic");E.push(P.charCodeAt(Bv))}for(var Uv=Xv>0?Xv+1:0;Uv<U;){var Jv=h;for(var $v=1,hv=q;;hv+=q){if(Uv>=U)R("invalid-input");var zv=c(P.charCodeAt(Uv++));if(zv>=q||zv>_((K-h)/$v))R("overflow");h+=zv*$v;var wv=hv<=e?L:hv>=e+V?V:hv-e;if(zv<wv)break;var Mv=q-wv;if($v>_(K/Mv))R("overflow");$v*=Mv}var qv=E.length+1;if(e=s(h-Jv,qv,Jv==0),_(h/qv)>K-r)R("overflow");r+=_(h/qv),h%=qv,E.splice(h++,0,r)}return String.fromCodePoint.apply(String,E)},Vv=function N(P){var E=[];P=k(P);var U=P.length,h=F,r=0,e=y,Xv=!0,Bv=!1,Uv=void 0;try{for(var Jv=P[Symbol.iterator](),$v;!(Xv=($v=Jv.next()).done);Xv=!0){var hv=$v.value;if(hv<128)E.push(l(hv))}}catch(lf){Bv=!0,Uv=lf}finally{try{if(!Xv&&Jv.return)Jv.return()}finally{if(Bv)throw Uv}}var zv=E.length,wv=zv;if(zv)E.push(Z);while(wv<U){var Mv=K,qv=!0,Sf=!1,rv=void 0;try{for(var cv=P[Symbol.iterator](),Pv;!(qv=(Pv=cv.next()).done);qv=!0){var mv=Pv.value;if(mv>=h&&mv<Mv)Mv=mv}}catch(lf){Sf=!0,rv=lf}finally{try{if(!qv&&cv.return)cv.return()}finally{if(Sf)throw rv}}var nv=wv+1;if(Mv-h>_((K-r)/nv))R("overflow");r+=(Mv-h)*nv,h=Mv;var Yf=!0,yf=!1,Kf=void 0;try{for(var L1=P[Symbol.iterator](),l1;!(Yf=(l1=L1.next()).done);Yf=!0){var I1=l1.value;if(I1<h&&++r>K)R("overflow");if(I1==h){var af=r;for(var cf=q;;cf+=q){var zf=cf<=e?L:cf>=e+V?V:cf-e;if(af<zf)break;var nf=af-zf,l0=q-zf;E.push(l(d(zf+nf%l0,0))),af=_(nf/l0)}E.push(l(d(af,0))),e=s(r,nv,wv==zv),r=0,++wv}}}catch(lf){yf=!0,Kf=lf}finally{try{if(!Yf&&L1.return)L1.return()}finally{if(yf)throw Kf}}++r,++h}return E.join("")},_v=function N(P){return b(P,function(E){return C.test(E)?n(E.slice(4).toLowerCase()):E})},Sv=function N(P){return b(P,function(E){return T.test(E)?"xn--"+Vv(E):E})},Yv={version:"2.1.0",ucs2:{decode:k,encode:m},decode:n,encode:Vv,toASCII:Sv,toUnicode:_v},jv={};function gv(N){var P=N.charCodeAt(0),E=void 0;if(P<16)E="%0"+P.toString(16).toUpperCase();else if(P<128)E="%"+P.toString(16).toUpperCase();else if(P<2048)E="%"+(P>>6|192).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase();else E="%"+(P>>12|224).toString(16).toUpperCase()+"%"+(P>>6&63|128).toString(16).toUpperCase()+"%"+(P&63|128).toString(16).toUpperCase();return E}function yv(N){var P="",E=0,U=N.length;while(E<U){var h=parseInt(N.substr(E+1,2),16);if(h<128)P+=String.fromCharCode(h),E+=3;else if(h>=194&&h<224){if(U-E>=6){var r=parseInt(N.substr(E+4,2),16);P+=String.fromCharCode((h&31)<<6|r&63)}else P+=N.substr(E,6);E+=6}else if(h>=224){if(U-E>=9){var e=parseInt(N.substr(E+4,2),16),Xv=parseInt(N.substr(E+7,2),16);P+=String.fromCharCode((h&15)<<12|(e&63)<<6|Xv&63)}else P+=N.substr(E,9);E+=9}else P+=N.substr(E,3),E+=3}return P}function Vf(N,P){function E(U){var h=yv(U);return!h.match(P.UNRESERVED)?U:h}if(N.scheme)N.scheme=String(N.scheme).replace(P.PCT_ENCODED,E).toLowerCase().replace(P.NOT_SCHEME,"");if(N.userinfo!==void 0)N.userinfo=String(N.userinfo).replace(P.PCT_ENCODED,E).replace(P.NOT_USERINFO,gv).replace(P.PCT_ENCODED,Q);if(N.host!==void 0)N.host=String(N.host).replace(P.PCT_ENCODED,E).toLowerCase().replace(P.NOT_HOST,gv).replace(P.PCT_ENCODED,Q);if(N.path!==void 0)N.path=String(N.path).replace(P.PCT_ENCODED,E).replace(N.scheme?P.NOT_PATH:P.NOT_PATH_NOSCHEME,gv).replace(P.PCT_ENCODED,Q);if(N.query!==void 0)N.query=String(N.query).replace(P.PCT_ENCODED,E).replace(P.NOT_QUERY,gv).replace(P.PCT_ENCODED,Q);if(N.fragment!==void 0)N.fragment=String(N.fragment).replace(P.PCT_ENCODED,E).replace(P.NOT_FRAGMENT,gv).replace(P.PCT_ENCODED,Q);return N}function Pf(N){return N.replace(/^0*(.*)/,"$1")||"0"}function Ov(N,P){var E=N.match(P.IPV4ADDRESS)||[],U=H(E,2),h=U[1];if(h)return h.split(".").map(Pf).join(".");else return N}function Ev(N,P){var E=N.match(P.IPV6ADDRESS)||[],U=H(E,3),h=U[1],r=U[2];if(h){var e=h.toLowerCase().split("::").reverse(),Xv=H(e,2),Bv=Xv[0],Uv=Xv[1],Jv=Uv?Uv.split(":").map(Pf):[],$v=Bv.split(":").map(Pf),hv=P.IPV4ADDRESS.test($v[$v.length-1]),zv=hv?7:8,wv=$v.length-zv,Mv=Array(zv);for(var qv=0;qv<zv;++qv)Mv[qv]=Jv[qv]||$v[wv+qv]||"";if(hv)Mv[zv-1]=Ov(Mv[zv-1],P);var Sf=Mv.reduce(function(nv,Yf,yf){if(!Yf||Yf==="0"){var Kf=nv[nv.length-1];if(Kf&&Kf.index+Kf.length===yf)Kf.length++;else nv.push({index:yf,length:1})}return nv},[]),rv=Sf.sort(function(nv,Yf){return Yf.length-nv.length})[0],cv=void 0;if(rv&&rv.length>1){var Pv=Mv.slice(0,rv.index),mv=Mv.slice(rv.index+rv.length);cv=Pv.join(":")+"::"+mv.join(":")}else cv=Mv.join(":");if(r)cv+="%"+r;return cv}else return N}var _f=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Rv="".match(/(){0}/)[1]===void 0;function Gv(N){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E={},U=P.iri!==!1?z:B;if(P.reference==="suffix")N=(P.scheme?P.scheme+":":"")+"//"+N;var h=N.match(_f);if(h){if(Rv){if(E.scheme=h[1],E.userinfo=h[3],E.host=h[4],E.port=parseInt(h[5],10),E.path=h[6]||"",E.query=h[7],E.fragment=h[8],isNaN(E.port))E.port=h[5]}else if(E.scheme=h[1]||void 0,E.userinfo=N.indexOf("@")!==-1?h[3]:void 0,E.host=N.indexOf("//")!==-1?h[4]:void 0,E.port=parseInt(h[5],10),E.path=h[6]||"",E.query=N.indexOf("?")!==-1?h[7]:void 0,E.fragment=N.indexOf("#")!==-1?h[8]:void 0,isNaN(E.port))E.port=N.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?h[4]:void 0;if(E.host)E.host=Ev(Ov(E.host,U),U);if(E.scheme===void 0&&E.userinfo===void 0&&E.host===void 0&&E.port===void 0&&!E.path&&E.query===void 0)E.reference="same-document";else if(E.scheme===void 0)E.reference="relative";else if(E.fragment===void 0)E.reference="absolute";else E.reference="uri";if(P.reference&&P.reference!=="suffix"&&P.reference!==E.reference)E.error=E.error||"URI is not a "+P.reference+" reference.";var r=jv[(P.scheme||E.scheme||"").toLowerCase()];if(!P.unicodeSupport&&(!r||!r.unicodeSupport)){if(E.host&&(P.domainHost||r&&r.domainHost))try{E.host=Yv.toASCII(E.host.replace(U.PCT_ENCODED,yv).toLowerCase())}catch(e){E.error=E.error||"Host's domain name can not be converted to ASCII via punycode: "+e}Vf(E,B)}else Vf(E,U);if(r&&r.parse)r.parse(E,P)}else E.error=E.error||"URI can not be parsed.";return E}function Ef(N,P){var E=P.iri!==!1?z:B,U=[];if(N.userinfo!==void 0)U.push(N.userinfo),U.push("@");if(N.host!==void 0)U.push(Ev(Ov(String(N.host),E),E).replace(E.IPV6ADDRESS,function(h,r,e){return"["+r+(e?"%25"+e:"")+"]"}));if(typeof N.port==="number"||typeof N.port==="string")U.push(":"),U.push(String(N.port));return U.length?U.join(""):void 0}var Hf=/^\.\.?\//,Rf=/^\/\.(\/|$)/,kf=/^\/\.\.(\/|$)/,Av=/^\/?(?:.|\n)*?(?=\/|$)/;function av(N){var P=[];while(N.length)if(N.match(Hf))N=N.replace(Hf,"");else if(N.match(Rf))N=N.replace(Rf,"/");else if(N.match(kf))N=N.replace(kf,"/"),P.pop();else if(N==="."||N==="..")N="";else{var E=N.match(Av);if(E){var U=E[0];N=N.slice(U.length),P.push(U)}else throw new Error("Unexpected dot segment condition")}return P.join("")}function Zv(N){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=P.iri?z:B,U=[],h=jv[(P.scheme||N.scheme||"").toLowerCase()];if(h&&h.serialize)h.serialize(N,P);if(N.host){if(E.IPV6ADDRESS.test(N.host));else if(P.domainHost||h&&h.domainHost)try{N.host=!P.iri?Yv.toASCII(N.host.replace(E.PCT_ENCODED,yv).toLowerCase()):Yv.toUnicode(N.host)}catch(Xv){N.error=N.error||"Host's domain name can not be converted to "+(!P.iri?"ASCII":"Unicode")+" via punycode: "+Xv}}if(Vf(N,E),P.reference!=="suffix"&&N.scheme)U.push(N.scheme),U.push(":");var r=Ef(N,P);if(r!==void 0){if(P.reference!=="suffix")U.push("//");if(U.push(r),N.path&&N.path.charAt(0)!=="/")U.push("/")}if(N.path!==void 0){var e=N.path;if(!P.absolutePath&&(!h||!h.absolutePath))e=av(e);if(r===void 0)e=e.replace(/^\/\//,"/%2F");U.push(e)}if(N.query!==void 0)U.push("?"),U.push(N.query);if(N.fragment!==void 0)U.push("#"),U.push(N.fragment);return U.join("")}function lv(N,P){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},U=arguments[3],h={};if(!U)N=Gv(Zv(N,E),E),P=Gv(Zv(P,E),E);if(E=E||{},!E.tolerant&&P.scheme)h.scheme=P.scheme,h.userinfo=P.userinfo,h.host=P.host,h.port=P.port,h.path=av(P.path||""),h.query=P.query;else{if(P.userinfo!==void 0||P.host!==void 0||P.port!==void 0)h.userinfo=P.userinfo,h.host=P.host,h.port=P.port,h.path=av(P.path||""),h.query=P.query;else{if(!P.path)if(h.path=N.path,P.query!==void 0)h.query=P.query;else h.query=N.query;else{if(P.path.charAt(0)==="/")h.path=av(P.path);else{if((N.userinfo!==void 0||N.host!==void 0||N.port!==void 0)&&!N.path)h.path="/"+P.path;else if(!N.path)h.path=P.path;else h.path=N.path.slice(0,N.path.lastIndexOf("/")+1)+P.path;h.path=av(h.path)}h.query=P.query}h.userinfo=N.userinfo,h.host=N.host,h.port=N.port}h.scheme=N.scheme}return h.fragment=P.fragment,h}function Jf(N,P,E){var U=Y({scheme:"null"},E);return Zv(lv(Gv(N,U),Gv(P,U),U,!0),U)}function uv(N,P){if(typeof N==="string")N=Zv(Gv(N,P),P);else if(J(N)==="object")N=Gv(Zv(N,P),P);return N}function y1(N,P,E){if(typeof N==="string")N=Zv(Gv(N,E),E);else if(J(N)==="object")N=Zv(N,E);if(typeof P==="string")P=Zv(Gv(P,E),E);else if(J(P)==="object")P=Zv(P,E);return N===P}function S0(N,P){return N&&N.toString().replace(!P||!P.iri?B.ESCAPE:z.ESCAPE,gv)}function dv(N,P){return N&&N.toString().replace(!P||!P.iri?B.PCT_ENCODED:z.PCT_ENCODED,yv)}var K1={scheme:"http",domainHost:!0,parse:function N(P,E){if(!P.host)P.error=P.error||"HTTP URIs must have a host.";return P},serialize:function N(P,E){var U=String(P.scheme).toLowerCase()==="https";if(P.port===(U?443:80)||P.port==="")P.port=void 0;if(!P.path)P.path="/";return P}},rQ={scheme:"https",domainHost:K1.domainHost,parse:K1.parse,serialize:K1.serialize};function mQ(N){return typeof N.secure==="boolean"?N.secure:String(N.scheme).toLowerCase()==="wss"}var z1={scheme:"ws",domainHost:!0,parse:function N(P,E){var U=P;return U.secure=mQ(U),U.resourceName=(U.path||"/")+(U.query?"?"+U.query:""),U.path=void 0,U.query=void 0,U},serialize:function N(P,E){if(P.port===(mQ(P)?443:80)||P.port==="")P.port=void 0;if(typeof P.secure==="boolean")P.scheme=P.secure?"wss":"ws",P.secure=void 0;if(P.resourceName){var U=P.resourceName.split("?"),h=H(U,2),r=h[0],e=h[1];P.path=r&&r!=="/"?r:void 0,P.query=e,P.resourceName=void 0}return P.fragment=void 0,P}},aQ={scheme:"wss",domainHost:z1.domainHost,parse:z1.parse,serialize:z1.serialize},nJ={},pJ=!0,cQ="[A-Za-z0-9\\-\\.\\_\\~"+(pJ?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Xf="[0-9A-Fa-f]",iJ=W(W("%[EFef]"+Xf+"%"+Xf+Xf+"%"+Xf+Xf)+"|"+W("%[89A-Fa-f]"+Xf+"%"+Xf+Xf)+"|"+W("%"+Xf+Xf)),dJ="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",oJ="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",sJ=v(oJ,"[\\\"\\\\]"),tJ="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",eJ=new RegExp(cQ,"g"),mf=new RegExp(iJ,"g"),v6=new RegExp(v("[^]",dJ,"[\\.]","[\\\"]",sJ),"g"),nQ=new RegExp(v("[^]",cQ,tJ),"g"),f6=nQ;function y0(N){var P=yv(N);return!P.match(eJ)?N:P}var pQ={scheme:"mailto",parse:function N(P,E){var U=P,h=U.to=U.path?U.path.split(","):[];if(U.path=void 0,U.query){var r=!1,e={},Xv=U.query.split("&");for(var Bv=0,Uv=Xv.length;Bv<Uv;++Bv){var Jv=Xv[Bv].split("=");switch(Jv[0]){case"to":var $v=Jv[1].split(",");for(var hv=0,zv=$v.length;hv<zv;++hv)h.push($v[hv]);break;case"subject":U.subject=dv(Jv[1],E);break;case"body":U.body=dv(Jv[1],E);break;default:r=!0,e[dv(Jv[0],E)]=dv(Jv[1],E);break}}if(r)U.headers=e}U.query=void 0;for(var wv=0,Mv=h.length;wv<Mv;++wv){var qv=h[wv].split("@");if(qv[0]=dv(qv[0]),!E.unicodeSupport)try{qv[1]=Yv.toASCII(dv(qv[1],E).toLowerCase())}catch(Sf){U.error=U.error||"Email address's domain name can not be converted to ASCII via punycode: "+Sf}else qv[1]=dv(qv[1],E).toLowerCase();h[wv]=qv.join("@")}return U},serialize:function N(P,E){var U=P,h=X(P.to);if(h){for(var r=0,e=h.length;r<e;++r){var Xv=String(h[r]),Bv=Xv.lastIndexOf("@"),Uv=Xv.slice(0,Bv).replace(mf,y0).replace(mf,Q).replace(v6,gv),Jv=Xv.slice(Bv+1);try{Jv=!E.iri?Yv.toASCII(dv(Jv,E).toLowerCase()):Yv.toUnicode(Jv)}catch(wv){U.error=U.error||"Email address's domain name can not be converted to "+(!E.iri?"ASCII":"Unicode")+" via punycode: "+wv}h[r]=Uv+"@"+Jv}U.path=h.join(",")}var $v=P.headers=P.headers||{};if(P.subject)$v.subject=P.subject;if(P.body)$v.body=P.body;var hv=[];for(var zv in $v)if($v[zv]!==nJ[zv])hv.push(zv.replace(mf,y0).replace(mf,Q).replace(nQ,gv)+"="+$v[zv].replace(mf,y0).replace(mf,Q).replace(f6,gv));if(hv.length)U.query=hv.join("&");return U}},Q6=/^([^\:]+)\:(.*)/,iQ={scheme:"urn",parse:function N(P,E){var U=P.path&&P.path.match(Q6),h=P;if(U){var r=E.scheme||h.scheme||"urn",e=U[1].toLowerCase(),Xv=U[2],Bv=r+":"+(E.nid||e),Uv=jv[Bv];if(h.nid=e,h.nss=Xv,h.path=void 0,Uv)h=Uv.parse(h,E)}else h.error=h.error||"URN can not be parsed.";return h},serialize:function N(P,E){var U=E.scheme||P.scheme||"urn",h=P.nid,r=U+":"+(E.nid||h),e=jv[r];if(e)P=e.serialize(P,E);var Xv=P,Bv=P.nss;return Xv.path=(h||E.nid)+":"+Bv,Xv}},W6=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,dQ={scheme:"urn:uuid",parse:function N(P,E){var U=P;if(U.uuid=U.nss,U.nss=void 0,!E.tolerant&&(!U.uuid||!U.uuid.match(W6)))U.error=U.error||"UUID is not valid.";return U},serialize:function N(P,E){var U=P;return U.nss=(P.uuid||"").toLowerCase(),U}};jv[K1.scheme]=K1,jv[rQ.scheme]=rQ,jv[z1.scheme]=z1,jv[aQ.scheme]=aQ,jv[pQ.scheme]=pQ,jv[iQ.scheme]=iQ,jv[dQ.scheme]=dQ,f.SCHEMES=jv,f.pctEncChar=gv,f.pctDecChars=yv,f.parse=Gv,f.removeDotSegments=av,f.serialize=Zv,f.resolveComponents=lv,f.resolve=Jf,f.normalize=uv,f.equal=y1,f.escapeComponent=S0,f.unescapeComponent=dv,Object.defineProperty(f,"__esModule",{value:!0})})});var X0=o((W4,S8)=>{S8.exports=function f(v,W){if(v===W)return!0;if(v&&W&&typeof v=="object"&&typeof W=="object"){if(v.constructor!==W.constructor)return!1;var J,Q,X;if(Array.isArray(v)){if(J=v.length,J!=W.length)return!1;for(Q=J;Q--!==0;)if(!f(v[Q],W[Q]))return!1;return!0}if(v.constructor===RegExp)return v.source===W.source&&v.flags===W.flags;if(v.valueOf!==Object.prototype.valueOf)return v.valueOf()===W.valueOf();if(v.toString!==Object.prototype.toString)return v.toString()===W.toString();if(X=Object.keys(v),J=X.length,J!==Object.keys(W).length)return!1;for(Q=J;Q--!==0;)if(!Object.prototype.hasOwnProperty.call(W,X[Q]))return!1;for(Q=J;Q--!==0;){var Y=X[Q];if(!f(v[Y],W[Y]))return!1}return!0}return v!==v&&W!==W}});var l8=o((J4,y8)=>{y8.exports=function f(v){var W=0,J=v.length,Q=0,X;while(Q<J)if(W++,X=v.charCodeAt(Q++),X>=55296&&X<=56319&&Q<J){if(X=v.charCodeAt(Q),(X&64512)==56320)Q++}return W}});var uf=o((X4,C8)=>{C8.exports={copy:$X,checkDataType:vQ,checkDataTypes:MX,coerceToTypes:NX,toHash:QQ,getProperty:WQ,escapeQuotes:JQ,equal:X0(),ucs2length:l8(),varOccurences:DX,varReplace:jX,schemaHasRules:OX,schemaHasRulesExcept:UX,schemaUnknownRules:hX,toQuotedString:fQ,getPathExpr:FX,getPath:gX,getData:_X,unescapeFragment:RX,unescapeJsonPointer:YQ,escapeFragment:kX,escapeJsonPointer:XQ};function $X(f,v){v=v||{};for(var W in f)v[W]=f[W];return v}function vQ(f,v,W,J){var Q=J?" !== ":" === ",X=J?" || ":" && ",Y=J?"!":"",w=J?"":"!";switch(f){case"null":return v+Q+"null";case"array":return Y+"Array.isArray("+v+")";case"object":return"("+Y+v+X+"typeof "+v+Q+'"object"'+X+w+"Array.isArray("+v+"))";case"integer":return"(typeof "+v+Q+'"number"'+X+w+"("+v+" % 1)"+X+v+Q+v+(W?X+Y+"isFinite("+v+")":"")+")";case"number":return"(typeof "+v+Q+'"'+f+'"'+(W?X+Y+"isFinite("+v+")":"")+")";default:return"typeof "+v+Q+'"'+f+'"'}}function MX(f,v,W){switch(f.length){case 1:return vQ(f[0],v,W,!0);default:var J="",Q=QQ(f);if(Q.array&&Q.object)J=Q.null?"(":"(!"+v+" || ",J+="typeof "+v+' !== "object")',delete Q.null,delete Q.array,delete Q.object;if(Q.number)delete Q.integer;for(var X in Q)J+=(J?" && ":"")+vQ(X,v,W,!0);return J}}var I8=QQ(["string","number","integer","boolean","null"]);function NX(f,v){if(Array.isArray(v)){var W=[];for(var J=0;J<v.length;J++){var Q=v[J];if(I8[Q])W[W.length]=Q;else if(f==="array"&&Q==="array")W[W.length]=Q}if(W.length)return W}else if(I8[v])return[v];else if(f==="array"&&v==="array")return["array"]}function QQ(f){var v={};for(var W=0;W<f.length;W++)v[f[W]]=!0;return v}var VX=/^[a-z$_][a-z$_0-9]*$/i,EX=/'|\\/g;function WQ(f){return typeof f=="number"?"["+f+"]":VX.test(f)?"."+f:"['"+JQ(f)+"']"}function JQ(f){return f.replace(EX,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function DX(f,v){v+="[^0-9]";var W=f.match(new RegExp(v,"g"));return W?W.length:0}function jX(f,v,W){return v+="([^0-9])",W=W.replace(/\$/g,"$$$$"),f.replace(new RegExp(v,"g"),W+"$1")}function OX(f,v){if(typeof f=="boolean")return!f;for(var W in f)if(v[W])return!0}function UX(f,v,W){if(typeof f=="boolean")return!f&&W!="not";for(var J in f)if(J!=W&&v[J])return!0}function hX(f,v){if(typeof f=="boolean")return;for(var W in f)if(!v[W])return W}function fQ(f){return"'"+JQ(f)+"'"}function FX(f,v,W,J){var Q=W?"'/' + "+v+(J?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):J?"'[' + "+v+" + ']'":"'[\\'' + "+v+" + '\\']'";return Z8(f,Q)}function gX(f,v,W){var J=W?fQ("/"+XQ(v)):fQ(WQ(v));return Z8(f,J)}var AX=/^\/(?:[^~]|~0|~1)*$/,bX=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function _X(f,v,W){var J,Q,X,Y;if(f==="")return"rootData";if(f[0]=="/"){if(!AX.test(f))throw new Error("Invalid JSON-pointer: "+f);Q=f,X="rootData"}else{if(Y=f.match(bX),!Y)throw new Error("Invalid JSON-pointer: "+f);if(J=+Y[1],Q=Y[2],Q=="#"){if(J>=v)throw new Error("Cannot access property/index "+J+" levels up, current level is "+v);return W[v-J]}if(J>v)throw new Error("Cannot access data "+J+" levels up, current level is "+v);if(X="data"+(v-J||""),!Q)return X}var w=X,B=Q.split("/");for(var z=0;z<B.length;z++){var H=B[z];if(H)X+=WQ(YQ(H)),w+=" && "+X}return w}function Z8(f,v){if(f=='""')return v;return(f+" + "+v).replace(/([^\\])' \+ '/g,"$1")}function RX(f){return YQ(decodeURIComponent(f))}function kX(f){return encodeURIComponent(XQ(f))}function XQ(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}function YQ(f){return f.replace(/~1/g,"/").replace(/~0/g,"~")}});var wQ=o((Y4,T8)=>{var SX=uf();T8.exports=yX;function yX(f){SX.copy(f,this)}});var u8=o((w4,x8)=>{var gf=x8.exports=function(f,v,W){if(typeof v=="function")W=v,v={};W=v.cb||W;var J=typeof W=="function"?W:W.pre||function(){},Q=W.post||function(){};Y0(v,J,Q,f,"",f)};gf.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};gf.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};gf.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};gf.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Y0(f,v,W,J,Q,X,Y,w,B,z){if(J&&typeof J=="object"&&!Array.isArray(J)){v(J,Q,X,Y,w,B,z);for(var H in J){var $=J[H];if(Array.isArray($)){if(H in gf.arrayKeywords)for(var K=0;K<$.length;K++)Y0(f,v,W,$[K],Q+"/"+H+"/"+K,X,Q,H,J,K)}else if(H in gf.propsKeywords){if($&&typeof $=="object")for(var q in $)Y0(f,v,W,$[q],Q+"/"+H+"/"+lX(q),X,Q,H,J,q)}else if(H in gf.keywords||f.allKeys&&!(H in gf.skipKeywords))Y0(f,v,W,$,Q+"/"+H,X,Q,H,J)}W(J,Q,X,Y,w,B,z)}}function lX(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}});var H0=o((G4,c8)=>{var R1=k8(),r8=X0(),q0=uf(),w0=wQ(),IX=u8();c8.exports=bf;bf.normalizeId=Af;bf.fullPath=G0;bf.url=B0;bf.ids=uX;bf.inlineRef=GQ;bf.schema=P0;function bf(f,v,W){var J=this._refs[W];if(typeof J=="string")if(this._refs[J])J=this._refs[J];else return bf.call(this,f,v,J);if(J=J||this._schemas[W],J instanceof w0)return GQ(J.schema,this._opts.inlineRefs)?J.schema:J.validate||this._compile(J);var Q=P0.call(this,v,W),X,Y,w;if(Q)X=Q.schema,v=Q.root,w=Q.baseId;if(X instanceof w0)Y=X.validate||f.call(this,X.schema,v,void 0,w);else if(X!==void 0)Y=GQ(X,this._opts.inlineRefs)?X:f.call(this,X,v,void 0,w);return Y}function P0(f,v){var W=R1.parse(v),J=a8(W),Q=G0(this._getId(f.schema));if(Object.keys(f.schema).length===0||J!==Q){var X=Af(J),Y=this._refs[X];if(typeof Y=="string")return ZX.call(this,f,Y,W);else if(Y instanceof w0){if(!Y.validate)this._compile(Y);f=Y}else if(Y=this._schemas[X],Y instanceof w0){if(!Y.validate)this._compile(Y);if(X==Af(v))return{schema:Y,root:f,baseId:Q};f=Y}else return;if(!f.schema)return;Q=G0(this._getId(f.schema))}return m8.call(this,W,Q,f.schema,f)}function ZX(f,v,W){var J=P0.call(this,f,v);if(J){var{schema:Q,baseId:X}=J;f=J.root;var Y=this._getId(Q);if(Y)X=B0(X,Y);return m8.call(this,W,X,Q,f)}}var CX=q0.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function m8(f,v,W,J){if(f.fragment=f.fragment||"",f.fragment.slice(0,1)!="/")return;var Q=f.fragment.split("/");for(var X=1;X<Q.length;X++){var Y=Q[X];if(Y){if(Y=q0.unescapeFragment(Y),W=W[Y],W===void 0)break;var w;if(!CX[Y]){if(w=this._getId(W),w)v=B0(v,w);if(W.$ref){var B=B0(v,W.$ref),z=P0.call(this,J,B);if(z)W=z.schema,J=z.root,v=z.baseId}}}}if(W!==void 0&&W!==J.schema)return{schema:W,root:J,baseId:v}}var TX=q0.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function GQ(f,v){if(v===!1)return!1;if(v===void 0||v===!0)return BQ(f);else if(v)return qQ(f)<=v}function BQ(f){var v;if(Array.isArray(f)){for(var W=0;W<f.length;W++)if(v=f[W],typeof v=="object"&&!BQ(v))return!1}else for(var J in f){if(J=="$ref")return!1;if(v=f[J],typeof v=="object"&&!BQ(v))return!1}return!0}function qQ(f){var v=0,W;if(Array.isArray(f))for(var J=0;J<f.length;J++){if(W=f[J],typeof W=="object")v+=qQ(W);if(v==1/0)return 1/0}else for(var Q in f){if(Q=="$ref")return 1/0;if(TX[Q])v++;else{if(W=f[Q],typeof W=="object")v+=qQ(W)+1;if(v==1/0)return 1/0}}return v}function G0(f,v){if(v!==!1)f=Af(f);var W=R1.parse(f);return a8(W)}function a8(f){return R1.serialize(f).split("#")[0]+"#"}var xX=/#\/?$/;function Af(f){return f?f.replace(xX,""):""}function B0(f,v){return v=Af(v),R1.resolve(f,v)}function uX(f){var v=Af(this._getId(f)),W={"":v},J={"":G0(v,!1)},Q={},X=this;return IX(f,{allKeys:!0},function(Y,w,B,z,H,$,K){if(w==="")return;var q=X._getId(Y),L=W[z],V=J[z]+"/"+H;if(K!==void 0)V+="/"+(typeof K=="number"?K:q0.escapeFragment(K));if(typeof q=="string"){q=L=Af(L?R1.resolve(L,q):q);var M=X._refs[q];if(typeof M=="string")M=X._refs[M];if(M&&M.schema){if(!r8(Y,M.schema))throw new Error('id "'+q+'" resolves to more than one schema')}else if(q!=Af(V))if(q[0]=="#"){if(Q[q]&&!r8(Y,Q[q]))throw new Error('id "'+q+'" resolves to more than one schema');Q[q]=Y}else X._refs[q]=V}W[w]=L,J[w]=V}),Q}});var K0=o((B4,p8)=>{var PQ=H0();p8.exports={Validation:n8(rX),MissingRef:n8(HQ)};function rX(f){this.message="validation failed",this.errors=f,this.ajv=this.validation=!0}HQ.message=function(f,v){return"can't resolve reference "+v+" from id "+f};function HQ(f,v,W){this.message=W||HQ.message(f,v),this.missingRef=PQ.url(f,v),this.missingSchema=PQ.normalizeId(PQ.fullPath(this.missingRef))}function n8(f){return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f}});var KQ=o((q4,i8)=>{i8.exports=function(f,v){if(!v)v={};if(typeof v==="function")v={cmp:v};var W=typeof v.cycles==="boolean"?v.cycles:!1,J=v.cmp&&function(X){return function(Y){return function(w,B){var z={key:w,value:Y[w]},H={key:B,value:Y[B]};return X(z,H)}}}(v.cmp),Q=[];return function X(Y){if(Y&&Y.toJSON&&typeof Y.toJSON==="function")Y=Y.toJSON();if(Y===void 0)return;if(typeof Y=="number")return isFinite(Y)?""+Y:"null";if(typeof Y!=="object")return JSON.stringify(Y);var w,B;if(Array.isArray(Y)){B="[";for(w=0;w<Y.length;w++){if(w)B+=",";B+=X(Y[w])||"null"}return B+"]"}if(Y===null)return"null";if(Q.indexOf(Y)!==-1){if(W)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var z=Q.push(Y)-1,H=Object.keys(Y).sort(J&&J(Y));B="";for(w=0;w<H.length;w++){var $=H[w],K=X(Y[$]);if(!K)continue;if(B)B+=",";B+=JSON.stringify($)+":"+K}return Q.splice(z,1),"{"+B+"}"}(f)}});var zQ=o((P4,d8)=>{d8.exports=function f(v,W,J){var Q="",X=v.schema.$async===!0,Y=v.util.schemaHasRulesExcept(v.schema,v.RULES.all,"$ref"),w=v.self._getId(v.schema);if(v.opts.strictKeywords){var B=v.util.schemaUnknownRules(v.schema,v.RULES.keywords);if(B){var z="unknown keyword: "+B;if(v.opts.strictKeywords==="log")v.logger.warn(z);else throw new Error(z)}}if(v.isTop){if(Q+=" var validate = ",X)v.async=!0,Q+="async ";if(Q+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",w&&(v.opts.sourceCode||v.opts.processCode))Q+=" "+("/*# sourceURL="+w+" */")+" "}if(typeof v.schema=="boolean"||!(Y||v.schema.$ref)){var W="false schema",H=v.level,$=v.dataLevel,K=v.schema[W],q=v.schemaPath+v.util.getProperty(W),L=v.errSchemaPath+"/"+W,C=!v.opts.allErrors,A,V="data"+($||""),Z="valid"+H;if(v.schema===!1){if(v.isTop)C=!0;else Q+=" var "+Z+" = false; ";var M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(A||"false schema")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(L)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'boolean schema is false' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+V+" ";Q+=" } "}else Q+=" {} ";var D=Q;if(Q=M.pop(),!v.compositeRule&&C)if(v.async)Q+=" throw new ValidationError(["+D+"]); ";else Q+=" validate.errors = ["+D+"]; return false; ";else Q+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(v.isTop)if(X)Q+=" return data; ";else Q+=" validate.errors = null; return true; ";else Q+=" var "+Z+" = true; ";if(v.isTop)Q+=" }; return validate; ";return Q}if(v.isTop){var y=v.isTop,H=v.level=0,$=v.dataLevel=0,V="data";if(v.rootId=v.resolve.fullPath(v.self._getId(v.root.schema)),v.baseId=v.baseId||v.rootId,delete v.isTop,v.dataPathArr=[""],v.schema.default!==void 0&&v.opts.useDefaults&&v.opts.strictDefaults){var F="default is ignored in the schema root";if(v.opts.strictDefaults==="log")v.logger.warn(F);else throw new Error(F)}Q+=" var vErrors = null; ",Q+=" var errors = 0; ",Q+=" if (rootData === undefined) rootData = data; "}else{var{level:H,dataLevel:$}=v,V="data"+($||"");if(w)v.baseId=v.resolve.url(v.baseId,w);if(X&&!v.async)throw new Error("async schema in sync schema");Q+=" var errs_"+H+" = errors;"}var Z="valid"+H,C=!v.opts.allErrors,T="",O="",A,j=v.schema.type,_=Array.isArray(j);if(j&&v.opts.nullable&&v.schema.nullable===!0){if(_){if(j.indexOf("null")==-1)j=j.concat("null")}else if(j!="null")j=[j,"null"],_=!0}if(_&&j.length==1)j=j[0],_=!1;if(v.schema.$ref&&Y){if(v.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+v.errSchemaPath+'" (see option extendRefs)');else if(v.opts.extendRefs!==!0)Y=!1,v.logger.warn('$ref: keywords ignored in schema at path "'+v.errSchemaPath+'"')}if(v.schema.$comment&&v.opts.$comment)Q+=" "+v.RULES.all.$comment.code(v,"$comment");if(j){if(v.opts.coerceTypes)var l=v.util.coerceToTypes(v.opts.coerceTypes,j);var R=v.RULES.types[j];if(l||_||R===!0||R&&!Av(R)){var q=v.schemaPath+".type",L=v.errSchemaPath+"/type",q=v.schemaPath+".type",L=v.errSchemaPath+"/type",g=_?"checkDataTypes":"checkDataType";if(Q+=" if ("+v.util[g](j,V,v.opts.strictNumbers,!0)+") { ",l){var b="dataType"+H,k="coerced"+H;if(Q+=" var "+b+" = typeof "+V+"; var "+k+" = undefined; ",v.opts.coerceTypes=="array")Q+=" if ("+b+" == 'object' && Array.isArray("+V+") && "+V+".length == 1) { "+V+" = "+V+"[0]; "+b+" = typeof "+V+"; if ("+v.util.checkDataType(v.schema.type,V,v.opts.strictNumbers)+") "+k+" = "+V+"; } ";Q+=" if ("+k+" !== undefined) ; ";var m=l;if(m){var c,d=-1,s=m.length-1;while(d<s)if(c=m[d+=1],c=="string")Q+=" else if ("+b+" == 'number' || "+b+" == 'boolean') "+k+" = '' + "+V+"; else if ("+V+" === null) "+k+" = ''; ";else if(c=="number"||c=="integer"){if(Q+=" else if ("+b+" == 'boolean' || "+V+" === null || ("+b+" == 'string' && "+V+" && "+V+" == +"+V+" ",c=="integer")Q+=" && !("+V+" % 1)";Q+=")) "+k+" = +"+V+"; "}else if(c=="boolean")Q+=" else if ("+V+" === 'false' || "+V+" === 0 || "+V+" === null) "+k+" = false; else if ("+V+" === 'true' || "+V+" === 1) "+k+" = true; ";else if(c=="null")Q+=" else if ("+V+" === '' || "+V+" === 0 || "+V+" === false) "+k+" = null; ";else if(v.opts.coerceTypes=="array"&&c=="array")Q+=" else if ("+b+" == 'string' || "+b+" == 'number' || "+b+" == 'boolean' || "+V+" == null) "+k+" = ["+V+"]; "}Q+=" else { ";var M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(A||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(L)+" , params: { type: '",_)Q+=""+j.join(",");else Q+=""+j;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",_)Q+=""+j.join(",");else Q+=""+j;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+V+" ";Q+=" } "}else Q+=" {} ";var D=Q;if(Q=M.pop(),!v.compositeRule&&C)if(v.async)Q+=" throw new ValidationError(["+D+"]); ";else Q+=" validate.errors = ["+D+"]; return false; ";else Q+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } if ("+k+" !== undefined) { ";var n=$?"data"+($-1||""):"parentData",Vv=$?v.dataPathArr[$]:"parentDataProperty";if(Q+=" "+V+" = "+k+"; ",!$)Q+="if ("+n+" !== undefined)";Q+=" "+n+"["+Vv+"] = "+k+"; } "}else{var M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(A||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(L)+" , params: { type: '",_)Q+=""+j.join(",");else Q+=""+j;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",_)Q+=""+j.join(",");else Q+=""+j;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+V+" ";Q+=" } "}else Q+=" {} ";var D=Q;if(Q=M.pop(),!v.compositeRule&&C)if(v.async)Q+=" throw new ValidationError(["+D+"]); ";else Q+=" validate.errors = ["+D+"]; return false; ";else Q+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}Q+=" } "}}if(v.schema.$ref&&!Y){if(Q+=" "+v.RULES.all.$ref.code(v,"$ref")+" ",C){if(Q+=" } if (errors === ",y)Q+="0";else Q+="errs_"+H;Q+=") { ",O+="}"}}else{var _v=v.RULES;if(_v){var R,Sv=-1,Yv=_v.length-1;while(Sv<Yv)if(R=_v[Sv+=1],Av(R)){if(R.type)Q+=" if ("+v.util.checkDataType(R.type,V,v.opts.strictNumbers)+") { ";if(v.opts.useDefaults){if(R.type=="object"&&v.schema.properties){var K=v.schema.properties,jv=Object.keys(K),gv=jv;if(gv){var yv,Vf=-1,Pf=gv.length-1;while(Vf<Pf){yv=gv[Vf+=1];var Ov=K[yv];if(Ov.default!==void 0){var Ev=V+v.util.getProperty(yv);if(v.compositeRule){if(v.opts.strictDefaults){var F="default is ignored for: "+Ev;if(v.opts.strictDefaults==="log")v.logger.warn(F);else throw new Error(F)}}else{if(Q+=" if ("+Ev+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+Ev+" === null || "+Ev+" === '' ";if(Q+=" ) "+Ev+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Ov.default)+" ";else Q+=" "+JSON.stringify(Ov.default)+" ";Q+="; "}}}}}else if(R.type=="array"&&Array.isArray(v.schema.items)){var _f=v.schema.items;if(_f){var Ov,d=-1,Rv=_f.length-1;while(d<Rv)if(Ov=_f[d+=1],Ov.default!==void 0){var Ev=V+"["+d+"]";if(v.compositeRule){if(v.opts.strictDefaults){var F="default is ignored for: "+Ev;if(v.opts.strictDefaults==="log")v.logger.warn(F);else throw new Error(F)}}else{if(Q+=" if ("+Ev+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+Ev+" === null || "+Ev+" === '' ";if(Q+=" ) "+Ev+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(Ov.default)+" ";else Q+=" "+JSON.stringify(Ov.default)+" ";Q+="; "}}}}}var Gv=R.rules;if(Gv){var Ef,Hf=-1,Rf=Gv.length-1;while(Hf<Rf)if(Ef=Gv[Hf+=1],av(Ef)){var kf=Ef.code(v,Ef.keyword,R.type);if(kf){if(Q+=" "+kf+" ",C)T+="}"}}}if(C)Q+=" "+T+" ",T="";if(R.type){if(Q+=" } ",j&&j===R.type&&!l){Q+=" else { ";var q=v.schemaPath+".type",L=v.errSchemaPath+"/type",M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(A||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(L)+" , params: { type: '",_)Q+=""+j.join(",");else Q+=""+j;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",_)Q+=""+j.join(",");else Q+=""+j;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+q+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+V+" ";Q+=" } "}else Q+=" {} ";var D=Q;if(Q=M.pop(),!v.compositeRule&&C)if(v.async)Q+=" throw new ValidationError(["+D+"]); ";else Q+=" validate.errors = ["+D+"]; return false; ";else Q+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } "}}if(C){if(Q+=" if (errors === ",y)Q+="0";else Q+="errs_"+H;Q+=") { ",O+="}"}}}}if(C)Q+=" "+O+" ";if(y){if(X)Q+=" if (errors === 0) return data; ",Q+=" else throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; ",Q+=" return errors === 0; ";Q+=" }; return validate;"}else Q+=" var "+Z+" = errors === errs_"+H+";";function Av(lv){var Jf=lv.rules;for(var uv=0;uv<Jf.length;uv++)if(av(Jf[uv]))return!0}function av(lv){return v.schema[lv.keyword]!==void 0||lv.implements&&Zv(lv)}function Zv(lv){var Jf=lv.implements;for(var uv=0;uv<Jf.length;uv++)if(v.schema[Jf[uv]]!==void 0)return!0}return Q}});var vW=o((H4,e8)=>{var z0=H0(),$0=uf(),s8=K0(),mX=KQ(),o8=zQ(),aX=$0.ucs2length,cX=X0(),nX=s8.Validation;e8.exports=LQ;function LQ(f,v,W,J){var Q=this,X=this._opts,Y=[void 0],w={},B=[],z={},H=[],$={},K=[];v=v||{schema:f,refVal:Y,refs:w};var q=pX.call(this,f,v,J),L=this._compilations[q.index];if(q.compiling)return L.callValidate=F;var V=this._formats,M=this.RULES;try{var D=Z(f,v,W,J);L.validate=D;var y=L.callValidate;if(y){if(y.schema=D.schema,y.errors=null,y.refs=D.refs,y.refVal=D.refVal,y.root=D.root,y.$async=D.$async,X.sourceCode)y.source=D.source}return D}finally{iX.call(this,f,v,J)}function F(){var g=L.validate,b=g.apply(this,arguments);return F.errors=g.errors,b}function Z(g,b,k,m){var c=!b||b&&b.schema==g;if(b.schema!=v.schema)return LQ.call(Q,g,b,k,m);var d=g.$async===!0,s=o8({isTop:!0,schema:g,isRoot:c,baseId:m,root:b,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:s8.MissingRef,RULES:M,validate:o8,util:$0,resolve:z0,resolveRef:C,usePattern:_,useDefault:l,useCustomRule:R,opts:X,formats:V,logger:Q.logger,self:Q});if(s=L0(Y,sX)+L0(B,dX)+L0(H,oX)+L0(K,tX)+s,X.processCode)s=X.processCode(s,g);var n;try{var Vv=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",s);n=Vv(Q,M,V,v,Y,H,K,cX,aX,nX),Y[0]=n}catch(_v){throw Q.logger.error("Error compiling schema, function code:",s),_v}if(n.schema=g,n.errors=null,n.refs=w,n.refVal=Y,n.root=c?n:b,d)n.$async=!0;if(X.sourceCode===!0)n.source={code:s,patterns:B,defaults:H};return n}function C(g,b,k){b=z0.url(g,b);var m=w[b],c,d;if(m!==void 0)return c=Y[m],d="refVal["+m+"]",j(c,d);if(!k&&v.refs){var s=v.refs[b];if(s!==void 0)return c=v.refVal[s],d=T(b,c),j(c,d)}d=T(b);var n=z0.call(Q,Z,v,b);if(n===void 0){var Vv=W&&W[b];if(Vv)n=z0.inlineRef(Vv,X.inlineRefs)?Vv:LQ.call(Q,Vv,v,W,g)}if(n===void 0)O(b);else return A(b,n),j(n,d)}function T(g,b){var k=Y.length;return Y[k]=b,w[g]=k,"refVal"+k}function O(g){delete w[g]}function A(g,b){var k=w[g];Y[k]=b}function j(g,b){return typeof g=="object"||typeof g=="boolean"?{code:b,schema:g,inline:!0}:{code:b,$async:g&&!!g.$async}}function _(g){var b=z[g];if(b===void 0)b=z[g]=B.length,B[b]=g;return"pattern"+b}function l(g){switch(typeof g){case"boolean":case"number":return""+g;case"string":return $0.toQuotedString(g);case"object":if(g===null)return"null";var b=mX(g),k=$[b];if(k===void 0)k=$[b]=H.length,H[k]=g;return"default"+k}}function R(g,b,k,m){if(Q._opts.validateSchema!==!1){var c=g.definition.dependencies;if(c&&!c.every(function(gv){return Object.prototype.hasOwnProperty.call(k,gv)}))throw new Error("parent schema must have all required keywords: "+c.join(","));var d=g.definition.validateSchema;if(d){var s=d(b);if(!s){var n="keyword schema is invalid: "+Q.errorsText(d.errors);if(Q._opts.validateSchema=="log")Q.logger.error(n);else throw new Error(n)}}}var Vv=g.definition.compile,_v=g.definition.inline,Sv=g.definition.macro,Yv;if(Vv)Yv=Vv.call(Q,b,k,m);else if(Sv){if(Yv=Sv.call(Q,b,k,m),X.validateSchema!==!1)Q.validateSchema(Yv,!0)}else if(_v)Yv=_v.call(Q,m,g.keyword,b,k);else if(Yv=g.definition.validate,!Yv)return;if(Yv===void 0)throw new Error('custom keyword "'+g.keyword+'"failed to compile');var jv=K.length;return K[jv]=Yv,{code:"customRule"+jv,validate:Yv}}}function pX(f,v,W){var J=t8.call(this,f,v,W);if(J>=0)return{index:J,compiling:!0};return J=this._compilations.length,this._compilations[J]={schema:f,root:v,baseId:W},{index:J,compiling:!1}}function iX(f,v,W){var J=t8.call(this,f,v,W);if(J>=0)this._compilations.splice(J,1)}function t8(f,v,W){for(var J=0;J<this._compilations.length;J++){var Q=this._compilations[J];if(Q.schema==f&&Q.root==v&&Q.baseId==W)return J}return-1}function dX(f,v){return"var pattern"+f+" = new RegExp("+$0.toQuotedString(v[f])+");"}function oX(f){return"var default"+f+" = defaults["+f+"];"}function sX(f,v){return v[f]===void 0?"":"var refVal"+f+" = refVal["+f+"];"}function tX(f){return"var customRule"+f+" = customRules["+f+"];"}function L0(f,v){if(!f.length)return"";var W="";for(var J=0;J<f.length;J++)W+=v(J,f);return W}});var QW=o((K4,fW)=>{var M0=fW.exports=function f(){this._cache={}};M0.prototype.put=function f(v,W){this._cache[v]=W};M0.prototype.get=function f(v){return this._cache[v]};M0.prototype.del=function f(v){delete this._cache[v]};M0.prototype.clear=function f(){this._cache={}}});var zW=o((z4,KW)=>{var eX=uf(),vY=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,fY=[0,31,28,31,30,31,30,31,31,30,31,30,31],QY=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,WW=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,WY=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,JY=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,JW=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,XW=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,YW=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,wW=/^(?:\/(?:[^~/]|~0|~1)*)*$/,GW=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,BW=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;KW.exports=N0;function N0(f){return f=f=="full"?"full":"fast",eX.copy(N0[f])}N0.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":JW,url:XW,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:WW,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:HW,uuid:YW,"json-pointer":wW,"json-pointer-uri-fragment":GW,"relative-json-pointer":BW};N0.full={date:qW,time:PW,"date-time":wY,uri:BY,"uri-reference":JY,"uri-template":JW,url:XW,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:WW,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:HW,uuid:YW,"json-pointer":wW,"json-pointer-uri-fragment":GW,"relative-json-pointer":BW};function XY(f){return f%4===0&&(f%100!==0||f%400===0)}function qW(f){var v=f.match(vY);if(!v)return!1;var W=+v[1],J=+v[2],Q=+v[3];return J>=1&&J<=12&&Q>=1&&Q<=(J==2&&XY(W)?29:fY[J])}function PW(f,v){var W=f.match(QY);if(!W)return!1;var J=W[1],Q=W[2],X=W[3],Y=W[5];return(J<=23&&Q<=59&&X<=59||J==23&&Q==59&&X==60)&&(!v||Y)}var YY=/t|\s/i;function wY(f){var v=f.split(YY);return v.length==2&&qW(v[0])&&PW(v[1],!0)}var GY=/\/|:/;function BY(f){return GY.test(f)&&WY.test(f)}var qY=/[^\\]\\Z/;function HW(f){if(qY.test(f))return!1;try{return new RegExp(f),!0}catch(v){return!1}}});var $W=o((L4,LW)=>{LW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.errSchemaPath+"/"+W,z=!v.opts.allErrors,H="data"+(Y||""),$="valid"+X,K,q;if(w=="#"||w=="#/")if(v.isRoot)K=v.async,q="validate";else K=v.root.schema.$async===!0,q="root.refVal[0]";else{var L=v.resolveRef(v.baseId,w,v.isRoot);if(L===void 0){var V=v.MissingRefError.message(v.baseId,w);if(v.opts.missingRefs=="fail"){v.logger.error(V);var M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(B)+" , params: { ref: '"+v.util.escapeQuotes(w)+"' } ",v.opts.messages!==!1)Q+=" , message: 'can\\'t resolve reference "+v.util.escapeQuotes(w)+"' ";if(v.opts.verbose)Q+=" , schema: "+v.util.toQuotedString(w)+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+H+" ";Q+=" } "}else Q+=" {} ";var D=Q;if(Q=M.pop(),!v.compositeRule&&z)if(v.async)Q+=" throw new ValidationError(["+D+"]); ";else Q+=" validate.errors = ["+D+"]; return false; ";else Q+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(z)Q+=" if (false) { "}else if(v.opts.missingRefs=="ignore"){if(v.logger.warn(V),z)Q+=" if (true) { "}else throw new v.MissingRefError(v.baseId,w,V)}else if(L.inline){var y=v.util.copy(v);y.level++;var F="valid"+y.level;y.schema=L.schema,y.schemaPath="",y.errSchemaPath=w;var Z=v.validate(y).replace(/validate\.schema/g,L.code);if(Q+=" "+Z+" ",z)Q+=" if ("+F+") { "}else K=L.$async===!0||v.async&&L.$async!==!1,q=L.code}if(q){var M=M||[];if(M.push(Q),Q="",v.opts.passContext)Q+=" "+q+".call(this, ";else Q+=" "+q+"( ";if(Q+=" "+H+", (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var C=Y?"data"+(Y-1||""):"parentData",T=Y?v.dataPathArr[Y]:"parentDataProperty";Q+=" , "+C+" , "+T+", rootData) ";var O=Q;if(Q=M.pop(),K){if(!v.async)throw new Error("async schema referenced by sync schema");if(z)Q+=" var "+$+"; ";if(Q+=" try { await "+O+"; ",z)Q+=" "+$+" = true; ";if(Q+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",z)Q+=" "+$+" = false; ";if(Q+=" } ",z)Q+=" if ("+$+") { "}else if(Q+=" if (!"+O+") { if (vErrors === null) vErrors = "+q+".errors; else vErrors = vErrors.concat("+q+".errors); errors = vErrors.length; } ",z)Q+=" else { "}return Q}});var NW=o(($4,MW)=>{MW.exports=function f(v,W,J){var Q=" ",X=v.schema[W],Y=v.schemaPath+v.util.getProperty(W),w=v.errSchemaPath+"/"+W,B=!v.opts.allErrors,z=v.util.copy(v),H="";z.level++;var $="valid"+z.level,K=z.baseId,q=!0,L=X;if(L){var V,M=-1,D=L.length-1;while(M<D)if(V=L[M+=1],v.opts.strictKeywords?typeof V=="object"&&Object.keys(V).length>0||V===!1:v.util.schemaHasRules(V,v.RULES.all)){if(q=!1,z.schema=V,z.schemaPath=Y+"["+M+"]",z.errSchemaPath=w+"/"+M,Q+=" "+v.validate(z)+" ",z.baseId=K,B)Q+=" if ("+$+") { ",H+="}"}}if(B)if(q)Q+=" if (true) { ";else Q+=" "+H.slice(0,-1)+" ";return Q}});var EW=o((M4,VW)=>{VW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="valid"+X,q="errs__"+X,L=v.util.copy(v),V="";L.level++;var M="valid"+L.level,D=w.every(function(A){return v.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:v.util.schemaHasRules(A,v.RULES.all)});if(D){var y=L.baseId;Q+=" var "+q+" = errors; var "+K+" = false; ";var F=v.compositeRule;v.compositeRule=L.compositeRule=!0;var Z=w;if(Z){var C,T=-1,O=Z.length-1;while(T<O)C=Z[T+=1],L.schema=C,L.schemaPath=B+"["+T+"]",L.errSchemaPath=z+"/"+T,Q+=" "+v.validate(L)+" ",L.baseId=y,Q+=" "+K+" = "+K+" || "+M+"; if (!"+K+") { ",V+="}"}if(v.compositeRule=L.compositeRule=F,Q+=" "+V+" if (!"+K+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should match some schema in anyOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } else { errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else if(H)Q+=" if (true) { ";return Q}});var jW=o((N4,DW)=>{DW.exports=function f(v,W,J){var Q=" ",X=v.schema[W],Y=v.errSchemaPath+"/"+W,w=!v.opts.allErrors,B=v.util.toQuotedString(X);if(v.opts.$comment===!0)Q+=" console.log("+B+");";else if(typeof v.opts.$comment=="function")Q+=" self._opts.$comment("+B+", "+v.util.toQuotedString(Y)+", validate.root.schema);";return Q}});var UW=o((V4,OW)=>{OW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="valid"+X,q=v.opts.$data&&w&&w.$data,L;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",L="schema"+X;else L=w;if(!q)Q+=" var schema"+X+" = validate.schema"+B+";";Q+="var "+K+" = equal("+$+", schema"+X+"); if (!"+K+") { ";var V=V||[];if(V.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'const' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { allowedValue: schema"+X+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to constant' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var M=Q;if(Q=V.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+M+"]); ";else Q+=" validate.errors = ["+M+"]; return false; ";else Q+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",H)Q+=" else { ";return Q}});var FW=o((E4,hW)=>{hW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="valid"+X,q="errs__"+X,L=v.util.copy(v),V="";L.level++;var M="valid"+L.level,D="i"+X,y=L.dataLevel=v.dataLevel+1,F="data"+y,Z=v.baseId,C=v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all);if(Q+="var "+q+" = errors;var "+K+";",C){var T=v.compositeRule;v.compositeRule=L.compositeRule=!0,L.schema=w,L.schemaPath=B,L.errSchemaPath=z,Q+=" var "+M+" = false; for (var "+D+" = 0; "+D+" < "+$+".length; "+D+"++) { ",L.errorPath=v.util.getPathExpr(v.errorPath,D,v.opts.jsonPointers,!0);var O=$+"["+D+"]";L.dataPathArr[y]=D;var A=v.validate(L);if(L.baseId=Z,v.util.varOccurences(A,F)<2)Q+=" "+v.util.varReplace(A,F,O)+" ";else Q+=" var "+F+" = "+O+"; "+A+" ";Q+=" if ("+M+") break; } ",v.compositeRule=L.compositeRule=T,Q+=" "+V+" if (!"+M+") {"}else Q+=" if ("+$+".length == 0) {";var j=j||[];if(j.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should contain a valid item' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var _=Q;if(Q=j.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+_+"]); ";else Q+=" validate.errors = ["+_+"]; return false; ";else Q+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { ",C)Q+=" errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ";if(v.opts.allErrors)Q+=" } ";return Q}});var AW=o((D4,gW)=>{gW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="errs__"+X,q=v.util.copy(v),L="";q.level++;var V="valid"+q.level,M={},D={},y=v.opts.ownProperties;for(T in w){if(T=="__proto__")continue;var F=w[T],Z=Array.isArray(F)?D:M;Z[T]=F}Q+="var "+K+" = errors;";var C=v.errorPath;Q+="var missing"+X+";";for(var T in D)if(Z=D[T],Z.length){if(Q+=" if ( "+$+v.util.getProperty(T)+" !== undefined ",y)Q+=" && Object.prototype.hasOwnProperty.call("+$+", '"+v.util.escapeQuotes(T)+"') ";if(H){Q+=" && ( ";var O=Z;if(O){var A,j=-1,_=O.length-1;while(j<_){if(A=O[j+=1],j)Q+=" || ";var l=v.util.getProperty(A),R=$+l;if(Q+=" ( ( "+R+" === undefined ",y)Q+=" || ! Object.prototype.hasOwnProperty.call("+$+", '"+v.util.escapeQuotes(A)+"') ";Q+=") && (missing"+X+" = "+v.util.toQuotedString(v.opts.jsonPointers?A:l)+") ) "}}Q+=")) { ";var g="missing"+X,b="' + "+g+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(C,g,!0):C+" + "+g;var k=k||[];if(k.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { property: '"+v.util.escapeQuotes(T)+"', missingProperty: '"+b+"', depsCount: "+Z.length+", deps: '"+v.util.escapeQuotes(Z.length==1?Z[0]:Z.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",Z.length==1)Q+="property "+v.util.escapeQuotes(Z[0]);else Q+="properties "+v.util.escapeQuotes(Z.join(", "));Q+=" when property "+v.util.escapeQuotes(T)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var m=Q;if(Q=k.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+m+"]); ";else Q+=" validate.errors = ["+m+"]; return false; ";else Q+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{Q+=" ) { ";var c=Z;if(c){var A,d=-1,s=c.length-1;while(d<s){A=c[d+=1];var l=v.util.getProperty(A),b=v.util.escapeQuotes(A),R=$+l;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(C,A,v.opts.jsonPointers);if(Q+=" if ( "+R+" === undefined ",y)Q+=" || ! Object.prototype.hasOwnProperty.call("+$+", '"+v.util.escapeQuotes(A)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { property: '"+v.util.escapeQuotes(T)+"', missingProperty: '"+b+"', depsCount: "+Z.length+", deps: '"+v.util.escapeQuotes(Z.length==1?Z[0]:Z.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",Z.length==1)Q+="property "+v.util.escapeQuotes(Z[0]);else Q+="properties "+v.util.escapeQuotes(Z.join(", "));Q+=" when property "+v.util.escapeQuotes(T)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(Q+=" } ",H)L+="}",Q+=" else { "}v.errorPath=C;var n=q.baseId;for(var T in M){var F=M[T];if(v.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:v.util.schemaHasRules(F,v.RULES.all)){if(Q+=" "+V+" = true; if ( "+$+v.util.getProperty(T)+" !== undefined ",y)Q+=" && Object.prototype.hasOwnProperty.call("+$+", '"+v.util.escapeQuotes(T)+"') ";if(Q+=") { ",q.schema=F,q.schemaPath=B+v.util.getProperty(T),q.errSchemaPath=z+"/"+v.util.escapeFragment(T),Q+=" "+v.validate(q)+" ",q.baseId=n,Q+=" } ",H)Q+=" if ("+V+") { ",L+="}"}}if(H)Q+=" "+L+" if ("+K+" == errors) {";return Q}});var _W=o((j4,bW)=>{bW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="valid"+X,q=v.opts.$data&&w&&w.$data,L;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",L="schema"+X;else L=w;var V="i"+X,M="schema"+X;if(!q)Q+=" var "+M+" = validate.schema"+B+";";if(Q+="var "+K+";",q)Q+=" if (schema"+X+" === undefined) "+K+" = true; else if (!Array.isArray(schema"+X+")) "+K+" = false; else {";if(Q+=""+K+" = false;for (var "+V+"=0; "+V+"<"+M+".length; "+V+"++) if (equal("+$+", "+M+"["+V+"])) { "+K+" = true; break; }",q)Q+=" } ";Q+=" if (!"+K+") { ";var D=D||[];if(D.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { allowedValues: schema"+X+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to one of the allowed values' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var y=Q;if(Q=D.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+y+"]); ";else Q+=" validate.errors = ["+y+"]; return false; ";else Q+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",H)Q+=" else { ";return Q}});var kW=o((O4,RW)=>{RW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||"");if(v.opts.format===!1){if(H)Q+=" if (true) { ";return Q}var K=v.opts.$data&&w&&w.$data,q;if(K)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var L=v.opts.unknownFormats,V=Array.isArray(L);if(K){var M="format"+X,D="isObject"+X,y="formatType"+X;if(Q+=" var "+M+" = formats["+q+"]; var "+D+" = typeof "+M+" == 'object' && !("+M+" instanceof RegExp) && "+M+".validate; var "+y+" = "+D+" && "+M+".type || 'string'; if ("+D+") { ",v.async)Q+=" var async"+X+" = "+M+".async; ";if(Q+=" "+M+" = "+M+".validate; } if ( ",K)Q+=" ("+q+" !== undefined && typeof "+q+" != 'string') || ";if(Q+=" (",L!="ignore"){if(Q+=" ("+q+" && !"+M+" ",V)Q+=" && self._opts.unknownFormats.indexOf("+q+") == -1 ";Q+=") || "}if(Q+=" ("+M+" && "+y+" == '"+J+"' && !(typeof "+M+" == 'function' ? ",v.async)Q+=" (async"+X+" ? await "+M+"("+$+") : "+M+"("+$+")) ";else Q+=" "+M+"("+$+") ";Q+=" : "+M+".test("+$+"))))) {"}else{var M=v.formats[w];if(!M)if(L=="ignore"){if(v.logger.warn('unknown format "'+w+'" ignored in schema at path "'+v.errSchemaPath+'"'),H)Q+=" if (true) { ";return Q}else if(V&&L.indexOf(w)>=0){if(H)Q+=" if (true) { ";return Q}else throw new Error('unknown format "'+w+'" is used in schema at path "'+v.errSchemaPath+'"');var D=typeof M=="object"&&!(M instanceof RegExp)&&M.validate,y=D&&M.type||"string";if(D){var F=M.async===!0;M=M.validate}if(y!=J){if(H)Q+=" if (true) { ";return Q}if(F){if(!v.async)throw new Error("async format in sync schema");var Z="formats"+v.util.getProperty(w)+".validate";Q+=" if (!(await "+Z+"("+$+"))) { "}else{Q+=" if (! ";var Z="formats"+v.util.getProperty(w);if(D)Z+=".validate";if(typeof M=="function")Q+=" "+Z+"("+$+") ";else Q+=" "+Z+".test("+$+") ";Q+=") { "}}var C=C||[];if(C.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'format' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { format: ",K)Q+=""+q;else Q+=""+v.util.toQuotedString(w);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match format "`,K)Q+="' + "+q+" + '";else Q+=""+v.util.escapeQuotes(w);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",K)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(w);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" "}Q+=" } "}else Q+=" {} ";var T=Q;if(Q=C.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+T+"]); ";else Q+=" validate.errors = ["+T+"]; return false; ";else Q+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",H)Q+=" else { ";return Q}});var yW=o((U4,SW)=>{SW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="valid"+X,q="errs__"+X,L=v.util.copy(v);L.level++;var V="valid"+L.level,M=v.schema.then,D=v.schema.else,y=M!==void 0&&(v.opts.strictKeywords?typeof M=="object"&&Object.keys(M).length>0||M===!1:v.util.schemaHasRules(M,v.RULES.all)),F=D!==void 0&&(v.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:v.util.schemaHasRules(D,v.RULES.all)),Z=L.baseId;if(y||F){var C;L.createErrors=!1,L.schema=w,L.schemaPath=B,L.errSchemaPath=z,Q+=" var "+q+" = errors; var "+K+" = true; ";var T=v.compositeRule;if(v.compositeRule=L.compositeRule=!0,Q+=" "+v.validate(L)+" ",L.baseId=Z,L.createErrors=!0,Q+=" errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; } ",v.compositeRule=L.compositeRule=T,y){if(Q+=" if ("+V+") { ",L.schema=v.schema.then,L.schemaPath=v.schemaPath+".then",L.errSchemaPath=v.errSchemaPath+"/then",Q+=" "+v.validate(L)+" ",L.baseId=Z,Q+=" "+K+" = "+V+"; ",y&&F)C="ifClause"+X,Q+=" var "+C+" = 'then'; ";else C="'then'";if(Q+=" } ",F)Q+=" else { "}else Q+=" if (!"+V+") { ";if(F){if(L.schema=v.schema.else,L.schemaPath=v.schemaPath+".else",L.errSchemaPath=v.errSchemaPath+"/else",Q+=" "+v.validate(L)+" ",L.baseId=Z,Q+=" "+K+" = "+V+"; ",y&&F)C="ifClause"+X,Q+=" var "+C+" = 'else'; ";else C="'else'";Q+=" } "}if(Q+=" if (!"+K+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'if' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { failingKeyword: "+C+" } ",v.opts.messages!==!1)Q+=` , message: 'should match "' + `+C+` + '" schema' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } ",H)Q+=" else { "}else if(H)Q+=" if (true) { ";return Q}});var IW=o((h4,lW)=>{lW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="valid"+X,q="errs__"+X,L=v.util.copy(v),V="";L.level++;var M="valid"+L.level,D="i"+X,y=L.dataLevel=v.dataLevel+1,F="data"+y,Z=v.baseId;if(Q+="var "+q+" = errors;var "+K+";",Array.isArray(w)){var C=v.schema.additionalItems;if(C===!1){Q+=" "+K+" = "+$+".length <= "+w.length+"; ";var T=z;z=v.errSchemaPath+"/additionalItems",Q+=" if (!"+K+") { ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+w.length+" } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have more than "+w.length+" items' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var A=Q;if(Q=O.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+A+"]); ";else Q+=" validate.errors = ["+A+"]; return false; ";else Q+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",z=T,H)V+="}",Q+=" else { "}var j=w;if(j){var _,l=-1,R=j.length-1;while(l<R)if(_=j[l+=1],v.opts.strictKeywords?typeof _=="object"&&Object.keys(_).length>0||_===!1:v.util.schemaHasRules(_,v.RULES.all)){Q+=" "+M+" = true; if ("+$+".length > "+l+") { ";var g=$+"["+l+"]";L.schema=_,L.schemaPath=B+"["+l+"]",L.errSchemaPath=z+"/"+l,L.errorPath=v.util.getPathExpr(v.errorPath,l,v.opts.jsonPointers,!0),L.dataPathArr[y]=l;var b=v.validate(L);if(L.baseId=Z,v.util.varOccurences(b,F)<2)Q+=" "+v.util.varReplace(b,F,g)+" ";else Q+=" var "+F+" = "+g+"; "+b+" ";if(Q+=" } ",H)Q+=" if ("+M+") { ",V+="}"}}if(typeof C=="object"&&(v.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:v.util.schemaHasRules(C,v.RULES.all))){L.schema=C,L.schemaPath=v.schemaPath+".additionalItems",L.errSchemaPath=v.errSchemaPath+"/additionalItems",Q+=" "+M+" = true; if ("+$+".length > "+w.length+") { for (var "+D+" = "+w.length+"; "+D+" < "+$+".length; "+D+"++) { ",L.errorPath=v.util.getPathExpr(v.errorPath,D,v.opts.jsonPointers,!0);var g=$+"["+D+"]";L.dataPathArr[y]=D;var b=v.validate(L);if(L.baseId=Z,v.util.varOccurences(b,F)<2)Q+=" "+v.util.varReplace(b,F,g)+" ";else Q+=" var "+F+" = "+g+"; "+b+" ";if(H)Q+=" if (!"+M+") break; ";if(Q+=" } } ",H)Q+=" if ("+M+") { ",V+="}"}}else if(v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){L.schema=w,L.schemaPath=B,L.errSchemaPath=z,Q+=" for (var "+D+" = 0; "+D+" < "+$+".length; "+D+"++) { ",L.errorPath=v.util.getPathExpr(v.errorPath,D,v.opts.jsonPointers,!0);var g=$+"["+D+"]";L.dataPathArr[y]=D;var b=v.validate(L);if(L.baseId=Z,v.util.varOccurences(b,F)<2)Q+=" "+v.util.varReplace(b,F,g)+" ";else Q+=" var "+F+" = "+g+"; "+b+" ";if(H)Q+=" if (!"+M+") break; ";Q+=" }"}if(H)Q+=" "+V+" if ("+q+" == errors) {";return Q}});var $Q=o((F4,ZW)=>{ZW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,Z,$="data"+(Y||""),K=v.opts.$data&&w&&w.$data,q;if(K)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var L=W=="maximum",V=L?"exclusiveMaximum":"exclusiveMinimum",M=v.schema[V],D=v.opts.$data&&M&&M.$data,y=L?"<":">",F=L?">":"<",Z=void 0;if(!(K||typeof w=="number"||w===void 0))throw new Error(W+" must be number");if(!(D||M===void 0||typeof M=="number"||typeof M=="boolean"))throw new Error(V+" must be number or boolean");if(D){var C=v.util.getData(M.$data,Y,v.dataPathArr),T="exclusive"+X,O="exclType"+X,A="exclIsNumber"+X,j="op"+X,_="' + "+j+" + '";Q+=" var schemaExcl"+X+" = "+C+"; ",C="schemaExcl"+X,Q+=" var "+T+"; var "+O+" = typeof "+C+"; if ("+O+" != 'boolean' && "+O+" != 'undefined' && "+O+" != 'number') { ";var Z=V,l=l||[];if(l.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(Z||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: '"+V+" should be boolean' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var R=Q;if(Q=l.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+R+"]); ";else Q+=" validate.errors = ["+R+"]; return false; ";else Q+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else if ( ",K)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";if(Q+=" "+O+" == 'number' ? ( ("+T+" = "+q+" === undefined || "+C+" "+y+"= "+q+") ? "+$+" "+F+"= "+C+" : "+$+" "+F+" "+q+" ) : ( ("+T+" = "+C+" === true) ? "+$+" "+F+"= "+q+" : "+$+" "+F+" "+q+" ) || "+$+" !== "+$+") { var op"+X+" = "+T+" ? '"+y+"' : '"+y+"='; ",w===void 0)Z=V,z=v.errSchemaPath+"/"+V,q=C,K=D}else{var A=typeof M=="number",_=y;if(A&&K){var j="'"+_+"'";if(Q+=" if ( ",K)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" ( "+q+" === undefined || "+M+" "+y+"= "+q+" ? "+$+" "+F+"= "+M+" : "+$+" "+F+" "+q+" ) || "+$+" !== "+$+") { "}else{if(A&&w===void 0)T=!0,Z=V,z=v.errSchemaPath+"/"+V,q=M,F+="=";else{if(A)q=Math[L?"min":"max"](M,w);if(M===(A?q:!0))T=!0,Z=V,z=v.errSchemaPath+"/"+V,F+="=";else T=!1,_+="="}var j="'"+_+"'";if(Q+=" if ( ",K)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" "+$+" "+F+" "+q+" || "+$+" !== "+$+") { "}}Z=Z||W;var l=l||[];if(l.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(Z||"_limit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { comparison: "+j+", limit: "+q+", exclusive: "+T+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be "+_+" ",K)Q+="' + "+q;else Q+=""+q+"'";if(v.opts.verbose){if(Q+=" , schema: ",K)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" "}Q+=" } "}else Q+=" {} ";var R=Q;if(Q=l.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+R+"]); ";else Q+=" validate.errors = ["+R+"]; return false; ";else Q+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",H)Q+=" else { ";return Q}});var MQ=o((g4,CW)=>{CW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,V,$="data"+(Y||""),K=v.opts.$data&&w&&w.$data,q;if(K)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(K||typeof w=="number"))throw new Error(W+" must be number");var L=W=="maxItems"?">":"<";if(Q+="if ( ",K)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" "+$+".length "+L+" "+q+") { ";var V=W,M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(V||"_limitItems")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxItems")Q+="more";else Q+="fewer";if(Q+=" than ",K)Q+="' + "+q+" + '";else Q+=""+w;Q+=" items' "}if(v.opts.verbose){if(Q+=" , schema: ",K)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" "}Q+=" } "}else Q+=" {} ";var D=Q;if(Q=M.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+D+"]); ";else Q+=" validate.errors = ["+D+"]; return false; ";else Q+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",H)Q+=" else { ";return Q}});var NQ=o((A4,TW)=>{TW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,V,$="data"+(Y||""),K=v.opts.$data&&w&&w.$data,q;if(K)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(K||typeof w=="number"))throw new Error(W+" must be number");var L=W=="maxLength"?">":"<";if(Q+="if ( ",K)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";if(v.opts.unicode===!1)Q+=" "+$+".length ";else Q+=" ucs2length("+$+") ";Q+=" "+L+" "+q+") { ";var V=W,M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(V||"_limitLength")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT be ",W=="maxLength")Q+="longer";else Q+="shorter";if(Q+=" than ",K)Q+="' + "+q+" + '";else Q+=""+w;Q+=" characters' "}if(v.opts.verbose){if(Q+=" , schema: ",K)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" "}Q+=" } "}else Q+=" {} ";var D=Q;if(Q=M.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+D+"]); ";else Q+=" validate.errors = ["+D+"]; return false; ";else Q+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",H)Q+=" else { ";return Q}});var VQ=o((b4,xW)=>{xW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,V,$="data"+(Y||""),K=v.opts.$data&&w&&w.$data,q;if(K)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(K||typeof w=="number"))throw new Error(W+" must be number");var L=W=="maxProperties"?">":"<";if(Q+="if ( ",K)Q+=" ("+q+" !== undefined && typeof "+q+" != 'number') || ";Q+=" Object.keys("+$+").length "+L+" "+q+") { ";var V=W,M=M||[];if(M.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(V||"_limitProperties")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { limit: "+q+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxProperties")Q+="more";else Q+="fewer";if(Q+=" than ",K)Q+="' + "+q+" + '";else Q+=""+w;Q+=" properties' "}if(v.opts.verbose){if(Q+=" , schema: ",K)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" "}Q+=" } "}else Q+=" {} ";var D=Q;if(Q=M.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+D+"]); ";else Q+=" validate.errors = ["+D+"]; return false; ";else Q+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",H)Q+=" else { ";return Q}});var rW=o((_4,uW)=>{uW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K=v.opts.$data&&w&&w.$data,q;if(K)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;if(!(K||typeof w=="number"))throw new Error(W+" must be number");if(Q+="var division"+X+";if (",K)Q+=" "+q+" !== undefined && ( typeof "+q+" != 'number' || ";if(Q+=" (division"+X+" = "+$+" / "+q+", ",v.opts.multipleOfPrecision)Q+=" Math.abs(Math.round(division"+X+") - division"+X+") > 1e-"+v.opts.multipleOfPrecision+" ";else Q+=" division"+X+" !== parseInt(division"+X+") ";if(Q+=" ) ",K)Q+=" ) ";Q+=" ) { ";var L=L||[];if(L.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { multipleOf: "+q+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be multiple of ",K)Q+="' + "+q;else Q+=""+q+"'";if(v.opts.verbose){if(Q+=" , schema: ",K)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" "}Q+=" } "}else Q+=" {} ";var V=Q;if(Q=L.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+V+"]); ";else Q+=" validate.errors = ["+V+"]; return false; ";else Q+=" var err = "+V+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",H)Q+=" else { ";return Q}});var aW=o((R4,mW)=>{mW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="errs__"+X,q=v.util.copy(v);q.level++;var L="valid"+q.level;if(v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){q.schema=w,q.schemaPath=B,q.errSchemaPath=z,Q+=" var "+K+" = errors; ";var V=v.compositeRule;v.compositeRule=q.compositeRule=!0,q.createErrors=!1;var M;if(q.opts.allErrors)M=q.opts.allErrors,q.opts.allErrors=!1;if(Q+=" "+v.validate(q)+" ",q.createErrors=!0,M)q.opts.allErrors=M;v.compositeRule=q.compositeRule=V,Q+=" if ("+L+") { ";var D=D||[];if(D.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var y=Q;if(Q=D.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+y+"]); ";else Q+=" validate.errors = ["+y+"]; return false; ";else Q+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { errors = "+K+"; if (vErrors !== null) { if ("+K+") vErrors.length = "+K+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else{if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",H)Q+=" if (false) { "}return Q}});var nW=o((k4,cW)=>{cW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="valid"+X,q="errs__"+X,L=v.util.copy(v),V="";L.level++;var M="valid"+L.level,D=L.baseId,y="prevValid"+X,F="passingSchemas"+X;Q+="var "+q+" = errors , "+y+" = false , "+K+" = false , "+F+" = null; ";var Z=v.compositeRule;v.compositeRule=L.compositeRule=!0;var C=w;if(C){var T,O=-1,A=C.length-1;while(O<A){if(T=C[O+=1],v.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:v.util.schemaHasRules(T,v.RULES.all))L.schema=T,L.schemaPath=B+"["+O+"]",L.errSchemaPath=z+"/"+O,Q+=" "+v.validate(L)+" ",L.baseId=D;else Q+=" var "+M+" = true; ";if(O)Q+=" if ("+M+" && "+y+") { "+K+" = false; "+F+" = ["+F+", "+O+"]; } else { ",V+="}";Q+=" if ("+M+") { "+K+" = "+y+" = true; "+F+" = "+O+"; }"}}if(v.compositeRule=L.compositeRule=Z,Q+=""+V+"if (!"+K+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { passingSchemas: "+F+" } ",v.opts.messages!==!1)Q+=" , message: 'should match exactly one schema in oneOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+="} else { errors = "+q+"; if (vErrors !== null) { if ("+q+") vErrors.length = "+q+"; else vErrors = null; }",v.opts.allErrors)Q+=" } ";return Q}});var iW=o((S4,pW)=>{pW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K=v.opts.$data&&w&&w.$data,q;if(K)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",q="schema"+X;else q=w;var L=K?"(new RegExp("+q+"))":v.usePattern(w);if(Q+="if ( ",K)Q+=" ("+q+" !== undefined && typeof "+q+" != 'string') || ";Q+=" !"+L+".test("+$+") ) { ";var V=V||[];if(V.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { pattern: ",K)Q+=""+q;else Q+=""+v.util.toQuotedString(w);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match pattern "`,K)Q+="' + "+q+" + '";else Q+=""+v.util.escapeQuotes(w);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",K)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(w);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" "}Q+=" } "}else Q+=" {} ";var M=Q;if(Q=V.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+M+"]); ";else Q+=" validate.errors = ["+M+"]; return false; ";else Q+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",H)Q+=" else { ";return Q}});var oW=o((y4,dW)=>{dW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="errs__"+X,q=v.util.copy(v),L="";q.level++;var V="valid"+q.level,M="key"+X,D="idx"+X,y=q.dataLevel=v.dataLevel+1,F="data"+y,Z="dataProperties"+X,C=Object.keys(w||{}).filter(d),T=v.schema.patternProperties||{},O=Object.keys(T).filter(d),A=v.schema.additionalProperties,j=C.length||O.length,_=A===!1,l=typeof A=="object"&&Object.keys(A).length,R=v.opts.removeAdditional,g=_||l||R,b=v.opts.ownProperties,k=v.baseId,m=v.schema.required;if(m&&!(v.opts.$data&&m.$data)&&m.length<v.opts.loopRequired)var c=v.util.toHash(m);function d(dv){return dv!=="__proto__"}if(Q+="var "+K+" = errors;var "+V+" = true;",b)Q+=" var "+Z+" = undefined;";if(g){if(b)Q+=" "+Z+" = "+Z+" || Object.keys("+$+"); for (var "+D+"=0; "+D+"<"+Z+".length; "+D+"++) { var "+M+" = "+Z+"["+D+"]; ";else Q+=" for (var "+M+" in "+$+") { ";if(j){if(Q+=" var isAdditional"+X+" = !(false ",C.length)if(C.length>8)Q+=" || validate.schema"+B+".hasOwnProperty("+M+") ";else{var s=C;if(s){var n,Vv=-1,_v=s.length-1;while(Vv<_v)n=s[Vv+=1],Q+=" || "+M+" == "+v.util.toQuotedString(n)+" "}}if(O.length){var Sv=O;if(Sv){var Yv,jv=-1,gv=Sv.length-1;while(jv<gv)Yv=Sv[jv+=1],Q+=" || "+v.usePattern(Yv)+".test("+M+") "}}Q+=" ); if (isAdditional"+X+") { "}if(R=="all")Q+=" delete "+$+"["+M+"]; ";else{var yv=v.errorPath,Vf="' + "+M+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(v.errorPath,M,v.opts.jsonPointers);if(_)if(R)Q+=" delete "+$+"["+M+"]; ";else{Q+=" "+V+" = false; ";var Pf=z;z=v.errSchemaPath+"/additionalProperties";var Ov=Ov||[];if(Ov.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { additionalProperty: '"+Vf+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is an invalid additional property";else Q+="should NOT have additional properties";Q+="' "}if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var Ev=Q;if(Q=Ov.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+Ev+"]); ";else Q+=" validate.errors = ["+Ev+"]; return false; ";else Q+=" var err = "+Ev+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(z=Pf,H)Q+=" break; "}else if(l)if(R=="failing"){Q+=" var "+K+" = errors; ";var _f=v.compositeRule;v.compositeRule=q.compositeRule=!0,q.schema=A,q.schemaPath=v.schemaPath+".additionalProperties",q.errSchemaPath=v.errSchemaPath+"/additionalProperties",q.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,M,v.opts.jsonPointers);var Rv=$+"["+M+"]";q.dataPathArr[y]=M;var Gv=v.validate(q);if(q.baseId=k,v.util.varOccurences(Gv,F)<2)Q+=" "+v.util.varReplace(Gv,F,Rv)+" ";else Q+=" var "+F+" = "+Rv+"; "+Gv+" ";Q+=" if (!"+V+") { errors = "+K+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+$+"["+M+"]; } ",v.compositeRule=q.compositeRule=_f}else{q.schema=A,q.schemaPath=v.schemaPath+".additionalProperties",q.errSchemaPath=v.errSchemaPath+"/additionalProperties",q.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,M,v.opts.jsonPointers);var Rv=$+"["+M+"]";q.dataPathArr[y]=M;var Gv=v.validate(q);if(q.baseId=k,v.util.varOccurences(Gv,F)<2)Q+=" "+v.util.varReplace(Gv,F,Rv)+" ";else Q+=" var "+F+" = "+Rv+"; "+Gv+" ";if(H)Q+=" if (!"+V+") break; "}v.errorPath=yv}if(j)Q+=" } ";if(Q+=" } ",H)Q+=" if ("+V+") { ",L+="}"}var Ef=v.opts.useDefaults&&!v.compositeRule;if(C.length){var Hf=C;if(Hf){var n,Rf=-1,kf=Hf.length-1;while(Rf<kf){n=Hf[Rf+=1];var Av=w[n];if(v.opts.strictKeywords?typeof Av=="object"&&Object.keys(Av).length>0||Av===!1:v.util.schemaHasRules(Av,v.RULES.all)){var av=v.util.getProperty(n),Rv=$+av,Zv=Ef&&Av.default!==void 0;q.schema=Av,q.schemaPath=B+av,q.errSchemaPath=z+"/"+v.util.escapeFragment(n),q.errorPath=v.util.getPath(v.errorPath,n,v.opts.jsonPointers),q.dataPathArr[y]=v.util.toQuotedString(n);var Gv=v.validate(q);if(q.baseId=k,v.util.varOccurences(Gv,F)<2){Gv=v.util.varReplace(Gv,F,Rv);var lv=Rv}else{var lv=F;Q+=" var "+F+" = "+Rv+"; "}if(Zv)Q+=" "+Gv+" ";else{if(c&&c[n]){if(Q+=" if ( "+lv+" === undefined ",b)Q+=" || ! Object.prototype.hasOwnProperty.call("+$+", '"+v.util.escapeQuotes(n)+"') ";Q+=") { "+V+" = false; ";var yv=v.errorPath,Pf=z,Jf=v.util.escapeQuotes(n);if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(yv,n,v.opts.jsonPointers);z=v.errSchemaPath+"/required";var Ov=Ov||[];if(Ov.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+Jf+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+Jf+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var Ev=Q;if(Q=Ov.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+Ev+"]); ";else Q+=" validate.errors = ["+Ev+"]; return false; ";else Q+=" var err = "+Ev+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";z=Pf,v.errorPath=yv,Q+=" } else { "}else if(H){if(Q+=" if ( "+lv+" === undefined ",b)Q+=" || ! Object.prototype.hasOwnProperty.call("+$+", '"+v.util.escapeQuotes(n)+"') ";Q+=") { "+V+" = true; } else { "}else{if(Q+=" if ("+lv+" !== undefined ",b)Q+=" && Object.prototype.hasOwnProperty.call("+$+", '"+v.util.escapeQuotes(n)+"') ";Q+=" ) { "}Q+=" "+Gv+" } "}}if(H)Q+=" if ("+V+") { ",L+="}"}}}if(O.length){var uv=O;if(uv){var Yv,y1=-1,S0=uv.length-1;while(y1<S0){Yv=uv[y1+=1];var Av=T[Yv];if(v.opts.strictKeywords?typeof Av=="object"&&Object.keys(Av).length>0||Av===!1:v.util.schemaHasRules(Av,v.RULES.all)){if(q.schema=Av,q.schemaPath=v.schemaPath+".patternProperties"+v.util.getProperty(Yv),q.errSchemaPath=v.errSchemaPath+"/patternProperties/"+v.util.escapeFragment(Yv),b)Q+=" "+Z+" = "+Z+" || Object.keys("+$+"); for (var "+D+"=0; "+D+"<"+Z+".length; "+D+"++) { var "+M+" = "+Z+"["+D+"]; ";else Q+=" for (var "+M+" in "+$+") { ";Q+=" if ("+v.usePattern(Yv)+".test("+M+")) { ",q.errorPath=v.util.getPathExpr(v.errorPath,M,v.opts.jsonPointers);var Rv=$+"["+M+"]";q.dataPathArr[y]=M;var Gv=v.validate(q);if(q.baseId=k,v.util.varOccurences(Gv,F)<2)Q+=" "+v.util.varReplace(Gv,F,Rv)+" ";else Q+=" var "+F+" = "+Rv+"; "+Gv+" ";if(H)Q+=" if (!"+V+") break; ";if(Q+=" } ",H)Q+=" else "+V+" = true; ";if(Q+=" } ",H)Q+=" if ("+V+") { ",L+="}"}}}}if(H)Q+=" "+L+" if ("+K+" == errors) {";return Q}});var tW=o((l4,sW)=>{sW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="errs__"+X,q=v.util.copy(v),L="";q.level++;var V="valid"+q.level;if(Q+="var "+K+" = errors;",v.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:v.util.schemaHasRules(w,v.RULES.all)){q.schema=w,q.schemaPath=B,q.errSchemaPath=z;var M="key"+X,D="idx"+X,y="i"+X,F="' + "+M+" + '",Z=q.dataLevel=v.dataLevel+1,C="data"+Z,T="dataProperties"+X,O=v.opts.ownProperties,A=v.baseId;if(O)Q+=" var "+T+" = undefined; ";if(O)Q+=" "+T+" = "+T+" || Object.keys("+$+"); for (var "+D+"=0; "+D+"<"+T+".length; "+D+"++) { var "+M+" = "+T+"["+D+"]; ";else Q+=" for (var "+M+" in "+$+") { ";Q+=" var startErrs"+X+" = errors; ";var j=M,_=v.compositeRule;v.compositeRule=q.compositeRule=!0;var l=v.validate(q);if(q.baseId=A,v.util.varOccurences(l,C)<2)Q+=" "+v.util.varReplace(l,C,j)+" ";else Q+=" var "+C+" = "+j+"; "+l+" ";if(v.compositeRule=q.compositeRule=_,Q+=" if (!"+V+") { for (var "+y+"=startErrs"+X+"; "+y+"<errors; "+y+"++) { vErrors["+y+"].propertyName = "+M+"; } var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { propertyName: '"+F+"' } ",v.opts.messages!==!1)Q+=" , message: 'property name \\'"+F+"\\' is invalid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(H)Q+=" break; ";Q+=" } }"}if(H)Q+=" "+L+" if ("+K+" == errors) {";return Q}});var v9=o((I4,eW)=>{eW.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="valid"+X,q=v.opts.$data&&w&&w.$data,L;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",L="schema"+X;else L=w;var V="schema"+X;if(!q)if(w.length<v.opts.loopRequired&&v.schema.properties&&Object.keys(v.schema.properties).length){var M=[],D=w;if(D){var y,F=-1,Z=D.length-1;while(F<Z){y=D[F+=1];var C=v.schema.properties[y];if(!(C&&(v.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:v.util.schemaHasRules(C,v.RULES.all))))M[M.length]=y}}}else var M=w;if(q||M.length){var T=v.errorPath,O=q||M.length>=v.opts.loopRequired,A=v.opts.ownProperties;if(H)if(Q+=" var missing"+X+"; ",O){if(!q)Q+=" var "+V+" = validate.schema"+B+"; ";var j="i"+X,_="schema"+X+"["+j+"]",l="' + "+_+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(T,_,v.opts.jsonPointers);if(Q+=" var "+K+" = true; ",q)Q+=" if (schema"+X+" === undefined) "+K+" = true; else if (!Array.isArray(schema"+X+")) "+K+" = false; else {";if(Q+=" for (var "+j+" = 0; "+j+" < "+V+".length; "+j+"++) { "+K+" = "+$+"["+V+"["+j+"]] !== undefined ",A)Q+=" && Object.prototype.hasOwnProperty.call("+$+", "+V+"["+j+"]) ";if(Q+="; if (!"+K+") break; } ",q)Q+=" } ";Q+=" if (!"+K+") { ";var R=R||[];if(R.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+l+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+l+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var g=Q;if(Q=R.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+g+"]); ";else Q+=" validate.errors = ["+g+"]; return false; ";else Q+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else{Q+=" if ( ";var b=M;if(b){var k,j=-1,m=b.length-1;while(j<m){if(k=b[j+=1],j)Q+=" || ";var c=v.util.getProperty(k),d=$+c;if(Q+=" ( ( "+d+" === undefined ",A)Q+=" || ! Object.prototype.hasOwnProperty.call("+$+", '"+v.util.escapeQuotes(k)+"') ";Q+=") && (missing"+X+" = "+v.util.toQuotedString(v.opts.jsonPointers?k:c)+") ) "}}Q+=") { ";var _="missing"+X,l="' + "+_+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(T,_,!0):T+" + "+_;var R=R||[];if(R.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+l+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+l+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";var g=Q;if(Q=R.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+g+"]); ";else Q+=" validate.errors = ["+g+"]; return false; ";else Q+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else if(O){if(!q)Q+=" var "+V+" = validate.schema"+B+"; ";var j="i"+X,_="schema"+X+"["+j+"]",l="' + "+_+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(T,_,v.opts.jsonPointers);if(q){if(Q+=" if ("+V+" && !Array.isArray("+V+")) { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+l+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+l+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+V+" !== undefined) { "}if(Q+=" for (var "+j+" = 0; "+j+" < "+V+".length; "+j+"++) { if ("+$+"["+V+"["+j+"]] === undefined ",A)Q+=" || ! Object.prototype.hasOwnProperty.call("+$+", "+V+"["+j+"]) ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+l+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+l+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",q)Q+=" } "}else{var s=M;if(s){var k,n=-1,Vv=s.length-1;while(n<Vv){k=s[n+=1];var c=v.util.getProperty(k),l=v.util.escapeQuotes(k),d=$+c;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(T,k,v.opts.jsonPointers);if(Q+=" if ( "+d+" === undefined ",A)Q+=" || ! Object.prototype.hasOwnProperty.call("+$+", '"+v.util.escapeQuotes(k)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { missingProperty: '"+l+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+l+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}v.errorPath=T}else if(H)Q+=" if (true) {";return Q}});var Q9=o((Z4,f9)=>{f9.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$="data"+(Y||""),K="valid"+X,q=v.opts.$data&&w&&w.$data,L;if(q)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",L="schema"+X;else L=w;if((w||q)&&v.opts.uniqueItems!==!1){if(q)Q+=" var "+K+"; if ("+L+" === false || "+L+" === undefined) "+K+" = true; else if (typeof "+L+" != 'boolean') "+K+" = false; else { ";Q+=" var i = "+$+".length , "+K+" = true , j; if (i > 1) { ";var V=v.schema.items&&v.schema.items.type,M=Array.isArray(V);if(!V||V=="object"||V=="array"||M&&(V.indexOf("object")>=0||V.indexOf("array")>=0))Q+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+$+"[i], "+$+"[j])) { "+K+" = false; break outer; } } } ";else{Q+=" var itemIndices = {}, item; for (;i--;) { var item = "+$+"[i]; ";var D="checkDataType"+(M?"s":"");if(Q+=" if ("+v.util[D](V,"item",v.opts.strictNumbers,!0)+") continue; ",M)Q+=` if (typeof item == 'string') item = '"' + item; `;Q+=" if (typeof itemIndices[item] == 'number') { "+K+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(Q+=" } ",q)Q+=" } ";Q+=" if (!"+K+") { ";var y=y||[];if(y.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { i: i, j: j } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(v.opts.verbose){if(Q+=" , schema: ",q)Q+="validate.schema"+B;else Q+=""+w;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+$+" "}Q+=" } "}else Q+=" {} ";var F=Q;if(Q=y.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",H)Q+=" else { "}else if(H)Q+=" if (true) { ";return Q}});var J9=o((C4,W9)=>{W9.exports={$ref:$W(),allOf:NW(),anyOf:EW(),$comment:jW(),const:UW(),contains:FW(),dependencies:AW(),enum:_W(),format:kW(),if:yW(),items:IW(),maximum:$Q(),minimum:$Q(),maxItems:MQ(),minItems:MQ(),maxLength:NQ(),minLength:NQ(),maxProperties:VQ(),minProperties:VQ(),multipleOf:rW(),not:aW(),oneOf:nW(),pattern:iW(),properties:oW(),propertyNames:tW(),required:v9(),uniqueItems:Q9(),validate:zQ()}});var w9=o((T4,Y9)=>{var X9=J9(),EQ=uf().toHash;Y9.exports=function f(){var v=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],W=["type","$comment"],J=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],Q=["number","integer","string","array","object","boolean","null"];return v.all=EQ(W),v.types=EQ(Q),v.forEach(function(X){if(X.rules=X.rules.map(function(Y){var w;if(typeof Y=="object"){var B=Object.keys(Y)[0];w=Y[B],Y=B,w.forEach(function(H){W.push(H),v.all[H]=!0})}W.push(Y);var z=v.all[Y]={keyword:Y,code:X9[Y],implements:w};return z}),v.all.$comment={keyword:"$comment",code:X9.$comment},X.type)v.types[X.type]=X}),v.keywords=EQ(W.concat(J)),v.custom={},v}});var q9=o((x4,B9)=>{var G9=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];B9.exports=function(f,v){for(var W=0;W<v.length;W++){f=JSON.parse(JSON.stringify(f));var J=v[W].split("/"),Q=f,X;for(X=1;X<J.length;X++)Q=Q[J[X]];for(X=0;X<G9.length;X++){var Y=G9[X],w=Q[Y];if(w)Q[Y]={anyOf:[w,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return f}});var K9=o((u4,H9)=>{var PY=K0().MissingRef;H9.exports=P9;function P9(f,v,W){var J=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof v=="function")W=v,v=void 0;var Q=X(f).then(function(){var w=J._addSchema(f,void 0,v);return w.validate||Y(w)});if(W)Q.then(function(w){W(null,w)},W);return Q;function X(w){var B=w.$schema;return B&&!J.getSchema(B)?P9.call(J,{$ref:B},!0):Promise.resolve()}function Y(w){try{return J._compile(w)}catch(z){if(z instanceof PY)return B(z);throw z}function B(z){var H=z.missingSchema;if(q(H))throw new Error("Schema "+H+" is loaded but "+z.missingRef+" cannot be resolved");var $=J._loadingSchemas[H];if(!$)$=J._loadingSchemas[H]=J._opts.loadSchema(H),$.then(K,K);return $.then(function(L){if(!q(H))return X(L).then(function(){if(!q(H))J.addSchema(L,H,void 0,v)})}).then(function(){return Y(w)});function K(){delete J._loadingSchemas[H]}function q(L){return J._refs[L]||J._schemas[L]}}}}});var L9=o((r4,z9)=>{z9.exports=function f(v,W,J){var Q=" ",X=v.level,Y=v.dataLevel,w=v.schema[W],B=v.schemaPath+v.util.getProperty(W),z=v.errSchemaPath+"/"+W,H=!v.opts.allErrors,$,K="data"+(Y||""),q="valid"+X,L="errs__"+X,V=v.opts.$data&&w&&w.$data,M;if(V)Q+=" var schema"+X+" = "+v.util.getData(w.$data,Y,v.dataPathArr)+"; ",M="schema"+X;else M=w;var D=this,y="definition"+X,F=D.definition,Z="",C,T,O,A,j;if(V&&F.$data){j="keywordValidate"+X;var _=F.validateSchema;Q+=" var "+y+" = RULES.custom['"+W+"'].definition; var "+j+" = "+y+".validate;"}else{if(A=v.useCustomRule(D,w,v.schema,v),!A)return;M="validate.schema"+B,j=A.code,C=F.compile,T=F.inline,O=F.macro}var l=j+".errors",R="i"+X,g="ruleErr"+X,b=F.async;if(b&&!v.async)throw new Error("async keyword in sync schema");if(!(T||O))Q+=""+l+" = null;";if(Q+="var "+L+" = errors;var "+q+";",V&&F.$data){if(Z+="}",Q+=" if ("+M+" === undefined) { "+q+" = true; } else { ",_)Z+="}",Q+=" "+q+" = "+y+".validateSchema("+M+"); if ("+q+") { "}if(T)if(F.statements)Q+=" "+A.validate+" ";else Q+=" "+q+" = "+A.validate+"; ";else if(O){var k=v.util.copy(v),Z="";k.level++;var m="valid"+k.level;k.schema=A.validate,k.schemaPath="";var c=v.compositeRule;v.compositeRule=k.compositeRule=!0;var d=v.validate(k).replace(/validate\.schema/g,j);v.compositeRule=k.compositeRule=c,Q+=" "+d}else{var s=s||[];if(s.push(Q),Q="",Q+=" "+j+".call( ",v.opts.passContext)Q+="this";else Q+="self";if(C||F.schema===!1)Q+=" , "+K+" ";else Q+=" , "+M+" , "+K+" , validate.schema"+v.schemaPath+" ";if(Q+=" , (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var n=Y?"data"+(Y-1||""):"parentData",Vv=Y?v.dataPathArr[Y]:"parentDataProperty";Q+=" , "+n+" , "+Vv+" , rootData ) ";var _v=Q;if(Q=s.pop(),F.errors===!1){if(Q+=" "+q+" = ",b)Q+="await ";Q+=""+_v+"; "}else if(b)l="customErrors"+X,Q+=" var "+l+" = null; try { "+q+" = await "+_v+"; } catch (e) { "+q+" = false; if (e instanceof ValidationError) "+l+" = e.errors; else throw e; } ";else Q+=" "+l+" = null; "+q+" = "+_v+"; "}if(F.modifying)Q+=" if ("+n+") "+K+" = "+n+"["+Vv+"];";if(Q+=""+Z,F.valid){if(H)Q+=" if (true) { "}else{if(Q+=" if ( ",F.valid===void 0)if(Q+=" !",O)Q+=""+m;else Q+=""+q;else Q+=" "+!F.valid+" ";Q+=") { ",$=D.keyword;var s=s||[];s.push(Q),Q="";var s=s||[];if(s.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+($||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { keyword: '"+D.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+D.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+K+" ";Q+=" } "}else Q+=" {} ";var Sv=Q;if(Q=s.pop(),!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(["+Sv+"]); ";else Q+=" validate.errors = ["+Sv+"]; return false; ";else Q+=" var err = "+Sv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Yv=Q;if(Q=s.pop(),T)if(F.errors){if(F.errors!="full"){if(Q+=" for (var "+R+"="+L+"; "+R+"<errors; "+R+"++) { var "+g+" = vErrors["+R+"]; if ("+g+".dataPath === undefined) "+g+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+g+".schemaPath === undefined) { "+g+'.schemaPath = "'+z+'"; } ',v.opts.verbose)Q+=" "+g+".schema = "+M+"; "+g+".data = "+K+"; ";Q+=" } "}}else if(F.errors===!1)Q+=" "+Yv+" ";else{if(Q+=" if ("+L+" == errors) { "+Yv+" } else { for (var "+R+"="+L+"; "+R+"<errors; "+R+"++) { var "+g+" = vErrors["+R+"]; if ("+g+".dataPath === undefined) "+g+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+g+".schemaPath === undefined) { "+g+'.schemaPath = "'+z+'"; } ',v.opts.verbose)Q+=" "+g+".schema = "+M+"; "+g+".data = "+K+"; ";Q+=" } } "}else if(O){if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: '"+($||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(z)+" , params: { keyword: '"+D.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+D.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+K+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&H)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; "}else if(F.errors===!1)Q+=" "+Yv+" ";else{if(Q+=" if (Array.isArray("+l+")) { if (vErrors === null) vErrors = "+l+"; else vErrors = vErrors.concat("+l+"); errors = vErrors.length; for (var "+R+"="+L+"; "+R+"<errors; "+R+"++) { var "+g+" = vErrors["+R+"]; if ("+g+".dataPath === undefined) "+g+".dataPath = (dataPath || '') + "+v.errorPath+"; "+g+'.schemaPath = "'+z+'"; ',v.opts.verbose)Q+=" "+g+".schema = "+M+"; "+g+".data = "+K+"; ";Q+=" } } else { "+Yv+" } "}if(Q+=" } ",H)Q+=" else { "}return Q}});var DQ=o((m4,HY)=>{HY.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var N9=o((a4,M9)=>{var $9=DQ();M9.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:$9.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:$9.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var E9=o((c4,V9)=>{var KY=/^[a-z_$][a-z0-9_$-]*$/i,zY=L9(),LY=N9();V9.exports={add:$Y,get:MY,remove:NY,validate:jQ};function $Y(f,v){var W=this.RULES;if(W.keywords[f])throw new Error("Keyword "+f+" is already defined");if(!KY.test(f))throw new Error("Keyword "+f+" is not a valid identifier");if(v){this.validateKeyword(v,!0);var J=v.type;if(Array.isArray(J))for(var Q=0;Q<J.length;Q++)Y(f,J[Q],v);else Y(f,J,v);var X=v.metaSchema;if(X){if(v.$data&&this._opts.$data)X={anyOf:[X,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};v.validateSchema=this.compile(X,!0)}}W.keywords[f]=W.all[f]=!0;function Y(w,B,z){var H;for(var $=0;$<W.length;$++){var K=W[$];if(K.type==B){H=K;break}}if(!H)H={type:B,rules:[]},W.push(H);var q={keyword:w,definition:z,custom:!0,code:zY,implements:z.implements};H.rules.push(q),W.custom[w]=q}return this}function MY(f){var v=this.RULES.custom[f];return v?v.definition:this.RULES.keywords[f]||!1}function NY(f){var v=this.RULES;delete v.keywords[f],delete v.all[f],delete v.custom[f];for(var W=0;W<v.length;W++){var J=v[W].rules;for(var Q=0;Q<J.length;Q++)if(J[Q].keyword==f){J.splice(Q,1);break}}return this}function jQ(f,v){jQ.errors=null;var W=this._validateKeyword=this._validateKeyword||this.compile(LY,!0);if(W(f))return!0;if(jQ.errors=W.errors,v)throw new Error("custom keyword definition is invalid: "+this.errorsText(W.errors));else return!1}});var D9=o((n4,VY)=>{VY.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var R9=o((p4,_9)=>{var O9=vW(),rf=H0(),EY=QW(),U9=wQ(),DY=KQ(),jY=zW(),OY=w9(),h9=q9(),F9=uf();_9.exports=Dv;Dv.prototype.validate=hY;Dv.prototype.compile=FY;Dv.prototype.addSchema=gY;Dv.prototype.addMetaSchema=AY;Dv.prototype.validateSchema=bY;Dv.prototype.getSchema=RY;Dv.prototype.removeSchema=SY;Dv.prototype.addFormat=uY;Dv.prototype.errorsText=xY;Dv.prototype._addSchema=yY;Dv.prototype._compile=lY;Dv.prototype.compileAsync=K9();var D0=E9();Dv.prototype.addKeyword=D0.add;Dv.prototype.getKeyword=D0.get;Dv.prototype.removeKeyword=D0.remove;Dv.prototype.validateKeyword=D0.validate;var g9=K0();Dv.ValidationError=g9.Validation;Dv.MissingRefError=g9.MissingRef;Dv.$dataMetaSchema=h9;var E0="http://json-schema.org/draft-07/schema",j9=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],UY=["/properties"];function Dv(f){if(!(this instanceof Dv))return new Dv(f);if(f=this._opts=F9.copy(f)||{},pY(this),this._schemas={},this._refs={},this._fragments={},this._formats=jY(f.format),this._cache=f.cache||new EY,this._loadingSchemas={},this._compilations=[],this.RULES=OY(),this._getId=IY(f),f.loopRequired=f.loopRequired||1/0,f.errorDataPath=="property")f._errorDataPathProperty=!0;if(f.serialize===void 0)f.serialize=DY;if(this._metaOpts=nY(this),f.formats)aY(this);if(f.keywords)cY(this);if(rY(this),typeof f.meta=="object")this.addMetaSchema(f.meta);if(f.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});mY(this)}function hY(f,v){var W;if(typeof f=="string"){if(W=this.getSchema(f),!W)throw new Error('no schema with key or ref "'+f+'"')}else{var J=this._addSchema(f);W=J.validate||this._compile(J)}var Q=W(v);if(W.$async!==!0)this.errors=W.errors;return Q}function FY(f,v){var W=this._addSchema(f,void 0,v);return W.validate||this._compile(W)}function gY(f,v,W,J){if(Array.isArray(f)){for(var Q=0;Q<f.length;Q++)this.addSchema(f[Q],void 0,W,J);return this}var X=this._getId(f);if(X!==void 0&&typeof X!="string")throw new Error("schema id must be string");return v=rf.normalizeId(v||X),b9(this,v),this._schemas[v]=this._addSchema(f,W,J,!0),this}function AY(f,v,W){return this.addSchema(f,v,W,!0),this}function bY(f,v){var W=f.$schema;if(W!==void 0&&typeof W!="string")throw new Error("$schema must be a string");if(W=W||this._opts.defaultMeta||_Y(this),!W)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var J=this.validate(W,f);if(!J&&v){var Q="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(Q);else throw new Error(Q)}return J}function _Y(f){var v=f._opts.meta;return f._opts.defaultMeta=typeof v=="object"?f._getId(v)||v:f.getSchema(E0)?E0:void 0,f._opts.defaultMeta}function RY(f){var v=A9(this,f);switch(typeof v){case"object":return v.validate||this._compile(v);case"string":return this.getSchema(v);case"undefined":return kY(this,f)}}function kY(f,v){var W=rf.schema.call(f,{schema:{}},v);if(W){var{schema:J,root:Q,baseId:X}=W,Y=O9.call(f,J,Q,void 0,X);return f._fragments[v]=new U9({ref:v,fragment:!0,schema:J,root:Q,baseId:X,validate:Y}),Y}}function A9(f,v){return v=rf.normalizeId(v),f._schemas[v]||f._refs[v]||f._fragments[v]}function SY(f){if(f instanceof RegExp)return V0(this,this._schemas,f),V0(this,this._refs,f),this;switch(typeof f){case"undefined":return V0(this,this._schemas),V0(this,this._refs),this._cache.clear(),this;case"string":var v=A9(this,f);if(v)this._cache.del(v.cacheKey);return delete this._schemas[f],delete this._refs[f],this;case"object":var W=this._opts.serialize,J=W?W(f):f;this._cache.del(J);var Q=this._getId(f);if(Q)Q=rf.normalizeId(Q),delete this._schemas[Q],delete this._refs[Q]}return this}function V0(f,v,W){for(var J in v){var Q=v[J];if(!Q.meta&&(!W||W.test(J)))f._cache.del(Q.cacheKey),delete v[J]}}function yY(f,v,W,J){if(typeof f!="object"&&typeof f!="boolean")throw new Error("schema should be object or boolean");var Q=this._opts.serialize,X=Q?Q(f):f,Y=this._cache.get(X);if(Y)return Y;J=J||this._opts.addUsedSchema!==!1;var w=rf.normalizeId(this._getId(f));if(w&&J)b9(this,w);var B=this._opts.validateSchema!==!1&&!v,z;if(B&&!(z=w&&w==rf.normalizeId(f.$schema)))this.validateSchema(f,!0);var H=rf.ids.call(this,f),$=new U9({id:w,schema:f,localRefs:H,cacheKey:X,meta:W});if(w[0]!="#"&&J)this._refs[w]=$;if(this._cache.put(X,$),B&&z)this.validateSchema(f,!0);return $}function lY(f,v){if(f.compiling){if(f.validate=Q,Q.schema=f.schema,Q.errors=null,Q.root=v?v:Q,f.schema.$async===!0)Q.$async=!0;return Q}f.compiling=!0;var W;if(f.meta)W=this._opts,this._opts=this._metaOpts;var J;try{J=O9.call(this,f.schema,v,f.localRefs)}catch(X){throw delete f.validate,X}finally{if(f.compiling=!1,f.meta)this._opts=W}return f.validate=J,f.refs=J.refs,f.refVal=J.refVal,f.root=J.root,J;function Q(){var X=f.validate,Y=X.apply(this,arguments);return Q.errors=X.errors,Y}}function IY(f){switch(f.schemaId){case"auto":return TY;case"id":return ZY;default:return CY}}function ZY(f){if(f.$id)this.logger.warn("schema $id ignored",f.$id);return f.id}function CY(f){if(f.id)this.logger.warn("schema id ignored",f.id);return f.$id}function TY(f){if(f.$id&&f.id&&f.$id!=f.id)throw new Error("schema $id is different from id");return f.$id||f.id}function xY(f,v){if(f=f||this.errors,!f)return"No errors";v=v||{};var W=v.separator===void 0?", ":v.separator,J=v.dataVar===void 0?"data":v.dataVar,Q="";for(var X=0;X<f.length;X++){var Y=f[X];if(Y)Q+=J+Y.dataPath+" "+Y.message+W}return Q.slice(0,-W.length)}function uY(f,v){if(typeof v=="string")v=new RegExp(v);return this._formats[f]=v,this}function rY(f){var v;if(f._opts.$data)v=D9(),f.addMetaSchema(v,v.$id,!0);if(f._opts.meta===!1)return;var W=DQ();if(f._opts.$data)W=h9(W,UY);f.addMetaSchema(W,E0,!0),f._refs["http://json-schema.org/schema"]=E0}function mY(f){var v=f._opts.schemas;if(!v)return;if(Array.isArray(v))f.addSchema(v);else for(var W in v)f.addSchema(v[W],W)}function aY(f){for(var v in f._opts.formats){var W=f._opts.formats[v];f.addFormat(v,W)}}function cY(f){for(var v in f._opts.keywords){var W=f._opts.keywords[v];f.addKeyword(v,W)}}function b9(f,v){if(f._schemas[v]||f._refs[v])throw new Error('schema with key or id "'+v+'" already exists')}function nY(f){var v=F9.copy(f._opts);for(var W=0;W<j9.length;W++)delete v[j9[W]];return v}function pY(f){var v=f._opts.logger;if(v===!1)f.logger={log:OQ,warn:OQ,error:OQ};else{if(v===void 0)v=console;if(!(typeof v=="object"&&v.log&&v.warn&&v.error))throw new Error("logger must implement log, warn and error methods");f.logger=v}}function OQ(){}});var q7=(f)=>{let{idPattern:v,entityName:W}=f,J=(B)=>{return v.test(B)};return Object.freeze({isId:J,validateId:(B)=>{return J(B)},resolve:(B)=>{if(J(B))return{kind:"id",value:B};return{kind:"path",value:B}},getPattern:()=>{return v},getEntityName:()=>{return W}})},P7,yQ;var $J=Df(()=>{P7=Object.freeze({create:q7}),yQ=P7});var b0,_0,lQ=(f)=>{if(b0.isId(f))return"project";if(_0.isId(f))return"shared";return},H7=(f)=>{return b0.isId(f)||_0.isId(f)},MJ=(f)=>{return f==="project"?b0:_0},K7=(f,v)=>{return MJ(v).validateId(f)},z7,xv;var H1=Df(()=>{$J();b0=yQ.create({idPattern:/^doc\d{3,}$/,entityName:"project-doc"}),_0=yQ.create({idPattern:/^sdoc\d{3,}$/,entityName:"shared-doc"}),z7=Object.freeze({project:b0,shared:_0,detectScopeFromId:lQ,isdocId:H7,getResolverForScope:MJ,validateIdForScope:K7}),xv=z7});import{resolve as UJ,relative as FJ,normalize as h7,isAbsolute as gJ}from"path";import{realpath as hJ,lstat as F7}from"fs/promises";var Wf=(f,v,W)=>{let J=new Error(v);return J.name=f,J.code=f,J.details=W,J},AJ=(f)=>{if(!f)throw Wf("VALIDATION_ERROR","Empty path");if(gJ(f))throw Wf("VALIDATION_ERROR","Absolute path not allowed",{path:f});let v=h7(f).replaceAll("\\","/");if(v.split("/").some((J)=>J===".."))throw Wf("BOUNDARY_VIOLATION","Path contains ..",{path:f});return v},IQ=(f,v)=>{let W=FJ(f,v);return W!==""&&!W.startsWith("..")&&!gJ(W)},g7=async(f,v,W)=>{let J=AJ(v),Q=UJ(f),X=UJ(Q,J);if(W?.followSymlinks)try{X=await hJ(X)}catch(w){if(w.code!=="ENOENT")throw w}else try{if((await F7(X)).isSymbolicLink()){let B=await hJ(X);if(!IQ(Q,B))throw Wf("BOUNDARY_VIOLATION",`Symlink target escapes boundary: '${v}' \u2192 '${B}'`,{path:v,resolved:X,target:B})}}catch(w){if(w.code!=="ENOENT"&&w.code!=="BOUNDARY_VIOLATION")throw w;if(w.code==="BOUNDARY_VIOLATION")throw w}if(!IQ(Q,X)&&X!==Q)throw Wf("BOUNDARY_VIOLATION",`Path escapes boundary: '${v}' \u2192 '${X}'`,{path:v,resolved:X,boundary:Q});let Y=FJ(Q,X).replaceAll("\\","/");return{abs:X,rel:Y}},A7=(f,v)=>{let W=f.code,J=v?.path?v.resolved?`'${v.path}' \u2192 '${v.resolved}'`:`'${v.path}'`:"";switch(W){case"ENOENT":return Wf("NOT_FOUND",`File or directory not found${J?`: ${J}`:""}`,{...v,originalCode:W});case"ENOTEMPTY":return Wf("DIRECTORY_NOT_EMPTY",`Directory not empty${J?`: ${J}`:""}`,{...v,originalCode:W});case"ENOTDIR":case"EISDIR":return Wf("VALIDATION_ERROR",`Invalid path type${J?`: ${J}`:""}`,{...v,originalCode:W,reason:W==="ENOTDIR"?"not a directory":"is a directory"});case"EACCES":case"EPERM":return Wf("FS_ERROR",`Permission denied${J?`: ${J}`:""}`,{...v,originalCode:W});case"EBUSY":return Wf("FS_ERROR",`Resource busy or locked${J?`: ${J}`:""}`,{...v,originalCode:W});default:if(v)f.context=v;return f}},b7,Wv;var ZQ=Df(()=>{b7=Object.freeze({fsError:Wf,validateRelative:AJ,insideBoundary:IQ,resolveWithinBoundary:g7,mapOsError:A7}),Wv=b7});import{readFile as _7,writeFile as R7,unlink as bJ,stat as CQ,rename as k7,access as S7,mkdir as y7}from"fs/promises";import{constants as l7}from"fs";import{resolve as I7,dirname as TQ,isAbsolute as Z7}from"path";var C7=(f)=>{let{boundaryDir:v}=f;if(!v)throw Wv.fsError("VALIDATION_ERROR","boundaryDir is required (empty string)",{boundaryDir:v});if(!Z7(v))throw Wv.fsError("VALIDATION_ERROR",`boundaryDir must be an absolute path: '${v}'`,{boundaryDir:v});let W=I7(v),J=async(K)=>{let{abs:q}=await Wv.resolveWithinBoundary(W,K);return q},Q=async(K)=>{let q=await J(K);try{return await S7(q,l7.F_OK),!0}catch{return!1}},X=async(K)=>{let q=await J(K);try{return await CQ(q)}catch(L){throw Wv.mapOsError(L,{path:K,resolved:q,operation:"stat"})}},Y=async(K)=>{let q=await J(K),L;try{L=await CQ(q)}catch(V){throw Wv.mapOsError(V,{path:K,resolved:q,operation:"stat"})}if(!L.isFile())throw Wv.fsError("VALIDATION_ERROR","Target is not a regular file",{path:K,resolved:q});try{return await _7(q,"utf-8")}catch(V){throw Wv.mapOsError(V,{path:K,resolved:q,operation:"readFile"})}},w=async(K,q)=>{let L=await J(K),V;try{V=await CQ(L)}catch(D){if(D.code==="ENOENT")V=null;else throw Wv.mapOsError(D,{path:K,resolved:L,operation:"stat"})}if(V&&!V.isFile())throw Wv.fsError("VALIDATION_ERROR","Target path exists and is not a regular file",{path:K,resolved:L});try{await y7(TQ(L),{recursive:!0})}catch(D){throw Wv.mapOsError(D,{path:TQ(K),resolved:TQ(L),operation:"mkdir"})}let M=`${L}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{await R7(M,q,{encoding:"utf-8",mode:384}),await k7(M,L)}catch(D){try{await bJ(M)}catch{}throw Wv.mapOsError(D,{path:K,resolved:L,operation:"writeText"})}},B=async(K)=>{let q=await J(K);try{return await bJ(q),{deleted:!0}}catch(L){if(L.code==="ENOENT")return{deleted:!1};throw Wv.mapOsError(L,{path:K,resolved:q,operation:"delete"})}},z=(K,q,L)=>{for(let D=0;D<q.length;D++){let{oldText:y}=q[D];if(y.length===0)throw Wv.fsError("VALIDATION_ERROR",`Empty oldText in replacement at index ${D} would cause infinite loop`,{index:D})}let V=K,M=0;for(let{oldText:D,newText:y}of q)if(V.includes(D))V=V.replace(D,y),M++;if(L?.requireAll&&M!==q.length)throw Wv.fsError("VALIDATION_ERROR",`Only ${M} of ${q.length} replacements were applied (requireAll=true)`,{applied:M,total:q.length});return{wouldContent:V,applied:M}};return Object.freeze({exists:Q,stat:X,readText:Y,resolveSafe:async(K)=>{return Wv.resolveWithinBoundary(W,K)},writeText:w,delete:B,previewReplaceFirst:z,applyReplaceFirst:async(K,q,L)=>{let V=await Y(K),{wouldContent:M,applied:D}=z(V,q,L);if(D===0)return{applied:0};return await w(K,M),{applied:D}}})},T7,xQ;var _J=Df(()=>{ZQ();T7=Object.freeze({create:C7}),xQ=T7});import{mkdir as x7,rm as u7,rmdir as r7,stat as RJ,readdir as m7}from"fs/promises";import{resolve as kJ,dirname as a7,isAbsolute as SJ}from"path";var c7=(f)=>{let{boundaryDir:v}=f;if(!v)throw Wv.fsError("VALIDATION_ERROR","boundaryDir is required (empty string)",{boundaryDir:v});if(!SJ(v))throw Wv.fsError("VALIDATION_ERROR",`boundaryDir must be an absolute path: '${v}'`,{boundaryDir:v});let W=kJ(v),J=(H)=>{let $=H.toLowerCase().replace(/[^a-z0-9-_]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if(!$)throw Wv.fsError("VALIDATION_ERROR",`normalizeName produced empty result from input: '${H}'`,{name:H,normalized:$});return $},Q=async(H,$)=>{return await Wv.resolveWithinBoundary(W,H,$)};return Object.freeze({normalizeName:J,resolve:Q,isInsideBoundary:(H)=>{if(!SJ(H))throw Wv.fsError("VALIDATION_ERROR",`targetAbs must be an absolute path: '${H}'`,{targetAbs:H});let $=kJ(H);return Wv.insideBoundary(W,$)},ensureDir:async(H)=>{let{abs:$}=await Q(H);try{await x7($,{recursive:!0})}catch(K){throw Wv.mapOsError(K,{path:H,resolved:$,operation:"ensureDir"})}},parentDir:(H)=>{let $=Wv.validateRelative(H),K=a7($);return K==="."?K:K.replaceAll("\\","/")},stat:async(H)=>{let{abs:$}=await Q(H);try{return await RJ($)}catch(K){throw Wv.mapOsError(K,{path:H,resolved:$,operation:"stat"})}},deleteDir:async(H,$)=>{if($?.requireEmpty&&$?.recursive)throw Wv.fsError("VALIDATION_ERROR","requireEmpty and recursive are mutually exclusive",{path:H});let{abs:K}=await Q(H);if(K===W)throw Wv.fsError("VALIDATION_ERROR",`Cannot delete boundary root: '${H}' \u2192 '${K}'`,{path:H,resolved:K,boundary:W});let q;try{q=await RJ(K)}catch(L){if(L.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};throw Wv.mapOsError(L,{path:H,resolved:K,operation:"stat"})}if(!q.isDirectory())return{deleted:!1,reason:"NOT_DIR"};if($?.requireEmpty){let L;try{L=await m7(K)}catch(V){throw Wv.mapOsError(V,{path:H,resolved:K,operation:"readdir"})}if(L.length>0)throw Wv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty: '${H}' \u2192 '${K}'`,{path:H,resolved:K});try{return await r7(K),{deleted:!0}}catch(V){if(V.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};if(V.code==="ENOTEMPTY")throw Wv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty (race condition): '${H}' \u2192 '${K}'`,{path:H,resolved:K});throw Wv.mapOsError(V,{path:H,resolved:K,operation:"rmdir"})}}try{return await u7(K,{recursive:$?.recursive??!1}),{deleted:!0}}catch(L){if(L.code==="ENOENT")return{deleted:!1,reason:"NOT_FOUND"};if(L.code==="ENOTEMPTY"||L.code==="EISDIR"||L.code==="EACCES")throw Wv.fsError("DIRECTORY_NOT_EMPTY",`Directory not empty: '${H}' \u2192 '${K}'`,{path:H,resolved:K,originalCode:L.code});throw Wv.mapOsError(L,{path:H,resolved:K,operation:"deleteDir"})}}})},n7,uQ;var yJ=Df(()=>{ZQ();n7=Object.freeze({create:c7}),uQ=n7});import{dirname as p7}from"path";var lJ="---",Fv=(f,v,W)=>{let J=new Error(v);if(J.code=f,W!==void 0)J.data=W;throw J},i7=(f)=>{let{fileServiceByScope:v,folderServiceByScope:W,indexFilename:J}=f,Q=(O)=>{if(O==="project")return v.project;if(O==="shared")return v.shared;return Fv("INVALID_SCOPE",`Unknown scope '${O}'`,{scope:O})},X=(O)=>{if(O==="project")return W.project;if(O==="shared")return W.shared;return Fv("INVALID_SCOPE",`Unknown scope '${O}'`,{scope:O})},Y=async(O)=>{if(O.scope)return{scope:O.scope};if(O.kind==="id"){let j=lQ(O.id);if(!j)Fv("INVALID_ID_FORMAT",`Invalid doc ID format: '${O.id}'. Expected docNNN or sdocNNN`,{id:O.id});return{scope:j}}if(O.kind==="path"){try{let j=await B("project");if(Object.entries(j.index).find(([l,R])=>R===O.path))return{scope:"project"}}catch{}try{let j=await B("shared");if(Object.entries(j.index).find(([l,R])=>R===O.path))return{scope:"shared",fallback:!0}}catch{}return{scope:"project"}}let A=O;return Fv("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(A)}`)},w=(O)=>{return J},B=async(O)=>{let A=w(O),j=Q(O);try{let _=await j.readText(A);return JSON.parse(_)}catch(_){if(_.code==="NOT_FOUND")return{};throw _}},z=async(O,A)=>{let j=w(O),_=Q(O),l=JSON.stringify(A,null,2);await _.writeText(j,l)},H=(O)=>{let A=O.split(`
3
+ `);if(A.length<3||A[0].trim()!==lJ)return{bodyContent:O};let j=-1;for(let k=1;k<A.length;k++)if(A[k].trim()===lJ){j=k;break}if(j===-1)return{bodyContent:O};let _=A.slice(1,j),l=A.slice(0,j+1).join(`
4
+ `),R=A.slice(j+1).join(`
5
+ `).trim(),g=(k)=>{if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);return k},b={};for(let k of _){let m=k.indexOf(":");if(m===-1)continue;let c=k.slice(0,m).trim(),d=k.slice(m+1).trim();b[c]=g(d)}return{rawFrontMatter:l,frontMatter:Object.keys(b).length>0?b:void 0,bodyContent:R}},$=(O,A)=>{switch(A.op){case"replaceOnce":{let{oldText:j,newText:_}=A;if(!O.includes(j))return{newContent:O,applied:!1};return{newContent:O.replace(j,_),applied:!0}}case"replaceAll":{let{oldText:j,newText:_}=A;if(!O.includes(j))return{newContent:O,applied:!1};let l=new RegExp(j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");return{newContent:O.replace(l,_),applied:!0}}case"replaceRegex":{let{pattern:j,flags:_,replacement:l}=A,R=new RegExp(j,_);if(!R.test(O))return{newContent:O,applied:!1};return{newContent:O.replace(R,l),applied:!0}}case"replaceAllContent":{let{content:j}=A;return{newContent:j,applied:!0}}default:{let j=A;return Fv("VALIDATION_ERROR",`Unknown edit operation: ${JSON.stringify(j)}`)}}},K=(O)=>{return xv.isdocId(O)},q=(O)=>{if(!O||O.trim().length===0)return{valid:!1,reason:"Path cannot be empty"};if(O.startsWith("/"))return{valid:!1,reason:"Path must be relative (no leading slash)"};if(O.includes(".."))return{valid:!1,reason:'Path cannot contain ".." segments'};let j=O.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");if(/[<>:"|?*\0]/.test(j))return{valid:!1,reason:"Path contains invalid characters"};return{valid:!0,normalized:j}},L=(O)=>{let{scope:A,path:j}=O;if(A!=="project"&&A!=="shared")Fv("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${A}'`,{scope:A});let _=q(j);if(!_.valid)Fv("INVALID_PATH_FORMAT",_.reason,{path:j});return{scope:A,path:_.normalized}},V=async(O)=>{let{scope:A}=await Y(O),j=X(A),_;if(O.kind==="path")_=L({...O,scope:A}).path;else{let{id:R}=O;if(!K(R))Fv("INVALID_ID_FORMAT",`ID must match pattern doc\\d{3,} or sdoc\\d{3,}, got '${R}'`,{id:R});let g=await B(A);if(!g[R])Fv("doc_NOT_FOUND",`No doc with ID '${R}' in scope '${A}'`,{id:R,scope:A});_=g[R]}return{...await j.resolve(_),scope:A}},M=async(O)=>{if(O!=="project"&&O!=="shared")Fv("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${O}'`,{scope:O});let A=await B(O),j=O==="project"?"doc":"sdoc",_=new RegExp(`^${j}(\\d{3,})$`),l=0;for(let b of Object.keys(A)){let k=b.match(_);if(k){let m=parseInt(k[1],10);if(m>l)l=m}}let R=l+1;return`${j}${R.toString().padStart(3,"0")}`},D=async(O)=>{let{address:A,content:j}=O;if(A.kind!=="path")Fv("VALIDATION_ERROR","Create requires path-based addressing");let _=A.scope??"project",l=L({...A,scope:_}),{path:R}=l;if(xv.isdocId(R))Fv("INVALID_PATH_FORMAT",`Cannot create doc with path '${R}' - matches ID pattern`,{path:R,scope:_});let g=Q(_),b=X(_),k=await M(_);if(await g.exists(R))Fv("doc_ALREADY_EXISTS",`doc already exists at path '${R}'`,{path:R,scope:_});let c=p7(R);if(c!==".")await b.ensureDir(c);await g.writeText(R,j);let d=await B(_);return d[k]=R,await z(_,d),{id:k,path:R}},y=async(O)=>{let{rel:A,scope:j}=await V(O),l=await Q(j).readText(A),{frontMatter:R,bodyContent:g,rawFrontMatter:b}=H(l),k,m;if(O.kind==="path"){k=L({...O,scope:j}).path;let d=await B(j),s=Object.keys(d).find((n)=>d[n]===k);if(!s)return Fv("doc_NOT_FOUND",`doc exists but not in index: '${k}'`,{path:k,scope:j});m=s}else if(O.kind==="id"){m=O.id;let d=(await B(j))[m];if(!d)return Fv("doc_NOT_FOUND",`No doc with ID '${m}'`,{id:m,scope:j});k=d}else{let c=O;return Fv("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(c)}`)}return{address:O,content:l,frontMatter:R,bodyContent:g,path:k,id:m}},F=async(O,A)=>{let{rel:j,scope:_}=await V(O),l=Q(_),g=await l.readText(j),b=0;for(let k of A){let{newContent:m,applied:c}=$(g,k);if(g=m,c)b++}if(b===0)return{applied:0};return await l.writeText(j,g),{applied:b}},Z=async(O)=>{let{rel:A,scope:j}=await V(O),_=await(async()=>{if(O.kind==="id")return O.id;else if(O.kind==="path"){let k=L({...O,scope:j}),m=await B(j),c=Object.keys(m).find((d)=>m[d]===k.path);if(!c)return Fv("doc_NOT_FOUND",`doc not in index: '${k.path}'`,{path:k.path,scope:j});return c}else{let b=O;return Fv("VALIDATION_ERROR",`Unknown address kind: ${JSON.stringify(b)}`)}})(),l=Q(j),R=!1;try{R=(await l.delete(A)).deleted}catch(b){if(b.code==="NOT_FOUND")R=!1;else throw b}let g=await B(j);if(g[_])delete g[_],await z(j,g);return{deleted:R}},C=async(O)=>{let{scope:A,pathPrefix:j,includeContent:_=!1}=O;if(A){if(A!=="project"&&A!=="shared")Fv("INVALID_SCOPE",`Scope must be 'project' or 'shared', got '${A}'`,{scope:A});return await T(A,j,_)}let l=await T("project",j,_),R=await T("shared",j,_),g=new Set(l.map((m)=>m.path)),b=new Set(R.map((m)=>m.path));for(let m of l)if(b.has(m.path))m.override="overrides";for(let m of R)if(g.has(m.path))m.override="overridden";let k=[...l,...R];return k.sort((m,c)=>m.path.localeCompare(c.path)),k},T=async(O,A,j=!1)=>{let _=Q(O),l;try{l=await B(O)}catch(g){if(g.code==="NOT_FOUND"||g.code==="ENOENT")return[];throw g}let R=[];for(let[g,b]of Object.entries(l)){if(A&&!b.startsWith(A))continue;try{if(j){let k=await _.readText(b),m=await _.stat(b),{frontMatter:c}=H(k);R.push({scope:O,id:g,path:b,synopsis:c?.synopsis,modifiedAt:m.mtime})}else{let k=await _.stat(b);R.push({scope:O,id:g,path:b,modifiedAt:k.mtime})}}catch{continue}}return R.sort((g,b)=>g.path.localeCompare(b.path)),R};return Object.freeze({create:D,read:y,editLatest:F,deleteLatest:Z,list:C})},d7,IJ;var ZJ=Df(()=>{H1();d7=Object.freeze({create:i7}),IJ=d7});import{resolve as R0,dirname as o7}from"path";import{homedir as s7}from"os";import{existsSync as t7}from"fs";var e7=(f=process.cwd())=>{let v=R0(f),W=R0("/"),J=R0(s7(),".swic");while(v!==W){let Q=R0(v,".swic");if(Q===J)throw new Error("Not in a project directory (found ~/.swic instead). Run swic from within a project.");if(t7(Q))return Q;v=o7(v)}throw new Error("Could not find .swic directory. Are you in a SWIC project?")},CJ;var TJ=Df(()=>{CJ=Object.freeze({findProjectRoot:e7})});var rJ={};v8(rJ,{default:()=>Y2});import{mkdirSync as xJ}from"fs";import{resolve as uJ}from"path";import{homedir as v2}from"os";var k0="docs",f2=".index.json",Q2=(f,v)=>{try{xJ(f,{recursive:!0}),xJ(v,{recursive:!0})}catch(W){let J=W instanceof Error?W.message:String(W);throw new Error(`Failed to create swic directories. Please check permissions.
6
6
  Project: ${f}
7
7
  Shared: ${v}
8
- Error: ${J}`)}},J2=()=>{let f;try{f=TJ.findProjectRoot()}catch{f=mJ(process.cwd(),".swic")}let v=mJ(f2(),".swic"),W=`${f}/${k0}`,J=`${v}/${k0}`;return W2(W,J),{projectDataDir:f,sharedDataDir:v}},X2=(f)=>{let{projectBoundaryDir:v,sharedBoundaryDir:W}=f,J=`${v}/${k0}`,Q=`${W}/${k0}`,X=xQ.create({boundaryDir:J}),Y=xQ.create({boundaryDir:Q}),w=uQ.create({boundaryDir:J}),B=uQ.create({boundaryDir:Q}),z=ZJ.create({fileServiceByScope:{project:X,shared:Y},folderServiceByScope:{project:w,shared:B},indexFilename:Q2});return Object.freeze({DocService:z})},Y2,w2;var aJ=Ef(()=>{RJ();lJ();CJ();xJ();Y2=Object.freeze({createServices:X2,lazilyGetDataDirs:J2}),w2=Y2});var G={};v8(G,{void:()=>v5,util:()=>Qv,unknown:()=>t6,union:()=>J5,undefined:()=>d6,tuple:()=>w5,transformer:()=>N5,symbol:()=>i6,string:()=>B8,strictObject:()=>W5,setErrorMap:()=>D6,set:()=>q5,record:()=>G5,quotelessJson:()=>N6,promise:()=>M5,preprocess:()=>j5,pipeline:()=>E5,ostring:()=>O5,optional:()=>V5,onumber:()=>U5,oboolean:()=>H5,objectUtil:()=>C0,object:()=>Q5,number:()=>q8,nullable:()=>D5,null:()=>o6,never:()=>e6,nativeEnum:()=>L5,nan:()=>c6,map:()=>B5,makeIssue:()=>j1,literal:()=>z5,lazy:()=>K5,late:()=>r6,isValid:()=>Of,isDirty:()=>T1,isAsync:()=>tf,isAborted:()=>C1,intersection:()=>Y5,instanceof:()=>a6,getParsedType:()=>wf,getErrorMap:()=>sf,function:()=>P5,enum:()=>$5,effect:()=>N5,discriminatedUnion:()=>X5,defaultErrorMap:()=>Mf,datetimeRegex:()=>Y8,date:()=>p6,custom:()=>G8,coerce:()=>F5,boolean:()=>P8,bigint:()=>n6,array:()=>f5,any:()=>s6,addIssueToContext:()=>u,ZodVoid:()=>O1,ZodUnknown:()=>Uf,ZodUnion:()=>J1,ZodUndefined:()=>Q1,ZodType:()=>vv,ZodTuple:()=>Bf,ZodTransformer:()=>vf,ZodSymbol:()=>E1,ZodString:()=>ov,ZodSet:()=>Tf,ZodSchema:()=>vv,ZodRecord:()=>U1,ZodReadonly:()=>P1,ZodPromise:()=>xf,ZodPipeline:()=>A1,ZodParsedType:()=>x,ZodOptional:()=>tv,ZodObject:()=>Dv,ZodNumber:()=>Hf,ZodNullable:()=>Vf,ZodNull:()=>W1,ZodNever:()=>Gf,ZodNativeEnum:()=>G1,ZodNaN:()=>F1,ZodMap:()=>H1,ZodLiteral:()=>w1,ZodLazy:()=>Y1,ZodIssueCode:()=>Z,ZodIntersection:()=>X1,ZodFunction:()=>v1,ZodFirstPartyTypeKind:()=>C,ZodError:()=>Cv,ZodEnum:()=>Af,ZodEffects:()=>vf,ZodDiscriminatedUnion:()=>x1,ZodDefault:()=>B1,ZodDate:()=>Zf,ZodCatch:()=>q1,ZodBranded:()=>u1,ZodBoolean:()=>f1,ZodBigInt:()=>Ff,ZodArray:()=>sv,ZodAny:()=>Cf,Schema:()=>vv,ParseStatus:()=>hv,OK:()=>kv,NEVER:()=>A5,INVALID:()=>d,EMPTY_PATH:()=>j6,DIRTY:()=>If,BRAND:()=>m6});var Qv;(function(f){f.assertEqual=(Q)=>{};function v(Q){}f.assertIs=v;function W(Q){throw new Error}f.assertNever=W,f.arrayToEnum=(Q)=>{let X={};for(let Y of Q)X[Y]=Y;return X},f.getValidEnumValues=(Q)=>{let X=f.objectKeys(Q).filter((w)=>typeof Q[Q[w]]!=="number"),Y={};for(let w of X)Y[w]=Q[w];return f.objectValues(Y)},f.objectValues=(Q)=>{return f.objectKeys(Q).map(function(X){return Q[X]})},f.objectKeys=typeof Object.keys==="function"?(Q)=>Object.keys(Q):(Q)=>{let X=[];for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X.push(Y);return X},f.find=(Q,X)=>{for(let Y of Q)if(X(Y))return Y;return},f.isInteger=typeof Number.isInteger==="function"?(Q)=>Number.isInteger(Q):(Q)=>typeof Q==="number"&&Number.isFinite(Q)&&Math.floor(Q)===Q;function J(Q,X=" | "){return Q.map((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(X)}f.joinValues=J,f.jsonStringifyReplacer=(Q,X)=>{if(typeof X==="bigint")return X.toString();return X}})(Qv||(Qv={}));var C0;(function(f){f.mergeShapes=(v,W)=>{return{...v,...W}}})(C0||(C0={}));var x=Qv.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wf=(f)=>{switch(typeof f){case"undefined":return x.undefined;case"string":return x.string;case"number":return Number.isNaN(f)?x.nan:x.number;case"boolean":return x.boolean;case"function":return x.function;case"bigint":return x.bigint;case"symbol":return x.symbol;case"object":if(Array.isArray(f))return x.array;if(f===null)return x.null;if(f.then&&typeof f.then==="function"&&f.catch&&typeof f.catch==="function")return x.promise;if(typeof Map!=="undefined"&&f instanceof Map)return x.map;if(typeof Set!=="undefined"&&f instanceof Set)return x.set;if(typeof Date!=="undefined"&&f instanceof Date)return x.date;return x.object;default:return x.unknown}};var Z=Qv.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),N6=(f)=>{return JSON.stringify(f,null,2).replace(/"([^"]+)":/g,"$1:")};class Cv extends Error{get errors(){return this.issues}constructor(f){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let v=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,v);else this.__proto__=v;this.name="ZodError",this.issues=f}format(f){let v=f||function(Q){return Q.message},W={_errors:[]},J=(Q)=>{for(let X of Q.issues)if(X.code==="invalid_union")X.unionErrors.map(J);else if(X.code==="invalid_return_type")J(X.returnTypeError);else if(X.code==="invalid_arguments")J(X.argumentsError);else if(X.path.length===0)W._errors.push(v(X));else{let Y=W,w=0;while(w<X.path.length){let B=X.path[w];if(w!==X.path.length-1)Y[B]=Y[B]||{_errors:[]};else Y[B]=Y[B]||{_errors:[]},Y[B]._errors.push(v(X));Y=Y[B],w++}}};return J(this),W}static assert(f){if(!(f instanceof Cv))throw new Error(`Not a ZodError: ${f}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qv.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(f=(v)=>v.message){let v={},W=[];for(let J of this.issues)if(J.path.length>0){let Q=J.path[0];v[Q]=v[Q]||[],v[Q].push(f(J))}else W.push(f(J));return{formErrors:W,fieldErrors:v}}get formErrors(){return this.flatten()}}Cv.create=(f)=>{return new Cv(f)};var V6=(f,v)=>{let W;switch(f.code){case Z.invalid_type:if(f.received===x.undefined)W="Required";else W=`Expected ${f.expected}, received ${f.received}`;break;case Z.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify(f.expected,Qv.jsonStringifyReplacer)}`;break;case Z.unrecognized_keys:W=`Unrecognized key(s) in object: ${Qv.joinValues(f.keys,", ")}`;break;case Z.invalid_union:W="Invalid input";break;case Z.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${Qv.joinValues(f.options)}`;break;case Z.invalid_enum_value:W=`Invalid enum value. Expected ${Qv.joinValues(f.options)}, received '${f.received}'`;break;case Z.invalid_arguments:W="Invalid function arguments";break;case Z.invalid_return_type:W="Invalid function return type";break;case Z.invalid_date:W="Invalid date";break;case Z.invalid_string:if(typeof f.validation==="object")if("includes"in f.validation){if(W=`Invalid input: must include "${f.validation.includes}"`,typeof f.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${f.validation.position}`}else if("startsWith"in f.validation)W=`Invalid input: must start with "${f.validation.startsWith}"`;else if("endsWith"in f.validation)W=`Invalid input: must end with "${f.validation.endsWith}"`;else Qv.assertNever(f.validation);else if(f.validation!=="regex")W=`Invalid ${f.validation}`;else W="Invalid";break;case Z.too_small:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at least":"more than"} ${f.minimum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at least":"over"} ${f.minimum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="bigint")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(f.minimum))}`;else W="Invalid input";break;case Z.too_big:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at most":"less than"} ${f.maximum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at most":"under"} ${f.maximum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="bigint")W=`BigInt must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly":f.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(f.maximum))}`;else W="Invalid input";break;case Z.custom:W="Invalid input";break;case Z.invalid_intersection_types:W="Intersection results could not be merged";break;case Z.not_multiple_of:W=`Number must be a multiple of ${f.multipleOf}`;break;case Z.not_finite:W="Number must be finite";break;default:W=v.defaultError,Qv.assertNever(f)}return{message:W}},Mf=V6;var f8=Mf;function D6(f){f8=f}function sf(){return f8}var j1=(f)=>{let{data:v,path:W,errorMaps:J,issueData:Q}=f,X=[...W,...Q.path||[]],Y={...Q,path:X};if(Q.message!==void 0)return{...Q,path:X,message:Q.message};let w="",B=J.filter((z)=>!!z).slice().reverse();for(let z of B)w=z(Y,{data:v,defaultError:w}).message;return{...Q,path:X,message:w}},j6=[];function u(f,v){let W=sf(),J=j1({issueData:v,data:f.data,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,W,W===Mf?void 0:Mf].filter((Q)=>!!Q)});f.common.issues.push(J)}class hv{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(f,v){let W=[];for(let J of v){if(J.status==="aborted")return d;if(J.status==="dirty")f.dirty();W.push(J.value)}return{status:f.value,value:W}}static async mergeObjectAsync(f,v){let W=[];for(let J of v){let Q=await J.key,X=await J.value;W.push({key:Q,value:X})}return hv.mergeObjectSync(f,W)}static mergeObjectSync(f,v){let W={};for(let J of v){let{key:Q,value:X}=J;if(Q.status==="aborted")return d;if(X.status==="aborted")return d;if(Q.status==="dirty")f.dirty();if(X.status==="dirty")f.dirty();if(Q.value!=="__proto__"&&(typeof X.value!=="undefined"||J.alwaysSet))W[Q.value]=X.value}return{status:f.value,value:W}}}var d=Object.freeze({status:"aborted"}),If=(f)=>({status:"dirty",value:f}),kv=(f)=>({status:"valid",value:f}),C1=(f)=>f.status==="aborted",T1=(f)=>f.status==="dirty",Of=(f)=>f.status==="valid",tf=(f)=>typeof Promise!=="undefined"&&f instanceof Promise;var c;(function(f){f.errToObj=(v)=>typeof v==="string"?{message:v}:v||{},f.toString=(v)=>typeof v==="string"?v:v?.message})(c||(c={}));class ev{constructor(f,v,W,J){this._cachedPath=[],this.parent=f,this.data=v,this._path=W,this._key=J}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var Q8=(f,v)=>{if(Of(v))return{success:!0,data:v.value};else{if(!f.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new Cv(f.common.issues);return this._error=W,this._error}}}};function t(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:J,description:Q}=f;if(v&&(W||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(Y,w)=>{let{message:B}=f;if(Y.code==="invalid_enum_value")return{message:B??w.defaultError};if(typeof w.data==="undefined")return{message:B??J??w.defaultError};if(Y.code!=="invalid_type")return{message:w.defaultError};return{message:B??W??w.defaultError}},description:Q}}class vv{get description(){return this._def.description}_getType(f){return wf(f.data)}_getOrReturnCtx(f,v){return v||{common:f.parent.common,data:f.data,parsedType:wf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}_processInputParams(f){return{status:new hv,ctx:{common:f.parent.common,data:f.data,parsedType:wf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}}_parseSync(f){let v=this._parse(f);if(tf(v))throw new Error("Synchronous parse encountered promise.");return v}_parseAsync(f){let v=this._parse(f);return Promise.resolve(v)}parse(f,v){let W=this.safeParse(f,v);if(W.success)return W.data;throw W.error}safeParse(f,v){let W={common:{issues:[],async:v?.async??!1,contextualErrorMap:v?.errorMap},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)},J=this._parseSync({data:f,path:W.path,parent:W});return Q8(W,J)}"~validate"(f){let v={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)};if(!this["~standard"].async)try{let W=this._parseSync({data:f,path:[],parent:v});return Of(W)?{value:W.value}:{issues:v.common.issues}}catch(W){if(W?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;v.common={issues:[],async:!0}}return this._parseAsync({data:f,path:[],parent:v}).then((W)=>Of(W)?{value:W.value}:{issues:v.common.issues})}async parseAsync(f,v){let W=await this.safeParseAsync(f,v);if(W.success)return W.data;throw W.error}async safeParseAsync(f,v){let W={common:{issues:[],contextualErrorMap:v?.errorMap,async:!0},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)},J=this._parse({data:f,path:W.path,parent:W}),Q=await(tf(J)?J:Promise.resolve(J));return Q8(W,Q)}refine(f,v){let W=(J)=>{if(typeof v==="string"||typeof v==="undefined")return{message:v};else if(typeof v==="function")return v(J);else return v};return this._refinement((J,Q)=>{let X=f(J),Y=()=>Q.addIssue({code:Z.custom,...W(J)});if(typeof Promise!=="undefined"&&X instanceof Promise)return X.then((w)=>{if(!w)return Y(),!1;else return!0});if(!X)return Y(),!1;else return!0})}refinement(f,v){return this._refinement((W,J)=>{if(!f(W))return J.addIssue(typeof v==="function"?v(W,J):v),!1;else return!0})}_refinement(f){return new vf({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:f}})}superRefine(f){return this._refinement(f)}constructor(f){this.spa=this.safeParseAsync,this._def=f,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(v)=>this["~validate"](v)}}optional(){return tv.create(this,this._def)}nullable(){return Vf.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sv.create(this)}promise(){return xf.create(this,this._def)}or(f){return J1.create([this,f],this._def)}and(f){return X1.create(this,f,this._def)}transform(f){return new vf({...t(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:f}})}default(f){let v=typeof f==="function"?f:()=>f;return new B1({...t(this._def),innerType:this,defaultValue:v,typeName:C.ZodDefault})}brand(){return new u1({typeName:C.ZodBranded,type:this,...t(this._def)})}catch(f){let v=typeof f==="function"?f:()=>f;return new q1({...t(this._def),innerType:this,catchValue:v,typeName:C.ZodCatch})}describe(f){return new this.constructor({...this._def,description:f})}pipe(f){return A1.create(this,f)}readonly(){return P1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var E6=/^c[^\s-]{8,}$/i,O6=/^[0-9a-z]+$/,U6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,H6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,F6=/^[a-z0-9_-]{21}$/i,A6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,g6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,h6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",T0,b6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,R6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,k6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,S6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,y6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,l6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,J8="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",I6=new RegExp(`^${J8}$`);function X8(f){let v="[0-5]\\d";if(f.precision)v=`${v}\\.\\d{${f.precision}}`;else if(f.precision==null)v=`${v}(\\.\\d+)?`;let W=f.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${v})${W}`}function Z6(f){return new RegExp(`^${X8(f)}$`)}function Y8(f){let v=`${J8}T${X8(f)}`,W=[];if(W.push(f.local?"Z?":"Z"),f.offset)W.push("([+-]\\d{2}:?\\d{2})");return v=`${v}(${W.join("|")})`,new RegExp(`^${v}$`)}function C6(f,v){if((v==="v4"||!v)&&b6.test(f))return!0;if((v==="v6"||!v)&&k6.test(f))return!0;return!1}function T6(f,v){if(!A6.test(f))return!1;try{let[W]=f.split(".");if(!W)return!1;let J=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),Q=JSON.parse(atob(J));if(typeof Q!=="object"||Q===null)return!1;if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(v&&Q.alg!==v)return!1;return!0}catch{return!1}}function x6(f,v){if((v==="v4"||!v)&&R6.test(f))return!0;if((v==="v6"||!v)&&S6.test(f))return!0;return!1}class ov extends vv{_parse(f){if(this._def.coerce)f.data=String(f.data);if(this._getType(f)!==x.string){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_type,expected:x.string,received:Q.parsedType}),d}let W=new hv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.length<Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="max"){if(f.data.length>Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="length"){let X=f.data.length>Q.value,Y=f.data.length<Q.value;if(X||Y){if(J=this._getOrReturnCtx(f,J),X)u(J,{code:Z.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});else if(Y)u(J,{code:Z.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});W.dirty()}}else if(Q.kind==="email"){if(!_6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"email",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="emoji"){if(!T0)T0=new RegExp(h6,"u");if(!T0.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"emoji",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="uuid"){if(!H6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"uuid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="nanoid"){if(!F6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"nanoid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid"){if(!E6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"cuid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid2"){if(!O6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"cuid2",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ulid"){if(!U6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"ulid",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="url")try{new URL(f.data)}catch{J=this._getOrReturnCtx(f,J),u(J,{validation:"url",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="regex"){if(Q.regex.lastIndex=0,!Q.regex.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"regex",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="trim")f.data=f.data.trim();else if(Q.kind==="includes"){if(!f.data.includes(Q.value,Q.position))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:{includes:Q.value,position:Q.position},message:Q.message}),W.dirty()}else if(Q.kind==="toLowerCase")f.data=f.data.toLowerCase();else if(Q.kind==="toUpperCase")f.data=f.data.toUpperCase();else if(Q.kind==="startsWith"){if(!f.data.startsWith(Q.value))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:{startsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="endsWith"){if(!f.data.endsWith(Q.value))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:{endsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="datetime"){if(!Y8(Q).test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:"datetime",message:Q.message}),W.dirty()}else if(Q.kind==="date"){if(!I6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:"date",message:Q.message}),W.dirty()}else if(Q.kind==="time"){if(!Z6(Q).test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:Z.invalid_string,validation:"time",message:Q.message}),W.dirty()}else if(Q.kind==="duration"){if(!g6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"duration",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ip"){if(!C6(f.data,Q.version))J=this._getOrReturnCtx(f,J),u(J,{validation:"ip",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="jwt"){if(!T6(f.data,Q.alg))J=this._getOrReturnCtx(f,J),u(J,{validation:"jwt",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cidr"){if(!x6(f.data,Q.version))J=this._getOrReturnCtx(f,J),u(J,{validation:"cidr",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64"){if(!y6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"base64",code:Z.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64url"){if(!l6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"base64url",code:Z.invalid_string,message:Q.message}),W.dirty()}else Qv.assertNever(Q);return{status:W.value,value:f.data}}_regex(f,v,W){return this.refinement((J)=>f.test(J),{validation:v,code:Z.invalid_string,...c.errToObj(W)})}_addCheck(f){return new ov({...this._def,checks:[...this._def.checks,f]})}email(f){return this._addCheck({kind:"email",...c.errToObj(f)})}url(f){return this._addCheck({kind:"url",...c.errToObj(f)})}emoji(f){return this._addCheck({kind:"emoji",...c.errToObj(f)})}uuid(f){return this._addCheck({kind:"uuid",...c.errToObj(f)})}nanoid(f){return this._addCheck({kind:"nanoid",...c.errToObj(f)})}cuid(f){return this._addCheck({kind:"cuid",...c.errToObj(f)})}cuid2(f){return this._addCheck({kind:"cuid2",...c.errToObj(f)})}ulid(f){return this._addCheck({kind:"ulid",...c.errToObj(f)})}base64(f){return this._addCheck({kind:"base64",...c.errToObj(f)})}base64url(f){return this._addCheck({kind:"base64url",...c.errToObj(f)})}jwt(f){return this._addCheck({kind:"jwt",...c.errToObj(f)})}ip(f){return this._addCheck({kind:"ip",...c.errToObj(f)})}cidr(f){return this._addCheck({kind:"cidr",...c.errToObj(f)})}datetime(f){if(typeof f==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:f});return this._addCheck({kind:"datetime",precision:typeof f?.precision==="undefined"?null:f?.precision,offset:f?.offset??!1,local:f?.local??!1,...c.errToObj(f?.message)})}date(f){return this._addCheck({kind:"date",message:f})}time(f){if(typeof f==="string")return this._addCheck({kind:"time",precision:null,message:f});return this._addCheck({kind:"time",precision:typeof f?.precision==="undefined"?null:f?.precision,...c.errToObj(f?.message)})}duration(f){return this._addCheck({kind:"duration",...c.errToObj(f)})}regex(f,v){return this._addCheck({kind:"regex",regex:f,...c.errToObj(v)})}includes(f,v){return this._addCheck({kind:"includes",value:f,position:v?.position,...c.errToObj(v?.message)})}startsWith(f,v){return this._addCheck({kind:"startsWith",value:f,...c.errToObj(v)})}endsWith(f,v){return this._addCheck({kind:"endsWith",value:f,...c.errToObj(v)})}min(f,v){return this._addCheck({kind:"min",value:f,...c.errToObj(v)})}max(f,v){return this._addCheck({kind:"max",value:f,...c.errToObj(v)})}length(f,v){return this._addCheck({kind:"length",value:f,...c.errToObj(v)})}nonempty(f){return this.min(1,c.errToObj(f))}trim(){return new ov({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ov({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ov({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((f)=>f.kind==="datetime")}get isDate(){return!!this._def.checks.find((f)=>f.kind==="date")}get isTime(){return!!this._def.checks.find((f)=>f.kind==="time")}get isDuration(){return!!this._def.checks.find((f)=>f.kind==="duration")}get isEmail(){return!!this._def.checks.find((f)=>f.kind==="email")}get isURL(){return!!this._def.checks.find((f)=>f.kind==="url")}get isEmoji(){return!!this._def.checks.find((f)=>f.kind==="emoji")}get isUUID(){return!!this._def.checks.find((f)=>f.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((f)=>f.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((f)=>f.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((f)=>f.kind==="cuid2")}get isULID(){return!!this._def.checks.find((f)=>f.kind==="ulid")}get isIP(){return!!this._def.checks.find((f)=>f.kind==="ip")}get isCIDR(){return!!this._def.checks.find((f)=>f.kind==="cidr")}get isBase64(){return!!this._def.checks.find((f)=>f.kind==="base64")}get isBase64url(){return!!this._def.checks.find((f)=>f.kind==="base64url")}get minLength(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxLength(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}}ov.create=(f)=>{return new ov({checks:[],typeName:C.ZodString,coerce:f?.coerce??!1,...t(f)})};function u6(f,v){let W=(f.toString().split(".")[1]||"").length,J=(v.toString().split(".")[1]||"").length,Q=W>J?W:J,X=Number.parseInt(f.toFixed(Q).replace(".","")),Y=Number.parseInt(v.toFixed(Q).replace(".",""));return X%Y/10**Q}class Hf extends vv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(f){if(this._def.coerce)f.data=Number(f.data);if(this._getType(f)!==x.number){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_type,expected:x.number,received:Q.parsedType}),d}let W=void 0,J=new hv;for(let Q of this._def.checks)if(Q.kind==="int"){if(!Qv.isInteger(f.data))W=this._getOrReturnCtx(f,W),u(W,{code:Z.invalid_type,expected:"integer",received:"float",message:Q.message}),J.dirty()}else if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_small,minimum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_big,maximum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(u6(f.data,Q.value)!==0)W=this._getOrReturnCtx(f,W),u(W,{code:Z.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else if(Q.kind==="finite"){if(!Number.isFinite(f.data))W=this._getOrReturnCtx(f,W),u(W,{code:Z.not_finite,message:Q.message}),J.dirty()}else Qv.assertNever(Q);return{status:J.value,value:f.data}}gte(f,v){return this.setLimit("min",f,!0,c.toString(v))}gt(f,v){return this.setLimit("min",f,!1,c.toString(v))}lte(f,v){return this.setLimit("max",f,!0,c.toString(v))}lt(f,v){return this.setLimit("max",f,!1,c.toString(v))}setLimit(f,v,W,J){return new Hf({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:c.toString(J)}]})}_addCheck(f){return new Hf({...this._def,checks:[...this._def.checks,f]})}int(f){return this._addCheck({kind:"int",message:c.toString(f)})}positive(f){return this._addCheck({kind:"min",value:0,inclusive:!1,message:c.toString(f)})}negative(f){return this._addCheck({kind:"max",value:0,inclusive:!1,message:c.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:0,inclusive:!0,message:c.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:0,inclusive:!0,message:c.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:c.toString(v)})}finite(f){return this._addCheck({kind:"finite",message:c.toString(f)})}safe(f){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:c.toString(f)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:c.toString(f)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}get isInt(){return!!this._def.checks.find((f)=>f.kind==="int"||f.kind==="multipleOf"&&Qv.isInteger(f.value))}get isFinite(){let f=null,v=null;for(let W of this._def.checks)if(W.kind==="finite"||W.kind==="int"||W.kind==="multipleOf")return!0;else if(W.kind==="min"){if(v===null||W.value>v)v=W.value}else if(W.kind==="max"){if(f===null||W.value<f)f=W.value}return Number.isFinite(v)&&Number.isFinite(f)}}Hf.create=(f)=>{return new Hf({checks:[],typeName:C.ZodNumber,coerce:f?.coerce||!1,...t(f)})};class Ff extends vv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(f){if(this._def.coerce)try{f.data=BigInt(f.data)}catch{return this._getInvalidInput(f)}if(this._getType(f)!==x.bigint)return this._getInvalidInput(f);let W=void 0,J=new hv;for(let Q of this._def.checks)if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_small,type:"bigint",minimum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:Z.too_big,type:"bigint",maximum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(f.data%Q.value!==BigInt(0))W=this._getOrReturnCtx(f,W),u(W,{code:Z.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else Qv.assertNever(Q);return{status:J.value,value:f.data}}_getInvalidInput(f){let v=this._getOrReturnCtx(f);return u(v,{code:Z.invalid_type,expected:x.bigint,received:v.parsedType}),d}gte(f,v){return this.setLimit("min",f,!0,c.toString(v))}gt(f,v){return this.setLimit("min",f,!1,c.toString(v))}lte(f,v){return this.setLimit("max",f,!0,c.toString(v))}lt(f,v){return this.setLimit("max",f,!1,c.toString(v))}setLimit(f,v,W,J){return new Ff({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:c.toString(J)}]})}_addCheck(f){return new Ff({...this._def,checks:[...this._def.checks,f]})}positive(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:c.toString(f)})}negative(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:c.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:c.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:c.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:c.toString(v)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}}Ff.create=(f)=>{return new Ff({checks:[],typeName:C.ZodBigInt,coerce:f?.coerce??!1,...t(f)})};class f1 extends vv{_parse(f){if(this._def.coerce)f.data=Boolean(f.data);if(this._getType(f)!==x.boolean){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.boolean,received:W.parsedType}),d}return kv(f.data)}}f1.create=(f)=>{return new f1({typeName:C.ZodBoolean,coerce:f?.coerce||!1,...t(f)})};class Zf extends vv{_parse(f){if(this._def.coerce)f.data=new Date(f.data);if(this._getType(f)!==x.date){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_type,expected:x.date,received:Q.parsedType}),d}if(Number.isNaN(f.data.getTime())){let Q=this._getOrReturnCtx(f);return u(Q,{code:Z.invalid_date}),d}let W=new hv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.getTime()<Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_small,message:Q.message,inclusive:!0,exact:!1,minimum:Q.value,type:"date"}),W.dirty()}else if(Q.kind==="max"){if(f.data.getTime()>Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:Z.too_big,message:Q.message,inclusive:!0,exact:!1,maximum:Q.value,type:"date"}),W.dirty()}else Qv.assertNever(Q);return{status:W.value,value:new Date(f.data.getTime())}}_addCheck(f){return new Zf({...this._def,checks:[...this._def.checks,f]})}min(f,v){return this._addCheck({kind:"min",value:f.getTime(),message:c.toString(v)})}max(f,v){return this._addCheck({kind:"max",value:f.getTime(),message:c.toString(v)})}get minDate(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f!=null?new Date(f):null}get maxDate(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f!=null?new Date(f):null}}Zf.create=(f)=>{return new Zf({checks:[],coerce:f?.coerce||!1,typeName:C.ZodDate,...t(f)})};class E1 extends vv{_parse(f){if(this._getType(f)!==x.symbol){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.symbol,received:W.parsedType}),d}return kv(f.data)}}E1.create=(f)=>{return new E1({typeName:C.ZodSymbol,...t(f)})};class Q1 extends vv{_parse(f){if(this._getType(f)!==x.undefined){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.undefined,received:W.parsedType}),d}return kv(f.data)}}Q1.create=(f)=>{return new Q1({typeName:C.ZodUndefined,...t(f)})};class W1 extends vv{_parse(f){if(this._getType(f)!==x.null){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.null,received:W.parsedType}),d}return kv(f.data)}}W1.create=(f)=>{return new W1({typeName:C.ZodNull,...t(f)})};class Cf extends vv{constructor(){super(...arguments);this._any=!0}_parse(f){return kv(f.data)}}Cf.create=(f)=>{return new Cf({typeName:C.ZodAny,...t(f)})};class Uf extends vv{constructor(){super(...arguments);this._unknown=!0}_parse(f){return kv(f.data)}}Uf.create=(f)=>{return new Uf({typeName:C.ZodUnknown,...t(f)})};class Gf extends vv{_parse(f){let v=this._getOrReturnCtx(f);return u(v,{code:Z.invalid_type,expected:x.never,received:v.parsedType}),d}}Gf.create=(f)=>{return new Gf({typeName:C.ZodNever,...t(f)})};class O1 extends vv{_parse(f){if(this._getType(f)!==x.undefined){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.void,received:W.parsedType}),d}return kv(f.data)}}O1.create=(f)=>{return new O1({typeName:C.ZodVoid,...t(f)})};class sv extends vv{_parse(f){let{ctx:v,status:W}=this._processInputParams(f),J=this._def;if(v.parsedType!==x.array)return u(v,{code:Z.invalid_type,expected:x.array,received:v.parsedType}),d;if(J.exactLength!==null){let X=v.data.length>J.exactLength.value,Y=v.data.length<J.exactLength.value;if(X||Y)u(v,{code:X?Z.too_big:Z.too_small,minimum:Y?J.exactLength.value:void 0,maximum:X?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),W.dirty()}if(J.minLength!==null){if(v.data.length<J.minLength.value)u(v,{code:Z.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),W.dirty()}if(J.maxLength!==null){if(v.data.length>J.maxLength.value)u(v,{code:Z.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),W.dirty()}if(v.common.async)return Promise.all([...v.data].map((X,Y)=>{return J.type._parseAsync(new ev(v,X,v.path,Y))})).then((X)=>{return hv.mergeArray(W,X)});let Q=[...v.data].map((X,Y)=>{return J.type._parseSync(new ev(v,X,v.path,Y))});return hv.mergeArray(W,Q)}get element(){return this._def.type}min(f,v){return new sv({...this._def,minLength:{value:f,message:c.toString(v)}})}max(f,v){return new sv({...this._def,maxLength:{value:f,message:c.toString(v)}})}length(f,v){return new sv({...this._def,exactLength:{value:f,message:c.toString(v)}})}nonempty(f){return this.min(1,f)}}sv.create=(f,v)=>{return new sv({type:f,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...t(v)})};function ef(f){if(f instanceof Dv){let v={};for(let W in f.shape){let J=f.shape[W];v[W]=tv.create(ef(J))}return new Dv({...f._def,shape:()=>v})}else if(f instanceof sv)return new sv({...f._def,type:ef(f.element)});else if(f instanceof tv)return tv.create(ef(f.unwrap()));else if(f instanceof Vf)return Vf.create(ef(f.unwrap()));else if(f instanceof Bf)return Bf.create(f.items.map((v)=>ef(v)));else return f}class Dv extends vv{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let f=this._def.shape(),v=Qv.objectKeys(f);return this._cached={shape:f,keys:v},this._cached}_parse(f){if(this._getType(f)!==x.object){let B=this._getOrReturnCtx(f);return u(B,{code:Z.invalid_type,expected:x.object,received:B.parsedType}),d}let{status:W,ctx:J}=this._processInputParams(f),{shape:Q,keys:X}=this._getCached(),Y=[];if(!(this._def.catchall instanceof Gf&&this._def.unknownKeys==="strip")){for(let B in J.data)if(!X.includes(B))Y.push(B)}let w=[];for(let B of X){let z=Q[B],K=J.data[B];w.push({key:{status:"valid",value:B},value:z._parse(new ev(J,K,J.path,B)),alwaysSet:B in J.data})}if(this._def.catchall instanceof Gf){let B=this._def.unknownKeys;if(B==="passthrough")for(let z of Y)w.push({key:{status:"valid",value:z},value:{status:"valid",value:J.data[z]}});else if(B==="strict"){if(Y.length>0)u(J,{code:Z.unrecognized_keys,keys:Y}),W.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let z of Y){let K=J.data[z];w.push({key:{status:"valid",value:z},value:B._parse(new ev(J,K,J.path,z)),alwaysSet:z in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let B=[];for(let z of w){let K=await z.key,L=await z.value;B.push({key:K,value:L,alwaysSet:z.alwaysSet})}return B}).then((B)=>{return hv.mergeObjectSync(W,B)});else return hv.mergeObjectSync(W,w)}get shape(){return this._def.shape()}strict(f){return c.errToObj,new Dv({...this._def,unknownKeys:"strict",...f!==void 0?{errorMap:(v,W)=>{let J=this._def.errorMap?.(v,W).message??W.defaultError;if(v.code==="unrecognized_keys")return{message:c.errToObj(f).message??J};return{message:J}}}:{}})}strip(){return new Dv({...this._def,unknownKeys:"strip"})}passthrough(){return new Dv({...this._def,unknownKeys:"passthrough"})}extend(f){return new Dv({...this._def,shape:()=>({...this._def.shape(),...f})})}merge(f){return new Dv({unknownKeys:f._def.unknownKeys,catchall:f._def.catchall,shape:()=>({...this._def.shape(),...f._def.shape()}),typeName:C.ZodObject})}setKey(f,v){return this.augment({[f]:v})}catchall(f){return new Dv({...this._def,catchall:f})}pick(f){let v={};for(let W of Qv.objectKeys(f))if(f[W]&&this.shape[W])v[W]=this.shape[W];return new Dv({...this._def,shape:()=>v})}omit(f){let v={};for(let W of Qv.objectKeys(this.shape))if(!f[W])v[W]=this.shape[W];return new Dv({...this._def,shape:()=>v})}deepPartial(){return ef(this)}partial(f){let v={};for(let W of Qv.objectKeys(this.shape)){let J=this.shape[W];if(f&&!f[W])v[W]=J;else v[W]=J.optional()}return new Dv({...this._def,shape:()=>v})}required(f){let v={};for(let W of Qv.objectKeys(this.shape))if(f&&!f[W])v[W]=this.shape[W];else{let Q=this.shape[W];while(Q instanceof tv)Q=Q._def.innerType;v[W]=Q}return new Dv({...this._def,shape:()=>v})}keyof(){return w8(Qv.objectKeys(this.shape))}}Dv.create=(f,v)=>{return new Dv({shape:()=>f,unknownKeys:"strip",catchall:Gf.create(),typeName:C.ZodObject,...t(v)})};Dv.strictCreate=(f,v)=>{return new Dv({shape:()=>f,unknownKeys:"strict",catchall:Gf.create(),typeName:C.ZodObject,...t(v)})};Dv.lazycreate=(f,v)=>{return new Dv({shape:f,unknownKeys:"strip",catchall:Gf.create(),typeName:C.ZodObject,...t(v)})};class J1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=this._def.options;function J(Q){for(let Y of Q)if(Y.result.status==="valid")return Y.result;for(let Y of Q)if(Y.result.status==="dirty")return v.common.issues.push(...Y.ctx.common.issues),Y.result;let X=Q.map((Y)=>new Cv(Y.ctx.common.issues));return u(v,{code:Z.invalid_union,unionErrors:X}),d}if(v.common.async)return Promise.all(W.map(async(Q)=>{let X={...v,common:{...v.common,issues:[]},parent:null};return{result:await Q._parseAsync({data:v.data,path:v.path,parent:X}),ctx:X}})).then(J);else{let Q=void 0,X=[];for(let w of W){let B={...v,common:{...v.common,issues:[]},parent:null},z=w._parseSync({data:v.data,path:v.path,parent:B});if(z.status==="valid")return z;else if(z.status==="dirty"&&!Q)Q={result:z,ctx:B};if(B.common.issues.length)X.push(B.common.issues)}if(Q)return v.common.issues.push(...Q.ctx.common.issues),Q.result;let Y=X.map((w)=>new Cv(w));return u(v,{code:Z.invalid_union,unionErrors:Y}),d}}get options(){return this._def.options}}J1.create=(f,v)=>{return new J1({options:f,typeName:C.ZodUnion,...t(v)})};var Nf=(f)=>{if(f instanceof Y1)return Nf(f.schema);else if(f instanceof vf)return Nf(f.innerType());else if(f instanceof w1)return[f.value];else if(f instanceof Af)return f.options;else if(f instanceof G1)return Qv.objectValues(f.enum);else if(f instanceof B1)return Nf(f._def.innerType);else if(f instanceof Q1)return[void 0];else if(f instanceof W1)return[null];else if(f instanceof tv)return[void 0,...Nf(f.unwrap())];else if(f instanceof Vf)return[null,...Nf(f.unwrap())];else if(f instanceof u1)return Nf(f.unwrap());else if(f instanceof P1)return Nf(f.unwrap());else if(f instanceof q1)return Nf(f._def.innerType);else return[]};class x1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.object)return u(v,{code:Z.invalid_type,expected:x.object,received:v.parsedType}),d;let W=this.discriminator,J=v.data[W],Q=this.optionsMap.get(J);if(!Q)return u(v,{code:Z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),d;if(v.common.async)return Q._parseAsync({data:v.data,path:v.path,parent:v});else return Q._parseSync({data:v.data,path:v.path,parent:v})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(f,v,W){let J=new Map;for(let Q of v){let X=Nf(Q.shape[f]);if(!X.length)throw new Error(`A discriminator value for key \`${f}\` could not be extracted from all schema options`);for(let Y of X){if(J.has(Y))throw new Error(`Discriminator property ${String(f)} has duplicate value ${String(Y)}`);J.set(Y,Q)}}return new x1({typeName:C.ZodDiscriminatedUnion,discriminator:f,options:v,optionsMap:J,...t(W)})}}function x0(f,v){let W=wf(f),J=wf(v);if(f===v)return{valid:!0,data:f};else if(W===x.object&&J===x.object){let Q=Qv.objectKeys(v),X=Qv.objectKeys(f).filter((w)=>Q.indexOf(w)!==-1),Y={...f,...v};for(let w of X){let B=x0(f[w],v[w]);if(!B.valid)return{valid:!1};Y[w]=B.data}return{valid:!0,data:Y}}else if(W===x.array&&J===x.array){if(f.length!==v.length)return{valid:!1};let Q=[];for(let X=0;X<f.length;X++){let Y=f[X],w=v[X],B=x0(Y,w);if(!B.valid)return{valid:!1};Q.push(B.data)}return{valid:!0,data:Q}}else if(W===x.date&&J===x.date&&+f===+v)return{valid:!0,data:f};else return{valid:!1}}class X1 extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f),J=(Q,X)=>{if(C1(Q)||C1(X))return d;let Y=x0(Q.value,X.value);if(!Y.valid)return u(W,{code:Z.invalid_intersection_types}),d;if(T1(Q)||T1(X))v.dirty();return{status:v.value,value:Y.data}};if(W.common.async)return Promise.all([this._def.left._parseAsync({data:W.data,path:W.path,parent:W}),this._def.right._parseAsync({data:W.data,path:W.path,parent:W})]).then(([Q,X])=>J(Q,X));else return J(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}}X1.create=(f,v,W)=>{return new X1({left:f,right:v,typeName:C.ZodIntersection,...t(W)})};class Bf extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.array)return u(W,{code:Z.invalid_type,expected:x.array,received:W.parsedType}),d;if(W.data.length<this._def.items.length)return u(W,{code:Z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d;if(!this._def.rest&&W.data.length>this._def.items.length)u(W,{code:Z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v.dirty();let Q=[...W.data].map((X,Y)=>{let w=this._def.items[Y]||this._def.rest;if(!w)return null;return w._parse(new ev(W,X,W.path,Y))}).filter((X)=>!!X);if(W.common.async)return Promise.all(Q).then((X)=>{return hv.mergeArray(v,X)});else return hv.mergeArray(v,Q)}get items(){return this._def.items}rest(f){return new Bf({...this._def,rest:f})}}Bf.create=(f,v)=>{if(!Array.isArray(f))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bf({items:f,typeName:C.ZodTuple,rest:null,...t(v)})};class U1 extends vv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.object)return u(W,{code:Z.invalid_type,expected:x.object,received:W.parsedType}),d;let J=[],Q=this._def.keyType,X=this._def.valueType;for(let Y in W.data)J.push({key:Q._parse(new ev(W,Y,W.path,Y)),value:X._parse(new ev(W,W.data[Y],W.path,Y)),alwaysSet:Y in W.data});if(W.common.async)return hv.mergeObjectAsync(v,J);else return hv.mergeObjectSync(v,J)}get element(){return this._def.valueType}static create(f,v,W){if(v instanceof vv)return new U1({keyType:f,valueType:v,typeName:C.ZodRecord,...t(W)});return new U1({keyType:ov.create(),valueType:f,typeName:C.ZodRecord,...t(v)})}}class H1 extends vv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.map)return u(W,{code:Z.invalid_type,expected:x.map,received:W.parsedType}),d;let J=this._def.keyType,Q=this._def.valueType,X=[...W.data.entries()].map(([Y,w],B)=>{return{key:J._parse(new ev(W,Y,W.path,[B,"key"])),value:Q._parse(new ev(W,w,W.path,[B,"value"]))}});if(W.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let w of X){let B=await w.key,z=await w.value;if(B.status==="aborted"||z.status==="aborted")return d;if(B.status==="dirty"||z.status==="dirty")v.dirty();Y.set(B.value,z.value)}return{status:v.value,value:Y}})}else{let Y=new Map;for(let w of X){let{key:B,value:z}=w;if(B.status==="aborted"||z.status==="aborted")return d;if(B.status==="dirty"||z.status==="dirty")v.dirty();Y.set(B.value,z.value)}return{status:v.value,value:Y}}}}H1.create=(f,v,W)=>{return new H1({valueType:v,keyType:f,typeName:C.ZodMap,...t(W)})};class Tf extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.set)return u(W,{code:Z.invalid_type,expected:x.set,received:W.parsedType}),d;let J=this._def;if(J.minSize!==null){if(W.data.size<J.minSize.value)u(W,{code:Z.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),v.dirty()}if(J.maxSize!==null){if(W.data.size>J.maxSize.value)u(W,{code:Z.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),v.dirty()}let Q=this._def.valueType;function X(w){let B=new Set;for(let z of w){if(z.status==="aborted")return d;if(z.status==="dirty")v.dirty();B.add(z.value)}return{status:v.value,value:B}}let Y=[...W.data.values()].map((w,B)=>Q._parse(new ev(W,w,W.path,B)));if(W.common.async)return Promise.all(Y).then((w)=>X(w));else return X(Y)}min(f,v){return new Tf({...this._def,minSize:{value:f,message:c.toString(v)}})}max(f,v){return new Tf({...this._def,maxSize:{value:f,message:c.toString(v)}})}size(f,v){return this.min(f,v).max(f,v)}nonempty(f){return this.min(1,f)}}Tf.create=(f,v)=>{return new Tf({valueType:f,minSize:null,maxSize:null,typeName:C.ZodSet,...t(v)})};class v1 extends vv{constructor(){super(...arguments);this.validate=this.implement}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.function)return u(v,{code:Z.invalid_type,expected:x.function,received:v.parsedType}),d;function W(Y,w){return j1({data:Y,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,sf(),Mf].filter((B)=>!!B),issueData:{code:Z.invalid_arguments,argumentsError:w}})}function J(Y,w){return j1({data:Y,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,sf(),Mf].filter((B)=>!!B),issueData:{code:Z.invalid_return_type,returnTypeError:w}})}let Q={errorMap:v.common.contextualErrorMap},X=v.data;if(this._def.returns instanceof xf){let Y=this;return kv(async function(...w){let B=new Cv([]),z=await Y._def.args.parseAsync(w,Q).catch((V)=>{throw B.addIssue(W(w,V)),B}),K=await Reflect.apply(X,this,z);return await Y._def.returns._def.type.parseAsync(K,Q).catch((V)=>{throw B.addIssue(J(K,V)),B})})}else{let Y=this;return kv(function(...w){let B=Y._def.args.safeParse(w,Q);if(!B.success)throw new Cv([W(w,B.error)]);let z=Reflect.apply(X,this,B.data),K=Y._def.returns.safeParse(z,Q);if(!K.success)throw new Cv([J(z,K.error)]);return K.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...f){return new v1({...this._def,args:Bf.create(f).rest(Uf.create())})}returns(f){return new v1({...this._def,returns:f})}implement(f){return this.parse(f)}strictImplement(f){return this.parse(f)}static create(f,v,W){return new v1({args:f?f:Bf.create([]).rest(Uf.create()),returns:v||Uf.create(),typeName:C.ZodFunction,...t(W)})}}class Y1 extends vv{get schema(){return this._def.getter()}_parse(f){let{ctx:v}=this._processInputParams(f);return this._def.getter()._parse({data:v.data,path:v.path,parent:v})}}Y1.create=(f,v)=>{return new Y1({getter:f,typeName:C.ZodLazy,...t(v)})};class w1 extends vv{_parse(f){if(f.data!==this._def.value){let v=this._getOrReturnCtx(f);return u(v,{received:v.data,code:Z.invalid_literal,expected:this._def.value}),d}return{status:"valid",value:f.data}}get value(){return this._def.value}}w1.create=(f,v)=>{return new w1({value:f,typeName:C.ZodLiteral,...t(v)})};function w8(f,v){return new Af({values:f,typeName:C.ZodEnum,...t(v)})}class Af extends vv{_parse(f){if(typeof f.data!=="string"){let v=this._getOrReturnCtx(f),W=this._def.values;return u(v,{expected:Qv.joinValues(W),received:v.parsedType,code:Z.invalid_type}),d}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(f.data)){let v=this._getOrReturnCtx(f),W=this._def.values;return u(v,{received:v.data,code:Z.invalid_enum_value,options:W}),d}return kv(f.data)}get options(){return this._def.values}get enum(){let f={};for(let v of this._def.values)f[v]=v;return f}get Values(){let f={};for(let v of this._def.values)f[v]=v;return f}get Enum(){let f={};for(let v of this._def.values)f[v]=v;return f}extract(f,v=this._def){return Af.create(f,{...this._def,...v})}exclude(f,v=this._def){return Af.create(this.options.filter((W)=>!f.includes(W)),{...this._def,...v})}}Af.create=w8;class G1 extends vv{_parse(f){let v=Qv.getValidEnumValues(this._def.values),W=this._getOrReturnCtx(f);if(W.parsedType!==x.string&&W.parsedType!==x.number){let J=Qv.objectValues(v);return u(W,{expected:Qv.joinValues(J),received:W.parsedType,code:Z.invalid_type}),d}if(!this._cache)this._cache=new Set(Qv.getValidEnumValues(this._def.values));if(!this._cache.has(f.data)){let J=Qv.objectValues(v);return u(W,{received:W.data,code:Z.invalid_enum_value,options:J}),d}return kv(f.data)}get enum(){return this._def.values}}G1.create=(f,v)=>{return new G1({values:f,typeName:C.ZodNativeEnum,...t(v)})};class xf extends vv{unwrap(){return this._def.type}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.promise&&v.common.async===!1)return u(v,{code:Z.invalid_type,expected:x.promise,received:v.parsedType}),d;let W=v.parsedType===x.promise?v.data:Promise.resolve(v.data);return kv(W.then((J)=>{return this._def.type.parseAsync(J,{path:v.path,errorMap:v.common.contextualErrorMap})}))}}xf.create=(f,v)=>{return new xf({type:f,typeName:C.ZodPromise,...t(v)})};class vf extends vv{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(f){let{status:v,ctx:W}=this._processInputParams(f),J=this._def.effect||null,Q={addIssue:(X)=>{if(u(W,X),X.fatal)v.abort();else v.dirty()},get path(){return W.path}};if(Q.addIssue=Q.addIssue.bind(Q),J.type==="preprocess"){let X=J.transform(W.data,Q);if(W.common.async)return Promise.resolve(X).then(async(Y)=>{if(v.value==="aborted")return d;let w=await this._def.schema._parseAsync({data:Y,path:W.path,parent:W});if(w.status==="aborted")return d;if(w.status==="dirty")return If(w.value);if(v.value==="dirty")return If(w.value);return w});else{if(v.value==="aborted")return d;let Y=this._def.schema._parseSync({data:X,path:W.path,parent:W});if(Y.status==="aborted")return d;if(Y.status==="dirty")return If(Y.value);if(v.value==="dirty")return If(Y.value);return Y}}if(J.type==="refinement"){let X=(Y)=>{let w=J.refinement(Y,Q);if(W.common.async)return Promise.resolve(w);if(w instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if(W.common.async===!1){let Y=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(Y.status==="aborted")return d;if(Y.status==="dirty")v.dirty();return X(Y.value),{status:v.value,value:Y.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((Y)=>{if(Y.status==="aborted")return d;if(Y.status==="dirty")v.dirty();return X(Y.value).then(()=>{return{status:v.value,value:Y.value}})})}if(J.type==="transform")if(W.common.async===!1){let X=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!Of(X))return d;let Y=J.transform(X.value,Q);if(Y instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:v.value,value:Y}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((X)=>{if(!Of(X))return d;return Promise.resolve(J.transform(X.value,Q)).then((Y)=>({status:v.value,value:Y}))});Qv.assertNever(J)}}vf.create=(f,v,W)=>{return new vf({schema:f,typeName:C.ZodEffects,effect:v,...t(W)})};vf.createWithPreprocess=(f,v,W)=>{return new vf({schema:v,effect:{type:"preprocess",transform:f},typeName:C.ZodEffects,...t(W)})};class tv extends vv{_parse(f){if(this._getType(f)===x.undefined)return kv(void 0);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}tv.create=(f,v)=>{return new tv({innerType:f,typeName:C.ZodOptional,...t(v)})};class Vf extends vv{_parse(f){if(this._getType(f)===x.null)return kv(null);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}Vf.create=(f,v)=>{return new Vf({innerType:f,typeName:C.ZodNullable,...t(v)})};class B1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;if(v.parsedType===x.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:v.path,parent:v})}removeDefault(){return this._def.innerType}}B1.create=(f,v)=>{return new B1({innerType:f,typeName:C.ZodDefault,defaultValue:typeof v.default==="function"?v.default:()=>v.default,...t(v)})};class q1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W={...v,common:{...v.common,issues:[]}},J=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(tf(J))return J.then((Q)=>{return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new Cv(W.common.issues)},input:W.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new Cv(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}}q1.create=(f,v)=>{return new q1({innerType:f,typeName:C.ZodCatch,catchValue:typeof v.catch==="function"?v.catch:()=>v.catch,...t(v)})};class F1 extends vv{_parse(f){if(this._getType(f)!==x.nan){let W=this._getOrReturnCtx(f);return u(W,{code:Z.invalid_type,expected:x.nan,received:W.parsedType}),d}return{status:"valid",value:f.data}}}F1.create=(f)=>{return new F1({typeName:C.ZodNaN,...t(f)})};var m6=Symbol("zod_brand");class u1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}class A1 extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.common.async)return(async()=>{let Q=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if(Q.status==="aborted")return d;if(Q.status==="dirty")return v.dirty(),If(Q.value);else return this._def.out._parseAsync({data:Q.value,path:W.path,parent:W})})();else{let J=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(J.status==="aborted")return d;if(J.status==="dirty")return v.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:W.path,parent:W})}}static create(f,v){return new A1({in:f,out:v,typeName:C.ZodPipeline})}}class P1 extends vv{_parse(f){let v=this._def.innerType._parse(f),W=(J)=>{if(Of(J))J.value=Object.freeze(J.value);return J};return tf(v)?v.then((J)=>W(J)):W(v)}unwrap(){return this._def.innerType}}P1.create=(f,v)=>{return new P1({innerType:f,typeName:C.ZodReadonly,...t(v)})};function W8(f,v){let W=typeof f==="function"?f(v):typeof f==="string"?{message:f}:f;return typeof W==="string"?{message:W}:W}function G8(f,v={},W){if(f)return Cf.create().superRefine((J,Q)=>{let X=f(J);if(X instanceof Promise)return X.then((Y)=>{if(!Y){let w=W8(v,J),B=w.fatal??W??!0;Q.addIssue({code:"custom",...w,fatal:B})}});if(!X){let Y=W8(v,J),w=Y.fatal??W??!0;Q.addIssue({code:"custom",...Y,fatal:w})}return});return Cf.create()}var r6={object:Dv.lazycreate},C;(function(f){f.ZodString="ZodString",f.ZodNumber="ZodNumber",f.ZodNaN="ZodNaN",f.ZodBigInt="ZodBigInt",f.ZodBoolean="ZodBoolean",f.ZodDate="ZodDate",f.ZodSymbol="ZodSymbol",f.ZodUndefined="ZodUndefined",f.ZodNull="ZodNull",f.ZodAny="ZodAny",f.ZodUnknown="ZodUnknown",f.ZodNever="ZodNever",f.ZodVoid="ZodVoid",f.ZodArray="ZodArray",f.ZodObject="ZodObject",f.ZodUnion="ZodUnion",f.ZodDiscriminatedUnion="ZodDiscriminatedUnion",f.ZodIntersection="ZodIntersection",f.ZodTuple="ZodTuple",f.ZodRecord="ZodRecord",f.ZodMap="ZodMap",f.ZodSet="ZodSet",f.ZodFunction="ZodFunction",f.ZodLazy="ZodLazy",f.ZodLiteral="ZodLiteral",f.ZodEnum="ZodEnum",f.ZodEffects="ZodEffects",f.ZodNativeEnum="ZodNativeEnum",f.ZodOptional="ZodOptional",f.ZodNullable="ZodNullable",f.ZodDefault="ZodDefault",f.ZodCatch="ZodCatch",f.ZodPromise="ZodPromise",f.ZodBranded="ZodBranded",f.ZodPipeline="ZodPipeline",f.ZodReadonly="ZodReadonly"})(C||(C={}));var a6=(f,v={message:`Input not instance of ${f.name}`})=>G8((W)=>W instanceof f,v),B8=ov.create,q8=Hf.create,c6=F1.create,n6=Ff.create,P8=f1.create,p6=Zf.create,i6=E1.create,d6=Q1.create,o6=W1.create,s6=Cf.create,t6=Uf.create,e6=Gf.create,v5=O1.create,f5=sv.create,Q5=Dv.create,W5=Dv.strictCreate,J5=J1.create,X5=x1.create,Y5=X1.create,w5=Bf.create,G5=U1.create,B5=H1.create,q5=Tf.create,P5=v1.create,K5=Y1.create,z5=w1.create,$5=Af.create,L5=G1.create,M5=xf.create,N5=vf.create,V5=tv.create,D5=Vf.create,j5=vf.createWithPreprocess,E5=A1.create,O5=()=>B8().optional(),U5=()=>q8().optional(),H5=()=>P8().optional(),F5={string:(f)=>ov.create({...f,coerce:!0}),number:(f)=>Hf.create({...f,coerce:!0}),boolean:(f)=>f1.create({...f,coerce:!0}),bigint:(f)=>Ff.create({...f,coerce:!0}),date:(f)=>Zf.create({...f,coerce:!0})};var A5=d;var u0="2025-06-18";var K8=[u0,"2025-03-26","2024-11-05","2024-10-07"],m1="2.0",z8=G.union([G.string(),G.number().int()]),$8=G.string(),g5=G.object({progressToken:G.optional(z8)}).passthrough(),pv=G.object({_meta:G.optional(g5)}).passthrough(),Tv=G.object({method:G.string(),params:G.optional(pv)}),g1=G.object({_meta:G.optional(G.object({}).passthrough())}).passthrough(),qf=G.object({method:G.string(),params:G.optional(g1)}),iv=G.object({_meta:G.optional(G.object({}).passthrough())}).passthrough(),r1=G.union([G.string(),G.number().int()]),L8=G.object({jsonrpc:G.literal(m1),id:r1}).merge(Tv).strict(),M8=(f)=>L8.safeParse(f).success,N8=G.object({jsonrpc:G.literal(m1)}).merge(qf).strict(),V8=(f)=>N8.safeParse(f).success,D8=G.object({jsonrpc:G.literal(m1),id:r1,result:iv}).strict(),m0=(f)=>D8.safeParse(f).success,Kv;(function(f){f[f.ConnectionClosed=-32000]="ConnectionClosed",f[f.RequestTimeout=-32001]="RequestTimeout",f[f.ParseError=-32700]="ParseError",f[f.InvalidRequest=-32600]="InvalidRequest",f[f.MethodNotFound=-32601]="MethodNotFound",f[f.InvalidParams=-32602]="InvalidParams",f[f.InternalError=-32603]="InternalError"})(Kv||(Kv={}));var j8=G.object({jsonrpc:G.literal(m1),id:r1,error:G.object({code:G.number().int(),message:G.string(),data:G.optional(G.unknown())})}).strict(),E8=(f)=>j8.safeParse(f).success,O8=G.union([L8,N8,D8,j8]),a1=iv.strict(),c1=qf.extend({method:G.literal("notifications/cancelled"),params:g1.extend({requestId:r1,reason:G.string().optional()})}),_5=G.object({src:G.string(),mimeType:G.optional(G.string()),sizes:G.optional(G.array(G.string()))}).passthrough(),_1=G.object({icons:G.array(_5).optional()}).passthrough(),h1=G.object({name:G.string(),title:G.optional(G.string())}).passthrough(),U8=h1.extend({version:G.string(),websiteUrl:G.optional(G.string())}).merge(_1),h5=G.object({experimental:G.optional(G.object({}).passthrough()),sampling:G.optional(G.object({}).passthrough()),elicitation:G.optional(G.object({}).passthrough()),roots:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough())}).passthrough(),r0=Tv.extend({method:G.literal("initialize"),params:pv.extend({protocolVersion:G.string(),capabilities:h5,clientInfo:U8})});var b5=G.object({experimental:G.optional(G.object({}).passthrough()),logging:G.optional(G.object({}).passthrough()),completions:G.optional(G.object({}).passthrough()),prompts:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough()),resources:G.optional(G.object({subscribe:G.optional(G.boolean()),listChanged:G.optional(G.boolean())}).passthrough()),tools:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough())}).passthrough(),R5=iv.extend({protocolVersion:G.string(),capabilities:b5,serverInfo:U8,instructions:G.optional(G.string())}),a0=qf.extend({method:G.literal("notifications/initialized")});var n1=Tv.extend({method:G.literal("ping")}),k5=G.object({progress:G.number(),total:G.optional(G.number()),message:G.optional(G.string())}).passthrough(),p1=qf.extend({method:G.literal("notifications/progress"),params:g1.merge(k5).extend({progressToken:z8})}),i1=Tv.extend({params:pv.extend({cursor:G.optional($8)}).optional()}),d1=iv.extend({nextCursor:G.optional($8)}),H8=G.object({uri:G.string(),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).passthrough(),F8=H8.extend({text:G.string()}),c0=G.string().refine((f)=>{try{return atob(f),!0}catch(v){return!1}},{message:"Invalid Base64 string"}),A8=H8.extend({blob:c0}),g8=h1.extend({uri:G.string(),description:G.optional(G.string()),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).merge(_1),S5=h1.extend({uriTemplate:G.string(),description:G.optional(G.string()),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).merge(_1),o1=i1.extend({method:G.literal("resources/list")}),y5=d1.extend({resources:G.array(g8)}),s1=i1.extend({method:G.literal("resources/templates/list")}),l5=d1.extend({resourceTemplates:G.array(S5)}),t1=Tv.extend({method:G.literal("resources/read"),params:pv.extend({uri:G.string()})}),I5=iv.extend({contents:G.array(G.union([F8,A8]))}),Z5=qf.extend({method:G.literal("notifications/resources/list_changed")}),C5=Tv.extend({method:G.literal("resources/subscribe"),params:pv.extend({uri:G.string()})}),T5=Tv.extend({method:G.literal("resources/unsubscribe"),params:pv.extend({uri:G.string()})}),x5=qf.extend({method:G.literal("notifications/resources/updated"),params:g1.extend({uri:G.string()})}),u5=G.object({name:G.string(),description:G.optional(G.string()),required:G.optional(G.boolean())}).passthrough(),m5=h1.extend({description:G.optional(G.string()),arguments:G.optional(G.array(u5)),_meta:G.optional(G.object({}).passthrough())}).merge(_1),e1=i1.extend({method:G.literal("prompts/list")}),r5=d1.extend({prompts:G.array(m5)}),v0=Tv.extend({method:G.literal("prompts/get"),params:pv.extend({name:G.string(),arguments:G.optional(G.record(G.string()))})}),n0=G.object({type:G.literal("text"),text:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),p0=G.object({type:G.literal("image"),data:c0,mimeType:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),i0=G.object({type:G.literal("audio"),data:c0,mimeType:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),a5=G.object({type:G.literal("resource"),resource:G.union([F8,A8]),_meta:G.optional(G.object({}).passthrough())}).passthrough(),c5=g8.extend({type:G.literal("resource_link")}),_8=G.union([n0,p0,i0,c5,a5]),n5=G.object({role:G.enum(["user","assistant"]),content:_8}).passthrough(),p5=iv.extend({description:G.optional(G.string()),messages:G.array(n5)}),i5=qf.extend({method:G.literal("notifications/prompts/list_changed")}),d5=G.object({title:G.optional(G.string()),readOnlyHint:G.optional(G.boolean()),destructiveHint:G.optional(G.boolean()),idempotentHint:G.optional(G.boolean()),openWorldHint:G.optional(G.boolean())}).passthrough(),o5=h1.extend({description:G.optional(G.string()),inputSchema:G.object({type:G.literal("object"),properties:G.optional(G.object({}).passthrough()),required:G.optional(G.array(G.string()))}).passthrough(),outputSchema:G.optional(G.object({type:G.literal("object"),properties:G.optional(G.object({}).passthrough()),required:G.optional(G.array(G.string()))}).passthrough()),annotations:G.optional(d5),_meta:G.optional(G.object({}).passthrough())}).merge(_1),f0=i1.extend({method:G.literal("tools/list")}),s5=d1.extend({tools:G.array(o5)}),h8=iv.extend({content:G.array(_8).default([]),structuredContent:G.object({}).passthrough().optional(),isError:G.optional(G.boolean())}),i2=h8.or(iv.extend({toolResult:G.unknown()})),Q0=Tv.extend({method:G.literal("tools/call"),params:pv.extend({name:G.string(),arguments:G.optional(G.record(G.unknown()))})}),t5=qf.extend({method:G.literal("notifications/tools/list_changed")}),b1=G.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),d0=Tv.extend({method:G.literal("logging/setLevel"),params:pv.extend({level:b1})}),e5=qf.extend({method:G.literal("notifications/message"),params:g1.extend({level:b1,logger:G.optional(G.string()),data:G.unknown()})}),vX=G.object({name:G.string().optional()}).passthrough(),fX=G.object({hints:G.optional(G.array(vX)),costPriority:G.optional(G.number().min(0).max(1)),speedPriority:G.optional(G.number().min(0).max(1)),intelligencePriority:G.optional(G.number().min(0).max(1))}).passthrough(),QX=G.object({role:G.enum(["user","assistant"]),content:G.union([n0,p0,i0])}).passthrough(),WX=Tv.extend({method:G.literal("sampling/createMessage"),params:pv.extend({messages:G.array(QX),systemPrompt:G.optional(G.string()),includeContext:G.optional(G.enum(["none","thisServer","allServers"])),temperature:G.optional(G.number()),maxTokens:G.number().int(),stopSequences:G.optional(G.array(G.string())),metadata:G.optional(G.object({}).passthrough()),modelPreferences:G.optional(fX)})}),o0=iv.extend({model:G.string(),stopReason:G.optional(G.enum(["endTurn","stopSequence","maxTokens"]).or(G.string())),role:G.enum(["user","assistant"]),content:G.discriminatedUnion("type",[n0,p0,i0])}),JX=G.object({type:G.literal("boolean"),title:G.optional(G.string()),description:G.optional(G.string()),default:G.optional(G.boolean())}).passthrough(),XX=G.object({type:G.literal("string"),title:G.optional(G.string()),description:G.optional(G.string()),minLength:G.optional(G.number()),maxLength:G.optional(G.number()),format:G.optional(G.enum(["email","uri","date","date-time"]))}).passthrough(),YX=G.object({type:G.enum(["number","integer"]),title:G.optional(G.string()),description:G.optional(G.string()),minimum:G.optional(G.number()),maximum:G.optional(G.number())}).passthrough(),wX=G.object({type:G.literal("string"),title:G.optional(G.string()),description:G.optional(G.string()),enum:G.array(G.string()),enumNames:G.optional(G.array(G.string()))}).passthrough(),GX=G.union([JX,XX,YX,wX]),BX=Tv.extend({method:G.literal("elicitation/create"),params:pv.extend({message:G.string(),requestedSchema:G.object({type:G.literal("object"),properties:G.record(G.string(),GX),required:G.optional(G.array(G.string()))}).passthrough()})}),s0=iv.extend({action:G.enum(["accept","decline","cancel"]),content:G.optional(G.record(G.string(),G.unknown()))}),qX=G.object({type:G.literal("ref/resource"),uri:G.string()}).passthrough();var PX=G.object({type:G.literal("ref/prompt"),name:G.string()}).passthrough(),W0=Tv.extend({method:G.literal("completion/complete"),params:pv.extend({ref:G.union([PX,qX]),argument:G.object({name:G.string(),value:G.string()}).passthrough(),context:G.optional(G.object({arguments:G.optional(G.record(G.string(),G.string()))}))})}),KX=iv.extend({completion:G.object({values:G.array(G.string()).max(100),total:G.optional(G.number().int()),hasMore:G.optional(G.boolean())}).passthrough()}),zX=G.object({uri:G.string().startsWith("file://"),name:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).passthrough(),$X=Tv.extend({method:G.literal("roots/list")}),t0=iv.extend({roots:G.array(zX)}),LX=qf.extend({method:G.literal("notifications/roots/list_changed")}),d2=G.union([n1,r0,W0,d0,v0,e1,o1,s1,t1,C5,T5,Q0,f0]),o2=G.union([c1,p1,a0,LX]),s2=G.union([a1,o0,s0,t0]),t2=G.union([n1,WX,BX,$X]),e2=G.union([c1,p1,e5,x5,Z5,t5,i5]),v4=G.union([a1,R5,KX,p5,r5,y5,l5,I5,h8,s5]);class zv extends Error{constructor(f,v,W){super(`MCP error ${f}: ${v}`);this.code=f,this.data=W,this.name="McpError"}}var MX=60000;class e0{constructor(f){this._options=f,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(c1,(v)=>{let W=this._requestHandlerAbortControllers.get(v.params.requestId);W===null||W===void 0||W.abort(v.params.reason)}),this.setNotificationHandler(p1,(v)=>{this._onprogress(v)}),this.setRequestHandler(n1,(v)=>({}))}_setupTimeout(f,v,W,J,Q=!1){this._timeoutInfo.set(f,{timeoutId:setTimeout(J,v),startTime:Date.now(),timeout:v,maxTotalTimeout:W,resetTimeoutOnProgress:Q,onTimeout:J})}_resetTimeout(f){let v=this._timeoutInfo.get(f);if(!v)return!1;let W=Date.now()-v.startTime;if(v.maxTotalTimeout&&W>=v.maxTotalTimeout)throw this._timeoutInfo.delete(f),new zv(Kv.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:W});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout(f){let v=this._timeoutInfo.get(f);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete(f)}async connect(f){var v,W,J;this._transport=f;let Q=(v=this.transport)===null||v===void 0?void 0:v.onclose;this._transport.onclose=()=>{Q===null||Q===void 0||Q(),this._onclose()};let X=(W=this.transport)===null||W===void 0?void 0:W.onerror;this._transport.onerror=(w)=>{X===null||X===void 0||X(w),this._onerror(w)};let Y=(J=this._transport)===null||J===void 0?void 0:J.onmessage;this._transport.onmessage=(w,B)=>{if(Y===null||Y===void 0||Y(w,B),m0(w)||E8(w))this._onresponse(w);else if(M8(w))this._onrequest(w,B);else if(V8(w))this._onnotification(w);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(w)}`))},await this._transport.start()}_onclose(){var f;let v=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(f=this.onclose)===null||f===void 0||f.call(this);let W=new zv(Kv.ConnectionClosed,"Connection closed");for(let J of v.values())J(W)}_onerror(f){var v;(v=this.onerror)===null||v===void 0||v.call(this,f)}_onnotification(f){var v;let W=(v=this._notificationHandlers.get(f.method))!==null&&v!==void 0?v:this.fallbackNotificationHandler;if(W===void 0)return;Promise.resolve().then(()=>W(f)).catch((J)=>this._onerror(new Error(`Uncaught error in notification handler: ${J}`)))}_onrequest(f,v){var W,J;let Q=(W=this._requestHandlers.get(f.method))!==null&&W!==void 0?W:this.fallbackRequestHandler,X=this._transport;if(Q===void 0){X===null||X===void 0||X.send({jsonrpc:"2.0",id:f.id,error:{code:Kv.MethodNotFound,message:"Method not found"}}).catch((B)=>this._onerror(new Error(`Failed to send an error response: ${B}`)));return}let Y=new AbortController;this._requestHandlerAbortControllers.set(f.id,Y);let w={signal:Y.signal,sessionId:X===null||X===void 0?void 0:X.sessionId,_meta:(J=f.params)===null||J===void 0?void 0:J._meta,sendNotification:(B)=>this.notification(B,{relatedRequestId:f.id}),sendRequest:(B,z,K)=>this.request(B,z,{...K,relatedRequestId:f.id}),authInfo:v===null||v===void 0?void 0:v.authInfo,requestId:f.id,requestInfo:v===null||v===void 0?void 0:v.requestInfo};Promise.resolve().then(()=>Q(f,w)).then((B)=>{if(Y.signal.aborted)return;return X===null||X===void 0?void 0:X.send({result:B,jsonrpc:"2.0",id:f.id})},(B)=>{var z;if(Y.signal.aborted)return;return X===null||X===void 0?void 0:X.send({jsonrpc:"2.0",id:f.id,error:{code:Number.isSafeInteger(B.code)?B.code:Kv.InternalError,message:(z=B.message)!==null&&z!==void 0?z:"Internal error"}})}).catch((B)=>this._onerror(new Error(`Failed to send response: ${B}`))).finally(()=>{this._requestHandlerAbortControllers.delete(f.id)})}_onprogress(f){let{progressToken:v,...W}=f.params,J=Number(v),Q=this._progressHandlers.get(J);if(!Q){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(f)}`));return}let X=this._responseHandlers.get(J),Y=this._timeoutInfo.get(J);if(Y&&X&&Y.resetTimeoutOnProgress)try{this._resetTimeout(J)}catch(w){X(w);return}Q(W)}_onresponse(f){let v=Number(f.id),W=this._responseHandlers.get(v);if(W===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(f)}`));return}if(this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),m0(f))W(f);else{let J=new zv(f.error.code,f.error.message,f.error.data);W(J)}}get transport(){return this._transport}async close(){var f;await((f=this._transport)===null||f===void 0?void 0:f.close())}request(f,v,W){let{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}=W!==null&&W!==void 0?W:{};return new Promise((Y,w)=>{var B,z,K,L,V,q;if(!this._transport){w(new Error("Not connected"));return}if(((B=this._options)===null||B===void 0?void 0:B.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(f.method);(z=W===null||W===void 0?void 0:W.signal)===null||z===void 0||z.throwIfAborted();let M=this._requestMessageId++,N={...f,jsonrpc:"2.0",id:M};if(W===null||W===void 0?void 0:W.onprogress)this._progressHandlers.set(M,W.onprogress),N.params={...f.params,_meta:{...((K=f.params)===null||K===void 0?void 0:K._meta)||{},progressToken:M}};let $=(H)=>{var k;this._responseHandlers.delete(M),this._progressHandlers.delete(M),this._cleanupTimeout(M),(k=this._transport)===null||k===void 0||k.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(H)}},{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}).catch((l)=>this._onerror(new Error(`Failed to send cancellation: ${l}`))),w(H)};this._responseHandlers.set(M,(H)=>{var k;if((k=W===null||W===void 0?void 0:W.signal)===null||k===void 0?void 0:k.aborted)return;if(H instanceof Error)return w(H);try{let l=v.parse(H.result);Y(l)}catch(l){w(l)}}),(L=W===null||W===void 0?void 0:W.signal)===null||L===void 0||L.addEventListener("abort",()=>{var H;$((H=W===null||W===void 0?void 0:W.signal)===null||H===void 0?void 0:H.reason)});let O=(V=W===null||W===void 0?void 0:W.timeout)!==null&&V!==void 0?V:MX,h=()=>$(new zv(Kv.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(M,O,W===null||W===void 0?void 0:W.maxTotalTimeout,h,(q=W===null||W===void 0?void 0:W.resetTimeoutOnProgress)!==null&&q!==void 0?q:!1),this._transport.send(N,{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}).catch((H)=>{this._cleanupTimeout(M),w(H)})})}async notification(f,v){var W,J;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(f.method),((J=(W=this._options)===null||W===void 0?void 0:W.debouncedNotificationMethods)!==null&&J!==void 0?J:[]).includes(f.method)&&!f.params&&!(v===null||v===void 0?void 0:v.relatedRequestId)){if(this._pendingDebouncedNotifications.has(f.method))return;this._pendingDebouncedNotifications.add(f.method),Promise.resolve().then(()=>{var w;if(this._pendingDebouncedNotifications.delete(f.method),!this._transport)return;let B={...f,jsonrpc:"2.0"};(w=this._transport)===null||w===void 0||w.send(B,v).catch((z)=>this._onerror(z))});return}let Y={...f,jsonrpc:"2.0"};await this._transport.send(Y,v)}setRequestHandler(f,v){let W=f.shape.method.value;this.assertRequestHandlerCapability(W),this._requestHandlers.set(W,(J,Q)=>{return Promise.resolve(v(f.parse(J),Q))})}removeRequestHandler(f){this._requestHandlers.delete(f)}assertCanSetRequestHandler(f){if(this._requestHandlers.has(f))throw new Error(`A request handler for ${f} already exists, which would be overridden`)}setNotificationHandler(f,v){this._notificationHandlers.set(f.shape.method.value,(W)=>Promise.resolve(v(f.parse(W))))}removeNotificationHandler(f){this._notificationHandlers.delete(f)}}function b8(f,v){return Object.entries(v).reduce((W,[J,Q])=>{if(Q&&typeof Q==="object")W[J]=W[J]?{...W[J],...Q}:Q;else W[J]=Q;return W},{...f})}var k9=M6(R9(),1);class HQ extends e0{constructor(f,v){var W;super(v);if(this._serverInfo=f,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(b1.options.map((J,Q)=>[J,Q])),this.isMessageIgnored=(J,Q)=>{let X=this._loggingLevels.get(Q);return X?this.LOG_LEVEL_SEVERITY.get(J)<this.LOG_LEVEL_SEVERITY.get(X):!1},this._capabilities=(W=v===null||v===void 0?void 0:v.capabilities)!==null&&W!==void 0?W:{},this._instructions=v===null||v===void 0?void 0:v.instructions,this.setRequestHandler(r0,(J)=>this._oninitialize(J)),this.setNotificationHandler(a0,()=>{var J;return(J=this.oninitialized)===null||J===void 0?void 0:J.call(this)}),this._capabilities.logging)this.setRequestHandler(d0,async(J,Q)=>{var X;let Y=Q.sessionId||((X=Q.requestInfo)===null||X===void 0?void 0:X.headers["mcp-session-id"])||void 0,{level:w}=J.params,B=b1.safeParse(w);if(B.success)this._loggingLevels.set(Y,B.data);return{}})}registerCapabilities(f){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=b8(this._capabilities,f)}assertCapabilityForMethod(f){var v,W,J;switch(f){case"sampling/createMessage":if(!((v=this._clientCapabilities)===null||v===void 0?void 0:v.sampling))throw new Error(`Client does not support sampling (required for ${f})`);break;case"elicitation/create":if(!((W=this._clientCapabilities)===null||W===void 0?void 0:W.elicitation))throw new Error(`Client does not support elicitation (required for ${f})`);break;case"roots/list":if(!((J=this._clientCapabilities)===null||J===void 0?void 0:J.roots))throw new Error(`Client does not support listing roots (required for ${f})`);break;case"ping":break}}assertNotificationCapability(f){switch(f){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${f})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${f})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${f})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(f){switch(f){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${f})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${f})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${f})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${f})`);break;case"ping":case"initialize":break}}async _oninitialize(f){let v=f.params.protocolVersion;return this._clientCapabilities=f.params.capabilities,this._clientVersion=f.params.clientInfo,{protocolVersion:K8.includes(v)?v:u0,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},a1)}async createMessage(f,v){return this.request({method:"sampling/createMessage",params:f},o0,v)}async elicitInput(f,v){let W=await this.request({method:"elicitation/create",params:f},s0,v);if(W.action==="accept"&&W.content)try{let J=new k9.default,Q=J.compile(f.requestedSchema);if(!Q(W.content))throw new zv(Kv.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorsText(Q.errors)}`)}catch(J){if(J instanceof zv)throw J;throw new zv(Kv.InternalError,`Error validating elicitation response: ${J}`)}return W}async listRoots(f,v){return this.request({method:"roots/list",params:f},t0,v)}async sendLoggingMessage(f,v){if(this._capabilities.logging){if(!this.isMessageIgnored(f.level,v))return this.notification({method:"notifications/message",params:f})}}async sendResourceUpdated(f){return this.notification({method:"notifications/resources/updated",params:f})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var y9=Symbol("Let zodToJsonSchema decide on which parser to use");var S9={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},l9=(f)=>typeof f==="string"?{...S9,name:f}:{...S9,...f};var I9=(f)=>{let v=l9(f),W=v.name!==void 0?[...v.basePath,v.definitionPath,v.name]:v.basePath;return{...v,flags:{hasReferencedOpenAiAnyType:!1},currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(v.definitions).map(([J,Q])=>[Q._def,{def:Q._def,path:[...v.basePath,v.definitionPath,J],jsonSchema:void 0}]))}};function FQ(f,v,W,J){if(!J?.errorMessages)return;if(W)f.errorMessage={...f.errorMessage,[v]:W}}function Wv(f,v,W,J,Q){f[v]=W,FQ(f,v,J,Q)}var O0=(f,v)=>{let W=0;for(;W<f.length&&W<v.length;W++)if(f[W]!==v[W])break;return[(f.length-W).toString(),...v.slice(W)].join("/")};function Mv(f){if(f.target!=="openAi")return{};let v=[...f.basePath,f.definitionPath,f.openAiAnyTypeName];return f.flags.hasReferencedOpenAiAnyType=!0,{$ref:f.$refStrategy==="relative"?O0(v,f.currentPath):v.join("/")}}function Z9(f,v){let W={type:"array"};if(f.type?._def&&f.type?._def?.typeName!==C.ZodAny)W.items=o(f.type._def,{...v,currentPath:[...v.currentPath,"items"]});if(f.minLength)Wv(W,"minItems",f.minLength.value,f.minLength.message,v);if(f.maxLength)Wv(W,"maxItems",f.maxLength.value,f.maxLength.message,v);if(f.exactLength)Wv(W,"minItems",f.exactLength.value,f.exactLength.message,v),Wv(W,"maxItems",f.exactLength.value,f.exactLength.message,v);return W}function C9(f,v){let W={type:"integer",format:"int64"};if(!f.checks)return W;for(let J of f.checks)switch(J.kind){case"min":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"minimum",J.value,J.message,v);else Wv(W,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMinimum=!0;Wv(W,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"maximum",J.value,J.message,v);else Wv(W,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMaximum=!0;Wv(W,"maximum",J.value,J.message,v)}break;case"multipleOf":Wv(W,"multipleOf",J.value,J.message,v);break}return W}function T9(){return{type:"boolean"}}function U0(f,v){return o(f.type._def,v)}var x9=(f,v)=>{return o(f.innerType._def,v)};function AQ(f,v,W){let J=W??v.dateStrategy;if(Array.isArray(J))return{anyOf:J.map((Q,X)=>AQ(f,v,Q))};switch(J){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return dY(f,v)}}var dY=(f,v)=>{let W={type:"integer",format:"unix-time"};if(v.target==="openApi3")return W;for(let J of f.checks)switch(J.kind){case"min":Wv(W,"minimum",J.value,J.message,v);break;case"max":Wv(W,"maximum",J.value,J.message,v);break}return W};function u9(f,v){return{...o(f.innerType._def,v),default:f.defaultValue()}}function m9(f,v){return v.effectStrategy==="input"?o(f.schema._def,v):Mv(v)}function r9(f){return{type:"string",enum:Array.from(f.values)}}var oY=(f)=>{if("type"in f&&f.type==="string")return!1;return"allOf"in f};function a9(f,v){let W=[o(f.left._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),o(f.right._def,{...v,currentPath:[...v.currentPath,"allOf","1"]})].filter((X)=>!!X),J=v.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,Q=[];return W.forEach((X)=>{if(oY(X)){if(Q.push(...X.allOf),X.unevaluatedProperties===void 0)J=void 0}else{let Y=X;if("additionalProperties"in X&&X.additionalProperties===!1){let{additionalProperties:w,...B}=X;Y=B}else J=void 0;Q.push(Y)}}),Q.length?{allOf:Q,...J}:void 0}function c9(f,v){let W=typeof f.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray(f.value)?"array":"object"};if(v.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[f.value]};return{type:W==="bigint"?"integer":W,const:f.value}}var gQ=void 0,ff={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(gQ===void 0)gQ=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return gQ},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function H0(f,v){let W={type:"string"};if(f.checks)for(let J of f.checks)switch(J.kind){case"min":Wv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,J.value):J.value,J.message,v);break;case"max":Wv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,J.value):J.value,J.message,v);break;case"email":switch(v.emailStrategy){case"format:email":Qf(W,"email",J.message,v);break;case"format:idn-email":Qf(W,"idn-email",J.message,v);break;case"pattern:zod":Iv(W,ff.email,J.message,v);break}break;case"url":Qf(W,"uri",J.message,v);break;case"uuid":Qf(W,"uuid",J.message,v);break;case"regex":Iv(W,J.regex,J.message,v);break;case"cuid":Iv(W,ff.cuid,J.message,v);break;case"cuid2":Iv(W,ff.cuid2,J.message,v);break;case"startsWith":Iv(W,RegExp(`^${_Q(J.value,v)}`),J.message,v);break;case"endsWith":Iv(W,RegExp(`${_Q(J.value,v)}$`),J.message,v);break;case"datetime":Qf(W,"date-time",J.message,v);break;case"date":Qf(W,"date",J.message,v);break;case"time":Qf(W,"time",J.message,v);break;case"duration":Qf(W,"duration",J.message,v);break;case"length":Wv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,J.value):J.value,J.message,v),Wv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,J.value):J.value,J.message,v);break;case"includes":{Iv(W,RegExp(_Q(J.value,v)),J.message,v);break}case"ip":{if(J.version!=="v6")Qf(W,"ipv4",J.message,v);if(J.version!=="v4")Qf(W,"ipv6",J.message,v);break}case"base64url":Iv(W,ff.base64url,J.message,v);break;case"jwt":Iv(W,ff.jwt,J.message,v);break;case"cidr":{if(J.version!=="v6")Iv(W,ff.ipv4Cidr,J.message,v);if(J.version!=="v4")Iv(W,ff.ipv6Cidr,J.message,v);break}case"emoji":Iv(W,ff.emoji(),J.message,v);break;case"ulid":{Iv(W,ff.ulid,J.message,v);break}case"base64":{switch(v.base64Strategy){case"format:binary":{Qf(W,"binary",J.message,v);break}case"contentEncoding:base64":{Wv(W,"contentEncoding","base64",J.message,v);break}case"pattern:zod":{Iv(W,ff.base64,J.message,v);break}}break}case"nanoid":Iv(W,ff.nanoid,J.message,v);case"toLowerCase":case"toUpperCase":case"trim":break;default:((Q)=>{})(J)}return W}function _Q(f,v){return v.patternStrategy==="escape"?tY(f):f}var sY=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function tY(f){let v="";for(let W=0;W<f.length;W++){if(!sY.has(f[W]))v+="\\";v+=f[W]}return v}function Qf(f,v,W,J){if(f.format||f.anyOf?.some((Q)=>Q.format)){if(!f.anyOf)f.anyOf=[];if(f.format){if(f.anyOf.push({format:f.format,...f.errorMessage&&J.errorMessages&&{errorMessage:{format:f.errorMessage.format}}}),delete f.format,f.errorMessage){if(delete f.errorMessage.format,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.anyOf.push({format:v,...W&&J.errorMessages&&{errorMessage:{format:W}}})}else Wv(f,"format",v,W,J)}function Iv(f,v,W,J){if(f.pattern||f.allOf?.some((Q)=>Q.pattern)){if(!f.allOf)f.allOf=[];if(f.pattern){if(f.allOf.push({pattern:f.pattern,...f.errorMessage&&J.errorMessages&&{errorMessage:{pattern:f.errorMessage.pattern}}}),delete f.pattern,f.errorMessage){if(delete f.errorMessage.pattern,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.allOf.push({pattern:n9(v,J),...W&&J.errorMessages&&{errorMessage:{pattern:W}}})}else Wv(f,"pattern",n9(v,J),W,J)}function n9(f,v){if(!v.applyRegexFlags||!f.flags)return f.source;let W={i:f.flags.includes("i"),m:f.flags.includes("m"),s:f.flags.includes("s")},J=W.i?f.source.toLowerCase():f.source,Q="",X=!1,Y=!1,w=!1;for(let B=0;B<J.length;B++){if(X){Q+=J[B],X=!1;continue}if(W.i){if(Y){if(J[B].match(/[a-z]/)){if(w)Q+=J[B],Q+=`${J[B-2]}-${J[B]}`.toUpperCase(),w=!1;else if(J[B+1]==="-"&&J[B+2]?.match(/[a-z]/))Q+=J[B],w=!0;else Q+=`${J[B]}${J[B].toUpperCase()}`;continue}}else if(J[B].match(/[a-z]/)){Q+=`[${J[B]}${J[B].toUpperCase()}]`;continue}}if(W.m){if(J[B]==="^"){Q+=`(^|(?<=[\r
8
+ Error: ${J}`)}},W2=()=>{let f;try{f=CJ.findProjectRoot()}catch{f=uJ(process.cwd(),".swic")}let v=uJ(v2(),".swic"),W=`${f}/${k0}`,J=`${v}/${k0}`;return Q2(W,J),{projectDataDir:f,sharedDataDir:v}},J2=(f)=>{let{projectBoundaryDir:v,sharedBoundaryDir:W}=f,J=`${v}/${k0}`,Q=`${W}/${k0}`,X=xQ.create({boundaryDir:J}),Y=xQ.create({boundaryDir:Q}),w=uQ.create({boundaryDir:J}),B=uQ.create({boundaryDir:Q}),z=IJ.create({fileServiceByScope:{project:X,shared:Y},folderServiceByScope:{project:w,shared:B},indexFilename:f2});return Object.freeze({DocService:z})},X2,Y2;var mJ=Df(()=>{_J();yJ();ZJ();TJ();X2=Object.freeze({createServices:J2,lazilyGetDataDirs:W2}),Y2=X2});var G={};v8(G,{void:()=>e6,util:()=>fv,unknown:()=>s6,union:()=>W5,undefined:()=>i6,tuple:()=>Y5,transformer:()=>$5,symbol:()=>p6,string:()=>B8,strictObject:()=>Q5,setErrorMap:()=>N6,set:()=>B5,record:()=>w5,quotelessJson:()=>$6,promise:()=>L5,preprocess:()=>V5,pipeline:()=>E5,ostring:()=>D5,optional:()=>M5,onumber:()=>j5,oboolean:()=>O5,objectUtil:()=>C0,object:()=>f5,number:()=>q8,nullable:()=>N5,null:()=>d6,never:()=>t6,nativeEnum:()=>z5,nan:()=>a6,map:()=>G5,makeIssue:()=>E1,literal:()=>H5,lazy:()=>P5,late:()=>r6,isValid:()=>jf,isDirty:()=>T1,isAsync:()=>tf,isAborted:()=>C1,intersection:()=>X5,instanceof:()=>m6,getParsedType:()=>wf,getErrorMap:()=>sf,function:()=>q5,enum:()=>K5,effect:()=>$5,discriminatedUnion:()=>J5,defaultErrorMap:()=>$f,datetimeRegex:()=>Y8,date:()=>n6,custom:()=>G8,coerce:()=>U5,boolean:()=>P8,bigint:()=>c6,array:()=>v5,any:()=>o6,addIssueToContext:()=>u,ZodVoid:()=>j1,ZodUnknown:()=>Of,ZodUnion:()=>J1,ZodUndefined:()=>Q1,ZodType:()=>vv,ZodTuple:()=>Bf,ZodTransformer:()=>vf,ZodSymbol:()=>D1,ZodString:()=>ov,ZodSet:()=>Tf,ZodSchema:()=>vv,ZodRecord:()=>O1,ZodReadonly:()=>P1,ZodPromise:()=>xf,ZodPipeline:()=>F1,ZodParsedType:()=>x,ZodOptional:()=>tv,ZodObject:()=>Nv,ZodNumber:()=>Uf,ZodNullable:()=>Nf,ZodNull:()=>W1,ZodNever:()=>Gf,ZodNativeEnum:()=>G1,ZodNaN:()=>h1,ZodMap:()=>U1,ZodLiteral:()=>w1,ZodLazy:()=>Y1,ZodIssueCode:()=>S,ZodIntersection:()=>X1,ZodFunction:()=>v1,ZodFirstPartyTypeKind:()=>I,ZodError:()=>Cv,ZodEnum:()=>Ff,ZodEffects:()=>vf,ZodDiscriminatedUnion:()=>x1,ZodDefault:()=>B1,ZodDate:()=>Zf,ZodCatch:()=>q1,ZodBranded:()=>u1,ZodBoolean:()=>f1,ZodBigInt:()=>hf,ZodArray:()=>sv,ZodAny:()=>Cf,Schema:()=>vv,ParseStatus:()=>bv,OK:()=>kv,NEVER:()=>h5,INVALID:()=>p,EMPTY_PATH:()=>V6,DIRTY:()=>If,BRAND:()=>u6});var fv;(function(f){f.assertEqual=(Q)=>{};function v(Q){}f.assertIs=v;function W(Q){throw new Error}f.assertNever=W,f.arrayToEnum=(Q)=>{let X={};for(let Y of Q)X[Y]=Y;return X},f.getValidEnumValues=(Q)=>{let X=f.objectKeys(Q).filter((w)=>typeof Q[Q[w]]!=="number"),Y={};for(let w of X)Y[w]=Q[w];return f.objectValues(Y)},f.objectValues=(Q)=>{return f.objectKeys(Q).map(function(X){return Q[X]})},f.objectKeys=typeof Object.keys==="function"?(Q)=>Object.keys(Q):(Q)=>{let X=[];for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X.push(Y);return X},f.find=(Q,X)=>{for(let Y of Q)if(X(Y))return Y;return},f.isInteger=typeof Number.isInteger==="function"?(Q)=>Number.isInteger(Q):(Q)=>typeof Q==="number"&&Number.isFinite(Q)&&Math.floor(Q)===Q;function J(Q,X=" | "){return Q.map((Y)=>typeof Y==="string"?`'${Y}'`:Y).join(X)}f.joinValues=J,f.jsonStringifyReplacer=(Q,X)=>{if(typeof X==="bigint")return X.toString();return X}})(fv||(fv={}));var C0;(function(f){f.mergeShapes=(v,W)=>{return{...v,...W}}})(C0||(C0={}));var x=fv.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wf=(f)=>{switch(typeof f){case"undefined":return x.undefined;case"string":return x.string;case"number":return Number.isNaN(f)?x.nan:x.number;case"boolean":return x.boolean;case"function":return x.function;case"bigint":return x.bigint;case"symbol":return x.symbol;case"object":if(Array.isArray(f))return x.array;if(f===null)return x.null;if(f.then&&typeof f.then==="function"&&f.catch&&typeof f.catch==="function")return x.promise;if(typeof Map!=="undefined"&&f instanceof Map)return x.map;if(typeof Set!=="undefined"&&f instanceof Set)return x.set;if(typeof Date!=="undefined"&&f instanceof Date)return x.date;return x.object;default:return x.unknown}};var S=fv.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),$6=(f)=>{return JSON.stringify(f,null,2).replace(/"([^"]+)":/g,"$1:")};class Cv extends Error{get errors(){return this.issues}constructor(f){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let v=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,v);else this.__proto__=v;this.name="ZodError",this.issues=f}format(f){let v=f||function(Q){return Q.message},W={_errors:[]},J=(Q)=>{for(let X of Q.issues)if(X.code==="invalid_union")X.unionErrors.map(J);else if(X.code==="invalid_return_type")J(X.returnTypeError);else if(X.code==="invalid_arguments")J(X.argumentsError);else if(X.path.length===0)W._errors.push(v(X));else{let Y=W,w=0;while(w<X.path.length){let B=X.path[w];if(w!==X.path.length-1)Y[B]=Y[B]||{_errors:[]};else Y[B]=Y[B]||{_errors:[]},Y[B]._errors.push(v(X));Y=Y[B],w++}}};return J(this),W}static assert(f){if(!(f instanceof Cv))throw new Error(`Not a ZodError: ${f}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fv.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(f=(v)=>v.message){let v={},W=[];for(let J of this.issues)if(J.path.length>0){let Q=J.path[0];v[Q]=v[Q]||[],v[Q].push(f(J))}else W.push(f(J));return{formErrors:W,fieldErrors:v}}get formErrors(){return this.flatten()}}Cv.create=(f)=>{return new Cv(f)};var M6=(f,v)=>{let W;switch(f.code){case S.invalid_type:if(f.received===x.undefined)W="Required";else W=`Expected ${f.expected}, received ${f.received}`;break;case S.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify(f.expected,fv.jsonStringifyReplacer)}`;break;case S.unrecognized_keys:W=`Unrecognized key(s) in object: ${fv.joinValues(f.keys,", ")}`;break;case S.invalid_union:W="Invalid input";break;case S.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${fv.joinValues(f.options)}`;break;case S.invalid_enum_value:W=`Invalid enum value. Expected ${fv.joinValues(f.options)}, received '${f.received}'`;break;case S.invalid_arguments:W="Invalid function arguments";break;case S.invalid_return_type:W="Invalid function return type";break;case S.invalid_date:W="Invalid date";break;case S.invalid_string:if(typeof f.validation==="object")if("includes"in f.validation){if(W=`Invalid input: must include "${f.validation.includes}"`,typeof f.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${f.validation.position}`}else if("startsWith"in f.validation)W=`Invalid input: must start with "${f.validation.startsWith}"`;else if("endsWith"in f.validation)W=`Invalid input: must end with "${f.validation.endsWith}"`;else fv.assertNever(f.validation);else if(f.validation!=="regex")W=`Invalid ${f.validation}`;else W="Invalid";break;case S.too_small:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at least":"more than"} ${f.minimum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at least":"over"} ${f.minimum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="bigint")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(f.minimum))}`;else W="Invalid input";break;case S.too_big:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at most":"less than"} ${f.maximum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at most":"under"} ${f.maximum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="bigint")W=`BigInt must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly":f.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(f.maximum))}`;else W="Invalid input";break;case S.custom:W="Invalid input";break;case S.invalid_intersection_types:W="Intersection results could not be merged";break;case S.not_multiple_of:W=`Number must be a multiple of ${f.multipleOf}`;break;case S.not_finite:W="Number must be finite";break;default:W=v.defaultError,fv.assertNever(f)}return{message:W}},$f=M6;var f8=$f;function N6(f){f8=f}function sf(){return f8}var E1=(f)=>{let{data:v,path:W,errorMaps:J,issueData:Q}=f,X=[...W,...Q.path||[]],Y={...Q,path:X};if(Q.message!==void 0)return{...Q,path:X,message:Q.message};let w="",B=J.filter((z)=>!!z).slice().reverse();for(let z of B)w=z(Y,{data:v,defaultError:w}).message;return{...Q,path:X,message:w}},V6=[];function u(f,v){let W=sf(),J=E1({issueData:v,data:f.data,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,W,W===$f?void 0:$f].filter((Q)=>!!Q)});f.common.issues.push(J)}class bv{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(f,v){let W=[];for(let J of v){if(J.status==="aborted")return p;if(J.status==="dirty")f.dirty();W.push(J.value)}return{status:f.value,value:W}}static async mergeObjectAsync(f,v){let W=[];for(let J of v){let Q=await J.key,X=await J.value;W.push({key:Q,value:X})}return bv.mergeObjectSync(f,W)}static mergeObjectSync(f,v){let W={};for(let J of v){let{key:Q,value:X}=J;if(Q.status==="aborted")return p;if(X.status==="aborted")return p;if(Q.status==="dirty")f.dirty();if(X.status==="dirty")f.dirty();if(Q.value!=="__proto__"&&(typeof X.value!=="undefined"||J.alwaysSet))W[Q.value]=X.value}return{status:f.value,value:W}}}var p=Object.freeze({status:"aborted"}),If=(f)=>({status:"dirty",value:f}),kv=(f)=>({status:"valid",value:f}),C1=(f)=>f.status==="aborted",T1=(f)=>f.status==="dirty",jf=(f)=>f.status==="valid",tf=(f)=>typeof Promise!=="undefined"&&f instanceof Promise;var a;(function(f){f.errToObj=(v)=>typeof v==="string"?{message:v}:v||{},f.toString=(v)=>typeof v==="string"?v:v?.message})(a||(a={}));class ev{constructor(f,v,W,J){this._cachedPath=[],this.parent=f,this.data=v,this._path=W,this._key=J}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var Q8=(f,v)=>{if(jf(v))return{success:!0,data:v.value};else{if(!f.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new Cv(f.common.issues);return this._error=W,this._error}}}};function t(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:J,description:Q}=f;if(v&&(W||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(Y,w)=>{let{message:B}=f;if(Y.code==="invalid_enum_value")return{message:B??w.defaultError};if(typeof w.data==="undefined")return{message:B??J??w.defaultError};if(Y.code!=="invalid_type")return{message:w.defaultError};return{message:B??W??w.defaultError}},description:Q}}class vv{get description(){return this._def.description}_getType(f){return wf(f.data)}_getOrReturnCtx(f,v){return v||{common:f.parent.common,data:f.data,parsedType:wf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}_processInputParams(f){return{status:new bv,ctx:{common:f.parent.common,data:f.data,parsedType:wf(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}}_parseSync(f){let v=this._parse(f);if(tf(v))throw new Error("Synchronous parse encountered promise.");return v}_parseAsync(f){let v=this._parse(f);return Promise.resolve(v)}parse(f,v){let W=this.safeParse(f,v);if(W.success)return W.data;throw W.error}safeParse(f,v){let W={common:{issues:[],async:v?.async??!1,contextualErrorMap:v?.errorMap},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)},J=this._parseSync({data:f,path:W.path,parent:W});return Q8(W,J)}"~validate"(f){let v={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)};if(!this["~standard"].async)try{let W=this._parseSync({data:f,path:[],parent:v});return jf(W)?{value:W.value}:{issues:v.common.issues}}catch(W){if(W?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;v.common={issues:[],async:!0}}return this._parseAsync({data:f,path:[],parent:v}).then((W)=>jf(W)?{value:W.value}:{issues:v.common.issues})}async parseAsync(f,v){let W=await this.safeParseAsync(f,v);if(W.success)return W.data;throw W.error}async safeParseAsync(f,v){let W={common:{issues:[],contextualErrorMap:v?.errorMap,async:!0},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:wf(f)},J=this._parse({data:f,path:W.path,parent:W}),Q=await(tf(J)?J:Promise.resolve(J));return Q8(W,Q)}refine(f,v){let W=(J)=>{if(typeof v==="string"||typeof v==="undefined")return{message:v};else if(typeof v==="function")return v(J);else return v};return this._refinement((J,Q)=>{let X=f(J),Y=()=>Q.addIssue({code:S.custom,...W(J)});if(typeof Promise!=="undefined"&&X instanceof Promise)return X.then((w)=>{if(!w)return Y(),!1;else return!0});if(!X)return Y(),!1;else return!0})}refinement(f,v){return this._refinement((W,J)=>{if(!f(W))return J.addIssue(typeof v==="function"?v(W,J):v),!1;else return!0})}_refinement(f){return new vf({schema:this,typeName:I.ZodEffects,effect:{type:"refinement",refinement:f}})}superRefine(f){return this._refinement(f)}constructor(f){this.spa=this.safeParseAsync,this._def=f,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(v)=>this["~validate"](v)}}optional(){return tv.create(this,this._def)}nullable(){return Nf.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sv.create(this)}promise(){return xf.create(this,this._def)}or(f){return J1.create([this,f],this._def)}and(f){return X1.create(this,f,this._def)}transform(f){return new vf({...t(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:f}})}default(f){let v=typeof f==="function"?f:()=>f;return new B1({...t(this._def),innerType:this,defaultValue:v,typeName:I.ZodDefault})}brand(){return new u1({typeName:I.ZodBranded,type:this,...t(this._def)})}catch(f){let v=typeof f==="function"?f:()=>f;return new q1({...t(this._def),innerType:this,catchValue:v,typeName:I.ZodCatch})}describe(f){return new this.constructor({...this._def,description:f})}pipe(f){return F1.create(this,f)}readonly(){return P1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var E6=/^c[^\s-]{8,}$/i,D6=/^[0-9a-z]+$/,j6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,O6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,U6=/^[a-z0-9_-]{21}$/i,h6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,F6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,g6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,A6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",T0,b6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,R6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,k6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,S6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,y6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,J8="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",l6=new RegExp(`^${J8}$`);function X8(f){let v="[0-5]\\d";if(f.precision)v=`${v}\\.\\d{${f.precision}}`;else if(f.precision==null)v=`${v}(\\.\\d+)?`;let W=f.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${v})${W}`}function I6(f){return new RegExp(`^${X8(f)}$`)}function Y8(f){let v=`${J8}T${X8(f)}`,W=[];if(W.push(f.local?"Z?":"Z"),f.offset)W.push("([+-]\\d{2}:?\\d{2})");return v=`${v}(${W.join("|")})`,new RegExp(`^${v}$`)}function Z6(f,v){if((v==="v4"||!v)&&b6.test(f))return!0;if((v==="v6"||!v)&&R6.test(f))return!0;return!1}function C6(f,v){if(!h6.test(f))return!1;try{let[W]=f.split(".");if(!W)return!1;let J=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),Q=JSON.parse(atob(J));if(typeof Q!=="object"||Q===null)return!1;if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(v&&Q.alg!==v)return!1;return!0}catch{return!1}}function T6(f,v){if((v==="v4"||!v)&&_6.test(f))return!0;if((v==="v6"||!v)&&k6.test(f))return!0;return!1}class ov extends vv{_parse(f){if(this._def.coerce)f.data=String(f.data);if(this._getType(f)!==x.string){let Q=this._getOrReturnCtx(f);return u(Q,{code:S.invalid_type,expected:x.string,received:Q.parsedType}),p}let W=new bv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.length<Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:S.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="max"){if(f.data.length>Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:S.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="length"){let X=f.data.length>Q.value,Y=f.data.length<Q.value;if(X||Y){if(J=this._getOrReturnCtx(f,J),X)u(J,{code:S.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});else if(Y)u(J,{code:S.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});W.dirty()}}else if(Q.kind==="email"){if(!g6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"email",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="emoji"){if(!T0)T0=new RegExp(A6,"u");if(!T0.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"emoji",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="uuid"){if(!O6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"uuid",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="nanoid"){if(!U6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"nanoid",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid"){if(!E6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"cuid",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid2"){if(!D6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"cuid2",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ulid"){if(!j6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"ulid",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="url")try{new URL(f.data)}catch{J=this._getOrReturnCtx(f,J),u(J,{validation:"url",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="regex"){if(Q.regex.lastIndex=0,!Q.regex.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"regex",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="trim")f.data=f.data.trim();else if(Q.kind==="includes"){if(!f.data.includes(Q.value,Q.position))J=this._getOrReturnCtx(f,J),u(J,{code:S.invalid_string,validation:{includes:Q.value,position:Q.position},message:Q.message}),W.dirty()}else if(Q.kind==="toLowerCase")f.data=f.data.toLowerCase();else if(Q.kind==="toUpperCase")f.data=f.data.toUpperCase();else if(Q.kind==="startsWith"){if(!f.data.startsWith(Q.value))J=this._getOrReturnCtx(f,J),u(J,{code:S.invalid_string,validation:{startsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="endsWith"){if(!f.data.endsWith(Q.value))J=this._getOrReturnCtx(f,J),u(J,{code:S.invalid_string,validation:{endsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="datetime"){if(!Y8(Q).test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:S.invalid_string,validation:"datetime",message:Q.message}),W.dirty()}else if(Q.kind==="date"){if(!l6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:S.invalid_string,validation:"date",message:Q.message}),W.dirty()}else if(Q.kind==="time"){if(!I6(Q).test(f.data))J=this._getOrReturnCtx(f,J),u(J,{code:S.invalid_string,validation:"time",message:Q.message}),W.dirty()}else if(Q.kind==="duration"){if(!F6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"duration",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ip"){if(!Z6(f.data,Q.version))J=this._getOrReturnCtx(f,J),u(J,{validation:"ip",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="jwt"){if(!C6(f.data,Q.alg))J=this._getOrReturnCtx(f,J),u(J,{validation:"jwt",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cidr"){if(!T6(f.data,Q.version))J=this._getOrReturnCtx(f,J),u(J,{validation:"cidr",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64"){if(!S6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"base64",code:S.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64url"){if(!y6.test(f.data))J=this._getOrReturnCtx(f,J),u(J,{validation:"base64url",code:S.invalid_string,message:Q.message}),W.dirty()}else fv.assertNever(Q);return{status:W.value,value:f.data}}_regex(f,v,W){return this.refinement((J)=>f.test(J),{validation:v,code:S.invalid_string,...a.errToObj(W)})}_addCheck(f){return new ov({...this._def,checks:[...this._def.checks,f]})}email(f){return this._addCheck({kind:"email",...a.errToObj(f)})}url(f){return this._addCheck({kind:"url",...a.errToObj(f)})}emoji(f){return this._addCheck({kind:"emoji",...a.errToObj(f)})}uuid(f){return this._addCheck({kind:"uuid",...a.errToObj(f)})}nanoid(f){return this._addCheck({kind:"nanoid",...a.errToObj(f)})}cuid(f){return this._addCheck({kind:"cuid",...a.errToObj(f)})}cuid2(f){return this._addCheck({kind:"cuid2",...a.errToObj(f)})}ulid(f){return this._addCheck({kind:"ulid",...a.errToObj(f)})}base64(f){return this._addCheck({kind:"base64",...a.errToObj(f)})}base64url(f){return this._addCheck({kind:"base64url",...a.errToObj(f)})}jwt(f){return this._addCheck({kind:"jwt",...a.errToObj(f)})}ip(f){return this._addCheck({kind:"ip",...a.errToObj(f)})}cidr(f){return this._addCheck({kind:"cidr",...a.errToObj(f)})}datetime(f){if(typeof f==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:f});return this._addCheck({kind:"datetime",precision:typeof f?.precision==="undefined"?null:f?.precision,offset:f?.offset??!1,local:f?.local??!1,...a.errToObj(f?.message)})}date(f){return this._addCheck({kind:"date",message:f})}time(f){if(typeof f==="string")return this._addCheck({kind:"time",precision:null,message:f});return this._addCheck({kind:"time",precision:typeof f?.precision==="undefined"?null:f?.precision,...a.errToObj(f?.message)})}duration(f){return this._addCheck({kind:"duration",...a.errToObj(f)})}regex(f,v){return this._addCheck({kind:"regex",regex:f,...a.errToObj(v)})}includes(f,v){return this._addCheck({kind:"includes",value:f,position:v?.position,...a.errToObj(v?.message)})}startsWith(f,v){return this._addCheck({kind:"startsWith",value:f,...a.errToObj(v)})}endsWith(f,v){return this._addCheck({kind:"endsWith",value:f,...a.errToObj(v)})}min(f,v){return this._addCheck({kind:"min",value:f,...a.errToObj(v)})}max(f,v){return this._addCheck({kind:"max",value:f,...a.errToObj(v)})}length(f,v){return this._addCheck({kind:"length",value:f,...a.errToObj(v)})}nonempty(f){return this.min(1,a.errToObj(f))}trim(){return new ov({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ov({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ov({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((f)=>f.kind==="datetime")}get isDate(){return!!this._def.checks.find((f)=>f.kind==="date")}get isTime(){return!!this._def.checks.find((f)=>f.kind==="time")}get isDuration(){return!!this._def.checks.find((f)=>f.kind==="duration")}get isEmail(){return!!this._def.checks.find((f)=>f.kind==="email")}get isURL(){return!!this._def.checks.find((f)=>f.kind==="url")}get isEmoji(){return!!this._def.checks.find((f)=>f.kind==="emoji")}get isUUID(){return!!this._def.checks.find((f)=>f.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((f)=>f.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((f)=>f.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((f)=>f.kind==="cuid2")}get isULID(){return!!this._def.checks.find((f)=>f.kind==="ulid")}get isIP(){return!!this._def.checks.find((f)=>f.kind==="ip")}get isCIDR(){return!!this._def.checks.find((f)=>f.kind==="cidr")}get isBase64(){return!!this._def.checks.find((f)=>f.kind==="base64")}get isBase64url(){return!!this._def.checks.find((f)=>f.kind==="base64url")}get minLength(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxLength(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}}ov.create=(f)=>{return new ov({checks:[],typeName:I.ZodString,coerce:f?.coerce??!1,...t(f)})};function x6(f,v){let W=(f.toString().split(".")[1]||"").length,J=(v.toString().split(".")[1]||"").length,Q=W>J?W:J,X=Number.parseInt(f.toFixed(Q).replace(".","")),Y=Number.parseInt(v.toFixed(Q).replace(".",""));return X%Y/10**Q}class Uf extends vv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(f){if(this._def.coerce)f.data=Number(f.data);if(this._getType(f)!==x.number){let Q=this._getOrReturnCtx(f);return u(Q,{code:S.invalid_type,expected:x.number,received:Q.parsedType}),p}let W=void 0,J=new bv;for(let Q of this._def.checks)if(Q.kind==="int"){if(!fv.isInteger(f.data))W=this._getOrReturnCtx(f,W),u(W,{code:S.invalid_type,expected:"integer",received:"float",message:Q.message}),J.dirty()}else if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:S.too_small,minimum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:S.too_big,maximum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(x6(f.data,Q.value)!==0)W=this._getOrReturnCtx(f,W),u(W,{code:S.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else if(Q.kind==="finite"){if(!Number.isFinite(f.data))W=this._getOrReturnCtx(f,W),u(W,{code:S.not_finite,message:Q.message}),J.dirty()}else fv.assertNever(Q);return{status:J.value,value:f.data}}gte(f,v){return this.setLimit("min",f,!0,a.toString(v))}gt(f,v){return this.setLimit("min",f,!1,a.toString(v))}lte(f,v){return this.setLimit("max",f,!0,a.toString(v))}lt(f,v){return this.setLimit("max",f,!1,a.toString(v))}setLimit(f,v,W,J){return new Uf({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:a.toString(J)}]})}_addCheck(f){return new Uf({...this._def,checks:[...this._def.checks,f]})}int(f){return this._addCheck({kind:"int",message:a.toString(f)})}positive(f){return this._addCheck({kind:"min",value:0,inclusive:!1,message:a.toString(f)})}negative(f){return this._addCheck({kind:"max",value:0,inclusive:!1,message:a.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:0,inclusive:!0,message:a.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:0,inclusive:!0,message:a.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:a.toString(v)})}finite(f){return this._addCheck({kind:"finite",message:a.toString(f)})}safe(f){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:a.toString(f)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:a.toString(f)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}get isInt(){return!!this._def.checks.find((f)=>f.kind==="int"||f.kind==="multipleOf"&&fv.isInteger(f.value))}get isFinite(){let f=null,v=null;for(let W of this._def.checks)if(W.kind==="finite"||W.kind==="int"||W.kind==="multipleOf")return!0;else if(W.kind==="min"){if(v===null||W.value>v)v=W.value}else if(W.kind==="max"){if(f===null||W.value<f)f=W.value}return Number.isFinite(v)&&Number.isFinite(f)}}Uf.create=(f)=>{return new Uf({checks:[],typeName:I.ZodNumber,coerce:f?.coerce||!1,...t(f)})};class hf extends vv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(f){if(this._def.coerce)try{f.data=BigInt(f.data)}catch{return this._getInvalidInput(f)}if(this._getType(f)!==x.bigint)return this._getInvalidInput(f);let W=void 0,J=new bv;for(let Q of this._def.checks)if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:S.too_small,type:"bigint",minimum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),u(W,{code:S.too_big,type:"bigint",maximum:Q.value,inclusive:Q.inclusive,message:Q.message}),J.dirty()}else if(Q.kind==="multipleOf"){if(f.data%Q.value!==BigInt(0))W=this._getOrReturnCtx(f,W),u(W,{code:S.not_multiple_of,multipleOf:Q.value,message:Q.message}),J.dirty()}else fv.assertNever(Q);return{status:J.value,value:f.data}}_getInvalidInput(f){let v=this._getOrReturnCtx(f);return u(v,{code:S.invalid_type,expected:x.bigint,received:v.parsedType}),p}gte(f,v){return this.setLimit("min",f,!0,a.toString(v))}gt(f,v){return this.setLimit("min",f,!1,a.toString(v))}lte(f,v){return this.setLimit("max",f,!0,a.toString(v))}lt(f,v){return this.setLimit("max",f,!1,a.toString(v))}setLimit(f,v,W,J){return new hf({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:a.toString(J)}]})}_addCheck(f){return new hf({...this._def,checks:[...this._def.checks,f]})}positive(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:a.toString(f)})}negative(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:a.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:a.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:a.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:a.toString(v)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}}hf.create=(f)=>{return new hf({checks:[],typeName:I.ZodBigInt,coerce:f?.coerce??!1,...t(f)})};class f1 extends vv{_parse(f){if(this._def.coerce)f.data=Boolean(f.data);if(this._getType(f)!==x.boolean){let W=this._getOrReturnCtx(f);return u(W,{code:S.invalid_type,expected:x.boolean,received:W.parsedType}),p}return kv(f.data)}}f1.create=(f)=>{return new f1({typeName:I.ZodBoolean,coerce:f?.coerce||!1,...t(f)})};class Zf extends vv{_parse(f){if(this._def.coerce)f.data=new Date(f.data);if(this._getType(f)!==x.date){let Q=this._getOrReturnCtx(f);return u(Q,{code:S.invalid_type,expected:x.date,received:Q.parsedType}),p}if(Number.isNaN(f.data.getTime())){let Q=this._getOrReturnCtx(f);return u(Q,{code:S.invalid_date}),p}let W=new bv,J=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.getTime()<Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:S.too_small,message:Q.message,inclusive:!0,exact:!1,minimum:Q.value,type:"date"}),W.dirty()}else if(Q.kind==="max"){if(f.data.getTime()>Q.value)J=this._getOrReturnCtx(f,J),u(J,{code:S.too_big,message:Q.message,inclusive:!0,exact:!1,maximum:Q.value,type:"date"}),W.dirty()}else fv.assertNever(Q);return{status:W.value,value:new Date(f.data.getTime())}}_addCheck(f){return new Zf({...this._def,checks:[...this._def.checks,f]})}min(f,v){return this._addCheck({kind:"min",value:f.getTime(),message:a.toString(v)})}max(f,v){return this._addCheck({kind:"max",value:f.getTime(),message:a.toString(v)})}get minDate(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f!=null?new Date(f):null}get maxDate(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f!=null?new Date(f):null}}Zf.create=(f)=>{return new Zf({checks:[],coerce:f?.coerce||!1,typeName:I.ZodDate,...t(f)})};class D1 extends vv{_parse(f){if(this._getType(f)!==x.symbol){let W=this._getOrReturnCtx(f);return u(W,{code:S.invalid_type,expected:x.symbol,received:W.parsedType}),p}return kv(f.data)}}D1.create=(f)=>{return new D1({typeName:I.ZodSymbol,...t(f)})};class Q1 extends vv{_parse(f){if(this._getType(f)!==x.undefined){let W=this._getOrReturnCtx(f);return u(W,{code:S.invalid_type,expected:x.undefined,received:W.parsedType}),p}return kv(f.data)}}Q1.create=(f)=>{return new Q1({typeName:I.ZodUndefined,...t(f)})};class W1 extends vv{_parse(f){if(this._getType(f)!==x.null){let W=this._getOrReturnCtx(f);return u(W,{code:S.invalid_type,expected:x.null,received:W.parsedType}),p}return kv(f.data)}}W1.create=(f)=>{return new W1({typeName:I.ZodNull,...t(f)})};class Cf extends vv{constructor(){super(...arguments);this._any=!0}_parse(f){return kv(f.data)}}Cf.create=(f)=>{return new Cf({typeName:I.ZodAny,...t(f)})};class Of extends vv{constructor(){super(...arguments);this._unknown=!0}_parse(f){return kv(f.data)}}Of.create=(f)=>{return new Of({typeName:I.ZodUnknown,...t(f)})};class Gf extends vv{_parse(f){let v=this._getOrReturnCtx(f);return u(v,{code:S.invalid_type,expected:x.never,received:v.parsedType}),p}}Gf.create=(f)=>{return new Gf({typeName:I.ZodNever,...t(f)})};class j1 extends vv{_parse(f){if(this._getType(f)!==x.undefined){let W=this._getOrReturnCtx(f);return u(W,{code:S.invalid_type,expected:x.void,received:W.parsedType}),p}return kv(f.data)}}j1.create=(f)=>{return new j1({typeName:I.ZodVoid,...t(f)})};class sv extends vv{_parse(f){let{ctx:v,status:W}=this._processInputParams(f),J=this._def;if(v.parsedType!==x.array)return u(v,{code:S.invalid_type,expected:x.array,received:v.parsedType}),p;if(J.exactLength!==null){let X=v.data.length>J.exactLength.value,Y=v.data.length<J.exactLength.value;if(X||Y)u(v,{code:X?S.too_big:S.too_small,minimum:Y?J.exactLength.value:void 0,maximum:X?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),W.dirty()}if(J.minLength!==null){if(v.data.length<J.minLength.value)u(v,{code:S.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),W.dirty()}if(J.maxLength!==null){if(v.data.length>J.maxLength.value)u(v,{code:S.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),W.dirty()}if(v.common.async)return Promise.all([...v.data].map((X,Y)=>{return J.type._parseAsync(new ev(v,X,v.path,Y))})).then((X)=>{return bv.mergeArray(W,X)});let Q=[...v.data].map((X,Y)=>{return J.type._parseSync(new ev(v,X,v.path,Y))});return bv.mergeArray(W,Q)}get element(){return this._def.type}min(f,v){return new sv({...this._def,minLength:{value:f,message:a.toString(v)}})}max(f,v){return new sv({...this._def,maxLength:{value:f,message:a.toString(v)}})}length(f,v){return new sv({...this._def,exactLength:{value:f,message:a.toString(v)}})}nonempty(f){return this.min(1,f)}}sv.create=(f,v)=>{return new sv({type:f,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...t(v)})};function ef(f){if(f instanceof Nv){let v={};for(let W in f.shape){let J=f.shape[W];v[W]=tv.create(ef(J))}return new Nv({...f._def,shape:()=>v})}else if(f instanceof sv)return new sv({...f._def,type:ef(f.element)});else if(f instanceof tv)return tv.create(ef(f.unwrap()));else if(f instanceof Nf)return Nf.create(ef(f.unwrap()));else if(f instanceof Bf)return Bf.create(f.items.map((v)=>ef(v)));else return f}class Nv extends vv{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let f=this._def.shape(),v=fv.objectKeys(f);return this._cached={shape:f,keys:v},this._cached}_parse(f){if(this._getType(f)!==x.object){let B=this._getOrReturnCtx(f);return u(B,{code:S.invalid_type,expected:x.object,received:B.parsedType}),p}let{status:W,ctx:J}=this._processInputParams(f),{shape:Q,keys:X}=this._getCached(),Y=[];if(!(this._def.catchall instanceof Gf&&this._def.unknownKeys==="strip")){for(let B in J.data)if(!X.includes(B))Y.push(B)}let w=[];for(let B of X){let z=Q[B],H=J.data[B];w.push({key:{status:"valid",value:B},value:z._parse(new ev(J,H,J.path,B)),alwaysSet:B in J.data})}if(this._def.catchall instanceof Gf){let B=this._def.unknownKeys;if(B==="passthrough")for(let z of Y)w.push({key:{status:"valid",value:z},value:{status:"valid",value:J.data[z]}});else if(B==="strict"){if(Y.length>0)u(J,{code:S.unrecognized_keys,keys:Y}),W.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let z of Y){let H=J.data[z];w.push({key:{status:"valid",value:z},value:B._parse(new ev(J,H,J.path,z)),alwaysSet:z in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let B=[];for(let z of w){let H=await z.key,$=await z.value;B.push({key:H,value:$,alwaysSet:z.alwaysSet})}return B}).then((B)=>{return bv.mergeObjectSync(W,B)});else return bv.mergeObjectSync(W,w)}get shape(){return this._def.shape()}strict(f){return a.errToObj,new Nv({...this._def,unknownKeys:"strict",...f!==void 0?{errorMap:(v,W)=>{let J=this._def.errorMap?.(v,W).message??W.defaultError;if(v.code==="unrecognized_keys")return{message:a.errToObj(f).message??J};return{message:J}}}:{}})}strip(){return new Nv({...this._def,unknownKeys:"strip"})}passthrough(){return new Nv({...this._def,unknownKeys:"passthrough"})}extend(f){return new Nv({...this._def,shape:()=>({...this._def.shape(),...f})})}merge(f){return new Nv({unknownKeys:f._def.unknownKeys,catchall:f._def.catchall,shape:()=>({...this._def.shape(),...f._def.shape()}),typeName:I.ZodObject})}setKey(f,v){return this.augment({[f]:v})}catchall(f){return new Nv({...this._def,catchall:f})}pick(f){let v={};for(let W of fv.objectKeys(f))if(f[W]&&this.shape[W])v[W]=this.shape[W];return new Nv({...this._def,shape:()=>v})}omit(f){let v={};for(let W of fv.objectKeys(this.shape))if(!f[W])v[W]=this.shape[W];return new Nv({...this._def,shape:()=>v})}deepPartial(){return ef(this)}partial(f){let v={};for(let W of fv.objectKeys(this.shape)){let J=this.shape[W];if(f&&!f[W])v[W]=J;else v[W]=J.optional()}return new Nv({...this._def,shape:()=>v})}required(f){let v={};for(let W of fv.objectKeys(this.shape))if(f&&!f[W])v[W]=this.shape[W];else{let Q=this.shape[W];while(Q instanceof tv)Q=Q._def.innerType;v[W]=Q}return new Nv({...this._def,shape:()=>v})}keyof(){return w8(fv.objectKeys(this.shape))}}Nv.create=(f,v)=>{return new Nv({shape:()=>f,unknownKeys:"strip",catchall:Gf.create(),typeName:I.ZodObject,...t(v)})};Nv.strictCreate=(f,v)=>{return new Nv({shape:()=>f,unknownKeys:"strict",catchall:Gf.create(),typeName:I.ZodObject,...t(v)})};Nv.lazycreate=(f,v)=>{return new Nv({shape:f,unknownKeys:"strip",catchall:Gf.create(),typeName:I.ZodObject,...t(v)})};class J1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=this._def.options;function J(Q){for(let Y of Q)if(Y.result.status==="valid")return Y.result;for(let Y of Q)if(Y.result.status==="dirty")return v.common.issues.push(...Y.ctx.common.issues),Y.result;let X=Q.map((Y)=>new Cv(Y.ctx.common.issues));return u(v,{code:S.invalid_union,unionErrors:X}),p}if(v.common.async)return Promise.all(W.map(async(Q)=>{let X={...v,common:{...v.common,issues:[]},parent:null};return{result:await Q._parseAsync({data:v.data,path:v.path,parent:X}),ctx:X}})).then(J);else{let Q=void 0,X=[];for(let w of W){let B={...v,common:{...v.common,issues:[]},parent:null},z=w._parseSync({data:v.data,path:v.path,parent:B});if(z.status==="valid")return z;else if(z.status==="dirty"&&!Q)Q={result:z,ctx:B};if(B.common.issues.length)X.push(B.common.issues)}if(Q)return v.common.issues.push(...Q.ctx.common.issues),Q.result;let Y=X.map((w)=>new Cv(w));return u(v,{code:S.invalid_union,unionErrors:Y}),p}}get options(){return this._def.options}}J1.create=(f,v)=>{return new J1({options:f,typeName:I.ZodUnion,...t(v)})};var Mf=(f)=>{if(f instanceof Y1)return Mf(f.schema);else if(f instanceof vf)return Mf(f.innerType());else if(f instanceof w1)return[f.value];else if(f instanceof Ff)return f.options;else if(f instanceof G1)return fv.objectValues(f.enum);else if(f instanceof B1)return Mf(f._def.innerType);else if(f instanceof Q1)return[void 0];else if(f instanceof W1)return[null];else if(f instanceof tv)return[void 0,...Mf(f.unwrap())];else if(f instanceof Nf)return[null,...Mf(f.unwrap())];else if(f instanceof u1)return Mf(f.unwrap());else if(f instanceof P1)return Mf(f.unwrap());else if(f instanceof q1)return Mf(f._def.innerType);else return[]};class x1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.object)return u(v,{code:S.invalid_type,expected:x.object,received:v.parsedType}),p;let W=this.discriminator,J=v.data[W],Q=this.optionsMap.get(J);if(!Q)return u(v,{code:S.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),p;if(v.common.async)return Q._parseAsync({data:v.data,path:v.path,parent:v});else return Q._parseSync({data:v.data,path:v.path,parent:v})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(f,v,W){let J=new Map;for(let Q of v){let X=Mf(Q.shape[f]);if(!X.length)throw new Error(`A discriminator value for key \`${f}\` could not be extracted from all schema options`);for(let Y of X){if(J.has(Y))throw new Error(`Discriminator property ${String(f)} has duplicate value ${String(Y)}`);J.set(Y,Q)}}return new x1({typeName:I.ZodDiscriminatedUnion,discriminator:f,options:v,optionsMap:J,...t(W)})}}function x0(f,v){let W=wf(f),J=wf(v);if(f===v)return{valid:!0,data:f};else if(W===x.object&&J===x.object){let Q=fv.objectKeys(v),X=fv.objectKeys(f).filter((w)=>Q.indexOf(w)!==-1),Y={...f,...v};for(let w of X){let B=x0(f[w],v[w]);if(!B.valid)return{valid:!1};Y[w]=B.data}return{valid:!0,data:Y}}else if(W===x.array&&J===x.array){if(f.length!==v.length)return{valid:!1};let Q=[];for(let X=0;X<f.length;X++){let Y=f[X],w=v[X],B=x0(Y,w);if(!B.valid)return{valid:!1};Q.push(B.data)}return{valid:!0,data:Q}}else if(W===x.date&&J===x.date&&+f===+v)return{valid:!0,data:f};else return{valid:!1}}class X1 extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f),J=(Q,X)=>{if(C1(Q)||C1(X))return p;let Y=x0(Q.value,X.value);if(!Y.valid)return u(W,{code:S.invalid_intersection_types}),p;if(T1(Q)||T1(X))v.dirty();return{status:v.value,value:Y.data}};if(W.common.async)return Promise.all([this._def.left._parseAsync({data:W.data,path:W.path,parent:W}),this._def.right._parseAsync({data:W.data,path:W.path,parent:W})]).then(([Q,X])=>J(Q,X));else return J(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}}X1.create=(f,v,W)=>{return new X1({left:f,right:v,typeName:I.ZodIntersection,...t(W)})};class Bf extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.array)return u(W,{code:S.invalid_type,expected:x.array,received:W.parsedType}),p;if(W.data.length<this._def.items.length)return u(W,{code:S.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;if(!this._def.rest&&W.data.length>this._def.items.length)u(W,{code:S.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v.dirty();let Q=[...W.data].map((X,Y)=>{let w=this._def.items[Y]||this._def.rest;if(!w)return null;return w._parse(new ev(W,X,W.path,Y))}).filter((X)=>!!X);if(W.common.async)return Promise.all(Q).then((X)=>{return bv.mergeArray(v,X)});else return bv.mergeArray(v,Q)}get items(){return this._def.items}rest(f){return new Bf({...this._def,rest:f})}}Bf.create=(f,v)=>{if(!Array.isArray(f))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bf({items:f,typeName:I.ZodTuple,rest:null,...t(v)})};class O1 extends vv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.object)return u(W,{code:S.invalid_type,expected:x.object,received:W.parsedType}),p;let J=[],Q=this._def.keyType,X=this._def.valueType;for(let Y in W.data)J.push({key:Q._parse(new ev(W,Y,W.path,Y)),value:X._parse(new ev(W,W.data[Y],W.path,Y)),alwaysSet:Y in W.data});if(W.common.async)return bv.mergeObjectAsync(v,J);else return bv.mergeObjectSync(v,J)}get element(){return this._def.valueType}static create(f,v,W){if(v instanceof vv)return new O1({keyType:f,valueType:v,typeName:I.ZodRecord,...t(W)});return new O1({keyType:ov.create(),valueType:f,typeName:I.ZodRecord,...t(v)})}}class U1 extends vv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.map)return u(W,{code:S.invalid_type,expected:x.map,received:W.parsedType}),p;let J=this._def.keyType,Q=this._def.valueType,X=[...W.data.entries()].map(([Y,w],B)=>{return{key:J._parse(new ev(W,Y,W.path,[B,"key"])),value:Q._parse(new ev(W,w,W.path,[B,"value"]))}});if(W.common.async){let Y=new Map;return Promise.resolve().then(async()=>{for(let w of X){let B=await w.key,z=await w.value;if(B.status==="aborted"||z.status==="aborted")return p;if(B.status==="dirty"||z.status==="dirty")v.dirty();Y.set(B.value,z.value)}return{status:v.value,value:Y}})}else{let Y=new Map;for(let w of X){let{key:B,value:z}=w;if(B.status==="aborted"||z.status==="aborted")return p;if(B.status==="dirty"||z.status==="dirty")v.dirty();Y.set(B.value,z.value)}return{status:v.value,value:Y}}}}U1.create=(f,v,W)=>{return new U1({valueType:v,keyType:f,typeName:I.ZodMap,...t(W)})};class Tf extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==x.set)return u(W,{code:S.invalid_type,expected:x.set,received:W.parsedType}),p;let J=this._def;if(J.minSize!==null){if(W.data.size<J.minSize.value)u(W,{code:S.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),v.dirty()}if(J.maxSize!==null){if(W.data.size>J.maxSize.value)u(W,{code:S.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),v.dirty()}let Q=this._def.valueType;function X(w){let B=new Set;for(let z of w){if(z.status==="aborted")return p;if(z.status==="dirty")v.dirty();B.add(z.value)}return{status:v.value,value:B}}let Y=[...W.data.values()].map((w,B)=>Q._parse(new ev(W,w,W.path,B)));if(W.common.async)return Promise.all(Y).then((w)=>X(w));else return X(Y)}min(f,v){return new Tf({...this._def,minSize:{value:f,message:a.toString(v)}})}max(f,v){return new Tf({...this._def,maxSize:{value:f,message:a.toString(v)}})}size(f,v){return this.min(f,v).max(f,v)}nonempty(f){return this.min(1,f)}}Tf.create=(f,v)=>{return new Tf({valueType:f,minSize:null,maxSize:null,typeName:I.ZodSet,...t(v)})};class v1 extends vv{constructor(){super(...arguments);this.validate=this.implement}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.function)return u(v,{code:S.invalid_type,expected:x.function,received:v.parsedType}),p;function W(Y,w){return E1({data:Y,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,sf(),$f].filter((B)=>!!B),issueData:{code:S.invalid_arguments,argumentsError:w}})}function J(Y,w){return E1({data:Y,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,sf(),$f].filter((B)=>!!B),issueData:{code:S.invalid_return_type,returnTypeError:w}})}let Q={errorMap:v.common.contextualErrorMap},X=v.data;if(this._def.returns instanceof xf){let Y=this;return kv(async function(...w){let B=new Cv([]),z=await Y._def.args.parseAsync(w,Q).catch((K)=>{throw B.addIssue(W(w,K)),B}),H=await Reflect.apply(X,this,z);return await Y._def.returns._def.type.parseAsync(H,Q).catch((K)=>{throw B.addIssue(J(H,K)),B})})}else{let Y=this;return kv(function(...w){let B=Y._def.args.safeParse(w,Q);if(!B.success)throw new Cv([W(w,B.error)]);let z=Reflect.apply(X,this,B.data),H=Y._def.returns.safeParse(z,Q);if(!H.success)throw new Cv([J(z,H.error)]);return H.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...f){return new v1({...this._def,args:Bf.create(f).rest(Of.create())})}returns(f){return new v1({...this._def,returns:f})}implement(f){return this.parse(f)}strictImplement(f){return this.parse(f)}static create(f,v,W){return new v1({args:f?f:Bf.create([]).rest(Of.create()),returns:v||Of.create(),typeName:I.ZodFunction,...t(W)})}}class Y1 extends vv{get schema(){return this._def.getter()}_parse(f){let{ctx:v}=this._processInputParams(f);return this._def.getter()._parse({data:v.data,path:v.path,parent:v})}}Y1.create=(f,v)=>{return new Y1({getter:f,typeName:I.ZodLazy,...t(v)})};class w1 extends vv{_parse(f){if(f.data!==this._def.value){let v=this._getOrReturnCtx(f);return u(v,{received:v.data,code:S.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:f.data}}get value(){return this._def.value}}w1.create=(f,v)=>{return new w1({value:f,typeName:I.ZodLiteral,...t(v)})};function w8(f,v){return new Ff({values:f,typeName:I.ZodEnum,...t(v)})}class Ff extends vv{_parse(f){if(typeof f.data!=="string"){let v=this._getOrReturnCtx(f),W=this._def.values;return u(v,{expected:fv.joinValues(W),received:v.parsedType,code:S.invalid_type}),p}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(f.data)){let v=this._getOrReturnCtx(f),W=this._def.values;return u(v,{received:v.data,code:S.invalid_enum_value,options:W}),p}return kv(f.data)}get options(){return this._def.values}get enum(){let f={};for(let v of this._def.values)f[v]=v;return f}get Values(){let f={};for(let v of this._def.values)f[v]=v;return f}get Enum(){let f={};for(let v of this._def.values)f[v]=v;return f}extract(f,v=this._def){return Ff.create(f,{...this._def,...v})}exclude(f,v=this._def){return Ff.create(this.options.filter((W)=>!f.includes(W)),{...this._def,...v})}}Ff.create=w8;class G1 extends vv{_parse(f){let v=fv.getValidEnumValues(this._def.values),W=this._getOrReturnCtx(f);if(W.parsedType!==x.string&&W.parsedType!==x.number){let J=fv.objectValues(v);return u(W,{expected:fv.joinValues(J),received:W.parsedType,code:S.invalid_type}),p}if(!this._cache)this._cache=new Set(fv.getValidEnumValues(this._def.values));if(!this._cache.has(f.data)){let J=fv.objectValues(v);return u(W,{received:W.data,code:S.invalid_enum_value,options:J}),p}return kv(f.data)}get enum(){return this._def.values}}G1.create=(f,v)=>{return new G1({values:f,typeName:I.ZodNativeEnum,...t(v)})};class xf extends vv{unwrap(){return this._def.type}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==x.promise&&v.common.async===!1)return u(v,{code:S.invalid_type,expected:x.promise,received:v.parsedType}),p;let W=v.parsedType===x.promise?v.data:Promise.resolve(v.data);return kv(W.then((J)=>{return this._def.type.parseAsync(J,{path:v.path,errorMap:v.common.contextualErrorMap})}))}}xf.create=(f,v)=>{return new xf({type:f,typeName:I.ZodPromise,...t(v)})};class vf extends vv{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(f){let{status:v,ctx:W}=this._processInputParams(f),J=this._def.effect||null,Q={addIssue:(X)=>{if(u(W,X),X.fatal)v.abort();else v.dirty()},get path(){return W.path}};if(Q.addIssue=Q.addIssue.bind(Q),J.type==="preprocess"){let X=J.transform(W.data,Q);if(W.common.async)return Promise.resolve(X).then(async(Y)=>{if(v.value==="aborted")return p;let w=await this._def.schema._parseAsync({data:Y,path:W.path,parent:W});if(w.status==="aborted")return p;if(w.status==="dirty")return If(w.value);if(v.value==="dirty")return If(w.value);return w});else{if(v.value==="aborted")return p;let Y=this._def.schema._parseSync({data:X,path:W.path,parent:W});if(Y.status==="aborted")return p;if(Y.status==="dirty")return If(Y.value);if(v.value==="dirty")return If(Y.value);return Y}}if(J.type==="refinement"){let X=(Y)=>{let w=J.refinement(Y,Q);if(W.common.async)return Promise.resolve(w);if(w instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Y};if(W.common.async===!1){let Y=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(Y.status==="aborted")return p;if(Y.status==="dirty")v.dirty();return X(Y.value),{status:v.value,value:Y.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((Y)=>{if(Y.status==="aborted")return p;if(Y.status==="dirty")v.dirty();return X(Y.value).then(()=>{return{status:v.value,value:Y.value}})})}if(J.type==="transform")if(W.common.async===!1){let X=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!jf(X))return p;let Y=J.transform(X.value,Q);if(Y instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:v.value,value:Y}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((X)=>{if(!jf(X))return p;return Promise.resolve(J.transform(X.value,Q)).then((Y)=>({status:v.value,value:Y}))});fv.assertNever(J)}}vf.create=(f,v,W)=>{return new vf({schema:f,typeName:I.ZodEffects,effect:v,...t(W)})};vf.createWithPreprocess=(f,v,W)=>{return new vf({schema:v,effect:{type:"preprocess",transform:f},typeName:I.ZodEffects,...t(W)})};class tv extends vv{_parse(f){if(this._getType(f)===x.undefined)return kv(void 0);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}tv.create=(f,v)=>{return new tv({innerType:f,typeName:I.ZodOptional,...t(v)})};class Nf extends vv{_parse(f){if(this._getType(f)===x.null)return kv(null);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}Nf.create=(f,v)=>{return new Nf({innerType:f,typeName:I.ZodNullable,...t(v)})};class B1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;if(v.parsedType===x.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:v.path,parent:v})}removeDefault(){return this._def.innerType}}B1.create=(f,v)=>{return new B1({innerType:f,typeName:I.ZodDefault,defaultValue:typeof v.default==="function"?v.default:()=>v.default,...t(v)})};class q1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W={...v,common:{...v.common,issues:[]}},J=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(tf(J))return J.then((Q)=>{return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new Cv(W.common.issues)},input:W.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new Cv(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}}q1.create=(f,v)=>{return new q1({innerType:f,typeName:I.ZodCatch,catchValue:typeof v.catch==="function"?v.catch:()=>v.catch,...t(v)})};class h1 extends vv{_parse(f){if(this._getType(f)!==x.nan){let W=this._getOrReturnCtx(f);return u(W,{code:S.invalid_type,expected:x.nan,received:W.parsedType}),p}return{status:"valid",value:f.data}}}h1.create=(f)=>{return new h1({typeName:I.ZodNaN,...t(f)})};var u6=Symbol("zod_brand");class u1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}class F1 extends vv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.common.async)return(async()=>{let Q=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if(Q.status==="aborted")return p;if(Q.status==="dirty")return v.dirty(),If(Q.value);else return this._def.out._parseAsync({data:Q.value,path:W.path,parent:W})})();else{let J=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(J.status==="aborted")return p;if(J.status==="dirty")return v.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:W.path,parent:W})}}static create(f,v){return new F1({in:f,out:v,typeName:I.ZodPipeline})}}class P1 extends vv{_parse(f){let v=this._def.innerType._parse(f),W=(J)=>{if(jf(J))J.value=Object.freeze(J.value);return J};return tf(v)?v.then((J)=>W(J)):W(v)}unwrap(){return this._def.innerType}}P1.create=(f,v)=>{return new P1({innerType:f,typeName:I.ZodReadonly,...t(v)})};function W8(f,v){let W=typeof f==="function"?f(v):typeof f==="string"?{message:f}:f;return typeof W==="string"?{message:W}:W}function G8(f,v={},W){if(f)return Cf.create().superRefine((J,Q)=>{let X=f(J);if(X instanceof Promise)return X.then((Y)=>{if(!Y){let w=W8(v,J),B=w.fatal??W??!0;Q.addIssue({code:"custom",...w,fatal:B})}});if(!X){let Y=W8(v,J),w=Y.fatal??W??!0;Q.addIssue({code:"custom",...Y,fatal:w})}return});return Cf.create()}var r6={object:Nv.lazycreate},I;(function(f){f.ZodString="ZodString",f.ZodNumber="ZodNumber",f.ZodNaN="ZodNaN",f.ZodBigInt="ZodBigInt",f.ZodBoolean="ZodBoolean",f.ZodDate="ZodDate",f.ZodSymbol="ZodSymbol",f.ZodUndefined="ZodUndefined",f.ZodNull="ZodNull",f.ZodAny="ZodAny",f.ZodUnknown="ZodUnknown",f.ZodNever="ZodNever",f.ZodVoid="ZodVoid",f.ZodArray="ZodArray",f.ZodObject="ZodObject",f.ZodUnion="ZodUnion",f.ZodDiscriminatedUnion="ZodDiscriminatedUnion",f.ZodIntersection="ZodIntersection",f.ZodTuple="ZodTuple",f.ZodRecord="ZodRecord",f.ZodMap="ZodMap",f.ZodSet="ZodSet",f.ZodFunction="ZodFunction",f.ZodLazy="ZodLazy",f.ZodLiteral="ZodLiteral",f.ZodEnum="ZodEnum",f.ZodEffects="ZodEffects",f.ZodNativeEnum="ZodNativeEnum",f.ZodOptional="ZodOptional",f.ZodNullable="ZodNullable",f.ZodDefault="ZodDefault",f.ZodCatch="ZodCatch",f.ZodPromise="ZodPromise",f.ZodBranded="ZodBranded",f.ZodPipeline="ZodPipeline",f.ZodReadonly="ZodReadonly"})(I||(I={}));var m6=(f,v={message:`Input not instance of ${f.name}`})=>G8((W)=>W instanceof f,v),B8=ov.create,q8=Uf.create,a6=h1.create,c6=hf.create,P8=f1.create,n6=Zf.create,p6=D1.create,i6=Q1.create,d6=W1.create,o6=Cf.create,s6=Of.create,t6=Gf.create,e6=j1.create,v5=sv.create,f5=Nv.create,Q5=Nv.strictCreate,W5=J1.create,J5=x1.create,X5=X1.create,Y5=Bf.create,w5=O1.create,G5=U1.create,B5=Tf.create,q5=v1.create,P5=Y1.create,H5=w1.create,K5=Ff.create,z5=G1.create,L5=xf.create,$5=vf.create,M5=tv.create,N5=Nf.create,V5=vf.createWithPreprocess,E5=F1.create,D5=()=>B8().optional(),j5=()=>q8().optional(),O5=()=>P8().optional(),U5={string:(f)=>ov.create({...f,coerce:!0}),number:(f)=>Uf.create({...f,coerce:!0}),boolean:(f)=>f1.create({...f,coerce:!0}),bigint:(f)=>hf.create({...f,coerce:!0}),date:(f)=>Zf.create({...f,coerce:!0})};var h5=p;var u0="2025-06-18";var H8=[u0,"2025-03-26","2024-11-05","2024-10-07"],r1="2.0",K8=G.union([G.string(),G.number().int()]),z8=G.string(),F5=G.object({progressToken:G.optional(K8)}).passthrough(),pv=G.object({_meta:G.optional(F5)}).passthrough(),Tv=G.object({method:G.string(),params:G.optional(pv)}),g1=G.object({_meta:G.optional(G.object({}).passthrough())}).passthrough(),qf=G.object({method:G.string(),params:G.optional(g1)}),iv=G.object({_meta:G.optional(G.object({}).passthrough())}).passthrough(),m1=G.union([G.string(),G.number().int()]),L8=G.object({jsonrpc:G.literal(r1),id:m1}).merge(Tv).strict(),$8=(f)=>L8.safeParse(f).success,M8=G.object({jsonrpc:G.literal(r1)}).merge(qf).strict(),N8=(f)=>M8.safeParse(f).success,V8=G.object({jsonrpc:G.literal(r1),id:m1,result:iv}).strict(),r0=(f)=>V8.safeParse(f).success,Hv;(function(f){f[f.ConnectionClosed=-32000]="ConnectionClosed",f[f.RequestTimeout=-32001]="RequestTimeout",f[f.ParseError=-32700]="ParseError",f[f.InvalidRequest=-32600]="InvalidRequest",f[f.MethodNotFound=-32601]="MethodNotFound",f[f.InvalidParams=-32602]="InvalidParams",f[f.InternalError=-32603]="InternalError"})(Hv||(Hv={}));var E8=G.object({jsonrpc:G.literal(r1),id:m1,error:G.object({code:G.number().int(),message:G.string(),data:G.optional(G.unknown())})}).strict(),D8=(f)=>E8.safeParse(f).success,j8=G.union([L8,M8,V8,E8]),a1=iv.strict(),c1=qf.extend({method:G.literal("notifications/cancelled"),params:g1.extend({requestId:m1,reason:G.string().optional()})}),g5=G.object({src:G.string(),mimeType:G.optional(G.string()),sizes:G.optional(G.array(G.string()))}).passthrough(),A1=G.object({icons:G.array(g5).optional()}).passthrough(),b1=G.object({name:G.string(),title:G.optional(G.string())}).passthrough(),O8=b1.extend({version:G.string(),websiteUrl:G.optional(G.string())}).merge(A1),A5=G.object({experimental:G.optional(G.object({}).passthrough()),sampling:G.optional(G.object({}).passthrough()),elicitation:G.optional(G.object({}).passthrough()),roots:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough())}).passthrough(),m0=Tv.extend({method:G.literal("initialize"),params:pv.extend({protocolVersion:G.string(),capabilities:A5,clientInfo:O8})});var b5=G.object({experimental:G.optional(G.object({}).passthrough()),logging:G.optional(G.object({}).passthrough()),completions:G.optional(G.object({}).passthrough()),prompts:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough()),resources:G.optional(G.object({subscribe:G.optional(G.boolean()),listChanged:G.optional(G.boolean())}).passthrough()),tools:G.optional(G.object({listChanged:G.optional(G.boolean())}).passthrough())}).passthrough(),_5=iv.extend({protocolVersion:G.string(),capabilities:b5,serverInfo:O8,instructions:G.optional(G.string())}),a0=qf.extend({method:G.literal("notifications/initialized")});var n1=Tv.extend({method:G.literal("ping")}),R5=G.object({progress:G.number(),total:G.optional(G.number()),message:G.optional(G.string())}).passthrough(),p1=qf.extend({method:G.literal("notifications/progress"),params:g1.merge(R5).extend({progressToken:K8})}),i1=Tv.extend({params:pv.extend({cursor:G.optional(z8)}).optional()}),d1=iv.extend({nextCursor:G.optional(z8)}),U8=G.object({uri:G.string(),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).passthrough(),h8=U8.extend({text:G.string()}),c0=G.string().refine((f)=>{try{return atob(f),!0}catch(v){return!1}},{message:"Invalid Base64 string"}),F8=U8.extend({blob:c0}),g8=b1.extend({uri:G.string(),description:G.optional(G.string()),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).merge(A1),k5=b1.extend({uriTemplate:G.string(),description:G.optional(G.string()),mimeType:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).merge(A1),o1=i1.extend({method:G.literal("resources/list")}),S5=d1.extend({resources:G.array(g8)}),s1=i1.extend({method:G.literal("resources/templates/list")}),y5=d1.extend({resourceTemplates:G.array(k5)}),t1=Tv.extend({method:G.literal("resources/read"),params:pv.extend({uri:G.string()})}),l5=iv.extend({contents:G.array(G.union([h8,F8]))}),I5=qf.extend({method:G.literal("notifications/resources/list_changed")}),Z5=Tv.extend({method:G.literal("resources/subscribe"),params:pv.extend({uri:G.string()})}),C5=Tv.extend({method:G.literal("resources/unsubscribe"),params:pv.extend({uri:G.string()})}),T5=qf.extend({method:G.literal("notifications/resources/updated"),params:g1.extend({uri:G.string()})}),x5=G.object({name:G.string(),description:G.optional(G.string()),required:G.optional(G.boolean())}).passthrough(),u5=b1.extend({description:G.optional(G.string()),arguments:G.optional(G.array(x5)),_meta:G.optional(G.object({}).passthrough())}).merge(A1),e1=i1.extend({method:G.literal("prompts/list")}),r5=d1.extend({prompts:G.array(u5)}),v0=Tv.extend({method:G.literal("prompts/get"),params:pv.extend({name:G.string(),arguments:G.optional(G.record(G.string()))})}),n0=G.object({type:G.literal("text"),text:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),p0=G.object({type:G.literal("image"),data:c0,mimeType:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),i0=G.object({type:G.literal("audio"),data:c0,mimeType:G.string(),_meta:G.optional(G.object({}).passthrough())}).passthrough(),m5=G.object({type:G.literal("resource"),resource:G.union([h8,F8]),_meta:G.optional(G.object({}).passthrough())}).passthrough(),a5=g8.extend({type:G.literal("resource_link")}),A8=G.union([n0,p0,i0,a5,m5]),c5=G.object({role:G.enum(["user","assistant"]),content:A8}).passthrough(),n5=iv.extend({description:G.optional(G.string()),messages:G.array(c5)}),p5=qf.extend({method:G.literal("notifications/prompts/list_changed")}),i5=G.object({title:G.optional(G.string()),readOnlyHint:G.optional(G.boolean()),destructiveHint:G.optional(G.boolean()),idempotentHint:G.optional(G.boolean()),openWorldHint:G.optional(G.boolean())}).passthrough(),d5=b1.extend({description:G.optional(G.string()),inputSchema:G.object({type:G.literal("object"),properties:G.optional(G.object({}).passthrough()),required:G.optional(G.array(G.string()))}).passthrough(),outputSchema:G.optional(G.object({type:G.literal("object"),properties:G.optional(G.object({}).passthrough()),required:G.optional(G.array(G.string()))}).passthrough()),annotations:G.optional(i5),_meta:G.optional(G.object({}).passthrough())}).merge(A1),f0=i1.extend({method:G.literal("tools/list")}),o5=d1.extend({tools:G.array(d5)}),b8=iv.extend({content:G.array(A8).default([]),structuredContent:G.object({}).passthrough().optional(),isError:G.optional(G.boolean())}),p2=b8.or(iv.extend({toolResult:G.unknown()})),Q0=Tv.extend({method:G.literal("tools/call"),params:pv.extend({name:G.string(),arguments:G.optional(G.record(G.unknown()))})}),s5=qf.extend({method:G.literal("notifications/tools/list_changed")}),_1=G.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),d0=Tv.extend({method:G.literal("logging/setLevel"),params:pv.extend({level:_1})}),t5=qf.extend({method:G.literal("notifications/message"),params:g1.extend({level:_1,logger:G.optional(G.string()),data:G.unknown()})}),e5=G.object({name:G.string().optional()}).passthrough(),vX=G.object({hints:G.optional(G.array(e5)),costPriority:G.optional(G.number().min(0).max(1)),speedPriority:G.optional(G.number().min(0).max(1)),intelligencePriority:G.optional(G.number().min(0).max(1))}).passthrough(),fX=G.object({role:G.enum(["user","assistant"]),content:G.union([n0,p0,i0])}).passthrough(),QX=Tv.extend({method:G.literal("sampling/createMessage"),params:pv.extend({messages:G.array(fX),systemPrompt:G.optional(G.string()),includeContext:G.optional(G.enum(["none","thisServer","allServers"])),temperature:G.optional(G.number()),maxTokens:G.number().int(),stopSequences:G.optional(G.array(G.string())),metadata:G.optional(G.object({}).passthrough()),modelPreferences:G.optional(vX)})}),o0=iv.extend({model:G.string(),stopReason:G.optional(G.enum(["endTurn","stopSequence","maxTokens"]).or(G.string())),role:G.enum(["user","assistant"]),content:G.discriminatedUnion("type",[n0,p0,i0])}),WX=G.object({type:G.literal("boolean"),title:G.optional(G.string()),description:G.optional(G.string()),default:G.optional(G.boolean())}).passthrough(),JX=G.object({type:G.literal("string"),title:G.optional(G.string()),description:G.optional(G.string()),minLength:G.optional(G.number()),maxLength:G.optional(G.number()),format:G.optional(G.enum(["email","uri","date","date-time"]))}).passthrough(),XX=G.object({type:G.enum(["number","integer"]),title:G.optional(G.string()),description:G.optional(G.string()),minimum:G.optional(G.number()),maximum:G.optional(G.number())}).passthrough(),YX=G.object({type:G.literal("string"),title:G.optional(G.string()),description:G.optional(G.string()),enum:G.array(G.string()),enumNames:G.optional(G.array(G.string()))}).passthrough(),wX=G.union([WX,JX,XX,YX]),GX=Tv.extend({method:G.literal("elicitation/create"),params:pv.extend({message:G.string(),requestedSchema:G.object({type:G.literal("object"),properties:G.record(G.string(),wX),required:G.optional(G.array(G.string()))}).passthrough()})}),s0=iv.extend({action:G.enum(["accept","decline","cancel"]),content:G.optional(G.record(G.string(),G.unknown()))}),BX=G.object({type:G.literal("ref/resource"),uri:G.string()}).passthrough();var qX=G.object({type:G.literal("ref/prompt"),name:G.string()}).passthrough(),W0=Tv.extend({method:G.literal("completion/complete"),params:pv.extend({ref:G.union([qX,BX]),argument:G.object({name:G.string(),value:G.string()}).passthrough(),context:G.optional(G.object({arguments:G.optional(G.record(G.string(),G.string()))}))})}),PX=iv.extend({completion:G.object({values:G.array(G.string()).max(100),total:G.optional(G.number().int()),hasMore:G.optional(G.boolean())}).passthrough()}),HX=G.object({uri:G.string().startsWith("file://"),name:G.optional(G.string()),_meta:G.optional(G.object({}).passthrough())}).passthrough(),KX=Tv.extend({method:G.literal("roots/list")}),t0=iv.extend({roots:G.array(HX)}),zX=qf.extend({method:G.literal("notifications/roots/list_changed")}),i2=G.union([n1,m0,W0,d0,v0,e1,o1,s1,t1,Z5,C5,Q0,f0]),d2=G.union([c1,p1,a0,zX]),o2=G.union([a1,o0,s0,t0]),s2=G.union([n1,QX,GX,KX]),t2=G.union([c1,p1,t5,T5,I5,s5,p5]),e2=G.union([a1,_5,PX,n5,r5,S5,y5,l5,b8,o5]);class Kv extends Error{constructor(f,v,W){super(`MCP error ${f}: ${v}`);this.code=f,this.data=W,this.name="McpError"}}var LX=60000;class e0{constructor(f){this._options=f,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(c1,(v)=>{let W=this._requestHandlerAbortControllers.get(v.params.requestId);W===null||W===void 0||W.abort(v.params.reason)}),this.setNotificationHandler(p1,(v)=>{this._onprogress(v)}),this.setRequestHandler(n1,(v)=>({}))}_setupTimeout(f,v,W,J,Q=!1){this._timeoutInfo.set(f,{timeoutId:setTimeout(J,v),startTime:Date.now(),timeout:v,maxTotalTimeout:W,resetTimeoutOnProgress:Q,onTimeout:J})}_resetTimeout(f){let v=this._timeoutInfo.get(f);if(!v)return!1;let W=Date.now()-v.startTime;if(v.maxTotalTimeout&&W>=v.maxTotalTimeout)throw this._timeoutInfo.delete(f),new Kv(Hv.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:W});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout(f){let v=this._timeoutInfo.get(f);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete(f)}async connect(f){var v,W,J;this._transport=f;let Q=(v=this.transport)===null||v===void 0?void 0:v.onclose;this._transport.onclose=()=>{Q===null||Q===void 0||Q(),this._onclose()};let X=(W=this.transport)===null||W===void 0?void 0:W.onerror;this._transport.onerror=(w)=>{X===null||X===void 0||X(w),this._onerror(w)};let Y=(J=this._transport)===null||J===void 0?void 0:J.onmessage;this._transport.onmessage=(w,B)=>{if(Y===null||Y===void 0||Y(w,B),r0(w)||D8(w))this._onresponse(w);else if($8(w))this._onrequest(w,B);else if(N8(w))this._onnotification(w);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(w)}`))},await this._transport.start()}_onclose(){var f;let v=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(f=this.onclose)===null||f===void 0||f.call(this);let W=new Kv(Hv.ConnectionClosed,"Connection closed");for(let J of v.values())J(W)}_onerror(f){var v;(v=this.onerror)===null||v===void 0||v.call(this,f)}_onnotification(f){var v;let W=(v=this._notificationHandlers.get(f.method))!==null&&v!==void 0?v:this.fallbackNotificationHandler;if(W===void 0)return;Promise.resolve().then(()=>W(f)).catch((J)=>this._onerror(new Error(`Uncaught error in notification handler: ${J}`)))}_onrequest(f,v){var W,J;let Q=(W=this._requestHandlers.get(f.method))!==null&&W!==void 0?W:this.fallbackRequestHandler,X=this._transport;if(Q===void 0){X===null||X===void 0||X.send({jsonrpc:"2.0",id:f.id,error:{code:Hv.MethodNotFound,message:"Method not found"}}).catch((B)=>this._onerror(new Error(`Failed to send an error response: ${B}`)));return}let Y=new AbortController;this._requestHandlerAbortControllers.set(f.id,Y);let w={signal:Y.signal,sessionId:X===null||X===void 0?void 0:X.sessionId,_meta:(J=f.params)===null||J===void 0?void 0:J._meta,sendNotification:(B)=>this.notification(B,{relatedRequestId:f.id}),sendRequest:(B,z,H)=>this.request(B,z,{...H,relatedRequestId:f.id}),authInfo:v===null||v===void 0?void 0:v.authInfo,requestId:f.id,requestInfo:v===null||v===void 0?void 0:v.requestInfo};Promise.resolve().then(()=>Q(f,w)).then((B)=>{if(Y.signal.aborted)return;return X===null||X===void 0?void 0:X.send({result:B,jsonrpc:"2.0",id:f.id})},(B)=>{var z;if(Y.signal.aborted)return;return X===null||X===void 0?void 0:X.send({jsonrpc:"2.0",id:f.id,error:{code:Number.isSafeInteger(B.code)?B.code:Hv.InternalError,message:(z=B.message)!==null&&z!==void 0?z:"Internal error"}})}).catch((B)=>this._onerror(new Error(`Failed to send response: ${B}`))).finally(()=>{this._requestHandlerAbortControllers.delete(f.id)})}_onprogress(f){let{progressToken:v,...W}=f.params,J=Number(v),Q=this._progressHandlers.get(J);if(!Q){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(f)}`));return}let X=this._responseHandlers.get(J),Y=this._timeoutInfo.get(J);if(Y&&X&&Y.resetTimeoutOnProgress)try{this._resetTimeout(J)}catch(w){X(w);return}Q(W)}_onresponse(f){let v=Number(f.id),W=this._responseHandlers.get(v);if(W===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(f)}`));return}if(this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),r0(f))W(f);else{let J=new Kv(f.error.code,f.error.message,f.error.data);W(J)}}get transport(){return this._transport}async close(){var f;await((f=this._transport)===null||f===void 0?void 0:f.close())}request(f,v,W){let{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}=W!==null&&W!==void 0?W:{};return new Promise((Y,w)=>{var B,z,H,$,K,q;if(!this._transport){w(new Error("Not connected"));return}if(((B=this._options)===null||B===void 0?void 0:B.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(f.method);(z=W===null||W===void 0?void 0:W.signal)===null||z===void 0||z.throwIfAborted();let L=this._requestMessageId++,V={...f,jsonrpc:"2.0",id:L};if(W===null||W===void 0?void 0:W.onprogress)this._progressHandlers.set(L,W.onprogress),V.params={...f.params,_meta:{...((H=f.params)===null||H===void 0?void 0:H._meta)||{},progressToken:L}};let M=(F)=>{var Z;this._responseHandlers.delete(L),this._progressHandlers.delete(L),this._cleanupTimeout(L),(Z=this._transport)===null||Z===void 0||Z.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:L,reason:String(F)}},{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}).catch((C)=>this._onerror(new Error(`Failed to send cancellation: ${C}`))),w(F)};this._responseHandlers.set(L,(F)=>{var Z;if((Z=W===null||W===void 0?void 0:W.signal)===null||Z===void 0?void 0:Z.aborted)return;if(F instanceof Error)return w(F);try{let C=v.parse(F.result);Y(C)}catch(C){w(C)}}),($=W===null||W===void 0?void 0:W.signal)===null||$===void 0||$.addEventListener("abort",()=>{var F;M((F=W===null||W===void 0?void 0:W.signal)===null||F===void 0?void 0:F.reason)});let D=(K=W===null||W===void 0?void 0:W.timeout)!==null&&K!==void 0?K:LX,y=()=>M(new Kv(Hv.RequestTimeout,"Request timed out",{timeout:D}));this._setupTimeout(L,D,W===null||W===void 0?void 0:W.maxTotalTimeout,y,(q=W===null||W===void 0?void 0:W.resetTimeoutOnProgress)!==null&&q!==void 0?q:!1),this._transport.send(V,{relatedRequestId:J,resumptionToken:Q,onresumptiontoken:X}).catch((F)=>{this._cleanupTimeout(L),w(F)})})}async notification(f,v){var W,J;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(f.method),((J=(W=this._options)===null||W===void 0?void 0:W.debouncedNotificationMethods)!==null&&J!==void 0?J:[]).includes(f.method)&&!f.params&&!(v===null||v===void 0?void 0:v.relatedRequestId)){if(this._pendingDebouncedNotifications.has(f.method))return;this._pendingDebouncedNotifications.add(f.method),Promise.resolve().then(()=>{var w;if(this._pendingDebouncedNotifications.delete(f.method),!this._transport)return;let B={...f,jsonrpc:"2.0"};(w=this._transport)===null||w===void 0||w.send(B,v).catch((z)=>this._onerror(z))});return}let Y={...f,jsonrpc:"2.0"};await this._transport.send(Y,v)}setRequestHandler(f,v){let W=f.shape.method.value;this.assertRequestHandlerCapability(W),this._requestHandlers.set(W,(J,Q)=>{return Promise.resolve(v(f.parse(J),Q))})}removeRequestHandler(f){this._requestHandlers.delete(f)}assertCanSetRequestHandler(f){if(this._requestHandlers.has(f))throw new Error(`A request handler for ${f} already exists, which would be overridden`)}setNotificationHandler(f,v){this._notificationHandlers.set(f.shape.method.value,(W)=>Promise.resolve(v(f.parse(W))))}removeNotificationHandler(f){this._notificationHandlers.delete(f)}}function _8(f,v){return Object.entries(v).reduce((W,[J,Q])=>{if(Q&&typeof Q==="object")W[J]=W[J]?{...W[J],...Q}:Q;else W[J]=Q;return W},{...f})}var k9=L6(R9(),1);class UQ extends e0{constructor(f,v){var W;super(v);if(this._serverInfo=f,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(_1.options.map((J,Q)=>[J,Q])),this.isMessageIgnored=(J,Q)=>{let X=this._loggingLevels.get(Q);return X?this.LOG_LEVEL_SEVERITY.get(J)<this.LOG_LEVEL_SEVERITY.get(X):!1},this._capabilities=(W=v===null||v===void 0?void 0:v.capabilities)!==null&&W!==void 0?W:{},this._instructions=v===null||v===void 0?void 0:v.instructions,this.setRequestHandler(m0,(J)=>this._oninitialize(J)),this.setNotificationHandler(a0,()=>{var J;return(J=this.oninitialized)===null||J===void 0?void 0:J.call(this)}),this._capabilities.logging)this.setRequestHandler(d0,async(J,Q)=>{var X;let Y=Q.sessionId||((X=Q.requestInfo)===null||X===void 0?void 0:X.headers["mcp-session-id"])||void 0,{level:w}=J.params,B=_1.safeParse(w);if(B.success)this._loggingLevels.set(Y,B.data);return{}})}registerCapabilities(f){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=_8(this._capabilities,f)}assertCapabilityForMethod(f){var v,W,J;switch(f){case"sampling/createMessage":if(!((v=this._clientCapabilities)===null||v===void 0?void 0:v.sampling))throw new Error(`Client does not support sampling (required for ${f})`);break;case"elicitation/create":if(!((W=this._clientCapabilities)===null||W===void 0?void 0:W.elicitation))throw new Error(`Client does not support elicitation (required for ${f})`);break;case"roots/list":if(!((J=this._clientCapabilities)===null||J===void 0?void 0:J.roots))throw new Error(`Client does not support listing roots (required for ${f})`);break;case"ping":break}}assertNotificationCapability(f){switch(f){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${f})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${f})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${f})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(f){switch(f){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${f})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${f})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${f})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${f})`);break;case"ping":case"initialize":break}}async _oninitialize(f){let v=f.params.protocolVersion;return this._clientCapabilities=f.params.capabilities,this._clientVersion=f.params.clientInfo,{protocolVersion:H8.includes(v)?v:u0,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},a1)}async createMessage(f,v){return this.request({method:"sampling/createMessage",params:f},o0,v)}async elicitInput(f,v){let W=await this.request({method:"elicitation/create",params:f},s0,v);if(W.action==="accept"&&W.content)try{let J=new k9.default,Q=J.compile(f.requestedSchema);if(!Q(W.content))throw new Kv(Hv.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorsText(Q.errors)}`)}catch(J){if(J instanceof Kv)throw J;throw new Kv(Hv.InternalError,`Error validating elicitation response: ${J}`)}return W}async listRoots(f,v){return this.request({method:"roots/list",params:f},t0,v)}async sendLoggingMessage(f,v){if(this._capabilities.logging){if(!this.isMessageIgnored(f.level,v))return this.notification({method:"notifications/message",params:f})}}async sendResourceUpdated(f){return this.notification({method:"notifications/resources/updated",params:f})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var y9=Symbol("Let zodToJsonSchema decide on which parser to use");var S9={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},l9=(f)=>typeof f==="string"?{...S9,name:f}:{...S9,...f};var I9=(f)=>{let v=l9(f),W=v.name!==void 0?[...v.basePath,v.definitionPath,v.name]:v.basePath;return{...v,flags:{hasReferencedOpenAiAnyType:!1},currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(v.definitions).map(([J,Q])=>[Q._def,{def:Q._def,path:[...v.basePath,v.definitionPath,J],jsonSchema:void 0}]))}};function hQ(f,v,W,J){if(!J?.errorMessages)return;if(W)f.errorMessage={...f.errorMessage,[v]:W}}function Qv(f,v,W,J,Q){f[v]=W,hQ(f,v,J,Q)}var j0=(f,v)=>{let W=0;for(;W<f.length&&W<v.length;W++)if(f[W]!==v[W])break;return[(f.length-W).toString(),...v.slice(W)].join("/")};function Lv(f){if(f.target!=="openAi")return{};let v=[...f.basePath,f.definitionPath,f.openAiAnyTypeName];return f.flags.hasReferencedOpenAiAnyType=!0,{$ref:f.$refStrategy==="relative"?j0(v,f.currentPath):v.join("/")}}function Z9(f,v){let W={type:"array"};if(f.type?._def&&f.type?._def?.typeName!==I.ZodAny)W.items=i(f.type._def,{...v,currentPath:[...v.currentPath,"items"]});if(f.minLength)Qv(W,"minItems",f.minLength.value,f.minLength.message,v);if(f.maxLength)Qv(W,"maxItems",f.maxLength.value,f.maxLength.message,v);if(f.exactLength)Qv(W,"minItems",f.exactLength.value,f.exactLength.message,v),Qv(W,"maxItems",f.exactLength.value,f.exactLength.message,v);return W}function C9(f,v){let W={type:"integer",format:"int64"};if(!f.checks)return W;for(let J of f.checks)switch(J.kind){case"min":if(v.target==="jsonSchema7")if(J.inclusive)Qv(W,"minimum",J.value,J.message,v);else Qv(W,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMinimum=!0;Qv(W,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)Qv(W,"maximum",J.value,J.message,v);else Qv(W,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMaximum=!0;Qv(W,"maximum",J.value,J.message,v)}break;case"multipleOf":Qv(W,"multipleOf",J.value,J.message,v);break}return W}function T9(){return{type:"boolean"}}function O0(f,v){return i(f.type._def,v)}var x9=(f,v)=>{return i(f.innerType._def,v)};function FQ(f,v,W){let J=W??v.dateStrategy;if(Array.isArray(J))return{anyOf:J.map((Q,X)=>FQ(f,v,Q))};switch(J){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return iY(f,v)}}var iY=(f,v)=>{let W={type:"integer",format:"unix-time"};if(v.target==="openApi3")return W;for(let J of f.checks)switch(J.kind){case"min":Qv(W,"minimum",J.value,J.message,v);break;case"max":Qv(W,"maximum",J.value,J.message,v);break}return W};function u9(f,v){return{...i(f.innerType._def,v),default:f.defaultValue()}}function r9(f,v){return v.effectStrategy==="input"?i(f.schema._def,v):Lv(v)}function m9(f){return{type:"string",enum:Array.from(f.values)}}var dY=(f)=>{if("type"in f&&f.type==="string")return!1;return"allOf"in f};function a9(f,v){let W=[i(f.left._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),i(f.right._def,{...v,currentPath:[...v.currentPath,"allOf","1"]})].filter((X)=>!!X),J=v.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,Q=[];return W.forEach((X)=>{if(dY(X)){if(Q.push(...X.allOf),X.unevaluatedProperties===void 0)J=void 0}else{let Y=X;if("additionalProperties"in X&&X.additionalProperties===!1){let{additionalProperties:w,...B}=X;Y=B}else J=void 0;Q.push(Y)}}),Q.length?{allOf:Q,...J}:void 0}function c9(f,v){let W=typeof f.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray(f.value)?"array":"object"};if(v.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[f.value]};return{type:W==="bigint"?"integer":W,const:f.value}}var gQ=void 0,ff={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(gQ===void 0)gQ=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return gQ},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function U0(f,v){let W={type:"string"};if(f.checks)for(let J of f.checks)switch(J.kind){case"min":Qv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,J.value):J.value,J.message,v);break;case"max":Qv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,J.value):J.value,J.message,v);break;case"email":switch(v.emailStrategy){case"format:email":Qf(W,"email",J.message,v);break;case"format:idn-email":Qf(W,"idn-email",J.message,v);break;case"pattern:zod":Iv(W,ff.email,J.message,v);break}break;case"url":Qf(W,"uri",J.message,v);break;case"uuid":Qf(W,"uuid",J.message,v);break;case"regex":Iv(W,J.regex,J.message,v);break;case"cuid":Iv(W,ff.cuid,J.message,v);break;case"cuid2":Iv(W,ff.cuid2,J.message,v);break;case"startsWith":Iv(W,RegExp(`^${AQ(J.value,v)}`),J.message,v);break;case"endsWith":Iv(W,RegExp(`${AQ(J.value,v)}$`),J.message,v);break;case"datetime":Qf(W,"date-time",J.message,v);break;case"date":Qf(W,"date",J.message,v);break;case"time":Qf(W,"time",J.message,v);break;case"duration":Qf(W,"duration",J.message,v);break;case"length":Qv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,J.value):J.value,J.message,v),Qv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,J.value):J.value,J.message,v);break;case"includes":{Iv(W,RegExp(AQ(J.value,v)),J.message,v);break}case"ip":{if(J.version!=="v6")Qf(W,"ipv4",J.message,v);if(J.version!=="v4")Qf(W,"ipv6",J.message,v);break}case"base64url":Iv(W,ff.base64url,J.message,v);break;case"jwt":Iv(W,ff.jwt,J.message,v);break;case"cidr":{if(J.version!=="v6")Iv(W,ff.ipv4Cidr,J.message,v);if(J.version!=="v4")Iv(W,ff.ipv6Cidr,J.message,v);break}case"emoji":Iv(W,ff.emoji(),J.message,v);break;case"ulid":{Iv(W,ff.ulid,J.message,v);break}case"base64":{switch(v.base64Strategy){case"format:binary":{Qf(W,"binary",J.message,v);break}case"contentEncoding:base64":{Qv(W,"contentEncoding","base64",J.message,v);break}case"pattern:zod":{Iv(W,ff.base64,J.message,v);break}}break}case"nanoid":Iv(W,ff.nanoid,J.message,v);case"toLowerCase":case"toUpperCase":case"trim":break;default:((Q)=>{})(J)}return W}function AQ(f,v){return v.patternStrategy==="escape"?sY(f):f}var oY=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function sY(f){let v="";for(let W=0;W<f.length;W++){if(!oY.has(f[W]))v+="\\";v+=f[W]}return v}function Qf(f,v,W,J){if(f.format||f.anyOf?.some((Q)=>Q.format)){if(!f.anyOf)f.anyOf=[];if(f.format){if(f.anyOf.push({format:f.format,...f.errorMessage&&J.errorMessages&&{errorMessage:{format:f.errorMessage.format}}}),delete f.format,f.errorMessage){if(delete f.errorMessage.format,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.anyOf.push({format:v,...W&&J.errorMessages&&{errorMessage:{format:W}}})}else Qv(f,"format",v,W,J)}function Iv(f,v,W,J){if(f.pattern||f.allOf?.some((Q)=>Q.pattern)){if(!f.allOf)f.allOf=[];if(f.pattern){if(f.allOf.push({pattern:f.pattern,...f.errorMessage&&J.errorMessages&&{errorMessage:{pattern:f.errorMessage.pattern}}}),delete f.pattern,f.errorMessage){if(delete f.errorMessage.pattern,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.allOf.push({pattern:n9(v,J),...W&&J.errorMessages&&{errorMessage:{pattern:W}}})}else Qv(f,"pattern",n9(v,J),W,J)}function n9(f,v){if(!v.applyRegexFlags||!f.flags)return f.source;let W={i:f.flags.includes("i"),m:f.flags.includes("m"),s:f.flags.includes("s")},J=W.i?f.source.toLowerCase():f.source,Q="",X=!1,Y=!1,w=!1;for(let B=0;B<J.length;B++){if(X){Q+=J[B],X=!1;continue}if(W.i){if(Y){if(J[B].match(/[a-z]/)){if(w)Q+=J[B],Q+=`${J[B-2]}-${J[B]}`.toUpperCase(),w=!1;else if(J[B+1]==="-"&&J[B+2]?.match(/[a-z]/))Q+=J[B],w=!0;else Q+=`${J[B]}${J[B].toUpperCase()}`;continue}}else if(J[B].match(/[a-z]/)){Q+=`[${J[B]}${J[B].toUpperCase()}]`;continue}}if(W.m){if(J[B]==="^"){Q+=`(^|(?<=[\r
9
9
  ]))`;continue}else if(J[B]==="$"){Q+=`($|(?=[\r
10
10
  ]))`;continue}}if(W.s&&J[B]==="."){Q+=Y?`${J[B]}\r
11
11
  `:`[${J[B]}\r
12
- ]`;continue}if(Q+=J[B],J[B]==="\\")X=!0;else if(Y&&J[B]==="]")Y=!1;else if(!Y&&J[B]==="[")Y=!0}try{new RegExp(Q)}catch{return console.warn(`Could not convert regex pattern at ${v.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),f.source}return Q}function F0(f,v){if(v.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(v.target==="openApi3"&&f.keyType?._def.typeName===C.ZodEnum)return{type:"object",required:f.keyType._def.values,properties:f.keyType._def.values.reduce((J,Q)=>({...J,[Q]:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"properties",Q]})??Mv(v)}),{}),additionalProperties:v.rejectedAdditionalProperties};let W={type:"object",additionalProperties:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]})??v.allowedAdditionalProperties};if(v.target==="openApi3")return W;if(f.keyType?._def.typeName===C.ZodString&&f.keyType._def.checks?.length){let{type:J,...Q}=H0(f.keyType._def,v);return{...W,propertyNames:Q}}else if(f.keyType?._def.typeName===C.ZodEnum)return{...W,propertyNames:{enum:f.keyType._def.values}};else if(f.keyType?._def.typeName===C.ZodBranded&&f.keyType._def.type._def.typeName===C.ZodString&&f.keyType._def.type._def.checks?.length){let{type:J,...Q}=U0(f.keyType._def,v);return{...W,propertyNames:Q}}return W}function p9(f,v){if(v.mapStrategy==="record")return F0(f,v);let W=o(f.keyType._def,{...v,currentPath:[...v.currentPath,"items","items","0"]})||Mv(v),J=o(f.valueType._def,{...v,currentPath:[...v.currentPath,"items","items","1"]})||Mv(v);return{type:"array",maxItems:125,items:{type:"array",items:[W,J],minItems:2,maxItems:2}}}function i9(f){let v=f.values,J=Object.keys(f.values).filter((X)=>{return typeof v[v[X]]!=="number"}).map((X)=>v[X]),Q=Array.from(new Set(J.map((X)=>typeof X)));return{type:Q.length===1?Q[0]==="string"?"string":"number":["string","number"],enum:J}}function d9(f){return f.target==="openAi"?void 0:{not:Mv({...f,currentPath:[...f.currentPath,"not"]})}}function o9(f){return f.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var k1={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function t9(f,v){if(v.target==="openApi3")return s9(f,v);let W=f.options instanceof Map?Array.from(f.options.values()):f.options;if(W.every((J)=>(J._def.typeName in k1)&&(!J._def.checks||!J._def.checks.length))){let J=W.reduce((Q,X)=>{let Y=k1[X._def.typeName];return Y&&!Q.includes(Y)?[...Q,Y]:Q},[]);return{type:J.length>1?J:J[0]}}else if(W.every((J)=>J._def.typeName==="ZodLiteral"&&!J.description)){let J=W.reduce((Q,X)=>{let Y=typeof X._def.value;switch(Y){case"string":case"number":case"boolean":return[...Q,Y];case"bigint":return[...Q,"integer"];case"object":if(X._def.value===null)return[...Q,"null"];case"symbol":case"undefined":case"function":default:return Q}},[]);if(J.length===W.length){let Q=J.filter((X,Y,w)=>w.indexOf(X)===Y);return{type:Q.length>1?Q:Q[0],enum:W.reduce((X,Y)=>{return X.includes(Y._def.value)?X:[...X,Y._def.value]},[])}}}else if(W.every((J)=>J._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((J,Q)=>[...J,...Q._def.values.filter((X)=>!J.includes(X))],[])};return s9(f,v)}var s9=(f,v)=>{let W=(f.options instanceof Map?Array.from(f.options.values()):f.options).map((J,Q)=>o(J._def,{...v,currentPath:[...v.currentPath,"anyOf",`${Q}`]})).filter((J)=>!!J&&(!v.strictUnions||typeof J==="object"&&Object.keys(J).length>0));return W.length?{anyOf:W}:void 0};function e9(f,v){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(f.innerType._def.typeName)&&(!f.innerType._def.checks||!f.innerType._def.checks.length)){if(v.target==="openApi3")return{type:k1[f.innerType._def.typeName],nullable:!0};return{type:[k1[f.innerType._def.typeName],"null"]}}if(v.target==="openApi3"){let J=o(f.innerType._def,{...v,currentPath:[...v.currentPath]});if(J&&"$ref"in J)return{allOf:[J],nullable:!0};return J&&{...J,nullable:!0}}let W=o(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function vJ(f,v){let W={type:"number"};if(!f.checks)return W;for(let J of f.checks)switch(J.kind){case"int":W.type="integer",FQ(W,"type",J.message,v);break;case"min":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"minimum",J.value,J.message,v);else Wv(W,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMinimum=!0;Wv(W,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)Wv(W,"maximum",J.value,J.message,v);else Wv(W,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMaximum=!0;Wv(W,"maximum",J.value,J.message,v)}break;case"multipleOf":Wv(W,"multipleOf",J.value,J.message,v);break}return W}function fJ(f,v){let W=v.target==="openAi",J={type:"object",properties:{}},Q=[],X=f.shape();for(let w in X){let B=X[w];if(B===void 0||B._def===void 0)continue;let z=v7(B);if(z&&W){if(B._def.typeName==="ZodOptional")B=B._def.innerType;if(!B.isNullable())B=B.nullable();z=!1}let K=o(B._def,{...v,currentPath:[...v.currentPath,"properties",w],propertyPath:[...v.currentPath,"properties",w]});if(K===void 0)continue;if(J.properties[w]=K,!z)Q.push(w)}if(Q.length)J.required=Q;let Y=eY(f,v);if(Y!==void 0)J.additionalProperties=Y;return J}function eY(f,v){if(f.catchall._def.typeName!=="ZodNever")return o(f.catchall._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]});switch(f.unknownKeys){case"passthrough":return v.allowedAdditionalProperties;case"strict":return v.rejectedAdditionalProperties;case"strip":return v.removeAdditionalStrategy==="strict"?v.allowedAdditionalProperties:v.rejectedAdditionalProperties}}function v7(f){try{return f.isOptional()}catch{return!0}}var QJ=(f,v)=>{if(v.currentPath.toString()===v.propertyPath?.toString())return o(f.innerType._def,v);let W=o(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","1"]});return W?{anyOf:[{not:Mv(v)},W]}:Mv(v)};var WJ=(f,v)=>{if(v.pipeStrategy==="input")return o(f.in._def,v);else if(v.pipeStrategy==="output")return o(f.out._def,v);let W=o(f.in._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),J=o(f.out._def,{...v,currentPath:[...v.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,J].filter((Q)=>Q!==void 0)}};function JJ(f,v){return o(f.type._def,v)}function XJ(f,v){let J={type:"array",uniqueItems:!0,items:o(f.valueType._def,{...v,currentPath:[...v.currentPath,"items"]})};if(f.minSize)Wv(J,"minItems",f.minSize.value,f.minSize.message,v);if(f.maxSize)Wv(J,"maxItems",f.maxSize.value,f.maxSize.message,v);return J}function YJ(f,v){if(f.rest)return{type:"array",minItems:f.items.length,items:f.items.map((W,J)=>o(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[]),additionalItems:o(f.rest._def,{...v,currentPath:[...v.currentPath,"additionalItems"]})};else return{type:"array",minItems:f.items.length,maxItems:f.items.length,items:f.items.map((W,J)=>o(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[])}}function wJ(f){return{not:Mv(f)}}function GJ(f){return Mv(f)}var BJ=(f,v)=>{return o(f.innerType._def,v)};var qJ=(f,v,W)=>{switch(v){case C.ZodString:return H0(f,W);case C.ZodNumber:return vJ(f,W);case C.ZodObject:return fJ(f,W);case C.ZodBigInt:return C9(f,W);case C.ZodBoolean:return T9();case C.ZodDate:return AQ(f,W);case C.ZodUndefined:return wJ(W);case C.ZodNull:return o9(W);case C.ZodArray:return Z9(f,W);case C.ZodUnion:case C.ZodDiscriminatedUnion:return t9(f,W);case C.ZodIntersection:return a9(f,W);case C.ZodTuple:return YJ(f,W);case C.ZodRecord:return F0(f,W);case C.ZodLiteral:return c9(f,W);case C.ZodEnum:return r9(f);case C.ZodNativeEnum:return i9(f);case C.ZodNullable:return e9(f,W);case C.ZodOptional:return QJ(f,W);case C.ZodMap:return p9(f,W);case C.ZodSet:return XJ(f,W);case C.ZodLazy:return()=>f.getter()._def;case C.ZodPromise:return JJ(f,W);case C.ZodNaN:case C.ZodNever:return d9(W);case C.ZodEffects:return m9(f,W);case C.ZodAny:return Mv(W);case C.ZodUnknown:return GJ(W);case C.ZodDefault:return u9(f,W);case C.ZodBranded:return U0(f,W);case C.ZodReadonly:return BJ(f,W);case C.ZodCatch:return x9(f,W);case C.ZodPipeline:return WJ(f,W);case C.ZodFunction:case C.ZodVoid:case C.ZodSymbol:return;default:return((J)=>{return})(v)}};function o(f,v,W=!1){let J=v.seen.get(f);if(v.override){let w=v.override?.(f,v,J,W);if(w!==y9)return w}if(J&&!W){let w=f7(J,v);if(w!==void 0)return w}let Q={def:f,path:v.currentPath,jsonSchema:void 0};v.seen.set(f,Q);let X=qJ(f,f.typeName,v),Y=typeof X==="function"?o(X(),v):X;if(Y)Q7(f,v,Y);if(v.postProcess){let w=v.postProcess(Y,f,v);return Q.jsonSchema=Y,w}return Q.jsonSchema=Y,Y}var f7=(f,v)=>{switch(v.$refStrategy){case"root":return{$ref:f.path.join("/")};case"relative":return{$ref:O0(v.currentPath,f.path)};case"none":case"seen":{if(f.path.length<v.currentPath.length&&f.path.every((W,J)=>v.currentPath[J]===W))return console.warn(`Recursive reference detected at ${v.currentPath.join("/")}! Defaulting to any`),Mv(v);return v.$refStrategy==="seen"?Mv(v):void 0}}},Q7=(f,v,W)=>{if(f.description){if(W.description=f.description,v.markdownDescription)W.markdownDescription=f.description}return W};var A0=(f,v)=>{let W=I9(v),J=typeof v==="object"&&v.definitions?Object.entries(v.definitions).reduce((B,[z,K])=>({...B,[z]:o(K._def,{...W,currentPath:[...W.basePath,W.definitionPath,z]},!0)??Mv(W)}),{}):void 0,Q=typeof v==="string"?v:v?.nameStrategy==="title"?void 0:v?.name,X=o(f._def,Q===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,Q]},!1)??Mv(W),Y=typeof v==="object"&&v.name!==void 0&&v.nameStrategy==="title"?v.name:void 0;if(Y!==void 0)X.title=Y;if(W.flags.hasReferencedOpenAiAnyType){if(!J)J={};if(!J[W.openAiAnyTypeName])J[W.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:W.$refStrategy==="relative"?"1":[...W.basePath,W.definitionPath,W.openAiAnyTypeName].join("/")}}}let w=Q===void 0?J?{...X,[W.definitionPath]:J}:X:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,Q].join("/"),[W.definitionPath]:{...J,[Q]:X}};if(W.target==="jsonSchema7")w.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")w.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in w)||("oneOf"in w)||("allOf"in w)||("type"in w)&&Array.isArray(w.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return w};var hQ;(function(f){f.Completable="McpCompletable"})(hQ||(hQ={}));class S1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}S1.create=(f,v)=>{return new S1({type:f,typeName:hQ.Completable,complete:v.complete,...W7(v)})};function W7(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:J,description:Q}=f;if(v&&(W||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(Y,w)=>{var B,z;let{message:K}=f;if(Y.code==="invalid_enum_value")return{message:K!==null&&K!==void 0?K:w.defaultError};if(typeof w.data==="undefined")return{message:(B=K!==null&&K!==void 0?K:J)!==null&&B!==void 0?B:w.defaultError};if(Y.code!=="invalid_type")return{message:w.defaultError};return{message:(z=K!==null&&K!==void 0?K:W)!==null&&z!==void 0?z:w.defaultError}},description:Q}}class bQ{constructor(f,v){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new HQ(f,v)}async connect(f){return await this.server.connect(f)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(f0.shape.method.value),this.server.assertCanSetRequestHandler(Q0.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(f0,()=>({tools:Object.entries(this._registeredTools).filter(([,f])=>f.enabled).map(([f,v])=>{let W={name:f,title:v.title,description:v.description,inputSchema:v.inputSchema?A0(v.inputSchema,{strictUnions:!0}):J7,annotations:v.annotations,_meta:v._meta};if(v.outputSchema)W.outputSchema=A0(v.outputSchema,{strictUnions:!0});return W})})),this.server.setRequestHandler(Q0,async(f,v)=>{let W=this._registeredTools[f.params.name];if(!W)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} disabled`);let J;if(W.inputSchema){let Q=await W.inputSchema.safeParseAsync(f.params.arguments);if(!Q.success)throw new zv(Kv.InvalidParams,`Invalid arguments for tool ${f.params.name}: ${Q.error.message}`);let X=Q.data,Y=W.callback;try{J=await Promise.resolve(Y(X,v))}catch(w){J={content:[{type:"text",text:w instanceof Error?w.message:String(w)}],isError:!0}}}else{let Q=W.callback;try{J=await Promise.resolve(Q(v))}catch(X){J={content:[{type:"text",text:X instanceof Error?X.message:String(X)}],isError:!0}}}if(W.outputSchema&&!J.isError){if(!J.structuredContent)throw new zv(Kv.InvalidParams,`Tool ${f.params.name} has an output schema but no structured content was provided`);let Q=await W.outputSchema.safeParseAsync(J.structuredContent);if(!Q.success)throw new zv(Kv.InvalidParams,`Invalid structured content for tool ${f.params.name}: ${Q.error.message}`)}return J}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(W0.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(W0,async(f)=>{switch(f.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(f,f.params.ref);case"ref/resource":return this.handleResourceCompletion(f,f.params.ref);default:throw new zv(Kv.InvalidParams,`Invalid completion reference: ${f.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(f,v){let W=this._registeredPrompts[v.name];if(!W)throw new zv(Kv.InvalidParams,`Prompt ${v.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Prompt ${v.name} disabled`);if(!W.argsSchema)return g0;let J=W.argsSchema.shape[f.params.argument.name];if(!(J instanceof S1))return g0;let X=await J._def.complete(f.params.argument.value,f.params.context);return KJ(X)}async handleResourceCompletion(f,v){let W=Object.values(this._registeredResourceTemplates).find((X)=>X.resourceTemplate.uriTemplate.toString()===v.uri);if(!W){if(this._registeredResources[v.uri])return g0;throw new zv(Kv.InvalidParams,`Resource template ${f.params.ref.uri} not found`)}let J=W.resourceTemplate.completeCallback(f.params.argument.name);if(!J)return g0;let Q=await J(f.params.argument.value,f.params.context);return KJ(Q)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(o1.shape.method.value),this.server.assertCanSetRequestHandler(s1.shape.method.value),this.server.assertCanSetRequestHandler(t1.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(o1,async(f,v)=>{let W=Object.entries(this._registeredResources).filter(([Q,X])=>X.enabled).map(([Q,X])=>({uri:Q,name:X.name,...X.metadata})),J=[];for(let Q of Object.values(this._registeredResourceTemplates)){if(!Q.resourceTemplate.listCallback)continue;let X=await Q.resourceTemplate.listCallback(v);for(let Y of X.resources)J.push({...Q.metadata,...Y})}return{resources:[...W,...J]}}),this.server.setRequestHandler(s1,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([v,W])=>({name:v,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(t1,async(f,v)=>{let W=new URL(f.params.uri),J=this._registeredResources[W.toString()];if(J){if(!J.enabled)throw new zv(Kv.InvalidParams,`Resource ${W} disabled`);return J.readCallback(W,v)}for(let Q of Object.values(this._registeredResourceTemplates)){let X=Q.resourceTemplate.uriTemplate.match(W.toString());if(X)return Q.readCallback(W,X,v)}throw new zv(Kv.InvalidParams,`Resource ${W} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(e1.shape.method.value),this.server.assertCanSetRequestHandler(v0.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(e1,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,f])=>f.enabled).map(([f,v])=>{return{name:f,title:v.title,description:v.description,arguments:v.argsSchema?Y7(v.argsSchema):void 0}})})),this.server.setRequestHandler(v0,async(f,v)=>{let W=this._registeredPrompts[f.params.name];if(!W)throw new zv(Kv.InvalidParams,`Prompt ${f.params.name} not found`);if(!W.enabled)throw new zv(Kv.InvalidParams,`Prompt ${f.params.name} disabled`);if(W.argsSchema){let J=await W.argsSchema.safeParseAsync(f.params.arguments);if(!J.success)throw new zv(Kv.InvalidParams,`Invalid arguments for prompt ${f.params.name}: ${J.error.message}`);let Q=J.data,X=W.callback;return await Promise.resolve(X(Q,v))}else{let J=W.callback;return await Promise.resolve(J(v))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource(f,v,...W){let J;if(typeof W[0]==="object")J=W.shift();let Q=W[0];if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let X=this._createRegisteredResource(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let X=this._createRegisteredResourceTemplate(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}}registerResource(f,v,W,J){if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let Q=this._createRegisteredResource(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let Q=this._createRegisteredResourceTemplate(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}}_createRegisteredResource(f,v,W,J,Q){let X={name:f,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({uri:null}),update:(Y)=>{if(typeof Y.uri!=="undefined"&&Y.uri!==W){if(delete this._registeredResources[W],Y.uri)this._registeredResources[Y.uri]=X}if(typeof Y.name!=="undefined")X.name=Y.name;if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=X,X}_createRegisteredResourceTemplate(f,v,W,J,Q){let X={resourceTemplate:W,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredResourceTemplates[f],Y.name)this._registeredResourceTemplates[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.template!=="undefined")X.resourceTemplate=Y.template;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[f]=X,X}_createRegisteredPrompt(f,v,W,J,Q){let X={title:v,description:W,argsSchema:J===void 0?void 0:G.object(J),callback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredPrompts[f],Y.name)this._registeredPrompts[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.description!=="undefined")X.description=Y.description;if(typeof Y.argsSchema!=="undefined")X.argsSchema=G.object(Y.argsSchema);if(typeof Y.callback!=="undefined")X.callback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[f]=X,X}_createRegisteredTool(f,v,W,J,Q,X,Y,w){let B={title:v,description:W,inputSchema:J===void 0?void 0:G.object(J),outputSchema:Q===void 0?void 0:G.object(Q),annotations:X,_meta:Y,callback:w,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({name:null}),update:(z)=>{if(typeof z.name!=="undefined"&&z.name!==f){if(delete this._registeredTools[f],z.name)this._registeredTools[z.name]=B}if(typeof z.title!=="undefined")B.title=z.title;if(typeof z.description!=="undefined")B.description=z.description;if(typeof z.paramsSchema!=="undefined")B.inputSchema=G.object(z.paramsSchema);if(typeof z.callback!=="undefined")B.callback=z.callback;if(typeof z.annotations!=="undefined")B.annotations=z.annotations;if(typeof z._meta!=="undefined")B._meta=z._meta;if(typeof z.enabled!=="undefined")B.enabled=z.enabled;this.sendToolListChanged()}};return this._registeredTools[f]=B,this.setToolRequestHandlers(),this.sendToolListChanged(),B}tool(f,...v){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let W,J,Q,X;if(typeof v[0]==="string")W=v.shift();if(v.length>1){let w=v[0];if(PJ(w)){if(J=v.shift(),v.length>1&&typeof v[0]==="object"&&v[0]!==null&&!PJ(v[0]))X=v.shift()}else if(typeof w==="object"&&w!==null)X=v.shift()}let Y=v[0];return this._createRegisteredTool(f,void 0,W,J,Q,X,void 0,Y)}registerTool(f,v,W){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let{title:J,description:Q,inputSchema:X,outputSchema:Y,annotations:w,_meta:B}=v;return this._createRegisteredTool(f,J,Q,X,Y,w,B,W)}prompt(f,...v){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let W;if(typeof v[0]==="string")W=v.shift();let J;if(v.length>1)J=v.shift();let Q=v[0],X=this._createRegisteredPrompt(f,void 0,W,J,Q);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),X}registerPrompt(f,v,W){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let{title:J,description:Q,argsSchema:X}=v,Y=this._createRegisteredPrompt(f,J,Q,X,W);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),Y}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(f,v){return this.server.sendLoggingMessage(f,v)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var J7={type:"object",properties:{}};function PJ(f){if(typeof f!=="object"||f===null)return!1;return Object.keys(f).length===0||Object.values(f).some(X7)}function X7(f){return f!==null&&typeof f==="object"&&"parse"in f&&typeof f.parse==="function"&&"safeParse"in f&&typeof f.safeParse==="function"}function Y7(f){return Object.entries(f.shape).map(([v,W])=>({name:v,description:W.description,required:!W.isOptional()}))}function KJ(f){return{completion:{values:f.slice(0,100),total:f.length,hasMore:f.length>100}}}var g0={completion:{values:[],hasMore:!1}};import $J from"process";class RQ{append(f){this._buffer=this._buffer?Buffer.concat([this._buffer,f]):f}readMessage(){if(!this._buffer)return null;let f=this._buffer.indexOf(`
13
- `);if(f===-1)return null;let v=this._buffer.toString("utf8",0,f).replace(/\r$/,"");return this._buffer=this._buffer.subarray(f+1),w7(v)}clear(){this._buffer=void 0}}function w7(f){return O8.parse(JSON.parse(f))}function zJ(f){return JSON.stringify(f)+`
14
- `}class kQ{constructor(f=$J.stdin,v=$J.stdout){this._stdin=f,this._stdout=v,this._readBuffer=new RQ,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{var J;(J=this.onerror)===null||J===void 0||J.call(this,W)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){var f,v;while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;(f=this.onmessage)===null||f===void 0||f.call(this,W)}catch(W){(v=this.onerror)===null||v===void 0||v.call(this,W)}}async close(){var f;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),(f=this.onclose)===null||f===void 0||f.call(this)}send(f){return new Promise((v)=>{let W=zJ(f);if(this._stdout.write(W))v();else this._stdout.once("drain",v)})}}var SQ={name:"@kelceyp/swic",version:"0.1.10",description:"Story Workflow Integration Controller - MCP server for managing stories, subtasks, and pipelines",type:"module",main:"dist/server/Server.js",bin:{"swic-mcp":"./dist/server/Server.js",swic:"./dist/cli/cli.js"},files:["dist/","README.md","LICENSE"],scripts:{"build-server":"bun run scripts/server/build-dist.ts","build-cli":"bun run scripts/cli/build-dist.ts",build:"bun run scripts/build-all.ts",prepublishOnly:"bun run build","test:e2e":"bash tests/e2e/run-e2e-tests.sh","test:e2e:build":"bash tests/e2e/build-test-image.sh","test:e2e:rebuild":"bash tests/e2e/build-test-image.sh && bash tests/e2e/run-e2e-tests.sh",lint:"eslint src scripts archive --ext .ts","lint:fix":"eslint src scripts archive --ext .ts --fix"},dependencies:{"@kelceyp/clibuilder":"^0.1.9","@kelceyp/swic":"^0.1.9","@modelcontextprotocol/sdk":"^1.0.0",debug:"^4.4.3"},devDependencies:{"@types/bun":"latest","@types/debug":"^4.1.12","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^8.46.2","@typescript-eslint/parser":"^8.46.2",esbuild:"^0.25.11",eslint:"8",typescript:"^5.0.0"},engines:{bun:">=1.0.0"},repository:{type:"git",url:"https://github.com/kelceyp/swic.git"},author:"Paul Kelcey",license:"MIT",keywords:["mcp","model-context-protocol","workflow","story-management","pipeline-orchestration","development-workflow","sdlc"]};var B7=(f)=>{let v={name:"doc_create",description:"Create a new doc with content. Returns the created doc ID.",inputSchema:{scope:G.enum(["project","shared"]).describe("Scope for the doc (project or shared)"),path:G.string().describe('Path for the doc (e.g., "auth/jwt-setup" or "auth/jwt-setup.md")'),content:G.string().describe("Content of the doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,path:X,content:Y}=J,w=await f.DocService.create({address:{kind:"path",scope:Q,path:X},content:Y});return{content:[{type:"text",text:`Created doc: ${w.id} at ${w.path}`}]}}})},q7=Object.freeze({create:B7}),LJ=q7;var _0=(f)=>{let v;if(typeof f==="string")v=[f];else if(Array.isArray(f)){if(f.length===0)throw new Error("identifier array cannot be empty");v=f}else throw new Error("identifier must be a string or array of strings");for(let Q of v)if(typeof Q!=="string"||Q.trim().length===0)throw new Error("All identifiers must be non-empty strings");let W=v.map((Q)=>Q.trim()),J=[...new Set(W)];if(J.length===0)throw new Error("No valid identifiers provided");return J};K1();var M7=(f)=>{let v={name:"doc_delete",description:"Delete one or more docs using optimistic locking. Idempotent - does not error if doc already deleted. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk delete")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),expectedHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash for each doc.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,expectedHash:Y}=J,w=_0(Q),B=await Promise.all(w.map(async(q)=>{let N=xv.isdocId(q)?{kind:"id",scope:X,id:q}:{kind:"path",scope:X,path:q},$=await f.DocService.read(N);return{identifier:q,address:N,doc:$}})),z=[];for(let q of B){let M=Y||q.doc.hash,N=await f.DocService.deleteLatest(q.address,M);z.push({id:q.doc.id,deleted:N.deleted})}let K=z.filter((q)=>q.deleted),L=z.length-K.length,V={deleted:K.map((q)=>q.id),alreadyDeleted:z.filter((q)=>!q.deleted).map((q)=>q.id),message:`Deleted ${K.length} doc${K.length!==1?"s":""}`+(L>0?`, ${L} ${L!==1?"were":"was"} already deleted`:"")};return{content:[{type:"text",text:JSON.stringify(V,null,2)}]}}})},N7=Object.freeze({create:M7}),VJ=N7;K1();var V7=(f)=>{let v={name:"doc_edit",description:"Edit doc content using text replacement operations. Uses optimistic locking to prevent concurrent modifications.",inputSchema:{identifier:G.string().describe('doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),operation:G.discriminatedUnion("type",[G.object({type:G.literal("replaceOnce"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceAll"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceRegex"),pattern:G.string(),flags:G.string().optional(),replacement:G.string()}),G.object({type:G.literal("replaceAllContent"),content:G.string()})]).describe("Edit operation to perform"),baseHash:G.string().optional().describe("Optional. Expected hash for optimistic locking. If omitted, automatically fetches current hash.")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,operation:Y,baseHash:w}=J,B;switch(Y.type){case"replaceOnce":B={op:"replaceOnce",oldText:Y.oldText,newText:Y.newText};break;case"replaceAll":B={op:"replaceAll",oldText:Y.oldText,newText:Y.newText};break;case"replaceRegex":B={op:"replaceRegex",pattern:Y.pattern,flags:Y.flags||"",replacement:Y.replacement};break;case"replaceAllContent":B={op:"replaceAllContent",content:Y.content};break;default:throw new Error(`Unknown operation type: ${Y.type}`)}let K=xv.isdocId(Q)?{kind:"id",scope:X,id:Q}:{kind:"path",scope:X,path:Q},L=w;if(!L)L=(await f.DocService.read(K)).hash;let V=await f.DocService.editLatest(K,L,[B]);return{content:[{type:"text",text:`Edited doc: ${Q}
15
- Applied: ${V.applied} edit operation(s)
16
- New hash: ${V.newHash}`}]}}})},D7=Object.freeze({create:V7}),DJ=D7;var j7=(f)=>{let v={name:"doc_list",description:"List docs with optional filtering. Returns structured JSON with doc metadata. When no scope specified, lists from both scopes with override detection.",inputSchema:{scope:G.enum(["project","shared"]).optional().describe("Optional scope filter. If omitted, lists from both scopes and detects overrides (project docs that shadow shared ones)"),pathPrefix:G.string().optional().describe('Optional path prefix filter (e.g., "auth/" to list only docs in auth namespace)'),includeContent:G.boolean().optional().default(!1).describe("Include synopsis from front matter in results")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,pathPrefix:X,includeContent:Y}=J,w=await f.DocService.list({scope:Q,pathPrefix:X,includeContent:Y===!0}),B;if(!Q){let K=w.filter((M)=>M.id.startsWith("doc")),L=w.filter((M)=>M.id.startsWith("sdoc")),V=new Set(K.map((M)=>M.path)),q=new Set(L.map((M)=>M.path));B=w.map((M)=>{let N=M.id.startsWith("doc"),$;if(N&&q.has(M.path))$="overrides";else if(!N&&V.has(M.path))$="overridden";return{id:M.id,path:M.path,scope:N?"project":"shared",override:$,synopsis:M.synopsis,modifiedAt:M.modifiedAt}})}else B=w.map((K)=>({id:K.id,path:K.path,scope:K.id.startsWith("doc")?"project":"shared",synopsis:K.synopsis,modifiedAt:K.modifiedAt}));B.sort((K,L)=>K.path.localeCompare(L.path));let z={docs:B,count:B.length};return{content:[{type:"text",text:JSON.stringify(z,null,2)}]}}})},E7=Object.freeze({create:j7}),jJ=E7;K1();var O7=(f)=>{let v={name:"doc_move",description:"Move or rename a doc to a new path. Generates a new ID. Supports cross-scope moves.",inputSchema:{source:G.string().describe('Source doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),destination:G.string().describe("Destination path (not ID) for the doc"),sourceScope:G.enum(["project","shared"]).optional().describe("Optional. Source scope. Auto-resolves if omitted."),destinationScope:G.enum(["project","shared"]).optional().describe("Optional. Destination scope. Defaults to source scope if omitted.")}};return Object.freeze({definition:v,handler:async(J)=>{let{source:Q,destination:X,sourceScope:Y,destinationScope:w}=J,z=xv.isdocId(Q)?{kind:"id",scope:Y,id:Q}:{kind:"path",scope:Y,path:Q},K=await f.DocService.read(z),L=K.id.startsWith("sdoc")?"shared":"project",V=w||L,q=L!==V;if(K.path===X&&L===V)throw new Error("Source and destination are identical");try{throw await f.DocService.read({kind:"path",scope:V,path:X}),new Error(`Destination already exists: ${V} ${X}`)}catch($){if(!($.message.includes("No doc")||$.message.includes("not found")||$.message.includes("File or directory")))throw $}let M=await f.DocService.create({address:{kind:"path",path:X,scope:V},content:K.content});await f.DocService.deleteLatest(z,K.hash);let N={oldId:K.id,newId:M.id,oldPath:K.path,newPath:X,oldScope:L,newScope:V,message:q?`Moved doc across scopes from ${L} ${K.path} (${K.id}) to ${V} ${X} (new ID: ${M.id})`:`Moved doc from ${K.path} (${K.id}) to ${X} (new ID: ${M.id})`};return{content:[{type:"text",text:JSON.stringify(N,null,2)}]}}})},U7=Object.freeze({create:O7}),EJ=U7;K1();var H7=(f)=>{let v={name:"doc_read",description:"Read one or more docs by ID or path. Returns content with optional metadata. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk read")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. If omitted, auto-resolves (checks project first, then shared, or infers from ID prefix)"),includeMetadata:G.boolean().optional().default(!1).describe("Include ID, path, and hash metadata header for each doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,includeMetadata:Y}=J,w=_0(Q),B=await Promise.all(w.map(async(L)=>{let V=xv.isdocId(L);return await f.DocService.read(V?{kind:"id",scope:X,id:L}:{kind:"path",scope:X,path:L})})),z=[];for(let L=0;L<B.length;L++){let V=B[L];if(Y)z.push(`ID: ${V.id}`),z.push(`Path: ${V.path}`),z.push(`Hash: ${V.hash}`),z.push("---");let q=V.content;if(!q.endsWith(`
12
+ ]`;continue}if(Q+=J[B],J[B]==="\\")X=!0;else if(Y&&J[B]==="]")Y=!1;else if(!Y&&J[B]==="[")Y=!0}try{new RegExp(Q)}catch{return console.warn(`Could not convert regex pattern at ${v.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),f.source}return Q}function h0(f,v){if(v.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(v.target==="openApi3"&&f.keyType?._def.typeName===I.ZodEnum)return{type:"object",required:f.keyType._def.values,properties:f.keyType._def.values.reduce((J,Q)=>({...J,[Q]:i(f.valueType._def,{...v,currentPath:[...v.currentPath,"properties",Q]})??Lv(v)}),{}),additionalProperties:v.rejectedAdditionalProperties};let W={type:"object",additionalProperties:i(f.valueType._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]})??v.allowedAdditionalProperties};if(v.target==="openApi3")return W;if(f.keyType?._def.typeName===I.ZodString&&f.keyType._def.checks?.length){let{type:J,...Q}=U0(f.keyType._def,v);return{...W,propertyNames:Q}}else if(f.keyType?._def.typeName===I.ZodEnum)return{...W,propertyNames:{enum:f.keyType._def.values}};else if(f.keyType?._def.typeName===I.ZodBranded&&f.keyType._def.type._def.typeName===I.ZodString&&f.keyType._def.type._def.checks?.length){let{type:J,...Q}=O0(f.keyType._def,v);return{...W,propertyNames:Q}}return W}function p9(f,v){if(v.mapStrategy==="record")return h0(f,v);let W=i(f.keyType._def,{...v,currentPath:[...v.currentPath,"items","items","0"]})||Lv(v),J=i(f.valueType._def,{...v,currentPath:[...v.currentPath,"items","items","1"]})||Lv(v);return{type:"array",maxItems:125,items:{type:"array",items:[W,J],minItems:2,maxItems:2}}}function i9(f){let v=f.values,J=Object.keys(f.values).filter((X)=>{return typeof v[v[X]]!=="number"}).map((X)=>v[X]),Q=Array.from(new Set(J.map((X)=>typeof X)));return{type:Q.length===1?Q[0]==="string"?"string":"number":["string","number"],enum:J}}function d9(f){return f.target==="openAi"?void 0:{not:Lv({...f,currentPath:[...f.currentPath,"not"]})}}function o9(f){return f.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var k1={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function t9(f,v){if(v.target==="openApi3")return s9(f,v);let W=f.options instanceof Map?Array.from(f.options.values()):f.options;if(W.every((J)=>(J._def.typeName in k1)&&(!J._def.checks||!J._def.checks.length))){let J=W.reduce((Q,X)=>{let Y=k1[X._def.typeName];return Y&&!Q.includes(Y)?[...Q,Y]:Q},[]);return{type:J.length>1?J:J[0]}}else if(W.every((J)=>J._def.typeName==="ZodLiteral"&&!J.description)){let J=W.reduce((Q,X)=>{let Y=typeof X._def.value;switch(Y){case"string":case"number":case"boolean":return[...Q,Y];case"bigint":return[...Q,"integer"];case"object":if(X._def.value===null)return[...Q,"null"];case"symbol":case"undefined":case"function":default:return Q}},[]);if(J.length===W.length){let Q=J.filter((X,Y,w)=>w.indexOf(X)===Y);return{type:Q.length>1?Q:Q[0],enum:W.reduce((X,Y)=>{return X.includes(Y._def.value)?X:[...X,Y._def.value]},[])}}}else if(W.every((J)=>J._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((J,Q)=>[...J,...Q._def.values.filter((X)=>!J.includes(X))],[])};return s9(f,v)}var s9=(f,v)=>{let W=(f.options instanceof Map?Array.from(f.options.values()):f.options).map((J,Q)=>i(J._def,{...v,currentPath:[...v.currentPath,"anyOf",`${Q}`]})).filter((J)=>!!J&&(!v.strictUnions||typeof J==="object"&&Object.keys(J).length>0));return W.length?{anyOf:W}:void 0};function e9(f,v){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(f.innerType._def.typeName)&&(!f.innerType._def.checks||!f.innerType._def.checks.length)){if(v.target==="openApi3")return{type:k1[f.innerType._def.typeName],nullable:!0};return{type:[k1[f.innerType._def.typeName],"null"]}}if(v.target==="openApi3"){let J=i(f.innerType._def,{...v,currentPath:[...v.currentPath]});if(J&&"$ref"in J)return{allOf:[J],nullable:!0};return J&&{...J,nullable:!0}}let W=i(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function vJ(f,v){let W={type:"number"};if(!f.checks)return W;for(let J of f.checks)switch(J.kind){case"int":W.type="integer",hQ(W,"type",J.message,v);break;case"min":if(v.target==="jsonSchema7")if(J.inclusive)Qv(W,"minimum",J.value,J.message,v);else Qv(W,"exclusiveMinimum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMinimum=!0;Qv(W,"minimum",J.value,J.message,v)}break;case"max":if(v.target==="jsonSchema7")if(J.inclusive)Qv(W,"maximum",J.value,J.message,v);else Qv(W,"exclusiveMaximum",J.value,J.message,v);else{if(!J.inclusive)W.exclusiveMaximum=!0;Qv(W,"maximum",J.value,J.message,v)}break;case"multipleOf":Qv(W,"multipleOf",J.value,J.message,v);break}return W}function fJ(f,v){let W=v.target==="openAi",J={type:"object",properties:{}},Q=[],X=f.shape();for(let w in X){let B=X[w];if(B===void 0||B._def===void 0)continue;let z=eY(B);if(z&&W){if(B._def.typeName==="ZodOptional")B=B._def.innerType;if(!B.isNullable())B=B.nullable();z=!1}let H=i(B._def,{...v,currentPath:[...v.currentPath,"properties",w],propertyPath:[...v.currentPath,"properties",w]});if(H===void 0)continue;if(J.properties[w]=H,!z)Q.push(w)}if(Q.length)J.required=Q;let Y=tY(f,v);if(Y!==void 0)J.additionalProperties=Y;return J}function tY(f,v){if(f.catchall._def.typeName!=="ZodNever")return i(f.catchall._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]});switch(f.unknownKeys){case"passthrough":return v.allowedAdditionalProperties;case"strict":return v.rejectedAdditionalProperties;case"strip":return v.removeAdditionalStrategy==="strict"?v.allowedAdditionalProperties:v.rejectedAdditionalProperties}}function eY(f){try{return f.isOptional()}catch{return!0}}var QJ=(f,v)=>{if(v.currentPath.toString()===v.propertyPath?.toString())return i(f.innerType._def,v);let W=i(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","1"]});return W?{anyOf:[{not:Lv(v)},W]}:Lv(v)};var WJ=(f,v)=>{if(v.pipeStrategy==="input")return i(f.in._def,v);else if(v.pipeStrategy==="output")return i(f.out._def,v);let W=i(f.in._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),J=i(f.out._def,{...v,currentPath:[...v.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,J].filter((Q)=>Q!==void 0)}};function JJ(f,v){return i(f.type._def,v)}function XJ(f,v){let J={type:"array",uniqueItems:!0,items:i(f.valueType._def,{...v,currentPath:[...v.currentPath,"items"]})};if(f.minSize)Qv(J,"minItems",f.minSize.value,f.minSize.message,v);if(f.maxSize)Qv(J,"maxItems",f.maxSize.value,f.maxSize.message,v);return J}function YJ(f,v){if(f.rest)return{type:"array",minItems:f.items.length,items:f.items.map((W,J)=>i(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[]),additionalItems:i(f.rest._def,{...v,currentPath:[...v.currentPath,"additionalItems"]})};else return{type:"array",minItems:f.items.length,maxItems:f.items.length,items:f.items.map((W,J)=>i(W._def,{...v,currentPath:[...v.currentPath,"items",`${J}`]})).reduce((W,J)=>J===void 0?W:[...W,J],[])}}function wJ(f){return{not:Lv(f)}}function GJ(f){return Lv(f)}var BJ=(f,v)=>{return i(f.innerType._def,v)};var qJ=(f,v,W)=>{switch(v){case I.ZodString:return U0(f,W);case I.ZodNumber:return vJ(f,W);case I.ZodObject:return fJ(f,W);case I.ZodBigInt:return C9(f,W);case I.ZodBoolean:return T9();case I.ZodDate:return FQ(f,W);case I.ZodUndefined:return wJ(W);case I.ZodNull:return o9(W);case I.ZodArray:return Z9(f,W);case I.ZodUnion:case I.ZodDiscriminatedUnion:return t9(f,W);case I.ZodIntersection:return a9(f,W);case I.ZodTuple:return YJ(f,W);case I.ZodRecord:return h0(f,W);case I.ZodLiteral:return c9(f,W);case I.ZodEnum:return m9(f);case I.ZodNativeEnum:return i9(f);case I.ZodNullable:return e9(f,W);case I.ZodOptional:return QJ(f,W);case I.ZodMap:return p9(f,W);case I.ZodSet:return XJ(f,W);case I.ZodLazy:return()=>f.getter()._def;case I.ZodPromise:return JJ(f,W);case I.ZodNaN:case I.ZodNever:return d9(W);case I.ZodEffects:return r9(f,W);case I.ZodAny:return Lv(W);case I.ZodUnknown:return GJ(W);case I.ZodDefault:return u9(f,W);case I.ZodBranded:return O0(f,W);case I.ZodReadonly:return BJ(f,W);case I.ZodCatch:return x9(f,W);case I.ZodPipeline:return WJ(f,W);case I.ZodFunction:case I.ZodVoid:case I.ZodSymbol:return;default:return((J)=>{return})(v)}};function i(f,v,W=!1){let J=v.seen.get(f);if(v.override){let w=v.override?.(f,v,J,W);if(w!==y9)return w}if(J&&!W){let w=v7(J,v);if(w!==void 0)return w}let Q={def:f,path:v.currentPath,jsonSchema:void 0};v.seen.set(f,Q);let X=qJ(f,f.typeName,v),Y=typeof X==="function"?i(X(),v):X;if(Y)f7(f,v,Y);if(v.postProcess){let w=v.postProcess(Y,f,v);return Q.jsonSchema=Y,w}return Q.jsonSchema=Y,Y}var v7=(f,v)=>{switch(v.$refStrategy){case"root":return{$ref:f.path.join("/")};case"relative":return{$ref:j0(v.currentPath,f.path)};case"none":case"seen":{if(f.path.length<v.currentPath.length&&f.path.every((W,J)=>v.currentPath[J]===W))return console.warn(`Recursive reference detected at ${v.currentPath.join("/")}! Defaulting to any`),Lv(v);return v.$refStrategy==="seen"?Lv(v):void 0}}},f7=(f,v,W)=>{if(f.description){if(W.description=f.description,v.markdownDescription)W.markdownDescription=f.description}return W};var F0=(f,v)=>{let W=I9(v),J=typeof v==="object"&&v.definitions?Object.entries(v.definitions).reduce((B,[z,H])=>({...B,[z]:i(H._def,{...W,currentPath:[...W.basePath,W.definitionPath,z]},!0)??Lv(W)}),{}):void 0,Q=typeof v==="string"?v:v?.nameStrategy==="title"?void 0:v?.name,X=i(f._def,Q===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,Q]},!1)??Lv(W),Y=typeof v==="object"&&v.name!==void 0&&v.nameStrategy==="title"?v.name:void 0;if(Y!==void 0)X.title=Y;if(W.flags.hasReferencedOpenAiAnyType){if(!J)J={};if(!J[W.openAiAnyTypeName])J[W.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:W.$refStrategy==="relative"?"1":[...W.basePath,W.definitionPath,W.openAiAnyTypeName].join("/")}}}let w=Q===void 0?J?{...X,[W.definitionPath]:J}:X:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,Q].join("/"),[W.definitionPath]:{...J,[Q]:X}};if(W.target==="jsonSchema7")w.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")w.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in w)||("oneOf"in w)||("allOf"in w)||("type"in w)&&Array.isArray(w.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return w};var bQ;(function(f){f.Completable="McpCompletable"})(bQ||(bQ={}));class S1 extends vv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}S1.create=(f,v)=>{return new S1({type:f,typeName:bQ.Completable,complete:v.complete,...Q7(v)})};function Q7(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:J,description:Q}=f;if(v&&(W||J))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(Y,w)=>{var B,z;let{message:H}=f;if(Y.code==="invalid_enum_value")return{message:H!==null&&H!==void 0?H:w.defaultError};if(typeof w.data==="undefined")return{message:(B=H!==null&&H!==void 0?H:J)!==null&&B!==void 0?B:w.defaultError};if(Y.code!=="invalid_type")return{message:w.defaultError};return{message:(z=H!==null&&H!==void 0?H:W)!==null&&z!==void 0?z:w.defaultError}},description:Q}}class _Q{constructor(f,v){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new UQ(f,v)}async connect(f){return await this.server.connect(f)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(f0.shape.method.value),this.server.assertCanSetRequestHandler(Q0.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(f0,()=>({tools:Object.entries(this._registeredTools).filter(([,f])=>f.enabled).map(([f,v])=>{let W={name:f,title:v.title,description:v.description,inputSchema:v.inputSchema?F0(v.inputSchema,{strictUnions:!0}):W7,annotations:v.annotations,_meta:v._meta};if(v.outputSchema)W.outputSchema=F0(v.outputSchema,{strictUnions:!0});return W})})),this.server.setRequestHandler(Q0,async(f,v)=>{let W=this._registeredTools[f.params.name];if(!W)throw new Kv(Hv.InvalidParams,`Tool ${f.params.name} not found`);if(!W.enabled)throw new Kv(Hv.InvalidParams,`Tool ${f.params.name} disabled`);let J;if(W.inputSchema){let Q=await W.inputSchema.safeParseAsync(f.params.arguments);if(!Q.success)throw new Kv(Hv.InvalidParams,`Invalid arguments for tool ${f.params.name}: ${Q.error.message}`);let X=Q.data,Y=W.callback;try{J=await Promise.resolve(Y(X,v))}catch(w){J={content:[{type:"text",text:w instanceof Error?w.message:String(w)}],isError:!0}}}else{let Q=W.callback;try{J=await Promise.resolve(Q(v))}catch(X){J={content:[{type:"text",text:X instanceof Error?X.message:String(X)}],isError:!0}}}if(W.outputSchema&&!J.isError){if(!J.structuredContent)throw new Kv(Hv.InvalidParams,`Tool ${f.params.name} has an output schema but no structured content was provided`);let Q=await W.outputSchema.safeParseAsync(J.structuredContent);if(!Q.success)throw new Kv(Hv.InvalidParams,`Invalid structured content for tool ${f.params.name}: ${Q.error.message}`)}return J}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(W0.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(W0,async(f)=>{switch(f.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(f,f.params.ref);case"ref/resource":return this.handleResourceCompletion(f,f.params.ref);default:throw new Kv(Hv.InvalidParams,`Invalid completion reference: ${f.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(f,v){let W=this._registeredPrompts[v.name];if(!W)throw new Kv(Hv.InvalidParams,`Prompt ${v.name} not found`);if(!W.enabled)throw new Kv(Hv.InvalidParams,`Prompt ${v.name} disabled`);if(!W.argsSchema)return g0;let J=W.argsSchema.shape[f.params.argument.name];if(!(J instanceof S1))return g0;let X=await J._def.complete(f.params.argument.value,f.params.context);return HJ(X)}async handleResourceCompletion(f,v){let W=Object.values(this._registeredResourceTemplates).find((X)=>X.resourceTemplate.uriTemplate.toString()===v.uri);if(!W){if(this._registeredResources[v.uri])return g0;throw new Kv(Hv.InvalidParams,`Resource template ${f.params.ref.uri} not found`)}let J=W.resourceTemplate.completeCallback(f.params.argument.name);if(!J)return g0;let Q=await J(f.params.argument.value,f.params.context);return HJ(Q)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(o1.shape.method.value),this.server.assertCanSetRequestHandler(s1.shape.method.value),this.server.assertCanSetRequestHandler(t1.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(o1,async(f,v)=>{let W=Object.entries(this._registeredResources).filter(([Q,X])=>X.enabled).map(([Q,X])=>({uri:Q,name:X.name,...X.metadata})),J=[];for(let Q of Object.values(this._registeredResourceTemplates)){if(!Q.resourceTemplate.listCallback)continue;let X=await Q.resourceTemplate.listCallback(v);for(let Y of X.resources)J.push({...Q.metadata,...Y})}return{resources:[...W,...J]}}),this.server.setRequestHandler(s1,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([v,W])=>({name:v,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(t1,async(f,v)=>{let W=new URL(f.params.uri),J=this._registeredResources[W.toString()];if(J){if(!J.enabled)throw new Kv(Hv.InvalidParams,`Resource ${W} disabled`);return J.readCallback(W,v)}for(let Q of Object.values(this._registeredResourceTemplates)){let X=Q.resourceTemplate.uriTemplate.match(W.toString());if(X)return Q.readCallback(W,X,v)}throw new Kv(Hv.InvalidParams,`Resource ${W} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(e1.shape.method.value),this.server.assertCanSetRequestHandler(v0.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(e1,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,f])=>f.enabled).map(([f,v])=>{return{name:f,title:v.title,description:v.description,arguments:v.argsSchema?X7(v.argsSchema):void 0}})})),this.server.setRequestHandler(v0,async(f,v)=>{let W=this._registeredPrompts[f.params.name];if(!W)throw new Kv(Hv.InvalidParams,`Prompt ${f.params.name} not found`);if(!W.enabled)throw new Kv(Hv.InvalidParams,`Prompt ${f.params.name} disabled`);if(W.argsSchema){let J=await W.argsSchema.safeParseAsync(f.params.arguments);if(!J.success)throw new Kv(Hv.InvalidParams,`Invalid arguments for prompt ${f.params.name}: ${J.error.message}`);let Q=J.data,X=W.callback;return await Promise.resolve(X(Q,v))}else{let J=W.callback;return await Promise.resolve(J(v))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource(f,v,...W){let J;if(typeof W[0]==="object")J=W.shift();let Q=W[0];if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let X=this._createRegisteredResource(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let X=this._createRegisteredResourceTemplate(f,void 0,v,J,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}}registerResource(f,v,W,J){if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let Q=this._createRegisteredResource(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let Q=this._createRegisteredResourceTemplate(f,W.title,v,W,J);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}}_createRegisteredResource(f,v,W,J,Q){let X={name:f,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({uri:null}),update:(Y)=>{if(typeof Y.uri!=="undefined"&&Y.uri!==W){if(delete this._registeredResources[W],Y.uri)this._registeredResources[Y.uri]=X}if(typeof Y.name!=="undefined")X.name=Y.name;if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=X,X}_createRegisteredResourceTemplate(f,v,W,J,Q){let X={resourceTemplate:W,title:v,metadata:J,readCallback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredResourceTemplates[f],Y.name)this._registeredResourceTemplates[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.template!=="undefined")X.resourceTemplate=Y.template;if(typeof Y.metadata!=="undefined")X.metadata=Y.metadata;if(typeof Y.callback!=="undefined")X.readCallback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[f]=X,X}_createRegisteredPrompt(f,v,W,J,Q){let X={title:v,description:W,argsSchema:J===void 0?void 0:G.object(J),callback:Q,enabled:!0,disable:()=>X.update({enabled:!1}),enable:()=>X.update({enabled:!0}),remove:()=>X.update({name:null}),update:(Y)=>{if(typeof Y.name!=="undefined"&&Y.name!==f){if(delete this._registeredPrompts[f],Y.name)this._registeredPrompts[Y.name]=X}if(typeof Y.title!=="undefined")X.title=Y.title;if(typeof Y.description!=="undefined")X.description=Y.description;if(typeof Y.argsSchema!=="undefined")X.argsSchema=G.object(Y.argsSchema);if(typeof Y.callback!=="undefined")X.callback=Y.callback;if(typeof Y.enabled!=="undefined")X.enabled=Y.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[f]=X,X}_createRegisteredTool(f,v,W,J,Q,X,Y,w){let B={title:v,description:W,inputSchema:J===void 0?void 0:G.object(J),outputSchema:Q===void 0?void 0:G.object(Q),annotations:X,_meta:Y,callback:w,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({name:null}),update:(z)=>{if(typeof z.name!=="undefined"&&z.name!==f){if(delete this._registeredTools[f],z.name)this._registeredTools[z.name]=B}if(typeof z.title!=="undefined")B.title=z.title;if(typeof z.description!=="undefined")B.description=z.description;if(typeof z.paramsSchema!=="undefined")B.inputSchema=G.object(z.paramsSchema);if(typeof z.callback!=="undefined")B.callback=z.callback;if(typeof z.annotations!=="undefined")B.annotations=z.annotations;if(typeof z._meta!=="undefined")B._meta=z._meta;if(typeof z.enabled!=="undefined")B.enabled=z.enabled;this.sendToolListChanged()}};return this._registeredTools[f]=B,this.setToolRequestHandlers(),this.sendToolListChanged(),B}tool(f,...v){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let W,J,Q,X;if(typeof v[0]==="string")W=v.shift();if(v.length>1){let w=v[0];if(PJ(w)){if(J=v.shift(),v.length>1&&typeof v[0]==="object"&&v[0]!==null&&!PJ(v[0]))X=v.shift()}else if(typeof w==="object"&&w!==null)X=v.shift()}let Y=v[0];return this._createRegisteredTool(f,void 0,W,J,Q,X,void 0,Y)}registerTool(f,v,W){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let{title:J,description:Q,inputSchema:X,outputSchema:Y,annotations:w,_meta:B}=v;return this._createRegisteredTool(f,J,Q,X,Y,w,B,W)}prompt(f,...v){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let W;if(typeof v[0]==="string")W=v.shift();let J;if(v.length>1)J=v.shift();let Q=v[0],X=this._createRegisteredPrompt(f,void 0,W,J,Q);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),X}registerPrompt(f,v,W){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let{title:J,description:Q,argsSchema:X}=v,Y=this._createRegisteredPrompt(f,J,Q,X,W);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),Y}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(f,v){return this.server.sendLoggingMessage(f,v)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var W7={type:"object",properties:{}};function PJ(f){if(typeof f!=="object"||f===null)return!1;return Object.keys(f).length===0||Object.values(f).some(J7)}function J7(f){return f!==null&&typeof f==="object"&&"parse"in f&&typeof f.parse==="function"&&"safeParse"in f&&typeof f.safeParse==="function"}function X7(f){return Object.entries(f.shape).map(([v,W])=>({name:v,description:W.description,required:!W.isOptional()}))}function HJ(f){return{completion:{values:f.slice(0,100),total:f.length,hasMore:f.length>100}}}var g0={completion:{values:[],hasMore:!1}};import zJ from"process";class RQ{append(f){this._buffer=this._buffer?Buffer.concat([this._buffer,f]):f}readMessage(){if(!this._buffer)return null;let f=this._buffer.indexOf(`
13
+ `);if(f===-1)return null;let v=this._buffer.toString("utf8",0,f).replace(/\r$/,"");return this._buffer=this._buffer.subarray(f+1),Y7(v)}clear(){this._buffer=void 0}}function Y7(f){return j8.parse(JSON.parse(f))}function KJ(f){return JSON.stringify(f)+`
14
+ `}class kQ{constructor(f=zJ.stdin,v=zJ.stdout){this._stdin=f,this._stdout=v,this._readBuffer=new RQ,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{var J;(J=this.onerror)===null||J===void 0||J.call(this,W)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){var f,v;while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;(f=this.onmessage)===null||f===void 0||f.call(this,W)}catch(W){(v=this.onerror)===null||v===void 0||v.call(this,W)}}async close(){var f;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),(f=this.onclose)===null||f===void 0||f.call(this)}send(f){return new Promise((v)=>{let W=KJ(f);if(this._stdout.write(W))v();else this._stdout.once("drain",v)})}}var SQ={name:"@kelceyp/swic",version:"0.1.11",description:"Story Workflow Integration Controller - MCP server for managing stories, subtasks, and pipelines",type:"module",main:"dist/server/Server.js",bin:{"swic-mcp":"./dist/server/Server.js",swic:"./dist/cli/cli.js"},files:["dist/","README.md","LICENSE"],scripts:{"build-server":"bun run scripts/server/build-dist.ts","build-cli":"bun run scripts/cli/build-dist.ts",build:"bun run scripts/build-all.ts",prepublishOnly:"bun run build","test:e2e":"bash tests/e2e/run-e2e-tests.sh","test:e2e:build":"bash tests/e2e/build-test-image.sh","test:e2e:rebuild":"bash tests/e2e/build-test-image.sh && bash tests/e2e/run-e2e-tests.sh",lint:"eslint src scripts archive --ext .ts","lint:fix":"eslint src scripts archive --ext .ts --fix"},dependencies:{"@kelceyp/clibuilder":"^0.2.0","@kelceyp/swic":"^0.1.10","@modelcontextprotocol/sdk":"^1.0.0",debug:"^4.4.3"},devDependencies:{"@types/bun":"latest","@types/debug":"^4.1.12","@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^8.46.2","@typescript-eslint/parser":"^8.46.2",esbuild:"^0.25.11",eslint:"8",typescript:"^5.0.0"},engines:{bun:">=1.0.0"},repository:{type:"git",url:"https://github.com/kelceyp/swic.git"},author:"Paul Kelcey",license:"MIT",keywords:["mcp","model-context-protocol","workflow","story-management","pipeline-orchestration","development-workflow","sdlc"]};var G7=(f)=>{let v={name:"doc_create",description:"Create a new doc with content. Returns the created doc ID.",inputSchema:{scope:G.enum(["project","shared"]).describe("Scope for the doc (project or shared)"),path:G.string().describe('Path for the doc (e.g., "auth/jwt-setup.md")'),content:G.string().describe("Content of the doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,path:X,content:Y}=J,w=await f.DocService.create({address:{kind:"path",scope:Q,path:X},content:Y});return{content:[{type:"text",text:`Created doc: ${w.id} at ${w.path}`}]}}})},B7=Object.freeze({create:G7}),LJ=B7;var A0=(f)=>{let v;if(typeof f==="string")v=[f];else if(Array.isArray(f)){if(f.length===0)throw new Error("identifier array cannot be empty");v=f}else throw new Error("identifier must be a string or array of strings");for(let Q of v)if(typeof Q!=="string"||Q.trim().length===0)throw new Error("All identifiers must be non-empty strings");let W=v.map((Q)=>Q.trim()),J=[...new Set(W)];if(J.length===0)throw new Error("No valid identifiers provided");return J};H1();var L7=(f)=>{let v={name:"doc_delete",description:"Delete one or more docs. Idempotent - does not error if doc already deleted. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup.md")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk delete")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X}=J,Y=A0(Q),w=await Promise.all(Y.map(async(K)=>{let L=xv.isdocId(K)?{kind:"id",scope:X,id:K}:{kind:"path",scope:X,path:K},V=await f.DocService.read(L);return{identifier:K,address:L,doc:V}})),B=[];for(let K of w){let q=await f.DocService.deleteLatest(K.address);B.push({id:K.doc.id,deleted:q.deleted})}let z=B.filter((K)=>K.deleted),H=B.length-z.length,$={deleted:z.map((K)=>K.id),alreadyDeleted:B.filter((K)=>!K.deleted).map((K)=>K.id),message:`Deleted ${z.length} doc${z.length!==1?"s":""}`+(H>0?`, ${H} ${H!==1?"were":"was"} already deleted`:"")};return{content:[{type:"text",text:JSON.stringify($,null,2)}]}}})},$7=Object.freeze({create:L7}),NJ=$7;H1();var M7=(f)=>{let v={name:"doc_edit",description:"Edit doc content using text replacement operations. Uses last-write-wins semantics.",inputSchema:{identifier:G.string().describe('doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup.md")'),scope:G.enum(["project","shared"]).optional().describe("Optional scope. Auto-resolves if omitted (checks project first, then shared, or infers from ID prefix)"),operation:G.discriminatedUnion("type",[G.object({type:G.literal("replaceOnce"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceAll"),oldText:G.string(),newText:G.string()}),G.object({type:G.literal("replaceRegex"),pattern:G.string(),flags:G.string().optional(),replacement:G.string()}),G.object({type:G.literal("replaceAllContent"),content:G.string()})]).describe("Edit operation to perform")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,operation:Y}=J,w;switch(Y.type){case"replaceOnce":w={op:"replaceOnce",oldText:Y.oldText,newText:Y.newText};break;case"replaceAll":w={op:"replaceAll",oldText:Y.oldText,newText:Y.newText};break;case"replaceRegex":w={op:"replaceRegex",pattern:Y.pattern,flags:Y.flags||"",replacement:Y.replacement};break;case"replaceAllContent":w={op:"replaceAllContent",content:Y.content};break;default:throw new Error(`Unknown operation type: ${Y.type}`)}let z=xv.isdocId(Q)?{kind:"id",scope:X,id:Q}:{kind:"path",scope:X,path:Q},H=await f.DocService.editLatest(z,[w]);return{content:[{type:"text",text:`Edited doc: ${Q}
15
+ Applied: ${H.applied} edit operation(s)`}]}}})},N7=Object.freeze({create:M7}),VJ=N7;var V7=(f)=>{let v={name:"doc_list",description:"List docs with optional filtering. Returns structured JSON with doc metadata. When no scope specified, lists from both scopes with override detection.",inputSchema:{scope:G.enum(["project","shared"]).optional().describe("Optional scope filter. If omitted, lists from both scopes and detects overrides (project docs that shadow shared ones)"),pathPrefix:G.string().optional().describe('Optional path prefix filter (e.g., "auth/" to list only docs in auth namespace)'),includeContent:G.boolean().optional().default(!1).describe("Include synopsis from front matter in results")}};return Object.freeze({definition:v,handler:async(J)=>{let{scope:Q,pathPrefix:X,includeContent:Y}=J,w=await f.DocService.list({scope:Q,pathPrefix:X,includeContent:Y===!0}),B;if(!Q){let H=w.filter((L)=>L.id.startsWith("doc")),$=w.filter((L)=>L.id.startsWith("sdoc")),K=new Set(H.map((L)=>L.path)),q=new Set($.map((L)=>L.path));B=w.map((L)=>{let V=L.id.startsWith("doc"),M;if(V&&q.has(L.path))M="overrides";else if(!V&&K.has(L.path))M="overridden";return{id:L.id,path:L.path,scope:V?"project":"shared",override:M,synopsis:L.synopsis,modifiedAt:L.modifiedAt}})}else B=w.map((H)=>({id:H.id,path:H.path,scope:H.id.startsWith("doc")?"project":"shared",synopsis:H.synopsis,modifiedAt:H.modifiedAt}));B.sort((H,$)=>H.path.localeCompare($.path));let z={docs:B,count:B.length};return{content:[{type:"text",text:JSON.stringify(z,null,2)}]}}})},E7=Object.freeze({create:V7}),EJ=E7;H1();var D7=(f)=>{let v={name:"doc_move",description:"Move or rename a doc to a new path. Generates a new ID. Supports cross-scope moves.",inputSchema:{source:G.string().describe('Source doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup.md")'),destination:G.string().describe("Destination path (not ID) for the doc"),sourceScope:G.enum(["project","shared"]).optional().describe("Optional. Source scope. Auto-resolves if omitted."),destinationScope:G.enum(["project","shared"]).optional().describe("Optional. Destination scope. Defaults to source scope if omitted.")}};return Object.freeze({definition:v,handler:async(J)=>{let{source:Q,destination:X,sourceScope:Y,destinationScope:w}=J,z=xv.isdocId(Q)?{kind:"id",scope:Y,id:Q}:{kind:"path",scope:Y,path:Q},H=await f.DocService.read(z),$=H.id.startsWith("sdoc")?"shared":"project",K=w||$,q=$!==K;if(H.path===X&&$===K)throw new Error("Source and destination are identical");try{throw await f.DocService.read({kind:"path",scope:K,path:X}),new Error(`Destination already exists: ${K} ${X}`)}catch(M){if(!(M.message.includes("No doc")||M.message.includes("not found")||M.message.includes("File or directory")))throw M}let L=await f.DocService.create({address:{kind:"path",path:X,scope:K},content:H.content});await f.DocService.deleteLatest(z,H.hash);let V={oldId:H.id,newId:L.id,oldPath:H.path,newPath:X,oldScope:$,newScope:K,message:q?`Moved doc across scopes from ${$} ${H.path} (${H.id}) to ${K} ${X} (new ID: ${L.id})`:`Moved doc from ${H.path} (${H.id}) to ${X} (new ID: ${L.id})`};return{content:[{type:"text",text:JSON.stringify(V,null,2)}]}}})},j7=Object.freeze({create:D7}),DJ=j7;H1();var O7=(f)=>{let v={name:"doc_read",description:"Read one or more docs by ID or path. Returns content with optional metadata. Supports bulk operations by passing an array of identifiers.",inputSchema:{identifier:G.union([G.string().describe('Single doc ID (e.g., "doc001") or path (e.g., "auth/jwt-setup.md")'),G.array(G.string()).describe("Array of doc IDs or paths for bulk read")]).describe("doc identifier(s) - ID or path, single or array"),scope:G.enum(["project","shared"]).optional().describe("Optional scope. If omitted, auto-resolves (checks project first, then shared, or infers from ID prefix)"),includeMetadata:G.boolean().optional().default(!1).describe("Include ID and path metadata header for each doc")}};return Object.freeze({definition:v,handler:async(J)=>{let{identifier:Q,scope:X,includeMetadata:Y}=J,w=A0(Q),B=await Promise.all(w.map(async($)=>{let K=xv.isdocId($);return await f.DocService.read(K?{kind:"id",scope:X,id:$}:{kind:"path",scope:X,path:$})})),z=[];for(let $=0;$<B.length;$++){let K=B[$];if(Y)z.push(`ID: ${K.id}`),z.push(`Path: ${K.path}`),z.push("---");let q=K.content;if(!q.endsWith(`
17
16
  `))q+=`
18
- `;if(z.push(q),L<B.length-1)z.push("")}return{content:[{type:"text",text:z.join(`
19
- `)}]}}})},F7=Object.freeze({create:H7}),OJ=F7;var UJ=[LJ.create,VJ.create,DJ.create,jJ.create,EJ.create,OJ.create];import{fileURLToPath as q2}from"url";import{realpathSync as cJ}from"fs";var nJ=(f)=>{let{services:v}=f,W=SQ.name,J=SQ.version,Q=new bQ({name:W,version:J});return Object.freeze({start:async()=>{for(let w of UJ){let B=w(v);Q.registerTool(B.definition.name,{description:B.definition.description,inputSchema:B.definition.inputSchema},async(z)=>B.handler(z))}let Y=new kQ;await Q.connect(Y),console.error(`${W} v${J} running on stdio`)}})},G2=async()=>{let{default:f}=await Promise.resolve().then(() => (aJ(),rJ)),{projectDataDir:v,sharedDataDir:W}=f.lazilyGetDataDirs(),J=f.createServices({projectBoundaryDir:v,sharedBoundaryDir:W});await nJ({services:J}).start()},B2=Object.freeze({create:nJ}),P2=import.meta.main??(()=>{try{let f=cJ(q2(import.meta.url)),v=cJ(process.argv[1]);return f===v}catch{return!1}})();if(P2)G2().catch(console.error);var Mq=B2;export{Mq as default};
17
+ `;if(z.push(q),$<B.length-1)z.push("")}return{content:[{type:"text",text:z.join(`
18
+ `)}]}}})},U7=Object.freeze({create:O7}),jJ=U7;var OJ=[LJ.create,NJ.create,VJ.create,EJ.create,DJ.create,jJ.create];import{fileURLToPath as B2}from"url";import{realpathSync as aJ}from"fs";var cJ=(f)=>{let{services:v}=f,W=SQ.name,J=SQ.version,Q=new _Q({name:W,version:J});return Object.freeze({start:async()=>{for(let w of OJ){let B=w(v);Q.registerTool(B.definition.name,{description:B.definition.description,inputSchema:B.definition.inputSchema},async(z)=>B.handler(z))}let Y=new kQ;await Q.connect(Y),console.error(`${W} v${J} running on stdio`)}})},w2=async()=>{let{default:f}=await Promise.resolve().then(() => (mJ(),rJ)),{projectDataDir:v,sharedDataDir:W}=f.lazilyGetDataDirs(),J=f.createServices({projectBoundaryDir:v,sharedBoundaryDir:W});await cJ({services:J}).start()},G2=Object.freeze({create:cJ}),q2=import.meta.main??(()=>{try{let f=aJ(B2(import.meta.url)),v=aJ(process.argv[1]);return f===v}catch{return!1}})();if(q2)w2().catch(console.error);var Kq=G2;export{Kq as default};