@linzumi/cli 1.0.18 → 1.0.20

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,18 +1,18 @@
1
1
  import { createRequire } from 'node:module';
2
2
  const require = createRequire(import.meta.url);
3
- var $d=Object.create;var Qn=Object.defineProperty;var Dd=Object.getOwnPropertyDescriptor;var Ld=Object.getOwnPropertyNames;var Nd=Object.getPrototypeOf,Md=Object.prototype.hasOwnProperty;var ee=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),yo=(a,e)=>{for(var r in e)Qn(a,r,{get:e[r],enumerable:!0})},zd=(a,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of Ld(e))!Md.call(a,t)&&t!==r&&Qn(a,t,{get:()=>e[t],enumerable:!(n=Dd(e,t))||n.enumerable});return a};var Fd=(a,e,r)=>(r=a!=null?$d(Nd(a)):{},zd(e||!a||!a.__esModule?Qn(r,"default",{value:a,enumerable:!0}):r,a));var Qo=ee((un,Ko)=>{(function(a,e){typeof un=="object"&&typeof Ko<"u"?e(un):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(un,(function(a){"use strict";function e(){for(var m=arguments.length,p=Array(m),_=0;_<m;_++)p[_]=arguments[_];if(p.length>1){p[0]=p[0].slice(0,-1);for(var w=p.length-1,k=1;k<w;++k)p[k]=p[k].slice(1,-1);return p[w]=p[w].slice(1),p.join("")}else return p[0]}function r(m){return"(?:"+m+")"}function n(m){return m===void 0?"undefined":m===null?"null":Object.prototype.toString.call(m).split(" ").pop().split("]").shift().toLowerCase()}function t(m){return m.toUpperCase()}function s(m){return m!=null?m instanceof Array?m:typeof m.length!="number"||m.split||m.setInterval||m.call?[m]:Array.prototype.slice.call(m):[]}function o(m,p){var _=m;if(p)for(var w in p)_[w]=p[w];return _}function i(m){var p="[A-Za-z]",_="[\\x0D]",w="[0-9]",k="[\\x22]",F=e(w,"[A-Fa-f]"),ne="[\\x0A]",pe="[\\x20]",ve=r(r("%[EFef]"+F+"%"+F+F+"%"+F+F)+"|"+r("%[89A-Fa-f]"+F+"%"+F+F)+"|"+r("%"+F+F)),$e="[\\:\\/\\?\\#\\[\\]\\@]",fe="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ee=e($e,fe),De=m?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Se=m?"[\\uE000-\\uF8FF]":"[]",me=e(p,w,"[\\-\\.\\_\\~]",De),Re=r(p+e(p,w,"[\\+\\-\\.]")+"*"),be=r(r(ve+"|"+e(me,fe,"[\\:]"))+"*"),ir=r(r("25[0-5]")+"|"+r("2[0-4]"+w)+"|"+r("1"+w+w)+"|"+r("[1-9]"+w)+"|"+w),rt=r(r("25[0-5]")+"|"+r("2[0-4]"+w)+"|"+r("1"+w+w)+"|"+r("0?[1-9]"+w)+"|0?0?"+w),st=r(rt+"\\."+rt+"\\."+rt+"\\."+rt),xe=r(F+"{1,4}"),at=r(r(xe+"\\:"+xe)+"|"+st),ot=r(r(xe+"\\:")+"{6}"+at),wt=r("\\:\\:"+r(xe+"\\:")+"{5}"+at),cr=r(r(xe)+"?\\:\\:"+r(xe+"\\:")+"{4}"+at),It=r(r(r(xe+"\\:")+"{0,1}"+xe)+"?\\:\\:"+r(xe+"\\:")+"{3}"+at),xa=r(r(r(xe+"\\:")+"{0,2}"+xe)+"?\\:\\:"+r(xe+"\\:")+"{2}"+at),Fa=r(r(r(xe+"\\:")+"{0,3}"+xe)+"?\\:\\:"+xe+"\\:"+at),Ua=r(r(r(xe+"\\:")+"{0,4}"+xe)+"?\\:\\:"+at),Hr=r(r(r(xe+"\\:")+"{0,5}"+xe)+"?\\:\\:"+xe),Br=r(r(r(xe+"\\:")+"{0,6}"+xe)+"?\\:\\:"),$t=r([ot,wt,cr,It,xa,Fa,Ua,Hr,Br].join("|")),Wr=r(r(me+"|"+ve)+"+"),Wn=r($t+"\\%25"+Wr),lr=r($t+r("\\%25|\\%(?!"+F+"{2})")+Wr),Rd=r("[vV]"+F+"+\\."+e(me,fe,"[\\:]")+"+"),Td=r("\\["+r(lr+"|"+$t+"|"+Rd)+"\\]"),ho=r(r(ve+"|"+e(me,fe))+"*"),wa=r(Td+"|"+st+"(?!"+ho+")|"+ho),ka=r(w+"*"),mo=r(r(be+"@")+"?"+wa+r("\\:"+ka)+"?"),Sa=r(ve+"|"+e(me,fe,"[\\:\\@]")),Od=r(Sa+"*"),go=r(Sa+"+"),Cd=r(r(ve+"|"+e(me,fe,"[\\@]"))+"+"),Dt=r(r("\\/"+Od)+"*"),Kr=r("\\/"+r(go+Dt)+"?"),Kn=r(Cd+Dt),qa=r(go+Dt),Qr="(?!"+Sa+")",nv=r(Dt+"|"+Kr+"|"+Kn+"|"+qa+"|"+Qr),Gr=r(r(Sa+"|"+e("[\\/\\?]",Se))+"*"),Pa=r(r(Sa+"|[\\/\\?]")+"*"),vo=r(r("\\/\\/"+mo+Dt)+"|"+Kr+"|"+qa+"|"+Qr),Ad=r(Re+"\\:"+vo+r("\\?"+Gr)+"?"+r("\\#"+Pa)+"?"),jd=r(r("\\/\\/"+mo+Dt)+"|"+Kr+"|"+Kn+"|"+Qr),Id=r(jd+r("\\?"+Gr)+"?"+r("\\#"+Pa)+"?"),sv=r(Ad+"|"+Id),ov=r(Re+"\\:"+vo+r("\\?"+Gr)+"?"),iv="^("+Re+")\\:"+r(r("\\/\\/("+r("("+be+")@")+"?("+wa+")"+r("\\:("+ka+")")+"?)")+"?("+Dt+"|"+Kr+"|"+qa+"|"+Qr+")")+r("\\?("+Gr+")")+"?"+r("\\#("+Pa+")")+"?$",cv="^(){0}"+r(r("\\/\\/("+r("("+be+")@")+"?("+wa+")"+r("\\:("+ka+")")+"?)")+"?("+Dt+"|"+Kr+"|"+Kn+"|"+Qr+")")+r("\\?("+Gr+")")+"?"+r("\\#("+Pa+")")+"?$",lv="^("+Re+")\\:"+r(r("\\/\\/("+r("("+be+")@")+"?("+wa+")"+r("\\:("+ka+")")+"?)")+"?("+Dt+"|"+Kr+"|"+qa+"|"+Qr+")")+r("\\?("+Gr+")")+"?$",dv="^"+r("\\#("+Pa+")")+"?$",uv="^"+r("("+be+")@")+"?("+wa+")"+r("\\:("+ka+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",p,w,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",me,fe),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",me,fe),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",me,fe),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",me,fe),"g"),NOT_QUERY:new RegExp(e("[^\\%]",me,fe,"[\\:\\@\\/\\?]",Se),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",me,fe,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",me,fe),"g"),UNRESERVED:new RegExp(me,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",me,Ee),"g"),PCT_ENCODED:new RegExp(ve,"g"),IPV4ADDRESS:new RegExp("^("+st+")$"),IPV6ADDRESS:new RegExp("^\\[?("+$t+")"+r(r("\\%25|\\%(?!"+F+"{2})")+"("+Wr+")")+"?\\]?$")}}var d=i(!1),c=i(!0),u=(function(){function m(p,_){var w=[],k=!0,F=!1,ne=void 0;try{for(var pe=p[Symbol.iterator](),ve;!(k=(ve=pe.next()).done)&&(w.push(ve.value),!(_&&w.length===_));k=!0);}catch($e){F=!0,ne=$e}finally{try{!k&&pe.return&&pe.return()}finally{if(F)throw ne}}return w}return function(p,_){if(Array.isArray(p))return p;if(Symbol.iterator in Object(p))return m(p,_);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),h=function(m){if(Array.isArray(m)){for(var p=0,_=Array(m.length);p<m.length;p++)_[p]=m[p];return _}else return Array.from(m)},v=2147483647,f=36,y=1,b=26,g=38,S=700,E=72,P=128,O="-",j=/^xn--/,I=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,J={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=f-y,Z=Math.floor,V=String.fromCharCode;function U(m){throw new RangeError(J[m])}function A(m,p){for(var _=[],w=m.length;w--;)_[w]=p(m[w]);return _}function D(m,p){var _=m.split("@"),w="";_.length>1&&(w=_[0]+"@",m=_[1]),m=m.replace(W,".");var k=m.split("."),F=A(k,p).join(".");return w+F}function q(m){for(var p=[],_=0,w=m.length;_<w;){var k=m.charCodeAt(_++);if(k>=55296&&k<=56319&&_<w){var F=m.charCodeAt(_++);(F&64512)==56320?p.push(((k&1023)<<10)+(F&1023)+65536):(p.push(k),_--)}else p.push(k)}return p}var _e=function(p){return String.fromCodePoint.apply(String,h(p))},ie=function(p){return p-48<10?p-22:p-65<26?p-65:p-97<26?p-97:f},ue=function(p,_){return p+22+75*(p<26)-((_!=0)<<5)},oe=function(p,_,w){var k=0;for(p=w?Z(p/S):p>>1,p+=Z(p/_);p>$*b>>1;k+=f)p=Z(p/$);return Z(k+($+1)*p/(p+g))},K=function(p){var _=[],w=p.length,k=0,F=P,ne=E,pe=p.lastIndexOf(O);pe<0&&(pe=0);for(var ve=0;ve<pe;++ve)p.charCodeAt(ve)>=128&&U("not-basic"),_.push(p.charCodeAt(ve));for(var $e=pe>0?pe+1:0;$e<w;){for(var fe=k,Ee=1,De=f;;De+=f){$e>=w&&U("invalid-input");var Se=ie(p.charCodeAt($e++));(Se>=f||Se>Z((v-k)/Ee))&&U("overflow"),k+=Se*Ee;var me=De<=ne?y:De>=ne+b?b:De-ne;if(Se<me)break;var Re=f-me;Ee>Z(v/Re)&&U("overflow"),Ee*=Re}var be=_.length+1;ne=oe(k-fe,be,fe==0),Z(k/be)>v-F&&U("overflow"),F+=Z(k/be),k%=be,_.splice(k++,0,F)}return String.fromCodePoint.apply(String,_)},Oe=function(p){var _=[];p=q(p);var w=p.length,k=P,F=0,ne=E,pe=!0,ve=!1,$e=void 0;try{for(var fe=p[Symbol.iterator](),Ee;!(pe=(Ee=fe.next()).done);pe=!0){var De=Ee.value;De<128&&_.push(V(De))}}catch(lr){ve=!0,$e=lr}finally{try{!pe&&fe.return&&fe.return()}finally{if(ve)throw $e}}var Se=_.length,me=Se;for(Se&&_.push(O);me<w;){var Re=v,be=!0,ir=!1,rt=void 0;try{for(var st=p[Symbol.iterator](),xe;!(be=(xe=st.next()).done);be=!0){var at=xe.value;at>=k&&at<Re&&(Re=at)}}catch(lr){ir=!0,rt=lr}finally{try{!be&&st.return&&st.return()}finally{if(ir)throw rt}}var ot=me+1;Re-k>Z((v-F)/ot)&&U("overflow"),F+=(Re-k)*ot,k=Re;var wt=!0,cr=!1,It=void 0;try{for(var xa=p[Symbol.iterator](),Fa;!(wt=(Fa=xa.next()).done);wt=!0){var Ua=Fa.value;if(Ua<k&&++F>v&&U("overflow"),Ua==k){for(var Hr=F,Br=f;;Br+=f){var $t=Br<=ne?y:Br>=ne+b?b:Br-ne;if(Hr<$t)break;var Wr=Hr-$t,Wn=f-$t;_.push(V(ue($t+Wr%Wn,0))),Hr=Z(Wr/Wn)}_.push(V(ue(Hr,0))),ne=oe(F,ot,me==Se),F=0,++me}}}catch(lr){cr=!0,It=lr}finally{try{!wt&&xa.return&&xa.return()}finally{if(cr)throw It}}++F,++k}return _.join("")},Fe=function(p){return D(p,function(_){return j.test(_)?K(_.slice(4).toLowerCase()):_})},Je=function(p){return D(p,function(_){return I.test(_)?"xn--"+Oe(_):_})},he={version:"2.1.0",ucs2:{decode:q,encode:_e},decode:K,encode:Oe,toASCII:Je,toUnicode:Fe},je={};function Le(m){var p=m.charCodeAt(0),_=void 0;return p<16?_="%0"+p.toString(16).toUpperCase():p<128?_="%"+p.toString(16).toUpperCase():p<2048?_="%"+(p>>6|192).toString(16).toUpperCase()+"%"+(p&63|128).toString(16).toUpperCase():_="%"+(p>>12|224).toString(16).toUpperCase()+"%"+(p>>6&63|128).toString(16).toUpperCase()+"%"+(p&63|128).toString(16).toUpperCase(),_}function Ze(m){for(var p="",_=0,w=m.length;_<w;){var k=parseInt(m.substr(_+1,2),16);if(k<128)p+=String.fromCharCode(k),_+=3;else if(k>=194&&k<224){if(w-_>=6){var F=parseInt(m.substr(_+4,2),16);p+=String.fromCharCode((k&31)<<6|F&63)}else p+=m.substr(_,6);_+=6}else if(k>=224){if(w-_>=9){var ne=parseInt(m.substr(_+4,2),16),pe=parseInt(m.substr(_+7,2),16);p+=String.fromCharCode((k&15)<<12|(ne&63)<<6|pe&63)}else p+=m.substr(_,9);_+=9}else p+=m.substr(_,3),_+=3}return p}function Jt(m,p){function _(w){var k=Ze(w);return k.match(p.UNRESERVED)?k:w}return m.scheme&&(m.scheme=String(m.scheme).replace(p.PCT_ENCODED,_).toLowerCase().replace(p.NOT_SCHEME,"")),m.userinfo!==void 0&&(m.userinfo=String(m.userinfo).replace(p.PCT_ENCODED,_).replace(p.NOT_USERINFO,Le).replace(p.PCT_ENCODED,t)),m.host!==void 0&&(m.host=String(m.host).replace(p.PCT_ENCODED,_).toLowerCase().replace(p.NOT_HOST,Le).replace(p.PCT_ENCODED,t)),m.path!==void 0&&(m.path=String(m.path).replace(p.PCT_ENCODED,_).replace(m.scheme?p.NOT_PATH:p.NOT_PATH_NOSCHEME,Le).replace(p.PCT_ENCODED,t)),m.query!==void 0&&(m.query=String(m.query).replace(p.PCT_ENCODED,_).replace(p.NOT_QUERY,Le).replace(p.PCT_ENCODED,t)),m.fragment!==void 0&&(m.fragment=String(m.fragment).replace(p.PCT_ENCODED,_).replace(p.NOT_FRAGMENT,Le).replace(p.PCT_ENCODED,t)),m}function At(m){return m.replace(/^0*(.*)/,"$1")||"0"}function Ie(m,p){var _=m.match(p.IPV4ADDRESS)||[],w=u(_,2),k=w[1];return k?k.split(".").map(At).join("."):m}function Ce(m,p){var _=m.match(p.IPV6ADDRESS)||[],w=u(_,3),k=w[1],F=w[2];if(k){for(var ne=k.toLowerCase().split("::").reverse(),pe=u(ne,2),ve=pe[0],$e=pe[1],fe=$e?$e.split(":").map(At):[],Ee=ve.split(":").map(At),De=p.IPV4ADDRESS.test(Ee[Ee.length-1]),Se=De?7:8,me=Ee.length-Se,Re=Array(Se),be=0;be<Se;++be)Re[be]=fe[be]||Ee[me+be]||"";De&&(Re[Se-1]=Ie(Re[Se-1],p));var ir=Re.reduce(function(ot,wt,cr){if(!wt||wt==="0"){var It=ot[ot.length-1];It&&It.index+It.length===cr?It.length++:ot.push({index:cr,length:1})}return ot},[]),rt=ir.sort(function(ot,wt){return wt.length-ot.length})[0],st=void 0;if(rt&&rt.length>1){var xe=Re.slice(0,rt.index),at=Re.slice(rt.index+rt.length);st=xe.join(":")+"::"+at.join(":")}else st=Re.join(":");return F&&(st+="%"+F),st}else return m}var nr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Ue="".match(/(){0}/)[1]===void 0;function ge(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={},w=p.iri!==!1?c:d;p.reference==="suffix"&&(m=(p.scheme?p.scheme+":":"")+"//"+m);var k=m.match(nr);if(k){Ue?(_.scheme=k[1],_.userinfo=k[3],_.host=k[4],_.port=parseInt(k[5],10),_.path=k[6]||"",_.query=k[7],_.fragment=k[8],isNaN(_.port)&&(_.port=k[5])):(_.scheme=k[1]||void 0,_.userinfo=m.indexOf("@")!==-1?k[3]:void 0,_.host=m.indexOf("//")!==-1?k[4]:void 0,_.port=parseInt(k[5],10),_.path=k[6]||"",_.query=m.indexOf("?")!==-1?k[7]:void 0,_.fragment=m.indexOf("#")!==-1?k[8]:void 0,isNaN(_.port)&&(_.port=m.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?k[4]:void 0)),_.host&&(_.host=Ce(Ie(_.host,w),w)),_.scheme===void 0&&_.userinfo===void 0&&_.host===void 0&&_.port===void 0&&!_.path&&_.query===void 0?_.reference="same-document":_.scheme===void 0?_.reference="relative":_.fragment===void 0?_.reference="absolute":_.reference="uri",p.reference&&p.reference!=="suffix"&&p.reference!==_.reference&&(_.error=_.error||"URI is not a "+p.reference+" reference.");var F=je[(p.scheme||_.scheme||"").toLowerCase()];if(!p.unicodeSupport&&(!F||!F.unicodeSupport)){if(_.host&&(p.domainHost||F&&F.domainHost))try{_.host=he.toASCII(_.host.replace(w.PCT_ENCODED,Ze).toLowerCase())}catch(ne){_.error=_.error||"Host's domain name can not be converted to ASCII via punycode: "+ne}Jt(_,d)}else Jt(_,w);F&&F.parse&&F.parse(_,p)}else _.error=_.error||"URI can not be parsed.";return _}function Zt(m,p){var _=p.iri!==!1?c:d,w=[];return m.userinfo!==void 0&&(w.push(m.userinfo),w.push("@")),m.host!==void 0&&w.push(Ce(Ie(String(m.host),_),_).replace(_.IPV6ADDRESS,function(k,F,ne){return"["+F+(ne?"%25"+ne:"")+"]"})),(typeof m.port=="number"||typeof m.port=="string")&&(w.push(":"),w.push(String(m.port))),w.length?w.join(""):void 0}var jt=/^\.\.?\//,sr=/^\/\.(\/|$)/,or=/^\/\.\.(\/|$)/,Ne=/^\/?(?:.|\n)*?(?=\/|$)/;function nt(m){for(var p=[];m.length;)if(m.match(jt))m=m.replace(jt,"");else if(m.match(sr))m=m.replace(sr,"/");else if(m.match(or))m=m.replace(or,"/"),p.pop();else if(m==="."||m==="..")m="";else{var _=m.match(Ne);if(_){var w=_[0];m=m.slice(w.length),p.push(w)}else throw new Error("Unexpected dot segment condition")}return p.join("")}function We(m){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=p.iri?c:d,w=[],k=je[(p.scheme||m.scheme||"").toLowerCase()];if(k&&k.serialize&&k.serialize(m,p),m.host&&!_.IPV6ADDRESS.test(m.host)){if(p.domainHost||k&&k.domainHost)try{m.host=p.iri?he.toUnicode(m.host):he.toASCII(m.host.replace(_.PCT_ENCODED,Ze).toLowerCase())}catch(pe){m.error=m.error||"Host's domain name can not be converted to "+(p.iri?"Unicode":"ASCII")+" via punycode: "+pe}}Jt(m,_),p.reference!=="suffix"&&m.scheme&&(w.push(m.scheme),w.push(":"));var F=Zt(m,p);if(F!==void 0&&(p.reference!=="suffix"&&w.push("//"),w.push(F),m.path&&m.path.charAt(0)!=="/"&&w.push("/")),m.path!==void 0){var ne=m.path;!p.absolutePath&&(!k||!k.absolutePath)&&(ne=nt(ne)),F===void 0&&(ne=ne.replace(/^\/\//,"/%2F")),w.push(ne)}return m.query!==void 0&&(w.push("?"),w.push(m.query)),m.fragment!==void 0&&(w.push("#"),w.push(m.fragment)),w.join("")}function He(m,p){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=arguments[3],k={};return w||(m=ge(We(m,_),_),p=ge(We(p,_),_)),_=_||{},!_.tolerant&&p.scheme?(k.scheme=p.scheme,k.userinfo=p.userinfo,k.host=p.host,k.port=p.port,k.path=nt(p.path||""),k.query=p.query):(p.userinfo!==void 0||p.host!==void 0||p.port!==void 0?(k.userinfo=p.userinfo,k.host=p.host,k.port=p.port,k.path=nt(p.path||""),k.query=p.query):(p.path?(p.path.charAt(0)==="/"?k.path=nt(p.path):((m.userinfo!==void 0||m.host!==void 0||m.port!==void 0)&&!m.path?k.path="/"+p.path:m.path?k.path=m.path.slice(0,m.path.lastIndexOf("/")+1)+p.path:k.path=p.path,k.path=nt(k.path)),k.query=p.query):(k.path=m.path,p.query!==void 0?k.query=p.query:k.query=m.query),k.userinfo=m.userinfo,k.host=m.host,k.port=m.port),k.scheme=m.scheme),k.fragment=p.fragment,k}function bt(m,p,_){var w=o({scheme:"null"},_);return We(He(ge(m,w),ge(p,w),w,!0),w)}function tt(m,p){return typeof m=="string"?m=We(ge(m,p),p):n(m)==="object"&&(m=ge(We(m,p),p)),m}function za(m,p,_){return typeof m=="string"?m=We(ge(m,_),_):n(m)==="object"&&(m=We(m,_)),typeof p=="string"?p=We(ge(p,_),_):n(p)==="object"&&(p=We(p,_)),m===p}function Hn(m,p){return m&&m.toString().replace(!p||!p.iri?d.ESCAPE:c.ESCAPE,Le)}function mt(m,p){return m&&m.toString().replace(!p||!p.iri?d.PCT_ENCODED:c.PCT_ENCODED,Ze)}var _a={scheme:"http",domainHost:!0,parse:function(p,_){return p.host||(p.error=p.error||"HTTP URIs must have a host."),p},serialize:function(p,_){var w=String(p.scheme).toLowerCase()==="https";return(p.port===(w?443:80)||p.port==="")&&(p.port=void 0),p.path||(p.path="/"),p}},so={scheme:"https",domainHost:_a.domainHost,parse:_a.parse,serialize:_a.serialize};function oo(m){return typeof m.secure=="boolean"?m.secure:String(m.scheme).toLowerCase()==="wss"}var ba={scheme:"ws",domainHost:!0,parse:function(p,_){var w=p;return w.secure=oo(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w},serialize:function(p,_){if((p.port===(oo(p)?443:80)||p.port==="")&&(p.port=void 0),typeof p.secure=="boolean"&&(p.scheme=p.secure?"wss":"ws",p.secure=void 0),p.resourceName){var w=p.resourceName.split("?"),k=u(w,2),F=k[0],ne=k[1];p.path=F&&F!=="/"?F:void 0,p.query=ne,p.resourceName=void 0}return p.fragment=void 0,p}},io={scheme:"wss",domainHost:ba.domainHost,parse:ba.parse,serialize:ba.serialize},md={},gd=!0,co="[A-Za-z0-9\\-\\.\\_\\~"+(gd?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",xt="[0-9A-Fa-f]",vd=r(r("%[EFef]"+xt+"%"+xt+xt+"%"+xt+xt)+"|"+r("%[89A-Fa-f]"+xt+"%"+xt+xt)+"|"+r("%"+xt+xt)),yd="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",_d="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",bd=e(_d,'[\\"\\\\]'),xd="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",wd=new RegExp(co,"g"),Zr=new RegExp(vd,"g"),kd=new RegExp(e("[^]",yd,"[\\.]",'[\\"]',bd),"g"),lo=new RegExp(e("[^]",co,xd),"g"),Sd=lo;function Bn(m){var p=Ze(m);return p.match(wd)?p:m}var uo={scheme:"mailto",parse:function(p,_){var w=p,k=w.to=w.path?w.path.split(","):[];if(w.path=void 0,w.query){for(var F=!1,ne={},pe=w.query.split("&"),ve=0,$e=pe.length;ve<$e;++ve){var fe=pe[ve].split("=");switch(fe[0]){case"to":for(var Ee=fe[1].split(","),De=0,Se=Ee.length;De<Se;++De)k.push(Ee[De]);break;case"subject":w.subject=mt(fe[1],_);break;case"body":w.body=mt(fe[1],_);break;default:F=!0,ne[mt(fe[0],_)]=mt(fe[1],_);break}}F&&(w.headers=ne)}w.query=void 0;for(var me=0,Re=k.length;me<Re;++me){var be=k[me].split("@");if(be[0]=mt(be[0]),_.unicodeSupport)be[1]=mt(be[1],_).toLowerCase();else try{be[1]=he.toASCII(mt(be[1],_).toLowerCase())}catch(ir){w.error=w.error||"Email address's domain name can not be converted to ASCII via punycode: "+ir}k[me]=be.join("@")}return w},serialize:function(p,_){var w=p,k=s(p.to);if(k){for(var F=0,ne=k.length;F<ne;++F){var pe=String(k[F]),ve=pe.lastIndexOf("@"),$e=pe.slice(0,ve).replace(Zr,Bn).replace(Zr,t).replace(kd,Le),fe=pe.slice(ve+1);try{fe=_.iri?he.toUnicode(fe):he.toASCII(mt(fe,_).toLowerCase())}catch(me){w.error=w.error||"Email address's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+me}k[F]=$e+"@"+fe}w.path=k.join(",")}var Ee=p.headers=p.headers||{};p.subject&&(Ee.subject=p.subject),p.body&&(Ee.body=p.body);var De=[];for(var Se in Ee)Ee[Se]!==md[Se]&&De.push(Se.replace(Zr,Bn).replace(Zr,t).replace(lo,Le)+"="+Ee[Se].replace(Zr,Bn).replace(Zr,t).replace(Sd,Le));return De.length&&(w.query=De.join("&")),w}},Pd=/^([^\:]+)\:(.*)/,fo={scheme:"urn",parse:function(p,_){var w=p.path&&p.path.match(Pd),k=p;if(w){var F=_.scheme||k.scheme||"urn",ne=w[1].toLowerCase(),pe=w[2],ve=F+":"+(_.nid||ne),$e=je[ve];k.nid=ne,k.nss=pe,k.path=void 0,$e&&(k=$e.parse(k,_))}else k.error=k.error||"URN can not be parsed.";return k},serialize:function(p,_){var w=_.scheme||p.scheme||"urn",k=p.nid,F=w+":"+(_.nid||k),ne=je[F];ne&&(p=ne.serialize(p,_));var pe=p,ve=p.nss;return pe.path=(k||_.nid)+":"+ve,pe}},Ed=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,po={scheme:"urn:uuid",parse:function(p,_){var w=p;return w.uuid=w.nss,w.nss=void 0,!_.tolerant&&(!w.uuid||!w.uuid.match(Ed))&&(w.error=w.error||"UUID is not valid."),w},serialize:function(p,_){var w=p;return w.nss=(p.uuid||"").toLowerCase(),w}};je[_a.scheme]=_a,je[so.scheme]=so,je[ba.scheme]=ba,je[io.scheme]=io,je[uo.scheme]=uo,je[fo.scheme]=fo,je[po.scheme]=po,a.SCHEMES=je,a.pctEncChar=Le,a.pctDecChars=Ze,a.parse=ge,a.removeDotSegments=nt,a.serialize=We,a.resolveComponents=He,a.resolve=bt,a.normalize=tt,a.equal=za,a.escapeComponent=Hn,a.unescapeComponent=mt,Object.defineProperty(a,"__esModule",{value:!0})}))});var fn=ee((Qv,Go)=>{"use strict";Go.exports=function a(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,t,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(t=n;t--!==0;)if(!a(e[t],r[t]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(t=n;t--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[t]))return!1;for(t=n;t--!==0;){var o=s[t];if(!a(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var Xo=ee((Gv,Yo)=>{"use strict";Yo.exports=function(e){for(var r=0,n=e.length,t=0,s;t<n;)r++,s=e.charCodeAt(t++),s>=55296&&s<=56319&&t<n&&(s=e.charCodeAt(t),(s&64512)==56320&&t++);return r}});var Er=ee((Yv,ri)=>{"use strict";ri.exports={copy:Uf,checkDataType:fs,checkDataTypes:qf,coerceToTypes:Vf,toHash:hs,getProperty:ms,escapeQuotes:gs,equal:fn(),ucs2length:Xo(),varOccurences:Hf,varReplace:Bf,schemaHasRules:Wf,schemaHasRulesExcept:Kf,schemaUnknownRules:Qf,toQuotedString:ps,getPathExpr:Gf,getPath:Yf,getData:tp,unescapeFragment:rp,unescapeJsonPointer:ys,escapeFragment:ap,escapeJsonPointer:vs};function Uf(a,e){e=e||{};for(var r in a)e[r]=a[r];return e}function fs(a,e,r,n){var t=n?" !== ":" === ",s=n?" || ":" && ",o=n?"!":"",i=n?"":"!";switch(a){case"null":return e+t+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+s+"typeof "+e+t+'"object"'+s+i+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+t+'"number"'+s+i+"("+e+" % 1)"+s+e+t+e+(r?s+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+t+'"'+a+'"'+(r?s+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+t+'"'+a+'"'}}function qf(a,e,r){switch(a.length){case 1:return fs(a[0],e,r,!0);default:var n="",t=hs(a);t.array&&t.object&&(n=t.null?"(":"(!"+e+" || ",n+="typeof "+e+' !== "object")',delete t.null,delete t.array,delete t.object),t.number&&delete t.integer;for(var s in t)n+=(n?" && ":"")+fs(s,e,r,!0);return n}}var ei=hs(["string","number","integer","boolean","null"]);function Vf(a,e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++){var t=e[n];(ei[t]||a==="array"&&t==="array")&&(r[r.length]=t)}if(r.length)return r}else{if(ei[e])return[e];if(a==="array"&&e==="array")return["array"]}}function hs(a){for(var e={},r=0;r<a.length;r++)e[a[r]]=!0;return e}var Jf=/^[a-z$_][a-z$_0-9]*$/i,Zf=/'|\\/g;function ms(a){return typeof a=="number"?"["+a+"]":Jf.test(a)?"."+a:"['"+gs(a)+"']"}function gs(a){return a.replace(Zf,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Hf(a,e){e+="[^0-9]";var r=a.match(new RegExp(e,"g"));return r?r.length:0}function Bf(a,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),r+"$1")}function Wf(a,e){if(typeof a=="boolean")return!a;for(var r in a)if(e[r])return!0}function Kf(a,e,r){if(typeof a=="boolean")return!a&&r!="not";for(var n in a)if(n!=r&&e[n])return!0}function Qf(a,e){if(typeof a!="boolean"){for(var r in a)if(!e[r])return r}}function ps(a){return"'"+gs(a)+"'"}function Gf(a,e,r,n){var t=r?"'/' + "+e+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return ti(a,t)}function Yf(a,e,r){var n=ps(r?"/"+vs(e):ms(e));return ti(a,n)}var Xf=/^\/(?:[^~]|~0|~1)*$/,ep=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function tp(a,e,r){var n,t,s,o;if(a==="")return"rootData";if(a[0]=="/"){if(!Xf.test(a))throw new Error("Invalid JSON-pointer: "+a);t=a,s="rootData"}else{if(o=a.match(ep),!o)throw new Error("Invalid JSON-pointer: "+a);if(n=+o[1],t=o[2],t=="#"){if(n>=e)throw new Error("Cannot access property/index "+n+" levels up, current level is "+e);return r[e-n]}if(n>e)throw new Error("Cannot access data "+n+" levels up, current level is "+e);if(s="data"+(e-n||""),!t)return s}for(var i=s,d=t.split("/"),c=0;c<d.length;c++){var u=d[c];u&&(s+=ms(ys(u)),i+=" && "+s)}return i}function ti(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function rp(a){return ys(decodeURIComponent(a))}function ap(a){return encodeURIComponent(vs(a))}function vs(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function ys(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var _s=ee((Xv,ai)=>{"use strict";var np=Er();ai.exports=sp;function sp(a){np.copy(a,this)}});var si=ee((ey,ni)=>{"use strict";var Qt=ni.exports=function(a,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},t=r.post||function(){};pn(e,n,t,a,"",a)};Qt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Qt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Qt.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Qt.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 pn(a,e,r,n,t,s,o,i,d,c){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,t,s,o,i,d,c);for(var u in n){var h=n[u];if(Array.isArray(h)){if(u in Qt.arrayKeywords)for(var v=0;v<h.length;v++)pn(a,e,r,h[v],t+"/"+u+"/"+v,s,t,u,n,v)}else if(u in Qt.propsKeywords){if(h&&typeof h=="object")for(var f in h)pn(a,e,r,h[f],t+"/"+u+"/"+op(f),s,t,u,n,f)}else(u in Qt.keywords||a.allKeys&&!(u in Qt.skipKeywords))&&pn(a,e,r,h,t+"/"+u,s,t,u,n)}r(n,t,s,o,i,d,c)}}function op(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var _n=ee((ty,li)=>{"use strict";var ja=Qo(),oi=fn(),vn=Er(),hn=_s(),ip=si();li.exports=Yt;Yt.normalizeId=Gt;Yt.fullPath=mn;Yt.url=gn;Yt.ids=fp;Yt.inlineRef=bs;Yt.schema=yn;function Yt(a,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return Yt.call(this,a,e,n);if(n=n||this._schemas[r],n instanceof hn)return bs(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var t=yn.call(this,e,r),s,o,i;return t&&(s=t.schema,e=t.root,i=t.baseId),s instanceof hn?o=s.validate||a.call(this,s.schema,e,void 0,i):s!==void 0&&(o=bs(s,this._opts.inlineRefs)?s:a.call(this,s,e,void 0,i)),o}function yn(a,e){var r=ja.parse(e),n=ci(r),t=mn(this._getId(a.schema));if(Object.keys(a.schema).length===0||n!==t){var s=Gt(n),o=this._refs[s];if(typeof o=="string")return cp.call(this,a,o,r);if(o instanceof hn)o.validate||this._compile(o),a=o;else if(o=this._schemas[s],o instanceof hn){if(o.validate||this._compile(o),s==Gt(e))return{schema:o,root:a,baseId:t};a=o}else return;if(!a.schema)return;t=mn(this._getId(a.schema))}return ii.call(this,r,t,a.schema,a)}function cp(a,e,r){var n=yn.call(this,a,e);if(n){var t=n.schema,s=n.baseId;a=n.root;var o=this._getId(t);return o&&(s=gn(s,o)),ii.call(this,r,s,t,a)}}var lp=vn.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function ii(a,e,r,n){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var t=a.fragment.split("/"),s=1;s<t.length;s++){var o=t[s];if(o){if(o=vn.unescapeFragment(o),r=r[o],r===void 0)break;var i;if(!lp[o]&&(i=this._getId(r),i&&(e=gn(e,i)),r.$ref)){var d=gn(e,r.$ref),c=yn.call(this,n,d);c&&(r=c.schema,n=c.root,e=c.baseId)}}}if(r!==void 0&&r!==n.schema)return{schema:r,root:n,baseId:e}}}var dp=vn.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function bs(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return xs(a);if(e)return ws(a)<=e}function xs(a){var e;if(Array.isArray(a)){for(var r=0;r<a.length;r++)if(e=a[r],typeof e=="object"&&!xs(e))return!1}else for(var n in a)if(n=="$ref"||(e=a[n],typeof e=="object"&&!xs(e)))return!1;return!0}function ws(a){var e=0,r;if(Array.isArray(a)){for(var n=0;n<a.length;n++)if(r=a[n],typeof r=="object"&&(e+=ws(r)),e==1/0)return 1/0}else for(var t in a){if(t=="$ref")return 1/0;if(dp[t])e++;else if(r=a[t],typeof r=="object"&&(e+=ws(r)+1),e==1/0)return 1/0}return e}function mn(a,e){e!==!1&&(a=Gt(a));var r=ja.parse(a);return ci(r)}function ci(a){return ja.serialize(a).split("#")[0]+"#"}var up=/#\/?$/;function Gt(a){return a?a.replace(up,""):""}function gn(a,e){return e=Gt(e),ja.resolve(a,e)}function fp(a){var e=Gt(this._getId(a)),r={"":e},n={"":mn(e,!1)},t={},s=this;return ip(a,{allKeys:!0},function(o,i,d,c,u,h,v){if(i!==""){var f=s._getId(o),y=r[c],b=n[c]+"/"+u;if(v!==void 0&&(b+="/"+(typeof v=="number"?v:vn.escapeFragment(v))),typeof f=="string"){f=y=Gt(y?ja.resolve(y,f):f);var g=s._refs[f];if(typeof g=="string"&&(g=s._refs[g]),g&&g.schema){if(!oi(o,g.schema))throw new Error('id "'+f+'" resolves to more than one schema')}else if(f!=Gt(b))if(f[0]=="#"){if(t[f]&&!oi(o,t[f]))throw new Error('id "'+f+'" resolves to more than one schema');t[f]=o}else s._refs[f]=b}r[i]=y,n[i]=b}}),t}});var bn=ee((ry,ui)=>{"use strict";var ks=_n();ui.exports={Validation:di(pp),MissingRef:di(Ss)};function pp(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}Ss.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function Ss(a,e,r){this.message=r||Ss.message(a,e),this.missingRef=ks.url(a,e),this.missingSchema=ks.normalizeId(ks.fullPath(this.missingRef))}function di(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Ps=ee((ay,fi)=>{"use strict";fi.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(s){return function(o){return function(i,d){var c={key:i,value:o[i]},u={key:d,value:o[d]};return s(c,u)}}})(e.cmp),t=[];return(function s(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var i,d;if(Array.isArray(o)){for(d="[",i=0;i<o.length;i++)i&&(d+=","),d+=s(o[i])||"null";return d+"]"}if(o===null)return"null";if(t.indexOf(o)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=t.push(o)-1,u=Object.keys(o).sort(n&&n(o));for(d="",i=0;i<u.length;i++){var h=u[i],v=s(o[h]);v&&(d&&(d+=","),d+=JSON.stringify(h)+":"+v)}return t.splice(c,1),"{"+d+"}"}})(a)}});var Es=ee((ny,pi)=>{"use strict";pi.exports=function(e,r,n){var t="",s=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var c="unknown keyword: "+d;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(t+=" var validate = ",s&&(e.async=!0,t+="async "),t+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(t+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var r="false schema",u=e.level,h=e.dataLevel,v=e.schema[r],f=e.schemaPath+e.util.getProperty(r),y=e.errSchemaPath+"/"+r,j=!e.opts.allErrors,J,b="data"+(h||""),O="valid"+u;if(e.schema===!1){e.isTop?j=!0:t+=" var "+O+" = false; ";var g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(J||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'boolean schema is false' "),e.opts.verbose&&(t+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&j?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?s?t+=" return data; ":t+=" validate.errors = null; return true; ":t+=" var "+O+" = true; ";return e.isTop&&(t+=" }; return validate; "),t}if(e.isTop){var E=e.isTop,u=e.level=0,h=e.dataLevel=0,b="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}t+=" var vErrors = null; ",t+=" var errors = 0; ",t+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,h=e.dataLevel,b="data"+(h||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),s&&!e.async)throw new Error("async schema in sync schema");t+=" var errs_"+u+" = errors;"}var O="valid"+u,j=!e.opts.allErrors,I="",W="",J,$=e.schema.type,Z=Array.isArray($);if($&&e.opts.nullable&&e.schema.nullable===!0&&(Z?$.indexOf("null")==-1&&($=$.concat("null")):$!="null"&&($=[$,"null"],Z=!0)),Z&&$.length==1&&($=$[0],Z=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(t+=" "+e.RULES.all.$comment.code(e,"$comment")),$){if(e.opts.coerceTypes)var V=e.util.coerceToTypes(e.opts.coerceTypes,$);var U=e.RULES.types[$];if(V||Z||U===!0||U&&!Ne(U)){var f=e.schemaPath+".type",y=e.errSchemaPath+"/type",f=e.schemaPath+".type",y=e.errSchemaPath+"/type",A=Z?"checkDataTypes":"checkDataType";if(t+=" if ("+e.util[A]($,b,e.opts.strictNumbers,!0)+") { ",V){var D="dataType"+u,q="coerced"+u;t+=" var "+D+" = typeof "+b+"; var "+q+" = undefined; ",e.opts.coerceTypes=="array"&&(t+=" if ("+D+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+D+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+q+" = "+b+"; } "),t+=" if ("+q+" !== undefined) ; ";var _e=V;if(_e)for(var ie,ue=-1,oe=_e.length-1;ue<oe;)ie=_e[ue+=1],ie=="string"?t+=" else if ("+D+" == 'number' || "+D+" == 'boolean') "+q+" = '' + "+b+"; else if ("+b+" === null) "+q+" = ''; ":ie=="number"||ie=="integer"?(t+=" else if ("+D+" == 'boolean' || "+b+" === null || ("+D+" == 'string' && "+b+" && "+b+" == +"+b+" ",ie=="integer"&&(t+=" && !("+b+" % 1)"),t+=")) "+q+" = +"+b+"; "):ie=="boolean"?t+=" else if ("+b+" === 'false' || "+b+" === 0 || "+b+" === null) "+q+" = false; else if ("+b+" === 'true' || "+b+" === 1) "+q+" = true; ":ie=="null"?t+=" else if ("+b+" === '' || "+b+" === 0 || "+b+" === false) "+q+" = null; ":e.opts.coerceTypes=="array"&&ie=="array"&&(t+=" else if ("+D+" == 'string' || "+D+" == 'number' || "+D+" == 'boolean' || "+b+" == null) "+q+" = ["+b+"]; ");t+=" else { ";var g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(J||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",Z?t+=""+$.join(","):t+=""+$,t+="' } ",e.opts.messages!==!1&&(t+=" , message: 'should be ",Z?t+=""+$.join(","):t+=""+$,t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&j?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } if ("+q+" !== undefined) { ";var K=h?"data"+(h-1||""):"parentData",Oe=h?e.dataPathArr[h]:"parentDataProperty";t+=" "+b+" = "+q+"; ",h||(t+="if ("+K+" !== undefined)"),t+=" "+K+"["+Oe+"] = "+q+"; } "}else{var g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(J||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",Z?t+=""+$.join(","):t+=""+$,t+="' } ",e.opts.messages!==!1&&(t+=" , message: 'should be ",Z?t+=""+$.join(","):t+=""+$,t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&j?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}t+=" } "}}if(e.schema.$ref&&!o)t+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",j&&(t+=" } if (errors === ",E?t+="0":t+="errs_"+u,t+=") { ",W+="}");else{var Fe=e.RULES;if(Fe){for(var U,Je=-1,he=Fe.length-1;Je<he;)if(U=Fe[Je+=1],Ne(U)){if(U.type&&(t+=" if ("+e.util.checkDataType(U.type,b,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(U.type=="object"&&e.schema.properties){var v=e.schema.properties,je=Object.keys(v),Le=je;if(Le)for(var Ze,Jt=-1,At=Le.length-1;Jt<At;){Ze=Le[Jt+=1];var Ie=v[Ze];if(Ie.default!==void 0){var Ce=b+e.util.getProperty(Ze);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else t+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(t+=" || "+Ce+" === null || "+Ce+" === '' "),t+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?t+=" "+e.useDefault(Ie.default)+" ":t+=" "+JSON.stringify(Ie.default)+" ",t+="; "}}}else if(U.type=="array"&&Array.isArray(e.schema.items)){var nr=e.schema.items;if(nr){for(var Ie,ue=-1,Ue=nr.length-1;ue<Ue;)if(Ie=nr[ue+=1],Ie.default!==void 0){var Ce=b+"["+ue+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else t+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(t+=" || "+Ce+" === null || "+Ce+" === '' "),t+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?t+=" "+e.useDefault(Ie.default)+" ":t+=" "+JSON.stringify(Ie.default)+" ",t+="; "}}}}var ge=U.rules;if(ge){for(var Zt,jt=-1,sr=ge.length-1;jt<sr;)if(Zt=ge[jt+=1],nt(Zt)){var or=Zt.code(e,Zt.keyword,U.type);or&&(t+=" "+or+" ",j&&(I+="}"))}}if(j&&(t+=" "+I+" ",I=""),U.type&&(t+=" } ",$&&$===U.type&&!V)){t+=" else { ";var f=e.schemaPath+".type",y=e.errSchemaPath+"/type",g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(J||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",Z?t+=""+$.join(","):t+=""+$,t+="' } ",e.opts.messages!==!1&&(t+=" , message: 'should be ",Z?t+=""+$.join(","):t+=""+$,t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+f+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&j?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } "}j&&(t+=" if (errors === ",E?t+="0":t+="errs_"+u,t+=") { ",W+="}")}}}j&&(t+=" "+W+" "),E?(s?(t+=" if (errors === 0) return data; ",t+=" else throw new ValidationError(vErrors); "):(t+=" validate.errors = vErrors; ",t+=" return errors === 0; "),t+=" }; return validate;"):t+=" var "+O+" = errors === errs_"+u+";";function Ne(He){for(var bt=He.rules,tt=0;tt<bt.length;tt++)if(nt(bt[tt]))return!0}function nt(He){return e.schema[He.keyword]!==void 0||He.implements&&We(He)}function We(He){for(var bt=He.implements,tt=0;tt<bt.length;tt++)if(e.schema[bt[tt]]!==void 0)return!0}return t}});var yi=ee((sy,vi)=>{"use strict";var xn=_n(),kn=Er(),mi=bn(),hp=Ps(),hi=Es(),mp=kn.ucs2length,gp=fn(),vp=mi.Validation;vi.exports=Rs;function Rs(a,e,r,n){var t=this,s=this._opts,o=[void 0],i={},d=[],c={},u=[],h={},v=[];e=e||{schema:a,refVal:o,refs:i};var f=yp.call(this,a,e,n),y=this._compilations[f.index];if(f.compiling)return y.callValidate=P;var b=this._formats,g=this.RULES;try{var S=O(a,e,r,n);y.validate=S;var E=y.callValidate;return E&&(E.schema=S.schema,E.errors=null,E.refs=S.refs,E.refVal=S.refVal,E.root=S.root,E.$async=S.$async,s.sourceCode&&(E.source=S.source)),S}finally{_p.call(this,a,e,n)}function P(){var A=y.validate,D=A.apply(this,arguments);return P.errors=A.errors,D}function O(A,D,q,_e){var ie=!D||D&&D.schema==A;if(D.schema!=e.schema)return Rs.call(t,A,D,q,_e);var ue=A.$async===!0,oe=hi({isTop:!0,schema:A,isRoot:ie,baseId:_e,root:D,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:mi.MissingRef,RULES:g,validate:hi,util:kn,resolve:xn,resolveRef:j,usePattern:Z,useDefault:V,useCustomRule:U,opts:s,formats:b,logger:t.logger,self:t});oe=wn(o,wp)+wn(d,bp)+wn(u,xp)+wn(v,kp)+oe,s.processCode&&(oe=s.processCode(oe,A));var K;try{var Oe=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",oe);K=Oe(t,g,b,e,o,u,v,gp,mp,vp),o[0]=K}catch(Fe){throw t.logger.error("Error compiling schema, function code:",oe),Fe}return K.schema=A,K.errors=null,K.refs=i,K.refVal=o,K.root=ie?K:D,ue&&(K.$async=!0),s.sourceCode===!0&&(K.source={code:oe,patterns:d,defaults:u}),K}function j(A,D,q){D=xn.url(A,D);var _e=i[D],ie,ue;if(_e!==void 0)return ie=o[_e],ue="refVal["+_e+"]",$(ie,ue);if(!q&&e.refs){var oe=e.refs[D];if(oe!==void 0)return ie=e.refVal[oe],ue=I(D,ie),$(ie,ue)}ue=I(D);var K=xn.call(t,O,e,D);if(K===void 0){var Oe=r&&r[D];Oe&&(K=xn.inlineRef(Oe,s.inlineRefs)?Oe:Rs.call(t,Oe,e,r,A))}if(K===void 0)W(D);else return J(D,K),$(K,ue)}function I(A,D){var q=o.length;return o[q]=D,i[A]=q,"refVal"+q}function W(A){delete i[A]}function J(A,D){var q=i[A];o[q]=D}function $(A,D){return typeof A=="object"||typeof A=="boolean"?{code:D,schema:A,inline:!0}:{code:D,$async:A&&!!A.$async}}function Z(A){var D=c[A];return D===void 0&&(D=c[A]=d.length,d[D]=A),"pattern"+D}function V(A){switch(typeof A){case"boolean":case"number":return""+A;case"string":return kn.toQuotedString(A);case"object":if(A===null)return"null";var D=hp(A),q=h[D];return q===void 0&&(q=h[D]=u.length,u[q]=A),"default"+q}}function U(A,D,q,_e){if(t._opts.validateSchema!==!1){var ie=A.definition.dependencies;if(ie&&!ie.every(function(Le){return Object.prototype.hasOwnProperty.call(q,Le)}))throw new Error("parent schema must have all required keywords: "+ie.join(","));var ue=A.definition.validateSchema;if(ue){var oe=ue(D);if(!oe){var K="keyword schema is invalid: "+t.errorsText(ue.errors);if(t._opts.validateSchema=="log")t.logger.error(K);else throw new Error(K)}}}var Oe=A.definition.compile,Fe=A.definition.inline,Je=A.definition.macro,he;if(Oe)he=Oe.call(t,D,q,_e);else if(Je)he=Je.call(t,D,q,_e),s.validateSchema!==!1&&t.validateSchema(he,!0);else if(Fe)he=Fe.call(t,_e,A.keyword,D,q);else if(he=A.definition.validate,!he)return;if(he===void 0)throw new Error('custom keyword "'+A.keyword+'"failed to compile');var je=v.length;return v[je]=he,{code:"customRule"+je,validate:he}}}function yp(a,e,r){var n=gi.call(this,a,e,r);return n>=0?{index:n,compiling:!0}:(n=this._compilations.length,this._compilations[n]={schema:a,root:e,baseId:r},{index:n,compiling:!1})}function _p(a,e,r){var n=gi.call(this,a,e,r);n>=0&&this._compilations.splice(n,1)}function gi(a,e,r){for(var n=0;n<this._compilations.length;n++){var t=this._compilations[n];if(t.schema==a&&t.root==e&&t.baseId==r)return n}return-1}function bp(a,e){return"var pattern"+a+" = new RegExp("+kn.toQuotedString(e[a])+");"}function xp(a){return"var default"+a+" = defaults["+a+"];"}function wp(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function kp(a){return"var customRule"+a+" = customRules["+a+"];"}function wn(a,e){if(!a.length)return"";for(var r="",n=0;n<a.length;n++)r+=e(n,a);return r}});var bi=ee((oy,_i)=>{"use strict";var Sn=_i.exports=function(){this._cache={}};Sn.prototype.put=function(e,r){this._cache[e]=r};Sn.prototype.get=function(e){return this._cache[e]};Sn.prototype.del=function(e){delete this._cache[e]};Sn.prototype.clear=function(){this._cache={}}});var ji=ee((iy,Ai)=>{"use strict";var Sp=Er(),Pp=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Ep=[0,31,28,31,30,31,30,31,31,30,31,30,31],Rp=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,xi=/^(?=.{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,Tp=/^(?:[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,Op=/^(?:[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,wi=/^(?:(?:[^\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,ki=/^(?:(?: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,Si=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Pi=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ei=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Ri=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Ai.exports=Pn;function Pn(a){return a=a=="full"?"full":"fast",Sp.copy(Pn[a])}Pn.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":wi,url:ki,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:xi,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:Ci,uuid:Si,"json-pointer":Pi,"json-pointer-uri-fragment":Ei,"relative-json-pointer":Ri};Pn.full={date:Ti,time:Oi,"date-time":jp,uri:$p,"uri-reference":Op,"uri-template":wi,url:ki,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:xi,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:Ci,uuid:Si,"json-pointer":Pi,"json-pointer-uri-fragment":Ei,"relative-json-pointer":Ri};function Cp(a){return a%4===0&&(a%100!==0||a%400===0)}function Ti(a){var e=a.match(Pp);if(!e)return!1;var r=+e[1],n=+e[2],t=+e[3];return n>=1&&n<=12&&t>=1&&t<=(n==2&&Cp(r)?29:Ep[n])}function Oi(a,e){var r=a.match(Rp);if(!r)return!1;var n=r[1],t=r[2],s=r[3],o=r[5];return(n<=23&&t<=59&&s<=59||n==23&&t==59&&s==60)&&(!e||o)}var Ap=/t|\s/i;function jp(a){var e=a.split(Ap);return e.length==2&&Ti(e[0])&&Oi(e[1],!0)}var Ip=/\/|:/;function $p(a){return Ip.test(a)&&Tp.test(a)}var Dp=/[^\\]\\Z/;function Ci(a){if(Dp.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var $i=ee((cy,Ii)=>{"use strict";Ii.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(o||""),h="valid"+s,v,f;if(i=="#"||i=="#/")e.isRoot?(v=e.async,f="validate"):(v=e.root.schema.$async===!0,f="root.refVal[0]");else{var y=e.resolveRef(e.baseId,i,e.isRoot);if(y===void 0){var b=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(b);var g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(t+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(t+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&c?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(t+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(b),c&&(t+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,b)}else if(y.inline){var E=e.util.copy(e);E.level++;var P="valid"+E.level;E.schema=y.schema,E.schemaPath="",E.errSchemaPath=i;var O=e.validate(E).replace(/validate\.schema/g,y.code);t+=" "+O+" ",c&&(t+=" if ("+P+") { ")}else v=y.$async===!0||e.async&&y.$async!==!1,f=y.code}if(f){var g=g||[];g.push(t),t="",e.opts.passContext?t+=" "+f+".call(this, ":t+=" "+f+"( ",t+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(t+=" + "+e.errorPath);var j=o?"data"+(o-1||""):"parentData",I=o?e.dataPathArr[o]:"parentDataProperty";t+=" , "+j+" , "+I+", rootData) ";var W=t;if(t=g.pop(),v){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(t+=" var "+h+"; "),t+=" try { await "+W+"; ",c&&(t+=" "+h+" = true; "),t+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(t+=" "+h+" = false; "),t+=" } ",c&&(t+=" if ("+h+") { ")}else t+=" if (!"+W+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",c&&(t+=" else { ")}return t}});var Li=ee((ly,Di)=>{"use strict";Di.exports=function(e,r,n){var t=" ",s=e.schema[r],o=e.schemaPath+e.util.getProperty(r),i=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var h="valid"+c.level,v=c.baseId,f=!0,y=s;if(y)for(var b,g=-1,S=y.length-1;g<S;)b=y[g+=1],(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(f=!1,c.schema=b,c.schemaPath=o+"["+g+"]",c.errSchemaPath=i+"/"+g,t+=" "+e.validate(c)+" ",c.baseId=v,d&&(t+=" if ("+h+") { ",u+="}"));return d&&(f?t+=" if (true) { ":t+=" "+u.slice(0,-1)+" "),t}});var Mi=ee((dy,Ni)=>{"use strict";Ni.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,f="errs__"+s,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S=i.every(function(J){return e.opts.strictKeywords?typeof J=="object"&&Object.keys(J).length>0||J===!1:e.util.schemaHasRules(J,e.RULES.all)});if(S){var E=y.baseId;t+=" var "+f+" = errors; var "+v+" = false; ";var P=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=i;if(O)for(var j,I=-1,W=O.length-1;I<W;)j=O[I+=1],y.schema=j,y.schemaPath=d+"["+I+"]",y.errSchemaPath=c+"/"+I,t+=" "+e.validate(y)+" ",y.baseId=E,t+=" "+v+" = "+v+" || "+g+"; if (!"+v+") { ",b+="}";e.compositeRule=y.compositeRule=P,t+=" "+b+" if (!"+v+") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),t+=" } else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.opts.allErrors&&(t+=" } ")}else u&&(t+=" if (true) { ");return t}});var Fi=ee((uy,zi)=>{"use strict";zi.exports=function(e,r,n){var t=" ",s=e.schema[r],o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,d=e.util.toQuotedString(s);return e.opts.$comment===!0?t+=" console.log("+d+");":typeof e.opts.$comment=="function"&&(t+=" self._opts.$comment("+d+", "+e.util.toQuotedString(o)+", validate.root.schema);"),t}});var qi=ee((fy,Ui)=>{"use strict";Ui.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,f=e.opts.$data&&i&&i.$data,y;f?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+s):y=i,f||(t+=" var schema"+s+" = validate.schema"+d+";"),t+="var "+v+" = equal("+h+", schema"+s+"); if (!"+v+") { ";var b=b||[];b.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+s+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be equal to constant' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var g=t;return t=b.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+g+"]); ":t+=" validate.errors = ["+g+"]; return false; ":t+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" }",u&&(t+=" else { "),t}});var Ji=ee((py,Vi)=>{"use strict";Vi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,f="errs__"+s,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S="i"+s,E=y.dataLevel=e.dataLevel+1,P="data"+E,O=e.baseId,j=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(t+="var "+f+" = errors;var "+v+";",j){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=i,y.schemaPath=d,y.errSchemaPath=c,t+=" var "+g+" = false; for (var "+S+" = 0; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var W=h+"["+S+"]";y.dataPathArr[E]=S;var J=e.validate(y);y.baseId=O,e.util.varOccurences(J,P)<2?t+=" "+e.util.varReplace(J,P,W)+" ":t+=" var "+P+" = "+W+"; "+J+" ",t+=" if ("+g+") break; } ",e.compositeRule=y.compositeRule=I,t+=" "+b+" if (!"+g+") {"}else t+=" if ("+h+".length == 0) {";var $=$||[];$.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should contain a valid item' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var Z=t;return t=$.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+Z+"]); ":t+=" validate.errors = ["+Z+"]; return false; ":t+=" var err = "+Z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { ",j&&(t+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),e.opts.allErrors&&(t+=" } "),t}});var Hi=ee((hy,Zi)=>{"use strict";Zi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="errs__"+s,f=e.util.copy(e),y="";f.level++;var b="valid"+f.level,g={},S={},E=e.opts.ownProperties;for(I in i)if(I!="__proto__"){var P=i[I],O=Array.isArray(P)?S:g;O[I]=P}t+="var "+v+" = errors;";var j=e.errorPath;t+="var missing"+s+";";for(var I in S)if(O=S[I],O.length){if(t+=" if ( "+h+e.util.getProperty(I)+" !== undefined ",E&&(t+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(I)+"') "),u){t+=" && ( ";var W=O;if(W)for(var J,$=-1,Z=W.length-1;$<Z;){J=W[$+=1],$&&(t+=" || ");var V=e.util.getProperty(J),U=h+V;t+=" ( ( "+U+" === undefined ",E&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(J)+"') "),t+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?J:V)+") ) "}t+=")) { ";var A="missing"+s,D="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(j,A,!0):j+" + "+A);var q=q||[];q.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+D+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(t+=" , message: 'should have ",O.length==1?t+="property "+e.util.escapeQuotes(O[0]):t+="properties "+e.util.escapeQuotes(O.join(", ")),t+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var _e=t;t=q.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+_e+"]); ":t+=" validate.errors = ["+_e+"]; return false; ":t+=" var err = "+_e+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{t+=" ) { ";var ie=O;if(ie)for(var J,ue=-1,oe=ie.length-1;ue<oe;){J=ie[ue+=1];var V=e.util.getProperty(J),D=e.util.escapeQuotes(J),U=h+V;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(j,J,e.opts.jsonPointers)),t+=" if ( "+U+" === undefined ",E&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(J)+"') "),t+=") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+D+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(t+=" , message: 'should have ",O.length==1?t+="property "+e.util.escapeQuotes(O[0]):t+="properties "+e.util.escapeQuotes(O.join(", ")),t+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}t+=" } ",u&&(y+="}",t+=" else { ")}e.errorPath=j;var K=f.baseId;for(var I in g){var P=g[I];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(t+=" "+b+" = true; if ( "+h+e.util.getProperty(I)+" !== undefined ",E&&(t+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(I)+"') "),t+=") { ",f.schema=P,f.schemaPath=d+e.util.getProperty(I),f.errSchemaPath=c+"/"+e.util.escapeFragment(I),t+=" "+e.validate(f)+" ",f.baseId=K,t+=" } ",u&&(t+=" if ("+b+") { ",y+="}"))}return u&&(t+=" "+y+" if ("+v+" == errors) {"),t}});var Wi=ee((my,Bi)=>{"use strict";Bi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,f=e.opts.$data&&i&&i.$data,y;f?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+s):y=i;var b="i"+s,g="schema"+s;f||(t+=" var "+g+" = validate.schema"+d+";"),t+="var "+v+";",f&&(t+=" if (schema"+s+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+s+")) "+v+" = false; else {"),t+=""+v+" = false;for (var "+b+"=0; "+b+"<"+g+".length; "+b+"++) if (equal("+h+", "+g+"["+b+"])) { "+v+" = true; break; }",f&&(t+=" } "),t+=" if (!"+v+") { ";var S=S||[];S.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+s+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var E=t;return t=S.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+E+"]); ":t+=" validate.errors = ["+E+"]; return false; ":t+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" }",u&&(t+=" else { "),t}});var Qi=ee((gy,Ki)=>{"use strict";Ki.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||"");if(e.opts.format===!1)return u&&(t+=" if (true) { "),t;var v=e.opts.$data&&i&&i.$data,f;v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+s):f=i;var y=e.opts.unknownFormats,b=Array.isArray(y);if(v){var g="format"+s,S="isObject"+s,E="formatType"+s;t+=" var "+g+" = formats["+f+"]; var "+S+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+E+" = "+S+" && "+g+".type || 'string'; if ("+S+") { ",e.async&&(t+=" var async"+s+" = "+g+".async; "),t+=" "+g+" = "+g+".validate; } if ( ",v&&(t+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),t+=" (",y!="ignore"&&(t+=" ("+f+" && !"+g+" ",b&&(t+=" && self._opts.unknownFormats.indexOf("+f+") == -1 "),t+=") || "),t+=" ("+g+" && "+E+" == '"+n+"' && !(typeof "+g+" == 'function' ? ",e.async?t+=" (async"+s+" ? await "+g+"("+h+") : "+g+"("+h+")) ":t+=" "+g+"("+h+") ",t+=" : "+g+".test("+h+"))))) {"}else{var g=e.formats[i];if(!g){if(y=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(t+=" if (true) { "),t;if(b&&y.indexOf(i)>=0)return u&&(t+=" if (true) { "),t;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var S=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,E=S&&g.type||"string";if(S){var P=g.async===!0;g=g.validate}if(E!=n)return u&&(t+=" if (true) { "),t;if(P){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(i)+".validate";t+=" if (!(await "+O+"("+h+"))) { "}else{t+=" if (! ";var O="formats"+e.util.getProperty(i);S&&(O+=".validate"),typeof g=="function"?t+=" "+O+"("+h+") ":t+=" "+O+".test("+h+") ",t+=") { "}}var j=j||[];j.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",v?t+=""+f:t+=""+e.util.toQuotedString(i),t+=" } ",e.opts.messages!==!1&&(t+=` , message: 'should match format "`,v?t+="' + "+f+" + '":t+=""+e.util.escapeQuotes(i),t+=`"' `),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+e.util.toQuotedString(i),t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var I=t;return t=j.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+I+"]); ":t+=" validate.errors = ["+I+"]; return false; ":t+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",u&&(t+=" else { "),t}});var Yi=ee((vy,Gi)=>{"use strict";Gi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,f="errs__"+s,y=e.util.copy(e);y.level++;var b="valid"+y.level,g=e.schema.then,S=e.schema.else,E=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),P=S!==void 0&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all)),O=y.baseId;if(E||P){var j;y.createErrors=!1,y.schema=i,y.schemaPath=d,y.errSchemaPath=c,t+=" var "+f+" = errors; var "+v+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,t+=" "+e.validate(y)+" ",y.baseId=O,y.createErrors=!0,t+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,E?(t+=" if ("+b+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",t+=" "+e.validate(y)+" ",y.baseId=O,t+=" "+v+" = "+b+"; ",E&&P?(j="ifClause"+s,t+=" var "+j+" = 'then'; "):j="'then'",t+=" } ",P&&(t+=" else { ")):t+=" if (!"+b+") { ",P&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",t+=" "+e.validate(y)+" ",y.baseId=O,t+=" "+v+" = "+b+"; ",E&&P?(j="ifClause"+s,t+=" var "+j+" = 'else'; "):j="'else'",t+=" } "),t+=" if (!"+v+") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+j+" } ",e.opts.messages!==!1&&(t+=` , message: 'should match "' + `+j+` + '" schema' `),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),t+=" } ",u&&(t+=" else { ")}else u&&(t+=" if (true) { ");return t}});var ec=ee((yy,Xi)=>{"use strict";Xi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,f="errs__"+s,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S="i"+s,E=y.dataLevel=e.dataLevel+1,P="data"+E,O=e.baseId;if(t+="var "+f+" = errors;var "+v+";",Array.isArray(i)){var j=e.schema.additionalItems;if(j===!1){t+=" "+v+" = "+h+".length <= "+i.length+"; ";var I=c;c=e.errSchemaPath+"/additionalItems",t+=" if (!"+v+") { ";var W=W||[];W.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(t+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var J=t;t=W.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+J+"]); ":t+=" validate.errors = ["+J+"]; return false; ":t+=" var err = "+J+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",c=I,u&&(b+="}",t+=" else { ")}var $=i;if($){for(var Z,V=-1,U=$.length-1;V<U;)if(Z=$[V+=1],e.opts.strictKeywords?typeof Z=="object"&&Object.keys(Z).length>0||Z===!1:e.util.schemaHasRules(Z,e.RULES.all)){t+=" "+g+" = true; if ("+h+".length > "+V+") { ";var A=h+"["+V+"]";y.schema=Z,y.schemaPath=d+"["+V+"]",y.errSchemaPath=c+"/"+V,y.errorPath=e.util.getPathExpr(e.errorPath,V,e.opts.jsonPointers,!0),y.dataPathArr[E]=V;var D=e.validate(y);y.baseId=O,e.util.varOccurences(D,P)<2?t+=" "+e.util.varReplace(D,P,A)+" ":t+=" var "+P+" = "+A+"; "+D+" ",t+=" } ",u&&(t+=" if ("+g+") { ",b+="}")}}if(typeof j=="object"&&(e.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:e.util.schemaHasRules(j,e.RULES.all))){y.schema=j,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",t+=" "+g+" = true; if ("+h+".length > "+i.length+") { for (var "+S+" = "+i.length+"; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var A=h+"["+S+"]";y.dataPathArr[E]=S;var D=e.validate(y);y.baseId=O,e.util.varOccurences(D,P)<2?t+=" "+e.util.varReplace(D,P,A)+" ":t+=" var "+P+" = "+A+"; "+D+" ",u&&(t+=" if (!"+g+") break; "),t+=" } } ",u&&(t+=" if ("+g+") { ",b+="}")}}else if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){y.schema=i,y.schemaPath=d,y.errSchemaPath=c,t+=" for (var "+S+" = 0; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var A=h+"["+S+"]";y.dataPathArr[E]=S;var D=e.validate(y);y.baseId=O,e.util.varOccurences(D,P)<2?t+=" "+e.util.varReplace(D,P,A)+" ":t+=" var "+P+" = "+A+"; "+D+" ",u&&(t+=" if (!"+g+") break; "),t+=" }"}return u&&(t+=" "+b+" if ("+f+" == errors) {"),t}});var Ts=ee((_y,tc)=>{"use strict";tc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,O,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,f;v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+s):f=i;var y=r=="maximum",b=y?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[b],S=e.opts.$data&&g&&g.$data,E=y?"<":">",P=y?">":"<",O=void 0;if(!(v||typeof i=="number"||i===void 0))throw new Error(r+" must be number");if(!(S||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(b+" must be number or boolean");if(S){var j=e.util.getData(g.$data,o,e.dataPathArr),I="exclusive"+s,W="exclType"+s,J="exclIsNumber"+s,$="op"+s,Z="' + "+$+" + '";t+=" var schemaExcl"+s+" = "+j+"; ",j="schemaExcl"+s,t+=" var "+I+"; var "+W+" = typeof "+j+"; if ("+W+" != 'boolean' && "+W+" != 'undefined' && "+W+" != 'number') { ";var O=b,V=V||[];V.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: '"+b+" should be boolean' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var U=t;t=V.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+U+"]); ":t+=" validate.errors = ["+U+"]; return false; ":t+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else if ( ",v&&(t+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),t+=" "+W+" == 'number' ? ( ("+I+" = "+f+" === undefined || "+j+" "+E+"= "+f+") ? "+h+" "+P+"= "+j+" : "+h+" "+P+" "+f+" ) : ( ("+I+" = "+j+" === true) ? "+h+" "+P+"= "+f+" : "+h+" "+P+" "+f+" ) || "+h+" !== "+h+") { var op"+s+" = "+I+" ? '"+E+"' : '"+E+"='; ",i===void 0&&(O=b,c=e.errSchemaPath+"/"+b,f=j,v=S)}else{var J=typeof g=="number",Z=E;if(J&&v){var $="'"+Z+"'";t+=" if ( ",v&&(t+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),t+=" ( "+f+" === undefined || "+g+" "+E+"= "+f+" ? "+h+" "+P+"= "+g+" : "+h+" "+P+" "+f+" ) || "+h+" !== "+h+") { "}else{J&&i===void 0?(I=!0,O=b,c=e.errSchemaPath+"/"+b,f=g,P+="="):(J&&(f=Math[y?"min":"max"](g,i)),g===(J?f:!0)?(I=!0,O=b,c=e.errSchemaPath+"/"+b,P+="="):(I=!1,Z+="="));var $="'"+Z+"'";t+=" if ( ",v&&(t+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),t+=" "+h+" "+P+" "+f+" || "+h+" !== "+h+") { "}}O=O||r;var V=V||[];V.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+$+", limit: "+f+", exclusive: "+I+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be "+Z+" ",v?t+="' + "+f:t+=""+f+"'"),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var U=t;return t=V.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+U+"]); ":t+=" validate.errors = ["+U+"]; return false; ":t+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",u&&(t+=" else { "),t}});var Os=ee((by,rc)=>{"use strict";rc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,b,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,f;if(v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+s):f=i,!(v||typeof i=="number"))throw new Error(r+" must be number");var y=r=="maxItems"?">":"<";t+="if ( ",v&&(t+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),t+=" "+h+".length "+y+" "+f+") { ";var b=r,g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have ",r=="maxItems"?t+="more":t+="fewer",t+=" than ",v?t+="' + "+f+" + '":t+=""+i,t+=" items' "),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var S=t;return t=g.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var Cs=ee((xy,ac)=>{"use strict";ac.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,b,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,f;if(v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+s):f=i,!(v||typeof i=="number"))throw new Error(r+" must be number");var y=r=="maxLength"?">":"<";t+="if ( ",v&&(t+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),e.opts.unicode===!1?t+=" "+h+".length ":t+=" ucs2length("+h+") ",t+=" "+y+" "+f+") { ";var b=r,g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT be ",r=="maxLength"?t+="longer":t+="shorter",t+=" than ",v?t+="' + "+f+" + '":t+=""+i,t+=" characters' "),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var S=t;return t=g.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var As=ee((wy,nc)=>{"use strict";nc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,b,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,f;if(v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+s):f=i,!(v||typeof i=="number"))throw new Error(r+" must be number");var y=r=="maxProperties"?">":"<";t+="if ( ",v&&(t+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),t+=" Object.keys("+h+").length "+y+" "+f+") { ";var b=r,g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+f+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have ",r=="maxProperties"?t+="more":t+="fewer",t+=" than ",v?t+="' + "+f+" + '":t+=""+i,t+=" properties' "),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var S=t;return t=g.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var oc=ee((ky,sc)=>{"use strict";sc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,f;if(v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+s):f=i,!(v||typeof i=="number"))throw new Error(r+" must be number");t+="var division"+s+";if (",v&&(t+=" "+f+" !== undefined && ( typeof "+f+" != 'number' || "),t+=" (division"+s+" = "+h+" / "+f+", ",e.opts.multipleOfPrecision?t+=" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":t+=" division"+s+" !== parseInt(division"+s+") ",t+=" ) ",v&&(t+=" ) "),t+=" ) { ";var y=y||[];y.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+f+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be multiple of ",v?t+="' + "+f:t+=""+f+"'"),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var b=t;return t=y.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+b+"]); ":t+=" validate.errors = ["+b+"]; return false; ":t+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var cc=ee((Sy,ic)=>{"use strict";ic.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="errs__"+s,f=e.util.copy(e);f.level++;var y="valid"+f.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=d,f.errSchemaPath=c,t+=" var "+v+" = errors; ";var b=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.createErrors=!1;var g;f.opts.allErrors&&(g=f.opts.allErrors,f.opts.allErrors=!1),t+=" "+e.validate(f)+" ",f.createErrors=!0,g&&(f.opts.allErrors=g),e.compositeRule=f.compositeRule=b,t+=" if ("+y+") { ";var S=S||[];S.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var E=t;t=S.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+E+"]); ":t+=" validate.errors = ["+E+"]; return false; ":t+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",e.opts.allErrors&&(t+=" } ")}else t+=" var err = ",e.createErrors!==!1?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(t+=" if (false) { ");return t}});var dc=ee((Py,lc)=>{"use strict";lc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,f="errs__"+s,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S=y.baseId,E="prevValid"+s,P="passingSchemas"+s;t+="var "+f+" = errors , "+E+" = false , "+v+" = false , "+P+" = null; ";var O=e.compositeRule;e.compositeRule=y.compositeRule=!0;var j=i;if(j)for(var I,W=-1,J=j.length-1;W<J;)I=j[W+=1],(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))?(y.schema=I,y.schemaPath=d+"["+W+"]",y.errSchemaPath=c+"/"+W,t+=" "+e.validate(y)+" ",y.baseId=S):t+=" var "+g+" = true; ",W&&(t+=" if ("+g+" && "+E+") { "+v+" = false; "+P+" = ["+P+", "+W+"]; } else { ",b+="}"),t+=" if ("+g+") { "+v+" = "+E+" = true; "+P+" = "+W+"; }";return e.compositeRule=y.compositeRule=O,t+=""+b+"if (!"+v+") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(t+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),t+="} else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; }",e.opts.allErrors&&(t+=" } "),t}});var fc=ee((Ey,uc)=>{"use strict";uc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,f;v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",f="schema"+s):f=i;var y=v?"(new RegExp("+f+"))":e.usePattern(i);t+="if ( ",v&&(t+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),t+=" !"+y+".test("+h+") ) { ";var b=b||[];b.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",v?t+=""+f:t+=""+e.util.toQuotedString(i),t+=" } ",e.opts.messages!==!1&&(t+=` , message: 'should match pattern "`,v?t+="' + "+f+" + '":t+=""+e.util.escapeQuotes(i),t+=`"' `),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+e.util.toQuotedString(i),t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var g=t;return t=b.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+g+"]); ":t+=" validate.errors = ["+g+"]; return false; ":t+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var hc=ee((Ry,pc)=>{"use strict";pc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="errs__"+s,f=e.util.copy(e),y="";f.level++;var b="valid"+f.level,g="key"+s,S="idx"+s,E=f.dataLevel=e.dataLevel+1,P="data"+E,O="dataProperties"+s,j=Object.keys(i||{}).filter(ue),I=e.schema.patternProperties||{},W=Object.keys(I).filter(ue),J=e.schema.additionalProperties,$=j.length||W.length,Z=J===!1,V=typeof J=="object"&&Object.keys(J).length,U=e.opts.removeAdditional,A=Z||V||U,D=e.opts.ownProperties,q=e.baseId,_e=e.schema.required;if(_e&&!(e.opts.$data&&_e.$data)&&_e.length<e.opts.loopRequired)var ie=e.util.toHash(_e);function ue(mt){return mt!=="__proto__"}if(t+="var "+v+" = errors;var "+b+" = true;",D&&(t+=" var "+O+" = undefined;"),A){if(D?t+=" "+O+" = "+O+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+O+".length; "+S+"++) { var "+g+" = "+O+"["+S+"]; ":t+=" for (var "+g+" in "+h+") { ",$){if(t+=" var isAdditional"+s+" = !(false ",j.length)if(j.length>8)t+=" || validate.schema"+d+".hasOwnProperty("+g+") ";else{var oe=j;if(oe)for(var K,Oe=-1,Fe=oe.length-1;Oe<Fe;)K=oe[Oe+=1],t+=" || "+g+" == "+e.util.toQuotedString(K)+" "}if(W.length){var Je=W;if(Je)for(var he,je=-1,Le=Je.length-1;je<Le;)he=Je[je+=1],t+=" || "+e.usePattern(he)+".test("+g+") "}t+=" ); if (isAdditional"+s+") { "}if(U=="all")t+=" delete "+h+"["+g+"]; ";else{var Ze=e.errorPath,Jt="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),Z)if(U)t+=" delete "+h+"["+g+"]; ";else{t+=" "+b+" = false; ";var At=c;c=e.errSchemaPath+"/additionalProperties";var Ie=Ie||[];Ie.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Jt+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is an invalid additional property":t+="should NOT have additional properties",t+="' "),e.opts.verbose&&(t+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var Ce=t;t=Ie.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+Ce+"]); ":t+=" validate.errors = ["+Ce+"]; return false; ":t+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=At,u&&(t+=" break; ")}else if(V)if(U=="failing"){t+=" var "+v+" = errors; ";var nr=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=J,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ue=h+"["+g+"]";f.dataPathArr[E]=g;var ge=e.validate(f);f.baseId=q,e.util.varOccurences(ge,P)<2?t+=" "+e.util.varReplace(ge,P,Ue)+" ":t+=" var "+P+" = "+Ue+"; "+ge+" ",t+=" if (!"+b+") { errors = "+v+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+h+"["+g+"]; } ",e.compositeRule=f.compositeRule=nr}else{f.schema=J,f.schemaPath=e.schemaPath+".additionalProperties",f.errSchemaPath=e.errSchemaPath+"/additionalProperties",f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ue=h+"["+g+"]";f.dataPathArr[E]=g;var ge=e.validate(f);f.baseId=q,e.util.varOccurences(ge,P)<2?t+=" "+e.util.varReplace(ge,P,Ue)+" ":t+=" var "+P+" = "+Ue+"; "+ge+" ",u&&(t+=" if (!"+b+") break; ")}e.errorPath=Ze}$&&(t+=" } "),t+=" } ",u&&(t+=" if ("+b+") { ",y+="}")}var Zt=e.opts.useDefaults&&!e.compositeRule;if(j.length){var jt=j;if(jt)for(var K,sr=-1,or=jt.length-1;sr<or;){K=jt[sr+=1];var Ne=i[K];if(e.opts.strictKeywords?typeof Ne=="object"&&Object.keys(Ne).length>0||Ne===!1:e.util.schemaHasRules(Ne,e.RULES.all)){var nt=e.util.getProperty(K),Ue=h+nt,We=Zt&&Ne.default!==void 0;f.schema=Ne,f.schemaPath=d+nt,f.errSchemaPath=c+"/"+e.util.escapeFragment(K),f.errorPath=e.util.getPath(e.errorPath,K,e.opts.jsonPointers),f.dataPathArr[E]=e.util.toQuotedString(K);var ge=e.validate(f);if(f.baseId=q,e.util.varOccurences(ge,P)<2){ge=e.util.varReplace(ge,P,Ue);var He=Ue}else{var He=P;t+=" var "+P+" = "+Ue+"; "}if(We)t+=" "+ge+" ";else{if(ie&&ie[K]){t+=" if ( "+He+" === undefined ",D&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(K)+"') "),t+=") { "+b+" = false; ";var Ze=e.errorPath,At=c,bt=e.util.escapeQuotes(K);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ze,K,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var Ie=Ie||[];Ie.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+bt+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+bt+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var Ce=t;t=Ie.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+Ce+"]); ":t+=" validate.errors = ["+Ce+"]; return false; ":t+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=At,e.errorPath=Ze,t+=" } else { "}else u?(t+=" if ( "+He+" === undefined ",D&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(K)+"') "),t+=") { "+b+" = true; } else { "):(t+=" if ("+He+" !== undefined ",D&&(t+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(K)+"') "),t+=" ) { ");t+=" "+ge+" } "}}u&&(t+=" if ("+b+") { ",y+="}")}}if(W.length){var tt=W;if(tt)for(var he,za=-1,Hn=tt.length-1;za<Hn;){he=tt[za+=1];var Ne=I[he];if(e.opts.strictKeywords?typeof Ne=="object"&&Object.keys(Ne).length>0||Ne===!1:e.util.schemaHasRules(Ne,e.RULES.all)){f.schema=Ne,f.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(he),f.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(he),D?t+=" "+O+" = "+O+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+O+".length; "+S+"++) { var "+g+" = "+O+"["+S+"]; ":t+=" for (var "+g+" in "+h+") { ",t+=" if ("+e.usePattern(he)+".test("+g+")) { ",f.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ue=h+"["+g+"]";f.dataPathArr[E]=g;var ge=e.validate(f);f.baseId=q,e.util.varOccurences(ge,P)<2?t+=" "+e.util.varReplace(ge,P,Ue)+" ":t+=" var "+P+" = "+Ue+"; "+ge+" ",u&&(t+=" if (!"+b+") break; "),t+=" } ",u&&(t+=" else "+b+" = true; "),t+=" } ",u&&(t+=" if ("+b+") { ",y+="}")}}}return u&&(t+=" "+y+" if ("+v+" == errors) {"),t}});var gc=ee((Ty,mc)=>{"use strict";mc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="errs__"+s,f=e.util.copy(e),y="";f.level++;var b="valid"+f.level;if(t+="var "+v+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){f.schema=i,f.schemaPath=d,f.errSchemaPath=c;var g="key"+s,S="idx"+s,E="i"+s,P="' + "+g+" + '",O=f.dataLevel=e.dataLevel+1,j="data"+O,I="dataProperties"+s,W=e.opts.ownProperties,J=e.baseId;W&&(t+=" var "+I+" = undefined; "),W?t+=" "+I+" = "+I+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+I+".length; "+S+"++) { var "+g+" = "+I+"["+S+"]; ":t+=" for (var "+g+" in "+h+") { ",t+=" var startErrs"+s+" = errors; ";var $=g,Z=e.compositeRule;e.compositeRule=f.compositeRule=!0;var V=e.validate(f);f.baseId=J,e.util.varOccurences(V,j)<2?t+=" "+e.util.varReplace(V,j,$)+" ":t+=" var "+j+" = "+$+"; "+V+" ",e.compositeRule=f.compositeRule=Z,t+=" if (!"+b+") { for (var "+E+"=startErrs"+s+"; "+E+"<errors; "+E+"++) { vErrors["+E+"].propertyName = "+g+"; } var err = ",e.createErrors!==!1?(t+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(t+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),u&&(t+=" break; "),t+=" } }"}return u&&(t+=" "+y+" if ("+v+" == errors) {"),t}});var yc=ee((Oy,vc)=>{"use strict";vc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,f=e.opts.$data&&i&&i.$data,y;f?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+s):y=i;var b="schema"+s;if(!f)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var g=[],S=i;if(S)for(var E,P=-1,O=S.length-1;P<O;){E=S[P+=1];var j=e.schema.properties[E];j&&(e.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:e.util.schemaHasRules(j,e.RULES.all))||(g[g.length]=E)}}else var g=i;if(f||g.length){var I=e.errorPath,W=f||g.length>=e.opts.loopRequired,J=e.opts.ownProperties;if(u)if(t+=" var missing"+s+"; ",W){f||(t+=" var "+b+" = validate.schema"+d+"; ");var $="i"+s,Z="schema"+s+"["+$+"]",V="' + "+Z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,Z,e.opts.jsonPointers)),t+=" var "+v+" = true; ",f&&(t+=" if (schema"+s+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+s+")) "+v+" = false; else {"),t+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { "+v+" = "+h+"["+b+"["+$+"]] !== undefined ",J&&(t+=" && Object.prototype.hasOwnProperty.call("+h+", "+b+"["+$+"]) "),t+="; if (!"+v+") break; } ",f&&(t+=" } "),t+=" if (!"+v+") { ";var U=U||[];U.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var A=t;t=U.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+A+"]); ":t+=" validate.errors = ["+A+"]; return false; ":t+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { "}else{t+=" if ( ";var D=g;if(D)for(var q,$=-1,_e=D.length-1;$<_e;){q=D[$+=1],$&&(t+=" || ");var ie=e.util.getProperty(q),ue=h+ie;t+=" ( ( "+ue+" === undefined ",J&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(q)+"') "),t+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:ie)+") ) "}t+=") { ";var Z="missing"+s,V="' + "+Z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,Z,!0):I+" + "+Z);var U=U||[];U.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var A=t;t=U.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+A+"]); ":t+=" validate.errors = ["+A+"]; return false; ":t+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { "}else if(W){f||(t+=" var "+b+" = validate.schema"+d+"; ");var $="i"+s,Z="schema"+s+"["+$+"]",V="' + "+Z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,Z,e.opts.jsonPointers)),f&&(t+=" if ("+b+" && !Array.isArray("+b+")) { var err = ",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+b+" !== undefined) { "),t+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { if ("+h+"["+b+"["+$+"]] === undefined ",J&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", "+b+"["+$+"]) "),t+=") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",f&&(t+=" } ")}else{var oe=g;if(oe)for(var q,K=-1,Oe=oe.length-1;K<Oe;){q=oe[K+=1];var ie=e.util.getProperty(q),V=e.util.escapeQuotes(q),ue=h+ie;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,q,e.opts.jsonPointers)),t+=" if ( "+ue+" === undefined ",J&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(q)+"') "),t+=") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=I}else u&&(t+=" if (true) {");return t}});var bc=ee((Cy,_c)=>{"use strict";_c.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,f=e.opts.$data&&i&&i.$data,y;if(f?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+s):y=i,(i||f)&&e.opts.uniqueItems!==!1){f&&(t+=" var "+v+"; if ("+y+" === false || "+y+" === undefined) "+v+" = true; else if (typeof "+y+" != 'boolean') "+v+" = false; else { "),t+=" var i = "+h+".length , "+v+" = true , j; if (i > 1) { ";var b=e.schema.items&&e.schema.items.type,g=Array.isArray(b);if(!b||b=="object"||b=="array"||g&&(b.indexOf("object")>=0||b.indexOf("array")>=0))t+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+v+" = false; break outer; } } } ";else{t+=" var itemIndices = {}, item; for (;i--;) { var item = "+h+"[i]; ";var S="checkDataType"+(g?"s":"");t+=" if ("+e.util[S](b,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(t+=` if (typeof item == 'string') item = '"' + item; `),t+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}t+=" } ",f&&(t+=" } "),t+=" if (!"+v+") { ";var E=E||[];E.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(t+=" , schema: ",f?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var P=t;t=E.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+P+"]); ":t+=" validate.errors = ["+P+"]; return false; ":t+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",u&&(t+=" else { ")}else u&&(t+=" if (true) { ");return t}});var wc=ee((Ay,xc)=>{"use strict";xc.exports={$ref:$i(),allOf:Li(),anyOf:Mi(),$comment:Fi(),const:qi(),contains:Ji(),dependencies:Hi(),enum:Wi(),format:Qi(),if:Yi(),items:ec(),maximum:Ts(),minimum:Ts(),maxItems:Os(),minItems:Os(),maxLength:Cs(),minLength:Cs(),maxProperties:As(),minProperties:As(),multipleOf:oc(),not:cc(),oneOf:dc(),pattern:fc(),properties:hc(),propertyNames:gc(),required:yc(),uniqueItems:bc(),validate:Es()}});var Pc=ee((jy,Sc)=>{"use strict";var kc=wc(),js=Er().toHash;Sc.exports=function(){var e=[{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"]}],r=["type","$comment"],n=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],t=["number","integer","string","array","object","boolean","null"];return e.all=js(r),e.types=js(t),e.forEach(function(s){s.rules=s.rules.map(function(o){var i;if(typeof o=="object"){var d=Object.keys(o)[0];i=o[d],o=d,i.forEach(function(u){r.push(u),e.all[u]=!0})}r.push(o);var c=e.all[o]={keyword:o,code:kc[o],implements:i};return c}),e.all.$comment={keyword:"$comment",code:kc.$comment},s.type&&(e.types[s.type]=s)}),e.keywords=js(r.concat(n)),e.custom={},e}});var Tc=ee((Iy,Rc)=>{"use strict";var Ec=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Rc.exports=function(a,e){for(var r=0;r<e.length;r++){a=JSON.parse(JSON.stringify(a));var n=e[r].split("/"),t=a,s;for(s=1;s<n.length;s++)t=t[n[s]];for(s=0;s<Ec.length;s++){var o=Ec[s],i=t[o];i&&(t[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var Ac=ee(($y,Cc)=>{"use strict";var Lp=bn().MissingRef;Cc.exports=Oc;function Oc(a,e,r){var n=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var t=s(a).then(function(){var i=n._addSchema(a,void 0,e);return i.validate||o(i)});return r&&t.then(function(i){r(null,i)},r),t;function s(i){var d=i.$schema;return d&&!n.getSchema(d)?Oc.call(n,{$ref:d},!0):Promise.resolve()}function o(i){try{return n._compile(i)}catch(c){if(c instanceof Lp)return d(c);throw c}function d(c){var u=c.missingSchema;if(f(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var h=n._loadingSchemas[u];return h||(h=n._loadingSchemas[u]=n._opts.loadSchema(u),h.then(v,v)),h.then(function(y){if(!f(u))return s(y).then(function(){f(u)||n.addSchema(y,u,void 0,e)})}).then(function(){return o(i)});function v(){delete n._loadingSchemas[u]}function f(y){return n._refs[y]||n._schemas[y]}}}}});var Ic=ee((Dy,jc)=>{"use strict";jc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,v="data"+(o||""),f="valid"+s,y="errs__"+s,b=e.opts.$data&&i&&i.$data,g;b?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",g="schema"+s):g=i;var S=this,E="definition"+s,P=S.definition,O="",j,I,W,J,$;if(b&&P.$data){$="keywordValidate"+s;var Z=P.validateSchema;t+=" var "+E+" = RULES.custom['"+r+"'].definition; var "+$+" = "+E+".validate;"}else{if(J=e.useCustomRule(S,i,e.schema,e),!J)return;g="validate.schema"+d,$=J.code,j=P.compile,I=P.inline,W=P.macro}var V=$+".errors",U="i"+s,A="ruleErr"+s,D=P.async;if(D&&!e.async)throw new Error("async keyword in sync schema");if(I||W||(t+=""+V+" = null;"),t+="var "+y+" = errors;var "+f+";",b&&P.$data&&(O+="}",t+=" if ("+g+" === undefined) { "+f+" = true; } else { ",Z&&(O+="}",t+=" "+f+" = "+E+".validateSchema("+g+"); if ("+f+") { ")),I)P.statements?t+=" "+J.validate+" ":t+=" "+f+" = "+J.validate+"; ";else if(W){var q=e.util.copy(e),O="";q.level++;var _e="valid"+q.level;q.schema=J.validate,q.schemaPath="";var ie=e.compositeRule;e.compositeRule=q.compositeRule=!0;var ue=e.validate(q).replace(/validate\.schema/g,$);e.compositeRule=q.compositeRule=ie,t+=" "+ue}else{var oe=oe||[];oe.push(t),t="",t+=" "+$+".call( ",e.opts.passContext?t+="this":t+="self",j||P.schema===!1?t+=" , "+v+" ":t+=" , "+g+" , "+v+" , validate.schema"+e.schemaPath+" ",t+=" , (dataPath || '')",e.errorPath!='""'&&(t+=" + "+e.errorPath);var K=o?"data"+(o-1||""):"parentData",Oe=o?e.dataPathArr[o]:"parentDataProperty";t+=" , "+K+" , "+Oe+" , rootData ) ";var Fe=t;t=oe.pop(),P.errors===!1?(t+=" "+f+" = ",D&&(t+="await "),t+=""+Fe+"; "):D?(V="customErrors"+s,t+=" var "+V+" = null; try { "+f+" = await "+Fe+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+V+" = e.errors; else throw e; } "):t+=" "+V+" = null; "+f+" = "+Fe+"; "}if(P.modifying&&(t+=" if ("+K+") "+v+" = "+K+"["+Oe+"];"),t+=""+O,P.valid)u&&(t+=" if (true) { ");else{t+=" if ( ",P.valid===void 0?(t+=" !",W?t+=""+_e:t+=""+f):t+=" "+!P.valid+" ",t+=") { ",h=S.keyword;var oe=oe||[];oe.push(t),t="";var oe=oe||[];oe.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(t+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),t+=" } "):t+=" {} ";var Je=t;t=oe.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+Je+"]); ":t+=" validate.errors = ["+Je+"]; return false; ":t+=" var err = "+Je+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var he=t;t=oe.pop(),I?P.errors?P.errors!="full"&&(t+=" for (var "+U+"="+y+"; "+U+"<errors; "+U+"++) { var "+A+" = vErrors["+U+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(t+=" "+A+".schema = "+g+"; "+A+".data = "+v+"; "),t+=" } "):P.errors===!1?t+=" "+he+" ":(t+=" if ("+y+" == errors) { "+he+" } else { for (var "+U+"="+y+"; "+U+"<errors; "+U+"++) { var "+A+" = vErrors["+U+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(t+=" "+A+".schema = "+g+"; "+A+".data = "+v+"; "),t+=" } } "):W?(t+=" var err = ",e.createErrors!==!1?(t+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(t+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; ")):P.errors===!1?t+=" "+he+" ":(t+=" if (Array.isArray("+V+")) { if (vErrors === null) vErrors = "+V+"; else vErrors = vErrors.concat("+V+"); errors = vErrors.length; for (var "+U+"="+y+"; "+U+"<errors; "+U+"++) { var "+A+" = vErrors["+U+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; "+A+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(t+=" "+A+".schema = "+g+"; "+A+".data = "+v+"; "),t+=" } } else { "+he+" } "),t+=" } ",u&&(t+=" else { ")}return t}});var Is=ee((Ly,Np)=>{Np.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 Lc=ee((Ny,Dc)=>{"use strict";var $c=Is();Dc.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:$c.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:$c.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 Mc=ee((My,Nc)=>{"use strict";var Mp=/^[a-z_$][a-z0-9_$-]*$/i,zp=Ic(),Fp=Lc();Nc.exports={add:Up,get:qp,remove:Vp,validate:$s};function Up(a,e){var r=this.RULES;if(r.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Mp.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var n=e.type;if(Array.isArray(n))for(var t=0;t<n.length;t++)o(a,n[t],e);else o(a,n,e);var s=e.metaSchema;s&&(e.$data&&this._opts.$data&&(s={anyOf:[s,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(s,!0))}r.keywords[a]=r.all[a]=!0;function o(i,d,c){for(var u,h=0;h<r.length;h++){var v=r[h];if(v.type==d){u=v;break}}u||(u={type:d,rules:[]},r.push(u));var f={keyword:i,definition:c,custom:!0,code:zp,implements:c.implements};u.rules.push(f),r.custom[i]=f}return this}function qp(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Vp(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var r=0;r<e.length;r++)for(var n=e[r].rules,t=0;t<n.length;t++)if(n[t].keyword==a){n.splice(t,1);break}return this}function $s(a,e){$s.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(Fp,!0);if(r(a))return!0;if($s.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}});var zc=ee((zy,Jp)=>{Jp.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 Kc=ee((Fy,Wc)=>{"use strict";var Uc=yi(),Rr=_n(),Zp=bi(),qc=_s(),Hp=Ps(),Bp=ji(),Wp=Pc(),Vc=Tc(),Jc=Er();Wc.exports=Ae;Ae.prototype.validate=Qp;Ae.prototype.compile=Gp;Ae.prototype.addSchema=Yp;Ae.prototype.addMetaSchema=Xp;Ae.prototype.validateSchema=eh;Ae.prototype.getSchema=rh;Ae.prototype.removeSchema=nh;Ae.prototype.addFormat=fh;Ae.prototype.errorsText=uh;Ae.prototype._addSchema=sh;Ae.prototype._compile=oh;Ae.prototype.compileAsync=Ac();var Tn=Mc();Ae.prototype.addKeyword=Tn.add;Ae.prototype.getKeyword=Tn.get;Ae.prototype.removeKeyword=Tn.remove;Ae.prototype.validateKeyword=Tn.validate;var Zc=bn();Ae.ValidationError=Zc.Validation;Ae.MissingRefError=Zc.MissingRef;Ae.$dataMetaSchema=Vc;var Rn="http://json-schema.org/draft-07/schema",Fc=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Kp=["/properties"];function Ae(a){if(!(this instanceof Ae))return new Ae(a);a=this._opts=Jc.copy(a)||{},yh(this),this._schemas={},this._refs={},this._fragments={},this._formats=Bp(a.format),this._cache=a.cache||new Zp,this._loadingSchemas={},this._compilations=[],this.RULES=Wp(),this._getId=ih(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Hp),this._metaOpts=vh(this),a.formats&&mh(this),a.keywords&&gh(this),ph(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),hh(this)}function Qp(a,e){var r;if(typeof a=="string"){if(r=this.getSchema(a),!r)throw new Error('no schema with key or ref "'+a+'"')}else{var n=this._addSchema(a);r=n.validate||this._compile(n)}var t=r(e);return r.$async!==!0&&(this.errors=r.errors),t}function Gp(a,e){var r=this._addSchema(a,void 0,e);return r.validate||this._compile(r)}function Yp(a,e,r,n){if(Array.isArray(a)){for(var t=0;t<a.length;t++)this.addSchema(a[t],void 0,r,n);return this}var s=this._getId(a);if(s!==void 0&&typeof s!="string")throw new Error("schema id must be string");return e=Rr.normalizeId(e||s),Bc(this,e),this._schemas[e]=this._addSchema(a,r,n,!0),this}function Xp(a,e,r){return this.addSchema(a,e,r,!0),this}function eh(a,e){var r=a.$schema;if(r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this._opts.defaultMeta||th(this),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var n=this.validate(r,a);if(!n&&e){var t="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(t);else throw new Error(t)}return n}function th(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(Rn)?Rn:void 0,a._opts.defaultMeta}function rh(a){var e=Hc(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return ah(this,a)}}function ah(a,e){var r=Rr.schema.call(a,{schema:{}},e);if(r){var n=r.schema,t=r.root,s=r.baseId,o=Uc.call(a,n,t,void 0,s);return a._fragments[e]=new qc({ref:e,fragment:!0,schema:n,root:t,baseId:s,validate:o}),o}}function Hc(a,e){return e=Rr.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function nh(a){if(a instanceof RegExp)return En(this,this._schemas,a),En(this,this._refs,a),this;switch(typeof a){case"undefined":return En(this,this._schemas),En(this,this._refs),this._cache.clear(),this;case"string":var e=Hc(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var r=this._opts.serialize,n=r?r(a):a;this._cache.del(n);var t=this._getId(a);t&&(t=Rr.normalizeId(t),delete this._schemas[t],delete this._refs[t])}return this}function En(a,e,r){for(var n in e){var t=e[n];!t.meta&&(!r||r.test(n))&&(a._cache.del(t.cacheKey),delete e[n])}}function sh(a,e,r,n){if(typeof a!="object"&&typeof a!="boolean")throw new Error("schema should be object or boolean");var t=this._opts.serialize,s=t?t(a):a,o=this._cache.get(s);if(o)return o;n=n||this._opts.addUsedSchema!==!1;var i=Rr.normalizeId(this._getId(a));i&&n&&Bc(this,i);var d=this._opts.validateSchema!==!1&&!e,c;d&&!(c=i&&i==Rr.normalizeId(a.$schema))&&this.validateSchema(a,!0);var u=Rr.ids.call(this,a),h=new qc({id:i,schema:a,localRefs:u,cacheKey:s,meta:r});return i[0]!="#"&&n&&(this._refs[i]=h),this._cache.put(s,h),d&&c&&this.validateSchema(a,!0),h}function oh(a,e){if(a.compiling)return a.validate=t,t.schema=a.schema,t.errors=null,t.root=e||t,a.schema.$async===!0&&(t.$async=!0),t;a.compiling=!0;var r;a.meta&&(r=this._opts,this._opts=this._metaOpts);var n;try{n=Uc.call(this,a.schema,e,a.localRefs)}catch(s){throw delete a.validate,s}finally{a.compiling=!1,a.meta&&(this._opts=r)}return a.validate=n,a.refs=n.refs,a.refVal=n.refVal,a.root=n.root,n;function t(){var s=a.validate,o=s.apply(this,arguments);return t.errors=s.errors,o}}function ih(a){switch(a.schemaId){case"auto":return dh;case"id":return ch;default:return lh}}function ch(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function lh(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function dh(a){if(a.$id&&a.id&&a.$id!=a.id)throw new Error("schema $id is different from id");return a.$id||a.id}function uh(a,e){if(a=a||this.errors,!a)return"No errors";e=e||{};for(var r=e.separator===void 0?", ":e.separator,n=e.dataVar===void 0?"data":e.dataVar,t="",s=0;s<a.length;s++){var o=a[s];o&&(t+=n+o.dataPath+" "+o.message+r)}return t.slice(0,-r.length)}function fh(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function ph(a){var e;if(a._opts.$data&&(e=zc(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var r=Is();a._opts.$data&&(r=Vc(r,Kp)),a.addMetaSchema(r,Rn,!0),a._refs["http://json-schema.org/schema"]=Rn}}function hh(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var r in e)a.addSchema(e[r],r)}function mh(a){for(var e in a._opts.formats){var r=a._opts.formats[e];a.addFormat(e,r)}}function gh(a){for(var e in a._opts.keywords){var r=a._opts.keywords[e];a.addKeyword(e,r)}}function Bc(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function vh(a){for(var e=Jc.copy(a._opts),r=0;r<Fc.length;r++)delete e[Fc[r]];return e}function yh(a){var e=a._opts.logger;if(e===!1)a.logger={log:Ds,warn:Ds,error:Ds};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");a.logger=e}}function Ds(){}});import{pathToFileURL as ev}from"node:url";var l={};yo(l,{BRAND:()=>fu,DIRTY:()=>dr,EMPTY_PATH:()=>Jd,INVALID:()=>Q,NEVER:()=>Qu,OK:()=>qe,ParseStatus:()=>Me,Schema:()=>re,ZodAny:()=>Wt,ZodArray:()=>zt,ZodBigInt:()=>fr,ZodBoolean:()=>pr,ZodBranded:()=>Ra,ZodCatch:()=>Sr,ZodDate:()=>hr,ZodDefault:()=>kr,ZodDiscriminatedUnion:()=>Za,ZodEffects:()=>lt,ZodEnum:()=>xr,ZodError:()=>Ke,ZodFirstPartyTypeKind:()=>C,ZodFunction:()=>Ba,ZodIntersection:()=>yr,ZodIssueCode:()=>R,ZodLazy:()=>_r,ZodLiteral:()=>br,ZodMap:()=>aa,ZodNaN:()=>sa,ZodNativeEnum:()=>wr,ZodNever:()=>gt,ZodNull:()=>gr,ZodNullable:()=>Pt,ZodNumber:()=>ur,ZodObject:()=>Qe,ZodOptional:()=>it,ZodParsedType:()=>M,ZodPipeline:()=>Ta,ZodPromise:()=>Kt,ZodReadonly:()=>Pr,ZodRecord:()=>Ha,ZodSchema:()=>re,ZodSet:()=>na,ZodString:()=>Bt,ZodSymbol:()=>ta,ZodTransformer:()=>lt,ZodTuple:()=>St,ZodType:()=>re,ZodUndefined:()=>mr,ZodUnion:()=>vr,ZodUnknown:()=>Mt,ZodVoid:()=>ra,addIssueToContext:()=>L,any:()=>xu,array:()=>Pu,bigint:()=>gu,boolean:()=>Oo,coerce:()=>Ku,custom:()=>Eo,date:()=>vu,datetimeRegex:()=>So,defaultErrorMap:()=>Lt,discriminatedUnion:()=>Ou,effect:()=>Uu,enum:()=>Mu,function:()=>Du,getErrorMap:()=>Yr,getParsedType:()=>kt,instanceof:()=>hu,intersection:()=>Cu,isAborted:()=>Va,isAsync:()=>Xr,isDirty:()=>Ja,isValid:()=>Ht,late:()=>pu,lazy:()=>Lu,literal:()=>Nu,makeIssue:()=>Ea,map:()=>Iu,nan:()=>mu,nativeEnum:()=>zu,never:()=>ku,null:()=>bu,nullable:()=>Vu,number:()=>To,object:()=>Eu,objectUtil:()=>Gn,oboolean:()=>Wu,onumber:()=>Bu,optional:()=>qu,ostring:()=>Hu,pipeline:()=>Zu,preprocess:()=>Ju,promise:()=>Fu,quotelessJson:()=>Ud,record:()=>ju,set:()=>$u,setErrorMap:()=>Vd,strictObject:()=>Ru,string:()=>Ro,symbol:()=>yu,transformer:()=>Uu,tuple:()=>Au,undefined:()=>_u,union:()=>Tu,unknown:()=>wu,util:()=>ce,void:()=>Su});var ce;(function(a){a.assertEqual=t=>{};function e(t){}a.assertIs=e;function r(t){throw new Error}a.assertNever=r,a.arrayToEnum=t=>{let s={};for(let o of t)s[o]=o;return s},a.getValidEnumValues=t=>{let s=a.objectKeys(t).filter(i=>typeof t[t[i]]!="number"),o={};for(let i of s)o[i]=t[i];return a.objectValues(o)},a.objectValues=t=>a.objectKeys(t).map(function(s){return t[s]}),a.objectKeys=typeof Object.keys=="function"?t=>Object.keys(t):t=>{let s=[];for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&s.push(o);return s},a.find=(t,s)=>{for(let o of t)if(s(o))return o},a.isInteger=typeof Number.isInteger=="function"?t=>Number.isInteger(t):t=>typeof t=="number"&&Number.isFinite(t)&&Math.floor(t)===t;function n(t,s=" | "){return t.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}a.joinValues=n,a.jsonStringifyReplacer=(t,s)=>typeof s=="bigint"?s.toString():s})(ce||(ce={}));var Gn;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(Gn||(Gn={}));var M=ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),kt=a=>{switch(typeof a){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(a)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(a)?M.array:a===null?M.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?M.promise:typeof Map<"u"&&a instanceof Map?M.map:typeof Set<"u"&&a instanceof Set?M.set:typeof Date<"u"&&a instanceof Date?M.date:M.object;default:return M.unknown}};var R=ce.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"]),Ud=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ke=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},t=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(t);else if(o.code==="invalid_return_type")t(o.returnTypeError);else if(o.code==="invalid_arguments")t(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let i=n,d=0;for(;d<o.path.length;){let c=o.path[d];d===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(r(o))):i[c]=i[c]||{_errors:[]},i=i[c],d++}}};return t(this),n}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let t of this.issues)if(t.path.length>0){let s=t.path[0];r[s]=r[s]||[],r[s].push(e(t))}else n.push(e(t));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ke.create=a=>new Ke(a);var qd=(a,e)=>{let r;switch(a.code){case R.invalid_type:a.received===M.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case R.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,ce.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:r=`Unrecognized key(s) in object: ${ce.joinValues(a.keys,", ")}`;break;case R.invalid_union:r="Invalid input";break;case R.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ce.joinValues(a.options)}`;break;case R.invalid_enum_value:r=`Invalid enum value. Expected ${ce.joinValues(a.options)}, received '${a.received}'`;break;case R.invalid_arguments:r="Invalid function arguments";break;case R.invalid_return_type:r="Invalid function return type";break;case R.invalid_date:r="Invalid date";break;case R.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:ce.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case R.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case R.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case R.custom:r="Invalid input";break;case R.invalid_intersection_types:r="Intersection results could not be merged";break;case R.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case R.not_finite:r="Number must be finite";break;default:r=e.defaultError,ce.assertNever(a)}return{message:r}},Lt=qd;var _o=Lt;function Vd(a){_o=a}function Yr(){return _o}var Ea=a=>{let{data:e,path:r,errorMaps:n,issueData:t}=a,s=[...r,...t.path||[]],o={...t,path:s};if(t.message!==void 0)return{...t,path:s,message:t.message};let i="",d=n.filter(c=>!!c).slice().reverse();for(let c of d)i=c(o,{data:e,defaultError:i}).message;return{...t,path:s,message:i}},Jd=[];function L(a,e){let r=Yr(),n=Ea({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===Lt?void 0:Lt].filter(t=>!!t)});a.common.issues.push(n)}var Me=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let t of r){if(t.status==="aborted")return Q;t.status==="dirty"&&e.dirty(),n.push(t.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let t of r){let s=await t.key,o=await t.value;n.push({key:s,value:o})}return a.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let t of r){let{key:s,value:o}=t;if(s.status==="aborted"||o.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||t.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}},Q=Object.freeze({status:"aborted"}),dr=a=>({status:"dirty",value:a}),qe=a=>({status:"valid",value:a}),Va=a=>a.status==="aborted",Ja=a=>a.status==="dirty",Ht=a=>a.status==="valid",Xr=a=>typeof Promise<"u"&&a instanceof Promise;var H;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(H||(H={}));var ct=class{constructor(e,r,n,t){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=t}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},bo=(a,e)=>{if(Ht(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ke(a.common.issues);return this._error=r,this._error}}};function te(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:t}=a;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:t}:{errorMap:(o,i)=>{let{message:d}=a;return o.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??n??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:d??r??i.defaultError}},description:t}}var re=class{get description(){return this._def.description}_getType(e){return kt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:kt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Me,ctx:{common:e.parent.common,data:e.data,parsedType:kt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Xr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kt(e)},t=this._parseSync({data:e,path:n.path,parent:n});return bo(n,t)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Ht(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Ht(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kt(e)},t=this._parse({data:e,path:n.path,parent:n}),s=await(Xr(t)?t:Promise.resolve(t));return bo(n,s)}refine(e,r){let n=t=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(t):r;return this._refinement((t,s)=>{let o=e(t),i=()=>s.addIssue({code:R.custom,...n(t)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,r){return this._refinement((n,t)=>e(n)?!0:(t.addIssue(typeof r=="function"?r(n,t):r),!1))}_refinement(e){return new lt({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return it.create(this,this._def)}nullable(){return Pt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return zt.create(this)}promise(){return Kt.create(this,this._def)}or(e){return vr.create([this,e],this._def)}and(e){return yr.create(this,e,this._def)}transform(e){return new lt({...te(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new kr({...te(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new Ra({typeName:C.ZodBranded,type:this,...te(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Sr({...te(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ta.create(this,e)}readonly(){return Pr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Zd=/^c[^\s-]{8,}$/i,Hd=/^[0-9a-z]+$/,Bd=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Wd=/^[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,Kd=/^[a-z0-9_-]{21}$/i,Qd=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gd=/^[-+]?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)?)??$/,Yd=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Yn,eu=/^(?:(?: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])$/,tu=/^(?:(?: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])$/,ru=/^(([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]))$/,au=/^(([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])$/,nu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,su=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wo="((\\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])))",ou=new RegExp(`^${wo}$`);function ko(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function iu(a){return new RegExp(`^${ko(a)}$`)}function So(a){let e=`${wo}T${ko(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function cu(a,e){return!!((e==="v4"||!e)&&eu.test(a)||(e==="v6"||!e)&&ru.test(a))}function lu(a,e){if(!Qd.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),t=JSON.parse(atob(n));return!(typeof t!="object"||t===null||"typ"in t&&t?.typ!=="JWT"||!t.alg||e&&t.alg!==e)}catch{return!1}}function du(a,e){return!!((e==="v4"||!e)&&tu.test(a)||(e==="v6"||!e)&&au.test(a))}var Bt=class a extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==M.string){let s=this._getOrReturnCtx(e);return L(s,{code:R.invalid_type,expected:M.string,received:s.parsedType}),Q}let n=new Me,t;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(t=this._getOrReturnCtx(e,t),L(t,{code:R.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(t=this._getOrReturnCtx(e,t),L(t,{code:R.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,i=e.data.length<s.value;(o||i)&&(t=this._getOrReturnCtx(e,t),o?L(t,{code:R.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&L(t,{code:R.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Yd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"email",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Yn||(Yn=new RegExp(Xd,"u")),Yn.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"emoji",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Wd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"uuid",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Kd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"nanoid",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Zd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"cuid",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Hd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"cuid2",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Bd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"ulid",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{t=this._getOrReturnCtx(e,t),L(t,{validation:"url",code:R.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"regex",code:R.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?So(s).test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?ou.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?iu(s).test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Gd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"duration",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?cu(e.data,s.version)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"ip",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?lu(e.data,s.alg)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"jwt",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?du(e.data,s.version)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"cidr",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?nu.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"base64",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?su.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"base64url",code:R.invalid_string,message:s.message}),n.dirty()):ce.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(t=>e.test(t),{validation:r,code:R.invalid_string,...H.errToObj(n)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...H.errToObj(e)})}url(e){return this._addCheck({kind:"url",...H.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...H.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...H.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...H.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...H.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...H.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...H.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...H.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...H.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...H.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...H.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...H.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...H.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...H.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...H.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...H.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...H.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...H.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...H.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...H.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...H.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...H.errToObj(r)})}nonempty(e){return this.min(1,H.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Bt.create=a=>new Bt({checks:[],typeName:C.ZodString,coerce:a?.coerce??!1,...te(a)});function uu(a,e){let r=(a.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,t=r>n?r:n,s=Number.parseInt(a.toFixed(t).replace(".","")),o=Number.parseInt(e.toFixed(t).replace(".",""));return s%o/10**t}var ur=class a extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==M.number){let s=this._getOrReturnCtx(e);return L(s,{code:R.invalid_type,expected:M.number,received:s.parsedType}),Q}let n,t=new Me;for(let s of this._def.checks)s.kind==="int"?ce.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:R.invalid_type,expected:"integer",received:"float",message:s.message}),t.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),t.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),t.dirty()):s.kind==="multipleOf"?uu(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.not_multiple_of,multipleOf:s.value,message:s.message}),t.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:R.not_finite,message:s.message}),t.dirty()):ce.assertNever(s);return{status:t.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,H.toString(r))}gt(e,r){return this.setLimit("min",e,!1,H.toString(r))}lte(e,r){return this.setLimit("max",e,!0,H.toString(r))}lt(e,r){return this.setLimit("max",e,!1,H.toString(r))}setLimit(e,r,n,t){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:H.toString(t)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:H.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:H.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:H.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:H.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:H.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ce.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};ur.create=a=>new ur({checks:[],typeName:C.ZodNumber,coerce:a?.coerce||!1,...te(a)});var fr=class a extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==M.bigint)return this._getInvalidInput(e);let n,t=new Me;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),t.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),t.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.not_multiple_of,multipleOf:s.value,message:s.message}),t.dirty()):ce.assertNever(s);return{status:t.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return L(r,{code:R.invalid_type,expected:M.bigint,received:r.parsedType}),Q}gte(e,r){return this.setLimit("min",e,!0,H.toString(r))}gt(e,r){return this.setLimit("min",e,!1,H.toString(r))}lte(e,r){return this.setLimit("max",e,!0,H.toString(r))}lt(e,r){return this.setLimit("max",e,!1,H.toString(r))}setLimit(e,r,n,t){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:H.toString(t)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:H.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};fr.create=a=>new fr({checks:[],typeName:C.ZodBigInt,coerce:a?.coerce??!1,...te(a)});var pr=class extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==M.boolean){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.boolean,received:n.parsedType}),Q}return qe(e.data)}};pr.create=a=>new pr({typeName:C.ZodBoolean,coerce:a?.coerce||!1,...te(a)});var hr=class a extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==M.date){let s=this._getOrReturnCtx(e);return L(s,{code:R.invalid_type,expected:M.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return L(s,{code:R.invalid_date}),Q}let n=new Me,t;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(t=this._getOrReturnCtx(e,t),L(t,{code:R.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(t=this._getOrReturnCtx(e,t),L(t,{code:R.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):ce.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:H.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:H.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};hr.create=a=>new hr({checks:[],coerce:a?.coerce||!1,typeName:C.ZodDate,...te(a)});var ta=class extends re{_parse(e){if(this._getType(e)!==M.symbol){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.symbol,received:n.parsedType}),Q}return qe(e.data)}};ta.create=a=>new ta({typeName:C.ZodSymbol,...te(a)});var mr=class extends re{_parse(e){if(this._getType(e)!==M.undefined){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.undefined,received:n.parsedType}),Q}return qe(e.data)}};mr.create=a=>new mr({typeName:C.ZodUndefined,...te(a)});var gr=class extends re{_parse(e){if(this._getType(e)!==M.null){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.null,received:n.parsedType}),Q}return qe(e.data)}};gr.create=a=>new gr({typeName:C.ZodNull,...te(a)});var Wt=class extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return qe(e.data)}};Wt.create=a=>new Wt({typeName:C.ZodAny,...te(a)});var Mt=class extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return qe(e.data)}};Mt.create=a=>new Mt({typeName:C.ZodUnknown,...te(a)});var gt=class extends re{_parse(e){let r=this._getOrReturnCtx(e);return L(r,{code:R.invalid_type,expected:M.never,received:r.parsedType}),Q}};gt.create=a=>new gt({typeName:C.ZodNever,...te(a)});var ra=class extends re{_parse(e){if(this._getType(e)!==M.undefined){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.void,received:n.parsedType}),Q}return qe(e.data)}};ra.create=a=>new ra({typeName:C.ZodVoid,...te(a)});var zt=class a extends re{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),t=this._def;if(r.parsedType!==M.array)return L(r,{code:R.invalid_type,expected:M.array,received:r.parsedType}),Q;if(t.exactLength!==null){let o=r.data.length>t.exactLength.value,i=r.data.length<t.exactLength.value;(o||i)&&(L(r,{code:o?R.too_big:R.too_small,minimum:i?t.exactLength.value:void 0,maximum:o?t.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:t.exactLength.message}),n.dirty())}if(t.minLength!==null&&r.data.length<t.minLength.value&&(L(r,{code:R.too_small,minimum:t.minLength.value,type:"array",inclusive:!0,exact:!1,message:t.minLength.message}),n.dirty()),t.maxLength!==null&&r.data.length>t.maxLength.value&&(L(r,{code:R.too_big,maximum:t.maxLength.value,type:"array",inclusive:!0,exact:!1,message:t.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,i)=>t.type._parseAsync(new ct(r,o,r.path,i)))).then(o=>Me.mergeArray(n,o));let s=[...r.data].map((o,i)=>t.type._parseSync(new ct(r,o,r.path,i)));return Me.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:H.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:H.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:H.toString(r)}})}nonempty(e){return this.min(1,e)}};zt.create=(a,e)=>new zt({type:a,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...te(e)});function ea(a){if(a instanceof Qe){let e={};for(let r in a.shape){let n=a.shape[r];e[r]=it.create(ea(n))}return new Qe({...a._def,shape:()=>e})}else return a instanceof zt?new zt({...a._def,type:ea(a.element)}):a instanceof it?it.create(ea(a.unwrap())):a instanceof Pt?Pt.create(ea(a.unwrap())):a instanceof St?St.create(a.items.map(e=>ea(e))):a}var Qe=class a extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ce.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==M.object){let c=this._getOrReturnCtx(e);return L(c,{code:R.invalid_type,expected:M.object,received:c.parsedType}),Q}let{status:n,ctx:t}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof gt&&this._def.unknownKeys==="strip"))for(let c in t.data)o.includes(c)||i.push(c);let d=[];for(let c of o){let u=s[c],h=t.data[c];d.push({key:{status:"valid",value:c},value:u._parse(new ct(t,h,t.path,c)),alwaysSet:c in t.data})}if(this._def.catchall instanceof gt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)d.push({key:{status:"valid",value:u},value:{status:"valid",value:t.data[u]}});else if(c==="strict")i.length>0&&(L(t,{code:R.unrecognized_keys,keys:i}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let h=t.data[u];d.push({key:{status:"valid",value:u},value:c._parse(new ct(t,h,t.path,u)),alwaysSet:u in t.data})}}return t.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of d){let h=await u.key,v=await u.value;c.push({key:h,value:v,alwaysSet:u.alwaysSet})}return c}).then(c=>Me.mergeObjectSync(n,c)):Me.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return H.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let t=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:H.errToObj(e).message??t}:{message:t}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:C.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let n of ce.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ce.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new a({...this._def,shape:()=>r})}deepPartial(){return ea(this)}partial(e){let r={};for(let n of ce.objectKeys(this.shape)){let t=this.shape[n];e&&!e[n]?r[n]=t:r[n]=t.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let n of ce.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof it;)s=s._def.innerType;r[n]=s}return new a({...this._def,shape:()=>r})}keyof(){return Po(ce.objectKeys(this.shape))}};Qe.create=(a,e)=>new Qe({shape:()=>a,unknownKeys:"strip",catchall:gt.create(),typeName:C.ZodObject,...te(e)});Qe.strictCreate=(a,e)=>new Qe({shape:()=>a,unknownKeys:"strict",catchall:gt.create(),typeName:C.ZodObject,...te(e)});Qe.lazycreate=(a,e)=>new Qe({shape:a,unknownKeys:"strip",catchall:gt.create(),typeName:C.ZodObject,...te(e)});var vr=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function t(s){for(let i of s)if(i.result.status==="valid")return i.result;for(let i of s)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(i=>new Ke(i.ctx.common.issues));return L(r,{code:R.invalid_union,unionErrors:o}),Q}if(r.common.async)return Promise.all(n.map(async s=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(t);{let s,o=[];for(let d of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=d._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map(d=>new Ke(d));return L(r,{code:R.invalid_union,unionErrors:i}),Q}}get options(){return this._def.options}};vr.create=(a,e)=>new vr({options:a,typeName:C.ZodUnion,...te(e)});var Nt=a=>a instanceof _r?Nt(a.schema):a instanceof lt?Nt(a.innerType()):a instanceof br?[a.value]:a instanceof xr?a.options:a instanceof wr?ce.objectValues(a.enum):a instanceof kr?Nt(a._def.innerType):a instanceof mr?[void 0]:a instanceof gr?[null]:a instanceof it?[void 0,...Nt(a.unwrap())]:a instanceof Pt?[null,...Nt(a.unwrap())]:a instanceof Ra||a instanceof Pr?Nt(a.unwrap()):a instanceof Sr?Nt(a._def.innerType):[],Za=class a extends re{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==M.object)return L(r,{code:R.invalid_type,expected:M.object,received:r.parsedType}),Q;let n=this.discriminator,t=r.data[n],s=this.optionsMap.get(t);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(L(r,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let t=new Map;for(let s of r){let o=Nt(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(t.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);t.set(i,s)}}return new a({typeName:C.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:t,...te(n)})}};function Xn(a,e){let r=kt(a),n=kt(e);if(a===e)return{valid:!0,data:a};if(r===M.object&&n===M.object){let t=ce.objectKeys(e),s=ce.objectKeys(a).filter(i=>t.indexOf(i)!==-1),o={...a,...e};for(let i of s){let d=Xn(a[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(r===M.array&&n===M.array){if(a.length!==e.length)return{valid:!1};let t=[];for(let s=0;s<a.length;s++){let o=a[s],i=e[s],d=Xn(o,i);if(!d.valid)return{valid:!1};t.push(d.data)}return{valid:!0,data:t}}else return r===M.date&&n===M.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var yr=class extends re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),t=(s,o)=>{if(Va(s)||Va(o))return Q;let i=Xn(s.value,o.value);return i.valid?((Ja(s)||Ja(o))&&r.dirty(),{status:r.value,value:i.data}):(L(n,{code:R.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>t(s,o)):t(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};yr.create=(a,e,r)=>new yr({left:a,right:e,typeName:C.ZodIntersection,...te(r)});var St=class a extends re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.array)return L(n,{code:R.invalid_type,expected:M.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return L(n,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(L(n,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((o,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new ct(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>Me.mergeArray(r,o)):Me.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};St.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new St({items:a,typeName:C.ZodTuple,rest:null,...te(e)})};var Ha=class a extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.object)return L(n,{code:R.invalid_type,expected:M.object,received:n.parsedType}),Q;let t=[],s=this._def.keyType,o=this._def.valueType;for(let i in n.data)t.push({key:s._parse(new ct(n,i,n.path,i)),value:o._parse(new ct(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?Me.mergeObjectAsync(r,t):Me.mergeObjectSync(r,t)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof re?new a({keyType:e,valueType:r,typeName:C.ZodRecord,...te(n)}):new a({keyType:Bt.create(),valueType:e,typeName:C.ZodRecord,...te(r)})}},aa=class extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.map)return L(n,{code:R.invalid_type,expected:M.map,received:n.parsedType}),Q;let t=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([i,d],c)=>({key:t._parse(new ct(n,i,n.path,[c,"key"])),value:s._parse(new ct(n,d,n.path,[c,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of o){let c=await d.key,u=await d.value;if(c.status==="aborted"||u.status==="aborted")return Q;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),i.set(c.value,u.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let d of o){let c=d.key,u=d.value;if(c.status==="aborted"||u.status==="aborted")return Q;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),i.set(c.value,u.value)}return{status:r.value,value:i}}}};aa.create=(a,e,r)=>new aa({valueType:e,keyType:a,typeName:C.ZodMap,...te(r)});var na=class a extends re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.set)return L(n,{code:R.invalid_type,expected:M.set,received:n.parsedType}),Q;let t=this._def;t.minSize!==null&&n.data.size<t.minSize.value&&(L(n,{code:R.too_small,minimum:t.minSize.value,type:"set",inclusive:!0,exact:!1,message:t.minSize.message}),r.dirty()),t.maxSize!==null&&n.data.size>t.maxSize.value&&(L(n,{code:R.too_big,maximum:t.maxSize.value,type:"set",inclusive:!0,exact:!1,message:t.maxSize.message}),r.dirty());let s=this._def.valueType;function o(d){let c=new Set;for(let u of d){if(u.status==="aborted")return Q;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let i=[...n.data.values()].map((d,c)=>s._parse(new ct(n,d,n.path,c)));return n.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,r){return new a({...this._def,minSize:{value:e,message:H.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:H.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};na.create=(a,e)=>new na({valueType:a,minSize:null,maxSize:null,typeName:C.ZodSet,...te(e)});var Ba=class a extends re{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==M.function)return L(r,{code:R.invalid_type,expected:M.function,received:r.parsedType}),Q;function n(i,d){return Ea({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Yr(),Lt].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:d}})}function t(i,d){return Ea({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Yr(),Lt].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:d}})}let s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Kt){let i=this;return qe(async function(...d){let c=new Ke([]),u=await i._def.args.parseAsync(d,s).catch(f=>{throw c.addIssue(n(d,f)),c}),h=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(h,s).catch(f=>{throw c.addIssue(t(h,f)),c})})}else{let i=this;return qe(function(...d){let c=i._def.args.safeParse(d,s);if(!c.success)throw new Ke([n(d,c.error)]);let u=Reflect.apply(o,this,c.data),h=i._def.returns.safeParse(u,s);if(!h.success)throw new Ke([t(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:St.create(e).rest(Mt.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new a({args:e||St.create([]).rest(Mt.create()),returns:r||Mt.create(),typeName:C.ZodFunction,...te(n)})}},_r=class extends re{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};_r.create=(a,e)=>new _r({getter:a,typeName:C.ZodLazy,...te(e)});var br=class extends re{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return L(r,{received:r.data,code:R.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};br.create=(a,e)=>new br({value:a,typeName:C.ZodLiteral,...te(e)});function Po(a,e){return new xr({values:a,typeName:C.ZodEnum,...te(e)})}var xr=class a extends re{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return L(r,{expected:ce.joinValues(n),received:r.parsedType,code:R.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return L(r,{received:r.data,code:R.invalid_enum_value,options:n}),Q}return qe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};xr.create=Po;var wr=class extends re{_parse(e){let r=ce.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==M.string&&n.parsedType!==M.number){let t=ce.objectValues(r);return L(n,{expected:ce.joinValues(t),received:n.parsedType,code:R.invalid_type}),Q}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let t=ce.objectValues(r);return L(n,{received:n.data,code:R.invalid_enum_value,options:t}),Q}return qe(e.data)}get enum(){return this._def.values}};wr.create=(a,e)=>new wr({values:a,typeName:C.ZodNativeEnum,...te(e)});var Kt=class extends re{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==M.promise&&r.common.async===!1)return L(r,{code:R.invalid_type,expected:M.promise,received:r.parsedType}),Q;let n=r.parsedType===M.promise?r.data:Promise.resolve(r.data);return qe(n.then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Kt.create=(a,e)=>new Kt({type:a,typeName:C.ZodPromise,...te(e)});var lt=class extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),t=this._def.effect||null,s={addIssue:o=>{L(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),t.type==="preprocess"){let o=t.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async i=>{if(r.value==="aborted")return Q;let d=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return d.status==="aborted"?Q:d.status==="dirty"?dr(d.value):r.value==="dirty"?dr(d.value):d});{if(r.value==="aborted")return Q;let i=this._def.schema._parseSync({data:o,path:n.path,parent:n});return i.status==="aborted"?Q:i.status==="dirty"?dr(i.value):r.value==="dirty"?dr(i.value):i}}if(t.type==="refinement"){let o=i=>{let d=t.refinement(i,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Q:(i.status==="dirty"&&r.dirty(),o(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?Q:(i.status==="dirty"&&r.dirty(),o(i.value).then(()=>({status:r.value,value:i.value}))))}if(t.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ht(o))return Q;let i=t.transform(o.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Ht(o)?Promise.resolve(t.transform(o.value,s)).then(i=>({status:r.value,value:i})):Q);ce.assertNever(t)}};lt.create=(a,e,r)=>new lt({schema:a,typeName:C.ZodEffects,effect:e,...te(r)});lt.createWithPreprocess=(a,e,r)=>new lt({schema:e,effect:{type:"preprocess",transform:a},typeName:C.ZodEffects,...te(r)});var it=class extends re{_parse(e){return this._getType(e)===M.undefined?qe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};it.create=(a,e)=>new it({innerType:a,typeName:C.ZodOptional,...te(e)});var Pt=class extends re{_parse(e){return this._getType(e)===M.null?qe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pt.create=(a,e)=>new Pt({innerType:a,typeName:C.ZodNullable,...te(e)});var kr=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};kr.create=(a,e)=>new kr({innerType:a,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...te(e)});var Sr=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},t=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xr(t)?t.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ke(n.common.issues)},input:n.data})})):{status:"valid",value:t.status==="valid"?t.value:this._def.catchValue({get error(){return new Ke(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Sr.create=(a,e)=>new Sr({innerType:a,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...te(e)});var sa=class extends re{_parse(e){if(this._getType(e)!==M.nan){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.nan,received:n.parsedType}),Q}return{status:"valid",value:e.data}}};sa.create=a=>new sa({typeName:C.ZodNaN,...te(a)});var fu=Symbol("zod_brand"),Ra=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ta=class a extends re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Q:s.status==="dirty"?(r.dirty(),dr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let t=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return t.status==="aborted"?Q:t.status==="dirty"?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:n.path,parent:n})}}static create(e,r){return new a({in:e,out:r,typeName:C.ZodPipeline})}},Pr=class extends re{_parse(e){let r=this._def.innerType._parse(e),n=t=>(Ht(t)&&(t.value=Object.freeze(t.value)),t);return Xr(r)?r.then(t=>n(t)):n(r)}unwrap(){return this._def.innerType}};Pr.create=(a,e)=>new Pr({innerType:a,typeName:C.ZodReadonly,...te(e)});function xo(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function Eo(a,e={},r){return a?Wt.create().superRefine((n,t)=>{let s=a(n);if(s instanceof Promise)return s.then(o=>{if(!o){let i=xo(e,n),d=i.fatal??r??!0;t.addIssue({code:"custom",...i,fatal:d})}});if(!s){let o=xo(e,n),i=o.fatal??r??!0;t.addIssue({code:"custom",...o,fatal:i})}}):Wt.create()}var pu={object:Qe.lazycreate},C;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(C||(C={}));var hu=(a,e={message:`Input not instance of ${a.name}`})=>Eo(r=>r instanceof a,e),Ro=Bt.create,To=ur.create,mu=sa.create,gu=fr.create,Oo=pr.create,vu=hr.create,yu=ta.create,_u=mr.create,bu=gr.create,xu=Wt.create,wu=Mt.create,ku=gt.create,Su=ra.create,Pu=zt.create,Eu=Qe.create,Ru=Qe.strictCreate,Tu=vr.create,Ou=Za.create,Cu=yr.create,Au=St.create,ju=Ha.create,Iu=aa.create,$u=na.create,Du=Ba.create,Lu=_r.create,Nu=br.create,Mu=xr.create,zu=wr.create,Fu=Kt.create,Uu=lt.create,qu=it.create,Vu=Pt.create,Ju=lt.createWithPreprocess,Zu=Ta.create,Hu=()=>Ro().optional(),Bu=()=>To().optional(),Wu=()=>Oo().optional(),Ku={string:(a=>Bt.create({...a,coerce:!0})),number:(a=>ur.create({...a,coerce:!0})),boolean:(a=>pr.create({...a,coerce:!0})),bigint:(a=>fr.create({...a,coerce:!0})),date:(a=>hr.create({...a,coerce:!0}))};var Qu=Q;var es="2025-06-18";var Co=[es,"2025-03-26","2024-11-05","2024-10-07"],Wa="2.0",Ao=l.union([l.string(),l.number().int()]),jo=l.string(),Gu=l.object({progressToken:l.optional(Ao)}).passthrough(),dt=l.object({_meta:l.optional(Gu)}).passthrough(),Ge=l.object({method:l.string(),params:l.optional(dt)}),Oa=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),Et=l.object({method:l.string(),params:l.optional(Oa)}),ut=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ka=l.union([l.string(),l.number().int()]),Io=l.object({jsonrpc:l.literal(Wa),id:Ka}).merge(Ge).strict(),$o=a=>Io.safeParse(a).success,Do=l.object({jsonrpc:l.literal(Wa)}).merge(Et).strict(),Lo=a=>Do.safeParse(a).success,No=l.object({jsonrpc:l.literal(Wa),id:Ka,result:ut}).strict(),ts=a=>No.safeParse(a).success,we;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(we||(we={}));var Mo=l.object({jsonrpc:l.literal(Wa),id:Ka,error:l.object({code:l.number().int(),message:l.string(),data:l.optional(l.unknown())})}).strict(),zo=a=>Mo.safeParse(a).success,Fo=l.union([Io,Do,No,Mo]),Qa=ut.strict(),Ga=Et.extend({method:l.literal("notifications/cancelled"),params:Oa.extend({requestId:Ka,reason:l.string().optional()})}),Ya=l.object({src:l.string(),mimeType:l.optional(l.string()),sizes:l.optional(l.string())}).passthrough(),Ca=l.object({name:l.string(),title:l.optional(l.string())}).passthrough(),Uo=Ca.extend({version:l.string(),websiteUrl:l.optional(l.string()),icons:l.optional(l.array(Ya))}),Yu=l.object({experimental:l.optional(l.object({}).passthrough()),sampling:l.optional(l.object({}).passthrough()),elicitation:l.optional(l.object({}).passthrough()),roots:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),rs=Ge.extend({method:l.literal("initialize"),params:dt.extend({protocolVersion:l.string(),capabilities:Yu,clientInfo:Uo})});var Xu=l.object({experimental:l.optional(l.object({}).passthrough()),logging:l.optional(l.object({}).passthrough()),completions:l.optional(l.object({}).passthrough()),prompts:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough()),resources:l.optional(l.object({subscribe:l.optional(l.boolean()),listChanged:l.optional(l.boolean())}).passthrough()),tools:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),ef=ut.extend({protocolVersion:l.string(),capabilities:Xu,serverInfo:Uo,instructions:l.optional(l.string())}),as=Et.extend({method:l.literal("notifications/initialized")});var Xa=Ge.extend({method:l.literal("ping")}),tf=l.object({progress:l.number(),total:l.optional(l.number()),message:l.optional(l.string())}).passthrough(),en=Et.extend({method:l.literal("notifications/progress"),params:Oa.merge(tf).extend({progressToken:Ao})}),tn=Ge.extend({params:dt.extend({cursor:l.optional(jo)}).optional()}),rn=ut.extend({nextCursor:l.optional(jo)}),qo=l.object({uri:l.string(),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Vo=qo.extend({text:l.string()}),ns=l.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),Jo=qo.extend({blob:ns}),Zo=Ca.extend({uri:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),icons:l.optional(l.array(Ya)),_meta:l.optional(l.object({}).passthrough())}),rf=Ca.extend({uriTemplate:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),oa=tn.extend({method:l.literal("resources/list")}),af=rn.extend({resources:l.array(Zo)}),ia=tn.extend({method:l.literal("resources/templates/list")}),nf=rn.extend({resourceTemplates:l.array(rf)}),an=Ge.extend({method:l.literal("resources/read"),params:dt.extend({uri:l.string()})}),sf=ut.extend({contents:l.array(l.union([Vo,Jo]))}),of=Et.extend({method:l.literal("notifications/resources/list_changed")}),cf=Ge.extend({method:l.literal("resources/subscribe"),params:dt.extend({uri:l.string()})}),lf=Ge.extend({method:l.literal("resources/unsubscribe"),params:dt.extend({uri:l.string()})}),df=Et.extend({method:l.literal("notifications/resources/updated"),params:Oa.extend({uri:l.string()})}),uf=l.object({name:l.string(),description:l.optional(l.string()),required:l.optional(l.boolean())}).passthrough(),ff=Ca.extend({description:l.optional(l.string()),arguments:l.optional(l.array(uf)),icons:l.optional(l.array(Ya)),_meta:l.optional(l.object({}).passthrough())}),nn=tn.extend({method:l.literal("prompts/list")}),pf=rn.extend({prompts:l.array(ff)}),sn=Ge.extend({method:l.literal("prompts/get"),params:dt.extend({name:l.string(),arguments:l.optional(l.record(l.string()))})}),ss=l.object({type:l.literal("text"),text:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),os=l.object({type:l.literal("image"),data:ns,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),is=l.object({type:l.literal("audio"),data:ns,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),hf=l.object({type:l.literal("resource"),resource:l.union([Vo,Jo]),_meta:l.optional(l.object({}).passthrough())}).passthrough(),mf=Zo.extend({type:l.literal("resource_link")}),Ho=l.union([ss,os,is,mf,hf]),gf=l.object({role:l.enum(["user","assistant"]),content:Ho}).passthrough(),vf=ut.extend({description:l.optional(l.string()),messages:l.array(gf)}),yf=Et.extend({method:l.literal("notifications/prompts/list_changed")}),_f=l.object({title:l.optional(l.string()),readOnlyHint:l.optional(l.boolean()),destructiveHint:l.optional(l.boolean()),idempotentHint:l.optional(l.boolean()),openWorldHint:l.optional(l.boolean())}).passthrough(),bf=Ca.extend({description:l.optional(l.string()),inputSchema:l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough(),outputSchema:l.optional(l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough()),annotations:l.optional(_f),icons:l.optional(l.array(Ya)),_meta:l.optional(l.object({}).passthrough())}),on=tn.extend({method:l.literal("tools/list")}),xf=rn.extend({tools:l.array(bf)}),Bo=ut.extend({content:l.array(Ho).default([]),structuredContent:l.object({}).passthrough().optional(),isError:l.optional(l.boolean())}),Fv=Bo.or(ut.extend({toolResult:l.unknown()})),cn=Ge.extend({method:l.literal("tools/call"),params:dt.extend({name:l.string(),arguments:l.optional(l.record(l.unknown()))})}),wf=Et.extend({method:l.literal("notifications/tools/list_changed")}),Aa=l.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),cs=Ge.extend({method:l.literal("logging/setLevel"),params:dt.extend({level:Aa})}),kf=Et.extend({method:l.literal("notifications/message"),params:Oa.extend({level:Aa,logger:l.optional(l.string()),data:l.unknown()})}),Sf=l.object({name:l.string().optional()}).passthrough(),Pf=l.object({hints:l.optional(l.array(Sf)),costPriority:l.optional(l.number().min(0).max(1)),speedPriority:l.optional(l.number().min(0).max(1)),intelligencePriority:l.optional(l.number().min(0).max(1))}).passthrough(),Ef=l.object({role:l.enum(["user","assistant"]),content:l.union([ss,os,is])}).passthrough(),Rf=Ge.extend({method:l.literal("sampling/createMessage"),params:dt.extend({messages:l.array(Ef),systemPrompt:l.optional(l.string()),includeContext:l.optional(l.enum(["none","thisServer","allServers"])),temperature:l.optional(l.number()),maxTokens:l.number().int(),stopSequences:l.optional(l.array(l.string())),metadata:l.optional(l.object({}).passthrough()),modelPreferences:l.optional(Pf)})}),ls=ut.extend({model:l.string(),stopReason:l.optional(l.enum(["endTurn","stopSequence","maxTokens"]).or(l.string())),role:l.enum(["user","assistant"]),content:l.discriminatedUnion("type",[ss,os,is])}),Tf=l.object({type:l.literal("boolean"),title:l.optional(l.string()),description:l.optional(l.string()),default:l.optional(l.boolean())}).passthrough(),Of=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),minLength:l.optional(l.number()),maxLength:l.optional(l.number()),format:l.optional(l.enum(["email","uri","date","date-time"]))}).passthrough(),Cf=l.object({type:l.enum(["number","integer"]),title:l.optional(l.string()),description:l.optional(l.string()),minimum:l.optional(l.number()),maximum:l.optional(l.number())}).passthrough(),Af=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),enum:l.array(l.string()),enumNames:l.optional(l.array(l.string()))}).passthrough(),jf=l.union([Tf,Of,Cf,Af]),If=Ge.extend({method:l.literal("elicitation/create"),params:dt.extend({message:l.string(),requestedSchema:l.object({type:l.literal("object"),properties:l.record(l.string(),jf),required:l.optional(l.array(l.string()))}).passthrough()})}),ds=ut.extend({action:l.enum(["accept","decline","cancel"]),content:l.optional(l.record(l.string(),l.unknown()))}),$f=l.object({type:l.literal("ref/resource"),uri:l.string()}).passthrough();var Df=l.object({type:l.literal("ref/prompt"),name:l.string()}).passthrough(),ln=Ge.extend({method:l.literal("completion/complete"),params:dt.extend({ref:l.union([Df,$f]),argument:l.object({name:l.string(),value:l.string()}).passthrough(),context:l.optional(l.object({arguments:l.optional(l.record(l.string(),l.string()))}))})}),Lf=ut.extend({completion:l.object({values:l.array(l.string()).max(100),total:l.optional(l.number().int()),hasMore:l.optional(l.boolean())}).passthrough()}),Nf=l.object({uri:l.string().startsWith("file://"),name:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Mf=Ge.extend({method:l.literal("roots/list")}),us=ut.extend({roots:l.array(Nf)}),zf=Et.extend({method:l.literal("notifications/roots/list_changed")}),Uv=l.union([Xa,rs,ln,cs,sn,nn,oa,ia,an,cf,lf,cn,on]),qv=l.union([Ga,en,as,zf]),Vv=l.union([Qa,ls,ds,us]),Jv=l.union([Xa,Rf,If,Mf]),Zv=l.union([Ga,en,kf,df,of,wf,yf]),Hv=l.union([Qa,ef,Lf,vf,pf,af,nf,sf,Bo,xf]),ke=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}};var Ff=6e4,dn=class{constructor(e){this._options=e,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(Ga,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(en,r=>{this._onprogress(r)}),this.setRequestHandler(Xa,r=>({}))}_setupTimeout(e,r,n,t,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(t,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:t})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ke(we.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,t;this._transport=e;let s=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};let o=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=d=>{o?.(d),this._onerror(d)};let i=(t=this._transport)===null||t===void 0?void 0:t.onmessage;this._transport.onmessage=(d,c)=>{i?.(d,c),ts(d)||zo(d)?this._onresponse(d):$o(d)?this._onrequest(d,c):Lo(d)?this._onnotification(d):this._onerror(new Error(`Unknown message type: ${JSON.stringify(d)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new ke(we.ConnectionClosed,"Connection closed");for(let t of r.values())t(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(t=>this._onerror(new Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(e,r){var n,t;let s=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,o=this._transport;if(s===void 0){o?.send({jsonrpc:"2.0",id:e.id,error:{code:we.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let d={signal:i.signal,sessionId:o?.sessionId,_meta:(t=e.params)===null||t===void 0?void 0:t._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,u,h)=>this.request(c,u,{...h,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>s(e,d)).then(c=>{if(!i.signal.aborted)return o?.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var u;if(!i.signal.aborted)return o?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:we.InternalError,message:(u=c.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,t=Number(r),s=this._progressHandlers.get(t);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(t),i=this._timeoutInfo.get(t);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(t)}catch(d){o(d);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),ts(e))n(e);else{let t=new ke(e.error.code,e.error.message,e.error.data);n(t)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:t,resumptionToken:s,onresumptiontoken:o}=n??{};return new Promise((i,d)=>{var c,u,h,v,f,y;if(!this._transport){d(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=n?.signal)===null||u===void 0||u.throwIfAborted();let b=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:b};n?.onprogress&&(this._progressHandlers.set(b,n.onprogress),g.params={...e.params,_meta:{...((h=e.params)===null||h===void 0?void 0:h._meta)||{},progressToken:b}});let S=O=>{var j;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(j=this._transport)===null||j===void 0||j.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(O)}},{relatedRequestId:t,resumptionToken:s,onresumptiontoken:o}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),d(O)};this._responseHandlers.set(b,O=>{var j;if(!(!((j=n?.signal)===null||j===void 0)&&j.aborted)){if(O instanceof Error)return d(O);try{let I=r.parse(O.result);i(I)}catch(I){d(I)}}}),(v=n?.signal)===null||v===void 0||v.addEventListener("abort",()=>{var O;S((O=n?.signal)===null||O===void 0?void 0:O.reason)});let E=(f=n?.timeout)!==null&&f!==void 0?f:Ff,P=()=>S(new ke(we.RequestTimeout,"Request timed out",{timeout:E}));this._setupTimeout(b,E,n?.maxTotalTimeout,P,(y=n?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(g,{relatedRequestId:t,resumptionToken:s,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(b),d(O)})})}async notification(e,r){var n,t;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((t=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&t!==void 0?t:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var d;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(d=this._transport)===null||d===void 0||d.send(c,r).catch(u=>this._onerror(u))});return}let i={...e,jsonrpc:"2.0"};await this._transport.send(i,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(t,s)=>Promise.resolve(r(e.parse(t),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Wo(a,e){return Object.entries(e).reduce((r,[n,t])=>(t&&typeof t=="object"?r[n]=r[n]?{...r[n],...t}:t:r[n]=t,r),{...a})}var Qc=Fd(Kc(),1),On=class extends dn{constructor(e,r){var n;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Aa.options.map((t,s)=>[t,s])),this.isMessageIgnored=(t,s)=>{let o=this._loggingLevels.get(s);return o?this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._instructions=r?.instructions,this.setRequestHandler(rs,t=>this._oninitialize(t)),this.setNotificationHandler(as,()=>{var t;return(t=this.oninitialized)===null||t===void 0?void 0:t.call(this)}),this._capabilities.logging&&this.setRequestHandler(cs,async(t,s)=>{var o;let i=s.sessionId||((o=s.requestInfo)===null||o===void 0?void 0:o.headers["mcp-session-id"])||void 0,{level:d}=t.params,c=Aa.safeParse(d);return c.success&&this._loggingLevels.set(i,c.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Wo(this._capabilities,e)}assertCapabilityForMethod(e){var r,n,t;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);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 ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);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 ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Co.includes(r)?r:es,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"},Qa)}async createMessage(e,r){return this.request({method:"sampling/createMessage",params:e},ls,r)}async elicitInput(e,r){let n=await this.request({method:"elicitation/create",params:e},ds,r);if(n.action==="accept"&&n.content)try{let t=new Qc.default,s=t.compile(e.requestedSchema);if(!s(n.content))throw new ke(we.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorsText(s.errors)}`)}catch(t){throw t instanceof ke?t:new ke(we.InternalError,`Error validating elicitation response: ${t}`)}return n}async listRoots(e,r){return this.request({method:"roots/list",params:e},us,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}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 Yc=Symbol("Let zodToJsonSchema decide on which parser to use");var Gc={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"},Xc=a=>typeof a=="string"?{...Gc,name:a}:{...Gc,...a};var el=a=>{let e=Xc(a),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,t])=>[t._def,{def:t._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function Ls(a,e,r,n){n?.errorMessages&&r&&(a.errorMessage={...a.errorMessage,[e]:r})}function de(a,e,r,n,t){a[e]=r,Ls(a,e,n,t)}var Cn=(a,e)=>{let r=0;for(;r<a.length&&r<e.length&&a[r]===e[r];r++);return[(a.length-r).toString(),...e.slice(r)].join("/")};function Pe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?Cn(e,a.currentPath):e.join("/")}}function tl(a,e){let r={type:"array"};return a.type?._def&&a.type?._def?.typeName!==C.ZodAny&&(r.items=Y(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&de(r,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&de(r,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(de(r,"minItems",a.exactLength.value,a.exactLength.message,e),de(r,"maxItems",a.exactLength.value,a.exactLength.message,e)),r}function rl(a,e){let r={type:"integer",format:"int64"};if(!a.checks)return r;for(let n of a.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?de(r,"minimum",n.value,n.message,e):de(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),de(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?de(r,"maximum",n.value,n.message,e):de(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),de(r,"maximum",n.value,n.message,e));break;case"multipleOf":de(r,"multipleOf",n.value,n.message,e);break}return r}function al(){return{type:"boolean"}}function An(a,e){return Y(a.type._def,e)}var nl=(a,e)=>Y(a.innerType._def,e);function Ns(a,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((t,s)=>Ns(a,e,t))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return _h(a,e)}}var _h=(a,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of a.checks)switch(n.kind){case"min":de(r,"minimum",n.value,n.message,e);break;case"max":de(r,"maximum",n.value,n.message,e);break}return r};function sl(a,e){return{...Y(a.innerType._def,e),default:a.defaultValue()}}function ol(a,e){return e.effectStrategy==="input"?Y(a.schema._def,e):Pe(e)}function il(a){return{type:"string",enum:Array.from(a.values)}}var bh=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function cl(a,e){let r=[Y(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Y(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,t=[];return r.forEach(s=>{if(bh(s))t.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:i,...d}=s;o=d}else n=void 0;t.push(o)}}),t.length?{allOf:t,...n}:void 0}function ll(a,e){let r=typeof a.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[a.value]}:{type:r==="bigint"?"integer":r,const:a.value}}var Ms,vt={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:()=>(Ms===void 0&&(Ms=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ms),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 jn(a,e){let r={type:"string"};if(a.checks)for(let n of a.checks)switch(n.kind){case"min":de(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":de(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":yt(r,"email",n.message,e);break;case"format:idn-email":yt(r,"idn-email",n.message,e);break;case"pattern:zod":Be(r,vt.email,n.message,e);break}break;case"url":yt(r,"uri",n.message,e);break;case"uuid":yt(r,"uuid",n.message,e);break;case"regex":Be(r,n.regex,n.message,e);break;case"cuid":Be(r,vt.cuid,n.message,e);break;case"cuid2":Be(r,vt.cuid2,n.message,e);break;case"startsWith":Be(r,RegExp(`^${zs(n.value,e)}`),n.message,e);break;case"endsWith":Be(r,RegExp(`${zs(n.value,e)}$`),n.message,e);break;case"datetime":yt(r,"date-time",n.message,e);break;case"date":yt(r,"date",n.message,e);break;case"time":yt(r,"time",n.message,e);break;case"duration":yt(r,"duration",n.message,e);break;case"length":de(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),de(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Be(r,RegExp(zs(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&yt(r,"ipv4",n.message,e),n.version!=="v4"&&yt(r,"ipv6",n.message,e);break}case"base64url":Be(r,vt.base64url,n.message,e);break;case"jwt":Be(r,vt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Be(r,vt.ipv4Cidr,n.message,e),n.version!=="v4"&&Be(r,vt.ipv6Cidr,n.message,e);break}case"emoji":Be(r,vt.emoji(),n.message,e);break;case"ulid":{Be(r,vt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{yt(r,"binary",n.message,e);break}case"contentEncoding:base64":{de(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Be(r,vt.base64,n.message,e);break}}break}case"nanoid":Be(r,vt.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function zs(a,e){return e.patternStrategy==="escape"?wh(a):a}var xh=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function wh(a){let e="";for(let r=0;r<a.length;r++)xh.has(a[r])||(e+="\\"),e+=a[r];return e}function yt(a,e,r,n){a.format||a.anyOf?.some(t=>t.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&n.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):de(a,"format",e,r,n)}function Be(a,e,r,n){a.pattern||a.allOf?.some(t=>t.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&n.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:dl(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):de(a,"pattern",dl(e,n),r,n)}function dl(a,e){if(!e.applyRegexFlags||!a.flags)return a.source;let r={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},n=r.i?a.source.toLowerCase():a.source,t="",s=!1,o=!1,i=!1;for(let d=0;d<n.length;d++){if(s){t+=n[d],s=!1;continue}if(r.i){if(o){if(n[d].match(/[a-z]/)){i?(t+=n[d],t+=`${n[d-2]}-${n[d]}`.toUpperCase(),i=!1):n[d+1]==="-"&&n[d+2]?.match(/[a-z]/)?(t+=n[d],i=!0):t+=`${n[d]}${n[d].toUpperCase()}`;continue}}else if(n[d].match(/[a-z]/)){t+=`[${n[d]}${n[d].toUpperCase()}]`;continue}}if(r.m){if(n[d]==="^"){t+=`(^|(?<=[\r
3
+ var $d=Object.create;var Qn=Object.defineProperty;var Dd=Object.getOwnPropertyDescriptor;var Ld=Object.getOwnPropertyNames;var Nd=Object.getPrototypeOf,Md=Object.prototype.hasOwnProperty;var ee=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),yo=(a,e)=>{for(var r in e)Qn(a,r,{get:e[r],enumerable:!0})},zd=(a,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of Ld(e))!Md.call(a,t)&&t!==r&&Qn(a,t,{get:()=>e[t],enumerable:!(n=Dd(e,t))||n.enumerable});return a};var Fd=(a,e,r)=>(r=a!=null?$d(Nd(a)):{},zd(e||!a||!a.__esModule?Qn(r,"default",{value:a,enumerable:!0}):r,a));var Qo=ee((un,Ko)=>{(function(a,e){typeof un=="object"&&typeof Ko<"u"?e(un):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(un,(function(a){"use strict";function e(){for(var m=arguments.length,f=Array(m),_=0;_<m;_++)f[_]=arguments[_];if(f.length>1){f[0]=f[0].slice(0,-1);for(var w=f.length-1,k=1;k<w;++k)f[k]=f[k].slice(1,-1);return f[w]=f[w].slice(1),f.join("")}else return f[0]}function r(m){return"(?:"+m+")"}function n(m){return m===void 0?"undefined":m===null?"null":Object.prototype.toString.call(m).split(" ").pop().split("]").shift().toLowerCase()}function t(m){return m.toUpperCase()}function s(m){return m!=null?m instanceof Array?m:typeof m.length!="number"||m.split||m.setInterval||m.call?[m]:Array.prototype.slice.call(m):[]}function o(m,f){var _=m;if(f)for(var w in f)_[w]=f[w];return _}function i(m){var f="[A-Za-z]",_="[\\x0D]",w="[0-9]",k="[\\x22]",F=e(w,"[A-Fa-f]"),ne="[\\x0A]",fe="[\\x20]",ve=r(r("%[EFef]"+F+"%"+F+F+"%"+F+F)+"|"+r("%[89A-Fa-f]"+F+"%"+F+F)+"|"+r("%"+F+F)),$e="[\\:\\/\\?\\#\\[\\]\\@]",pe="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Ee=e($e,pe),De=m?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Se=m?"[\\uE000-\\uF8FF]":"[]",me=e(f,w,"[\\-\\.\\_\\~]",De),Re=r(f+e(f,w,"[\\+\\-\\.]")+"*"),be=r(r(ve+"|"+e(me,pe,"[\\:]"))+"*"),ir=r(r("25[0-5]")+"|"+r("2[0-4]"+w)+"|"+r("1"+w+w)+"|"+r("[1-9]"+w)+"|"+w),rt=r(r("25[0-5]")+"|"+r("2[0-4]"+w)+"|"+r("1"+w+w)+"|"+r("0?[1-9]"+w)+"|0?0?"+w),st=r(rt+"\\."+rt+"\\."+rt+"\\."+rt),xe=r(F+"{1,4}"),at=r(r(xe+"\\:"+xe)+"|"+st),ot=r(r(xe+"\\:")+"{6}"+at),wt=r("\\:\\:"+r(xe+"\\:")+"{5}"+at),cr=r(r(xe)+"?\\:\\:"+r(xe+"\\:")+"{4}"+at),jt=r(r(r(xe+"\\:")+"{0,1}"+xe)+"?\\:\\:"+r(xe+"\\:")+"{3}"+at),xa=r(r(r(xe+"\\:")+"{0,2}"+xe)+"?\\:\\:"+r(xe+"\\:")+"{2}"+at),Fa=r(r(r(xe+"\\:")+"{0,3}"+xe)+"?\\:\\:"+xe+"\\:"+at),Ua=r(r(r(xe+"\\:")+"{0,4}"+xe)+"?\\:\\:"+at),Hr=r(r(r(xe+"\\:")+"{0,5}"+xe)+"?\\:\\:"+xe),Br=r(r(r(xe+"\\:")+"{0,6}"+xe)+"?\\:\\:"),$t=r([ot,wt,cr,jt,xa,Fa,Ua,Hr,Br].join("|")),Wr=r(r(me+"|"+ve)+"+"),Wn=r($t+"\\%25"+Wr),lr=r($t+r("\\%25|\\%(?!"+F+"{2})")+Wr),Rd=r("[vV]"+F+"+\\."+e(me,pe,"[\\:]")+"+"),Td=r("\\["+r(lr+"|"+$t+"|"+Rd)+"\\]"),ho=r(r(ve+"|"+e(me,pe))+"*"),wa=r(Td+"|"+st+"(?!"+ho+")|"+ho),ka=r(w+"*"),mo=r(r(be+"@")+"?"+wa+r("\\:"+ka)+"?"),Sa=r(ve+"|"+e(me,pe,"[\\:\\@]")),Od=r(Sa+"*"),go=r(Sa+"+"),Cd=r(r(ve+"|"+e(me,pe,"[\\@]"))+"+"),Dt=r(r("\\/"+Od)+"*"),Kr=r("\\/"+r(go+Dt)+"?"),Kn=r(Cd+Dt),qa=r(go+Dt),Qr="(?!"+Sa+")",nv=r(Dt+"|"+Kr+"|"+Kn+"|"+qa+"|"+Qr),Gr=r(r(Sa+"|"+e("[\\/\\?]",Se))+"*"),Pa=r(r(Sa+"|[\\/\\?]")+"*"),vo=r(r("\\/\\/"+mo+Dt)+"|"+Kr+"|"+qa+"|"+Qr),Ad=r(Re+"\\:"+vo+r("\\?"+Gr)+"?"+r("\\#"+Pa)+"?"),Id=r(r("\\/\\/"+mo+Dt)+"|"+Kr+"|"+Kn+"|"+Qr),jd=r(Id+r("\\?"+Gr)+"?"+r("\\#"+Pa)+"?"),sv=r(Ad+"|"+jd),ov=r(Re+"\\:"+vo+r("\\?"+Gr)+"?"),iv="^("+Re+")\\:"+r(r("\\/\\/("+r("("+be+")@")+"?("+wa+")"+r("\\:("+ka+")")+"?)")+"?("+Dt+"|"+Kr+"|"+qa+"|"+Qr+")")+r("\\?("+Gr+")")+"?"+r("\\#("+Pa+")")+"?$",cv="^(){0}"+r(r("\\/\\/("+r("("+be+")@")+"?("+wa+")"+r("\\:("+ka+")")+"?)")+"?("+Dt+"|"+Kr+"|"+Kn+"|"+Qr+")")+r("\\?("+Gr+")")+"?"+r("\\#("+Pa+")")+"?$",lv="^("+Re+")\\:"+r(r("\\/\\/("+r("("+be+")@")+"?("+wa+")"+r("\\:("+ka+")")+"?)")+"?("+Dt+"|"+Kr+"|"+qa+"|"+Qr+")")+r("\\?("+Gr+")")+"?$",dv="^"+r("\\#("+Pa+")")+"?$",uv="^"+r("("+be+")@")+"?("+wa+")"+r("\\:("+ka+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",f,w,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",me,pe),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",me,pe),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",me,pe),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",me,pe),"g"),NOT_QUERY:new RegExp(e("[^\\%]",me,pe,"[\\:\\@\\/\\?]",Se),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",me,pe,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",me,pe),"g"),UNRESERVED:new RegExp(me,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",me,Ee),"g"),PCT_ENCODED:new RegExp(ve,"g"),IPV4ADDRESS:new RegExp("^("+st+")$"),IPV6ADDRESS:new RegExp("^\\[?("+$t+")"+r(r("\\%25|\\%(?!"+F+"{2})")+"("+Wr+")")+"?\\]?$")}}var d=i(!1),c=i(!0),u=(function(){function m(f,_){var w=[],k=!0,F=!1,ne=void 0;try{for(var fe=f[Symbol.iterator](),ve;!(k=(ve=fe.next()).done)&&(w.push(ve.value),!(_&&w.length===_));k=!0);}catch($e){F=!0,ne=$e}finally{try{!k&&fe.return&&fe.return()}finally{if(F)throw ne}}return w}return function(f,_){if(Array.isArray(f))return f;if(Symbol.iterator in Object(f))return m(f,_);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),h=function(m){if(Array.isArray(m)){for(var f=0,_=Array(m.length);f<m.length;f++)_[f]=m[f];return _}else return Array.from(m)},v=2147483647,p=36,y=1,b=26,g=38,S=700,E=72,P=128,O="-",I=/^xn--/,j=/[^\0-\x7E]/,W=/[\x2E\u3002\uFF0E\uFF61]/g,J={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=p-y,Z=Math.floor,V=String.fromCharCode;function U(m){throw new RangeError(J[m])}function A(m,f){for(var _=[],w=m.length;w--;)_[w]=f(m[w]);return _}function D(m,f){var _=m.split("@"),w="";_.length>1&&(w=_[0]+"@",m=_[1]),m=m.replace(W,".");var k=m.split("."),F=A(k,f).join(".");return w+F}function q(m){for(var f=[],_=0,w=m.length;_<w;){var k=m.charCodeAt(_++);if(k>=55296&&k<=56319&&_<w){var F=m.charCodeAt(_++);(F&64512)==56320?f.push(((k&1023)<<10)+(F&1023)+65536):(f.push(k),_--)}else f.push(k)}return f}var _e=function(f){return String.fromCodePoint.apply(String,h(f))},ie=function(f){return f-48<10?f-22:f-65<26?f-65:f-97<26?f-97:p},ue=function(f,_){return f+22+75*(f<26)-((_!=0)<<5)},oe=function(f,_,w){var k=0;for(f=w?Z(f/S):f>>1,f+=Z(f/_);f>$*b>>1;k+=p)f=Z(f/$);return Z(k+($+1)*f/(f+g))},K=function(f){var _=[],w=f.length,k=0,F=P,ne=E,fe=f.lastIndexOf(O);fe<0&&(fe=0);for(var ve=0;ve<fe;++ve)f.charCodeAt(ve)>=128&&U("not-basic"),_.push(f.charCodeAt(ve));for(var $e=fe>0?fe+1:0;$e<w;){for(var pe=k,Ee=1,De=p;;De+=p){$e>=w&&U("invalid-input");var Se=ie(f.charCodeAt($e++));(Se>=p||Se>Z((v-k)/Ee))&&U("overflow"),k+=Se*Ee;var me=De<=ne?y:De>=ne+b?b:De-ne;if(Se<me)break;var Re=p-me;Ee>Z(v/Re)&&U("overflow"),Ee*=Re}var be=_.length+1;ne=oe(k-pe,be,pe==0),Z(k/be)>v-F&&U("overflow"),F+=Z(k/be),k%=be,_.splice(k++,0,F)}return String.fromCodePoint.apply(String,_)},Oe=function(f){var _=[];f=q(f);var w=f.length,k=P,F=0,ne=E,fe=!0,ve=!1,$e=void 0;try{for(var pe=f[Symbol.iterator](),Ee;!(fe=(Ee=pe.next()).done);fe=!0){var De=Ee.value;De<128&&_.push(V(De))}}catch(lr){ve=!0,$e=lr}finally{try{!fe&&pe.return&&pe.return()}finally{if(ve)throw $e}}var Se=_.length,me=Se;for(Se&&_.push(O);me<w;){var Re=v,be=!0,ir=!1,rt=void 0;try{for(var st=f[Symbol.iterator](),xe;!(be=(xe=st.next()).done);be=!0){var at=xe.value;at>=k&&at<Re&&(Re=at)}}catch(lr){ir=!0,rt=lr}finally{try{!be&&st.return&&st.return()}finally{if(ir)throw rt}}var ot=me+1;Re-k>Z((v-F)/ot)&&U("overflow"),F+=(Re-k)*ot,k=Re;var wt=!0,cr=!1,jt=void 0;try{for(var xa=f[Symbol.iterator](),Fa;!(wt=(Fa=xa.next()).done);wt=!0){var Ua=Fa.value;if(Ua<k&&++F>v&&U("overflow"),Ua==k){for(var Hr=F,Br=p;;Br+=p){var $t=Br<=ne?y:Br>=ne+b?b:Br-ne;if(Hr<$t)break;var Wr=Hr-$t,Wn=p-$t;_.push(V(ue($t+Wr%Wn,0))),Hr=Z(Wr/Wn)}_.push(V(ue(Hr,0))),ne=oe(F,ot,me==Se),F=0,++me}}}catch(lr){cr=!0,jt=lr}finally{try{!wt&&xa.return&&xa.return()}finally{if(cr)throw jt}}++F,++k}return _.join("")},Fe=function(f){return D(f,function(_){return I.test(_)?K(_.slice(4).toLowerCase()):_})},Je=function(f){return D(f,function(_){return j.test(_)?"xn--"+Oe(_):_})},he={version:"2.1.0",ucs2:{decode:q,encode:_e},decode:K,encode:Oe,toASCII:Je,toUnicode:Fe},Ie={};function Le(m){var f=m.charCodeAt(0),_=void 0;return f<16?_="%0"+f.toString(16).toUpperCase():f<128?_="%"+f.toString(16).toUpperCase():f<2048?_="%"+(f>>6|192).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase():_="%"+(f>>12|224).toString(16).toUpperCase()+"%"+(f>>6&63|128).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase(),_}function Ze(m){for(var f="",_=0,w=m.length;_<w;){var k=parseInt(m.substr(_+1,2),16);if(k<128)f+=String.fromCharCode(k),_+=3;else if(k>=194&&k<224){if(w-_>=6){var F=parseInt(m.substr(_+4,2),16);f+=String.fromCharCode((k&31)<<6|F&63)}else f+=m.substr(_,6);_+=6}else if(k>=224){if(w-_>=9){var ne=parseInt(m.substr(_+4,2),16),fe=parseInt(m.substr(_+7,2),16);f+=String.fromCharCode((k&15)<<12|(ne&63)<<6|fe&63)}else f+=m.substr(_,9);_+=9}else f+=m.substr(_,3),_+=3}return f}function Jt(m,f){function _(w){var k=Ze(w);return k.match(f.UNRESERVED)?k:w}return m.scheme&&(m.scheme=String(m.scheme).replace(f.PCT_ENCODED,_).toLowerCase().replace(f.NOT_SCHEME,"")),m.userinfo!==void 0&&(m.userinfo=String(m.userinfo).replace(f.PCT_ENCODED,_).replace(f.NOT_USERINFO,Le).replace(f.PCT_ENCODED,t)),m.host!==void 0&&(m.host=String(m.host).replace(f.PCT_ENCODED,_).toLowerCase().replace(f.NOT_HOST,Le).replace(f.PCT_ENCODED,t)),m.path!==void 0&&(m.path=String(m.path).replace(f.PCT_ENCODED,_).replace(m.scheme?f.NOT_PATH:f.NOT_PATH_NOSCHEME,Le).replace(f.PCT_ENCODED,t)),m.query!==void 0&&(m.query=String(m.query).replace(f.PCT_ENCODED,_).replace(f.NOT_QUERY,Le).replace(f.PCT_ENCODED,t)),m.fragment!==void 0&&(m.fragment=String(m.fragment).replace(f.PCT_ENCODED,_).replace(f.NOT_FRAGMENT,Le).replace(f.PCT_ENCODED,t)),m}function At(m){return m.replace(/^0*(.*)/,"$1")||"0"}function je(m,f){var _=m.match(f.IPV4ADDRESS)||[],w=u(_,2),k=w[1];return k?k.split(".").map(At).join("."):m}function Ce(m,f){var _=m.match(f.IPV6ADDRESS)||[],w=u(_,3),k=w[1],F=w[2];if(k){for(var ne=k.toLowerCase().split("::").reverse(),fe=u(ne,2),ve=fe[0],$e=fe[1],pe=$e?$e.split(":").map(At):[],Ee=ve.split(":").map(At),De=f.IPV4ADDRESS.test(Ee[Ee.length-1]),Se=De?7:8,me=Ee.length-Se,Re=Array(Se),be=0;be<Se;++be)Re[be]=pe[be]||Ee[me+be]||"";De&&(Re[Se-1]=je(Re[Se-1],f));var ir=Re.reduce(function(ot,wt,cr){if(!wt||wt==="0"){var jt=ot[ot.length-1];jt&&jt.index+jt.length===cr?jt.length++:ot.push({index:cr,length:1})}return ot},[]),rt=ir.sort(function(ot,wt){return wt.length-ot.length})[0],st=void 0;if(rt&&rt.length>1){var xe=Re.slice(0,rt.index),at=Re.slice(rt.index+rt.length);st=xe.join(":")+"::"+at.join(":")}else st=Re.join(":");return F&&(st+="%"+F),st}else return m}var nr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Ue="".match(/(){0}/)[1]===void 0;function ge(m){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={},w=f.iri!==!1?c:d;f.reference==="suffix"&&(m=(f.scheme?f.scheme+":":"")+"//"+m);var k=m.match(nr);if(k){Ue?(_.scheme=k[1],_.userinfo=k[3],_.host=k[4],_.port=parseInt(k[5],10),_.path=k[6]||"",_.query=k[7],_.fragment=k[8],isNaN(_.port)&&(_.port=k[5])):(_.scheme=k[1]||void 0,_.userinfo=m.indexOf("@")!==-1?k[3]:void 0,_.host=m.indexOf("//")!==-1?k[4]:void 0,_.port=parseInt(k[5],10),_.path=k[6]||"",_.query=m.indexOf("?")!==-1?k[7]:void 0,_.fragment=m.indexOf("#")!==-1?k[8]:void 0,isNaN(_.port)&&(_.port=m.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?k[4]:void 0)),_.host&&(_.host=Ce(je(_.host,w),w)),_.scheme===void 0&&_.userinfo===void 0&&_.host===void 0&&_.port===void 0&&!_.path&&_.query===void 0?_.reference="same-document":_.scheme===void 0?_.reference="relative":_.fragment===void 0?_.reference="absolute":_.reference="uri",f.reference&&f.reference!=="suffix"&&f.reference!==_.reference&&(_.error=_.error||"URI is not a "+f.reference+" reference.");var F=Ie[(f.scheme||_.scheme||"").toLowerCase()];if(!f.unicodeSupport&&(!F||!F.unicodeSupport)){if(_.host&&(f.domainHost||F&&F.domainHost))try{_.host=he.toASCII(_.host.replace(w.PCT_ENCODED,Ze).toLowerCase())}catch(ne){_.error=_.error||"Host's domain name can not be converted to ASCII via punycode: "+ne}Jt(_,d)}else Jt(_,w);F&&F.parse&&F.parse(_,f)}else _.error=_.error||"URI can not be parsed.";return _}function Zt(m,f){var _=f.iri!==!1?c:d,w=[];return m.userinfo!==void 0&&(w.push(m.userinfo),w.push("@")),m.host!==void 0&&w.push(Ce(je(String(m.host),_),_).replace(_.IPV6ADDRESS,function(k,F,ne){return"["+F+(ne?"%25"+ne:"")+"]"})),(typeof m.port=="number"||typeof m.port=="string")&&(w.push(":"),w.push(String(m.port))),w.length?w.join(""):void 0}var It=/^\.\.?\//,sr=/^\/\.(\/|$)/,or=/^\/\.\.(\/|$)/,Ne=/^\/?(?:.|\n)*?(?=\/|$)/;function nt(m){for(var f=[];m.length;)if(m.match(It))m=m.replace(It,"");else if(m.match(sr))m=m.replace(sr,"/");else if(m.match(or))m=m.replace(or,"/"),f.pop();else if(m==="."||m==="..")m="";else{var _=m.match(Ne);if(_){var w=_[0];m=m.slice(w.length),f.push(w)}else throw new Error("Unexpected dot segment condition")}return f.join("")}function We(m){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=f.iri?c:d,w=[],k=Ie[(f.scheme||m.scheme||"").toLowerCase()];if(k&&k.serialize&&k.serialize(m,f),m.host&&!_.IPV6ADDRESS.test(m.host)){if(f.domainHost||k&&k.domainHost)try{m.host=f.iri?he.toUnicode(m.host):he.toASCII(m.host.replace(_.PCT_ENCODED,Ze).toLowerCase())}catch(fe){m.error=m.error||"Host's domain name can not be converted to "+(f.iri?"Unicode":"ASCII")+" via punycode: "+fe}}Jt(m,_),f.reference!=="suffix"&&m.scheme&&(w.push(m.scheme),w.push(":"));var F=Zt(m,f);if(F!==void 0&&(f.reference!=="suffix"&&w.push("//"),w.push(F),m.path&&m.path.charAt(0)!=="/"&&w.push("/")),m.path!==void 0){var ne=m.path;!f.absolutePath&&(!k||!k.absolutePath)&&(ne=nt(ne)),F===void 0&&(ne=ne.replace(/^\/\//,"/%2F")),w.push(ne)}return m.query!==void 0&&(w.push("?"),w.push(m.query)),m.fragment!==void 0&&(w.push("#"),w.push(m.fragment)),w.join("")}function He(m,f){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=arguments[3],k={};return w||(m=ge(We(m,_),_),f=ge(We(f,_),_)),_=_||{},!_.tolerant&&f.scheme?(k.scheme=f.scheme,k.userinfo=f.userinfo,k.host=f.host,k.port=f.port,k.path=nt(f.path||""),k.query=f.query):(f.userinfo!==void 0||f.host!==void 0||f.port!==void 0?(k.userinfo=f.userinfo,k.host=f.host,k.port=f.port,k.path=nt(f.path||""),k.query=f.query):(f.path?(f.path.charAt(0)==="/"?k.path=nt(f.path):((m.userinfo!==void 0||m.host!==void 0||m.port!==void 0)&&!m.path?k.path="/"+f.path:m.path?k.path=m.path.slice(0,m.path.lastIndexOf("/")+1)+f.path:k.path=f.path,k.path=nt(k.path)),k.query=f.query):(k.path=m.path,f.query!==void 0?k.query=f.query:k.query=m.query),k.userinfo=m.userinfo,k.host=m.host,k.port=m.port),k.scheme=m.scheme),k.fragment=f.fragment,k}function bt(m,f,_){var w=o({scheme:"null"},_);return We(He(ge(m,w),ge(f,w),w,!0),w)}function tt(m,f){return typeof m=="string"?m=We(ge(m,f),f):n(m)==="object"&&(m=ge(We(m,f),f)),m}function za(m,f,_){return typeof m=="string"?m=We(ge(m,_),_):n(m)==="object"&&(m=We(m,_)),typeof f=="string"?f=We(ge(f,_),_):n(f)==="object"&&(f=We(f,_)),m===f}function Hn(m,f){return m&&m.toString().replace(!f||!f.iri?d.ESCAPE:c.ESCAPE,Le)}function mt(m,f){return m&&m.toString().replace(!f||!f.iri?d.PCT_ENCODED:c.PCT_ENCODED,Ze)}var _a={scheme:"http",domainHost:!0,parse:function(f,_){return f.host||(f.error=f.error||"HTTP URIs must have a host."),f},serialize:function(f,_){var w=String(f.scheme).toLowerCase()==="https";return(f.port===(w?443:80)||f.port==="")&&(f.port=void 0),f.path||(f.path="/"),f}},so={scheme:"https",domainHost:_a.domainHost,parse:_a.parse,serialize:_a.serialize};function oo(m){return typeof m.secure=="boolean"?m.secure:String(m.scheme).toLowerCase()==="wss"}var ba={scheme:"ws",domainHost:!0,parse:function(f,_){var w=f;return w.secure=oo(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w},serialize:function(f,_){if((f.port===(oo(f)?443:80)||f.port==="")&&(f.port=void 0),typeof f.secure=="boolean"&&(f.scheme=f.secure?"wss":"ws",f.secure=void 0),f.resourceName){var w=f.resourceName.split("?"),k=u(w,2),F=k[0],ne=k[1];f.path=F&&F!=="/"?F:void 0,f.query=ne,f.resourceName=void 0}return f.fragment=void 0,f}},io={scheme:"wss",domainHost:ba.domainHost,parse:ba.parse,serialize:ba.serialize},md={},gd=!0,co="[A-Za-z0-9\\-\\.\\_\\~"+(gd?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",xt="[0-9A-Fa-f]",vd=r(r("%[EFef]"+xt+"%"+xt+xt+"%"+xt+xt)+"|"+r("%[89A-Fa-f]"+xt+"%"+xt+xt)+"|"+r("%"+xt+xt)),yd="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",_d="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",bd=e(_d,'[\\"\\\\]'),xd="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",wd=new RegExp(co,"g"),Zr=new RegExp(vd,"g"),kd=new RegExp(e("[^]",yd,"[\\.]",'[\\"]',bd),"g"),lo=new RegExp(e("[^]",co,xd),"g"),Sd=lo;function Bn(m){var f=Ze(m);return f.match(wd)?f:m}var uo={scheme:"mailto",parse:function(f,_){var w=f,k=w.to=w.path?w.path.split(","):[];if(w.path=void 0,w.query){for(var F=!1,ne={},fe=w.query.split("&"),ve=0,$e=fe.length;ve<$e;++ve){var pe=fe[ve].split("=");switch(pe[0]){case"to":for(var Ee=pe[1].split(","),De=0,Se=Ee.length;De<Se;++De)k.push(Ee[De]);break;case"subject":w.subject=mt(pe[1],_);break;case"body":w.body=mt(pe[1],_);break;default:F=!0,ne[mt(pe[0],_)]=mt(pe[1],_);break}}F&&(w.headers=ne)}w.query=void 0;for(var me=0,Re=k.length;me<Re;++me){var be=k[me].split("@");if(be[0]=mt(be[0]),_.unicodeSupport)be[1]=mt(be[1],_).toLowerCase();else try{be[1]=he.toASCII(mt(be[1],_).toLowerCase())}catch(ir){w.error=w.error||"Email address's domain name can not be converted to ASCII via punycode: "+ir}k[me]=be.join("@")}return w},serialize:function(f,_){var w=f,k=s(f.to);if(k){for(var F=0,ne=k.length;F<ne;++F){var fe=String(k[F]),ve=fe.lastIndexOf("@"),$e=fe.slice(0,ve).replace(Zr,Bn).replace(Zr,t).replace(kd,Le),pe=fe.slice(ve+1);try{pe=_.iri?he.toUnicode(pe):he.toASCII(mt(pe,_).toLowerCase())}catch(me){w.error=w.error||"Email address's domain name can not be converted to "+(_.iri?"Unicode":"ASCII")+" via punycode: "+me}k[F]=$e+"@"+pe}w.path=k.join(",")}var Ee=f.headers=f.headers||{};f.subject&&(Ee.subject=f.subject),f.body&&(Ee.body=f.body);var De=[];for(var Se in Ee)Ee[Se]!==md[Se]&&De.push(Se.replace(Zr,Bn).replace(Zr,t).replace(lo,Le)+"="+Ee[Se].replace(Zr,Bn).replace(Zr,t).replace(Sd,Le));return De.length&&(w.query=De.join("&")),w}},Pd=/^([^\:]+)\:(.*)/,po={scheme:"urn",parse:function(f,_){var w=f.path&&f.path.match(Pd),k=f;if(w){var F=_.scheme||k.scheme||"urn",ne=w[1].toLowerCase(),fe=w[2],ve=F+":"+(_.nid||ne),$e=Ie[ve];k.nid=ne,k.nss=fe,k.path=void 0,$e&&(k=$e.parse(k,_))}else k.error=k.error||"URN can not be parsed.";return k},serialize:function(f,_){var w=_.scheme||f.scheme||"urn",k=f.nid,F=w+":"+(_.nid||k),ne=Ie[F];ne&&(f=ne.serialize(f,_));var fe=f,ve=f.nss;return fe.path=(k||_.nid)+":"+ve,fe}},Ed=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,fo={scheme:"urn:uuid",parse:function(f,_){var w=f;return w.uuid=w.nss,w.nss=void 0,!_.tolerant&&(!w.uuid||!w.uuid.match(Ed))&&(w.error=w.error||"UUID is not valid."),w},serialize:function(f,_){var w=f;return w.nss=(f.uuid||"").toLowerCase(),w}};Ie[_a.scheme]=_a,Ie[so.scheme]=so,Ie[ba.scheme]=ba,Ie[io.scheme]=io,Ie[uo.scheme]=uo,Ie[po.scheme]=po,Ie[fo.scheme]=fo,a.SCHEMES=Ie,a.pctEncChar=Le,a.pctDecChars=Ze,a.parse=ge,a.removeDotSegments=nt,a.serialize=We,a.resolveComponents=He,a.resolve=bt,a.normalize=tt,a.equal=za,a.escapeComponent=Hn,a.unescapeComponent=mt,Object.defineProperty(a,"__esModule",{value:!0})}))});var pn=ee((Qv,Go)=>{"use strict";Go.exports=function a(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,t,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(t=n;t--!==0;)if(!a(e[t],r[t]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(t=n;t--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[t]))return!1;for(t=n;t--!==0;){var o=s[t];if(!a(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var Xo=ee((Gv,Yo)=>{"use strict";Yo.exports=function(e){for(var r=0,n=e.length,t=0,s;t<n;)r++,s=e.charCodeAt(t++),s>=55296&&s<=56319&&t<n&&(s=e.charCodeAt(t),(s&64512)==56320&&t++);return r}});var Er=ee((Yv,ri)=>{"use strict";ri.exports={copy:Fp,checkDataType:ps,checkDataTypes:Up,coerceToTypes:qp,toHash:hs,getProperty:ms,escapeQuotes:gs,equal:pn(),ucs2length:Xo(),varOccurences:Zp,varReplace:Hp,schemaHasRules:Bp,schemaHasRulesExcept:Wp,schemaUnknownRules:Kp,toQuotedString:fs,getPathExpr:Qp,getPath:Gp,getData:ef,unescapeFragment:tf,unescapeJsonPointer:ys,escapeFragment:rf,escapeJsonPointer:vs};function Fp(a,e){e=e||{};for(var r in a)e[r]=a[r];return e}function ps(a,e,r,n){var t=n?" !== ":" === ",s=n?" || ":" && ",o=n?"!":"",i=n?"":"!";switch(a){case"null":return e+t+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+s+"typeof "+e+t+'"object"'+s+i+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+t+'"number"'+s+i+"("+e+" % 1)"+s+e+t+e+(r?s+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+t+'"'+a+'"'+(r?s+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+t+'"'+a+'"'}}function Up(a,e,r){switch(a.length){case 1:return ps(a[0],e,r,!0);default:var n="",t=hs(a);t.array&&t.object&&(n=t.null?"(":"(!"+e+" || ",n+="typeof "+e+' !== "object")',delete t.null,delete t.array,delete t.object),t.number&&delete t.integer;for(var s in t)n+=(n?" && ":"")+ps(s,e,r,!0);return n}}var ei=hs(["string","number","integer","boolean","null"]);function qp(a,e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++){var t=e[n];(ei[t]||a==="array"&&t==="array")&&(r[r.length]=t)}if(r.length)return r}else{if(ei[e])return[e];if(a==="array"&&e==="array")return["array"]}}function hs(a){for(var e={},r=0;r<a.length;r++)e[a[r]]=!0;return e}var Vp=/^[a-z$_][a-z$_0-9]*$/i,Jp=/'|\\/g;function ms(a){return typeof a=="number"?"["+a+"]":Vp.test(a)?"."+a:"['"+gs(a)+"']"}function gs(a){return a.replace(Jp,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Zp(a,e){e+="[^0-9]";var r=a.match(new RegExp(e,"g"));return r?r.length:0}function Hp(a,e,r){return e+="([^0-9])",r=r.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),r+"$1")}function Bp(a,e){if(typeof a=="boolean")return!a;for(var r in a)if(e[r])return!0}function Wp(a,e,r){if(typeof a=="boolean")return!a&&r!="not";for(var n in a)if(n!=r&&e[n])return!0}function Kp(a,e){if(typeof a!="boolean"){for(var r in a)if(!e[r])return r}}function fs(a){return"'"+gs(a)+"'"}function Qp(a,e,r,n){var t=r?"'/' + "+e+(n?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):n?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return ti(a,t)}function Gp(a,e,r){var n=fs(r?"/"+vs(e):ms(e));return ti(a,n)}var Yp=/^\/(?:[^~]|~0|~1)*$/,Xp=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ef(a,e,r){var n,t,s,o;if(a==="")return"rootData";if(a[0]=="/"){if(!Yp.test(a))throw new Error("Invalid JSON-pointer: "+a);t=a,s="rootData"}else{if(o=a.match(Xp),!o)throw new Error("Invalid JSON-pointer: "+a);if(n=+o[1],t=o[2],t=="#"){if(n>=e)throw new Error("Cannot access property/index "+n+" levels up, current level is "+e);return r[e-n]}if(n>e)throw new Error("Cannot access data "+n+" levels up, current level is "+e);if(s="data"+(e-n||""),!t)return s}for(var i=s,d=t.split("/"),c=0;c<d.length;c++){var u=d[c];u&&(s+=ms(ys(u)),i+=" && "+s)}return i}function ti(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function tf(a){return ys(decodeURIComponent(a))}function rf(a){return encodeURIComponent(vs(a))}function vs(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function ys(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var _s=ee((Xv,ai)=>{"use strict";var af=Er();ai.exports=nf;function nf(a){af.copy(a,this)}});var si=ee((ey,ni)=>{"use strict";var Qt=ni.exports=function(a,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},t=r.post||function(){};fn(e,n,t,a,"",a)};Qt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Qt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Qt.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Qt.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 fn(a,e,r,n,t,s,o,i,d,c){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,t,s,o,i,d,c);for(var u in n){var h=n[u];if(Array.isArray(h)){if(u in Qt.arrayKeywords)for(var v=0;v<h.length;v++)fn(a,e,r,h[v],t+"/"+u+"/"+v,s,t,u,n,v)}else if(u in Qt.propsKeywords){if(h&&typeof h=="object")for(var p in h)fn(a,e,r,h[p],t+"/"+u+"/"+sf(p),s,t,u,n,p)}else(u in Qt.keywords||a.allKeys&&!(u in Qt.skipKeywords))&&fn(a,e,r,h,t+"/"+u,s,t,u,n)}r(n,t,s,o,i,d,c)}}function sf(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var _n=ee((ty,li)=>{"use strict";var Ia=Qo(),oi=pn(),vn=Er(),hn=_s(),of=si();li.exports=Yt;Yt.normalizeId=Gt;Yt.fullPath=mn;Yt.url=gn;Yt.ids=pf;Yt.inlineRef=bs;Yt.schema=yn;function Yt(a,e,r){var n=this._refs[r];if(typeof n=="string")if(this._refs[n])n=this._refs[n];else return Yt.call(this,a,e,n);if(n=n||this._schemas[r],n instanceof hn)return bs(n.schema,this._opts.inlineRefs)?n.schema:n.validate||this._compile(n);var t=yn.call(this,e,r),s,o,i;return t&&(s=t.schema,e=t.root,i=t.baseId),s instanceof hn?o=s.validate||a.call(this,s.schema,e,void 0,i):s!==void 0&&(o=bs(s,this._opts.inlineRefs)?s:a.call(this,s,e,void 0,i)),o}function yn(a,e){var r=Ia.parse(e),n=ci(r),t=mn(this._getId(a.schema));if(Object.keys(a.schema).length===0||n!==t){var s=Gt(n),o=this._refs[s];if(typeof o=="string")return cf.call(this,a,o,r);if(o instanceof hn)o.validate||this._compile(o),a=o;else if(o=this._schemas[s],o instanceof hn){if(o.validate||this._compile(o),s==Gt(e))return{schema:o,root:a,baseId:t};a=o}else return;if(!a.schema)return;t=mn(this._getId(a.schema))}return ii.call(this,r,t,a.schema,a)}function cf(a,e,r){var n=yn.call(this,a,e);if(n){var t=n.schema,s=n.baseId;a=n.root;var o=this._getId(t);return o&&(s=gn(s,o)),ii.call(this,r,s,t,a)}}var lf=vn.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function ii(a,e,r,n){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var t=a.fragment.split("/"),s=1;s<t.length;s++){var o=t[s];if(o){if(o=vn.unescapeFragment(o),r=r[o],r===void 0)break;var i;if(!lf[o]&&(i=this._getId(r),i&&(e=gn(e,i)),r.$ref)){var d=gn(e,r.$ref),c=yn.call(this,n,d);c&&(r=c.schema,n=c.root,e=c.baseId)}}}if(r!==void 0&&r!==n.schema)return{schema:r,root:n,baseId:e}}}var df=vn.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function bs(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return xs(a);if(e)return ws(a)<=e}function xs(a){var e;if(Array.isArray(a)){for(var r=0;r<a.length;r++)if(e=a[r],typeof e=="object"&&!xs(e))return!1}else for(var n in a)if(n=="$ref"||(e=a[n],typeof e=="object"&&!xs(e)))return!1;return!0}function ws(a){var e=0,r;if(Array.isArray(a)){for(var n=0;n<a.length;n++)if(r=a[n],typeof r=="object"&&(e+=ws(r)),e==1/0)return 1/0}else for(var t in a){if(t=="$ref")return 1/0;if(df[t])e++;else if(r=a[t],typeof r=="object"&&(e+=ws(r)+1),e==1/0)return 1/0}return e}function mn(a,e){e!==!1&&(a=Gt(a));var r=Ia.parse(a);return ci(r)}function ci(a){return Ia.serialize(a).split("#")[0]+"#"}var uf=/#\/?$/;function Gt(a){return a?a.replace(uf,""):""}function gn(a,e){return e=Gt(e),Ia.resolve(a,e)}function pf(a){var e=Gt(this._getId(a)),r={"":e},n={"":mn(e,!1)},t={},s=this;return of(a,{allKeys:!0},function(o,i,d,c,u,h,v){if(i!==""){var p=s._getId(o),y=r[c],b=n[c]+"/"+u;if(v!==void 0&&(b+="/"+(typeof v=="number"?v:vn.escapeFragment(v))),typeof p=="string"){p=y=Gt(y?Ia.resolve(y,p):p);var g=s._refs[p];if(typeof g=="string"&&(g=s._refs[g]),g&&g.schema){if(!oi(o,g.schema))throw new Error('id "'+p+'" resolves to more than one schema')}else if(p!=Gt(b))if(p[0]=="#"){if(t[p]&&!oi(o,t[p]))throw new Error('id "'+p+'" resolves to more than one schema');t[p]=o}else s._refs[p]=b}r[i]=y,n[i]=b}}),t}});var bn=ee((ry,ui)=>{"use strict";var ks=_n();ui.exports={Validation:di(ff),MissingRef:di(Ss)};function ff(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}Ss.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function Ss(a,e,r){this.message=r||Ss.message(a,e),this.missingRef=ks.url(a,e),this.missingSchema=ks.normalizeId(ks.fullPath(this.missingRef))}function di(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Ps=ee((ay,pi)=>{"use strict";pi.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(s){return function(o){return function(i,d){var c={key:i,value:o[i]},u={key:d,value:o[d]};return s(c,u)}}})(e.cmp),t=[];return(function s(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var i,d;if(Array.isArray(o)){for(d="[",i=0;i<o.length;i++)i&&(d+=","),d+=s(o[i])||"null";return d+"]"}if(o===null)return"null";if(t.indexOf(o)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=t.push(o)-1,u=Object.keys(o).sort(n&&n(o));for(d="",i=0;i<u.length;i++){var h=u[i],v=s(o[h]);v&&(d&&(d+=","),d+=JSON.stringify(h)+":"+v)}return t.splice(c,1),"{"+d+"}"}})(a)}});var Es=ee((ny,fi)=>{"use strict";fi.exports=function(e,r,n){var t="",s=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var c="unknown keyword: "+d;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(t+=" var validate = ",s&&(e.async=!0,t+="async "),t+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(t+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var r="false schema",u=e.level,h=e.dataLevel,v=e.schema[r],p=e.schemaPath+e.util.getProperty(r),y=e.errSchemaPath+"/"+r,I=!e.opts.allErrors,J,b="data"+(h||""),O="valid"+u;if(e.schema===!1){e.isTop?I=!0:t+=" var "+O+" = false; ";var g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(J||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'boolean schema is false' "),e.opts.verbose&&(t+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&I?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?s?t+=" return data; ":t+=" validate.errors = null; return true; ":t+=" var "+O+" = true; ";return e.isTop&&(t+=" }; return validate; "),t}if(e.isTop){var E=e.isTop,u=e.level=0,h=e.dataLevel=0,b="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}t+=" var vErrors = null; ",t+=" var errors = 0; ",t+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,h=e.dataLevel,b="data"+(h||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),s&&!e.async)throw new Error("async schema in sync schema");t+=" var errs_"+u+" = errors;"}var O="valid"+u,I=!e.opts.allErrors,j="",W="",J,$=e.schema.type,Z=Array.isArray($);if($&&e.opts.nullable&&e.schema.nullable===!0&&(Z?$.indexOf("null")==-1&&($=$.concat("null")):$!="null"&&($=[$,"null"],Z=!0)),Z&&$.length==1&&($=$[0],Z=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(t+=" "+e.RULES.all.$comment.code(e,"$comment")),$){if(e.opts.coerceTypes)var V=e.util.coerceToTypes(e.opts.coerceTypes,$);var U=e.RULES.types[$];if(V||Z||U===!0||U&&!Ne(U)){var p=e.schemaPath+".type",y=e.errSchemaPath+"/type",p=e.schemaPath+".type",y=e.errSchemaPath+"/type",A=Z?"checkDataTypes":"checkDataType";if(t+=" if ("+e.util[A]($,b,e.opts.strictNumbers,!0)+") { ",V){var D="dataType"+u,q="coerced"+u;t+=" var "+D+" = typeof "+b+"; var "+q+" = undefined; ",e.opts.coerceTypes=="array"&&(t+=" if ("+D+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+D+" = typeof "+b+"; if ("+e.util.checkDataType(e.schema.type,b,e.opts.strictNumbers)+") "+q+" = "+b+"; } "),t+=" if ("+q+" !== undefined) ; ";var _e=V;if(_e)for(var ie,ue=-1,oe=_e.length-1;ue<oe;)ie=_e[ue+=1],ie=="string"?t+=" else if ("+D+" == 'number' || "+D+" == 'boolean') "+q+" = '' + "+b+"; else if ("+b+" === null) "+q+" = ''; ":ie=="number"||ie=="integer"?(t+=" else if ("+D+" == 'boolean' || "+b+" === null || ("+D+" == 'string' && "+b+" && "+b+" == +"+b+" ",ie=="integer"&&(t+=" && !("+b+" % 1)"),t+=")) "+q+" = +"+b+"; "):ie=="boolean"?t+=" else if ("+b+" === 'false' || "+b+" === 0 || "+b+" === null) "+q+" = false; else if ("+b+" === 'true' || "+b+" === 1) "+q+" = true; ":ie=="null"?t+=" else if ("+b+" === '' || "+b+" === 0 || "+b+" === false) "+q+" = null; ":e.opts.coerceTypes=="array"&&ie=="array"&&(t+=" else if ("+D+" == 'string' || "+D+" == 'number' || "+D+" == 'boolean' || "+b+" == null) "+q+" = ["+b+"]; ");t+=" else { ";var g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(J||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",Z?t+=""+$.join(","):t+=""+$,t+="' } ",e.opts.messages!==!1&&(t+=" , message: 'should be ",Z?t+=""+$.join(","):t+=""+$,t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&I?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } if ("+q+" !== undefined) { ";var K=h?"data"+(h-1||""):"parentData",Oe=h?e.dataPathArr[h]:"parentDataProperty";t+=" "+b+" = "+q+"; ",h||(t+="if ("+K+" !== undefined)"),t+=" "+K+"["+Oe+"] = "+q+"; } "}else{var g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(J||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",Z?t+=""+$.join(","):t+=""+$,t+="' } ",e.opts.messages!==!1&&(t+=" , message: 'should be ",Z?t+=""+$.join(","):t+=""+$,t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&I?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}t+=" } "}}if(e.schema.$ref&&!o)t+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",I&&(t+=" } if (errors === ",E?t+="0":t+="errs_"+u,t+=") { ",W+="}");else{var Fe=e.RULES;if(Fe){for(var U,Je=-1,he=Fe.length-1;Je<he;)if(U=Fe[Je+=1],Ne(U)){if(U.type&&(t+=" if ("+e.util.checkDataType(U.type,b,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(U.type=="object"&&e.schema.properties){var v=e.schema.properties,Ie=Object.keys(v),Le=Ie;if(Le)for(var Ze,Jt=-1,At=Le.length-1;Jt<At;){Ze=Le[Jt+=1];var je=v[Ze];if(je.default!==void 0){var Ce=b+e.util.getProperty(Ze);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else t+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(t+=" || "+Ce+" === null || "+Ce+" === '' "),t+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?t+=" "+e.useDefault(je.default)+" ":t+=" "+JSON.stringify(je.default)+" ",t+="; "}}}else if(U.type=="array"&&Array.isArray(e.schema.items)){var nr=e.schema.items;if(nr){for(var je,ue=-1,Ue=nr.length-1;ue<Ue;)if(je=nr[ue+=1],je.default!==void 0){var Ce=b+"["+ue+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else t+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(t+=" || "+Ce+" === null || "+Ce+" === '' "),t+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?t+=" "+e.useDefault(je.default)+" ":t+=" "+JSON.stringify(je.default)+" ",t+="; "}}}}var ge=U.rules;if(ge){for(var Zt,It=-1,sr=ge.length-1;It<sr;)if(Zt=ge[It+=1],nt(Zt)){var or=Zt.code(e,Zt.keyword,U.type);or&&(t+=" "+or+" ",I&&(j+="}"))}}if(I&&(t+=" "+j+" ",j=""),U.type&&(t+=" } ",$&&$===U.type&&!V)){t+=" else { ";var p=e.schemaPath+".type",y=e.errSchemaPath+"/type",g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(J||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",Z?t+=""+$.join(","):t+=""+$,t+="' } ",e.opts.messages!==!1&&(t+=" , message: 'should be ",Z?t+=""+$.join(","):t+=""+$,t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+p+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&I?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } "}I&&(t+=" if (errors === ",E?t+="0":t+="errs_"+u,t+=") { ",W+="}")}}}I&&(t+=" "+W+" "),E?(s?(t+=" if (errors === 0) return data; ",t+=" else throw new ValidationError(vErrors); "):(t+=" validate.errors = vErrors; ",t+=" return errors === 0; "),t+=" }; return validate;"):t+=" var "+O+" = errors === errs_"+u+";";function Ne(He){for(var bt=He.rules,tt=0;tt<bt.length;tt++)if(nt(bt[tt]))return!0}function nt(He){return e.schema[He.keyword]!==void 0||He.implements&&We(He)}function We(He){for(var bt=He.implements,tt=0;tt<bt.length;tt++)if(e.schema[bt[tt]]!==void 0)return!0}return t}});var yi=ee((sy,vi)=>{"use strict";var xn=_n(),kn=Er(),mi=bn(),hf=Ps(),hi=Es(),mf=kn.ucs2length,gf=pn(),vf=mi.Validation;vi.exports=Rs;function Rs(a,e,r,n){var t=this,s=this._opts,o=[void 0],i={},d=[],c={},u=[],h={},v=[];e=e||{schema:a,refVal:o,refs:i};var p=yf.call(this,a,e,n),y=this._compilations[p.index];if(p.compiling)return y.callValidate=P;var b=this._formats,g=this.RULES;try{var S=O(a,e,r,n);y.validate=S;var E=y.callValidate;return E&&(E.schema=S.schema,E.errors=null,E.refs=S.refs,E.refVal=S.refVal,E.root=S.root,E.$async=S.$async,s.sourceCode&&(E.source=S.source)),S}finally{_f.call(this,a,e,n)}function P(){var A=y.validate,D=A.apply(this,arguments);return P.errors=A.errors,D}function O(A,D,q,_e){var ie=!D||D&&D.schema==A;if(D.schema!=e.schema)return Rs.call(t,A,D,q,_e);var ue=A.$async===!0,oe=hi({isTop:!0,schema:A,isRoot:ie,baseId:_e,root:D,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:mi.MissingRef,RULES:g,validate:hi,util:kn,resolve:xn,resolveRef:I,usePattern:Z,useDefault:V,useCustomRule:U,opts:s,formats:b,logger:t.logger,self:t});oe=wn(o,wf)+wn(d,bf)+wn(u,xf)+wn(v,kf)+oe,s.processCode&&(oe=s.processCode(oe,A));var K;try{var Oe=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",oe);K=Oe(t,g,b,e,o,u,v,gf,mf,vf),o[0]=K}catch(Fe){throw t.logger.error("Error compiling schema, function code:",oe),Fe}return K.schema=A,K.errors=null,K.refs=i,K.refVal=o,K.root=ie?K:D,ue&&(K.$async=!0),s.sourceCode===!0&&(K.source={code:oe,patterns:d,defaults:u}),K}function I(A,D,q){D=xn.url(A,D);var _e=i[D],ie,ue;if(_e!==void 0)return ie=o[_e],ue="refVal["+_e+"]",$(ie,ue);if(!q&&e.refs){var oe=e.refs[D];if(oe!==void 0)return ie=e.refVal[oe],ue=j(D,ie),$(ie,ue)}ue=j(D);var K=xn.call(t,O,e,D);if(K===void 0){var Oe=r&&r[D];Oe&&(K=xn.inlineRef(Oe,s.inlineRefs)?Oe:Rs.call(t,Oe,e,r,A))}if(K===void 0)W(D);else return J(D,K),$(K,ue)}function j(A,D){var q=o.length;return o[q]=D,i[A]=q,"refVal"+q}function W(A){delete i[A]}function J(A,D){var q=i[A];o[q]=D}function $(A,D){return typeof A=="object"||typeof A=="boolean"?{code:D,schema:A,inline:!0}:{code:D,$async:A&&!!A.$async}}function Z(A){var D=c[A];return D===void 0&&(D=c[A]=d.length,d[D]=A),"pattern"+D}function V(A){switch(typeof A){case"boolean":case"number":return""+A;case"string":return kn.toQuotedString(A);case"object":if(A===null)return"null";var D=hf(A),q=h[D];return q===void 0&&(q=h[D]=u.length,u[q]=A),"default"+q}}function U(A,D,q,_e){if(t._opts.validateSchema!==!1){var ie=A.definition.dependencies;if(ie&&!ie.every(function(Le){return Object.prototype.hasOwnProperty.call(q,Le)}))throw new Error("parent schema must have all required keywords: "+ie.join(","));var ue=A.definition.validateSchema;if(ue){var oe=ue(D);if(!oe){var K="keyword schema is invalid: "+t.errorsText(ue.errors);if(t._opts.validateSchema=="log")t.logger.error(K);else throw new Error(K)}}}var Oe=A.definition.compile,Fe=A.definition.inline,Je=A.definition.macro,he;if(Oe)he=Oe.call(t,D,q,_e);else if(Je)he=Je.call(t,D,q,_e),s.validateSchema!==!1&&t.validateSchema(he,!0);else if(Fe)he=Fe.call(t,_e,A.keyword,D,q);else if(he=A.definition.validate,!he)return;if(he===void 0)throw new Error('custom keyword "'+A.keyword+'"failed to compile');var Ie=v.length;return v[Ie]=he,{code:"customRule"+Ie,validate:he}}}function yf(a,e,r){var n=gi.call(this,a,e,r);return n>=0?{index:n,compiling:!0}:(n=this._compilations.length,this._compilations[n]={schema:a,root:e,baseId:r},{index:n,compiling:!1})}function _f(a,e,r){var n=gi.call(this,a,e,r);n>=0&&this._compilations.splice(n,1)}function gi(a,e,r){for(var n=0;n<this._compilations.length;n++){var t=this._compilations[n];if(t.schema==a&&t.root==e&&t.baseId==r)return n}return-1}function bf(a,e){return"var pattern"+a+" = new RegExp("+kn.toQuotedString(e[a])+");"}function xf(a){return"var default"+a+" = defaults["+a+"];"}function wf(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function kf(a){return"var customRule"+a+" = customRules["+a+"];"}function wn(a,e){if(!a.length)return"";for(var r="",n=0;n<a.length;n++)r+=e(n,a);return r}});var bi=ee((oy,_i)=>{"use strict";var Sn=_i.exports=function(){this._cache={}};Sn.prototype.put=function(e,r){this._cache[e]=r};Sn.prototype.get=function(e){return this._cache[e]};Sn.prototype.del=function(e){delete this._cache[e]};Sn.prototype.clear=function(){this._cache={}}});var Ii=ee((iy,Ai)=>{"use strict";var Sf=Er(),Pf=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Ef=[0,31,28,31,30,31,30,31,31,30,31,30,31],Rf=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,xi=/^(?=.{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,Tf=/^(?:[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,Of=/^(?:[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,wi=/^(?:(?:[^\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,ki=/^(?:(?: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,Si=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Pi=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ei=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Ri=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Ai.exports=Pn;function Pn(a){return a=a=="full"?"full":"fast",Sf.copy(Pn[a])}Pn.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":wi,url:ki,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:xi,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:Ci,uuid:Si,"json-pointer":Pi,"json-pointer-uri-fragment":Ei,"relative-json-pointer":Ri};Pn.full={date:Ti,time:Oi,"date-time":If,uri:$f,"uri-reference":Of,"uri-template":wi,url:ki,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:xi,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:Ci,uuid:Si,"json-pointer":Pi,"json-pointer-uri-fragment":Ei,"relative-json-pointer":Ri};function Cf(a){return a%4===0&&(a%100!==0||a%400===0)}function Ti(a){var e=a.match(Pf);if(!e)return!1;var r=+e[1],n=+e[2],t=+e[3];return n>=1&&n<=12&&t>=1&&t<=(n==2&&Cf(r)?29:Ef[n])}function Oi(a,e){var r=a.match(Rf);if(!r)return!1;var n=r[1],t=r[2],s=r[3],o=r[5];return(n<=23&&t<=59&&s<=59||n==23&&t==59&&s==60)&&(!e||o)}var Af=/t|\s/i;function If(a){var e=a.split(Af);return e.length==2&&Ti(e[0])&&Oi(e[1],!0)}var jf=/\/|:/;function $f(a){return jf.test(a)&&Tf.test(a)}var Df=/[^\\]\\Z/;function Ci(a){if(Df.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var $i=ee((cy,ji)=>{"use strict";ji.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.errSchemaPath+"/"+r,c=!e.opts.allErrors,u="data"+(o||""),h="valid"+s,v,p;if(i=="#"||i=="#/")e.isRoot?(v=e.async,p="validate"):(v=e.root.schema.$async===!0,p="root.refVal[0]");else{var y=e.resolveRef(e.baseId,i,e.isRoot);if(y===void 0){var b=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(b);var g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(t+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(t+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),t+=" } "):t+=" {} ";var S=t;t=g.pop(),!e.compositeRule&&c?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(t+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(b),c&&(t+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,b)}else if(y.inline){var E=e.util.copy(e);E.level++;var P="valid"+E.level;E.schema=y.schema,E.schemaPath="",E.errSchemaPath=i;var O=e.validate(E).replace(/validate\.schema/g,y.code);t+=" "+O+" ",c&&(t+=" if ("+P+") { ")}else v=y.$async===!0||e.async&&y.$async!==!1,p=y.code}if(p){var g=g||[];g.push(t),t="",e.opts.passContext?t+=" "+p+".call(this, ":t+=" "+p+"( ",t+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(t+=" + "+e.errorPath);var I=o?"data"+(o-1||""):"parentData",j=o?e.dataPathArr[o]:"parentDataProperty";t+=" , "+I+" , "+j+", rootData) ";var W=t;if(t=g.pop(),v){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(t+=" var "+h+"; "),t+=" try { await "+W+"; ",c&&(t+=" "+h+" = true; "),t+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(t+=" "+h+" = false; "),t+=" } ",c&&(t+=" if ("+h+") { ")}else t+=" if (!"+W+") { if (vErrors === null) vErrors = "+p+".errors; else vErrors = vErrors.concat("+p+".errors); errors = vErrors.length; } ",c&&(t+=" else { ")}return t}});var Li=ee((ly,Di)=>{"use strict";Di.exports=function(e,r,n){var t=" ",s=e.schema[r],o=e.schemaPath+e.util.getProperty(r),i=e.errSchemaPath+"/"+r,d=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var h="valid"+c.level,v=c.baseId,p=!0,y=s;if(y)for(var b,g=-1,S=y.length-1;g<S;)b=y[g+=1],(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))&&(p=!1,c.schema=b,c.schemaPath=o+"["+g+"]",c.errSchemaPath=i+"/"+g,t+=" "+e.validate(c)+" ",c.baseId=v,d&&(t+=" if ("+h+") { ",u+="}"));return d&&(p?t+=" if (true) { ":t+=" "+u.slice(0,-1)+" "),t}});var Mi=ee((dy,Ni)=>{"use strict";Ni.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,p="errs__"+s,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S=i.every(function(J){return e.opts.strictKeywords?typeof J=="object"&&Object.keys(J).length>0||J===!1:e.util.schemaHasRules(J,e.RULES.all)});if(S){var E=y.baseId;t+=" var "+p+" = errors; var "+v+" = false; ";var P=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=i;if(O)for(var I,j=-1,W=O.length-1;j<W;)I=O[j+=1],y.schema=I,y.schemaPath=d+"["+j+"]",y.errSchemaPath=c+"/"+j,t+=" "+e.validate(y)+" ",y.baseId=E,t+=" "+v+" = "+v+" || "+g+"; if (!"+v+") { ",b+="}";e.compositeRule=y.compositeRule=P,t+=" "+b+" if (!"+v+") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),t+=" } else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.opts.allErrors&&(t+=" } ")}else u&&(t+=" if (true) { ");return t}});var Fi=ee((uy,zi)=>{"use strict";zi.exports=function(e,r,n){var t=" ",s=e.schema[r],o=e.errSchemaPath+"/"+r,i=!e.opts.allErrors,d=e.util.toQuotedString(s);return e.opts.$comment===!0?t+=" console.log("+d+");":typeof e.opts.$comment=="function"&&(t+=" self._opts.$comment("+d+", "+e.util.toQuotedString(o)+", validate.root.schema);"),t}});var qi=ee((py,Ui)=>{"use strict";Ui.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,p=e.opts.$data&&i&&i.$data,y;p?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+s):y=i,p||(t+=" var schema"+s+" = validate.schema"+d+";"),t+="var "+v+" = equal("+h+", schema"+s+"); if (!"+v+") { ";var b=b||[];b.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+s+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be equal to constant' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var g=t;return t=b.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+g+"]); ":t+=" validate.errors = ["+g+"]; return false; ":t+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" }",u&&(t+=" else { "),t}});var Ji=ee((fy,Vi)=>{"use strict";Vi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,p="errs__"+s,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S="i"+s,E=y.dataLevel=e.dataLevel+1,P="data"+E,O=e.baseId,I=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(t+="var "+p+" = errors;var "+v+";",I){var j=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=i,y.schemaPath=d,y.errSchemaPath=c,t+=" var "+g+" = false; for (var "+S+" = 0; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var W=h+"["+S+"]";y.dataPathArr[E]=S;var J=e.validate(y);y.baseId=O,e.util.varOccurences(J,P)<2?t+=" "+e.util.varReplace(J,P,W)+" ":t+=" var "+P+" = "+W+"; "+J+" ",t+=" if ("+g+") break; } ",e.compositeRule=y.compositeRule=j,t+=" "+b+" if (!"+g+") {"}else t+=" if ("+h+".length == 0) {";var $=$||[];$.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should contain a valid item' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var Z=t;return t=$.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+Z+"]); ":t+=" validate.errors = ["+Z+"]; return false; ":t+=" var err = "+Z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { ",I&&(t+=" errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } "),e.opts.allErrors&&(t+=" } "),t}});var Hi=ee((hy,Zi)=>{"use strict";Zi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="errs__"+s,p=e.util.copy(e),y="";p.level++;var b="valid"+p.level,g={},S={},E=e.opts.ownProperties;for(j in i)if(j!="__proto__"){var P=i[j],O=Array.isArray(P)?S:g;O[j]=P}t+="var "+v+" = errors;";var I=e.errorPath;t+="var missing"+s+";";for(var j in S)if(O=S[j],O.length){if(t+=" if ( "+h+e.util.getProperty(j)+" !== undefined ",E&&(t+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(j)+"') "),u){t+=" && ( ";var W=O;if(W)for(var J,$=-1,Z=W.length-1;$<Z;){J=W[$+=1],$&&(t+=" || ");var V=e.util.getProperty(J),U=h+V;t+=" ( ( "+U+" === undefined ",E&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(J)+"') "),t+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?J:V)+") ) "}t+=")) { ";var A="missing"+s,D="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,A,!0):I+" + "+A);var q=q||[];q.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(j)+"', missingProperty: '"+D+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(t+=" , message: 'should have ",O.length==1?t+="property "+e.util.escapeQuotes(O[0]):t+="properties "+e.util.escapeQuotes(O.join(", ")),t+=" when property "+e.util.escapeQuotes(j)+" is present' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var _e=t;t=q.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+_e+"]); ":t+=" validate.errors = ["+_e+"]; return false; ":t+=" var err = "+_e+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{t+=" ) { ";var ie=O;if(ie)for(var J,ue=-1,oe=ie.length-1;ue<oe;){J=ie[ue+=1];var V=e.util.getProperty(J),D=e.util.escapeQuotes(J),U=h+V;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,J,e.opts.jsonPointers)),t+=" if ( "+U+" === undefined ",E&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(J)+"') "),t+=") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(j)+"', missingProperty: '"+D+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(t+=" , message: 'should have ",O.length==1?t+="property "+e.util.escapeQuotes(O[0]):t+="properties "+e.util.escapeQuotes(O.join(", ")),t+=" when property "+e.util.escapeQuotes(j)+" is present' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}t+=" } ",u&&(y+="}",t+=" else { ")}e.errorPath=I;var K=p.baseId;for(var j in g){var P=g[j];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(t+=" "+b+" = true; if ( "+h+e.util.getProperty(j)+" !== undefined ",E&&(t+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(j)+"') "),t+=") { ",p.schema=P,p.schemaPath=d+e.util.getProperty(j),p.errSchemaPath=c+"/"+e.util.escapeFragment(j),t+=" "+e.validate(p)+" ",p.baseId=K,t+=" } ",u&&(t+=" if ("+b+") { ",y+="}"))}return u&&(t+=" "+y+" if ("+v+" == errors) {"),t}});var Wi=ee((my,Bi)=>{"use strict";Bi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,p=e.opts.$data&&i&&i.$data,y;p?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+s):y=i;var b="i"+s,g="schema"+s;p||(t+=" var "+g+" = validate.schema"+d+";"),t+="var "+v+";",p&&(t+=" if (schema"+s+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+s+")) "+v+" = false; else {"),t+=""+v+" = false;for (var "+b+"=0; "+b+"<"+g+".length; "+b+"++) if (equal("+h+", "+g+"["+b+"])) { "+v+" = true; break; }",p&&(t+=" } "),t+=" if (!"+v+") { ";var S=S||[];S.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+s+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var E=t;return t=S.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+E+"]); ":t+=" validate.errors = ["+E+"]; return false; ":t+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" }",u&&(t+=" else { "),t}});var Qi=ee((gy,Ki)=>{"use strict";Ki.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||"");if(e.opts.format===!1)return u&&(t+=" if (true) { "),t;var v=e.opts.$data&&i&&i.$data,p;v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+s):p=i;var y=e.opts.unknownFormats,b=Array.isArray(y);if(v){var g="format"+s,S="isObject"+s,E="formatType"+s;t+=" var "+g+" = formats["+p+"]; var "+S+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+E+" = "+S+" && "+g+".type || 'string'; if ("+S+") { ",e.async&&(t+=" var async"+s+" = "+g+".async; "),t+=" "+g+" = "+g+".validate; } if ( ",v&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'string') || "),t+=" (",y!="ignore"&&(t+=" ("+p+" && !"+g+" ",b&&(t+=" && self._opts.unknownFormats.indexOf("+p+") == -1 "),t+=") || "),t+=" ("+g+" && "+E+" == '"+n+"' && !(typeof "+g+" == 'function' ? ",e.async?t+=" (async"+s+" ? await "+g+"("+h+") : "+g+"("+h+")) ":t+=" "+g+"("+h+") ",t+=" : "+g+".test("+h+"))))) {"}else{var g=e.formats[i];if(!g){if(y=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(t+=" if (true) { "),t;if(b&&y.indexOf(i)>=0)return u&&(t+=" if (true) { "),t;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var S=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,E=S&&g.type||"string";if(S){var P=g.async===!0;g=g.validate}if(E!=n)return u&&(t+=" if (true) { "),t;if(P){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(i)+".validate";t+=" if (!(await "+O+"("+h+"))) { "}else{t+=" if (! ";var O="formats"+e.util.getProperty(i);S&&(O+=".validate"),typeof g=="function"?t+=" "+O+"("+h+") ":t+=" "+O+".test("+h+") ",t+=") { "}}var I=I||[];I.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",v?t+=""+p:t+=""+e.util.toQuotedString(i),t+=" } ",e.opts.messages!==!1&&(t+=` , message: 'should match format "`,v?t+="' + "+p+" + '":t+=""+e.util.escapeQuotes(i),t+=`"' `),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+e.util.toQuotedString(i),t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var j=t;return t=I.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+j+"]); ":t+=" validate.errors = ["+j+"]; return false; ":t+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",u&&(t+=" else { "),t}});var Yi=ee((vy,Gi)=>{"use strict";Gi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,p="errs__"+s,y=e.util.copy(e);y.level++;var b="valid"+y.level,g=e.schema.then,S=e.schema.else,E=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),P=S!==void 0&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all)),O=y.baseId;if(E||P){var I;y.createErrors=!1,y.schema=i,y.schemaPath=d,y.errSchemaPath=c,t+=" var "+p+" = errors; var "+v+" = true; ";var j=e.compositeRule;e.compositeRule=y.compositeRule=!0,t+=" "+e.validate(y)+" ",y.baseId=O,y.createErrors=!0,t+=" errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=j,E?(t+=" if ("+b+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",t+=" "+e.validate(y)+" ",y.baseId=O,t+=" "+v+" = "+b+"; ",E&&P?(I="ifClause"+s,t+=" var "+I+" = 'then'; "):I="'then'",t+=" } ",P&&(t+=" else { ")):t+=" if (!"+b+") { ",P&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",t+=" "+e.validate(y)+" ",y.baseId=O,t+=" "+v+" = "+b+"; ",E&&P?(I="ifClause"+s,t+=" var "+I+" = 'else'; "):I="'else'",t+=" } "),t+=" if (!"+v+") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+I+" } ",e.opts.messages!==!1&&(t+=` , message: 'should match "' + `+I+` + '" schema' `),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),t+=" } ",u&&(t+=" else { ")}else u&&(t+=" if (true) { ");return t}});var ec=ee((yy,Xi)=>{"use strict";Xi.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,p="errs__"+s,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S="i"+s,E=y.dataLevel=e.dataLevel+1,P="data"+E,O=e.baseId;if(t+="var "+p+" = errors;var "+v+";",Array.isArray(i)){var I=e.schema.additionalItems;if(I===!1){t+=" "+v+" = "+h+".length <= "+i.length+"; ";var j=c;c=e.errSchemaPath+"/additionalItems",t+=" if (!"+v+") { ";var W=W||[];W.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(t+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var J=t;t=W.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+J+"]); ":t+=" validate.errors = ["+J+"]; return false; ":t+=" var err = "+J+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",c=j,u&&(b+="}",t+=" else { ")}var $=i;if($){for(var Z,V=-1,U=$.length-1;V<U;)if(Z=$[V+=1],e.opts.strictKeywords?typeof Z=="object"&&Object.keys(Z).length>0||Z===!1:e.util.schemaHasRules(Z,e.RULES.all)){t+=" "+g+" = true; if ("+h+".length > "+V+") { ";var A=h+"["+V+"]";y.schema=Z,y.schemaPath=d+"["+V+"]",y.errSchemaPath=c+"/"+V,y.errorPath=e.util.getPathExpr(e.errorPath,V,e.opts.jsonPointers,!0),y.dataPathArr[E]=V;var D=e.validate(y);y.baseId=O,e.util.varOccurences(D,P)<2?t+=" "+e.util.varReplace(D,P,A)+" ":t+=" var "+P+" = "+A+"; "+D+" ",t+=" } ",u&&(t+=" if ("+g+") { ",b+="}")}}if(typeof I=="object"&&(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))){y.schema=I,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",t+=" "+g+" = true; if ("+h+".length > "+i.length+") { for (var "+S+" = "+i.length+"; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var A=h+"["+S+"]";y.dataPathArr[E]=S;var D=e.validate(y);y.baseId=O,e.util.varOccurences(D,P)<2?t+=" "+e.util.varReplace(D,P,A)+" ":t+=" var "+P+" = "+A+"; "+D+" ",u&&(t+=" if (!"+g+") break; "),t+=" } } ",u&&(t+=" if ("+g+") { ",b+="}")}}else if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){y.schema=i,y.schemaPath=d,y.errSchemaPath=c,t+=" for (var "+S+" = 0; "+S+" < "+h+".length; "+S+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var A=h+"["+S+"]";y.dataPathArr[E]=S;var D=e.validate(y);y.baseId=O,e.util.varOccurences(D,P)<2?t+=" "+e.util.varReplace(D,P,A)+" ":t+=" var "+P+" = "+A+"; "+D+" ",u&&(t+=" if (!"+g+") break; "),t+=" }"}return u&&(t+=" "+b+" if ("+p+" == errors) {"),t}});var Ts=ee((_y,tc)=>{"use strict";tc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,O,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+s):p=i;var y=r=="maximum",b=y?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[b],S=e.opts.$data&&g&&g.$data,E=y?"<":">",P=y?">":"<",O=void 0;if(!(v||typeof i=="number"||i===void 0))throw new Error(r+" must be number");if(!(S||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(b+" must be number or boolean");if(S){var I=e.util.getData(g.$data,o,e.dataPathArr),j="exclusive"+s,W="exclType"+s,J="exclIsNumber"+s,$="op"+s,Z="' + "+$+" + '";t+=" var schemaExcl"+s+" = "+I+"; ",I="schemaExcl"+s,t+=" var "+j+"; var "+W+" = typeof "+I+"; if ("+W+" != 'boolean' && "+W+" != 'undefined' && "+W+" != 'number') { ";var O=b,V=V||[];V.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: '"+b+" should be boolean' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var U=t;t=V.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+U+"]); ":t+=" validate.errors = ["+U+"]; return false; ":t+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else if ( ",v&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" "+W+" == 'number' ? ( ("+j+" = "+p+" === undefined || "+I+" "+E+"= "+p+") ? "+h+" "+P+"= "+I+" : "+h+" "+P+" "+p+" ) : ( ("+j+" = "+I+" === true) ? "+h+" "+P+"= "+p+" : "+h+" "+P+" "+p+" ) || "+h+" !== "+h+") { var op"+s+" = "+j+" ? '"+E+"' : '"+E+"='; ",i===void 0&&(O=b,c=e.errSchemaPath+"/"+b,p=I,v=S)}else{var J=typeof g=="number",Z=E;if(J&&v){var $="'"+Z+"'";t+=" if ( ",v&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" ( "+p+" === undefined || "+g+" "+E+"= "+p+" ? "+h+" "+P+"= "+g+" : "+h+" "+P+" "+p+" ) || "+h+" !== "+h+") { "}else{J&&i===void 0?(j=!0,O=b,c=e.errSchemaPath+"/"+b,p=g,P+="="):(J&&(p=Math[y?"min":"max"](g,i)),g===(J?p:!0)?(j=!0,O=b,c=e.errSchemaPath+"/"+b,P+="="):(j=!1,Z+="="));var $="'"+Z+"'";t+=" if ( ",v&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" "+h+" "+P+" "+p+" || "+h+" !== "+h+") { "}}O=O||r;var V=V||[];V.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+$+", limit: "+p+", exclusive: "+j+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be "+Z+" ",v?t+="' + "+p:t+=""+p+"'"),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var U=t;return t=V.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+U+"]); ":t+=" validate.errors = ["+U+"]; return false; ":t+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",u&&(t+=" else { "),t}});var Os=ee((by,rc)=>{"use strict";rc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,b,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;if(v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+s):p=i,!(v||typeof i=="number"))throw new Error(r+" must be number");var y=r=="maxItems"?">":"<";t+="if ( ",v&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" "+h+".length "+y+" "+p+") { ";var b=r,g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+p+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have ",r=="maxItems"?t+="more":t+="fewer",t+=" than ",v?t+="' + "+p+" + '":t+=""+i,t+=" items' "),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var S=t;return t=g.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var Cs=ee((xy,ac)=>{"use strict";ac.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,b,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;if(v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+s):p=i,!(v||typeof i=="number"))throw new Error(r+" must be number");var y=r=="maxLength"?">":"<";t+="if ( ",v&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),e.opts.unicode===!1?t+=" "+h+".length ":t+=" ucs2length("+h+") ",t+=" "+y+" "+p+") { ";var b=r,g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+p+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT be ",r=="maxLength"?t+="longer":t+="shorter",t+=" than ",v?t+="' + "+p+" + '":t+=""+i,t+=" characters' "),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var S=t;return t=g.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var As=ee((wy,nc)=>{"use strict";nc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,b,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;if(v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+s):p=i,!(v||typeof i=="number"))throw new Error(r+" must be number");var y=r=="maxProperties"?">":"<";t+="if ( ",v&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'number') || "),t+=" Object.keys("+h+").length "+y+" "+p+") { ";var b=r,g=g||[];g.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+p+" } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have ",r=="maxProperties"?t+="more":t+="fewer",t+=" than ",v?t+="' + "+p+" + '":t+=""+i,t+=" properties' "),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var S=t;return t=g.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+S+"]); ":t+=" validate.errors = ["+S+"]; return false; ":t+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var oc=ee((ky,sc)=>{"use strict";sc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;if(v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+s):p=i,!(v||typeof i=="number"))throw new Error(r+" must be number");t+="var division"+s+";if (",v&&(t+=" "+p+" !== undefined && ( typeof "+p+" != 'number' || "),t+=" (division"+s+" = "+h+" / "+p+", ",e.opts.multipleOfPrecision?t+=" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":t+=" division"+s+" !== parseInt(division"+s+") ",t+=" ) ",v&&(t+=" ) "),t+=" ) { ";var y=y||[];y.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+p+" } ",e.opts.messages!==!1&&(t+=" , message: 'should be multiple of ",v?t+="' + "+p:t+=""+p+"'"),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var b=t;return t=y.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+b+"]); ":t+=" validate.errors = ["+b+"]; return false; ":t+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var cc=ee((Sy,ic)=>{"use strict";ic.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="errs__"+s,p=e.util.copy(e);p.level++;var y="valid"+p.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){p.schema=i,p.schemaPath=d,p.errSchemaPath=c,t+=" var "+v+" = errors; ";var b=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.createErrors=!1;var g;p.opts.allErrors&&(g=p.opts.allErrors,p.opts.allErrors=!1),t+=" "+e.validate(p)+" ",p.createErrors=!0,g&&(p.opts.allErrors=g),e.compositeRule=p.compositeRule=b,t+=" if ("+y+") { ";var S=S||[];S.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var E=t;t=S.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+E+"]); ":t+=" validate.errors = ["+E+"]; return false; ":t+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",e.opts.allErrors&&(t+=" } ")}else t+=" var err = ",e.createErrors!==!1?(t+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(t+=" , message: 'should NOT be valid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(t+=" if (false) { ");return t}});var dc=ee((Py,lc)=>{"use strict";lc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,p="errs__"+s,y=e.util.copy(e),b="";y.level++;var g="valid"+y.level,S=y.baseId,E="prevValid"+s,P="passingSchemas"+s;t+="var "+p+" = errors , "+E+" = false , "+v+" = false , "+P+" = null; ";var O=e.compositeRule;e.compositeRule=y.compositeRule=!0;var I=i;if(I)for(var j,W=-1,J=I.length-1;W<J;)j=I[W+=1],(e.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:e.util.schemaHasRules(j,e.RULES.all))?(y.schema=j,y.schemaPath=d+"["+W+"]",y.errSchemaPath=c+"/"+W,t+=" "+e.validate(y)+" ",y.baseId=S):t+=" var "+g+" = true; ",W&&(t+=" if ("+g+" && "+E+") { "+v+" = false; "+P+" = ["+P+", "+W+"]; } else { ",b+="}"),t+=" if ("+g+") { "+v+" = "+E+" = true; "+P+" = "+W+"; }";return e.compositeRule=y.compositeRule=O,t+=""+b+"if (!"+v+") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(t+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),t+="} else { errors = "+p+"; if (vErrors !== null) { if ("+p+") vErrors.length = "+p+"; else vErrors = null; }",e.opts.allErrors&&(t+=" } "),t}});var pc=ee((Ey,uc)=>{"use strict";uc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v=e.opts.$data&&i&&i.$data,p;v?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",p="schema"+s):p=i;var y=v?"(new RegExp("+p+"))":e.usePattern(i);t+="if ( ",v&&(t+=" ("+p+" !== undefined && typeof "+p+" != 'string') || "),t+=" !"+y+".test("+h+") ) { ";var b=b||[];b.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",v?t+=""+p:t+=""+e.util.toQuotedString(i),t+=" } ",e.opts.messages!==!1&&(t+=` , message: 'should match pattern "`,v?t+="' + "+p+" + '":t+=""+e.util.escapeQuotes(i),t+=`"' `),e.opts.verbose&&(t+=" , schema: ",v?t+="validate.schema"+d:t+=""+e.util.toQuotedString(i),t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var g=t;return t=b.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+g+"]); ":t+=" validate.errors = ["+g+"]; return false; ":t+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+="} ",u&&(t+=" else { "),t}});var hc=ee((Ry,fc)=>{"use strict";fc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="errs__"+s,p=e.util.copy(e),y="";p.level++;var b="valid"+p.level,g="key"+s,S="idx"+s,E=p.dataLevel=e.dataLevel+1,P="data"+E,O="dataProperties"+s,I=Object.keys(i||{}).filter(ue),j=e.schema.patternProperties||{},W=Object.keys(j).filter(ue),J=e.schema.additionalProperties,$=I.length||W.length,Z=J===!1,V=typeof J=="object"&&Object.keys(J).length,U=e.opts.removeAdditional,A=Z||V||U,D=e.opts.ownProperties,q=e.baseId,_e=e.schema.required;if(_e&&!(e.opts.$data&&_e.$data)&&_e.length<e.opts.loopRequired)var ie=e.util.toHash(_e);function ue(mt){return mt!=="__proto__"}if(t+="var "+v+" = errors;var "+b+" = true;",D&&(t+=" var "+O+" = undefined;"),A){if(D?t+=" "+O+" = "+O+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+O+".length; "+S+"++) { var "+g+" = "+O+"["+S+"]; ":t+=" for (var "+g+" in "+h+") { ",$){if(t+=" var isAdditional"+s+" = !(false ",I.length)if(I.length>8)t+=" || validate.schema"+d+".hasOwnProperty("+g+") ";else{var oe=I;if(oe)for(var K,Oe=-1,Fe=oe.length-1;Oe<Fe;)K=oe[Oe+=1],t+=" || "+g+" == "+e.util.toQuotedString(K)+" "}if(W.length){var Je=W;if(Je)for(var he,Ie=-1,Le=Je.length-1;Ie<Le;)he=Je[Ie+=1],t+=" || "+e.usePattern(he)+".test("+g+") "}t+=" ); if (isAdditional"+s+") { "}if(U=="all")t+=" delete "+h+"["+g+"]; ";else{var Ze=e.errorPath,Jt="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),Z)if(U)t+=" delete "+h+"["+g+"]; ";else{t+=" "+b+" = false; ";var At=c;c=e.errSchemaPath+"/additionalProperties";var je=je||[];je.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Jt+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is an invalid additional property":t+="should NOT have additional properties",t+="' "),e.opts.verbose&&(t+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var Ce=t;t=je.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+Ce+"]); ":t+=" validate.errors = ["+Ce+"]; return false; ":t+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=At,u&&(t+=" break; ")}else if(V)if(U=="failing"){t+=" var "+v+" = errors; ";var nr=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.schema=J,p.schemaPath=e.schemaPath+".additionalProperties",p.errSchemaPath=e.errSchemaPath+"/additionalProperties",p.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ue=h+"["+g+"]";p.dataPathArr[E]=g;var ge=e.validate(p);p.baseId=q,e.util.varOccurences(ge,P)<2?t+=" "+e.util.varReplace(ge,P,Ue)+" ":t+=" var "+P+" = "+Ue+"; "+ge+" ",t+=" if (!"+b+") { errors = "+v+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+h+"["+g+"]; } ",e.compositeRule=p.compositeRule=nr}else{p.schema=J,p.schemaPath=e.schemaPath+".additionalProperties",p.errSchemaPath=e.errSchemaPath+"/additionalProperties",p.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ue=h+"["+g+"]";p.dataPathArr[E]=g;var ge=e.validate(p);p.baseId=q,e.util.varOccurences(ge,P)<2?t+=" "+e.util.varReplace(ge,P,Ue)+" ":t+=" var "+P+" = "+Ue+"; "+ge+" ",u&&(t+=" if (!"+b+") break; ")}e.errorPath=Ze}$&&(t+=" } "),t+=" } ",u&&(t+=" if ("+b+") { ",y+="}")}var Zt=e.opts.useDefaults&&!e.compositeRule;if(I.length){var It=I;if(It)for(var K,sr=-1,or=It.length-1;sr<or;){K=It[sr+=1];var Ne=i[K];if(e.opts.strictKeywords?typeof Ne=="object"&&Object.keys(Ne).length>0||Ne===!1:e.util.schemaHasRules(Ne,e.RULES.all)){var nt=e.util.getProperty(K),Ue=h+nt,We=Zt&&Ne.default!==void 0;p.schema=Ne,p.schemaPath=d+nt,p.errSchemaPath=c+"/"+e.util.escapeFragment(K),p.errorPath=e.util.getPath(e.errorPath,K,e.opts.jsonPointers),p.dataPathArr[E]=e.util.toQuotedString(K);var ge=e.validate(p);if(p.baseId=q,e.util.varOccurences(ge,P)<2){ge=e.util.varReplace(ge,P,Ue);var He=Ue}else{var He=P;t+=" var "+P+" = "+Ue+"; "}if(We)t+=" "+ge+" ";else{if(ie&&ie[K]){t+=" if ( "+He+" === undefined ",D&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(K)+"') "),t+=") { "+b+" = false; ";var Ze=e.errorPath,At=c,bt=e.util.escapeQuotes(K);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ze,K,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var je=je||[];je.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+bt+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+bt+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var Ce=t;t=je.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+Ce+"]); ":t+=" validate.errors = ["+Ce+"]; return false; ":t+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=At,e.errorPath=Ze,t+=" } else { "}else u?(t+=" if ( "+He+" === undefined ",D&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(K)+"') "),t+=") { "+b+" = true; } else { "):(t+=" if ("+He+" !== undefined ",D&&(t+=" && Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(K)+"') "),t+=" ) { ");t+=" "+ge+" } "}}u&&(t+=" if ("+b+") { ",y+="}")}}if(W.length){var tt=W;if(tt)for(var he,za=-1,Hn=tt.length-1;za<Hn;){he=tt[za+=1];var Ne=j[he];if(e.opts.strictKeywords?typeof Ne=="object"&&Object.keys(Ne).length>0||Ne===!1:e.util.schemaHasRules(Ne,e.RULES.all)){p.schema=Ne,p.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(he),p.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(he),D?t+=" "+O+" = "+O+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+O+".length; "+S+"++) { var "+g+" = "+O+"["+S+"]; ":t+=" for (var "+g+" in "+h+") { ",t+=" if ("+e.usePattern(he)+".test("+g+")) { ",p.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var Ue=h+"["+g+"]";p.dataPathArr[E]=g;var ge=e.validate(p);p.baseId=q,e.util.varOccurences(ge,P)<2?t+=" "+e.util.varReplace(ge,P,Ue)+" ":t+=" var "+P+" = "+Ue+"; "+ge+" ",u&&(t+=" if (!"+b+") break; "),t+=" } ",u&&(t+=" else "+b+" = true; "),t+=" } ",u&&(t+=" if ("+b+") { ",y+="}")}}}return u&&(t+=" "+y+" if ("+v+" == errors) {"),t}});var gc=ee((Ty,mc)=>{"use strict";mc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="errs__"+s,p=e.util.copy(e),y="";p.level++;var b="valid"+p.level;if(t+="var "+v+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){p.schema=i,p.schemaPath=d,p.errSchemaPath=c;var g="key"+s,S="idx"+s,E="i"+s,P="' + "+g+" + '",O=p.dataLevel=e.dataLevel+1,I="data"+O,j="dataProperties"+s,W=e.opts.ownProperties,J=e.baseId;W&&(t+=" var "+j+" = undefined; "),W?t+=" "+j+" = "+j+" || Object.keys("+h+"); for (var "+S+"=0; "+S+"<"+j+".length; "+S+"++) { var "+g+" = "+j+"["+S+"]; ":t+=" for (var "+g+" in "+h+") { ",t+=" var startErrs"+s+" = errors; ";var $=g,Z=e.compositeRule;e.compositeRule=p.compositeRule=!0;var V=e.validate(p);p.baseId=J,e.util.varOccurences(V,I)<2?t+=" "+e.util.varReplace(V,I,$)+" ":t+=" var "+I+" = "+$+"; "+V+" ",e.compositeRule=p.compositeRule=Z,t+=" if (!"+b+") { for (var "+E+"=startErrs"+s+"; "+E+"<errors; "+E+"++) { vErrors["+E+"].propertyName = "+g+"; } var err = ",e.createErrors!==!1?(t+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(t+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; "),u&&(t+=" break; "),t+=" } }"}return u&&(t+=" "+y+" if ("+v+" == errors) {"),t}});var yc=ee((Oy,vc)=>{"use strict";vc.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,p=e.opts.$data&&i&&i.$data,y;p?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+s):y=i;var b="schema"+s;if(!p)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var g=[],S=i;if(S)for(var E,P=-1,O=S.length-1;P<O;){E=S[P+=1];var I=e.schema.properties[E];I&&(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))||(g[g.length]=E)}}else var g=i;if(p||g.length){var j=e.errorPath,W=p||g.length>=e.opts.loopRequired,J=e.opts.ownProperties;if(u)if(t+=" var missing"+s+"; ",W){p||(t+=" var "+b+" = validate.schema"+d+"; ");var $="i"+s,Z="schema"+s+"["+$+"]",V="' + "+Z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(j,Z,e.opts.jsonPointers)),t+=" var "+v+" = true; ",p&&(t+=" if (schema"+s+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+s+")) "+v+" = false; else {"),t+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { "+v+" = "+h+"["+b+"["+$+"]] !== undefined ",J&&(t+=" && Object.prototype.hasOwnProperty.call("+h+", "+b+"["+$+"]) "),t+="; if (!"+v+") break; } ",p&&(t+=" } "),t+=" if (!"+v+") { ";var U=U||[];U.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var A=t;t=U.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+A+"]); ":t+=" validate.errors = ["+A+"]; return false; ":t+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { "}else{t+=" if ( ";var D=g;if(D)for(var q,$=-1,_e=D.length-1;$<_e;){q=D[$+=1],$&&(t+=" || ");var ie=e.util.getProperty(q),ue=h+ie;t+=" ( ( "+ue+" === undefined ",J&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(q)+"') "),t+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:ie)+") ) "}t+=") { ";var Z="missing"+s,V="' + "+Z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(j,Z,!0):j+" + "+Z);var U=U||[];U.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var A=t;t=U.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+A+"]); ":t+=" validate.errors = ["+A+"]; return false; ":t+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } else { "}else if(W){p||(t+=" var "+b+" = validate.schema"+d+"; ");var $="i"+s,Z="schema"+s+"["+$+"]",V="' + "+Z+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(j,Z,e.opts.jsonPointers)),p&&(t+=" if ("+b+" && !Array.isArray("+b+")) { var err = ",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+b+" !== undefined) { "),t+=" for (var "+$+" = 0; "+$+" < "+b+".length; "+$+"++) { if ("+h+"["+b+"["+$+"]] === undefined ",J&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", "+b+"["+$+"]) "),t+=") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",p&&(t+=" } ")}else{var oe=g;if(oe)for(var q,K=-1,Oe=oe.length-1;K<Oe;){q=oe[K+=1];var ie=e.util.getProperty(q),V=e.util.escapeQuotes(q),ue=h+ie;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(j,q,e.opts.jsonPointers)),t+=" if ( "+ue+" === undefined ",J&&(t+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+e.util.escapeQuotes(q)+"') "),t+=") { var err = ",e.createErrors!==!1?(t+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+V+"' } ",e.opts.messages!==!1&&(t+=" , message: '",e.opts._errorDataPathProperty?t+="is a required property":t+="should have required property \\'"+V+"\\'",t+="' "),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=j}else u&&(t+=" if (true) {");return t}});var bc=ee((Cy,_c)=>{"use strict";_c.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h="data"+(o||""),v="valid"+s,p=e.opts.$data&&i&&i.$data,y;if(p?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+s):y=i,(i||p)&&e.opts.uniqueItems!==!1){p&&(t+=" var "+v+"; if ("+y+" === false || "+y+" === undefined) "+v+" = true; else if (typeof "+y+" != 'boolean') "+v+" = false; else { "),t+=" var i = "+h+".length , "+v+" = true , j; if (i > 1) { ";var b=e.schema.items&&e.schema.items.type,g=Array.isArray(b);if(!b||b=="object"||b=="array"||g&&(b.indexOf("object")>=0||b.indexOf("array")>=0))t+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+v+" = false; break outer; } } } ";else{t+=" var itemIndices = {}, item; for (;i--;) { var item = "+h+"[i]; ";var S="checkDataType"+(g?"s":"");t+=" if ("+e.util[S](b,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(t+=` if (typeof item == 'string') item = '"' + item; `),t+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}t+=" } ",p&&(t+=" } "),t+=" if (!"+v+") { ";var E=E||[];E.push(t),t="",e.createErrors!==!1?(t+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(t+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(t+=" , schema: ",p?t+="validate.schema"+d:t+=""+i,t+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),t+=" } "):t+=" {} ";var P=t;t=E.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+P+"]); ":t+=" validate.errors = ["+P+"]; return false; ":t+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",t+=" } ",u&&(t+=" else { ")}else u&&(t+=" if (true) { ");return t}});var wc=ee((Ay,xc)=>{"use strict";xc.exports={$ref:$i(),allOf:Li(),anyOf:Mi(),$comment:Fi(),const:qi(),contains:Ji(),dependencies:Hi(),enum:Wi(),format:Qi(),if:Yi(),items:ec(),maximum:Ts(),minimum:Ts(),maxItems:Os(),minItems:Os(),maxLength:Cs(),minLength:Cs(),maxProperties:As(),minProperties:As(),multipleOf:oc(),not:cc(),oneOf:dc(),pattern:pc(),properties:hc(),propertyNames:gc(),required:yc(),uniqueItems:bc(),validate:Es()}});var Pc=ee((Iy,Sc)=>{"use strict";var kc=wc(),Is=Er().toHash;Sc.exports=function(){var e=[{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"]}],r=["type","$comment"],n=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],t=["number","integer","string","array","object","boolean","null"];return e.all=Is(r),e.types=Is(t),e.forEach(function(s){s.rules=s.rules.map(function(o){var i;if(typeof o=="object"){var d=Object.keys(o)[0];i=o[d],o=d,i.forEach(function(u){r.push(u),e.all[u]=!0})}r.push(o);var c=e.all[o]={keyword:o,code:kc[o],implements:i};return c}),e.all.$comment={keyword:"$comment",code:kc.$comment},s.type&&(e.types[s.type]=s)}),e.keywords=Is(r.concat(n)),e.custom={},e}});var Tc=ee((jy,Rc)=>{"use strict";var Ec=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Rc.exports=function(a,e){for(var r=0;r<e.length;r++){a=JSON.parse(JSON.stringify(a));var n=e[r].split("/"),t=a,s;for(s=1;s<n.length;s++)t=t[n[s]];for(s=0;s<Ec.length;s++){var o=Ec[s],i=t[o];i&&(t[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var Ac=ee(($y,Cc)=>{"use strict";var Lf=bn().MissingRef;Cc.exports=Oc;function Oc(a,e,r){var n=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(r=e,e=void 0);var t=s(a).then(function(){var i=n._addSchema(a,void 0,e);return i.validate||o(i)});return r&&t.then(function(i){r(null,i)},r),t;function s(i){var d=i.$schema;return d&&!n.getSchema(d)?Oc.call(n,{$ref:d},!0):Promise.resolve()}function o(i){try{return n._compile(i)}catch(c){if(c instanceof Lf)return d(c);throw c}function d(c){var u=c.missingSchema;if(p(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var h=n._loadingSchemas[u];return h||(h=n._loadingSchemas[u]=n._opts.loadSchema(u),h.then(v,v)),h.then(function(y){if(!p(u))return s(y).then(function(){p(u)||n.addSchema(y,u,void 0,e)})}).then(function(){return o(i)});function v(){delete n._loadingSchemas[u]}function p(y){return n._refs[y]||n._schemas[y]}}}}});var jc=ee((Dy,Ic)=>{"use strict";Ic.exports=function(e,r,n){var t=" ",s=e.level,o=e.dataLevel,i=e.schema[r],d=e.schemaPath+e.util.getProperty(r),c=e.errSchemaPath+"/"+r,u=!e.opts.allErrors,h,v="data"+(o||""),p="valid"+s,y="errs__"+s,b=e.opts.$data&&i&&i.$data,g;b?(t+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",g="schema"+s):g=i;var S=this,E="definition"+s,P=S.definition,O="",I,j,W,J,$;if(b&&P.$data){$="keywordValidate"+s;var Z=P.validateSchema;t+=" var "+E+" = RULES.custom['"+r+"'].definition; var "+$+" = "+E+".validate;"}else{if(J=e.useCustomRule(S,i,e.schema,e),!J)return;g="validate.schema"+d,$=J.code,I=P.compile,j=P.inline,W=P.macro}var V=$+".errors",U="i"+s,A="ruleErr"+s,D=P.async;if(D&&!e.async)throw new Error("async keyword in sync schema");if(j||W||(t+=""+V+" = null;"),t+="var "+y+" = errors;var "+p+";",b&&P.$data&&(O+="}",t+=" if ("+g+" === undefined) { "+p+" = true; } else { ",Z&&(O+="}",t+=" "+p+" = "+E+".validateSchema("+g+"); if ("+p+") { ")),j)P.statements?t+=" "+J.validate+" ":t+=" "+p+" = "+J.validate+"; ";else if(W){var q=e.util.copy(e),O="";q.level++;var _e="valid"+q.level;q.schema=J.validate,q.schemaPath="";var ie=e.compositeRule;e.compositeRule=q.compositeRule=!0;var ue=e.validate(q).replace(/validate\.schema/g,$);e.compositeRule=q.compositeRule=ie,t+=" "+ue}else{var oe=oe||[];oe.push(t),t="",t+=" "+$+".call( ",e.opts.passContext?t+="this":t+="self",I||P.schema===!1?t+=" , "+v+" ":t+=" , "+g+" , "+v+" , validate.schema"+e.schemaPath+" ",t+=" , (dataPath || '')",e.errorPath!='""'&&(t+=" + "+e.errorPath);var K=o?"data"+(o-1||""):"parentData",Oe=o?e.dataPathArr[o]:"parentDataProperty";t+=" , "+K+" , "+Oe+" , rootData ) ";var Fe=t;t=oe.pop(),P.errors===!1?(t+=" "+p+" = ",D&&(t+="await "),t+=""+Fe+"; "):D?(V="customErrors"+s,t+=" var "+V+" = null; try { "+p+" = await "+Fe+"; } catch (e) { "+p+" = false; if (e instanceof ValidationError) "+V+" = e.errors; else throw e; } "):t+=" "+V+" = null; "+p+" = "+Fe+"; "}if(P.modifying&&(t+=" if ("+K+") "+v+" = "+K+"["+Oe+"];"),t+=""+O,P.valid)u&&(t+=" if (true) { ");else{t+=" if ( ",P.valid===void 0?(t+=" !",W?t+=""+_e:t+=""+p):t+=" "+!P.valid+" ",t+=") { ",h=S.keyword;var oe=oe||[];oe.push(t),t="";var oe=oe||[];oe.push(t),t="",e.createErrors!==!1?(t+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(t+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),t+=" } "):t+=" {} ";var Je=t;t=oe.pop(),!e.compositeRule&&u?e.async?t+=" throw new ValidationError(["+Je+"]); ":t+=" validate.errors = ["+Je+"]; return false; ":t+=" var err = "+Je+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var he=t;t=oe.pop(),j?P.errors?P.errors!="full"&&(t+=" for (var "+U+"="+y+"; "+U+"<errors; "+U+"++) { var "+A+" = vErrors["+U+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(t+=" "+A+".schema = "+g+"; "+A+".data = "+v+"; "),t+=" } "):P.errors===!1?t+=" "+he+" ":(t+=" if ("+y+" == errors) { "+he+" } else { for (var "+U+"="+y+"; "+U+"<errors; "+U+"++) { var "+A+" = vErrors["+U+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(t+=" "+A+".schema = "+g+"; "+A+".data = "+v+"; "),t+=" } } "):W?(t+=" var err = ",e.createErrors!==!1?(t+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(t+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(t+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+v+" "),t+=" } "):t+=" {} ",t+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?t+=" throw new ValidationError(vErrors); ":t+=" validate.errors = vErrors; return false; ")):P.errors===!1?t+=" "+he+" ":(t+=" if (Array.isArray("+V+")) { if (vErrors === null) vErrors = "+V+"; else vErrors = vErrors.concat("+V+"); errors = vErrors.length; for (var "+U+"="+y+"; "+U+"<errors; "+U+"++) { var "+A+" = vErrors["+U+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; "+A+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(t+=" "+A+".schema = "+g+"; "+A+".data = "+v+"; "),t+=" } } else { "+he+" } "),t+=" } ",u&&(t+=" else { ")}return t}});var js=ee((Ly,Nf)=>{Nf.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 Lc=ee((Ny,Dc)=>{"use strict";var $c=js();Dc.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:$c.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:$c.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 Mc=ee((My,Nc)=>{"use strict";var Mf=/^[a-z_$][a-z0-9_$-]*$/i,zf=jc(),Ff=Lc();Nc.exports={add:Uf,get:qf,remove:Vf,validate:$s};function Uf(a,e){var r=this.RULES;if(r.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Mf.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var n=e.type;if(Array.isArray(n))for(var t=0;t<n.length;t++)o(a,n[t],e);else o(a,n,e);var s=e.metaSchema;s&&(e.$data&&this._opts.$data&&(s={anyOf:[s,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(s,!0))}r.keywords[a]=r.all[a]=!0;function o(i,d,c){for(var u,h=0;h<r.length;h++){var v=r[h];if(v.type==d){u=v;break}}u||(u={type:d,rules:[]},r.push(u));var p={keyword:i,definition:c,custom:!0,code:zf,implements:c.implements};u.rules.push(p),r.custom[i]=p}return this}function qf(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Vf(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var r=0;r<e.length;r++)for(var n=e[r].rules,t=0;t<n.length;t++)if(n[t].keyword==a){n.splice(t,1);break}return this}function $s(a,e){$s.errors=null;var r=this._validateKeyword=this._validateKeyword||this.compile(Ff,!0);if(r(a))return!0;if($s.errors=r.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(r.errors));return!1}});var zc=ee((zy,Jf)=>{Jf.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 Kc=ee((Fy,Wc)=>{"use strict";var Uc=yi(),Rr=_n(),Zf=bi(),qc=_s(),Hf=Ps(),Bf=Ii(),Wf=Pc(),Vc=Tc(),Jc=Er();Wc.exports=Ae;Ae.prototype.validate=Qf;Ae.prototype.compile=Gf;Ae.prototype.addSchema=Yf;Ae.prototype.addMetaSchema=Xf;Ae.prototype.validateSchema=eh;Ae.prototype.getSchema=rh;Ae.prototype.removeSchema=nh;Ae.prototype.addFormat=ph;Ae.prototype.errorsText=uh;Ae.prototype._addSchema=sh;Ae.prototype._compile=oh;Ae.prototype.compileAsync=Ac();var Tn=Mc();Ae.prototype.addKeyword=Tn.add;Ae.prototype.getKeyword=Tn.get;Ae.prototype.removeKeyword=Tn.remove;Ae.prototype.validateKeyword=Tn.validate;var Zc=bn();Ae.ValidationError=Zc.Validation;Ae.MissingRefError=Zc.MissingRef;Ae.$dataMetaSchema=Vc;var Rn="http://json-schema.org/draft-07/schema",Fc=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Kf=["/properties"];function Ae(a){if(!(this instanceof Ae))return new Ae(a);a=this._opts=Jc.copy(a)||{},yh(this),this._schemas={},this._refs={},this._fragments={},this._formats=Bf(a.format),this._cache=a.cache||new Zf,this._loadingSchemas={},this._compilations=[],this.RULES=Wf(),this._getId=ih(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Hf),this._metaOpts=vh(this),a.formats&&mh(this),a.keywords&&gh(this),fh(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),hh(this)}function Qf(a,e){var r;if(typeof a=="string"){if(r=this.getSchema(a),!r)throw new Error('no schema with key or ref "'+a+'"')}else{var n=this._addSchema(a);r=n.validate||this._compile(n)}var t=r(e);return r.$async!==!0&&(this.errors=r.errors),t}function Gf(a,e){var r=this._addSchema(a,void 0,e);return r.validate||this._compile(r)}function Yf(a,e,r,n){if(Array.isArray(a)){for(var t=0;t<a.length;t++)this.addSchema(a[t],void 0,r,n);return this}var s=this._getId(a);if(s!==void 0&&typeof s!="string")throw new Error("schema id must be string");return e=Rr.normalizeId(e||s),Bc(this,e),this._schemas[e]=this._addSchema(a,r,n,!0),this}function Xf(a,e,r){return this.addSchema(a,e,r,!0),this}function eh(a,e){var r=a.$schema;if(r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this._opts.defaultMeta||th(this),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var n=this.validate(r,a);if(!n&&e){var t="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(t);else throw new Error(t)}return n}function th(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(Rn)?Rn:void 0,a._opts.defaultMeta}function rh(a){var e=Hc(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return ah(this,a)}}function ah(a,e){var r=Rr.schema.call(a,{schema:{}},e);if(r){var n=r.schema,t=r.root,s=r.baseId,o=Uc.call(a,n,t,void 0,s);return a._fragments[e]=new qc({ref:e,fragment:!0,schema:n,root:t,baseId:s,validate:o}),o}}function Hc(a,e){return e=Rr.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function nh(a){if(a instanceof RegExp)return En(this,this._schemas,a),En(this,this._refs,a),this;switch(typeof a){case"undefined":return En(this,this._schemas),En(this,this._refs),this._cache.clear(),this;case"string":var e=Hc(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var r=this._opts.serialize,n=r?r(a):a;this._cache.del(n);var t=this._getId(a);t&&(t=Rr.normalizeId(t),delete this._schemas[t],delete this._refs[t])}return this}function En(a,e,r){for(var n in e){var t=e[n];!t.meta&&(!r||r.test(n))&&(a._cache.del(t.cacheKey),delete e[n])}}function sh(a,e,r,n){if(typeof a!="object"&&typeof a!="boolean")throw new Error("schema should be object or boolean");var t=this._opts.serialize,s=t?t(a):a,o=this._cache.get(s);if(o)return o;n=n||this._opts.addUsedSchema!==!1;var i=Rr.normalizeId(this._getId(a));i&&n&&Bc(this,i);var d=this._opts.validateSchema!==!1&&!e,c;d&&!(c=i&&i==Rr.normalizeId(a.$schema))&&this.validateSchema(a,!0);var u=Rr.ids.call(this,a),h=new qc({id:i,schema:a,localRefs:u,cacheKey:s,meta:r});return i[0]!="#"&&n&&(this._refs[i]=h),this._cache.put(s,h),d&&c&&this.validateSchema(a,!0),h}function oh(a,e){if(a.compiling)return a.validate=t,t.schema=a.schema,t.errors=null,t.root=e||t,a.schema.$async===!0&&(t.$async=!0),t;a.compiling=!0;var r;a.meta&&(r=this._opts,this._opts=this._metaOpts);var n;try{n=Uc.call(this,a.schema,e,a.localRefs)}catch(s){throw delete a.validate,s}finally{a.compiling=!1,a.meta&&(this._opts=r)}return a.validate=n,a.refs=n.refs,a.refVal=n.refVal,a.root=n.root,n;function t(){var s=a.validate,o=s.apply(this,arguments);return t.errors=s.errors,o}}function ih(a){switch(a.schemaId){case"auto":return dh;case"id":return ch;default:return lh}}function ch(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function lh(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function dh(a){if(a.$id&&a.id&&a.$id!=a.id)throw new Error("schema $id is different from id");return a.$id||a.id}function uh(a,e){if(a=a||this.errors,!a)return"No errors";e=e||{};for(var r=e.separator===void 0?", ":e.separator,n=e.dataVar===void 0?"data":e.dataVar,t="",s=0;s<a.length;s++){var o=a[s];o&&(t+=n+o.dataPath+" "+o.message+r)}return t.slice(0,-r.length)}function ph(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function fh(a){var e;if(a._opts.$data&&(e=zc(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var r=js();a._opts.$data&&(r=Vc(r,Kf)),a.addMetaSchema(r,Rn,!0),a._refs["http://json-schema.org/schema"]=Rn}}function hh(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var r in e)a.addSchema(e[r],r)}function mh(a){for(var e in a._opts.formats){var r=a._opts.formats[e];a.addFormat(e,r)}}function gh(a){for(var e in a._opts.keywords){var r=a._opts.keywords[e];a.addKeyword(e,r)}}function Bc(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function vh(a){for(var e=Jc.copy(a._opts),r=0;r<Fc.length;r++)delete e[Fc[r]];return e}function yh(a){var e=a._opts.logger;if(e===!1)a.logger={log:Ds,warn:Ds,error:Ds};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");a.logger=e}}function Ds(){}});import{pathToFileURL as ev}from"node:url";var l={};yo(l,{BRAND:()=>pu,DIRTY:()=>dr,EMPTY_PATH:()=>Jd,INVALID:()=>Q,NEVER:()=>Qu,OK:()=>qe,ParseStatus:()=>Me,Schema:()=>re,ZodAny:()=>Wt,ZodArray:()=>zt,ZodBigInt:()=>pr,ZodBoolean:()=>fr,ZodBranded:()=>Ra,ZodCatch:()=>Sr,ZodDate:()=>hr,ZodDefault:()=>kr,ZodDiscriminatedUnion:()=>Za,ZodEffects:()=>lt,ZodEnum:()=>xr,ZodError:()=>Ke,ZodFirstPartyTypeKind:()=>C,ZodFunction:()=>Ba,ZodIntersection:()=>yr,ZodIssueCode:()=>R,ZodLazy:()=>_r,ZodLiteral:()=>br,ZodMap:()=>aa,ZodNaN:()=>sa,ZodNativeEnum:()=>wr,ZodNever:()=>gt,ZodNull:()=>gr,ZodNullable:()=>Pt,ZodNumber:()=>ur,ZodObject:()=>Qe,ZodOptional:()=>it,ZodParsedType:()=>M,ZodPipeline:()=>Ta,ZodPromise:()=>Kt,ZodReadonly:()=>Pr,ZodRecord:()=>Ha,ZodSchema:()=>re,ZodSet:()=>na,ZodString:()=>Bt,ZodSymbol:()=>ta,ZodTransformer:()=>lt,ZodTuple:()=>St,ZodType:()=>re,ZodUndefined:()=>mr,ZodUnion:()=>vr,ZodUnknown:()=>Mt,ZodVoid:()=>ra,addIssueToContext:()=>L,any:()=>xu,array:()=>Pu,bigint:()=>gu,boolean:()=>Oo,coerce:()=>Ku,custom:()=>Eo,date:()=>vu,datetimeRegex:()=>So,defaultErrorMap:()=>Lt,discriminatedUnion:()=>Ou,effect:()=>Uu,enum:()=>Mu,function:()=>Du,getErrorMap:()=>Yr,getParsedType:()=>kt,instanceof:()=>hu,intersection:()=>Cu,isAborted:()=>Va,isAsync:()=>Xr,isDirty:()=>Ja,isValid:()=>Ht,late:()=>fu,lazy:()=>Lu,literal:()=>Nu,makeIssue:()=>Ea,map:()=>ju,nan:()=>mu,nativeEnum:()=>zu,never:()=>ku,null:()=>bu,nullable:()=>Vu,number:()=>To,object:()=>Eu,objectUtil:()=>Gn,oboolean:()=>Wu,onumber:()=>Bu,optional:()=>qu,ostring:()=>Hu,pipeline:()=>Zu,preprocess:()=>Ju,promise:()=>Fu,quotelessJson:()=>Ud,record:()=>Iu,set:()=>$u,setErrorMap:()=>Vd,strictObject:()=>Ru,string:()=>Ro,symbol:()=>yu,transformer:()=>Uu,tuple:()=>Au,undefined:()=>_u,union:()=>Tu,unknown:()=>wu,util:()=>ce,void:()=>Su});var ce;(function(a){a.assertEqual=t=>{};function e(t){}a.assertIs=e;function r(t){throw new Error}a.assertNever=r,a.arrayToEnum=t=>{let s={};for(let o of t)s[o]=o;return s},a.getValidEnumValues=t=>{let s=a.objectKeys(t).filter(i=>typeof t[t[i]]!="number"),o={};for(let i of s)o[i]=t[i];return a.objectValues(o)},a.objectValues=t=>a.objectKeys(t).map(function(s){return t[s]}),a.objectKeys=typeof Object.keys=="function"?t=>Object.keys(t):t=>{let s=[];for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&s.push(o);return s},a.find=(t,s)=>{for(let o of t)if(s(o))return o},a.isInteger=typeof Number.isInteger=="function"?t=>Number.isInteger(t):t=>typeof t=="number"&&Number.isFinite(t)&&Math.floor(t)===t;function n(t,s=" | "){return t.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}a.joinValues=n,a.jsonStringifyReplacer=(t,s)=>typeof s=="bigint"?s.toString():s})(ce||(ce={}));var Gn;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(Gn||(Gn={}));var M=ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),kt=a=>{switch(typeof a){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(a)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(a)?M.array:a===null?M.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?M.promise:typeof Map<"u"&&a instanceof Map?M.map:typeof Set<"u"&&a instanceof Set?M.set:typeof Date<"u"&&a instanceof Date?M.date:M.object;default:return M.unknown}};var R=ce.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"]),Ud=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ke=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},t=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(t);else if(o.code==="invalid_return_type")t(o.returnTypeError);else if(o.code==="invalid_arguments")t(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let i=n,d=0;for(;d<o.path.length;){let c=o.path[d];d===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(r(o))):i[c]=i[c]||{_errors:[]},i=i[c],d++}}};return t(this),n}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let t of this.issues)if(t.path.length>0){let s=t.path[0];r[s]=r[s]||[],r[s].push(e(t))}else n.push(e(t));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ke.create=a=>new Ke(a);var qd=(a,e)=>{let r;switch(a.code){case R.invalid_type:a.received===M.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case R.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,ce.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:r=`Unrecognized key(s) in object: ${ce.joinValues(a.keys,", ")}`;break;case R.invalid_union:r="Invalid input";break;case R.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ce.joinValues(a.options)}`;break;case R.invalid_enum_value:r=`Invalid enum value. Expected ${ce.joinValues(a.options)}, received '${a.received}'`;break;case R.invalid_arguments:r="Invalid function arguments";break;case R.invalid_return_type:r="Invalid function return type";break;case R.invalid_date:r="Invalid date";break;case R.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:ce.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case R.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case R.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case R.custom:r="Invalid input";break;case R.invalid_intersection_types:r="Intersection results could not be merged";break;case R.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case R.not_finite:r="Number must be finite";break;default:r=e.defaultError,ce.assertNever(a)}return{message:r}},Lt=qd;var _o=Lt;function Vd(a){_o=a}function Yr(){return _o}var Ea=a=>{let{data:e,path:r,errorMaps:n,issueData:t}=a,s=[...r,...t.path||[]],o={...t,path:s};if(t.message!==void 0)return{...t,path:s,message:t.message};let i="",d=n.filter(c=>!!c).slice().reverse();for(let c of d)i=c(o,{data:e,defaultError:i}).message;return{...t,path:s,message:i}},Jd=[];function L(a,e){let r=Yr(),n=Ea({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===Lt?void 0:Lt].filter(t=>!!t)});a.common.issues.push(n)}var Me=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let t of r){if(t.status==="aborted")return Q;t.status==="dirty"&&e.dirty(),n.push(t.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let t of r){let s=await t.key,o=await t.value;n.push({key:s,value:o})}return a.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let t of r){let{key:s,value:o}=t;if(s.status==="aborted"||o.status==="aborted")return Q;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||t.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}},Q=Object.freeze({status:"aborted"}),dr=a=>({status:"dirty",value:a}),qe=a=>({status:"valid",value:a}),Va=a=>a.status==="aborted",Ja=a=>a.status==="dirty",Ht=a=>a.status==="valid",Xr=a=>typeof Promise<"u"&&a instanceof Promise;var H;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(H||(H={}));var ct=class{constructor(e,r,n,t){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=t}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},bo=(a,e)=>{if(Ht(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ke(a.common.issues);return this._error=r,this._error}}};function te(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:t}=a;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:t}:{errorMap:(o,i)=>{let{message:d}=a;return o.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??n??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:d??r??i.defaultError}},description:t}}var re=class{get description(){return this._def.description}_getType(e){return kt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:kt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Me,ctx:{common:e.parent.common,data:e.data,parsedType:kt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Xr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kt(e)},t=this._parseSync({data:e,path:n.path,parent:n});return bo(n,t)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Ht(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Ht(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kt(e)},t=this._parse({data:e,path:n.path,parent:n}),s=await(Xr(t)?t:Promise.resolve(t));return bo(n,s)}refine(e,r){let n=t=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(t):r;return this._refinement((t,s)=>{let o=e(t),i=()=>s.addIssue({code:R.custom,...n(t)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,r){return this._refinement((n,t)=>e(n)?!0:(t.addIssue(typeof r=="function"?r(n,t):r),!1))}_refinement(e){return new lt({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return it.create(this,this._def)}nullable(){return Pt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return zt.create(this)}promise(){return Kt.create(this,this._def)}or(e){return vr.create([this,e],this._def)}and(e){return yr.create(this,e,this._def)}transform(e){return new lt({...te(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new kr({...te(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new Ra({typeName:C.ZodBranded,type:this,...te(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Sr({...te(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ta.create(this,e)}readonly(){return Pr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Zd=/^c[^\s-]{8,}$/i,Hd=/^[0-9a-z]+$/,Bd=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Wd=/^[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,Kd=/^[a-z0-9_-]{21}$/i,Qd=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gd=/^[-+]?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)?)??$/,Yd=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Yn,eu=/^(?:(?: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])$/,tu=/^(?:(?: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])$/,ru=/^(([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]))$/,au=/^(([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])$/,nu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,su=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wo="((\\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])))",ou=new RegExp(`^${wo}$`);function ko(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function iu(a){return new RegExp(`^${ko(a)}$`)}function So(a){let e=`${wo}T${ko(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function cu(a,e){return!!((e==="v4"||!e)&&eu.test(a)||(e==="v6"||!e)&&ru.test(a))}function lu(a,e){if(!Qd.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),t=JSON.parse(atob(n));return!(typeof t!="object"||t===null||"typ"in t&&t?.typ!=="JWT"||!t.alg||e&&t.alg!==e)}catch{return!1}}function du(a,e){return!!((e==="v4"||!e)&&tu.test(a)||(e==="v6"||!e)&&au.test(a))}var Bt=class a extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==M.string){let s=this._getOrReturnCtx(e);return L(s,{code:R.invalid_type,expected:M.string,received:s.parsedType}),Q}let n=new Me,t;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(t=this._getOrReturnCtx(e,t),L(t,{code:R.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(t=this._getOrReturnCtx(e,t),L(t,{code:R.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,i=e.data.length<s.value;(o||i)&&(t=this._getOrReturnCtx(e,t),o?L(t,{code:R.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&L(t,{code:R.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Yd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"email",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Yn||(Yn=new RegExp(Xd,"u")),Yn.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"emoji",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Wd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"uuid",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Kd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"nanoid",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Zd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"cuid",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Hd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"cuid2",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Bd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"ulid",code:R.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{t=this._getOrReturnCtx(e,t),L(t,{validation:"url",code:R.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"regex",code:R.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?So(s).test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?ou.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?iu(s).test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:R.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Gd.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"duration",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?cu(e.data,s.version)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"ip",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?lu(e.data,s.alg)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"jwt",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?du(e.data,s.version)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"cidr",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?nu.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"base64",code:R.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?su.test(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{validation:"base64url",code:R.invalid_string,message:s.message}),n.dirty()):ce.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(t=>e.test(t),{validation:r,code:R.invalid_string,...H.errToObj(n)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...H.errToObj(e)})}url(e){return this._addCheck({kind:"url",...H.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...H.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...H.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...H.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...H.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...H.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...H.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...H.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...H.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...H.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...H.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...H.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...H.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...H.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...H.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...H.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...H.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...H.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...H.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...H.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...H.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...H.errToObj(r)})}nonempty(e){return this.min(1,H.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Bt.create=a=>new Bt({checks:[],typeName:C.ZodString,coerce:a?.coerce??!1,...te(a)});function uu(a,e){let r=(a.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,t=r>n?r:n,s=Number.parseInt(a.toFixed(t).replace(".","")),o=Number.parseInt(e.toFixed(t).replace(".",""));return s%o/10**t}var ur=class a extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==M.number){let s=this._getOrReturnCtx(e);return L(s,{code:R.invalid_type,expected:M.number,received:s.parsedType}),Q}let n,t=new Me;for(let s of this._def.checks)s.kind==="int"?ce.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:R.invalid_type,expected:"integer",received:"float",message:s.message}),t.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),t.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),t.dirty()):s.kind==="multipleOf"?uu(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.not_multiple_of,multipleOf:s.value,message:s.message}),t.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:R.not_finite,message:s.message}),t.dirty()):ce.assertNever(s);return{status:t.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,H.toString(r))}gt(e,r){return this.setLimit("min",e,!1,H.toString(r))}lte(e,r){return this.setLimit("max",e,!0,H.toString(r))}lt(e,r){return this.setLimit("max",e,!1,H.toString(r))}setLimit(e,r,n,t){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:H.toString(t)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:H.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:H.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:H.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:H.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:H.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ce.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};ur.create=a=>new ur({checks:[],typeName:C.ZodNumber,coerce:a?.coerce||!1,...te(a)});var pr=class a extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==M.bigint)return this._getInvalidInput(e);let n,t=new Me;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),t.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),t.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),L(n,{code:R.not_multiple_of,multipleOf:s.value,message:s.message}),t.dirty()):ce.assertNever(s);return{status:t.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return L(r,{code:R.invalid_type,expected:M.bigint,received:r.parsedType}),Q}gte(e,r){return this.setLimit("min",e,!0,H.toString(r))}gt(e,r){return this.setLimit("min",e,!1,H.toString(r))}lte(e,r){return this.setLimit("max",e,!0,H.toString(r))}lt(e,r){return this.setLimit("max",e,!1,H.toString(r))}setLimit(e,r,n,t){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:H.toString(t)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:H.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};pr.create=a=>new pr({checks:[],typeName:C.ZodBigInt,coerce:a?.coerce??!1,...te(a)});var fr=class extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==M.boolean){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.boolean,received:n.parsedType}),Q}return qe(e.data)}};fr.create=a=>new fr({typeName:C.ZodBoolean,coerce:a?.coerce||!1,...te(a)});var hr=class a extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==M.date){let s=this._getOrReturnCtx(e);return L(s,{code:R.invalid_type,expected:M.date,received:s.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return L(s,{code:R.invalid_date}),Q}let n=new Me,t;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(t=this._getOrReturnCtx(e,t),L(t,{code:R.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(t=this._getOrReturnCtx(e,t),L(t,{code:R.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):ce.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:H.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:H.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};hr.create=a=>new hr({checks:[],coerce:a?.coerce||!1,typeName:C.ZodDate,...te(a)});var ta=class extends re{_parse(e){if(this._getType(e)!==M.symbol){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.symbol,received:n.parsedType}),Q}return qe(e.data)}};ta.create=a=>new ta({typeName:C.ZodSymbol,...te(a)});var mr=class extends re{_parse(e){if(this._getType(e)!==M.undefined){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.undefined,received:n.parsedType}),Q}return qe(e.data)}};mr.create=a=>new mr({typeName:C.ZodUndefined,...te(a)});var gr=class extends re{_parse(e){if(this._getType(e)!==M.null){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.null,received:n.parsedType}),Q}return qe(e.data)}};gr.create=a=>new gr({typeName:C.ZodNull,...te(a)});var Wt=class extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return qe(e.data)}};Wt.create=a=>new Wt({typeName:C.ZodAny,...te(a)});var Mt=class extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return qe(e.data)}};Mt.create=a=>new Mt({typeName:C.ZodUnknown,...te(a)});var gt=class extends re{_parse(e){let r=this._getOrReturnCtx(e);return L(r,{code:R.invalid_type,expected:M.never,received:r.parsedType}),Q}};gt.create=a=>new gt({typeName:C.ZodNever,...te(a)});var ra=class extends re{_parse(e){if(this._getType(e)!==M.undefined){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.void,received:n.parsedType}),Q}return qe(e.data)}};ra.create=a=>new ra({typeName:C.ZodVoid,...te(a)});var zt=class a extends re{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),t=this._def;if(r.parsedType!==M.array)return L(r,{code:R.invalid_type,expected:M.array,received:r.parsedType}),Q;if(t.exactLength!==null){let o=r.data.length>t.exactLength.value,i=r.data.length<t.exactLength.value;(o||i)&&(L(r,{code:o?R.too_big:R.too_small,minimum:i?t.exactLength.value:void 0,maximum:o?t.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:t.exactLength.message}),n.dirty())}if(t.minLength!==null&&r.data.length<t.minLength.value&&(L(r,{code:R.too_small,minimum:t.minLength.value,type:"array",inclusive:!0,exact:!1,message:t.minLength.message}),n.dirty()),t.maxLength!==null&&r.data.length>t.maxLength.value&&(L(r,{code:R.too_big,maximum:t.maxLength.value,type:"array",inclusive:!0,exact:!1,message:t.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,i)=>t.type._parseAsync(new ct(r,o,r.path,i)))).then(o=>Me.mergeArray(n,o));let s=[...r.data].map((o,i)=>t.type._parseSync(new ct(r,o,r.path,i)));return Me.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:H.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:H.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:H.toString(r)}})}nonempty(e){return this.min(1,e)}};zt.create=(a,e)=>new zt({type:a,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...te(e)});function ea(a){if(a instanceof Qe){let e={};for(let r in a.shape){let n=a.shape[r];e[r]=it.create(ea(n))}return new Qe({...a._def,shape:()=>e})}else return a instanceof zt?new zt({...a._def,type:ea(a.element)}):a instanceof it?it.create(ea(a.unwrap())):a instanceof Pt?Pt.create(ea(a.unwrap())):a instanceof St?St.create(a.items.map(e=>ea(e))):a}var Qe=class a extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ce.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==M.object){let c=this._getOrReturnCtx(e);return L(c,{code:R.invalid_type,expected:M.object,received:c.parsedType}),Q}let{status:n,ctx:t}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof gt&&this._def.unknownKeys==="strip"))for(let c in t.data)o.includes(c)||i.push(c);let d=[];for(let c of o){let u=s[c],h=t.data[c];d.push({key:{status:"valid",value:c},value:u._parse(new ct(t,h,t.path,c)),alwaysSet:c in t.data})}if(this._def.catchall instanceof gt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)d.push({key:{status:"valid",value:u},value:{status:"valid",value:t.data[u]}});else if(c==="strict")i.length>0&&(L(t,{code:R.unrecognized_keys,keys:i}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let h=t.data[u];d.push({key:{status:"valid",value:u},value:c._parse(new ct(t,h,t.path,u)),alwaysSet:u in t.data})}}return t.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of d){let h=await u.key,v=await u.value;c.push({key:h,value:v,alwaysSet:u.alwaysSet})}return c}).then(c=>Me.mergeObjectSync(n,c)):Me.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return H.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let t=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:H.errToObj(e).message??t}:{message:t}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:C.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let n of ce.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ce.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new a({...this._def,shape:()=>r})}deepPartial(){return ea(this)}partial(e){let r={};for(let n of ce.objectKeys(this.shape)){let t=this.shape[n];e&&!e[n]?r[n]=t:r[n]=t.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let n of ce.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof it;)s=s._def.innerType;r[n]=s}return new a({...this._def,shape:()=>r})}keyof(){return Po(ce.objectKeys(this.shape))}};Qe.create=(a,e)=>new Qe({shape:()=>a,unknownKeys:"strip",catchall:gt.create(),typeName:C.ZodObject,...te(e)});Qe.strictCreate=(a,e)=>new Qe({shape:()=>a,unknownKeys:"strict",catchall:gt.create(),typeName:C.ZodObject,...te(e)});Qe.lazycreate=(a,e)=>new Qe({shape:a,unknownKeys:"strip",catchall:gt.create(),typeName:C.ZodObject,...te(e)});var vr=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function t(s){for(let i of s)if(i.result.status==="valid")return i.result;for(let i of s)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(i=>new Ke(i.ctx.common.issues));return L(r,{code:R.invalid_union,unionErrors:o}),Q}if(r.common.async)return Promise.all(n.map(async s=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(t);{let s,o=[];for(let d of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=d._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map(d=>new Ke(d));return L(r,{code:R.invalid_union,unionErrors:i}),Q}}get options(){return this._def.options}};vr.create=(a,e)=>new vr({options:a,typeName:C.ZodUnion,...te(e)});var Nt=a=>a instanceof _r?Nt(a.schema):a instanceof lt?Nt(a.innerType()):a instanceof br?[a.value]:a instanceof xr?a.options:a instanceof wr?ce.objectValues(a.enum):a instanceof kr?Nt(a._def.innerType):a instanceof mr?[void 0]:a instanceof gr?[null]:a instanceof it?[void 0,...Nt(a.unwrap())]:a instanceof Pt?[null,...Nt(a.unwrap())]:a instanceof Ra||a instanceof Pr?Nt(a.unwrap()):a instanceof Sr?Nt(a._def.innerType):[],Za=class a extends re{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==M.object)return L(r,{code:R.invalid_type,expected:M.object,received:r.parsedType}),Q;let n=this.discriminator,t=r.data[n],s=this.optionsMap.get(t);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(L(r,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let t=new Map;for(let s of r){let o=Nt(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(t.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);t.set(i,s)}}return new a({typeName:C.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:t,...te(n)})}};function Xn(a,e){let r=kt(a),n=kt(e);if(a===e)return{valid:!0,data:a};if(r===M.object&&n===M.object){let t=ce.objectKeys(e),s=ce.objectKeys(a).filter(i=>t.indexOf(i)!==-1),o={...a,...e};for(let i of s){let d=Xn(a[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(r===M.array&&n===M.array){if(a.length!==e.length)return{valid:!1};let t=[];for(let s=0;s<a.length;s++){let o=a[s],i=e[s],d=Xn(o,i);if(!d.valid)return{valid:!1};t.push(d.data)}return{valid:!0,data:t}}else return r===M.date&&n===M.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var yr=class extends re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),t=(s,o)=>{if(Va(s)||Va(o))return Q;let i=Xn(s.value,o.value);return i.valid?((Ja(s)||Ja(o))&&r.dirty(),{status:r.value,value:i.data}):(L(n,{code:R.invalid_intersection_types}),Q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>t(s,o)):t(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};yr.create=(a,e,r)=>new yr({left:a,right:e,typeName:C.ZodIntersection,...te(r)});var St=class a extends re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.array)return L(n,{code:R.invalid_type,expected:M.array,received:n.parsedType}),Q;if(n.data.length<this._def.items.length)return L(n,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&n.data.length>this._def.items.length&&(L(n,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((o,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new ct(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>Me.mergeArray(r,o)):Me.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};St.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new St({items:a,typeName:C.ZodTuple,rest:null,...te(e)})};var Ha=class a extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.object)return L(n,{code:R.invalid_type,expected:M.object,received:n.parsedType}),Q;let t=[],s=this._def.keyType,o=this._def.valueType;for(let i in n.data)t.push({key:s._parse(new ct(n,i,n.path,i)),value:o._parse(new ct(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?Me.mergeObjectAsync(r,t):Me.mergeObjectSync(r,t)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof re?new a({keyType:e,valueType:r,typeName:C.ZodRecord,...te(n)}):new a({keyType:Bt.create(),valueType:e,typeName:C.ZodRecord,...te(r)})}},aa=class extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.map)return L(n,{code:R.invalid_type,expected:M.map,received:n.parsedType}),Q;let t=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([i,d],c)=>({key:t._parse(new ct(n,i,n.path,[c,"key"])),value:s._parse(new ct(n,d,n.path,[c,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of o){let c=await d.key,u=await d.value;if(c.status==="aborted"||u.status==="aborted")return Q;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),i.set(c.value,u.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let d of o){let c=d.key,u=d.value;if(c.status==="aborted"||u.status==="aborted")return Q;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),i.set(c.value,u.value)}return{status:r.value,value:i}}}};aa.create=(a,e,r)=>new aa({valueType:e,keyType:a,typeName:C.ZodMap,...te(r)});var na=class a extends re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==M.set)return L(n,{code:R.invalid_type,expected:M.set,received:n.parsedType}),Q;let t=this._def;t.minSize!==null&&n.data.size<t.minSize.value&&(L(n,{code:R.too_small,minimum:t.minSize.value,type:"set",inclusive:!0,exact:!1,message:t.minSize.message}),r.dirty()),t.maxSize!==null&&n.data.size>t.maxSize.value&&(L(n,{code:R.too_big,maximum:t.maxSize.value,type:"set",inclusive:!0,exact:!1,message:t.maxSize.message}),r.dirty());let s=this._def.valueType;function o(d){let c=new Set;for(let u of d){if(u.status==="aborted")return Q;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let i=[...n.data.values()].map((d,c)=>s._parse(new ct(n,d,n.path,c)));return n.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,r){return new a({...this._def,minSize:{value:e,message:H.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:H.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};na.create=(a,e)=>new na({valueType:a,minSize:null,maxSize:null,typeName:C.ZodSet,...te(e)});var Ba=class a extends re{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==M.function)return L(r,{code:R.invalid_type,expected:M.function,received:r.parsedType}),Q;function n(i,d){return Ea({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Yr(),Lt].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:d}})}function t(i,d){return Ea({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Yr(),Lt].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:d}})}let s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Kt){let i=this;return qe(async function(...d){let c=new Ke([]),u=await i._def.args.parseAsync(d,s).catch(p=>{throw c.addIssue(n(d,p)),c}),h=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(h,s).catch(p=>{throw c.addIssue(t(h,p)),c})})}else{let i=this;return qe(function(...d){let c=i._def.args.safeParse(d,s);if(!c.success)throw new Ke([n(d,c.error)]);let u=Reflect.apply(o,this,c.data),h=i._def.returns.safeParse(u,s);if(!h.success)throw new Ke([t(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:St.create(e).rest(Mt.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new a({args:e||St.create([]).rest(Mt.create()),returns:r||Mt.create(),typeName:C.ZodFunction,...te(n)})}},_r=class extends re{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};_r.create=(a,e)=>new _r({getter:a,typeName:C.ZodLazy,...te(e)});var br=class extends re{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return L(r,{received:r.data,code:R.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};br.create=(a,e)=>new br({value:a,typeName:C.ZodLiteral,...te(e)});function Po(a,e){return new xr({values:a,typeName:C.ZodEnum,...te(e)})}var xr=class a extends re{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return L(r,{expected:ce.joinValues(n),received:r.parsedType,code:R.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return L(r,{received:r.data,code:R.invalid_enum_value,options:n}),Q}return qe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};xr.create=Po;var wr=class extends re{_parse(e){let r=ce.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==M.string&&n.parsedType!==M.number){let t=ce.objectValues(r);return L(n,{expected:ce.joinValues(t),received:n.parsedType,code:R.invalid_type}),Q}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let t=ce.objectValues(r);return L(n,{received:n.data,code:R.invalid_enum_value,options:t}),Q}return qe(e.data)}get enum(){return this._def.values}};wr.create=(a,e)=>new wr({values:a,typeName:C.ZodNativeEnum,...te(e)});var Kt=class extends re{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==M.promise&&r.common.async===!1)return L(r,{code:R.invalid_type,expected:M.promise,received:r.parsedType}),Q;let n=r.parsedType===M.promise?r.data:Promise.resolve(r.data);return qe(n.then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Kt.create=(a,e)=>new Kt({type:a,typeName:C.ZodPromise,...te(e)});var lt=class extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),t=this._def.effect||null,s={addIssue:o=>{L(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),t.type==="preprocess"){let o=t.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async i=>{if(r.value==="aborted")return Q;let d=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return d.status==="aborted"?Q:d.status==="dirty"?dr(d.value):r.value==="dirty"?dr(d.value):d});{if(r.value==="aborted")return Q;let i=this._def.schema._parseSync({data:o,path:n.path,parent:n});return i.status==="aborted"?Q:i.status==="dirty"?dr(i.value):r.value==="dirty"?dr(i.value):i}}if(t.type==="refinement"){let o=i=>{let d=t.refinement(i,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Q:(i.status==="dirty"&&r.dirty(),o(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?Q:(i.status==="dirty"&&r.dirty(),o(i.value).then(()=>({status:r.value,value:i.value}))))}if(t.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ht(o))return Q;let i=t.transform(o.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Ht(o)?Promise.resolve(t.transform(o.value,s)).then(i=>({status:r.value,value:i})):Q);ce.assertNever(t)}};lt.create=(a,e,r)=>new lt({schema:a,typeName:C.ZodEffects,effect:e,...te(r)});lt.createWithPreprocess=(a,e,r)=>new lt({schema:e,effect:{type:"preprocess",transform:a},typeName:C.ZodEffects,...te(r)});var it=class extends re{_parse(e){return this._getType(e)===M.undefined?qe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};it.create=(a,e)=>new it({innerType:a,typeName:C.ZodOptional,...te(e)});var Pt=class extends re{_parse(e){return this._getType(e)===M.null?qe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pt.create=(a,e)=>new Pt({innerType:a,typeName:C.ZodNullable,...te(e)});var kr=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};kr.create=(a,e)=>new kr({innerType:a,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...te(e)});var Sr=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},t=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xr(t)?t.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ke(n.common.issues)},input:n.data})})):{status:"valid",value:t.status==="valid"?t.value:this._def.catchValue({get error(){return new Ke(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Sr.create=(a,e)=>new Sr({innerType:a,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...te(e)});var sa=class extends re{_parse(e){if(this._getType(e)!==M.nan){let n=this._getOrReturnCtx(e);return L(n,{code:R.invalid_type,expected:M.nan,received:n.parsedType}),Q}return{status:"valid",value:e.data}}};sa.create=a=>new sa({typeName:C.ZodNaN,...te(a)});var pu=Symbol("zod_brand"),Ra=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ta=class a extends re{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Q:s.status==="dirty"?(r.dirty(),dr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let t=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return t.status==="aborted"?Q:t.status==="dirty"?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:n.path,parent:n})}}static create(e,r){return new a({in:e,out:r,typeName:C.ZodPipeline})}},Pr=class extends re{_parse(e){let r=this._def.innerType._parse(e),n=t=>(Ht(t)&&(t.value=Object.freeze(t.value)),t);return Xr(r)?r.then(t=>n(t)):n(r)}unwrap(){return this._def.innerType}};Pr.create=(a,e)=>new Pr({innerType:a,typeName:C.ZodReadonly,...te(e)});function xo(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function Eo(a,e={},r){return a?Wt.create().superRefine((n,t)=>{let s=a(n);if(s instanceof Promise)return s.then(o=>{if(!o){let i=xo(e,n),d=i.fatal??r??!0;t.addIssue({code:"custom",...i,fatal:d})}});if(!s){let o=xo(e,n),i=o.fatal??r??!0;t.addIssue({code:"custom",...o,fatal:i})}}):Wt.create()}var fu={object:Qe.lazycreate},C;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(C||(C={}));var hu=(a,e={message:`Input not instance of ${a.name}`})=>Eo(r=>r instanceof a,e),Ro=Bt.create,To=ur.create,mu=sa.create,gu=pr.create,Oo=fr.create,vu=hr.create,yu=ta.create,_u=mr.create,bu=gr.create,xu=Wt.create,wu=Mt.create,ku=gt.create,Su=ra.create,Pu=zt.create,Eu=Qe.create,Ru=Qe.strictCreate,Tu=vr.create,Ou=Za.create,Cu=yr.create,Au=St.create,Iu=Ha.create,ju=aa.create,$u=na.create,Du=Ba.create,Lu=_r.create,Nu=br.create,Mu=xr.create,zu=wr.create,Fu=Kt.create,Uu=lt.create,qu=it.create,Vu=Pt.create,Ju=lt.createWithPreprocess,Zu=Ta.create,Hu=()=>Ro().optional(),Bu=()=>To().optional(),Wu=()=>Oo().optional(),Ku={string:(a=>Bt.create({...a,coerce:!0})),number:(a=>ur.create({...a,coerce:!0})),boolean:(a=>fr.create({...a,coerce:!0})),bigint:(a=>pr.create({...a,coerce:!0})),date:(a=>hr.create({...a,coerce:!0}))};var Qu=Q;var es="2025-06-18";var Co=[es,"2025-03-26","2024-11-05","2024-10-07"],Wa="2.0",Ao=l.union([l.string(),l.number().int()]),Io=l.string(),Gu=l.object({progressToken:l.optional(Ao)}).passthrough(),dt=l.object({_meta:l.optional(Gu)}).passthrough(),Ge=l.object({method:l.string(),params:l.optional(dt)}),Oa=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),Et=l.object({method:l.string(),params:l.optional(Oa)}),ut=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ka=l.union([l.string(),l.number().int()]),jo=l.object({jsonrpc:l.literal(Wa),id:Ka}).merge(Ge).strict(),$o=a=>jo.safeParse(a).success,Do=l.object({jsonrpc:l.literal(Wa)}).merge(Et).strict(),Lo=a=>Do.safeParse(a).success,No=l.object({jsonrpc:l.literal(Wa),id:Ka,result:ut}).strict(),ts=a=>No.safeParse(a).success,we;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(we||(we={}));var Mo=l.object({jsonrpc:l.literal(Wa),id:Ka,error:l.object({code:l.number().int(),message:l.string(),data:l.optional(l.unknown())})}).strict(),zo=a=>Mo.safeParse(a).success,Fo=l.union([jo,Do,No,Mo]),Qa=ut.strict(),Ga=Et.extend({method:l.literal("notifications/cancelled"),params:Oa.extend({requestId:Ka,reason:l.string().optional()})}),Ya=l.object({src:l.string(),mimeType:l.optional(l.string()),sizes:l.optional(l.string())}).passthrough(),Ca=l.object({name:l.string(),title:l.optional(l.string())}).passthrough(),Uo=Ca.extend({version:l.string(),websiteUrl:l.optional(l.string()),icons:l.optional(l.array(Ya))}),Yu=l.object({experimental:l.optional(l.object({}).passthrough()),sampling:l.optional(l.object({}).passthrough()),elicitation:l.optional(l.object({}).passthrough()),roots:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),rs=Ge.extend({method:l.literal("initialize"),params:dt.extend({protocolVersion:l.string(),capabilities:Yu,clientInfo:Uo})});var Xu=l.object({experimental:l.optional(l.object({}).passthrough()),logging:l.optional(l.object({}).passthrough()),completions:l.optional(l.object({}).passthrough()),prompts:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough()),resources:l.optional(l.object({subscribe:l.optional(l.boolean()),listChanged:l.optional(l.boolean())}).passthrough()),tools:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),ep=ut.extend({protocolVersion:l.string(),capabilities:Xu,serverInfo:Uo,instructions:l.optional(l.string())}),as=Et.extend({method:l.literal("notifications/initialized")});var Xa=Ge.extend({method:l.literal("ping")}),tp=l.object({progress:l.number(),total:l.optional(l.number()),message:l.optional(l.string())}).passthrough(),en=Et.extend({method:l.literal("notifications/progress"),params:Oa.merge(tp).extend({progressToken:Ao})}),tn=Ge.extend({params:dt.extend({cursor:l.optional(Io)}).optional()}),rn=ut.extend({nextCursor:l.optional(Io)}),qo=l.object({uri:l.string(),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Vo=qo.extend({text:l.string()}),ns=l.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),Jo=qo.extend({blob:ns}),Zo=Ca.extend({uri:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),icons:l.optional(l.array(Ya)),_meta:l.optional(l.object({}).passthrough())}),rp=Ca.extend({uriTemplate:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),oa=tn.extend({method:l.literal("resources/list")}),ap=rn.extend({resources:l.array(Zo)}),ia=tn.extend({method:l.literal("resources/templates/list")}),np=rn.extend({resourceTemplates:l.array(rp)}),an=Ge.extend({method:l.literal("resources/read"),params:dt.extend({uri:l.string()})}),sp=ut.extend({contents:l.array(l.union([Vo,Jo]))}),op=Et.extend({method:l.literal("notifications/resources/list_changed")}),ip=Ge.extend({method:l.literal("resources/subscribe"),params:dt.extend({uri:l.string()})}),cp=Ge.extend({method:l.literal("resources/unsubscribe"),params:dt.extend({uri:l.string()})}),lp=Et.extend({method:l.literal("notifications/resources/updated"),params:Oa.extend({uri:l.string()})}),dp=l.object({name:l.string(),description:l.optional(l.string()),required:l.optional(l.boolean())}).passthrough(),up=Ca.extend({description:l.optional(l.string()),arguments:l.optional(l.array(dp)),icons:l.optional(l.array(Ya)),_meta:l.optional(l.object({}).passthrough())}),nn=tn.extend({method:l.literal("prompts/list")}),pp=rn.extend({prompts:l.array(up)}),sn=Ge.extend({method:l.literal("prompts/get"),params:dt.extend({name:l.string(),arguments:l.optional(l.record(l.string()))})}),ss=l.object({type:l.literal("text"),text:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),os=l.object({type:l.literal("image"),data:ns,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),is=l.object({type:l.literal("audio"),data:ns,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),fp=l.object({type:l.literal("resource"),resource:l.union([Vo,Jo]),_meta:l.optional(l.object({}).passthrough())}).passthrough(),hp=Zo.extend({type:l.literal("resource_link")}),Ho=l.union([ss,os,is,hp,fp]),mp=l.object({role:l.enum(["user","assistant"]),content:Ho}).passthrough(),gp=ut.extend({description:l.optional(l.string()),messages:l.array(mp)}),vp=Et.extend({method:l.literal("notifications/prompts/list_changed")}),yp=l.object({title:l.optional(l.string()),readOnlyHint:l.optional(l.boolean()),destructiveHint:l.optional(l.boolean()),idempotentHint:l.optional(l.boolean()),openWorldHint:l.optional(l.boolean())}).passthrough(),_p=Ca.extend({description:l.optional(l.string()),inputSchema:l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough(),outputSchema:l.optional(l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough()),annotations:l.optional(yp),icons:l.optional(l.array(Ya)),_meta:l.optional(l.object({}).passthrough())}),on=tn.extend({method:l.literal("tools/list")}),bp=rn.extend({tools:l.array(_p)}),Bo=ut.extend({content:l.array(Ho).default([]),structuredContent:l.object({}).passthrough().optional(),isError:l.optional(l.boolean())}),Fv=Bo.or(ut.extend({toolResult:l.unknown()})),cn=Ge.extend({method:l.literal("tools/call"),params:dt.extend({name:l.string(),arguments:l.optional(l.record(l.unknown()))})}),xp=Et.extend({method:l.literal("notifications/tools/list_changed")}),Aa=l.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),cs=Ge.extend({method:l.literal("logging/setLevel"),params:dt.extend({level:Aa})}),wp=Et.extend({method:l.literal("notifications/message"),params:Oa.extend({level:Aa,logger:l.optional(l.string()),data:l.unknown()})}),kp=l.object({name:l.string().optional()}).passthrough(),Sp=l.object({hints:l.optional(l.array(kp)),costPriority:l.optional(l.number().min(0).max(1)),speedPriority:l.optional(l.number().min(0).max(1)),intelligencePriority:l.optional(l.number().min(0).max(1))}).passthrough(),Pp=l.object({role:l.enum(["user","assistant"]),content:l.union([ss,os,is])}).passthrough(),Ep=Ge.extend({method:l.literal("sampling/createMessage"),params:dt.extend({messages:l.array(Pp),systemPrompt:l.optional(l.string()),includeContext:l.optional(l.enum(["none","thisServer","allServers"])),temperature:l.optional(l.number()),maxTokens:l.number().int(),stopSequences:l.optional(l.array(l.string())),metadata:l.optional(l.object({}).passthrough()),modelPreferences:l.optional(Sp)})}),ls=ut.extend({model:l.string(),stopReason:l.optional(l.enum(["endTurn","stopSequence","maxTokens"]).or(l.string())),role:l.enum(["user","assistant"]),content:l.discriminatedUnion("type",[ss,os,is])}),Rp=l.object({type:l.literal("boolean"),title:l.optional(l.string()),description:l.optional(l.string()),default:l.optional(l.boolean())}).passthrough(),Tp=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),minLength:l.optional(l.number()),maxLength:l.optional(l.number()),format:l.optional(l.enum(["email","uri","date","date-time"]))}).passthrough(),Op=l.object({type:l.enum(["number","integer"]),title:l.optional(l.string()),description:l.optional(l.string()),minimum:l.optional(l.number()),maximum:l.optional(l.number())}).passthrough(),Cp=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),enum:l.array(l.string()),enumNames:l.optional(l.array(l.string()))}).passthrough(),Ap=l.union([Rp,Tp,Op,Cp]),Ip=Ge.extend({method:l.literal("elicitation/create"),params:dt.extend({message:l.string(),requestedSchema:l.object({type:l.literal("object"),properties:l.record(l.string(),Ap),required:l.optional(l.array(l.string()))}).passthrough()})}),ds=ut.extend({action:l.enum(["accept","decline","cancel"]),content:l.optional(l.record(l.string(),l.unknown()))}),jp=l.object({type:l.literal("ref/resource"),uri:l.string()}).passthrough();var $p=l.object({type:l.literal("ref/prompt"),name:l.string()}).passthrough(),ln=Ge.extend({method:l.literal("completion/complete"),params:dt.extend({ref:l.union([$p,jp]),argument:l.object({name:l.string(),value:l.string()}).passthrough(),context:l.optional(l.object({arguments:l.optional(l.record(l.string(),l.string()))}))})}),Dp=ut.extend({completion:l.object({values:l.array(l.string()).max(100),total:l.optional(l.number().int()),hasMore:l.optional(l.boolean())}).passthrough()}),Lp=l.object({uri:l.string().startsWith("file://"),name:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Np=Ge.extend({method:l.literal("roots/list")}),us=ut.extend({roots:l.array(Lp)}),Mp=Et.extend({method:l.literal("notifications/roots/list_changed")}),Uv=l.union([Xa,rs,ln,cs,sn,nn,oa,ia,an,ip,cp,cn,on]),qv=l.union([Ga,en,as,Mp]),Vv=l.union([Qa,ls,ds,us]),Jv=l.union([Xa,Ep,Ip,Np]),Zv=l.union([Ga,en,wp,lp,op,xp,vp]),Hv=l.union([Qa,ep,Dp,gp,pp,ap,np,sp,Bo,bp]),ke=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}};var zp=6e4,dn=class{constructor(e){this._options=e,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(Ga,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(en,r=>{this._onprogress(r)}),this.setRequestHandler(Xa,r=>({}))}_setupTimeout(e,r,n,t,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(t,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:t})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ke(we.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,t;this._transport=e;let s=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};let o=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=d=>{o?.(d),this._onerror(d)};let i=(t=this._transport)===null||t===void 0?void 0:t.onmessage;this._transport.onmessage=(d,c)=>{i?.(d,c),ts(d)||zo(d)?this._onresponse(d):$o(d)?this._onrequest(d,c):Lo(d)?this._onnotification(d):this._onerror(new Error(`Unknown message type: ${JSON.stringify(d)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new ke(we.ConnectionClosed,"Connection closed");for(let t of r.values())t(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(t=>this._onerror(new Error(`Uncaught error in notification handler: ${t}`)))}_onrequest(e,r){var n,t;let s=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,o=this._transport;if(s===void 0){o?.send({jsonrpc:"2.0",id:e.id,error:{code:we.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let d={signal:i.signal,sessionId:o?.sessionId,_meta:(t=e.params)===null||t===void 0?void 0:t._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,u,h)=>this.request(c,u,{...h,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>s(e,d)).then(c=>{if(!i.signal.aborted)return o?.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var u;if(!i.signal.aborted)return o?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:we.InternalError,message:(u=c.message)!==null&&u!==void 0?u:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,t=Number(r),s=this._progressHandlers.get(t);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(t),i=this._timeoutInfo.get(t);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(t)}catch(d){o(d);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),ts(e))n(e);else{let t=new ke(e.error.code,e.error.message,e.error.data);n(t)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:t,resumptionToken:s,onresumptiontoken:o}=n??{};return new Promise((i,d)=>{var c,u,h,v,p,y;if(!this._transport){d(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=n?.signal)===null||u===void 0||u.throwIfAborted();let b=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:b};n?.onprogress&&(this._progressHandlers.set(b,n.onprogress),g.params={...e.params,_meta:{...((h=e.params)===null||h===void 0?void 0:h._meta)||{},progressToken:b}});let S=O=>{var I;this._responseHandlers.delete(b),this._progressHandlers.delete(b),this._cleanupTimeout(b),(I=this._transport)===null||I===void 0||I.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(O)}},{relatedRequestId:t,resumptionToken:s,onresumptiontoken:o}).catch(j=>this._onerror(new Error(`Failed to send cancellation: ${j}`))),d(O)};this._responseHandlers.set(b,O=>{var I;if(!(!((I=n?.signal)===null||I===void 0)&&I.aborted)){if(O instanceof Error)return d(O);try{let j=r.parse(O.result);i(j)}catch(j){d(j)}}}),(v=n?.signal)===null||v===void 0||v.addEventListener("abort",()=>{var O;S((O=n?.signal)===null||O===void 0?void 0:O.reason)});let E=(p=n?.timeout)!==null&&p!==void 0?p:zp,P=()=>S(new ke(we.RequestTimeout,"Request timed out",{timeout:E}));this._setupTimeout(b,E,n?.maxTotalTimeout,P,(y=n?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(g,{relatedRequestId:t,resumptionToken:s,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(b),d(O)})})}async notification(e,r){var n,t;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((t=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&t!==void 0?t:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var d;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(d=this._transport)===null||d===void 0||d.send(c,r).catch(u=>this._onerror(u))});return}let i={...e,jsonrpc:"2.0"};await this._transport.send(i,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(t,s)=>Promise.resolve(r(e.parse(t),s)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Wo(a,e){return Object.entries(e).reduce((r,[n,t])=>(t&&typeof t=="object"?r[n]=r[n]?{...r[n],...t}:t:r[n]=t,r),{...a})}var Qc=Fd(Kc(),1),On=class extends dn{constructor(e,r){var n;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Aa.options.map((t,s)=>[t,s])),this.isMessageIgnored=(t,s)=>{let o=this._loggingLevels.get(s);return o?this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._instructions=r?.instructions,this.setRequestHandler(rs,t=>this._oninitialize(t)),this.setNotificationHandler(as,()=>{var t;return(t=this.oninitialized)===null||t===void 0?void 0:t.call(this)}),this._capabilities.logging&&this.setRequestHandler(cs,async(t,s)=>{var o;let i=s.sessionId||((o=s.requestInfo)===null||o===void 0?void 0:o.headers["mcp-session-id"])||void 0,{level:d}=t.params,c=Aa.safeParse(d);return c.success&&this._loggingLevels.set(i,c.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Wo(this._capabilities,e)}assertCapabilityForMethod(e){var r,n,t;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);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 ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);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 ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Co.includes(r)?r:es,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"},Qa)}async createMessage(e,r){return this.request({method:"sampling/createMessage",params:e},ls,r)}async elicitInput(e,r){let n=await this.request({method:"elicitation/create",params:e},ds,r);if(n.action==="accept"&&n.content)try{let t=new Qc.default,s=t.compile(e.requestedSchema);if(!s(n.content))throw new ke(we.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorsText(s.errors)}`)}catch(t){throw t instanceof ke?t:new ke(we.InternalError,`Error validating elicitation response: ${t}`)}return n}async listRoots(e,r){return this.request({method:"roots/list",params:e},us,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}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 Yc=Symbol("Let zodToJsonSchema decide on which parser to use");var Gc={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"},Xc=a=>typeof a=="string"?{...Gc,name:a}:{...Gc,...a};var el=a=>{let e=Xc(a),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,t])=>[t._def,{def:t._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function Ls(a,e,r,n){n?.errorMessages&&r&&(a.errorMessage={...a.errorMessage,[e]:r})}function de(a,e,r,n,t){a[e]=r,Ls(a,e,n,t)}var Cn=(a,e)=>{let r=0;for(;r<a.length&&r<e.length&&a[r]===e[r];r++);return[(a.length-r).toString(),...e.slice(r)].join("/")};function Pe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?Cn(e,a.currentPath):e.join("/")}}function tl(a,e){let r={type:"array"};return a.type?._def&&a.type?._def?.typeName!==C.ZodAny&&(r.items=Y(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&de(r,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&de(r,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(de(r,"minItems",a.exactLength.value,a.exactLength.message,e),de(r,"maxItems",a.exactLength.value,a.exactLength.message,e)),r}function rl(a,e){let r={type:"integer",format:"int64"};if(!a.checks)return r;for(let n of a.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?de(r,"minimum",n.value,n.message,e):de(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),de(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?de(r,"maximum",n.value,n.message,e):de(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),de(r,"maximum",n.value,n.message,e));break;case"multipleOf":de(r,"multipleOf",n.value,n.message,e);break}return r}function al(){return{type:"boolean"}}function An(a,e){return Y(a.type._def,e)}var nl=(a,e)=>Y(a.innerType._def,e);function Ns(a,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((t,s)=>Ns(a,e,t))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return _h(a,e)}}var _h=(a,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of a.checks)switch(n.kind){case"min":de(r,"minimum",n.value,n.message,e);break;case"max":de(r,"maximum",n.value,n.message,e);break}return r};function sl(a,e){return{...Y(a.innerType._def,e),default:a.defaultValue()}}function ol(a,e){return e.effectStrategy==="input"?Y(a.schema._def,e):Pe(e)}function il(a){return{type:"string",enum:Array.from(a.values)}}var bh=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function cl(a,e){let r=[Y(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Y(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,t=[];return r.forEach(s=>{if(bh(s))t.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:i,...d}=s;o=d}else n=void 0;t.push(o)}}),t.length?{allOf:t,...n}:void 0}function ll(a,e){let r=typeof a.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[a.value]}:{type:r==="bigint"?"integer":r,const:a.value}}var Ms,vt={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:()=>(Ms===void 0&&(Ms=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ms),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 In(a,e){let r={type:"string"};if(a.checks)for(let n of a.checks)switch(n.kind){case"min":de(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":de(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":yt(r,"email",n.message,e);break;case"format:idn-email":yt(r,"idn-email",n.message,e);break;case"pattern:zod":Be(r,vt.email,n.message,e);break}break;case"url":yt(r,"uri",n.message,e);break;case"uuid":yt(r,"uuid",n.message,e);break;case"regex":Be(r,n.regex,n.message,e);break;case"cuid":Be(r,vt.cuid,n.message,e);break;case"cuid2":Be(r,vt.cuid2,n.message,e);break;case"startsWith":Be(r,RegExp(`^${zs(n.value,e)}`),n.message,e);break;case"endsWith":Be(r,RegExp(`${zs(n.value,e)}$`),n.message,e);break;case"datetime":yt(r,"date-time",n.message,e);break;case"date":yt(r,"date",n.message,e);break;case"time":yt(r,"time",n.message,e);break;case"duration":yt(r,"duration",n.message,e);break;case"length":de(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),de(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Be(r,RegExp(zs(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&yt(r,"ipv4",n.message,e),n.version!=="v4"&&yt(r,"ipv6",n.message,e);break}case"base64url":Be(r,vt.base64url,n.message,e);break;case"jwt":Be(r,vt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Be(r,vt.ipv4Cidr,n.message,e),n.version!=="v4"&&Be(r,vt.ipv6Cidr,n.message,e);break}case"emoji":Be(r,vt.emoji(),n.message,e);break;case"ulid":{Be(r,vt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{yt(r,"binary",n.message,e);break}case"contentEncoding:base64":{de(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Be(r,vt.base64,n.message,e);break}}break}case"nanoid":Be(r,vt.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function zs(a,e){return e.patternStrategy==="escape"?wh(a):a}var xh=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function wh(a){let e="";for(let r=0;r<a.length;r++)xh.has(a[r])||(e+="\\"),e+=a[r];return e}function yt(a,e,r,n){a.format||a.anyOf?.some(t=>t.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&n.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):de(a,"format",e,r,n)}function Be(a,e,r,n){a.pattern||a.allOf?.some(t=>t.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&n.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:dl(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):de(a,"pattern",dl(e,n),r,n)}function dl(a,e){if(!e.applyRegexFlags||!a.flags)return a.source;let r={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},n=r.i?a.source.toLowerCase():a.source,t="",s=!1,o=!1,i=!1;for(let d=0;d<n.length;d++){if(s){t+=n[d],s=!1;continue}if(r.i){if(o){if(n[d].match(/[a-z]/)){i?(t+=n[d],t+=`${n[d-2]}-${n[d]}`.toUpperCase(),i=!1):n[d+1]==="-"&&n[d+2]?.match(/[a-z]/)?(t+=n[d],i=!0):t+=`${n[d]}${n[d].toUpperCase()}`;continue}}else if(n[d].match(/[a-z]/)){t+=`[${n[d]}${n[d].toUpperCase()}]`;continue}}if(r.m){if(n[d]==="^"){t+=`(^|(?<=[\r
4
4
  ]))`;continue}else if(n[d]==="$"){t+=`($|(?=[\r
5
5
  ]))`;continue}}if(r.s&&n[d]==="."){t+=o?`${n[d]}\r
6
6
  `:`[${n[d]}\r
7
- ]`;continue}t+=n[d],n[d]==="\\"?s=!0:o&&n[d]==="]"?o=!1:!o&&n[d]==="["&&(o=!0)}try{new RegExp(t)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return t}function In(a,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&a.keyType?._def.typeName===C.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((n,t)=>({...n,[t]:Y(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",t]})??Pe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Y(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(a.keyType?._def.typeName===C.ZodString&&a.keyType._def.checks?.length){let{type:n,...t}=jn(a.keyType._def,e);return{...r,propertyNames:t}}else{if(a.keyType?._def.typeName===C.ZodEnum)return{...r,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===C.ZodBranded&&a.keyType._def.type._def.typeName===C.ZodString&&a.keyType._def.type._def.checks?.length){let{type:n,...t}=An(a.keyType._def,e);return{...r,propertyNames:t}}}return r}function ul(a,e){if(e.mapStrategy==="record")return In(a,e);let r=Y(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Pe(e),n=Y(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Pe(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function fl(a){let e=a.values,n=Object.keys(a.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),t=Array.from(new Set(n.map(s=>typeof s)));return{type:t.length===1?t[0]==="string"?"string":"number":["string","number"],enum:n}}function pl(a){return a.target==="openAi"?void 0:{not:Pe({...a,currentPath:[...a.currentPath,"not"]})}}function hl(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ia={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function gl(a,e){if(e.target==="openApi3")return ml(a,e);let r=a.options instanceof Map?Array.from(a.options.values()):a.options;if(r.every(n=>n._def.typeName in Ia&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((t,s)=>{let o=Ia[s._def.typeName];return o&&!t.includes(o)?[...t,o]:t},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((t,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...t,o];case"bigint":return[...t,"integer"];case"object":if(s._def.value===null)return[...t,"null"];default:return t}},[]);if(n.length===r.length){let t=n.filter((s,o,i)=>i.indexOf(s)===o);return{type:t.length>1?t:t[0],enum:r.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,t)=>[...n,...t._def.values.filter(s=>!n.includes(s))],[])};return ml(a,e)}var ml=(a,e)=>{let r=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((n,t)=>Y(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${t}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function vl(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:Ia[a.innerType._def.typeName],nullable:!0}:{type:[Ia[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Y(a.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Y(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function yl(a,e){let r={type:"number"};if(!a.checks)return r;for(let n of a.checks)switch(n.kind){case"int":r.type="integer",Ls(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?de(r,"minimum",n.value,n.message,e):de(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),de(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?de(r,"maximum",n.value,n.message,e):de(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),de(r,"maximum",n.value,n.message,e));break;case"multipleOf":de(r,"multipleOf",n.value,n.message,e);break}return r}function _l(a,e){let r=e.target==="openAi",n={type:"object",properties:{}},t=[],s=a.shape();for(let i in s){let d=s[i];if(d===void 0||d._def===void 0)continue;let c=Sh(d);c&&r&&(d._def.typeName==="ZodOptional"&&(d=d._def.innerType),d.isNullable()||(d=d.nullable()),c=!1);let u=Y(d._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});u!==void 0&&(n.properties[i]=u,c||t.push(i))}t.length&&(n.required=t);let o=kh(a,e);return o!==void 0&&(n.additionalProperties=o),n}function kh(a,e){if(a.catchall._def.typeName!=="ZodNever")return Y(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Sh(a){try{return a.isOptional()}catch{return!0}}var bl=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Y(a.innerType._def,e);let r=Y(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Pe(e)},r]}:Pe(e)};var xl=(a,e)=>{if(e.pipeStrategy==="input")return Y(a.in._def,e);if(e.pipeStrategy==="output")return Y(a.out._def,e);let r=Y(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Y(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(t=>t!==void 0)}};function wl(a,e){return Y(a.type._def,e)}function kl(a,e){let n={type:"array",uniqueItems:!0,items:Y(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&de(n,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&de(n,"maxItems",a.maxSize.value,a.maxSize.message,e),n}function Sl(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((r,n)=>Y(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Y(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((r,n)=>Y(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Pl(a){return{not:Pe(a)}}function El(a){return Pe(a)}var Rl=(a,e)=>Y(a.innerType._def,e);var Tl=(a,e,r)=>{switch(e){case C.ZodString:return jn(a,r);case C.ZodNumber:return yl(a,r);case C.ZodObject:return _l(a,r);case C.ZodBigInt:return rl(a,r);case C.ZodBoolean:return al();case C.ZodDate:return Ns(a,r);case C.ZodUndefined:return Pl(r);case C.ZodNull:return hl(r);case C.ZodArray:return tl(a,r);case C.ZodUnion:case C.ZodDiscriminatedUnion:return gl(a,r);case C.ZodIntersection:return cl(a,r);case C.ZodTuple:return Sl(a,r);case C.ZodRecord:return In(a,r);case C.ZodLiteral:return ll(a,r);case C.ZodEnum:return il(a);case C.ZodNativeEnum:return fl(a);case C.ZodNullable:return vl(a,r);case C.ZodOptional:return bl(a,r);case C.ZodMap:return ul(a,r);case C.ZodSet:return kl(a,r);case C.ZodLazy:return()=>a.getter()._def;case C.ZodPromise:return wl(a,r);case C.ZodNaN:case C.ZodNever:return pl(r);case C.ZodEffects:return ol(a,r);case C.ZodAny:return Pe(r);case C.ZodUnknown:return El(r);case C.ZodDefault:return sl(a,r);case C.ZodBranded:return An(a,r);case C.ZodReadonly:return Rl(a,r);case C.ZodCatch:return nl(a,r);case C.ZodPipeline:return xl(a,r);case C.ZodFunction:case C.ZodVoid:case C.ZodSymbol:return;default:return(n=>{})(e)}};function Y(a,e,r=!1){let n=e.seen.get(a);if(e.override){let i=e.override?.(a,e,n,r);if(i!==Yc)return i}if(n&&!r){let i=Ph(n,e);if(i!==void 0)return i}let t={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,t);let s=Tl(a,a.typeName,e),o=typeof s=="function"?Y(s(),e):s;if(o&&Eh(a,e,o),e.postProcess){let i=e.postProcess(o,a,e);return t.jsonSchema=o,i}return t.jsonSchema=o,o}var Ph=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:Cn(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Pe(e)):e.$refStrategy==="seen"?Pe(e):void 0}},Eh=(a,e,r)=>(a.description&&(r.description=a.description,e.markdownDescription&&(r.markdownDescription=a.description)),r);var $n=(a,e)=>{let r=el(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[c,u])=>({...d,[c]:Y(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,c]},!0)??Pe(r)}),{}):void 0,t=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=Y(a._def,t===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,t]},!1)??Pe(r),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(s.title=o),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let i=t===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,t].join("/"),[r.definitionPath]:{...n,[t]:s}};return r.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in i||"oneOf"in i||"allOf"in i||"type"in i&&Array.isArray(i.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),i};var Fs;(function(a){a.Completable="McpCompletable"})(Fs||(Fs={}));var ca=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};ca.create=(a,e)=>new ca({type:a,typeName:Fs.Completable,complete:e.complete,...Rh(e)});function Rh(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:t}=a;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:t}:{errorMap:(o,i)=>{var d,c;let{message:u}=a;return o.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:(d=u??n)!==null&&d!==void 0?d:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(c=u??r)!==null&&c!==void 0?c:i.defaultError}},description:t}}var Ln=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new On(e,r)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(on.shape.method.value),this.server.assertCanSetRequestHandler(cn.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(on,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:r.inputSchema?$n(r.inputSchema,{strictUnions:!0}):Th,annotations:r.annotations,_meta:r._meta};return r.outputSchema&&(n.outputSchema=$n(r.outputSchema,{strictUnions:!0})),n})})),this.server.setRequestHandler(cn,async(e,r)=>{let n=this._registeredTools[e.params.name];if(!n)throw new ke(we.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new ke(we.InvalidParams,`Tool ${e.params.name} disabled`);let t;if(n.inputSchema){let s=await n.inputSchema.safeParseAsync(e.params.arguments);if(!s.success)throw new ke(we.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${s.error.message}`);let o=s.data,i=n.callback;try{t=await Promise.resolve(i(o,r))}catch(d){t={content:[{type:"text",text:d instanceof Error?d.message:String(d)}],isError:!0}}}else{let s=n.callback;try{t=await Promise.resolve(s(r))}catch(o){t={content:[{type:"text",text:o instanceof Error?o.message:String(o)}],isError:!0}}}if(n.outputSchema&&!t.isError){if(!t.structuredContent)throw new ke(we.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);let s=await n.outputSchema.safeParseAsync(t.structuredContent);if(!s.success)throw new ke(we.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${s.error.message}`)}return t}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(ln.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ln,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new ke(we.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new ke(we.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new ke(we.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Dn;let t=n.argsSchema.shape[e.params.argument.name];if(!(t instanceof ca))return Dn;let o=await t._def.complete(e.params.argument.value,e.params.context);return Cl(o)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(o=>o.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Dn;throw new ke(we.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let t=n.resourceTemplate.completeCallback(e.params.argument.name);if(!t)return Dn;let s=await t(e.params.argument.value,e.params.context);return Cl(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(oa.shape.method.value),this.server.assertCanSetRequestHandler(ia.shape.method.value),this.server.assertCanSetRequestHandler(an.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(oa,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([s,o])=>o.enabled).map(([s,o])=>({uri:s,name:o.name,...o.metadata})),t=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let o=await s.resourceTemplate.listCallback(r);for(let i of o.resources)t.push({...s.metadata,...i})}return{resources:[...n,...t]}}),this.server.setRequestHandler(ia,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(an,async(e,r)=>{let n=new URL(e.params.uri),t=this._registeredResources[n.toString()];if(t){if(!t.enabled)throw new ke(we.InvalidParams,`Resource ${n} disabled`);return t.readCallback(n,r)}for(let s of Object.values(this._registeredResourceTemplates)){let o=s.resourceTemplate.uriTemplate.match(n.toString());if(o)return s.readCallback(n,o,r)}throw new ke(we.InvalidParams,`Resource ${n} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(nn.shape.method.value),this.server.assertCanSetRequestHandler(sn.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(nn,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?Ch(r.argsSchema):void 0}))})),this.server.setRequestHandler(sn,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new ke(we.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new ke(we.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let t=await n.argsSchema.safeParseAsync(e.params.arguments);if(!t.success)throw new ke(we.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t.error.message}`);let s=t.data,o=n.callback;return await Promise.resolve(o(s,r))}else{let t=n.callback;return await Promise.resolve(t(r))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,r,...n){let t;typeof n[0]=="object"&&(t=n.shift());let s=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(e,void 0,r,t,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,void 0,r,t,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,r,n,t){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,n.title,r,n,t);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,n.title,r,n,t);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,r,n,t,s){let o={name:e,title:r,metadata:t,readCallback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:i=>{typeof i.uri<"u"&&i.uri!==n&&(delete this._registeredResources[n],i.uri&&(this._registeredResources[i.uri]=o)),typeof i.name<"u"&&(o.name=i.name),typeof i.title<"u"&&(o.title=i.title),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=o,o}_createRegisteredResourceTemplate(e,r,n,t,s){let o={resourceTemplate:n,title:r,metadata:t,readCallback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredResourceTemplates[e],i.name&&(this._registeredResourceTemplates[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.template<"u"&&(o.resourceTemplate=i.template),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=o,o}_createRegisteredPrompt(e,r,n,t,s){let o={title:r,description:n,argsSchema:t===void 0?void 0:l.object(t),callback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredPrompts[e],i.name&&(this._registeredPrompts[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.description<"u"&&(o.description=i.description),typeof i.argsSchema<"u"&&(o.argsSchema=l.object(i.argsSchema)),typeof i.callback<"u"&&(o.callback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=o,o}_createRegisteredTool(e,r,n,t,s,o,i,d){let c={title:r,description:n,inputSchema:t===void 0?void 0:l.object(t),outputSchema:s===void 0?void 0:l.object(s),annotations:o,_meta:i,callback:d,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredTools[e],u.name&&(this._registeredTools[u.name]=c)),typeof u.title<"u"&&(c.title=u.title),typeof u.description<"u"&&(c.description=u.description),typeof u.paramsSchema<"u"&&(c.inputSchema=l.object(u.paramsSchema)),typeof u.callback<"u"&&(c.callback=u.callback),typeof u.annotations<"u"&&(c.annotations=u.annotations),typeof u._meta<"u"&&(c._meta=u._meta),typeof u.enabled<"u"&&(c.enabled=u.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,t,s,o;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let d=r[0];Ol(d)?(t=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Ol(r[0])&&(o=r.shift())):typeof d=="object"&&d!==null&&(o=r.shift())}let i=r[0];return this._createRegisteredTool(e,void 0,n,t,s,o,void 0,i)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:t,description:s,inputSchema:o,outputSchema:i,annotations:d,_meta:c}=r;return this._createRegisteredTool(e,t,s,o,i,d,c,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let t;r.length>1&&(t=r.shift());let s=r[0],o=this._createRegisteredPrompt(e,void 0,n,t,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:t,description:s,argsSchema:o}=r,i=this._createRegisteredPrompt(e,t,s,o,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Th={type:"object",properties:{}};function Ol(a){return typeof a!="object"||a===null?!1:Object.keys(a).length===0||Object.values(a).some(Oh)}function Oh(a){return a!==null&&typeof a=="object"&&"parse"in a&&typeof a.parse=="function"&&"safeParse"in a&&typeof a.safeParse=="function"}function Ch(a){return Object.entries(a.shape).map(([e,r])=>({name:e,description:r.description,required:!r.isOptional()}))}function Cl(a){return{completion:{values:a.slice(0,100),total:a.length,hasMore:a.length>100}}}var Dn={completion:{values:[],hasMore:!1}};import jl from"node:process";var Nn=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
7
+ ]`;continue}t+=n[d],n[d]==="\\"?s=!0:o&&n[d]==="]"?o=!1:!o&&n[d]==="["&&(o=!0)}try{new RegExp(t)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return t}function jn(a,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&a.keyType?._def.typeName===C.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((n,t)=>({...n,[t]:Y(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",t]})??Pe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Y(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(a.keyType?._def.typeName===C.ZodString&&a.keyType._def.checks?.length){let{type:n,...t}=In(a.keyType._def,e);return{...r,propertyNames:t}}else{if(a.keyType?._def.typeName===C.ZodEnum)return{...r,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===C.ZodBranded&&a.keyType._def.type._def.typeName===C.ZodString&&a.keyType._def.type._def.checks?.length){let{type:n,...t}=An(a.keyType._def,e);return{...r,propertyNames:t}}}return r}function ul(a,e){if(e.mapStrategy==="record")return jn(a,e);let r=Y(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Pe(e),n=Y(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Pe(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function pl(a){let e=a.values,n=Object.keys(a.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),t=Array.from(new Set(n.map(s=>typeof s)));return{type:t.length===1?t[0]==="string"?"string":"number":["string","number"],enum:n}}function fl(a){return a.target==="openAi"?void 0:{not:Pe({...a,currentPath:[...a.currentPath,"not"]})}}function hl(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var ja={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function gl(a,e){if(e.target==="openApi3")return ml(a,e);let r=a.options instanceof Map?Array.from(a.options.values()):a.options;if(r.every(n=>n._def.typeName in ja&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((t,s)=>{let o=ja[s._def.typeName];return o&&!t.includes(o)?[...t,o]:t},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((t,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...t,o];case"bigint":return[...t,"integer"];case"object":if(s._def.value===null)return[...t,"null"];default:return t}},[]);if(n.length===r.length){let t=n.filter((s,o,i)=>i.indexOf(s)===o);return{type:t.length>1?t:t[0],enum:r.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,t)=>[...n,...t._def.values.filter(s=>!n.includes(s))],[])};return ml(a,e)}var ml=(a,e)=>{let r=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((n,t)=>Y(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${t}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function vl(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:ja[a.innerType._def.typeName],nullable:!0}:{type:[ja[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Y(a.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Y(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function yl(a,e){let r={type:"number"};if(!a.checks)return r;for(let n of a.checks)switch(n.kind){case"int":r.type="integer",Ls(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?de(r,"minimum",n.value,n.message,e):de(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),de(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?de(r,"maximum",n.value,n.message,e):de(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),de(r,"maximum",n.value,n.message,e));break;case"multipleOf":de(r,"multipleOf",n.value,n.message,e);break}return r}function _l(a,e){let r=e.target==="openAi",n={type:"object",properties:{}},t=[],s=a.shape();for(let i in s){let d=s[i];if(d===void 0||d._def===void 0)continue;let c=Sh(d);c&&r&&(d._def.typeName==="ZodOptional"&&(d=d._def.innerType),d.isNullable()||(d=d.nullable()),c=!1);let u=Y(d._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});u!==void 0&&(n.properties[i]=u,c||t.push(i))}t.length&&(n.required=t);let o=kh(a,e);return o!==void 0&&(n.additionalProperties=o),n}function kh(a,e){if(a.catchall._def.typeName!=="ZodNever")return Y(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Sh(a){try{return a.isOptional()}catch{return!0}}var bl=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Y(a.innerType._def,e);let r=Y(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Pe(e)},r]}:Pe(e)};var xl=(a,e)=>{if(e.pipeStrategy==="input")return Y(a.in._def,e);if(e.pipeStrategy==="output")return Y(a.out._def,e);let r=Y(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Y(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(t=>t!==void 0)}};function wl(a,e){return Y(a.type._def,e)}function kl(a,e){let n={type:"array",uniqueItems:!0,items:Y(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&de(n,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&de(n,"maxItems",a.maxSize.value,a.maxSize.message,e),n}function Sl(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((r,n)=>Y(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Y(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((r,n)=>Y(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Pl(a){return{not:Pe(a)}}function El(a){return Pe(a)}var Rl=(a,e)=>Y(a.innerType._def,e);var Tl=(a,e,r)=>{switch(e){case C.ZodString:return In(a,r);case C.ZodNumber:return yl(a,r);case C.ZodObject:return _l(a,r);case C.ZodBigInt:return rl(a,r);case C.ZodBoolean:return al();case C.ZodDate:return Ns(a,r);case C.ZodUndefined:return Pl(r);case C.ZodNull:return hl(r);case C.ZodArray:return tl(a,r);case C.ZodUnion:case C.ZodDiscriminatedUnion:return gl(a,r);case C.ZodIntersection:return cl(a,r);case C.ZodTuple:return Sl(a,r);case C.ZodRecord:return jn(a,r);case C.ZodLiteral:return ll(a,r);case C.ZodEnum:return il(a);case C.ZodNativeEnum:return pl(a);case C.ZodNullable:return vl(a,r);case C.ZodOptional:return bl(a,r);case C.ZodMap:return ul(a,r);case C.ZodSet:return kl(a,r);case C.ZodLazy:return()=>a.getter()._def;case C.ZodPromise:return wl(a,r);case C.ZodNaN:case C.ZodNever:return fl(r);case C.ZodEffects:return ol(a,r);case C.ZodAny:return Pe(r);case C.ZodUnknown:return El(r);case C.ZodDefault:return sl(a,r);case C.ZodBranded:return An(a,r);case C.ZodReadonly:return Rl(a,r);case C.ZodCatch:return nl(a,r);case C.ZodPipeline:return xl(a,r);case C.ZodFunction:case C.ZodVoid:case C.ZodSymbol:return;default:return(n=>{})(e)}};function Y(a,e,r=!1){let n=e.seen.get(a);if(e.override){let i=e.override?.(a,e,n,r);if(i!==Yc)return i}if(n&&!r){let i=Ph(n,e);if(i!==void 0)return i}let t={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,t);let s=Tl(a,a.typeName,e),o=typeof s=="function"?Y(s(),e):s;if(o&&Eh(a,e,o),e.postProcess){let i=e.postProcess(o,a,e);return t.jsonSchema=o,i}return t.jsonSchema=o,o}var Ph=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:Cn(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Pe(e)):e.$refStrategy==="seen"?Pe(e):void 0}},Eh=(a,e,r)=>(a.description&&(r.description=a.description,e.markdownDescription&&(r.markdownDescription=a.description)),r);var $n=(a,e)=>{let r=el(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[c,u])=>({...d,[c]:Y(u._def,{...r,currentPath:[...r.basePath,r.definitionPath,c]},!0)??Pe(r)}),{}):void 0,t=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=Y(a._def,t===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,t]},!1)??Pe(r),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(s.title=o),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let i=t===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,t].join("/"),[r.definitionPath]:{...n,[t]:s}};return r.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in i||"oneOf"in i||"allOf"in i||"type"in i&&Array.isArray(i.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),i};var Fs;(function(a){a.Completable="McpCompletable"})(Fs||(Fs={}));var ca=class extends re{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};ca.create=(a,e)=>new ca({type:a,typeName:Fs.Completable,complete:e.complete,...Rh(e)});function Rh(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:t}=a;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:t}:{errorMap:(o,i)=>{var d,c;let{message:u}=a;return o.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:(d=u??n)!==null&&d!==void 0?d:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(c=u??r)!==null&&c!==void 0?c:i.defaultError}},description:t}}var Ln=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new On(e,r)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(on.shape.method.value),this.server.assertCanSetRequestHandler(cn.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(on,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:r.inputSchema?$n(r.inputSchema,{strictUnions:!0}):Th,annotations:r.annotations,_meta:r._meta};return r.outputSchema&&(n.outputSchema=$n(r.outputSchema,{strictUnions:!0})),n})})),this.server.setRequestHandler(cn,async(e,r)=>{let n=this._registeredTools[e.params.name];if(!n)throw new ke(we.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new ke(we.InvalidParams,`Tool ${e.params.name} disabled`);let t;if(n.inputSchema){let s=await n.inputSchema.safeParseAsync(e.params.arguments);if(!s.success)throw new ke(we.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${s.error.message}`);let o=s.data,i=n.callback;try{t=await Promise.resolve(i(o,r))}catch(d){t={content:[{type:"text",text:d instanceof Error?d.message:String(d)}],isError:!0}}}else{let s=n.callback;try{t=await Promise.resolve(s(r))}catch(o){t={content:[{type:"text",text:o instanceof Error?o.message:String(o)}],isError:!0}}}if(n.outputSchema&&!t.isError){if(!t.structuredContent)throw new ke(we.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);let s=await n.outputSchema.safeParseAsync(t.structuredContent);if(!s.success)throw new ke(we.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${s.error.message}`)}return t}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(ln.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ln,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new ke(we.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new ke(we.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new ke(we.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Dn;let t=n.argsSchema.shape[e.params.argument.name];if(!(t instanceof ca))return Dn;let o=await t._def.complete(e.params.argument.value,e.params.context);return Cl(o)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(o=>o.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Dn;throw new ke(we.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let t=n.resourceTemplate.completeCallback(e.params.argument.name);if(!t)return Dn;let s=await t(e.params.argument.value,e.params.context);return Cl(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(oa.shape.method.value),this.server.assertCanSetRequestHandler(ia.shape.method.value),this.server.assertCanSetRequestHandler(an.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(oa,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([s,o])=>o.enabled).map(([s,o])=>({uri:s,name:o.name,...o.metadata})),t=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let o=await s.resourceTemplate.listCallback(r);for(let i of o.resources)t.push({...s.metadata,...i})}return{resources:[...n,...t]}}),this.server.setRequestHandler(ia,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(an,async(e,r)=>{let n=new URL(e.params.uri),t=this._registeredResources[n.toString()];if(t){if(!t.enabled)throw new ke(we.InvalidParams,`Resource ${n} disabled`);return t.readCallback(n,r)}for(let s of Object.values(this._registeredResourceTemplates)){let o=s.resourceTemplate.uriTemplate.match(n.toString());if(o)return s.readCallback(n,o,r)}throw new ke(we.InvalidParams,`Resource ${n} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(nn.shape.method.value),this.server.assertCanSetRequestHandler(sn.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(nn,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?Ch(r.argsSchema):void 0}))})),this.server.setRequestHandler(sn,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new ke(we.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new ke(we.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let t=await n.argsSchema.safeParseAsync(e.params.arguments);if(!t.success)throw new ke(we.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t.error.message}`);let s=t.data,o=n.callback;return await Promise.resolve(o(s,r))}else{let t=n.callback;return await Promise.resolve(t(r))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,r,...n){let t;typeof n[0]=="object"&&(t=n.shift());let s=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(e,void 0,r,t,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,void 0,r,t,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,r,n,t){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,n.title,r,n,t);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,n.title,r,n,t);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,r,n,t,s){let o={name:e,title:r,metadata:t,readCallback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:i=>{typeof i.uri<"u"&&i.uri!==n&&(delete this._registeredResources[n],i.uri&&(this._registeredResources[i.uri]=o)),typeof i.name<"u"&&(o.name=i.name),typeof i.title<"u"&&(o.title=i.title),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=o,o}_createRegisteredResourceTemplate(e,r,n,t,s){let o={resourceTemplate:n,title:r,metadata:t,readCallback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredResourceTemplates[e],i.name&&(this._registeredResourceTemplates[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.template<"u"&&(o.resourceTemplate=i.template),typeof i.metadata<"u"&&(o.metadata=i.metadata),typeof i.callback<"u"&&(o.readCallback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=o,o}_createRegisteredPrompt(e,r,n,t,s){let o={title:r,description:n,argsSchema:t===void 0?void 0:l.object(t),callback:s,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredPrompts[e],i.name&&(this._registeredPrompts[i.name]=o)),typeof i.title<"u"&&(o.title=i.title),typeof i.description<"u"&&(o.description=i.description),typeof i.argsSchema<"u"&&(o.argsSchema=l.object(i.argsSchema)),typeof i.callback<"u"&&(o.callback=i.callback),typeof i.enabled<"u"&&(o.enabled=i.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=o,o}_createRegisteredTool(e,r,n,t,s,o,i,d){let c={title:r,description:n,inputSchema:t===void 0?void 0:l.object(t),outputSchema:s===void 0?void 0:l.object(s),annotations:o,_meta:i,callback:d,enabled:!0,disable:()=>c.update({enabled:!1}),enable:()=>c.update({enabled:!0}),remove:()=>c.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredTools[e],u.name&&(this._registeredTools[u.name]=c)),typeof u.title<"u"&&(c.title=u.title),typeof u.description<"u"&&(c.description=u.description),typeof u.paramsSchema<"u"&&(c.inputSchema=l.object(u.paramsSchema)),typeof u.callback<"u"&&(c.callback=u.callback),typeof u.annotations<"u"&&(c.annotations=u.annotations),typeof u._meta<"u"&&(c._meta=u._meta),typeof u.enabled<"u"&&(c.enabled=u.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=c,this.setToolRequestHandlers(),this.sendToolListChanged(),c}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,t,s,o;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let d=r[0];Ol(d)?(t=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Ol(r[0])&&(o=r.shift())):typeof d=="object"&&d!==null&&(o=r.shift())}let i=r[0];return this._createRegisteredTool(e,void 0,n,t,s,o,void 0,i)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:t,description:s,inputSchema:o,outputSchema:i,annotations:d,_meta:c}=r;return this._createRegisteredTool(e,t,s,o,i,d,c,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let t;r.length>1&&(t=r.shift());let s=r[0],o=this._createRegisteredPrompt(e,void 0,n,t,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:t,description:s,argsSchema:o}=r,i=this._createRegisteredPrompt(e,t,s,o,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Th={type:"object",properties:{}};function Ol(a){return typeof a!="object"||a===null?!1:Object.keys(a).length===0||Object.values(a).some(Oh)}function Oh(a){return a!==null&&typeof a=="object"&&"parse"in a&&typeof a.parse=="function"&&"safeParse"in a&&typeof a.safeParse=="function"}function Ch(a){return Object.entries(a.shape).map(([e,r])=>({name:e,description:r.description,required:!r.isOptional()}))}function Cl(a){return{completion:{values:a.slice(0,100),total:a.length,hasMore:a.length>100}}}var Dn={completion:{values:[],hasMore:!1}};import Il from"node:process";var Nn=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
8
8
  `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Ah(r)}clear(){this._buffer=void 0}};function Ah(a){return Fo.parse(JSON.parse(a))}function Al(a){return JSON.stringify(a)+`
9
- `}var Mn=class{constructor(e=jl.stdin,r=jl.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Nn,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{var t;(t=this.onerror)===null||t===void 0||t.call(this,n)}}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(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(r=>{let n=Al(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};import{readFile as dd}from"node:fs/promises";var x={};yo(x,{BRAND:()=>am,DIRTY:()=>Tr,EMPTY_PATH:()=>Dh,INVALID:()=>G,NEVER:()=>Um,OK:()=>Ve,ParseStatus:()=>ze,Schema:()=>se,ZodAny:()=>tr,ZodArray:()=>Vt,ZodBigInt:()=>Cr,ZodBoolean:()=>Ar,ZodBranded:()=>Da,ZodCatch:()=>qr,ZodDate:()=>jr,ZodDefault:()=>Ur,ZodDiscriminatedUnion:()=>Un,ZodEffects:()=>ht,ZodEnum:()=>zr,ZodError:()=>Ye,ZodFirstPartyTypeKind:()=>X,ZodFunction:()=>Vn,ZodIntersection:()=>Lr,ZodIssueCode:()=>T,ZodLazy:()=>Nr,ZodLiteral:()=>Mr,ZodMap:()=>ha,ZodNaN:()=>ga,ZodNativeEnum:()=>Fr,ZodNever:()=>_t,ZodNull:()=>$r,ZodNullable:()=>Ot,ZodNumber:()=>Or,ZodObject:()=>Xe,ZodOptional:()=>ft,ZodParsedType:()=>z,ZodPipeline:()=>La,ZodPromise:()=>rr,ZodReadonly:()=>Vr,ZodRecord:()=>qn,ZodSchema:()=>se,ZodSet:()=>ma,ZodString:()=>er,ZodSymbol:()=>fa,ZodTransformer:()=>ht,ZodTuple:()=>Tt,ZodType:()=>se,ZodUndefined:()=>Ir,ZodUnion:()=>Dr,ZodUnknown:()=>qt,ZodVoid:()=>pa,addIssueToContext:()=>N,any:()=>fm,array:()=>gm,bigint:()=>im,boolean:()=>Vl,coerce:()=>Fm,custom:()=>Fl,date:()=>cm,datetimeRegex:()=>Ml,defaultErrorMap:()=>Ft,discriminatedUnion:()=>bm,effect:()=>jm,enum:()=>Om,function:()=>Em,getErrorMap:()=>la,getParsedType:()=>Rt,instanceof:()=>sm,intersection:()=>xm,isAborted:()=>zn,isAsync:()=>da,isDirty:()=>Fn,isValid:()=>Xt,late:()=>nm,lazy:()=>Rm,literal:()=>Tm,makeIssue:()=>$a,map:()=>Sm,nan:()=>om,nativeEnum:()=>Cm,never:()=>hm,null:()=>um,nullable:()=>$m,number:()=>ql,object:()=>vm,objectUtil:()=>Us,oboolean:()=>zm,onumber:()=>Mm,optional:()=>Im,ostring:()=>Nm,pipeline:()=>Lm,preprocess:()=>Dm,promise:()=>Am,quotelessJson:()=>jh,record:()=>km,set:()=>Pm,setErrorMap:()=>$h,strictObject:()=>ym,string:()=>Ul,symbol:()=>lm,transformer:()=>jm,tuple:()=>wm,undefined:()=>dm,union:()=>_m,unknown:()=>pm,util:()=>le,void:()=>mm});var le;(function(a){a.assertEqual=t=>{};function e(t){}a.assertIs=e;function r(t){throw new Error}a.assertNever=r,a.arrayToEnum=t=>{let s={};for(let o of t)s[o]=o;return s},a.getValidEnumValues=t=>{let s=a.objectKeys(t).filter(i=>typeof t[t[i]]!="number"),o={};for(let i of s)o[i]=t[i];return a.objectValues(o)},a.objectValues=t=>a.objectKeys(t).map(function(s){return t[s]}),a.objectKeys=typeof Object.keys=="function"?t=>Object.keys(t):t=>{let s=[];for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&s.push(o);return s},a.find=(t,s)=>{for(let o of t)if(s(o))return o},a.isInteger=typeof Number.isInteger=="function"?t=>Number.isInteger(t):t=>typeof t=="number"&&Number.isFinite(t)&&Math.floor(t)===t;function n(t,s=" | "){return t.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}a.joinValues=n,a.jsonStringifyReplacer=(t,s)=>typeof s=="bigint"?s.toString():s})(le||(le={}));var Us;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(Us||(Us={}));var z=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rt=a=>{switch(typeof a){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(a)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(a)?z.array:a===null?z.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?z.promise:typeof Map<"u"&&a instanceof Map?z.map:typeof Set<"u"&&a instanceof Set?z.set:typeof Date<"u"&&a instanceof Date?z.date:z.object;default:return z.unknown}};var T=le.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"]),jh=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ye=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},t=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(t);else if(o.code==="invalid_return_type")t(o.returnTypeError);else if(o.code==="invalid_arguments")t(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let i=n,d=0;for(;d<o.path.length;){let c=o.path[d];d===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(r(o))):i[c]=i[c]||{_errors:[]},i=i[c],d++}}};return t(this),n}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let t of this.issues)if(t.path.length>0){let s=t.path[0];r[s]=r[s]||[],r[s].push(e(t))}else n.push(e(t));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ye.create=a=>new Ye(a);var Ih=(a,e)=>{let r;switch(a.code){case T.invalid_type:a.received===z.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case T.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,le.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:r=`Unrecognized key(s) in object: ${le.joinValues(a.keys,", ")}`;break;case T.invalid_union:r="Invalid input";break;case T.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${le.joinValues(a.options)}`;break;case T.invalid_enum_value:r=`Invalid enum value. Expected ${le.joinValues(a.options)}, received '${a.received}'`;break;case T.invalid_arguments:r="Invalid function arguments";break;case T.invalid_return_type:r="Invalid function return type";break;case T.invalid_date:r="Invalid date";break;case T.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:le.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case T.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case T.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case T.custom:r="Invalid input";break;case T.invalid_intersection_types:r="Intersection results could not be merged";break;case T.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case T.not_finite:r="Number must be finite";break;default:r=e.defaultError,le.assertNever(a)}return{message:r}},Ft=Ih;var Il=Ft;function $h(a){Il=a}function la(){return Il}var $a=a=>{let{data:e,path:r,errorMaps:n,issueData:t}=a,s=[...r,...t.path||[]],o={...t,path:s};if(t.message!==void 0)return{...t,path:s,message:t.message};let i="",d=n.filter(c=>!!c).slice().reverse();for(let c of d)i=c(o,{data:e,defaultError:i}).message;return{...t,path:s,message:i}},Dh=[];function N(a,e){let r=la(),n=$a({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===Ft?void 0:Ft].filter(t=>!!t)});a.common.issues.push(n)}var ze=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let t of r){if(t.status==="aborted")return G;t.status==="dirty"&&e.dirty(),n.push(t.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let t of r){let s=await t.key,o=await t.value;n.push({key:s,value:o})}return a.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let t of r){let{key:s,value:o}=t;if(s.status==="aborted"||o.status==="aborted")return G;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||t.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}},G=Object.freeze({status:"aborted"}),Tr=a=>({status:"dirty",value:a}),Ve=a=>({status:"valid",value:a}),zn=a=>a.status==="aborted",Fn=a=>a.status==="dirty",Xt=a=>a.status==="valid",da=a=>typeof Promise<"u"&&a instanceof Promise;var B;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(B||(B={}));var pt=class{constructor(e,r,n,t){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=t}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},$l=(a,e)=>{if(Xt(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ye(a.common.issues);return this._error=r,this._error}}};function ae(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:t}=a;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:t}:{errorMap:(o,i)=>{let{message:d}=a;return o.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??n??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:d??r??i.defaultError}},description:t}}var se=class{get description(){return this._def.description}_getType(e){return Rt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ze,ctx:{common:e.parent.common,data:e.data,parsedType:Rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(da(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)},t=this._parseSync({data:e,path:n.path,parent:n});return $l(n,t)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Xt(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Xt(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)},t=this._parse({data:e,path:n.path,parent:n}),s=await(da(t)?t:Promise.resolve(t));return $l(n,s)}refine(e,r){let n=t=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(t):r;return this._refinement((t,s)=>{let o=e(t),i=()=>s.addIssue({code:T.custom,...n(t)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,r){return this._refinement((n,t)=>e(n)?!0:(t.addIssue(typeof r=="function"?r(n,t):r),!1))}_refinement(e){return new ht({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ft.create(this,this._def)}nullable(){return Ot.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vt.create(this)}promise(){return rr.create(this,this._def)}or(e){return Dr.create([this,e],this._def)}and(e){return Lr.create(this,e,this._def)}transform(e){return new ht({...ae(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ur({...ae(this._def),innerType:this,defaultValue:r,typeName:X.ZodDefault})}brand(){return new Da({typeName:X.ZodBranded,type:this,...ae(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new qr({...ae(this._def),innerType:this,catchValue:r,typeName:X.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return La.create(this,e)}readonly(){return Vr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Lh=/^c[^\s-]{8,}$/i,Nh=/^[0-9a-z]+$/,Mh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zh=/^[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,Fh=/^[a-z0-9_-]{21}$/i,Uh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qh=/^[-+]?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)?)??$/,Vh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qs,Zh=/^(?:(?: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])$/,Hh=/^(?:(?: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])$/,Bh=/^(([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]))$/,Wh=/^(([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])$/,Kh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Qh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ll="((\\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])))",Gh=new RegExp(`^${Ll}$`);function Nl(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Yh(a){return new RegExp(`^${Nl(a)}$`)}function Ml(a){let e=`${Ll}T${Nl(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Xh(a,e){return!!((e==="v4"||!e)&&Zh.test(a)||(e==="v6"||!e)&&Bh.test(a))}function em(a,e){if(!Uh.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),t=JSON.parse(atob(n));return!(typeof t!="object"||t===null||"typ"in t&&t?.typ!=="JWT"||!t.alg||e&&t.alg!==e)}catch{return!1}}function tm(a,e){return!!((e==="v4"||!e)&&Hh.test(a)||(e==="v6"||!e)&&Wh.test(a))}var er=class a extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return N(s,{code:T.invalid_type,expected:z.string,received:s.parsedType}),G}let n=new ze,t;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(t=this._getOrReturnCtx(e,t),N(t,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(t=this._getOrReturnCtx(e,t),N(t,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,i=e.data.length<s.value;(o||i)&&(t=this._getOrReturnCtx(e,t),o?N(t,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&N(t,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Vh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"email",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")qs||(qs=new RegExp(Jh,"u")),qs.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"emoji",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")zh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"uuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Fh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"nanoid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Lh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"cuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Nh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"cuid2",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Mh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"ulid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{t=this._getOrReturnCtx(e,t),N(t,{validation:"url",code:T.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"regex",code:T.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Ml(s).test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Gh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Yh(s).test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?qh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"duration",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Xh(e.data,s.version)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"ip",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?em(e.data,s.alg)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"jwt",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?tm(e.data,s.version)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"cidr",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Kh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"base64",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Qh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"base64url",code:T.invalid_string,message:s.message}),n.dirty()):le.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(t=>e.test(t),{validation:r,code:T.invalid_string,...B.errToObj(n)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...B.errToObj(e)})}url(e){return this._addCheck({kind:"url",...B.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...B.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...B.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...B.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...B.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...B.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...B.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...B.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...B.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...B.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...B.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...B.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...B.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...B.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...B.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...B.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...B.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...B.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...B.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...B.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...B.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...B.errToObj(r)})}nonempty(e){return this.min(1,B.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};er.create=a=>new er({checks:[],typeName:X.ZodString,coerce:a?.coerce??!1,...ae(a)});function rm(a,e){let r=(a.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,t=r>n?r:n,s=Number.parseInt(a.toFixed(t).replace(".","")),o=Number.parseInt(e.toFixed(t).replace(".",""));return s%o/10**t}var Or=class a extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==z.number){let s=this._getOrReturnCtx(e);return N(s,{code:T.invalid_type,expected:z.number,received:s.parsedType}),G}let n,t=new ze;for(let s of this._def.checks)s.kind==="int"?le.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:T.invalid_type,expected:"integer",received:"float",message:s.message}),t.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),t.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),t.dirty()):s.kind==="multipleOf"?rm(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),t.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:T.not_finite,message:s.message}),t.dirty()):le.assertNever(s);return{status:t.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,B.toString(r))}gt(e,r){return this.setLimit("min",e,!1,B.toString(r))}lte(e,r){return this.setLimit("max",e,!0,B.toString(r))}lt(e,r){return this.setLimit("max",e,!1,B.toString(r))}setLimit(e,r,n,t){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:B.toString(t)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:B.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:B.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:B.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:B.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:B.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:B.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:B.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:B.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:B.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Or.create=a=>new Or({checks:[],typeName:X.ZodNumber,coerce:a?.coerce||!1,...ae(a)});var Cr=class a extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==z.bigint)return this._getInvalidInput(e);let n,t=new ze;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),t.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),t.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),t.dirty()):le.assertNever(s);return{status:t.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return N(r,{code:T.invalid_type,expected:z.bigint,received:r.parsedType}),G}gte(e,r){return this.setLimit("min",e,!0,B.toString(r))}gt(e,r){return this.setLimit("min",e,!1,B.toString(r))}lte(e,r){return this.setLimit("max",e,!0,B.toString(r))}lt(e,r){return this.setLimit("max",e,!1,B.toString(r))}setLimit(e,r,n,t){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:B.toString(t)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:B.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:B.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:B.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:B.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:B.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Cr.create=a=>new Cr({checks:[],typeName:X.ZodBigInt,coerce:a?.coerce??!1,...ae(a)});var Ar=class extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.boolean,received:n.parsedType}),G}return Ve(e.data)}};Ar.create=a=>new Ar({typeName:X.ZodBoolean,coerce:a?.coerce||!1,...ae(a)});var jr=class a extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return N(s,{code:T.invalid_type,expected:z.date,received:s.parsedType}),G}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return N(s,{code:T.invalid_date}),G}let n=new ze,t;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(t=this._getOrReturnCtx(e,t),N(t,{code:T.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(t=this._getOrReturnCtx(e,t),N(t,{code:T.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):le.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:B.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:B.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};jr.create=a=>new jr({checks:[],coerce:a?.coerce||!1,typeName:X.ZodDate,...ae(a)});var fa=class extends se{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.symbol,received:n.parsedType}),G}return Ve(e.data)}};fa.create=a=>new fa({typeName:X.ZodSymbol,...ae(a)});var Ir=class extends se{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.undefined,received:n.parsedType}),G}return Ve(e.data)}};Ir.create=a=>new Ir({typeName:X.ZodUndefined,...ae(a)});var $r=class extends se{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.null,received:n.parsedType}),G}return Ve(e.data)}};$r.create=a=>new $r({typeName:X.ZodNull,...ae(a)});var tr=class extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return Ve(e.data)}};tr.create=a=>new tr({typeName:X.ZodAny,...ae(a)});var qt=class extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ve(e.data)}};qt.create=a=>new qt({typeName:X.ZodUnknown,...ae(a)});var _t=class extends se{_parse(e){let r=this._getOrReturnCtx(e);return N(r,{code:T.invalid_type,expected:z.never,received:r.parsedType}),G}};_t.create=a=>new _t({typeName:X.ZodNever,...ae(a)});var pa=class extends se{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.void,received:n.parsedType}),G}return Ve(e.data)}};pa.create=a=>new pa({typeName:X.ZodVoid,...ae(a)});var Vt=class a extends se{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),t=this._def;if(r.parsedType!==z.array)return N(r,{code:T.invalid_type,expected:z.array,received:r.parsedType}),G;if(t.exactLength!==null){let o=r.data.length>t.exactLength.value,i=r.data.length<t.exactLength.value;(o||i)&&(N(r,{code:o?T.too_big:T.too_small,minimum:i?t.exactLength.value:void 0,maximum:o?t.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:t.exactLength.message}),n.dirty())}if(t.minLength!==null&&r.data.length<t.minLength.value&&(N(r,{code:T.too_small,minimum:t.minLength.value,type:"array",inclusive:!0,exact:!1,message:t.minLength.message}),n.dirty()),t.maxLength!==null&&r.data.length>t.maxLength.value&&(N(r,{code:T.too_big,maximum:t.maxLength.value,type:"array",inclusive:!0,exact:!1,message:t.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,i)=>t.type._parseAsync(new pt(r,o,r.path,i)))).then(o=>ze.mergeArray(n,o));let s=[...r.data].map((o,i)=>t.type._parseSync(new pt(r,o,r.path,i)));return ze.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:B.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:B.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:B.toString(r)}})}nonempty(e){return this.min(1,e)}};Vt.create=(a,e)=>new Vt({type:a,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...ae(e)});function ua(a){if(a instanceof Xe){let e={};for(let r in a.shape){let n=a.shape[r];e[r]=ft.create(ua(n))}return new Xe({...a._def,shape:()=>e})}else return a instanceof Vt?new Vt({...a._def,type:ua(a.element)}):a instanceof ft?ft.create(ua(a.unwrap())):a instanceof Ot?Ot.create(ua(a.unwrap())):a instanceof Tt?Tt.create(a.items.map(e=>ua(e))):a}var Xe=class a extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=le.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==z.object){let c=this._getOrReturnCtx(e);return N(c,{code:T.invalid_type,expected:z.object,received:c.parsedType}),G}let{status:n,ctx:t}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof _t&&this._def.unknownKeys==="strip"))for(let c in t.data)o.includes(c)||i.push(c);let d=[];for(let c of o){let u=s[c],h=t.data[c];d.push({key:{status:"valid",value:c},value:u._parse(new pt(t,h,t.path,c)),alwaysSet:c in t.data})}if(this._def.catchall instanceof _t){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)d.push({key:{status:"valid",value:u},value:{status:"valid",value:t.data[u]}});else if(c==="strict")i.length>0&&(N(t,{code:T.unrecognized_keys,keys:i}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let h=t.data[u];d.push({key:{status:"valid",value:u},value:c._parse(new pt(t,h,t.path,u)),alwaysSet:u in t.data})}}return t.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of d){let h=await u.key,v=await u.value;c.push({key:h,value:v,alwaysSet:u.alwaysSet})}return c}).then(c=>ze.mergeObjectSync(n,c)):ze.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return B.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let t=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:B.errToObj(e).message??t}:{message:t}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let n of le.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let n of le.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new a({...this._def,shape:()=>r})}deepPartial(){return ua(this)}partial(e){let r={};for(let n of le.objectKeys(this.shape)){let t=this.shape[n];e&&!e[n]?r[n]=t:r[n]=t.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let n of le.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof ft;)s=s._def.innerType;r[n]=s}return new a({...this._def,shape:()=>r})}keyof(){return zl(le.objectKeys(this.shape))}};Xe.create=(a,e)=>new Xe({shape:()=>a,unknownKeys:"strip",catchall:_t.create(),typeName:X.ZodObject,...ae(e)});Xe.strictCreate=(a,e)=>new Xe({shape:()=>a,unknownKeys:"strict",catchall:_t.create(),typeName:X.ZodObject,...ae(e)});Xe.lazycreate=(a,e)=>new Xe({shape:a,unknownKeys:"strip",catchall:_t.create(),typeName:X.ZodObject,...ae(e)});var Dr=class extends se{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function t(s){for(let i of s)if(i.result.status==="valid")return i.result;for(let i of s)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(i=>new Ye(i.ctx.common.issues));return N(r,{code:T.invalid_union,unionErrors:o}),G}if(r.common.async)return Promise.all(n.map(async s=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(t);{let s,o=[];for(let d of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=d._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map(d=>new Ye(d));return N(r,{code:T.invalid_union,unionErrors:i}),G}}get options(){return this._def.options}};Dr.create=(a,e)=>new Dr({options:a,typeName:X.ZodUnion,...ae(e)});var Ut=a=>a instanceof Nr?Ut(a.schema):a instanceof ht?Ut(a.innerType()):a instanceof Mr?[a.value]:a instanceof zr?a.options:a instanceof Fr?le.objectValues(a.enum):a instanceof Ur?Ut(a._def.innerType):a instanceof Ir?[void 0]:a instanceof $r?[null]:a instanceof ft?[void 0,...Ut(a.unwrap())]:a instanceof Ot?[null,...Ut(a.unwrap())]:a instanceof Da||a instanceof Vr?Ut(a.unwrap()):a instanceof qr?Ut(a._def.innerType):[],Un=class a extends se{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return N(r,{code:T.invalid_type,expected:z.object,received:r.parsedType}),G;let n=this.discriminator,t=r.data[n],s=this.optionsMap.get(t);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(N(r,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let t=new Map;for(let s of r){let o=Ut(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(t.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);t.set(i,s)}}return new a({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:t,...ae(n)})}};function Vs(a,e){let r=Rt(a),n=Rt(e);if(a===e)return{valid:!0,data:a};if(r===z.object&&n===z.object){let t=le.objectKeys(e),s=le.objectKeys(a).filter(i=>t.indexOf(i)!==-1),o={...a,...e};for(let i of s){let d=Vs(a[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(r===z.array&&n===z.array){if(a.length!==e.length)return{valid:!1};let t=[];for(let s=0;s<a.length;s++){let o=a[s],i=e[s],d=Vs(o,i);if(!d.valid)return{valid:!1};t.push(d.data)}return{valid:!0,data:t}}else return r===z.date&&n===z.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Lr=class extends se{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),t=(s,o)=>{if(zn(s)||zn(o))return G;let i=Vs(s.value,o.value);return i.valid?((Fn(s)||Fn(o))&&r.dirty(),{status:r.value,value:i.data}):(N(n,{code:T.invalid_intersection_types}),G)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>t(s,o)):t(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Lr.create=(a,e,r)=>new Lr({left:a,right:e,typeName:X.ZodIntersection,...ae(r)});var Tt=class a extends se{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return N(n,{code:T.invalid_type,expected:z.array,received:n.parsedType}),G;if(n.data.length<this._def.items.length)return N(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G;!this._def.rest&&n.data.length>this._def.items.length&&(N(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((o,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new pt(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>ze.mergeArray(r,o)):ze.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};Tt.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Tt({items:a,typeName:X.ZodTuple,rest:null,...ae(e)})};var qn=class a extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.object)return N(n,{code:T.invalid_type,expected:z.object,received:n.parsedType}),G;let t=[],s=this._def.keyType,o=this._def.valueType;for(let i in n.data)t.push({key:s._parse(new pt(n,i,n.path,i)),value:o._parse(new pt(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?ze.mergeObjectAsync(r,t):ze.mergeObjectSync(r,t)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof se?new a({keyType:e,valueType:r,typeName:X.ZodRecord,...ae(n)}):new a({keyType:er.create(),valueType:e,typeName:X.ZodRecord,...ae(r)})}},ha=class extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.map)return N(n,{code:T.invalid_type,expected:z.map,received:n.parsedType}),G;let t=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([i,d],c)=>({key:t._parse(new pt(n,i,n.path,[c,"key"])),value:s._parse(new pt(n,d,n.path,[c,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of o){let c=await d.key,u=await d.value;if(c.status==="aborted"||u.status==="aborted")return G;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),i.set(c.value,u.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let d of o){let c=d.key,u=d.value;if(c.status==="aborted"||u.status==="aborted")return G;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),i.set(c.value,u.value)}return{status:r.value,value:i}}}};ha.create=(a,e,r)=>new ha({valueType:e,keyType:a,typeName:X.ZodMap,...ae(r)});var ma=class a extends se{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return N(n,{code:T.invalid_type,expected:z.set,received:n.parsedType}),G;let t=this._def;t.minSize!==null&&n.data.size<t.minSize.value&&(N(n,{code:T.too_small,minimum:t.minSize.value,type:"set",inclusive:!0,exact:!1,message:t.minSize.message}),r.dirty()),t.maxSize!==null&&n.data.size>t.maxSize.value&&(N(n,{code:T.too_big,maximum:t.maxSize.value,type:"set",inclusive:!0,exact:!1,message:t.maxSize.message}),r.dirty());let s=this._def.valueType;function o(d){let c=new Set;for(let u of d){if(u.status==="aborted")return G;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let i=[...n.data.values()].map((d,c)=>s._parse(new pt(n,d,n.path,c)));return n.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,r){return new a({...this._def,minSize:{value:e,message:B.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:B.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ma.create=(a,e)=>new ma({valueType:a,minSize:null,maxSize:null,typeName:X.ZodSet,...ae(e)});var Vn=class a extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.function)return N(r,{code:T.invalid_type,expected:z.function,received:r.parsedType}),G;function n(i,d){return $a({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,la(),Ft].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:d}})}function t(i,d){return $a({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,la(),Ft].filter(c=>!!c),issueData:{code:T.invalid_return_type,returnTypeError:d}})}let s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof rr){let i=this;return Ve(async function(...d){let c=new Ye([]),u=await i._def.args.parseAsync(d,s).catch(f=>{throw c.addIssue(n(d,f)),c}),h=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(h,s).catch(f=>{throw c.addIssue(t(h,f)),c})})}else{let i=this;return Ve(function(...d){let c=i._def.args.safeParse(d,s);if(!c.success)throw new Ye([n(d,c.error)]);let u=Reflect.apply(o,this,c.data),h=i._def.returns.safeParse(u,s);if(!h.success)throw new Ye([t(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:Tt.create(e).rest(qt.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new a({args:e||Tt.create([]).rest(qt.create()),returns:r||qt.create(),typeName:X.ZodFunction,...ae(n)})}},Nr=class extends se{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Nr.create=(a,e)=>new Nr({getter:a,typeName:X.ZodLazy,...ae(e)});var Mr=class extends se{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return N(r,{received:r.data,code:T.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:e.data}}get value(){return this._def.value}};Mr.create=(a,e)=>new Mr({value:a,typeName:X.ZodLiteral,...ae(e)});function zl(a,e){return new zr({values:a,typeName:X.ZodEnum,...ae(e)})}var zr=class a extends se{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return N(r,{expected:le.joinValues(n),received:r.parsedType,code:T.invalid_type}),G}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return N(r,{received:r.data,code:T.invalid_enum_value,options:n}),G}return Ve(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};zr.create=zl;var Fr=class extends se{_parse(e){let r=le.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let t=le.objectValues(r);return N(n,{expected:le.joinValues(t),received:n.parsedType,code:T.invalid_type}),G}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let t=le.objectValues(r);return N(n,{received:n.data,code:T.invalid_enum_value,options:t}),G}return Ve(e.data)}get enum(){return this._def.values}};Fr.create=(a,e)=>new Fr({values:a,typeName:X.ZodNativeEnum,...ae(e)});var rr=class extends se{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.promise&&r.common.async===!1)return N(r,{code:T.invalid_type,expected:z.promise,received:r.parsedType}),G;let n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return Ve(n.then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}};rr.create=(a,e)=>new rr({type:a,typeName:X.ZodPromise,...ae(e)});var ht=class extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),t=this._def.effect||null,s={addIssue:o=>{N(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),t.type==="preprocess"){let o=t.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async i=>{if(r.value==="aborted")return G;let d=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return d.status==="aborted"?G:d.status==="dirty"?Tr(d.value):r.value==="dirty"?Tr(d.value):d});{if(r.value==="aborted")return G;let i=this._def.schema._parseSync({data:o,path:n.path,parent:n});return i.status==="aborted"?G:i.status==="dirty"?Tr(i.value):r.value==="dirty"?Tr(i.value):i}}if(t.type==="refinement"){let o=i=>{let d=t.refinement(i,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?G:(i.status==="dirty"&&r.dirty(),o(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?G:(i.status==="dirty"&&r.dirty(),o(i.value).then(()=>({status:r.value,value:i.value}))))}if(t.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Xt(o))return G;let i=t.transform(o.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Xt(o)?Promise.resolve(t.transform(o.value,s)).then(i=>({status:r.value,value:i})):G);le.assertNever(t)}};ht.create=(a,e,r)=>new ht({schema:a,typeName:X.ZodEffects,effect:e,...ae(r)});ht.createWithPreprocess=(a,e,r)=>new ht({schema:e,effect:{type:"preprocess",transform:a},typeName:X.ZodEffects,...ae(r)});var ft=class extends se{_parse(e){return this._getType(e)===z.undefined?Ve(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ft.create=(a,e)=>new ft({innerType:a,typeName:X.ZodOptional,...ae(e)});var Ot=class extends se{_parse(e){return this._getType(e)===z.null?Ve(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ot.create=(a,e)=>new Ot({innerType:a,typeName:X.ZodNullable,...ae(e)});var Ur=class extends se{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ur.create=(a,e)=>new Ur({innerType:a,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ae(e)});var qr=class extends se{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},t=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return da(t)?t.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})})):{status:"valid",value:t.status==="valid"?t.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};qr.create=(a,e)=>new qr({innerType:a,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ae(e)});var ga=class extends se{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.nan,received:n.parsedType}),G}return{status:"valid",value:e.data}}};ga.create=a=>new ga({typeName:X.ZodNaN,...ae(a)});var am=Symbol("zod_brand"),Da=class extends se{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},La=class a extends se{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?G:s.status==="dirty"?(r.dirty(),Tr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let t=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return t.status==="aborted"?G:t.status==="dirty"?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:n.path,parent:n})}}static create(e,r){return new a({in:e,out:r,typeName:X.ZodPipeline})}},Vr=class extends se{_parse(e){let r=this._def.innerType._parse(e),n=t=>(Xt(t)&&(t.value=Object.freeze(t.value)),t);return da(r)?r.then(t=>n(t)):n(r)}unwrap(){return this._def.innerType}};Vr.create=(a,e)=>new Vr({innerType:a,typeName:X.ZodReadonly,...ae(e)});function Dl(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function Fl(a,e={},r){return a?tr.create().superRefine((n,t)=>{let s=a(n);if(s instanceof Promise)return s.then(o=>{if(!o){let i=Dl(e,n),d=i.fatal??r??!0;t.addIssue({code:"custom",...i,fatal:d})}});if(!s){let o=Dl(e,n),i=o.fatal??r??!0;t.addIssue({code:"custom",...o,fatal:i})}}):tr.create()}var nm={object:Xe.lazycreate},X;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(X||(X={}));var sm=(a,e={message:`Input not instance of ${a.name}`})=>Fl(r=>r instanceof a,e),Ul=er.create,ql=Or.create,om=ga.create,im=Cr.create,Vl=Ar.create,cm=jr.create,lm=fa.create,dm=Ir.create,um=$r.create,fm=tr.create,pm=qt.create,hm=_t.create,mm=pa.create,gm=Vt.create,vm=Xe.create,ym=Xe.strictCreate,_m=Dr.create,bm=Un.create,xm=Lr.create,wm=Tt.create,km=qn.create,Sm=ha.create,Pm=ma.create,Em=Vn.create,Rm=Nr.create,Tm=Mr.create,Om=zr.create,Cm=Fr.create,Am=rr.create,jm=ht.create,Im=ft.create,$m=Ot.create,Dm=ht.createWithPreprocess,Lm=La.create,Nm=()=>Ul().optional(),Mm=()=>ql().optional(),zm=()=>Vl().optional(),Fm={string:(a=>er.create({...a,coerce:!0})),number:(a=>Or.create({...a,coerce:!0})),boolean:(a=>Ar.create({...a,coerce:!0})),bigint:(a=>Cr.create({...a,coerce:!0})),date:(a=>jr.create({...a,coerce:!0}))};var Um=G;import{existsSync as Bs,mkdirSync as _g,readFileSync as Ws,writeFileSync as bg}from"node:fs";import{homedir as xg}from"node:os";import{dirname as wg,join as kg}from"node:path";import{spawn as tg}from"node:child_process";import{randomBytes as rg}from"node:crypto";import{createServer as ag}from"node:http";import{appendFileSync as qm,openSync as Sx}from"node:fs";import{homedir as Vm}from"node:os";import{dirname as Jm,join as Zm}from"node:path";import{mkdirSync as Hm}from"node:fs";var Jr="<SENSITIVE_DATA>",Jl=new Set(["access_token","authorization","code","cookie","kandan_preview_ticket","refresh_token","token"]),Bm=new Set(["--access-token","--api-key","--authorization","--cookie","--oauth-code","--password","--refresh-token","--secret","--token"]);function Js(a,e,r={}){let n=r.logFile??Wm();try{Hm(Jm(n),{recursive:!0}),qm(n,`${JSON.stringify({ts:new Date().toISOString(),event:a,...r.sessionId===void 0?{}:{sessionId:r.sessionId},...Km(e)})}
10
- `,"utf8")}catch{return}}function Wm(){let a=process.env.LINZUMI_CLI_AUDIT_LOG?.trim();return a===void 0||a===""?Zm(Vm(),".linzumi","logs","command-events.jsonl"):a}function Km(a){return Zl(a)}function Zs(a,e){return Ym(e)?Jr:typeof a=="string"?Hl(a):Array.isArray(a)?e==="args"?Qm(a):a.map(r=>Zs(r,void 0)):a!==null&&typeof a=="object"?Zl(a):a}function Zl(a){let e=typeof a.name=="string"?a.name.toLowerCase():void 0,r=e==="authorization"||e==="cookie"||e==="set-cookie";return Object.fromEntries(Object.entries(a).filter(([n])=>n!=="runner_console").map(([n,t])=>[n,r&&n==="value"?Jr:Zs(t,n)]))}function Qm(a){let e=!1;return a.map(r=>{if(typeof r!="string")return e=!1,Zs(r,void 0);if(e)return e=!1,Jr;let[n,t]=Gm(r);return Bm.has(n)?t===void 0?(e=!0,r):`${n}=${Jr}`:Hl(r)})}function Gm(a){let e=a.indexOf("=");return e===-1?[a,void 0]:[a.slice(0,e),a.slice(e+1)]}function Ym(a){return a===void 0?!1:/^(authorization|cookie|set-cookie|password)$/i.test(a)||/(^|[_-])(access[_-]?token|api[_-]?key|auth[_-]?token|oauth[_-]?code|refresh[_-]?token|secret|token)$/i.test(a)}function Hl(a){return Xm(a).replace(/\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,Jr)}function Xm(a){let e;try{e=new URL(a)}catch{return eg(a)}for(let r of[...e.searchParams.keys()])Jl.has(r.toLowerCase())&&e.searchParams.set(r,Jr);return e.toString()}function eg(a){let e=a.indexOf("?"),r=a.indexOf("#");if(e===-1||r!==-1&&r<e)return a;let n=a.slice(0,e),t=r===-1?a.slice(e+1):a.slice(e+1,r),s=r===-1?"":a.slice(r),o=new URLSearchParams(t),i=!1;for(let d of[...o.keys()])Jl.has(d.toLowerCase())&&(o.set(d,Jr),i=!0);switch(i){case!0:return`${n}?${o.toString()}${s}`;case!1:return a}}var ng=300*1e3,sg=1e4;function Wl(a,e=process.env){if(typeof a=="number"&&Number.isFinite(a)&&a>0)return a;let r=e.LINZUMI_OAUTH_CALLBACK_TIMEOUT_MS?.trim();if(r!==void 0&&r!==""){let n=Number.parseInt(r,10);if(Number.isFinite(n)&&n>0)return n}return ng}async function Kl(a){let e=Ct(a.kandanUrl),r=rg(18).toString("base64url"),n=await pg({host:og(a.kandanUrl,a.callbackHost),exchange:async s=>{if(s.state!==r)throw new Error("local runner OAuth state mismatch");return await lg({httpBaseUrl:e,code:s.code,redirectUri:s.redirectUri})}}),t=cg({httpBaseUrl:e,redirectUri:n.redirectUri,state:r,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,onboarding:a.onboarding,purpose:a.purpose});process.stderr.write(`Authorize the local Codex runner:
9
+ `}var Mn=class{constructor(e=Il.stdin,r=Il.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Nn,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{var t;(t=this.onerror)===null||t===void 0||t.call(this,n)}}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(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(r=>{let n=Al(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};import{readFile as dd}from"node:fs/promises";var x={};yo(x,{BRAND:()=>am,DIRTY:()=>Tr,EMPTY_PATH:()=>Dh,INVALID:()=>G,NEVER:()=>Um,OK:()=>Ve,ParseStatus:()=>ze,Schema:()=>se,ZodAny:()=>tr,ZodArray:()=>Vt,ZodBigInt:()=>Cr,ZodBoolean:()=>Ar,ZodBranded:()=>Da,ZodCatch:()=>qr,ZodDate:()=>Ir,ZodDefault:()=>Ur,ZodDiscriminatedUnion:()=>Un,ZodEffects:()=>ht,ZodEnum:()=>zr,ZodError:()=>Ye,ZodFirstPartyTypeKind:()=>X,ZodFunction:()=>Vn,ZodIntersection:()=>Lr,ZodIssueCode:()=>T,ZodLazy:()=>Nr,ZodLiteral:()=>Mr,ZodMap:()=>ha,ZodNaN:()=>ga,ZodNativeEnum:()=>Fr,ZodNever:()=>_t,ZodNull:()=>$r,ZodNullable:()=>Ot,ZodNumber:()=>Or,ZodObject:()=>Xe,ZodOptional:()=>pt,ZodParsedType:()=>z,ZodPipeline:()=>La,ZodPromise:()=>rr,ZodReadonly:()=>Vr,ZodRecord:()=>qn,ZodSchema:()=>se,ZodSet:()=>ma,ZodString:()=>er,ZodSymbol:()=>pa,ZodTransformer:()=>ht,ZodTuple:()=>Tt,ZodType:()=>se,ZodUndefined:()=>jr,ZodUnion:()=>Dr,ZodUnknown:()=>qt,ZodVoid:()=>fa,addIssueToContext:()=>N,any:()=>pm,array:()=>gm,bigint:()=>im,boolean:()=>Vl,coerce:()=>Fm,custom:()=>Fl,date:()=>cm,datetimeRegex:()=>Ml,defaultErrorMap:()=>Ft,discriminatedUnion:()=>bm,effect:()=>Im,enum:()=>Om,function:()=>Em,getErrorMap:()=>la,getParsedType:()=>Rt,instanceof:()=>sm,intersection:()=>xm,isAborted:()=>zn,isAsync:()=>da,isDirty:()=>Fn,isValid:()=>Xt,late:()=>nm,lazy:()=>Rm,literal:()=>Tm,makeIssue:()=>$a,map:()=>Sm,nan:()=>om,nativeEnum:()=>Cm,never:()=>hm,null:()=>um,nullable:()=>$m,number:()=>ql,object:()=>vm,objectUtil:()=>Us,oboolean:()=>zm,onumber:()=>Mm,optional:()=>jm,ostring:()=>Nm,pipeline:()=>Lm,preprocess:()=>Dm,promise:()=>Am,quotelessJson:()=>Ih,record:()=>km,set:()=>Pm,setErrorMap:()=>$h,strictObject:()=>ym,string:()=>Ul,symbol:()=>lm,transformer:()=>Im,tuple:()=>wm,undefined:()=>dm,union:()=>_m,unknown:()=>fm,util:()=>le,void:()=>mm});var le;(function(a){a.assertEqual=t=>{};function e(t){}a.assertIs=e;function r(t){throw new Error}a.assertNever=r,a.arrayToEnum=t=>{let s={};for(let o of t)s[o]=o;return s},a.getValidEnumValues=t=>{let s=a.objectKeys(t).filter(i=>typeof t[t[i]]!="number"),o={};for(let i of s)o[i]=t[i];return a.objectValues(o)},a.objectValues=t=>a.objectKeys(t).map(function(s){return t[s]}),a.objectKeys=typeof Object.keys=="function"?t=>Object.keys(t):t=>{let s=[];for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&s.push(o);return s},a.find=(t,s)=>{for(let o of t)if(s(o))return o},a.isInteger=typeof Number.isInteger=="function"?t=>Number.isInteger(t):t=>typeof t=="number"&&Number.isFinite(t)&&Math.floor(t)===t;function n(t,s=" | "){return t.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}a.joinValues=n,a.jsonStringifyReplacer=(t,s)=>typeof s=="bigint"?s.toString():s})(le||(le={}));var Us;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(Us||(Us={}));var z=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rt=a=>{switch(typeof a){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(a)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(a)?z.array:a===null?z.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?z.promise:typeof Map<"u"&&a instanceof Map?z.map:typeof Set<"u"&&a instanceof Set?z.set:typeof Date<"u"&&a instanceof Date?z.date:z.object;default:return z.unknown}};var T=le.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"]),Ih=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ye=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},t=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(t);else if(o.code==="invalid_return_type")t(o.returnTypeError);else if(o.code==="invalid_arguments")t(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let i=n,d=0;for(;d<o.path.length;){let c=o.path[d];d===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(r(o))):i[c]=i[c]||{_errors:[]},i=i[c],d++}}};return t(this),n}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let t of this.issues)if(t.path.length>0){let s=t.path[0];r[s]=r[s]||[],r[s].push(e(t))}else n.push(e(t));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ye.create=a=>new Ye(a);var jh=(a,e)=>{let r;switch(a.code){case T.invalid_type:a.received===z.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case T.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,le.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:r=`Unrecognized key(s) in object: ${le.joinValues(a.keys,", ")}`;break;case T.invalid_union:r="Invalid input";break;case T.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${le.joinValues(a.options)}`;break;case T.invalid_enum_value:r=`Invalid enum value. Expected ${le.joinValues(a.options)}, received '${a.received}'`;break;case T.invalid_arguments:r="Invalid function arguments";break;case T.invalid_return_type:r="Invalid function return type";break;case T.invalid_date:r="Invalid date";break;case T.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:le.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case T.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case T.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case T.custom:r="Invalid input";break;case T.invalid_intersection_types:r="Intersection results could not be merged";break;case T.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case T.not_finite:r="Number must be finite";break;default:r=e.defaultError,le.assertNever(a)}return{message:r}},Ft=jh;var jl=Ft;function $h(a){jl=a}function la(){return jl}var $a=a=>{let{data:e,path:r,errorMaps:n,issueData:t}=a,s=[...r,...t.path||[]],o={...t,path:s};if(t.message!==void 0)return{...t,path:s,message:t.message};let i="",d=n.filter(c=>!!c).slice().reverse();for(let c of d)i=c(o,{data:e,defaultError:i}).message;return{...t,path:s,message:i}},Dh=[];function N(a,e){let r=la(),n=$a({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===Ft?void 0:Ft].filter(t=>!!t)});a.common.issues.push(n)}var ze=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let t of r){if(t.status==="aborted")return G;t.status==="dirty"&&e.dirty(),n.push(t.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let t of r){let s=await t.key,o=await t.value;n.push({key:s,value:o})}return a.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let t of r){let{key:s,value:o}=t;if(s.status==="aborted"||o.status==="aborted")return G;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||t.alwaysSet)&&(n[s.value]=o.value)}return{status:e.value,value:n}}},G=Object.freeze({status:"aborted"}),Tr=a=>({status:"dirty",value:a}),Ve=a=>({status:"valid",value:a}),zn=a=>a.status==="aborted",Fn=a=>a.status==="dirty",Xt=a=>a.status==="valid",da=a=>typeof Promise<"u"&&a instanceof Promise;var B;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(B||(B={}));var ft=class{constructor(e,r,n,t){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=t}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},$l=(a,e)=>{if(Xt(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ye(a.common.issues);return this._error=r,this._error}}};function ae(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:t}=a;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:t}:{errorMap:(o,i)=>{let{message:d}=a;return o.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??n??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:d??r??i.defaultError}},description:t}}var se=class{get description(){return this._def.description}_getType(e){return Rt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ze,ctx:{common:e.parent.common,data:e.data,parsedType:Rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(da(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)},t=this._parseSync({data:e,path:n.path,parent:n});return $l(n,t)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Xt(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Xt(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)},t=this._parse({data:e,path:n.path,parent:n}),s=await(da(t)?t:Promise.resolve(t));return $l(n,s)}refine(e,r){let n=t=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(t):r;return this._refinement((t,s)=>{let o=e(t),i=()=>s.addIssue({code:T.custom,...n(t)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,r){return this._refinement((n,t)=>e(n)?!0:(t.addIssue(typeof r=="function"?r(n,t):r),!1))}_refinement(e){return new ht({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return pt.create(this,this._def)}nullable(){return Ot.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vt.create(this)}promise(){return rr.create(this,this._def)}or(e){return Dr.create([this,e],this._def)}and(e){return Lr.create(this,e,this._def)}transform(e){return new ht({...ae(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ur({...ae(this._def),innerType:this,defaultValue:r,typeName:X.ZodDefault})}brand(){return new Da({typeName:X.ZodBranded,type:this,...ae(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new qr({...ae(this._def),innerType:this,catchValue:r,typeName:X.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return La.create(this,e)}readonly(){return Vr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Lh=/^c[^\s-]{8,}$/i,Nh=/^[0-9a-z]+$/,Mh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zh=/^[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,Fh=/^[a-z0-9_-]{21}$/i,Uh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qh=/^[-+]?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)?)??$/,Vh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qs,Zh=/^(?:(?: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])$/,Hh=/^(?:(?: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])$/,Bh=/^(([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]))$/,Wh=/^(([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])$/,Kh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Qh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ll="((\\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])))",Gh=new RegExp(`^${Ll}$`);function Nl(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Yh(a){return new RegExp(`^${Nl(a)}$`)}function Ml(a){let e=`${Ll}T${Nl(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Xh(a,e){return!!((e==="v4"||!e)&&Zh.test(a)||(e==="v6"||!e)&&Bh.test(a))}function em(a,e){if(!Uh.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),t=JSON.parse(atob(n));return!(typeof t!="object"||t===null||"typ"in t&&t?.typ!=="JWT"||!t.alg||e&&t.alg!==e)}catch{return!1}}function tm(a,e){return!!((e==="v4"||!e)&&Hh.test(a)||(e==="v6"||!e)&&Wh.test(a))}var er=class a extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return N(s,{code:T.invalid_type,expected:z.string,received:s.parsedType}),G}let n=new ze,t;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(t=this._getOrReturnCtx(e,t),N(t,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(t=this._getOrReturnCtx(e,t),N(t,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,i=e.data.length<s.value;(o||i)&&(t=this._getOrReturnCtx(e,t),o?N(t,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&N(t,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Vh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"email",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")qs||(qs=new RegExp(Jh,"u")),qs.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"emoji",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")zh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"uuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Fh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"nanoid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Lh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"cuid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Nh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"cuid2",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Mh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"ulid",code:T.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{t=this._getOrReturnCtx(e,t),N(t,{validation:"url",code:T.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"regex",code:T.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Ml(s).test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Gh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Yh(s).test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{code:T.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?qh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"duration",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Xh(e.data,s.version)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"ip",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?em(e.data,s.alg)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"jwt",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?tm(e.data,s.version)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"cidr",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Kh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"base64",code:T.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Qh.test(e.data)||(t=this._getOrReturnCtx(e,t),N(t,{validation:"base64url",code:T.invalid_string,message:s.message}),n.dirty()):le.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(t=>e.test(t),{validation:r,code:T.invalid_string,...B.errToObj(n)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...B.errToObj(e)})}url(e){return this._addCheck({kind:"url",...B.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...B.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...B.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...B.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...B.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...B.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...B.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...B.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...B.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...B.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...B.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...B.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...B.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...B.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...B.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...B.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...B.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...B.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...B.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...B.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...B.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...B.errToObj(r)})}nonempty(e){return this.min(1,B.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};er.create=a=>new er({checks:[],typeName:X.ZodString,coerce:a?.coerce??!1,...ae(a)});function rm(a,e){let r=(a.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,t=r>n?r:n,s=Number.parseInt(a.toFixed(t).replace(".","")),o=Number.parseInt(e.toFixed(t).replace(".",""));return s%o/10**t}var Or=class a extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==z.number){let s=this._getOrReturnCtx(e);return N(s,{code:T.invalid_type,expected:z.number,received:s.parsedType}),G}let n,t=new ze;for(let s of this._def.checks)s.kind==="int"?le.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:T.invalid_type,expected:"integer",received:"float",message:s.message}),t.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),t.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),t.dirty()):s.kind==="multipleOf"?rm(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),t.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:T.not_finite,message:s.message}),t.dirty()):le.assertNever(s);return{status:t.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,B.toString(r))}gt(e,r){return this.setLimit("min",e,!1,B.toString(r))}lte(e,r){return this.setLimit("max",e,!0,B.toString(r))}lt(e,r){return this.setLimit("max",e,!1,B.toString(r))}setLimit(e,r,n,t){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:B.toString(t)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:B.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:B.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:B.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:B.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:B.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:B.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:B.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:B.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:B.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&le.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Or.create=a=>new Or({checks:[],typeName:X.ZodNumber,coerce:a?.coerce||!1,...ae(a)});var Cr=class a extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==z.bigint)return this._getInvalidInput(e);let n,t=new ze;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),t.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),t.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),N(n,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),t.dirty()):le.assertNever(s);return{status:t.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return N(r,{code:T.invalid_type,expected:z.bigint,received:r.parsedType}),G}gte(e,r){return this.setLimit("min",e,!0,B.toString(r))}gt(e,r){return this.setLimit("min",e,!1,B.toString(r))}lte(e,r){return this.setLimit("max",e,!0,B.toString(r))}lt(e,r){return this.setLimit("max",e,!1,B.toString(r))}setLimit(e,r,n,t){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:B.toString(t)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:B.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:B.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:B.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:B.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:B.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Cr.create=a=>new Cr({checks:[],typeName:X.ZodBigInt,coerce:a?.coerce??!1,...ae(a)});var Ar=class extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.boolean,received:n.parsedType}),G}return Ve(e.data)}};Ar.create=a=>new Ar({typeName:X.ZodBoolean,coerce:a?.coerce||!1,...ae(a)});var Ir=class a extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return N(s,{code:T.invalid_type,expected:z.date,received:s.parsedType}),G}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return N(s,{code:T.invalid_date}),G}let n=new ze,t;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(t=this._getOrReturnCtx(e,t),N(t,{code:T.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(t=this._getOrReturnCtx(e,t),N(t,{code:T.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):le.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:B.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:B.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Ir.create=a=>new Ir({checks:[],coerce:a?.coerce||!1,typeName:X.ZodDate,...ae(a)});var pa=class extends se{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.symbol,received:n.parsedType}),G}return Ve(e.data)}};pa.create=a=>new pa({typeName:X.ZodSymbol,...ae(a)});var jr=class extends se{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.undefined,received:n.parsedType}),G}return Ve(e.data)}};jr.create=a=>new jr({typeName:X.ZodUndefined,...ae(a)});var $r=class extends se{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.null,received:n.parsedType}),G}return Ve(e.data)}};$r.create=a=>new $r({typeName:X.ZodNull,...ae(a)});var tr=class extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return Ve(e.data)}};tr.create=a=>new tr({typeName:X.ZodAny,...ae(a)});var qt=class extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ve(e.data)}};qt.create=a=>new qt({typeName:X.ZodUnknown,...ae(a)});var _t=class extends se{_parse(e){let r=this._getOrReturnCtx(e);return N(r,{code:T.invalid_type,expected:z.never,received:r.parsedType}),G}};_t.create=a=>new _t({typeName:X.ZodNever,...ae(a)});var fa=class extends se{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.void,received:n.parsedType}),G}return Ve(e.data)}};fa.create=a=>new fa({typeName:X.ZodVoid,...ae(a)});var Vt=class a extends se{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),t=this._def;if(r.parsedType!==z.array)return N(r,{code:T.invalid_type,expected:z.array,received:r.parsedType}),G;if(t.exactLength!==null){let o=r.data.length>t.exactLength.value,i=r.data.length<t.exactLength.value;(o||i)&&(N(r,{code:o?T.too_big:T.too_small,minimum:i?t.exactLength.value:void 0,maximum:o?t.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:t.exactLength.message}),n.dirty())}if(t.minLength!==null&&r.data.length<t.minLength.value&&(N(r,{code:T.too_small,minimum:t.minLength.value,type:"array",inclusive:!0,exact:!1,message:t.minLength.message}),n.dirty()),t.maxLength!==null&&r.data.length>t.maxLength.value&&(N(r,{code:T.too_big,maximum:t.maxLength.value,type:"array",inclusive:!0,exact:!1,message:t.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,i)=>t.type._parseAsync(new ft(r,o,r.path,i)))).then(o=>ze.mergeArray(n,o));let s=[...r.data].map((o,i)=>t.type._parseSync(new ft(r,o,r.path,i)));return ze.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:B.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:B.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:B.toString(r)}})}nonempty(e){return this.min(1,e)}};Vt.create=(a,e)=>new Vt({type:a,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...ae(e)});function ua(a){if(a instanceof Xe){let e={};for(let r in a.shape){let n=a.shape[r];e[r]=pt.create(ua(n))}return new Xe({...a._def,shape:()=>e})}else return a instanceof Vt?new Vt({...a._def,type:ua(a.element)}):a instanceof pt?pt.create(ua(a.unwrap())):a instanceof Ot?Ot.create(ua(a.unwrap())):a instanceof Tt?Tt.create(a.items.map(e=>ua(e))):a}var Xe=class a extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=le.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==z.object){let c=this._getOrReturnCtx(e);return N(c,{code:T.invalid_type,expected:z.object,received:c.parsedType}),G}let{status:n,ctx:t}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof _t&&this._def.unknownKeys==="strip"))for(let c in t.data)o.includes(c)||i.push(c);let d=[];for(let c of o){let u=s[c],h=t.data[c];d.push({key:{status:"valid",value:c},value:u._parse(new ft(t,h,t.path,c)),alwaysSet:c in t.data})}if(this._def.catchall instanceof _t){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)d.push({key:{status:"valid",value:u},value:{status:"valid",value:t.data[u]}});else if(c==="strict")i.length>0&&(N(t,{code:T.unrecognized_keys,keys:i}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let h=t.data[u];d.push({key:{status:"valid",value:u},value:c._parse(new ft(t,h,t.path,u)),alwaysSet:u in t.data})}}return t.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of d){let h=await u.key,v=await u.value;c.push({key:h,value:v,alwaysSet:u.alwaysSet})}return c}).then(c=>ze.mergeObjectSync(n,c)):ze.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return B.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let t=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:B.errToObj(e).message??t}:{message:t}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let n of le.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let n of le.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new a({...this._def,shape:()=>r})}deepPartial(){return ua(this)}partial(e){let r={};for(let n of le.objectKeys(this.shape)){let t=this.shape[n];e&&!e[n]?r[n]=t:r[n]=t.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let n of le.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof pt;)s=s._def.innerType;r[n]=s}return new a({...this._def,shape:()=>r})}keyof(){return zl(le.objectKeys(this.shape))}};Xe.create=(a,e)=>new Xe({shape:()=>a,unknownKeys:"strip",catchall:_t.create(),typeName:X.ZodObject,...ae(e)});Xe.strictCreate=(a,e)=>new Xe({shape:()=>a,unknownKeys:"strict",catchall:_t.create(),typeName:X.ZodObject,...ae(e)});Xe.lazycreate=(a,e)=>new Xe({shape:a,unknownKeys:"strip",catchall:_t.create(),typeName:X.ZodObject,...ae(e)});var Dr=class extends se{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function t(s){for(let i of s)if(i.result.status==="valid")return i.result;for(let i of s)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(i=>new Ye(i.ctx.common.issues));return N(r,{code:T.invalid_union,unionErrors:o}),G}if(r.common.async)return Promise.all(n.map(async s=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(t);{let s,o=[];for(let d of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=d._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map(d=>new Ye(d));return N(r,{code:T.invalid_union,unionErrors:i}),G}}get options(){return this._def.options}};Dr.create=(a,e)=>new Dr({options:a,typeName:X.ZodUnion,...ae(e)});var Ut=a=>a instanceof Nr?Ut(a.schema):a instanceof ht?Ut(a.innerType()):a instanceof Mr?[a.value]:a instanceof zr?a.options:a instanceof Fr?le.objectValues(a.enum):a instanceof Ur?Ut(a._def.innerType):a instanceof jr?[void 0]:a instanceof $r?[null]:a instanceof pt?[void 0,...Ut(a.unwrap())]:a instanceof Ot?[null,...Ut(a.unwrap())]:a instanceof Da||a instanceof Vr?Ut(a.unwrap()):a instanceof qr?Ut(a._def.innerType):[],Un=class a extends se{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return N(r,{code:T.invalid_type,expected:z.object,received:r.parsedType}),G;let n=this.discriminator,t=r.data[n],s=this.optionsMap.get(t);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(N(r,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let t=new Map;for(let s of r){let o=Ut(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(t.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);t.set(i,s)}}return new a({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:t,...ae(n)})}};function Vs(a,e){let r=Rt(a),n=Rt(e);if(a===e)return{valid:!0,data:a};if(r===z.object&&n===z.object){let t=le.objectKeys(e),s=le.objectKeys(a).filter(i=>t.indexOf(i)!==-1),o={...a,...e};for(let i of s){let d=Vs(a[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(r===z.array&&n===z.array){if(a.length!==e.length)return{valid:!1};let t=[];for(let s=0;s<a.length;s++){let o=a[s],i=e[s],d=Vs(o,i);if(!d.valid)return{valid:!1};t.push(d.data)}return{valid:!0,data:t}}else return r===z.date&&n===z.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Lr=class extends se{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),t=(s,o)=>{if(zn(s)||zn(o))return G;let i=Vs(s.value,o.value);return i.valid?((Fn(s)||Fn(o))&&r.dirty(),{status:r.value,value:i.data}):(N(n,{code:T.invalid_intersection_types}),G)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>t(s,o)):t(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Lr.create=(a,e,r)=>new Lr({left:a,right:e,typeName:X.ZodIntersection,...ae(r)});var Tt=class a extends se{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return N(n,{code:T.invalid_type,expected:z.array,received:n.parsedType}),G;if(n.data.length<this._def.items.length)return N(n,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G;!this._def.rest&&n.data.length>this._def.items.length&&(N(n,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((o,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new ft(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>ze.mergeArray(r,o)):ze.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};Tt.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Tt({items:a,typeName:X.ZodTuple,rest:null,...ae(e)})};var qn=class a extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.object)return N(n,{code:T.invalid_type,expected:z.object,received:n.parsedType}),G;let t=[],s=this._def.keyType,o=this._def.valueType;for(let i in n.data)t.push({key:s._parse(new ft(n,i,n.path,i)),value:o._parse(new ft(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?ze.mergeObjectAsync(r,t):ze.mergeObjectSync(r,t)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof se?new a({keyType:e,valueType:r,typeName:X.ZodRecord,...ae(n)}):new a({keyType:er.create(),valueType:e,typeName:X.ZodRecord,...ae(r)})}},ha=class extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.map)return N(n,{code:T.invalid_type,expected:z.map,received:n.parsedType}),G;let t=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([i,d],c)=>({key:t._parse(new ft(n,i,n.path,[c,"key"])),value:s._parse(new ft(n,d,n.path,[c,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of o){let c=await d.key,u=await d.value;if(c.status==="aborted"||u.status==="aborted")return G;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),i.set(c.value,u.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let d of o){let c=d.key,u=d.value;if(c.status==="aborted"||u.status==="aborted")return G;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),i.set(c.value,u.value)}return{status:r.value,value:i}}}};ha.create=(a,e,r)=>new ha({valueType:e,keyType:a,typeName:X.ZodMap,...ae(r)});var ma=class a extends se{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return N(n,{code:T.invalid_type,expected:z.set,received:n.parsedType}),G;let t=this._def;t.minSize!==null&&n.data.size<t.minSize.value&&(N(n,{code:T.too_small,minimum:t.minSize.value,type:"set",inclusive:!0,exact:!1,message:t.minSize.message}),r.dirty()),t.maxSize!==null&&n.data.size>t.maxSize.value&&(N(n,{code:T.too_big,maximum:t.maxSize.value,type:"set",inclusive:!0,exact:!1,message:t.maxSize.message}),r.dirty());let s=this._def.valueType;function o(d){let c=new Set;for(let u of d){if(u.status==="aborted")return G;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let i=[...n.data.values()].map((d,c)=>s._parse(new ft(n,d,n.path,c)));return n.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,r){return new a({...this._def,minSize:{value:e,message:B.toString(r)}})}max(e,r){return new a({...this._def,maxSize:{value:e,message:B.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ma.create=(a,e)=>new ma({valueType:a,minSize:null,maxSize:null,typeName:X.ZodSet,...ae(e)});var Vn=class a extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.function)return N(r,{code:T.invalid_type,expected:z.function,received:r.parsedType}),G;function n(i,d){return $a({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,la(),Ft].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:d}})}function t(i,d){return $a({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,la(),Ft].filter(c=>!!c),issueData:{code:T.invalid_return_type,returnTypeError:d}})}let s={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof rr){let i=this;return Ve(async function(...d){let c=new Ye([]),u=await i._def.args.parseAsync(d,s).catch(p=>{throw c.addIssue(n(d,p)),c}),h=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(h,s).catch(p=>{throw c.addIssue(t(h,p)),c})})}else{let i=this;return Ve(function(...d){let c=i._def.args.safeParse(d,s);if(!c.success)throw new Ye([n(d,c.error)]);let u=Reflect.apply(o,this,c.data),h=i._def.returns.safeParse(u,s);if(!h.success)throw new Ye([t(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:Tt.create(e).rest(qt.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new a({args:e||Tt.create([]).rest(qt.create()),returns:r||qt.create(),typeName:X.ZodFunction,...ae(n)})}},Nr=class extends se{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Nr.create=(a,e)=>new Nr({getter:a,typeName:X.ZodLazy,...ae(e)});var Mr=class extends se{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return N(r,{received:r.data,code:T.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:e.data}}get value(){return this._def.value}};Mr.create=(a,e)=>new Mr({value:a,typeName:X.ZodLiteral,...ae(e)});function zl(a,e){return new zr({values:a,typeName:X.ZodEnum,...ae(e)})}var zr=class a extends se{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return N(r,{expected:le.joinValues(n),received:r.parsedType,code:T.invalid_type}),G}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return N(r,{received:r.data,code:T.invalid_enum_value,options:n}),G}return Ve(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};zr.create=zl;var Fr=class extends se{_parse(e){let r=le.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let t=le.objectValues(r);return N(n,{expected:le.joinValues(t),received:n.parsedType,code:T.invalid_type}),G}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let t=le.objectValues(r);return N(n,{received:n.data,code:T.invalid_enum_value,options:t}),G}return Ve(e.data)}get enum(){return this._def.values}};Fr.create=(a,e)=>new Fr({values:a,typeName:X.ZodNativeEnum,...ae(e)});var rr=class extends se{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.promise&&r.common.async===!1)return N(r,{code:T.invalid_type,expected:z.promise,received:r.parsedType}),G;let n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return Ve(n.then(t=>this._def.type.parseAsync(t,{path:r.path,errorMap:r.common.contextualErrorMap})))}};rr.create=(a,e)=>new rr({type:a,typeName:X.ZodPromise,...ae(e)});var ht=class extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),t=this._def.effect||null,s={addIssue:o=>{N(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),t.type==="preprocess"){let o=t.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async i=>{if(r.value==="aborted")return G;let d=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return d.status==="aborted"?G:d.status==="dirty"?Tr(d.value):r.value==="dirty"?Tr(d.value):d});{if(r.value==="aborted")return G;let i=this._def.schema._parseSync({data:o,path:n.path,parent:n});return i.status==="aborted"?G:i.status==="dirty"?Tr(i.value):r.value==="dirty"?Tr(i.value):i}}if(t.type==="refinement"){let o=i=>{let d=t.refinement(i,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?G:(i.status==="dirty"&&r.dirty(),o(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?G:(i.status==="dirty"&&r.dirty(),o(i.value).then(()=>({status:r.value,value:i.value}))))}if(t.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Xt(o))return G;let i=t.transform(o.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Xt(o)?Promise.resolve(t.transform(o.value,s)).then(i=>({status:r.value,value:i})):G);le.assertNever(t)}};ht.create=(a,e,r)=>new ht({schema:a,typeName:X.ZodEffects,effect:e,...ae(r)});ht.createWithPreprocess=(a,e,r)=>new ht({schema:e,effect:{type:"preprocess",transform:a},typeName:X.ZodEffects,...ae(r)});var pt=class extends se{_parse(e){return this._getType(e)===z.undefined?Ve(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pt.create=(a,e)=>new pt({innerType:a,typeName:X.ZodOptional,...ae(e)});var Ot=class extends se{_parse(e){return this._getType(e)===z.null?Ve(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ot.create=(a,e)=>new Ot({innerType:a,typeName:X.ZodNullable,...ae(e)});var Ur=class extends se{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ur.create=(a,e)=>new Ur({innerType:a,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ae(e)});var qr=class extends se{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},t=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return da(t)?t.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})})):{status:"valid",value:t.status==="valid"?t.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};qr.create=(a,e)=>new qr({innerType:a,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ae(e)});var ga=class extends se{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return N(n,{code:T.invalid_type,expected:z.nan,received:n.parsedType}),G}return{status:"valid",value:e.data}}};ga.create=a=>new ga({typeName:X.ZodNaN,...ae(a)});var am=Symbol("zod_brand"),Da=class extends se{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},La=class a extends se{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?G:s.status==="dirty"?(r.dirty(),Tr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let t=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return t.status==="aborted"?G:t.status==="dirty"?(r.dirty(),{status:"dirty",value:t.value}):this._def.out._parseSync({data:t.value,path:n.path,parent:n})}}static create(e,r){return new a({in:e,out:r,typeName:X.ZodPipeline})}},Vr=class extends se{_parse(e){let r=this._def.innerType._parse(e),n=t=>(Xt(t)&&(t.value=Object.freeze(t.value)),t);return da(r)?r.then(t=>n(t)):n(r)}unwrap(){return this._def.innerType}};Vr.create=(a,e)=>new Vr({innerType:a,typeName:X.ZodReadonly,...ae(e)});function Dl(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function Fl(a,e={},r){return a?tr.create().superRefine((n,t)=>{let s=a(n);if(s instanceof Promise)return s.then(o=>{if(!o){let i=Dl(e,n),d=i.fatal??r??!0;t.addIssue({code:"custom",...i,fatal:d})}});if(!s){let o=Dl(e,n),i=o.fatal??r??!0;t.addIssue({code:"custom",...o,fatal:i})}}):tr.create()}var nm={object:Xe.lazycreate},X;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(X||(X={}));var sm=(a,e={message:`Input not instance of ${a.name}`})=>Fl(r=>r instanceof a,e),Ul=er.create,ql=Or.create,om=ga.create,im=Cr.create,Vl=Ar.create,cm=Ir.create,lm=pa.create,dm=jr.create,um=$r.create,pm=tr.create,fm=qt.create,hm=_t.create,mm=fa.create,gm=Vt.create,vm=Xe.create,ym=Xe.strictCreate,_m=Dr.create,bm=Un.create,xm=Lr.create,wm=Tt.create,km=qn.create,Sm=ha.create,Pm=ma.create,Em=Vn.create,Rm=Nr.create,Tm=Mr.create,Om=zr.create,Cm=Fr.create,Am=rr.create,Im=ht.create,jm=pt.create,$m=Ot.create,Dm=ht.createWithPreprocess,Lm=La.create,Nm=()=>Ul().optional(),Mm=()=>ql().optional(),zm=()=>Vl().optional(),Fm={string:(a=>er.create({...a,coerce:!0})),number:(a=>Or.create({...a,coerce:!0})),boolean:(a=>Ar.create({...a,coerce:!0})),bigint:(a=>Cr.create({...a,coerce:!0})),date:(a=>Ir.create({...a,coerce:!0}))};var Um=G;import{existsSync as Bs,mkdirSync as _g,readFileSync as Ws,writeFileSync as bg}from"node:fs";import{homedir as xg}from"node:os";import{dirname as wg,join as kg}from"node:path";import{spawn as tg}from"node:child_process";import{randomBytes as rg}from"node:crypto";import{createServer as ag}from"node:http";import{appendFileSync as qm,openSync as Sx}from"node:fs";import{homedir as Vm}from"node:os";import{dirname as Jm,join as Zm}from"node:path";import{mkdirSync as Hm}from"node:fs";var Jr="<SENSITIVE_DATA>",Jl=new Set(["access_token","authorization","code","cookie","kandan_preview_ticket","refresh_token","token"]),Bm=new Set(["--access-token","--api-key","--authorization","--cookie","--oauth-code","--password","--refresh-token","--secret","--token"]);function Js(a,e,r={}){let n=r.logFile??Wm();try{Hm(Jm(n),{recursive:!0}),qm(n,`${JSON.stringify({ts:new Date().toISOString(),event:a,...r.sessionId===void 0?{}:{sessionId:r.sessionId},...Km(e)})}
10
+ `,"utf8")}catch{return}}function Wm(){let a=process.env.LINZUMI_CLI_AUDIT_LOG?.trim();return a===void 0||a===""?Zm(Vm(),".linzumi","logs","command-events.jsonl"):a}function Km(a){return Zl(a)}function Zs(a,e){return Ym(e)?Jr:typeof a=="string"?Hl(a):Array.isArray(a)?e==="args"?Qm(a):a.map(r=>Zs(r,void 0)):a!==null&&typeof a=="object"?Zl(a):a}function Zl(a){let e=typeof a.name=="string"?a.name.toLowerCase():void 0,r=e==="authorization"||e==="cookie"||e==="set-cookie";return Object.fromEntries(Object.entries(a).filter(([n])=>n!=="runner_console").map(([n,t])=>[n,r&&n==="value"?Jr:Zs(t,n)]))}function Qm(a){let e=!1;return a.map(r=>{if(typeof r!="string")return e=!1,Zs(r,void 0);if(e)return e=!1,Jr;let[n,t]=Gm(r);return Bm.has(n)?t===void 0?(e=!0,r):`${n}=${Jr}`:Hl(r)})}function Gm(a){let e=a.indexOf("=");return e===-1?[a,void 0]:[a.slice(0,e),a.slice(e+1)]}function Ym(a){return a===void 0?!1:/^(authorization|cookie|set-cookie|password)$/i.test(a)||/(^|[_-])(access[_-]?token|api[_-]?key|auth[_-]?token|oauth[_-]?code|refresh[_-]?token|secret|token)$/i.test(a)}function Hl(a){return Xm(a).replace(/\beyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,Jr)}function Xm(a){let e;try{e=new URL(a)}catch{return eg(a)}for(let r of[...e.searchParams.keys()])Jl.has(r.toLowerCase())&&e.searchParams.set(r,Jr);return e.toString()}function eg(a){let e=a.indexOf("?"),r=a.indexOf("#");if(e===-1||r!==-1&&r<e)return a;let n=a.slice(0,e),t=r===-1?a.slice(e+1):a.slice(e+1,r),s=r===-1?"":a.slice(r),o=new URLSearchParams(t),i=!1;for(let d of[...o.keys()])Jl.has(d.toLowerCase())&&(o.set(d,Jr),i=!0);switch(i){case!0:return`${n}?${o.toString()}${s}`;case!1:return a}}var ng=300*1e3,sg=1e4;function Wl(a,e=process.env){if(typeof a=="number"&&Number.isFinite(a)&&a>0)return a;let r=e.LINZUMI_OAUTH_CALLBACK_TIMEOUT_MS?.trim();if(r!==void 0&&r!==""){let n=Number.parseInt(r,10);if(Number.isFinite(n)&&n>0)return n}return ng}async function Kl(a){let e=Ct(a.kandanUrl),r=rg(18).toString("base64url"),n=await fg({host:og(a.kandanUrl,a.callbackHost),exchange:async s=>{if(s.state!==r)throw new Error("local runner OAuth state mismatch");return await lg({httpBaseUrl:e,code:s.code,redirectUri:s.redirectUri})}}),t=cg({httpBaseUrl:e,redirectUri:n.redirectUri,state:r,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,onboarding:a.onboarding,purpose:a.purpose});process.stderr.write(`Authorize the local Codex runner:
11
11
  ${t}
12
12
  `);try{return await(a.openAuthorizationUrl??yg)(t),await n.waitForToken(Wl(a.waitForTokenTimeoutMs))}finally{n.close()}}async function Ql(a){let e=Ct(a.kandanUrl),r=await dg({httpBaseUrl:e,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,onboarding:a.onboarding});return(a.writeStderr??(t=>process.stderr.write(t)))(`Authorize this computer:
13
13
  Code: ${r.userCode}
14
14
  Open: ${r.verificationUri}
15
- `),await ug({httpBaseUrl:e,deviceCode:r.deviceCode,expiresInSeconds:r.expiresInSeconds})}async function Gl(a){return await Ma(a)==="usable"}async function Ma(a){let e=new URL("/api/v2/local-codex-runner/oauth/validate",Ct(a.kandanUrl));a.workspaceSlug!==void 0&&e.searchParams.set("workspace",a.workspaceSlug),a.channelSlug!==void 0&&e.searchParams.set("channel",a.channelSlug);for(let n of a.requiredScopes??[])e.searchParams.append("required_scope",n);let r=await fetch(e,{method:"GET",headers:{authorization:`Bearer ${a.accessToken}`}});switch(r.status){case 200:{let n=await r.json();return typeof n=="object"&&n!==null&&"ok"in n&&n.ok===!0?"usable":"rejected"}case 401:case 403:return"rejected";case 404:return"not_found";default:throw new Error(`local runner auth validation failed with HTTP ${r.status}`)}}function Ct(a){let e=new URL(a);switch(e.protocol){case"ws:":e.protocol="http:";break;case"wss:":e.protocol="https:";break;case"http:":case"https:":break;default:throw new Error("--api-url must be ws://, wss://, http://, or https://")}return e.pathname="",e.search="",e.hash="",e.toString().replace(/\/$/,"")}function og(a,e){let r=e?.trim();if(r!==void 0&&r!=="")return r;let n=new URL(a).hostname.trim();return ig(n)&&n!=="localhost"?n:"127.0.0.1"}function ig(a){let e=a.split(".").map(t=>Number.parseInt(t,10));if(e.length!==4||e.some(t=>!Number.isInteger(t)||t<0||t>255))return a==="localhost";let[r,n]=e;return r===void 0||n===void 0?!1:r===10||r===127||r===172&&n>=16&&n<=31||r===192&&n===168||r===169&&n===254||r===100&&n>=64&&n<=127}function cg(a){let e=new URL("/api/v2/local-codex-runner/oauth/authorize",a.httpBaseUrl);return e.searchParams.set("redirect_uri",a.redirectUri),e.searchParams.set("state",a.state),a.workspaceSlug!==void 0&&e.searchParams.set("workspace",a.workspaceSlug),a.channelSlug!==void 0&&e.searchParams.set("channel",a.channelSlug),a.onboarding!==void 0&&e.searchParams.set("onboarding",a.onboarding),a.purpose!==void 0&&e.searchParams.set("purpose",a.purpose),e.toString()}async function lg(a){let e=await fetch(new URL("/api/v2/local-codex-runner/oauth/token",a.httpBaseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:a.code,redirect_uri:a.redirectUri})}),r=await e.json();if(!e.ok||typeof r!="object"||r===null){let s=typeof r=="object"&&r!==null&&"error"in r&&typeof r.error=="string"?r.error:void 0;throw s==="admin_role_required"?new Error("This token requires a Linzumi admin account. Approve the request while signed in as an admin."):new Error(s!==void 0?`local runner OAuth token exchange failed: ${s}`:"local runner OAuth token exchange failed")}let n="access_token"in r?r.access_token:void 0;if(typeof n!="string"||n.trim()==="")throw new Error("local runner OAuth token response did not include access_token");let t="expires_in"in r?r.expires_in:void 0;return{accessToken:n,expiresInSeconds:typeof t=="number"?t:void 0,workspaceSlug:Jn(r,"workspace"),channelSlug:Jn(r,"channel")}}async function dg(a){let e=await fetch(new URL("/api/v2/local-codex-runner/device/start",a.httpBaseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({workspace:a.workspaceSlug,channel:a.channelSlug,onboarding:a.onboarding})}),r=await e.json();if(!e.ok||typeof r!="object"||r===null)throw new Error("local runner device authorization failed to start");let n="device_code"in r?r.device_code:void 0,t="user_code"in r?r.user_code:void 0,s="verification_uri"in r?r.verification_uri:void 0,o="expires_in"in r?r.expires_in:void 0;if(typeof n!="string"||n.trim()===""||typeof t!="string"||t.trim()===""||typeof s!="string"||s.trim()==="")throw new Error("local runner device authorization response was incomplete");return{deviceCode:n,userCode:t,verificationUri:s,expiresInSeconds:typeof o=="number"?o:void 0}}async function ug(a){let e=typeof a.expiresInSeconds=="number"&&a.expiresInSeconds>=0?a.expiresInSeconds:600,r=Date.now()+e*1e3;for(;Date.now()<r;){let n=Math.max(0,Math.min(3e4,r-Date.now())),t=new AbortController,s=setTimeout(()=>t.abort(),n+sg),o,i;try{o=await fetch(new URL("/api/v2/local-codex-runner/device/token",a.httpBaseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({device_code:a.deviceCode,wait_ms:n}),signal:t.signal}),i=await o.json()}catch(u){if(t.signal.aborted)continue;throw u}finally{clearTimeout(s)}if(o.status===202&&Bl(i)==="authorization_pending")continue;if(!o.ok||typeof i!="object"||i===null)throw new Error(fg(Bl(i)));let d="access_token"in i?i.access_token:void 0;if(typeof d!="string"||d.trim()==="")throw new Error("local runner device authorization response did not include access_token");let c="expires_in"in i?i.expires_in:void 0;return{accessToken:d,expiresInSeconds:typeof c=="number"?c:void 0,workspaceSlug:Jn(i,"workspace"),channelSlug:Jn(i,"channel")}}throw new Error("local runner device authorization expired")}function Bl(a){if(!(typeof a!="object"||a===null||!("error"in a)))return typeof a.error=="string"?a.error:void 0}function fg(a){switch(a){case"access_denied":return"local runner device authorization was denied";case"device_session_expired":return"local runner device authorization expired";case"device_session_consumed":return"local runner device authorization was already used";case"invalid_device_code":return"local runner device authorization code was rejected";default:return"local runner device authorization failed"}}function Jn(a,e){let r=a[e];return typeof r=="string"&&r.trim()!==""?r:void 0}function pg(a){return new Promise((e,r)=>{let n,t,s=!1,o=new Promise((u,h)=>{n=u,t=h});o.catch(()=>{});let i=u=>s?!1:(s=!0,u(),!0),d=`http://${a.host}/callback`,c=ag((u,h)=>{(async()=>{try{let v=new URL(u.url??"/",`http://${a.host}`),f=v.searchParams.get("code"),y=v.searchParams.get("state"),b=v.searchParams.get("error");if(b!==null&&b.trim()!==""){i(()=>t?.(new Error(`local runner OAuth failed: ${b}`))),Na(h,{title:"Not authorized",body:"You denied the request. Close this tab and rerun the bootstrap command when you're ready.",status:403});return}if(f===null||y===null||f.trim()===""||y.trim()===""){Na(h,{title:"Authorization callback was incomplete",body:"We didn't receive the authorization code. Return to your terminal and try again.",status:400});return}let g;try{g=await a.exchange({code:f,state:y,redirectUri:d})}catch(E){i(()=>t?.(E)),Na(h,{title:"Authorization could not be completed",body:"We received the authorization but could not finish setup. Return to your terminal for details and rerun the bootstrap command.",status:400});return}let S=i(()=>n?.(g));Na(h,{title:S?"Computer authorized":"Already authorized",body:"This computer has been authorized for agentic use in Linzumi. Feel free to close this tab and let the terminal finish setup.",status:200})}catch(v){i(()=>t?.(v)),Na(h,{title:"Authorization callback failed",body:"Return to your terminal and rerun the bootstrap command.",status:500})}})()});c.once("error",r),c.listen(0,a.host,()=>{let u=c.address();if(!hg(u)){r(new Error("local runner OAuth callback server did not bind to a TCP port"));return}d=`http://${a.host}:${u.port}/callback`,e({redirectUri:d,waitForToken:h=>{let v=Wl(h),f=setTimeout(()=>{i(()=>t?.(new Error("Authorization timed out before the browser callback completed. Rerun the connect command and finish authorizing in the browser."))),c.close()},v);return f.unref?.(),o.finally(()=>{clearTimeout(f)}).catch(()=>{}),o},close:()=>{c.close()}})})})}function hg(a){return typeof a=="object"&&a!==null&&typeof a.port=="number"}function Na(a,e){a.writeHead(e.status,{"content-type":"text/html; charset=utf-8"}),a.end(gg(e))}var mg='<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path fill="currentColor" d="M206.7,82.37l2.55-6.45,2.01-3.63c.67-1.21,1.07-1.88,2.55-3.63,1.34-1.61,3.36-4.43,5.64-6.58,2.42-2.24,5.06-4.3,7.93-6.18,3.92-2.53,8.17-4.52,12.63-5.91,1.79-.63,4.03-1.16,6.72-1.61,6.1-.88,12.29-.92,18.4-.13,2.69.45,5.06,1.03,7.12,1.75,2.15.67,3.49,1.07,5.64,2.15,4.55,2.16,8.87,4.77,12.9,7.79,1.61,1.34,2.42,2.15,4.16,4.16l5.91,7.66c1.34,2.01,1.34,2.28,2.15,4.03l2.55,6.58c.67,1.34-.13,1.34,1.07.94,1.21-.27,4.3-2.01,6.45-2.82,4.7-1.83,9.62-3,14.64-3.49,2.42-.27,3.76-.54,7.12-.27s9.27,1.21,12.76,2.15c3.63.94,6.58,2.55,8.73,3.49,2.15,1.07,2.55,1.48,4.16,2.55,3.49,2.51,6.77,5.29,9.81,8.33,1.52,1.7,3.04,3.58,4.57,5.64,2.74,4.49,4.86,9.32,6.31,14.37.67,2.28,1.07,3.49,1.34,6.72.27,3.22,0,10.48.4,12.76.27,2.28.27.67,1.61.94,1.48.27,4.3,0,6.72.4,2.42.27,4.97.85,7.66,1.75,6.76,2.32,13.01,5.92,18.4,10.61,2.28,1.75,2.96,2.69,4.3,4.3,3.51,3.93,6.32,8.43,8.33,13.3,1.07,2.15,1.21,2.28,1.88,5.1.54,2.96,1.61,8.19,1.61,12.36s-.81,9.67-1.34,12.76c-.67,3.22-1.07,4.03-2.15,6.18-2.16,4.54-4.81,8.82-7.93,12.76-1.25,1.61-2.6,3-4.03,4.16-1.48,1.34-2.69,2.42-4.7,3.76-3.79,2.34-7.74,4.4-11.82,6.18l-6.58,2.15c-2.06.45-4.12.72-6.18.81l-7.25.13c-2.28,0-2.82.27-6.58-.4-3.76-.81-11.69-2.82-15.99-4.3-4.16-1.34-6.31-2.69-9.67-4.43-3.49-1.75-10.48-6.18-12.9-7.39-8.26-4.54-16.78-8.58-25.52-12.09-4.3-1.75-9.27-3.22-11.82-4.03-2.55-.81-5.24-1.61-7.66-2.15-8.39-2.25-16.99-3.6-25.66-4.03-3.9-.27-4.84-.27-8.19-.13-3.67-.09-7.79.04-12.36.4-7.9.79-15.75,2.04-23.51,3.76-8.37,2.26-16.62,4.95-24.72,8.06-3.22,1.34-2.82.81-9.13,4.16-6.31,3.36-22.03,12.22-28.75,15.58-6.72,3.36-8.73,3.49-11.82,4.43-3.09,1.07-4.3,1.21-6.58,1.61-7.3,1.09-14.71,1.18-22.03.27-2.55-.54-5.78-1.61-7.79-2.28-2.01-.54-2.15-.67-4.03-1.75-2.02-1.07-5.64-3.22-7.79-4.7-3.24-2.15-6.14-4.77-8.6-7.79-1.34-1.52-2.69-3.36-4.03-5.51-1.52-2.51-2.96-5.24-4.3-8.19-2.03-5.46-3.03-11.24-2.96-17.06,0-2.96.13-6.72.67-9.67.54-2.87,1.34-5.6,2.42-8.19,4.24-10.52,12.04-19.22,22.03-24.58,5.19-2.98,10.88-4.98,16.79-5.91,2.55-.4,5.37-.13,6.72-.4,1.34-.27,1.34,1.34,1.61-.94.4-2.28,0-9.4.4-12.76.27-3.36.81-4.97,1.48-7.25,1.87-6.19,4.88-11.97,8.87-17.06,3.47-3.98,7.39-7.54,11.69-10.61,4.43-2.61,9.11-4.77,13.97-6.45,2.55-.67,6.99-1.34,9.13-1.75,2.15-.27,1.88-.13,3.63-.13,1.79-.09,4.03,0,6.72.27,2.69.18,5.73.72,9.13,1.61,3.49,1.07,9.27,4.03,11.28,4.7s.4.27,1.07-.94ZM512.27,255.7c0,141.39-114.62,256-256,256S.27,397.09.27,255.7,114.89-.3,256.27-.3s256,114.62,256,256ZM449.33,352.66c14.67-29.16,22.94-62.09,22.94-96.95,0-119.29-96.71-216-216-216S40.27,136.41,40.27,255.7c0,41.89,11.94,80.98,32.57,114.09,1.7,1.79,2.94.65,3.05-.57.27-1.61,2.75-20.85,4.43-27.27,1.87-7.6,4.52-14.98,7.93-22.03,1.75-3.49,3.76-7.93,6.18-11.82,8.77-13.95,19.75-26.38,32.51-36.81,7.24-5.32,14.87-10.08,22.84-14.24,9.74-4.78,20.09-8.22,30.76-10.21,4.03-.99,7.61-1.66,10.75-2.02,3.36-.54,5.78-.54,9.27-.94,3.49-.54,9.32-1.16,11.82-2.01,6.65-2.27,5.64-6.72,3.09-7.52-2.55-.81-9.67-1.88-13.84-2.96-4.16-1.21-8.73-2.82-11.28-3.76-2.55-.94-2.28-.94-3.9-2.02l-5.91-4.03c-.94-.94-1.34-.94.54-2.02l10.21-5.51c2.01-1.07,1.75-.67,3.09-.13,1.34.67,4.3,2.42,6.72,3.36,7.2,2.69,14.96,3.52,22.57,2.42,1.34-.27,1.34-.54,1.61-1.21.27-.67.81-.94-.13-2.69-.94-1.88-4.43-6.58-5.64-8.46l-1.21-2.28c-.27-.45-1.07-1.07,1.21-1.75,2.42-.54,10.48-2.58,12.9-2.82.86-.09.67,0,1.75,1.07,1.07,1.07,3.09,3.63,4.84,5.24,1.88,1.61,4.43,3.22,6.18,4.3,2.8,1.71,5.99,2.68,9.27,2.82,1.88,0,4.97-.13,7.12-.67,2.15-.4,3.63-.94,5.64-2.02,2.01-1.07,4.7-2.69,6.72-4.43,2.01-1.75,3.49-5.1,5.64-6.04,2.15-.81,4.97.54,7.12.94,2.28.4,4.97,1.21,6.18,1.61,1.21.4,2.01.4.67,2.28l-8.06,10.34c-1.34,1.88.13,5.51,1.21,5.64l5.64.27c2.28-.13,4.43.13,7.66-.67,3.36-.81,9.27-2.96,11.82-3.9,2.69-.94,3.22-1.34,4.16-2.01.81-.54,1.39-1.03,1.75-1.48.45-.27.67-1.07,2.82,0s9.4,4.97,11.28,6.18c2.01,1.21,1.07.94,0,1.75l-5.51,3.9c-1.48.94-1.07.94-3.22,1.88-2.15,1.07-6.58,2.96-9.67,4.03s-4.03,1.75-8.73,2.69c-4.7.81-14.51,1.75-19.48,2.55-4.97.81-7.93,1.34-10.34,2.01-2.28.67-2.15.94-3.49,1.88-1.48,1.07-2.69,1.61-4.97,3.9-2.28,2.28-5.91,6.85-8.73,9.81-2.82,2.96-6.45,6.04-8.33,7.79-2.02,1.61-1.61,1.34-3.36,2.42l-6.99,4.03-4.03,2.02-6.72,2.15c-2.42.67-3.9,1.21-7.66,2.01l-14.91,2.82c-3.63.81-4.3,1.07-7.12,2.01-2.96,1.07-6.22,2.46-9.81,4.16-3.22,1.43-6.81,3.45-10.75,6.04-13.6,9.14-24.61,21.63-31.97,36.27-2.01,3.76-2.96,6.58-3.9,9.27-1.07,2.69-1.61,4.03-2.28,6.58-.67,2.69-1.48,5.24-2.15,9.27-.54,4.16-1.48,11.15-1.75,15.45-.27,4.16-.27,6.04,0,10.21l1.88,14.91c.67,3.76,1.48,5.91,2.15,8.19l1.88,5.64c.99,2.6,2.42,5.78,4.3,9.54,2.15,3.76,5.37,9.13,8.06,13.03,10.08,14.51,23.81,26.36,40.17,33.05,22.55,9.22,43.32,10.46,61.89,10.46,3.25,0,6.49-.09,9.71-.23,3.07-.42,2.74-6.09,10.48-9.42,5.26-2.26,13.7-2.42,14.91-2.55,1.07-.13-5.24-4.57-7.79-6.45-2.55-1.88-4.97-4.3-6.72-5.91-1.75-1.75-2.42-2.28-3.9-4.16-1.61-1.88-3.9-5.51-5.24-7.12-1.34-1.61-1.48-2.28-2.55-2.55-.98-.27-2.37-.09-4.16.54-1.88.4-5.37,1.21-7.12,1.88-1.75.67-2.02.81-3.09,2.01-1.07,1.07-2.69,3.76-3.63,4.7-.81.94-.67.67-1.48.94-.81.27-2.42.67-3.63.54-1.34-.18-2.55-.58-3.63-1.21-.81-.81-1.48-2.42-1.88-3.22-.4-.94-.54-1.21-.54-2.15l.4-3.49c.18-1.52.72-3.27,1.61-5.24.94-1.75,1.88-3.49,4.16-5.64,2.15-2.02,7.52-5.51,9.13-6.85,1.61-1.34,1.21-2.15.54-3.63-2.69-5.16-6.33-9.77-10.75-13.57-2.42-1.88-5.51-3.22-7.79-4.3-2.15-1.21-2.01-1.21-5.78-2.42-3.76-1.07-13.16-3.63-16.79-4.84-3.63-1.07-2.82-.94-5.1-2.01l-8.19-4.3c-1.75-.94-1.34-.54-2.69-1.61l-5.51-4.57c-2.18-1.93-3.77-4.45-4.57-7.25-.45-1.52-.45-2.87,0-4.03.4-1.34,0-1.21,2.01-3.63,2.15-2.42,7.25-7.93,10.21-10.75,3.09-2.82,4.97-4.03,7.79-6.04,5.43-3.82,11.09-7.32,16.93-10.48,2.42-1.21,5.37-2.02,7.12-2.69,1.61-.81,2.64-1.43,3.09-1.88.54-.4.67.54.4-.94-.4-1.48-1.88-4.97-2.28-7.66-.4-2.82-.4-6.18,0-8.73.36-2.42,1.03-4.66,2.01-6.72,1.16-2.24,2.46-4.3,3.9-6.18,1.34-1.7,2.91-3.04,4.7-4.03,1.75-1.07,4.3-2.01,6.18-2.42,1.61-.45,3.13-.58,4.57-.4l4.57.27c1.34.18,2.55.49,3.63.94,1.07.54,2.55,1.48,3.09,2.01.4.67.67.13-.27,1.61-1.07,1.48-4.16,4.57-5.78,7.12-1.61,2.69-2.96,5.6-4.03,8.73-.94,3.22-1.88,8.73-2.01,10.75-.27,2.15,4.7,1.75,5.1.54.54-1.07.27-2.55,1.07-5.1.81-2.42,2.42-7.25,3.9-9.81,1.34-2.55,2.82-3.76,4.57-5.51,1.79-1.88,3.67-3.45,5.64-4.7,1.88-1.21,3.22-1.75,5.64-2.28,2.42-.4,6.18-.67,8.73-.67,2.42,0,3.9.13,6.18.94,2.15.81,5.24,2.69,7.12,4.03,1.79,1.52,3.22,3.09,4.3,4.7,1.21,1.61,1.88,2.96,2.55,5.1.67,2.15,1.34,5.1,1.34,7.66,0,2.69-.54,6.04-1.21,8.19-.63,2.24-1.43,4.03-2.42,5.37-.67,1.34-.94,1.61-2.15,2.82-1.21,1.34-3.22,3.22-4.97,4.57-1.75,1.21-4.43,2.28-5.51,3.22-.94.81-.4,2.51.4,2.42.94.13,1.75.4,4.57-.13,2.82-.4,8.33-2.15,12.22-2.82,11.99-2.63,24.41-2.63,36.4,0,3.22.54,4.16,1.07,6.31,1.75l6.04,2.28c2.42,1.07,5.51,2.42,8.19,4.16,8.15,5.36,15.14,12.3,20.55,20.42,1.61,2.42,2.87,4.66,3.76,6.72,1.85,4.51,3.42,9.13,4.7,13.84.67,2.82,1.21,4.43,1.61,8.19.4,3.76.4,11.82.54,14.37.27,2.55-.13,2.28,1.75,1.34,1.75-.94,20.09-7.74,30.63-31.57,9.16-20.71,1.9-47.26-2.28-55.34-1.75-3.22-4.16-6.99-6.31-9.81-4.44-5.14-9.6-9.62-15.31-13.3-2.96-1.7-5.55-3.09-7.79-4.16-4.33-1.6-8.77-2.86-13.3-3.76l-6.18-.4h-14.37c-2.69-.27-3.1-3.18-.54-4.3,3.64-1.58,9.88-2.63,18.54-2.42,8.78.21,14.91,1.88,17.33,2.55,13.98,3.94,30.19,16.65,38.55,30.76,6.61,11.16,9.81,29.96,9.81,29.96.37,1.75,2.18,1.66,3.08.35ZM232.78,345.3c-3.91,0-7.08,3.17-7.08,7.08s3.17,7.08,7.08,7.08,7.08-3.17,7.08-7.08-3.17-7.08-7.08-7.08Z"/></svg>';function gg(a){let e=a.status>=200&&a.status<300,r=e?"badge badge--success":"badge badge--notice",n=e?'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="mark"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M5 12.5l4.2 4.2L19 7"/></svg>':'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="mark"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M12 7v6M12 17h.01"/></svg>';return`<!doctype html>
15
+ `),await ug({httpBaseUrl:e,deviceCode:r.deviceCode,expiresInSeconds:r.expiresInSeconds})}async function Gl(a){return await Ma(a)==="usable"}async function Ma(a){let e=new URL("/api/v2/local-codex-runner/oauth/validate",Ct(a.kandanUrl));a.workspaceSlug!==void 0&&e.searchParams.set("workspace",a.workspaceSlug),a.channelSlug!==void 0&&e.searchParams.set("channel",a.channelSlug);for(let n of a.requiredScopes??[])e.searchParams.append("required_scope",n);let r=await fetch(e,{method:"GET",headers:{authorization:`Bearer ${a.accessToken}`}});switch(r.status){case 200:{let n=await r.json();return typeof n=="object"&&n!==null&&"ok"in n&&n.ok===!0?"usable":"rejected"}case 401:case 403:return"rejected";case 404:return"not_found";default:throw new Error(`local runner auth validation failed with HTTP ${r.status}`)}}function Ct(a){let e=new URL(a);switch(e.protocol){case"ws:":e.protocol="http:";break;case"wss:":e.protocol="https:";break;case"http:":case"https:":break;default:throw new Error("--api-url must be ws://, wss://, http://, or https://")}return e.pathname="",e.search="",e.hash="",e.toString().replace(/\/$/,"")}function og(a,e){let r=e?.trim();if(r!==void 0&&r!=="")return r;let n=new URL(a).hostname.trim();return ig(n)&&n!=="localhost"?n:"127.0.0.1"}function ig(a){let e=a.split(".").map(t=>Number.parseInt(t,10));if(e.length!==4||e.some(t=>!Number.isInteger(t)||t<0||t>255))return a==="localhost";let[r,n]=e;return r===void 0||n===void 0?!1:r===10||r===127||r===172&&n>=16&&n<=31||r===192&&n===168||r===169&&n===254||r===100&&n>=64&&n<=127}function cg(a){let e=new URL("/api/v2/local-codex-runner/oauth/authorize",a.httpBaseUrl);return e.searchParams.set("redirect_uri",a.redirectUri),e.searchParams.set("state",a.state),a.workspaceSlug!==void 0&&e.searchParams.set("workspace",a.workspaceSlug),a.channelSlug!==void 0&&e.searchParams.set("channel",a.channelSlug),a.onboarding!==void 0&&e.searchParams.set("onboarding",a.onboarding),a.purpose!==void 0&&e.searchParams.set("purpose",a.purpose),e.toString()}async function lg(a){let e=await fetch(new URL("/api/v2/local-codex-runner/oauth/token",a.httpBaseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:a.code,redirect_uri:a.redirectUri})}),r=await e.json();if(!e.ok||typeof r!="object"||r===null){let s=typeof r=="object"&&r!==null&&"error"in r&&typeof r.error=="string"?r.error:void 0;throw s==="admin_role_required"?new Error("This token requires a Linzumi admin account. Approve the request while signed in as an admin."):new Error(s!==void 0?`local runner OAuth token exchange failed: ${s}`:"local runner OAuth token exchange failed")}let n="access_token"in r?r.access_token:void 0;if(typeof n!="string"||n.trim()==="")throw new Error("local runner OAuth token response did not include access_token");let t="expires_in"in r?r.expires_in:void 0;return{accessToken:n,expiresInSeconds:typeof t=="number"?t:void 0,workspaceSlug:Jn(r,"workspace"),channelSlug:Jn(r,"channel")}}async function dg(a){let e=await fetch(new URL("/api/v2/local-codex-runner/device/start",a.httpBaseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({workspace:a.workspaceSlug,channel:a.channelSlug,onboarding:a.onboarding})}),r=await e.json();if(!e.ok||typeof r!="object"||r===null)throw new Error("local runner device authorization failed to start");let n="device_code"in r?r.device_code:void 0,t="user_code"in r?r.user_code:void 0,s="verification_uri"in r?r.verification_uri:void 0,o="expires_in"in r?r.expires_in:void 0;if(typeof n!="string"||n.trim()===""||typeof t!="string"||t.trim()===""||typeof s!="string"||s.trim()==="")throw new Error("local runner device authorization response was incomplete");return{deviceCode:n,userCode:t,verificationUri:s,expiresInSeconds:typeof o=="number"?o:void 0}}async function ug(a){let e=typeof a.expiresInSeconds=="number"&&a.expiresInSeconds>=0?a.expiresInSeconds:600,r=Date.now()+e*1e3;for(;Date.now()<r;){let n=Math.max(0,Math.min(3e4,r-Date.now())),t=new AbortController,s=setTimeout(()=>t.abort(),n+sg),o,i;try{o=await fetch(new URL("/api/v2/local-codex-runner/device/token",a.httpBaseUrl),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({device_code:a.deviceCode,wait_ms:n}),signal:t.signal}),i=await o.json()}catch(u){if(t.signal.aborted)continue;throw u}finally{clearTimeout(s)}if(o.status===202&&Bl(i)==="authorization_pending")continue;if(!o.ok||typeof i!="object"||i===null)throw new Error(pg(Bl(i)));let d="access_token"in i?i.access_token:void 0;if(typeof d!="string"||d.trim()==="")throw new Error("local runner device authorization response did not include access_token");let c="expires_in"in i?i.expires_in:void 0;return{accessToken:d,expiresInSeconds:typeof c=="number"?c:void 0,workspaceSlug:Jn(i,"workspace"),channelSlug:Jn(i,"channel")}}throw new Error("local runner device authorization expired")}function Bl(a){if(!(typeof a!="object"||a===null||!("error"in a)))return typeof a.error=="string"?a.error:void 0}function pg(a){switch(a){case"access_denied":return"local runner device authorization was denied";case"device_session_expired":return"local runner device authorization expired";case"device_session_consumed":return"local runner device authorization was already used";case"invalid_device_code":return"local runner device authorization code was rejected";default:return"local runner device authorization failed"}}function Jn(a,e){let r=a[e];return typeof r=="string"&&r.trim()!==""?r:void 0}function fg(a){return new Promise((e,r)=>{let n,t,s=!1,o=new Promise((u,h)=>{n=u,t=h});o.catch(()=>{});let i=u=>s?!1:(s=!0,u(),!0),d=`http://${a.host}/callback`,c=ag((u,h)=>{(async()=>{try{let v=new URL(u.url??"/",`http://${a.host}`),p=v.searchParams.get("code"),y=v.searchParams.get("state"),b=v.searchParams.get("error");if(b!==null&&b.trim()!==""){i(()=>t?.(new Error(`local runner OAuth failed: ${b}`))),Na(h,{title:"Not authorized",body:"You denied the request. Close this tab and rerun the bootstrap command when you're ready.",status:403});return}if(p===null||y===null||p.trim()===""||y.trim()===""){Na(h,{title:"Authorization callback was incomplete",body:"We didn't receive the authorization code. Return to your terminal and try again.",status:400});return}let g;try{g=await a.exchange({code:p,state:y,redirectUri:d})}catch(E){i(()=>t?.(E)),Na(h,{title:"Authorization could not be completed",body:"We received the authorization but could not finish setup. Return to your terminal for details and rerun the bootstrap command.",status:400});return}let S=i(()=>n?.(g));Na(h,{title:S?"Computer authorized":"Already authorized",body:"This computer has been authorized for agentic use in Linzumi. Feel free to close this tab and let the terminal finish setup.",status:200})}catch(v){i(()=>t?.(v)),Na(h,{title:"Authorization callback failed",body:"Return to your terminal and rerun the bootstrap command.",status:500})}})()});c.once("error",r),c.listen(0,a.host,()=>{let u=c.address();if(!hg(u)){r(new Error("local runner OAuth callback server did not bind to a TCP port"));return}d=`http://${a.host}:${u.port}/callback`,e({redirectUri:d,waitForToken:h=>{let v=Wl(h),p=setTimeout(()=>{i(()=>t?.(new Error("Authorization timed out before the browser callback completed. Rerun the connect command and finish authorizing in the browser."))),c.close()},v);return p.unref?.(),o.finally(()=>{clearTimeout(p)}).catch(()=>{}),o},close:()=>{c.close()}})})})}function hg(a){return typeof a=="object"&&a!==null&&typeof a.port=="number"}function Na(a,e){a.writeHead(e.status,{"content-type":"text/html; charset=utf-8"}),a.end(gg(e))}var mg='<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path fill="currentColor" d="M206.7,82.37l2.55-6.45,2.01-3.63c.67-1.21,1.07-1.88,2.55-3.63,1.34-1.61,3.36-4.43,5.64-6.58,2.42-2.24,5.06-4.3,7.93-6.18,3.92-2.53,8.17-4.52,12.63-5.91,1.79-.63,4.03-1.16,6.72-1.61,6.1-.88,12.29-.92,18.4-.13,2.69.45,5.06,1.03,7.12,1.75,2.15.67,3.49,1.07,5.64,2.15,4.55,2.16,8.87,4.77,12.9,7.79,1.61,1.34,2.42,2.15,4.16,4.16l5.91,7.66c1.34,2.01,1.34,2.28,2.15,4.03l2.55,6.58c.67,1.34-.13,1.34,1.07.94,1.21-.27,4.3-2.01,6.45-2.82,4.7-1.83,9.62-3,14.64-3.49,2.42-.27,3.76-.54,7.12-.27s9.27,1.21,12.76,2.15c3.63.94,6.58,2.55,8.73,3.49,2.15,1.07,2.55,1.48,4.16,2.55,3.49,2.51,6.77,5.29,9.81,8.33,1.52,1.7,3.04,3.58,4.57,5.64,2.74,4.49,4.86,9.32,6.31,14.37.67,2.28,1.07,3.49,1.34,6.72.27,3.22,0,10.48.4,12.76.27,2.28.27.67,1.61.94,1.48.27,4.3,0,6.72.4,2.42.27,4.97.85,7.66,1.75,6.76,2.32,13.01,5.92,18.4,10.61,2.28,1.75,2.96,2.69,4.3,4.3,3.51,3.93,6.32,8.43,8.33,13.3,1.07,2.15,1.21,2.28,1.88,5.1.54,2.96,1.61,8.19,1.61,12.36s-.81,9.67-1.34,12.76c-.67,3.22-1.07,4.03-2.15,6.18-2.16,4.54-4.81,8.82-7.93,12.76-1.25,1.61-2.6,3-4.03,4.16-1.48,1.34-2.69,2.42-4.7,3.76-3.79,2.34-7.74,4.4-11.82,6.18l-6.58,2.15c-2.06.45-4.12.72-6.18.81l-7.25.13c-2.28,0-2.82.27-6.58-.4-3.76-.81-11.69-2.82-15.99-4.3-4.16-1.34-6.31-2.69-9.67-4.43-3.49-1.75-10.48-6.18-12.9-7.39-8.26-4.54-16.78-8.58-25.52-12.09-4.3-1.75-9.27-3.22-11.82-4.03-2.55-.81-5.24-1.61-7.66-2.15-8.39-2.25-16.99-3.6-25.66-4.03-3.9-.27-4.84-.27-8.19-.13-3.67-.09-7.79.04-12.36.4-7.9.79-15.75,2.04-23.51,3.76-8.37,2.26-16.62,4.95-24.72,8.06-3.22,1.34-2.82.81-9.13,4.16-6.31,3.36-22.03,12.22-28.75,15.58-6.72,3.36-8.73,3.49-11.82,4.43-3.09,1.07-4.3,1.21-6.58,1.61-7.3,1.09-14.71,1.18-22.03.27-2.55-.54-5.78-1.61-7.79-2.28-2.01-.54-2.15-.67-4.03-1.75-2.02-1.07-5.64-3.22-7.79-4.7-3.24-2.15-6.14-4.77-8.6-7.79-1.34-1.52-2.69-3.36-4.03-5.51-1.52-2.51-2.96-5.24-4.3-8.19-2.03-5.46-3.03-11.24-2.96-17.06,0-2.96.13-6.72.67-9.67.54-2.87,1.34-5.6,2.42-8.19,4.24-10.52,12.04-19.22,22.03-24.58,5.19-2.98,10.88-4.98,16.79-5.91,2.55-.4,5.37-.13,6.72-.4,1.34-.27,1.34,1.34,1.61-.94.4-2.28,0-9.4.4-12.76.27-3.36.81-4.97,1.48-7.25,1.87-6.19,4.88-11.97,8.87-17.06,3.47-3.98,7.39-7.54,11.69-10.61,4.43-2.61,9.11-4.77,13.97-6.45,2.55-.67,6.99-1.34,9.13-1.75,2.15-.27,1.88-.13,3.63-.13,1.79-.09,4.03,0,6.72.27,2.69.18,5.73.72,9.13,1.61,3.49,1.07,9.27,4.03,11.28,4.7s.4.27,1.07-.94ZM512.27,255.7c0,141.39-114.62,256-256,256S.27,397.09.27,255.7,114.89-.3,256.27-.3s256,114.62,256,256ZM449.33,352.66c14.67-29.16,22.94-62.09,22.94-96.95,0-119.29-96.71-216-216-216S40.27,136.41,40.27,255.7c0,41.89,11.94,80.98,32.57,114.09,1.7,1.79,2.94.65,3.05-.57.27-1.61,2.75-20.85,4.43-27.27,1.87-7.6,4.52-14.98,7.93-22.03,1.75-3.49,3.76-7.93,6.18-11.82,8.77-13.95,19.75-26.38,32.51-36.81,7.24-5.32,14.87-10.08,22.84-14.24,9.74-4.78,20.09-8.22,30.76-10.21,4.03-.99,7.61-1.66,10.75-2.02,3.36-.54,5.78-.54,9.27-.94,3.49-.54,9.32-1.16,11.82-2.01,6.65-2.27,5.64-6.72,3.09-7.52-2.55-.81-9.67-1.88-13.84-2.96-4.16-1.21-8.73-2.82-11.28-3.76-2.55-.94-2.28-.94-3.9-2.02l-5.91-4.03c-.94-.94-1.34-.94.54-2.02l10.21-5.51c2.01-1.07,1.75-.67,3.09-.13,1.34.67,4.3,2.42,6.72,3.36,7.2,2.69,14.96,3.52,22.57,2.42,1.34-.27,1.34-.54,1.61-1.21.27-.67.81-.94-.13-2.69-.94-1.88-4.43-6.58-5.64-8.46l-1.21-2.28c-.27-.45-1.07-1.07,1.21-1.75,2.42-.54,10.48-2.58,12.9-2.82.86-.09.67,0,1.75,1.07,1.07,1.07,3.09,3.63,4.84,5.24,1.88,1.61,4.43,3.22,6.18,4.3,2.8,1.71,5.99,2.68,9.27,2.82,1.88,0,4.97-.13,7.12-.67,2.15-.4,3.63-.94,5.64-2.02,2.01-1.07,4.7-2.69,6.72-4.43,2.01-1.75,3.49-5.1,5.64-6.04,2.15-.81,4.97.54,7.12.94,2.28.4,4.97,1.21,6.18,1.61,1.21.4,2.01.4.67,2.28l-8.06,10.34c-1.34,1.88.13,5.51,1.21,5.64l5.64.27c2.28-.13,4.43.13,7.66-.67,3.36-.81,9.27-2.96,11.82-3.9,2.69-.94,3.22-1.34,4.16-2.01.81-.54,1.39-1.03,1.75-1.48.45-.27.67-1.07,2.82,0s9.4,4.97,11.28,6.18c2.01,1.21,1.07.94,0,1.75l-5.51,3.9c-1.48.94-1.07.94-3.22,1.88-2.15,1.07-6.58,2.96-9.67,4.03s-4.03,1.75-8.73,2.69c-4.7.81-14.51,1.75-19.48,2.55-4.97.81-7.93,1.34-10.34,2.01-2.28.67-2.15.94-3.49,1.88-1.48,1.07-2.69,1.61-4.97,3.9-2.28,2.28-5.91,6.85-8.73,9.81-2.82,2.96-6.45,6.04-8.33,7.79-2.02,1.61-1.61,1.34-3.36,2.42l-6.99,4.03-4.03,2.02-6.72,2.15c-2.42.67-3.9,1.21-7.66,2.01l-14.91,2.82c-3.63.81-4.3,1.07-7.12,2.01-2.96,1.07-6.22,2.46-9.81,4.16-3.22,1.43-6.81,3.45-10.75,6.04-13.6,9.14-24.61,21.63-31.97,36.27-2.01,3.76-2.96,6.58-3.9,9.27-1.07,2.69-1.61,4.03-2.28,6.58-.67,2.69-1.48,5.24-2.15,9.27-.54,4.16-1.48,11.15-1.75,15.45-.27,4.16-.27,6.04,0,10.21l1.88,14.91c.67,3.76,1.48,5.91,2.15,8.19l1.88,5.64c.99,2.6,2.42,5.78,4.3,9.54,2.15,3.76,5.37,9.13,8.06,13.03,10.08,14.51,23.81,26.36,40.17,33.05,22.55,9.22,43.32,10.46,61.89,10.46,3.25,0,6.49-.09,9.71-.23,3.07-.42,2.74-6.09,10.48-9.42,5.26-2.26,13.7-2.42,14.91-2.55,1.07-.13-5.24-4.57-7.79-6.45-2.55-1.88-4.97-4.3-6.72-5.91-1.75-1.75-2.42-2.28-3.9-4.16-1.61-1.88-3.9-5.51-5.24-7.12-1.34-1.61-1.48-2.28-2.55-2.55-.98-.27-2.37-.09-4.16.54-1.88.4-5.37,1.21-7.12,1.88-1.75.67-2.02.81-3.09,2.01-1.07,1.07-2.69,3.76-3.63,4.7-.81.94-.67.67-1.48.94-.81.27-2.42.67-3.63.54-1.34-.18-2.55-.58-3.63-1.21-.81-.81-1.48-2.42-1.88-3.22-.4-.94-.54-1.21-.54-2.15l.4-3.49c.18-1.52.72-3.27,1.61-5.24.94-1.75,1.88-3.49,4.16-5.64,2.15-2.02,7.52-5.51,9.13-6.85,1.61-1.34,1.21-2.15.54-3.63-2.69-5.16-6.33-9.77-10.75-13.57-2.42-1.88-5.51-3.22-7.79-4.3-2.15-1.21-2.01-1.21-5.78-2.42-3.76-1.07-13.16-3.63-16.79-4.84-3.63-1.07-2.82-.94-5.1-2.01l-8.19-4.3c-1.75-.94-1.34-.54-2.69-1.61l-5.51-4.57c-2.18-1.93-3.77-4.45-4.57-7.25-.45-1.52-.45-2.87,0-4.03.4-1.34,0-1.21,2.01-3.63,2.15-2.42,7.25-7.93,10.21-10.75,3.09-2.82,4.97-4.03,7.79-6.04,5.43-3.82,11.09-7.32,16.93-10.48,2.42-1.21,5.37-2.02,7.12-2.69,1.61-.81,2.64-1.43,3.09-1.88.54-.4.67.54.4-.94-.4-1.48-1.88-4.97-2.28-7.66-.4-2.82-.4-6.18,0-8.73.36-2.42,1.03-4.66,2.01-6.72,1.16-2.24,2.46-4.3,3.9-6.18,1.34-1.7,2.91-3.04,4.7-4.03,1.75-1.07,4.3-2.01,6.18-2.42,1.61-.45,3.13-.58,4.57-.4l4.57.27c1.34.18,2.55.49,3.63.94,1.07.54,2.55,1.48,3.09,2.01.4.67.67.13-.27,1.61-1.07,1.48-4.16,4.57-5.78,7.12-1.61,2.69-2.96,5.6-4.03,8.73-.94,3.22-1.88,8.73-2.01,10.75-.27,2.15,4.7,1.75,5.1.54.54-1.07.27-2.55,1.07-5.1.81-2.42,2.42-7.25,3.9-9.81,1.34-2.55,2.82-3.76,4.57-5.51,1.79-1.88,3.67-3.45,5.64-4.7,1.88-1.21,3.22-1.75,5.64-2.28,2.42-.4,6.18-.67,8.73-.67,2.42,0,3.9.13,6.18.94,2.15.81,5.24,2.69,7.12,4.03,1.79,1.52,3.22,3.09,4.3,4.7,1.21,1.61,1.88,2.96,2.55,5.1.67,2.15,1.34,5.1,1.34,7.66,0,2.69-.54,6.04-1.21,8.19-.63,2.24-1.43,4.03-2.42,5.37-.67,1.34-.94,1.61-2.15,2.82-1.21,1.34-3.22,3.22-4.97,4.57-1.75,1.21-4.43,2.28-5.51,3.22-.94.81-.4,2.51.4,2.42.94.13,1.75.4,4.57-.13,2.82-.4,8.33-2.15,12.22-2.82,11.99-2.63,24.41-2.63,36.4,0,3.22.54,4.16,1.07,6.31,1.75l6.04,2.28c2.42,1.07,5.51,2.42,8.19,4.16,8.15,5.36,15.14,12.3,20.55,20.42,1.61,2.42,2.87,4.66,3.76,6.72,1.85,4.51,3.42,9.13,4.7,13.84.67,2.82,1.21,4.43,1.61,8.19.4,3.76.4,11.82.54,14.37.27,2.55-.13,2.28,1.75,1.34,1.75-.94,20.09-7.74,30.63-31.57,9.16-20.71,1.9-47.26-2.28-55.34-1.75-3.22-4.16-6.99-6.31-9.81-4.44-5.14-9.6-9.62-15.31-13.3-2.96-1.7-5.55-3.09-7.79-4.16-4.33-1.6-8.77-2.86-13.3-3.76l-6.18-.4h-14.37c-2.69-.27-3.1-3.18-.54-4.3,3.64-1.58,9.88-2.63,18.54-2.42,8.78.21,14.91,1.88,17.33,2.55,13.98,3.94,30.19,16.65,38.55,30.76,6.61,11.16,9.81,29.96,9.81,29.96.37,1.75,2.18,1.66,3.08.35ZM232.78,345.3c-3.91,0-7.08,3.17-7.08,7.08s3.17,7.08,7.08,7.08,7.08-3.17,7.08-7.08-3.17-7.08-7.08-7.08Z"/></svg>';function gg(a){let e=a.status>=200&&a.status<300,r=e?"badge badge--success":"badge badge--notice",n=e?'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="mark"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M5 12.5l4.2 4.2L19 7"/></svg>':'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="mark"><path fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" d="M12 7v6M12 17h.01"/></svg>';return`<!doctype html>
16
16
  <html lang="en">
17
17
  <head>
18
18
  <meta charset="utf-8" />
@@ -114,12 +114,12 @@ Open: ${r.verificationUri}
114
114
  </main>
115
115
  </body>
116
116
  </html>`}function Hs(a){return a.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function vg(a){return a.replace(/[&^|<>()%"]/g,e=>`^${e}`)}function yg(a){let e=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open",r=process.platform==="win32"?["/c","start","",vg(a)]:[a];return new Promise(n=>{Js("process.spawn",{command:e,args:r,purpose:"oauth.open_browser"});let t=tg(e,r,{stdio:"ignore",detached:!0});Js("process.spawned",{command:e,args:r,pid:t.pid,purpose:"oauth.open_browser"}),t.on("error",()=>n()),t.on("spawn",()=>{t.unref(),n()})})}function Yl(){return kg(xg(),".linzumi","auth.json")}function Zn(a,e=Yl()){if(!Bs(e))return;let r=Ks(Ws(e,"utf8")),n=Ct(a),t=r.local_codex_runner?.[n];if(!(t===void 0||t.access_token.trim()==="")&&!(t.expires_at!==void 0&&Date.parse(t.expires_at)<=Date.now()))return{accessToken:t.access_token,kandanBaseUrl:n,issuedAt:t.issued_at,expiresAt:t.expires_at}}function Xl(a){if(!Bs(a))throw new Error(`missing personal-agent delegation auth file: ${a}`);let r=Ks(Ws(a,"utf8")).personal_agent_delegation;if(r===void 0||r.access_token.trim()==="")throw new Error("personal-agent delegation auth file is missing access_token");if(r.expires_at!==void 0&&Date.parse(r.expires_at)<=Date.now())throw new Error("personal-agent delegation auth file token is expired");return{accessToken:r.access_token,issuedAt:r.issued_at,expiresAt:r.expires_at}}function ed(a){let e=a.authFilePath??Yl(),r=Bs(e)?Ks(Ws(e,"utf8")):{version:1},n=Ct(a.kandanUrl),t=new Date,s=a.expiresInSeconds===void 0?void 0:new Date(t.getTime()+a.expiresInSeconds*1e3).toISOString(),o={...r,version:1,local_codex_runner:{...r.local_codex_runner??{},[n]:{access_token:a.accessToken,issued_at:t.toISOString(),expires_at:s}}};return _g(wg(e),{recursive:!0}),bg(e,`${JSON.stringify(o,null,2)}
117
- `,"utf8"),{accessToken:a.accessToken,kandanBaseUrl:n,issuedAt:t.toISOString(),expiresAt:s}}function Ks(a){let e=JSON.parse(a);if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("Kandan auth cache must contain a JSON object");let r=e,n=r.local_codex_runner,t=r.personal_agent_delegation;if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))throw new Error("Kandan auth cache local_codex_runner must be an object");if(t!==void 0&&(typeof t!="object"||t===null||Array.isArray(t)))throw new Error("Kandan auth cache personal_agent_delegation must be an object");return{version:1,local_codex_runner:Pg(n),personal_agent_delegation:Sg(t)}}function Sg(a){if(typeof a!="object"||a===null||Array.isArray(a))return;let e=a.access_token,r=a.issued_at,n=a.expires_at;if(!(typeof e!="string"||typeof r!="string"))return{access_token:e,issued_at:r,expires_at:typeof n=="string"?n:void 0}}function Pg(a){if(!(typeof a!="object"||a===null||Array.isArray(a)))return Object.fromEntries(Object.entries(a).flatMap(([e,r])=>{if(typeof r!="object"||r===null||Array.isArray(r))return[];let n=r.access_token,t=r.issued_at,s=r.expires_at;return typeof n!="string"||typeof t!="string"?[]:[[e,{access_token:n,issued_at:t,expires_at:typeof s=="string"?s:void 0}]]}))}async function td(a,e={readCachedToken:Zn,validateToken:Ma,acquireAndCacheToken:Tg}){if(a.explicitToken!==void 0)return a.explicitToken;let r=e.readCachedToken(a.kandanUrl,a.authFilePath);if(r!==void 0){let t=await e.validateToken({kandanUrl:a.kandanUrl,accessToken:r.accessToken,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,requiredScopes:a.requiredScopes});if(t==="usable")return r.accessToken;a.reportRejectedCachedToken?.(t)}let n=await e.acquireAndCacheToken(a);return a.workspaceSlug!==void 0&&await Eg(a,e,n),n}async function Eg(a,e,r){let n;try{n=await e.validateToken({kandanUrl:a.kandanUrl,accessToken:r,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,requiredScopes:a.requiredScopes})}catch{return}if(n==="not_found")throw new Error(Rg(a))}function Rg(a){let e=new URL(Ct(a.kandanUrl)).host;return`Workspace '${a.workspaceSlug}' was not found on ${e}. Sign in to the web app to create it, then re-run connect.`}async function Tg(a){let e=a.authMode??{kind:"browser",callbackHost:a.callbackHost},r=e.kind==="device"?await Ql({kandanUrl:a.kandanUrl,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,onboarding:a.onboarding}):await Kl({kandanUrl:a.kandanUrl,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,onboarding:a.onboarding,callbackHost:e.callbackHost??a.callbackHost});return ed({kandanUrl:a.kandanUrl,accessToken:r.accessToken,expiresInSeconds:r.expiresInSeconds,authFilePath:a.authFilePath}),r.accessToken}import{readFile as Hx,realpath as Ys,stat as Og,writeFile as Bx,mkdir as Wx}from"node:fs/promises";import{homedir as Cg}from"node:os";import{basename as Ag,extname as jg,isAbsolute as ad,join as Gx,relative as nd,resolve as Gs}from"node:path";function ar(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function va(a){return a!==void 0&&ar(a)?a:void 0}function Qs(a){return Array.isArray(a)?a:void 0}function et(a){return typeof a=="string"&&a.trim()!==""?a.trim():void 0}function rd(a){return typeof a=="number"&&Number.isInteger(a)?a:void 0}var Ig=new Set([".csv",".diff",".gif",".htm",".html",".jpeg",".jpg",".json",".jsonl",".log",".md",".mp4",".patch",".pdf",".png",".svg",".txt",".webm",".webp",".xml",".zip"]);async function Xs(a,e){let r=await Ys(a),n=await Lg(r),t=await $g(r,e);Dg(n,t);let s=await Og(t);if(!s.isFile())throw new Error(`Linzumi upload path is not a file: ${t}`);return{path:t,fileName:Ag(t),contentType:Mg(t),sizeBytes:s.size}}async function $g(a,e){if(e==="")throw new Error("Kandan attachment path must not be empty");let r=ad(e)?Gs(e):Gs(a,e);return await Ys(r)}function Dg(a,e){let r=a.find(o=>Ng(o.path,e));if(r===void 0){let o=a.map(i=>i.label).join(", ");throw new Error(`Kandan attachment path must resolve inside an allowed upload root (${o}): ${e}`)}if(nd(r.path,e).split(/[\\/]+/).find(o=>o.startsWith("."))!==void 0)throw new Error(`Kandan attachment upload path must not include hidden path segments: ${e}`);let s=jg(e).toLowerCase();if(!Ig.has(s))throw new Error(`Kandan attachment upload path extension is not allowed: ${e}`)}async function Lg(a){let e=[{path:a,label:"runner cwd"}],r=process.env.HOME?.trim(),n=Gs(r===void 0||r===""?Cg():r,"Downloads");try{let t=await Ys(n);e.some(s=>s.path===t)||e.push({path:t,label:"~/Downloads"})}catch{return e}return e}function Ng(a,e){let r=nd(a,e);return r===""||!r.startsWith("..")&&!ad(r)}function Mg(a){let e=a.toLowerCase();return e.endsWith(".png")?"image/png":e.endsWith(".jpg")||e.endsWith(".jpeg")?"image/jpeg":e.endsWith(".gif")?"image/gif":e.endsWith(".webp")?"image/webp":e.endsWith(".csv")?"text/csv":e.endsWith(".json")?"application/json":e.endsWith(".md")||e.endsWith(".txt")||e.endsWith(".log")?"text/plain":"application/octet-stream"}function eo(a){let e=a.fetchImpl??fetch,r=Ct(a.kandanUrl),n=a.authMode==="personal-agent-delegation"?"/api/v2/personal-agent-mcp":"/api/v2/local-runner-mcp",t=a.operatingMode??"text",s=async(o,i,d,c={})=>{let u=new URL(i,r),h={...d,operating_mode:t},v={method:o,headers:{authorization:`Bearer ${a.accessToken}`},...c.signal===void 0?{}:{signal:c.signal}};if(o==="GET")for(let[S,E]of Object.entries(h))E!=null&&u.searchParams.set(S,String(E));else v.headers={...v.headers,"content-type":"application/json"},v.body=JSON.stringify(h);let f=await e(u,v),y=await f.json(),b=ar(y)?y:void 0;if(b===void 0)throw new Error(`Linzumi MCP API returned non-object JSON from ${i}`);if(f.ok&&b.ok===!0)return b;let g=typeof b.error=="string"?b.error:`HTTP ${f.status}`;throw new Error(`Linzumi MCP API ${i} failed: ${g}`)};return{validateAuth:()=>s("GET",`${n}/validate`,{}),issueOnboardingDiscoveryToken:o=>s("POST",`${n}/onboarding-discovery-token`,o),getMessage:o=>s("GET",`${n}/message`,o),getThread:o=>s("GET",`${n}/thread`,o),getChannel:o=>s("GET",`${n}/channel`,o),searchWorkspace:o=>s("GET",`${n}/search`,o),askWorkspace:o=>s("POST",`${n}/ask`,o),getCodingJobMetadata:o=>s("GET",`${n}/coding-job-metadata`,o),renameCodingJob:o=>s("POST",`${n}/coding-job-title`,o),upsertCodingJobPlan:(o,i)=>s("POST",`${n}/coding-job-plan`,o,i),replaceCodingJobPlanSteps:o=>s("POST",`${n}/coding-job-plan/steps`,o),updateCodingJobPlanStep:o=>s("POST",`${n}/coding-job-plan/step`,o),linkCodingJobPullRequest:o=>s("POST",`${n}/coding-job-primary-pr`,o),listVaultSecrets:o=>s("GET",`${n}/vault-secrets`,o),noteProjectDirectory:o=>s("POST",`${n}/discovered-project`,o),noteAgentConversation:o=>s("POST",`${n}/discovered-conversation`,o),noteOnboardingDiscoveryStatus:o=>s("POST",`${n}/discovery-status`,o),sendChannelMessage:o=>s("POST",`${n}/channel-message`,o),prepareMessageUploads:o=>s("POST",`${n}/message-uploads/prepare`,o),attachMessageFiles:o=>s("POST",`${n}/message-files/attach`,o),prepareCustomEmoji:o=>s("POST",`${n}/custom-emoji/prepare`,o),renameCustomEmoji:o=>s("POST",`${n}/custom-emoji/rename`,o),sendThreadReply:o=>s("POST",`${n}/thread-reply`,o),sendDm:o=>s("POST",`${n}/dm`,o),dmOwner:o=>s("POST",`${n}/dm-owner`,o),getVaultValues:o=>s("POST",`${n}/vault-values`,o)}}function sd(a){return{name:"linzumi",command:a.command??"linzumi",args:[...a.argsPrefix??[],"mcp","server","--api-url",a.kandanUrl,...a.authFilePath===void 0?[]:["--auth-file",a.authFilePath],...a.delegationAuthFilePath===void 0?[]:["--delegation-auth-file",a.delegationAuthFilePath],...a.ownerUsername===void 0?[]:["--owner-username",a.ownerUsername],...a.cwd===void 0?[]:["--cwd",a.cwd],...a.threadId===void 0?[]:["--thread-id",a.threadId],"--mode",a.operatingMode??"text",...a.toolScope===void 0||a.toolScope==="all"?[]:["--tool-scope",a.toolScope]],env:{...a.accessToken===void 0?{}:{LINZUMI_MCP_ACCESS_TOKEN:a.accessToken},ELECTRON_RUN_AS_NODE:"1"}}}function od(a){return`${JSON.stringify({mcpServers:{[a.name]:{command:a.command,args:a.args,env:a.env}}},null,2)}
117
+ `,"utf8"),{accessToken:a.accessToken,kandanBaseUrl:n,issuedAt:t.toISOString(),expiresAt:s}}function Ks(a){let e=JSON.parse(a);if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("Kandan auth cache must contain a JSON object");let r=e,n=r.local_codex_runner,t=r.personal_agent_delegation;if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))throw new Error("Kandan auth cache local_codex_runner must be an object");if(t!==void 0&&(typeof t!="object"||t===null||Array.isArray(t)))throw new Error("Kandan auth cache personal_agent_delegation must be an object");return{version:1,local_codex_runner:Pg(n),personal_agent_delegation:Sg(t)}}function Sg(a){if(typeof a!="object"||a===null||Array.isArray(a))return;let e=a.access_token,r=a.issued_at,n=a.expires_at;if(!(typeof e!="string"||typeof r!="string"))return{access_token:e,issued_at:r,expires_at:typeof n=="string"?n:void 0}}function Pg(a){if(!(typeof a!="object"||a===null||Array.isArray(a)))return Object.fromEntries(Object.entries(a).flatMap(([e,r])=>{if(typeof r!="object"||r===null||Array.isArray(r))return[];let n=r.access_token,t=r.issued_at,s=r.expires_at;return typeof n!="string"||typeof t!="string"?[]:[[e,{access_token:n,issued_at:t,expires_at:typeof s=="string"?s:void 0}]]}))}async function td(a,e={readCachedToken:Zn,validateToken:Ma,acquireAndCacheToken:Tg}){if(a.explicitToken!==void 0)return a.explicitToken;let r=e.readCachedToken(a.kandanUrl,a.authFilePath);if(r!==void 0){let t=await e.validateToken({kandanUrl:a.kandanUrl,accessToken:r.accessToken,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,requiredScopes:a.requiredScopes});if(t==="usable")return r.accessToken;a.reportRejectedCachedToken?.(t)}let n=await e.acquireAndCacheToken(a);return a.workspaceSlug!==void 0&&await Eg(a,e,n),n}async function Eg(a,e,r){let n;try{n=await e.validateToken({kandanUrl:a.kandanUrl,accessToken:r,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,requiredScopes:a.requiredScopes})}catch{return}if(n==="not_found")throw new Error(Rg(a))}function Rg(a){let e=new URL(Ct(a.kandanUrl)).host;return`Workspace '${a.workspaceSlug}' was not found on ${e}. Sign in to the web app to create it, then re-run connect.`}async function Tg(a){let e=a.authMode??{kind:"browser",callbackHost:a.callbackHost},r=e.kind==="device"?await Ql({kandanUrl:a.kandanUrl,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,onboarding:a.onboarding}):await Kl({kandanUrl:a.kandanUrl,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,onboarding:a.onboarding,callbackHost:e.callbackHost??a.callbackHost});return ed({kandanUrl:a.kandanUrl,accessToken:r.accessToken,expiresInSeconds:r.expiresInSeconds,authFilePath:a.authFilePath}),r.accessToken}import{readFile as Hx,realpath as Ys,stat as Og,writeFile as Bx,mkdir as Wx}from"node:fs/promises";import{homedir as Cg}from"node:os";import{basename as Ag,extname as Ig,isAbsolute as ad,join as Gx,relative as nd,resolve as Gs}from"node:path";function ar(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function va(a){return a!==void 0&&ar(a)?a:void 0}function Qs(a){return Array.isArray(a)?a:void 0}function et(a){return typeof a=="string"&&a.trim()!==""?a.trim():void 0}function rd(a){return typeof a=="number"&&Number.isInteger(a)?a:void 0}var jg=new Set([".csv",".diff",".gif",".htm",".html",".jpeg",".jpg",".json",".jsonl",".log",".md",".mp4",".patch",".pdf",".png",".svg",".txt",".webm",".webp",".xml",".zip"]);async function Xs(a,e){let r=await Ys(a),n=await Lg(r),t=await $g(r,e);Dg(n,t);let s=await Og(t);if(!s.isFile())throw new Error(`Linzumi upload path is not a file: ${t}`);return{path:t,fileName:Ag(t),contentType:Mg(t),sizeBytes:s.size}}async function $g(a,e){if(e==="")throw new Error("Kandan attachment path must not be empty");let r=ad(e)?Gs(e):Gs(a,e);return await Ys(r)}function Dg(a,e){let r=a.find(o=>Ng(o.path,e));if(r===void 0){let o=a.map(i=>i.label).join(", ");throw new Error(`Kandan attachment path must resolve inside an allowed upload root (${o}): ${e}`)}if(nd(r.path,e).split(/[\\/]+/).find(o=>o.startsWith("."))!==void 0)throw new Error(`Kandan attachment upload path must not include hidden path segments: ${e}`);let s=Ig(e).toLowerCase();if(!jg.has(s))throw new Error(`Kandan attachment upload path extension is not allowed: ${e}`)}async function Lg(a){let e=[{path:a,label:"runner cwd"}],r=process.env.HOME?.trim(),n=Gs(r===void 0||r===""?Cg():r,"Downloads");try{let t=await Ys(n);e.some(s=>s.path===t)||e.push({path:t,label:"~/Downloads"})}catch{return e}return e}function Ng(a,e){let r=nd(a,e);return r===""||!r.startsWith("..")&&!ad(r)}function Mg(a){let e=a.toLowerCase();return e.endsWith(".png")?"image/png":e.endsWith(".jpg")||e.endsWith(".jpeg")?"image/jpeg":e.endsWith(".gif")?"image/gif":e.endsWith(".webp")?"image/webp":e.endsWith(".csv")?"text/csv":e.endsWith(".json")?"application/json":e.endsWith(".md")||e.endsWith(".txt")||e.endsWith(".log")?"text/plain":"application/octet-stream"}function eo(a){let e=a.fetchImpl??fetch,r=Ct(a.kandanUrl),n=a.authMode==="personal-agent-delegation"?"/api/v2/personal-agent-mcp":"/api/v2/local-runner-mcp",t=a.operatingMode??"text",s=async(o,i,d,c={})=>{let u=new URL(i,r),h={...d,operating_mode:t},v={method:o,headers:{authorization:`Bearer ${a.accessToken}`},...c.signal===void 0?{}:{signal:c.signal}};if(o==="GET")for(let[S,E]of Object.entries(h))E!=null&&u.searchParams.set(S,String(E));else v.headers={...v.headers,"content-type":"application/json"},v.body=JSON.stringify(h);let p=await e(u,v),y=await p.json(),b=ar(y)?y:void 0;if(b===void 0)throw new Error(`Linzumi MCP API returned non-object JSON from ${i}`);if(p.ok&&b.ok===!0)return b;let g=typeof b.error=="string"?b.error:`HTTP ${p.status}`;throw new Error(`Linzumi MCP API ${i} failed: ${g}`)};return{validateAuth:()=>s("GET",`${n}/validate`,{}),issueOnboardingDiscoveryToken:o=>s("POST",`${n}/onboarding-discovery-token`,o),getMessage:o=>s("GET",`${n}/message`,o),getThread:o=>s("GET",`${n}/thread`,o),getChannel:o=>s("GET",`${n}/channel`,o),searchWorkspace:o=>s("GET",`${n}/search`,o),askWorkspace:o=>s("POST",`${n}/ask`,o),getCodingJobMetadata:o=>s("GET",`${n}/coding-job-metadata`,o),renameCodingJob:o=>s("POST",`${n}/coding-job-title`,o),upsertCodingJobPlan:(o,i)=>s("POST",`${n}/coding-job-plan`,o,i),replaceCodingJobPlanSteps:o=>s("POST",`${n}/coding-job-plan/steps`,o),updateCodingJobPlanStep:o=>s("POST",`${n}/coding-job-plan/step`,o),linkCodingJobPullRequest:o=>s("POST",`${n}/coding-job-primary-pr`,o),listVaultSecrets:o=>s("GET",`${n}/vault-secrets`,o),noteProjectDirectory:o=>s("POST",`${n}/discovered-project`,o),noteAgentConversation:o=>s("POST",`${n}/discovered-conversation`,o),noteOnboardingDiscoveryStatus:o=>s("POST",`${n}/discovery-status`,o),sendChannelMessage:o=>s("POST",`${n}/channel-message`,o),prepareMessageUploads:o=>s("POST",`${n}/message-uploads/prepare`,o),attachMessageFiles:o=>s("POST",`${n}/message-files/attach`,o),prepareCustomEmoji:o=>s("POST",`${n}/custom-emoji/prepare`,o),renameCustomEmoji:o=>s("POST",`${n}/custom-emoji/rename`,o),sendThreadReply:o=>s("POST",`${n}/thread-reply`,o),sendDm:o=>s("POST",`${n}/dm`,o),dmOwner:o=>s("POST",`${n}/dm-owner`,o),getVaultValues:o=>s("POST",`${n}/vault-values`,o)}}function sd(a){return{name:"linzumi",command:a.command??"linzumi",args:[...a.argsPrefix??[],"mcp","server","--api-url",a.kandanUrl,...a.authFilePath===void 0?[]:["--auth-file",a.authFilePath],...a.delegationAuthFilePath===void 0?[]:["--delegation-auth-file",a.delegationAuthFilePath],...a.ownerUsername===void 0?[]:["--owner-username",a.ownerUsername],...a.cwd===void 0?[]:["--cwd",a.cwd],...a.threadId===void 0?[]:["--thread-id",a.threadId],"--mode",a.operatingMode??"text",...a.toolScope===void 0||a.toolScope==="all"?[]:["--tool-scope",a.toolScope]],env:{...a.accessToken===void 0?{}:{LINZUMI_MCP_ACCESS_TOKEN:a.accessToken},ELECTRON_RUN_AS_NODE:"1"}}}function od(a){return`${JSON.stringify({mcpServers:{[a.name]:{command:a.command,args:a.args,env:a.env}}},null,2)}
118
118
  `}function id(a){return`[mcp_servers.${a.name}]
119
119
  command = ${JSON.stringify(a.command)}
120
120
  args = ${zg(a.args)}
121
121
  ${Object.keys(a.env).length===0?"":`env = ${Fg(a.env)}
122
- `}`}function zg(a){return`[${a.map(e=>JSON.stringify(e)).join(", ")}]`}function Fg(a){return`{ ${Object.entries(a).map(([r,n])=>`${r} = ${JSON.stringify(n)}`).join(", ")} }`}var cd=64;function Ug(a){switch(a){case"all":return!0;case"onboarding-discovery":return!1}}function qg(a){switch(a){case"voice":return!0;case"text":return!1}}function Vg(a){return a.trim().replace(/^:+/,"").replace(/:+$/,"").toLowerCase()}var ld=x.string().min(1).refine(a=>Vg(a).length<=cd,{message:`Custom emoji shortcode name must be at most ${cd} characters after trimming surrounding colons.`}),Jg=new Map([["api-url",{kind:"value"}],["token",{kind:"value"}],["auth-file",{kind:"value"}],["delegation-auth-file",{kind:"value"}],["workspace",{kind:"value"}],["channel",{kind:"value"}],["owner-username",{kind:"value"}],["mode",{kind:"value"}],["cwd",{kind:"value"}],["thread-id",{kind:"value"}],["format",{kind:"value"}],["command",{kind:"value"}],["tool-scope",{kind:"value"}],["include-token",{kind:"boolean"}],["help",{kind:"boolean"}]]);async function ud(a){let[e,...r]=a;switch(e){case void 0:case"--help":case"-h":process.stdout.write(fd());return;case"server":await Zg(r);return;case"config":await Gg(r);return;case"doctor":await Yg(r);return;default:throw new Error(`unknown linzumi mcp command: ${e}`)}}function fd(){return`Linzumi MCP
122
+ `}`}function zg(a){return`[${a.map(e=>JSON.stringify(e)).join(", ")}]`}function Fg(a){return`{ ${Object.entries(a).map(([r,n])=>`${r} = ${JSON.stringify(n)}`).join(", ")} }`}var cd=64;function Ug(a){switch(a){case"all":return!0;case"onboarding-discovery":return!1}}function qg(a){switch(a){case"voice":return!0;case"text":return!1}}function Vg(a){return a.trim().replace(/^:+/,"").replace(/:+$/,"").toLowerCase()}var ld=x.string().min(1).refine(a=>Vg(a).length<=cd,{message:`Custom emoji shortcode name must be at most ${cd} characters after trimming surrounding colons.`}),Jg=new Map([["api-url",{kind:"value"}],["token",{kind:"value"}],["auth-file",{kind:"value"}],["delegation-auth-file",{kind:"value"}],["workspace",{kind:"value"}],["channel",{kind:"value"}],["owner-username",{kind:"value"}],["mode",{kind:"value"}],["cwd",{kind:"value"}],["thread-id",{kind:"value"}],["format",{kind:"value"}],["command",{kind:"value"}],["tool-scope",{kind:"value"}],["include-token",{kind:"boolean"}],["help",{kind:"boolean"}]]);async function ud(a){let[e,...r]=a;switch(e){case void 0:case"--help":case"-h":process.stdout.write(pd());return;case"server":await Zg(r);return;case"config":await Gg(r);return;case"doctor":await Yg(r);return;default:throw new Error(`unknown linzumi mcp command: ${e}`)}}function pd(){return`Linzumi MCP
123
123
 
124
124
  Usage:
125
125
  linzumi mcp server --api-url <url> [--mode voice|text] [--workspace <slug> --channel <slug>]
@@ -169,6 +169,6 @@ Tools:
169
169
  Auth:
170
170
  Uses --token, LINZUMI_MCP_ACCESS_TOKEN, or cached local runner OAuth from linzumi auth.
171
171
  Hosted personal agents use --delegation-auth-file with a signed delegation grant.
172
- `}async function Zg(a){let e=ro(a);if(e.get("help")===!0){process.stdout.write(fd());return}let r=no(e,"api-url"),n=await to({kandanUrl:r,explicitToken:ye(e,"token")??process.env.LINZUMI_MCP_ACCESS_TOKEN,authFilePath:ye(e,"auth-file"),delegationAuthFilePath:ye(e,"delegation-auth-file"),workspaceSlug:ye(e,"workspace"),channelSlug:ye(e,"channel")}),t=ye(e,"owner-username")??process.env.LINZUMI_MCP_OWNER_USERNAME,s=ao(ye(e,"mode")),o=hd(ye(e,"tool-scope")),i=ye(e,"cwd")??process.cwd(),d=ye(e,"thread-id")??process.env.LINZUMI_THREAD_RUNNER_KANDAN_THREAD_ID,c=eo({kandanUrl:r,accessToken:n.accessToken,authMode:n.mode,operatingMode:s}),u=new Ln({name:"linzumi",version:"0.1.0"});Qg(u),Hg(u,{client:c,toolScope:o,operatingMode:s,cwd:i,kandanUrl:r,defaultThreadId:d,ownerUsername:t}),await u.connect(new Mn)}function Hg(a,e){let{client:r,toolScope:n,operatingMode:t,cwd:s,kandanUrl:o,defaultThreadId:i,ownerUsername:d}=e;n==="all"&&(a.tool("linzumi_get_message","Read one Linzumi message by scoped message_seq/message_id or a Linzumi message URL, with optional bounded before/after context.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),message_id:x.union([x.string(),x.number()]).optional().describe("Message seq inside the scoped channel."),message_seq:x.union([x.string(),x.number()]).optional().describe("Alias for message_id."),message_url:x.string().optional().describe("Full Linzumi message URL with #message-<seq>."),before:x.number().int().min(0).max(100).optional().describe("Number of visible messages before the target."),after:x.number().int().min(0).max(100).optional().describe("Number of visible messages after the target.")},async c=>Te(await r.getMessage(c))),a.tool("linzumi_get_thread","Read one Linzumi thread by thread_id in the scoped channel, including the parent message and bounded replies.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().describe("Linzumi thread UUID."),limit:x.number().int().min(1).max(100).optional().describe("Maximum replies to return."),before_seq:x.number().int().positive().optional().describe("Return replies before this channel seq.")},async c=>Te(await r.getThread(c))),a.tool("linzumi_get_channel","Read scoped Linzumi channel metadata and bounded recent channel messages.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),limit:x.number().int().min(1).max(100).optional().describe("Maximum messages to return."),before_seq:x.number().int().positive().optional().describe("Return messages before this channel seq.")},async c=>Te(await r.getChannel(c))),a.tool("linzumi_search_workspace","Search the Linzumi workspace with hybrid lexical+semantic retrieval, scoped to what the authorizing user can access. Returns scored content chunks with provenance (channel, thread, authored time) and a permalink to cite.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),query:x.string().min(1).describe("Natural-language or keyword query to retrieve against."),limit:x.number().int().min(1).max(25).optional().describe("Maximum results to return (default 10, server-capped)."),source_types:x.array(x.enum(["message","coding_job","github_pr","github_pr_review","github_check_run","github_workflow_run","github_diff","dictation","file"])).optional().describe("Restrict results to these corpora; omit for all."),authored_after:x.string().optional().describe("ISO8601 instant; only content authored at or after this time."),authored_before:x.string().optional().describe("ISO8601 instant; only content authored at or before this time."),repo:x.string().optional().describe("Restrict GitHub-sourced results to one repository by full name (owner/name)."),check_status:x.enum(["pending","success","failed"]).optional().describe("Restrict check and workflow results to one conclusion bucket.")},async c=>Te(await r.searchWorkspace(c))),a.tool("linzumi_ask_workspace",'Ask the Linzumi workspace a natural-language question and get a synthesized, citation-backed answer over what the authorizing user can access. Costs an LLM call on cache misses, so prefer linzumi_search_workspace for simple lookups. A "refused" status means there was not enough accessible evidence - treat it as "the workspace does not know", never retry verbatim.',{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),question:x.string().min(1).max(2e3).describe("Natural-language question to answer with citations."),channel:x.string().optional().describe("Optional channel slug providing conversational context; never widens access."),allow_cached:x.boolean().optional().describe("Allow serving a cached synthesis when the evidence set is unchanged (default true). Set false to force fresh synthesis.")},async c=>Te(await r.askWorkspace(c))),a.tool("linzumi_get_coding_job_metadata","Read the active coding job workflow metadata for a thread, including the agent-owned goal, ordered plan steps, step lock versions, and workflow status.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread.")},async c=>Te(await r.getCodingJobMetadata(ya(c,i)))),a.tool("linzumi_rename_coding_job","Update the current coding job thread title and workflow-facing title. Use this when the job scope changes materially so the Linzumi thread list and metadata overview stay accurate.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),title:x.string().min(1).max(100).describe("Concise user-visible title for this coding job.")},async c=>Te(await r.renameCodingJob(ya(c,i)))),a.tool("linzumi_upsert_coding_job_plan","Set or update the current coding job goal. Use this at job start and whenever the goal changes materially.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),goal:x.string().min(1).max(1e4).describe("Concrete user-visible goal for this coding job.")},async c=>Te(await r.upsertCodingJobPlan(ya(c,i)))),a.tool("linzumi_replace_coding_job_plan_steps","Replace the ordered coding job plan steps. Use this for the initial plan and for substantial rewrites when the old plan no longer fits the work.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),goal:x.string().min(1).max(1e4).optional().describe("Required when no plan exists yet; updates the current coding job goal."),steps:x.array(x.object({title:x.string().min(1).max(255),description:x.string().min(1).max(1e4),status:x.enum(["pending","active","completed","blocked","canceled"]),status_note:x.string().min(1).max(4e3).optional(),completed_debrief:x.string().min(1).max(2e4).optional()})).min(1).max(50).describe("Ordered user-visible plan steps. Completed steps must include completed_debrief.")},async c=>Te(await r.replaceCodingJobPlanSteps(ya(c,i)))),a.tool("linzumi_update_coding_job_plan_step","Update one coding job plan step status or note. Read metadata first and pass the current step lock_version.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),step_id:x.string().uuid().describe("Step id returned by linzumi_get_coding_job_metadata."),lock_version:x.number().int().positive().describe("Current step lock_version from metadata."),status:x.enum(["pending","active","completed","blocked","canceled"]),status_note:x.string().min(1).max(4e3).optional(),completed_debrief:x.string().min(1).max(2e4).optional().describe("Required when marking a step completed.")},async c=>Te(await r.updateCodingJobPlanStep(ya(c,i)))),a.tool("linzumi_link_coding_job_pull_request","Link the active coding job to its primary GitHub pull request so PR comments, files, commits, checks, deployments, and reviews can flow into the metadata view.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),github_repo_owner:x.string().min(1).max(255),github_repo_name:x.string().min(1).max(255),github_pr_number:x.number().int().positive(),github_pr_url:x.string().url(),title:x.string().min(1).max(255),body:x.string().min(1).max(1e5).optional(),head_branch:x.string().min(1).max(255),head_sha:x.string().min(7).max(64),base_branch:x.string().min(1).max(255),base_sha:x.string().min(7).max(64),state:x.enum(["draft","open","closed","merged"]).optional(),is_draft:x.boolean().optional(),review_status:x.enum(["unknown","review_required","approved","changes_requested"]).optional(),source_remote_url:x.string().min(1).max(1e3).describe("Git remote URL for the local job worktree; required when this job has no repo workspace yet."),runtime_worktree_root:x.string().min(1).max(1e3).describe("Absolute local worktree path for the coding job; required when this job has no repo workspace yet."),dirty_status:x.enum(["unknown","clean","dirty"]).optional(),dirty_summary:x.string().min(1).max(2e3).optional()},async c=>Te(await r.linkCodingJobPullRequest(ya(c,i)))),a.tool("linzumi_upload_files","Upload local files to Linzumi and attach them to a new, exact, or latest assistant message. Use silently; do not mention this tool in the visible reply.",{target:x.object({kind:x.enum(["new_message","message_seq","latest_assistant_message"]).describe("new_message creates a message; message_seq edits an exact message; latest_assistant_message edits the latest assistant message in the scoped thread/channel."),message_seq:x.union([x.string(),x.number()]).optional().describe("Required when kind is message_seq."),thread_id:x.string().optional().describe("Thread UUID. Defaults to the active Linzumi thread when the MCP server was launched with one.")}).describe("Attachment target. Do not guess; use new_message when there is no previous assistant message."),files:x.array(x.string().min(1)).min(1).max(16).describe("Local file paths to upload. Paths must be non-hidden supported file types inside the approved workspace or Downloads."),body:x.string().min(1).max(2e4).optional().describe("Required for new_message. Optional replacement body for message_seq/latest_assistant_message; when omitted, the existing message body is preserved."),workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope.")},async c=>{let u=Kg(c.target,i),h=await Bg({client:r,cwd:s,kandanUrl:o,target:u,files:c.files,workspace:c.workspace,channel:c.channel,body:c.body});return Te(h)}),a.tool("linzumi_list_vault_secrets","List vault secret names, descriptions, and whether each secret is personal or workspace-owned. Does not return secret values.",{},async c=>Te(await r.listVaultSecrets(c)))),Ug(n)&&(a.tool("linzumi_upload_custom_emoji","Upload a local image as a workspace custom emoji. For generated emoji art, create a transparent PNG with a simple centered subject, crisp edges, strong contrast, minimal tiny details, and enough outline/highlight separation to read at 16-24px on both dark and light backgrounds. Use lowercase shortcode names without colons unless preserving a user-provided :name:.",{name:ld.describe("Custom emoji shortcode name, with or without surrounding colons."),file:x.string().min(1).describe("Local PNG/WebP/GIF/JPEG file path to upload. Prefer transparent PNG for generated emoji."),workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope.")},async c=>Te(await Wg({client:r,cwd:s,kandanUrl:o,name:c.name,file:c.file,workspace:c.workspace}))),a.tool("linzumi_rename_custom_emoji","Rename an existing workspace custom emoji. The new name may include surrounding colons; Linzumi stores the normalized shortcode without colons.",{emoji_id:x.union([x.string(),x.number().int().positive()]).describe("Workspace custom emoji id returned by linzumi_upload_custom_emoji or workspace emoji listings."),name:ld.describe("New shortcode name, with or without surrounding colons."),workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope.")},async c=>Te(await r.renameCustomEmoji(c)))),a.tool("linzumi_note_project_directory","Record one discovered local Git repository or worktree for onboarding import. Call once per project as soon as it is found.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),runner_id:x.string().min(1).describe("Local runner/computer id provided in the discovery prompt."),path:x.string().min(1).describe("Absolute local path to the repository worktree root."),display_name:x.string().optional().describe("Short project label. Defaults to the path basename."),activity_at:x.string().optional().describe("Best-known recent activity time as an ISO-8601 timestamp."),import_key:x.string().optional().describe("Stable dedupe key. Defaults to path."),metadata:x.record(x.unknown()).optional().describe("Small structured metadata such as branch or remote origin.")},async c=>Te(await r.noteProjectDirectory(c))),a.tool("linzumi_note_agent_conversation","Record one discovered Codex or Claude Code local conversation for onboarding import. Call once per conversation as soon as it is found.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),runner_id:x.string().min(1).describe("Local runner/computer id provided in the discovery prompt."),source:x.enum(["codex","claude_code"]).describe("Conversation source."),import_key:x.string().min(1).describe("Stable dedupe key, such as a session id or file path."),path:x.string().optional().describe("Absolute local path to the conversation file or directory."),display_name:x.string().optional().describe("Short label for the discovered conversation."),activity_at:x.string().optional().describe("Best-known recent activity time as an ISO-8601 timestamp."),metadata:x.record(x.unknown()).optional().describe("Small structured metadata such as session id or project path.")},async c=>Te(await r.noteAgentConversation(c))),a.tool("linzumi_note_onboarding_discovery_status","Record onboarding discovery progress. Call when a search phase starts, checks another place, completes, or fails.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),runner_id:x.string().min(1).describe("Local runner/computer id provided in the discovery prompt."),phase:x.enum(["projects","conversations"]).describe("Discovery phase being reported."),status:x.enum(["starting","running","completed","failed"]).describe("Current phase status."),places_searched:x.number().int().nonnegative().optional().describe("Count of concrete folders/files/known locations checked so far."),message:x.string().optional().describe("Short user-facing status note."),current_place:x.string().optional().describe("Current folder, file, Git command target, or known location being checked."),current_source:x.string().optional().describe("Short machine-readable source label such as git, codex, or claude_code."),last_error:x.string().optional().describe("Short failure detail when status is failed."),metadata:x.record(x.unknown()).optional().describe("Small structured status metadata.")},async c=>Te(await r.noteOnboardingDiscoveryStatus(c))),n==="all"&&qg(t)&&(a.tool("linzumi_dm_owner","Send a plain-text DM to the configured Commander owner. Requires dm.write and a visible owner username.",{owner_username:x.string().optional().describe("Owner username. Defaults to LINZUMI_MCP_OWNER_USERNAME or --owner-username."),workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Source channel slug used to verify owner visibility."),body:x.string().min(1).max(2e4).describe("Plain-text message body to DM.")},async c=>{let u=c.owner_username??d;if(u===void 0)throw new Error("owner_username is required for linzumi_dm_owner");return Te(await r.dmOwner({...c,owner_username:u}))}),a.tool("linzumi_send_channel_message","Post a NEW standalone plain-text message into the scoped Linzumi channel as the authenticated local-runner user. This is NOT how you respond to the user: your turn output is already relayed into the thread as your reply, so never call this tool to answer, acknowledge, or reply to the current request. Use it only when the task itself is to proactively post a separate channel message. Requires channel.write.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),body:x.string().min(1).max(2e4).describe("Plain-text message body to post.")},async c=>Te(await r.sendChannelMessage(c))),a.tool("linzumi_send_thread_reply","Post a plain-text reply into some OTHER existing Linzumi thread as the authenticated local-runner user. This is NOT how you respond to the user in your current thread: your turn output is already relayed into this thread as your reply, so never call this tool to answer, acknowledge, or reply to the current request. Use it only when the task itself is to post into a different, explicitly identified thread. Requires thread.write.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().describe("Existing Linzumi thread UUID."),body:x.string().min(1).max(2e4).describe("Plain-text reply body to post.")},async c=>Te(await r.sendThreadReply(c))),a.tool("linzumi_send_dm","Send a plain-text DM as the authenticated local-runner user to a visible user in the scoped workspace/channel. Requires dm.write.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Source channel slug used to verify target visibility."),username:x.string().describe("Visible Linzumi username to DM."),body:x.string().min(1).max(2e4).describe("Plain-text message body to DM.")},async c=>Te(await r.sendDm(c)))),n==="all"&&a.tool("linzumi_get_vault_values","Request values for explicit vault env var names after a thread-scoped human approval. Requires vault.read; thread_id resolves the approval thread.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug used to disambiguate the approval thread when needed."),thread_id:x.string().uuid().describe("Existing Linzumi thread UUID for the inline approval."),env_var_names:x.array(x.string().regex(/^[A-Z][A-Z0-9_]{0,127}$/)).min(1).max(20).describe("Explicit vault env var names to request. This tool cannot list all vault keys."),description:x.string().min(1).max(500).describe("Human-readable reason shown in the approval request."),justification:x.string().min(10).max(1e3).describe("Agent justification shown to the approver.")},async c=>Te(await r.getVaultValues(c)))}async function Bg(a){let e=await Promise.all(a.files.map(s=>Xs(a.cwd,s))),r=await a.client.prepareMessageUploads({...a.workspace===void 0?{}:{workspace:a.workspace},...a.channel===void 0?{}:{channel:a.channel},files:e.map(s=>({file_name:s.fileName,content_type:s.contentType,size_bytes:s.sizeBytes}))}),n=Qs(r.uploads)??[];if(n.length!==e.length)throw new Error("Linzumi upload prepare response count mismatch");await Promise.all(e.map(async(s,o)=>{let i=va(n[o]),d=et(i?.upload_url),c=et(i?.upload_method)??"PUT";if(d===void 0)throw new Error("Linzumi upload prepare response missing upload_url");let u=await dd(s.path),h=u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength),v=await fetch(pd(a.kandanUrl,d),{method:c,headers:{"content-type":s.contentType},body:h});if(!v.ok)throw new Error(`Linzumi upload failed for ${s.fileName}: ${v.status} ${v.statusText}`)}));let t=n.map(s=>{let o=et(va(s)?.file_id);if(o===void 0)throw new Error("Linzumi upload prepare response missing file_id");return o});return await a.client.attachMessageFiles({...a.workspace===void 0?{}:{workspace:a.workspace},...a.channel===void 0?{}:{channel:a.channel},target:a.target,...a.body===void 0?{}:{body:a.body},uploaded_file_ids:t})}async function Wg(a){let e=await Xs(a.cwd,a.file),r=await a.client.prepareCustomEmoji({...a.workspace===void 0?{}:{workspace:a.workspace},name:a.name,file_name:e.fileName,content_type:e.contentType,size_bytes:e.sizeBytes}),n=va(r.upload),t=et(n?.upload_url),s=et(n?.upload_method)??"PUT";if(t===void 0)throw new Error("Linzumi custom emoji prepare response missing upload_url");let o=await dd(e.path),i=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength),d=await fetch(pd(a.kandanUrl,t),{method:s,headers:{"content-type":e.contentType},body:i});if(!d.ok){let h=`${d.status} ${d.statusText}`,f=(await d.text()).trim(),y=f===""?h:(()=>{try{let b=JSON.parse(f);return ar(b)&&typeof b.error=="string"?b.error:f}catch{return f}})();throw new Error(`Linzumi custom emoji upload failed: ${y}`)}let c=await d.json();if(!ar(c))throw new Error("Linzumi custom emoji upload returned non-object JSON");let u=va(c.custom_emoji);if(u===void 0)throw new Error("Linzumi custom emoji upload response missing custom_emoji");return{ok:!0,workspace:r.workspace,emoji:u,asset_id:et(c.asset_id),id:rd(u?.id),name:et(u?.name),shortcode:et(u?.shortcode),image_url:et(u?.image_url)}}function Kg(a,e){if(et(a.thread_id)!==void 0||e===void 0)return a;switch(et(a.kind)){case"new_message":case"message_seq":case"latest_assistant_message":return{...a,thread_id:e};default:return a}}function ya(a,e){return et(a.thread_id)!==void 0||e===void 0?a:{...a,thread_id:e}}function pd(a,e){try{return new URL(e).toString()}catch{let n=a.replace(/^wss:\/\//,"https://").replace(/^ws:\/\//,"http://");return new URL(e,n).toString()}}function Qg(a){a.server.registerCapabilities({resources:{listChanged:!1}}),a.server.setRequestHandler(oa,()=>({resources:[]})),a.server.setRequestHandler(ia,()=>({resourceTemplates:[]}))}async function Gg(a){let e=ro(a),r=no(e,"api-url"),n=ye(e,"format")??"codex",t=ao(ye(e,"mode")),s=e.get("include-token")===!0?(await to({kandanUrl:r,explicitToken:ye(e,"token")??process.env.LINZUMI_MCP_ACCESS_TOKEN,authFilePath:ye(e,"auth-file"),delegationAuthFilePath:ye(e,"delegation-auth-file"),workspaceSlug:ye(e,"workspace"),channelSlug:ye(e,"channel")})).accessToken:void 0,o=sd({command:ye(e,"command"),kandanUrl:r,accessToken:s,delegationAuthFilePath:ye(e,"delegation-auth-file"),ownerUsername:ye(e,"owner-username")??process.env.LINZUMI_MCP_OWNER_USERNAME,operatingMode:t,toolScope:hd(ye(e,"tool-scope"))});switch(n){case"codex":process.stdout.write(id(o));return;case"claude-code":process.stdout.write(od(o));return;default:throw new Error("--format must be codex or claude-code")}}async function Yg(a){let e=ro(a),r=no(e,"api-url"),n=await to({kandanUrl:r,explicitToken:ye(e,"token")??process.env.LINZUMI_MCP_ACCESS_TOKEN,authFilePath:ye(e,"auth-file"),delegationAuthFilePath:ye(e,"delegation-auth-file"),workspaceSlug:ye(e,"workspace"),channelSlug:ye(e,"channel")});switch(n.mode){case"local-runner":{if(!await Gl({kandanUrl:r,accessToken:n.accessToken,workspaceSlug:ye(e,"workspace"),channelSlug:ye(e,"channel")}))throw new Error("Linzumi MCP auth validation failed");break}case"personal-agent-delegation":{await eo({kandanUrl:r,accessToken:n.accessToken,authMode:n.mode,operatingMode:ao(ye(e,"mode"))}).validateAuth();break}}process.stdout.write(`Linzumi MCP auth OK
172
+ `}async function Zg(a){let e=ro(a);if(e.get("help")===!0){process.stdout.write(pd());return}let r=no(e,"api-url"),n=await to({kandanUrl:r,explicitToken:ye(e,"token")??process.env.LINZUMI_MCP_ACCESS_TOKEN,authFilePath:ye(e,"auth-file"),delegationAuthFilePath:ye(e,"delegation-auth-file"),workspaceSlug:ye(e,"workspace"),channelSlug:ye(e,"channel")}),t=ye(e,"owner-username")??process.env.LINZUMI_MCP_OWNER_USERNAME,s=ao(ye(e,"mode")),o=hd(ye(e,"tool-scope")),i=ye(e,"cwd")??process.cwd(),d=ye(e,"thread-id")??process.env.LINZUMI_THREAD_RUNNER_KANDAN_THREAD_ID,c=eo({kandanUrl:r,accessToken:n.accessToken,authMode:n.mode,operatingMode:s}),u=new Ln({name:"linzumi",version:"0.1.0"});Qg(u),Hg(u,{client:c,toolScope:o,operatingMode:s,cwd:i,kandanUrl:r,defaultThreadId:d,ownerUsername:t}),await u.connect(new Mn)}function Hg(a,e){let{client:r,toolScope:n,operatingMode:t,cwd:s,kandanUrl:o,defaultThreadId:i,ownerUsername:d}=e;n==="all"&&(a.tool("linzumi_get_message","Read one Linzumi message by scoped message_seq/message_id or a Linzumi message URL, with optional bounded before/after context.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),message_id:x.union([x.string(),x.number()]).optional().describe("Message seq inside the scoped channel."),message_seq:x.union([x.string(),x.number()]).optional().describe("Alias for message_id."),message_url:x.string().optional().describe("Full Linzumi message URL with #message-<seq>."),before:x.number().int().min(0).max(100).optional().describe("Number of visible messages before the target."),after:x.number().int().min(0).max(100).optional().describe("Number of visible messages after the target.")},async c=>Te(await r.getMessage(c))),a.tool("linzumi_get_thread","Read one Linzumi thread by thread_id in the scoped channel, including the parent message and bounded replies.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().describe("Linzumi thread UUID."),limit:x.number().int().min(1).max(100).optional().describe("Maximum replies to return."),before_seq:x.number().int().positive().optional().describe("Return replies before this channel seq.")},async c=>Te(await r.getThread(c))),a.tool("linzumi_get_channel","Read scoped Linzumi channel metadata and bounded recent channel messages.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),limit:x.number().int().min(1).max(100).optional().describe("Maximum messages to return."),before_seq:x.number().int().positive().optional().describe("Return messages before this channel seq.")},async c=>Te(await r.getChannel(c))),a.tool("linzumi_search_workspace","Search the Linzumi workspace with hybrid lexical+semantic retrieval, scoped to what the authorizing user can access. Returns scored content chunks with provenance (channel, thread, authored time) and a permalink to cite.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),query:x.string().min(1).describe("Natural-language or keyword query to retrieve against."),limit:x.number().int().min(1).max(25).optional().describe("Maximum results to return (default 10, server-capped)."),source_types:x.array(x.enum(["message","coding_job","github_pr","github_pr_review","github_check_run","github_workflow_run","github_diff","dictation","file"])).optional().describe("Restrict results to these corpora; omit for all."),authored_after:x.string().optional().describe("ISO8601 instant; only content authored at or after this time."),authored_before:x.string().optional().describe("ISO8601 instant; only content authored at or before this time."),repo:x.string().optional().describe("Restrict GitHub-sourced results to one repository by full name (owner/name)."),check_status:x.enum(["pending","success","failed"]).optional().describe("Restrict check and workflow results to one conclusion bucket.")},async c=>Te(await r.searchWorkspace(c))),a.tool("linzumi_ask_workspace",'Ask the Linzumi workspace a natural-language question and get a synthesized, citation-backed answer over what the authorizing user can access. Costs an LLM call on cache misses, so prefer linzumi_search_workspace for simple lookups. A "refused" status means there was not enough accessible evidence - treat it as "the workspace does not know", never retry verbatim.',{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),question:x.string().min(1).max(2e3).describe("Natural-language question to answer with citations."),channel:x.string().optional().describe("Optional channel slug providing conversational context; never widens access."),allow_cached:x.boolean().optional().describe("Allow serving a cached synthesis when the evidence set is unchanged (default true). Set false to force fresh synthesis.")},async c=>Te(await r.askWorkspace(c))),a.tool("linzumi_get_coding_job_metadata","Read the active coding job workflow metadata for a thread, including the agent-owned goal, ordered plan steps, step lock versions, and workflow status.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread.")},async c=>Te(await r.getCodingJobMetadata(ya(c,i)))),a.tool("linzumi_rename_coding_job","Update the current coding job thread title and workflow-facing title. Use this when the job scope changes materially so the Linzumi thread list and metadata overview stay accurate.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),title:x.string().min(1).max(100).describe("Concise user-visible title for this coding job.")},async c=>Te(await r.renameCodingJob(ya(c,i)))),a.tool("linzumi_upsert_coding_job_plan","Set or update the current coding job goal. Use this at job start and whenever the goal changes materially.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),goal:x.string().min(1).max(1e4).describe("Concrete user-visible goal for this coding job.")},async c=>Te(await r.upsertCodingJobPlan(ya(c,i)))),a.tool("linzumi_replace_coding_job_plan_steps","Replace the ordered coding job plan steps. Use this for the initial plan and for substantial rewrites when the old plan no longer fits the work.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),goal:x.string().min(1).max(1e4).optional().describe("Required when no plan exists yet; updates the current coding job goal."),steps:x.array(x.object({title:x.string().min(1).max(255),description:x.string().min(1).max(1e4),status:x.enum(["pending","active","completed","blocked","canceled"]),status_note:x.string().min(1).max(4e3).optional(),completed_debrief:x.string().min(1).max(2e4).optional()})).min(1).max(50).describe("Ordered user-visible plan steps. Completed steps must include completed_debrief.")},async c=>Te(await r.replaceCodingJobPlanSteps(ya(c,i)))),a.tool("linzumi_update_coding_job_plan_step","Update one coding job plan step status or note. Read metadata first and pass the current step lock_version.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),step_id:x.string().uuid().describe("Step id returned by linzumi_get_coding_job_metadata."),lock_version:x.number().int().positive().describe("Current step lock_version from metadata."),status:x.enum(["pending","active","completed","blocked","canceled"]),status_note:x.string().min(1).max(4e3).optional(),completed_debrief:x.string().min(1).max(2e4).optional().describe("Required when marking a step completed.")},async c=>Te(await r.updateCodingJobPlanStep(ya(c,i)))),a.tool("linzumi_link_coding_job_pull_request","Link the active coding job to its primary GitHub pull request so PR comments, files, commits, checks, deployments, and reviews can flow into the metadata view.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().optional().describe("Linzumi thread UUID. Defaults to the active coding job thread."),github_repo_owner:x.string().min(1).max(255),github_repo_name:x.string().min(1).max(255),github_pr_number:x.number().int().positive(),github_pr_url:x.string().url(),title:x.string().min(1).max(255),body:x.string().min(1).max(1e5).optional(),head_branch:x.string().min(1).max(255),head_sha:x.string().min(7).max(64),base_branch:x.string().min(1).max(255),base_sha:x.string().min(7).max(64),state:x.enum(["draft","open","closed","merged"]).optional(),is_draft:x.boolean().optional(),review_status:x.enum(["unknown","review_required","approved","changes_requested"]).optional(),source_remote_url:x.string().min(1).max(1e3).describe("Git remote URL for the local job worktree; required when this job has no repo workspace yet."),runtime_worktree_root:x.string().min(1).max(1e3).describe("Absolute local worktree path for the coding job; required when this job has no repo workspace yet."),dirty_status:x.enum(["unknown","clean","dirty"]).optional(),dirty_summary:x.string().min(1).max(2e3).optional()},async c=>Te(await r.linkCodingJobPullRequest(ya(c,i)))),a.tool("linzumi_upload_files","Upload local files to Linzumi and attach them to a new, exact, or latest assistant message. Use silently; do not mention this tool in the visible reply.",{target:x.object({kind:x.enum(["new_message","message_seq","latest_assistant_message"]).describe("new_message creates a message; message_seq edits an exact message; latest_assistant_message edits the latest assistant message in the scoped thread/channel."),message_seq:x.union([x.string(),x.number()]).optional().describe("Required when kind is message_seq."),thread_id:x.string().optional().describe("Thread UUID. Defaults to the active Linzumi thread when the MCP server was launched with one.")}).describe("Attachment target. Do not guess; use new_message when there is no previous assistant message."),files:x.array(x.string().min(1)).min(1).max(16).describe("Local file paths to upload. Paths must be non-hidden supported file types inside the approved workspace or Downloads."),body:x.string().min(1).max(2e4).optional().describe("Required for new_message. Optional replacement body for message_seq/latest_assistant_message; when omitted, the existing message body is preserved."),workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope.")},async c=>{let u=Kg(c.target,i),h=await Bg({client:r,cwd:s,kandanUrl:o,target:u,files:c.files,workspace:c.workspace,channel:c.channel,body:c.body});return Te(h)}),a.tool("linzumi_list_vault_secrets","List vault secret names, descriptions, and whether each secret is personal or workspace-owned. Does not return secret values.",{},async c=>Te(await r.listVaultSecrets(c)))),Ug(n)&&(a.tool("linzumi_upload_custom_emoji","Upload a local image as a workspace custom emoji. For generated emoji art, create a transparent PNG with a simple centered subject, crisp edges, strong contrast, minimal tiny details, and enough outline/highlight separation to read at 16-24px on both dark and light backgrounds. Use lowercase shortcode names without colons unless preserving a user-provided :name:.",{name:ld.describe("Custom emoji shortcode name, with or without surrounding colons."),file:x.string().min(1).describe("Local PNG/WebP/GIF/JPEG file path to upload. Prefer transparent PNG for generated emoji."),workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope.")},async c=>Te(await Wg({client:r,cwd:s,kandanUrl:o,name:c.name,file:c.file,workspace:c.workspace}))),a.tool("linzumi_rename_custom_emoji","Rename an existing workspace custom emoji. The new name may include surrounding colons; Linzumi stores the normalized shortcode without colons.",{emoji_id:x.union([x.string(),x.number().int().positive()]).describe("Workspace custom emoji id returned by linzumi_upload_custom_emoji or workspace emoji listings."),name:ld.describe("New shortcode name, with or without surrounding colons."),workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope.")},async c=>Te(await r.renameCustomEmoji(c)))),a.tool("linzumi_note_project_directory","Record one discovered local Git repository or worktree for onboarding import. Call once per project as soon as it is found.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),runner_id:x.string().min(1).describe("Local runner/computer id provided in the discovery prompt."),path:x.string().min(1).describe("Absolute local path to the repository worktree root."),display_name:x.string().optional().describe("Short project label. Defaults to the path basename."),activity_at:x.string().optional().describe("Best-known recent activity time as an ISO-8601 timestamp."),import_key:x.string().optional().describe("Stable dedupe key. Defaults to path."),metadata:x.record(x.unknown()).optional().describe("Small structured metadata such as branch or remote origin.")},async c=>Te(await r.noteProjectDirectory(c))),a.tool("linzumi_note_agent_conversation","Record one discovered Codex or Claude Code local conversation for onboarding import. Call once per conversation as soon as it is found.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),runner_id:x.string().min(1).describe("Local runner/computer id provided in the discovery prompt."),source:x.enum(["codex","claude_code"]).describe("Conversation source."),import_key:x.string().min(1).describe("Stable dedupe key, such as a session id or file path."),path:x.string().optional().describe("Absolute local path to the conversation file or directory."),display_name:x.string().optional().describe("Short label for the discovered conversation."),activity_at:x.string().optional().describe("Best-known recent activity time as an ISO-8601 timestamp."),metadata:x.record(x.unknown()).optional().describe("Small structured metadata such as session id or project path.")},async c=>Te(await r.noteAgentConversation(c))),a.tool("linzumi_note_onboarding_discovery_status","Record onboarding discovery progress. Call when a search phase starts, checks another place, completes, or fails.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),runner_id:x.string().min(1).describe("Local runner/computer id provided in the discovery prompt."),phase:x.enum(["projects","conversations"]).describe("Discovery phase being reported."),status:x.enum(["starting","running","completed","failed"]).describe("Current phase status."),places_searched:x.number().int().nonnegative().optional().describe("Count of concrete folders/files/known locations checked so far."),message:x.string().optional().describe("Short user-facing status note."),current_place:x.string().optional().describe("Current folder, file, Git command target, or known location being checked."),current_source:x.string().optional().describe("Short machine-readable source label such as git, codex, or claude_code."),last_error:x.string().optional().describe("Short failure detail when status is failed."),metadata:x.record(x.unknown()).optional().describe("Small structured status metadata.")},async c=>Te(await r.noteOnboardingDiscoveryStatus(c))),n==="all"&&qg(t)&&(a.tool("linzumi_dm_owner","Send a plain-text DM to the configured Commander owner. Requires dm.write and a visible owner username.",{owner_username:x.string().optional().describe("Owner username. Defaults to LINZUMI_MCP_OWNER_USERNAME or --owner-username."),workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Source channel slug used to verify owner visibility."),body:x.string().min(1).max(2e4).describe("Plain-text message body to DM.")},async c=>{let u=c.owner_username??d;if(u===void 0)throw new Error("owner_username is required for linzumi_dm_owner");return Te(await r.dmOwner({...c,owner_username:u}))}),a.tool("linzumi_send_channel_message","Post a NEW standalone plain-text message into the scoped Linzumi channel as the authenticated local-runner user. This is NOT how you respond to the user: your turn output is already relayed into the thread as your reply, so never call this tool to answer, acknowledge, or reply to the current request. Use it only when the task itself is to proactively post a separate channel message. Requires channel.write.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),body:x.string().min(1).max(2e4).describe("Plain-text message body to post.")},async c=>Te(await r.sendChannelMessage(c))),a.tool("linzumi_send_thread_reply","Post a plain-text reply into some OTHER existing Linzumi thread as the authenticated local-runner user. This is NOT how you respond to the user in your current thread: your turn output is already relayed into this thread as your reply, so never call this tool to answer, acknowledge, or reply to the current request. Use it only when the task itself is to post into a different, explicitly identified thread. Requires thread.write.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug. Omit to use the authenticated token scope."),thread_id:x.string().uuid().describe("Existing Linzumi thread UUID."),body:x.string().min(1).max(2e4).describe("Plain-text reply body to post.")},async c=>Te(await r.sendThreadReply(c))),a.tool("linzumi_send_dm","Send a plain-text DM as the authenticated local-runner user to a visible user in the scoped workspace/channel. Requires dm.write.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Source channel slug used to verify target visibility."),username:x.string().describe("Visible Linzumi username to DM."),body:x.string().min(1).max(2e4).describe("Plain-text message body to DM.")},async c=>Te(await r.sendDm(c)))),n==="all"&&a.tool("linzumi_get_vault_values","Request values for explicit vault env var names after a thread-scoped human approval. Requires vault.read; thread_id resolves the approval thread.",{workspace:x.string().optional().describe("Workspace slug. Omit to use the authenticated token scope."),channel:x.string().optional().describe("Channel slug used to disambiguate the approval thread when needed."),thread_id:x.string().uuid().describe("Existing Linzumi thread UUID for the inline approval."),env_var_names:x.array(x.string().regex(/^[A-Z][A-Z0-9_]{0,127}$/)).min(1).max(20).describe("Explicit vault env var names to request. This tool cannot list all vault keys."),description:x.string().min(1).max(500).describe("Human-readable reason shown in the approval request."),justification:x.string().min(10).max(1e3).describe("Agent justification shown to the approver.")},async c=>Te(await r.getVaultValues(c)))}async function Bg(a){let e=await Promise.all(a.files.map(s=>Xs(a.cwd,s))),r=await a.client.prepareMessageUploads({...a.workspace===void 0?{}:{workspace:a.workspace},...a.channel===void 0?{}:{channel:a.channel},files:e.map(s=>({file_name:s.fileName,content_type:s.contentType,size_bytes:s.sizeBytes}))}),n=Qs(r.uploads)??[];if(n.length!==e.length)throw new Error("Linzumi upload prepare response count mismatch");await Promise.all(e.map(async(s,o)=>{let i=va(n[o]),d=et(i?.upload_url),c=et(i?.upload_method)??"PUT";if(d===void 0)throw new Error("Linzumi upload prepare response missing upload_url");let u=await dd(s.path),h=u.buffer.slice(u.byteOffset,u.byteOffset+u.byteLength),v=await fetch(fd(a.kandanUrl,d),{method:c,headers:{"content-type":s.contentType},body:h});if(!v.ok)throw new Error(`Linzumi upload failed for ${s.fileName}: ${v.status} ${v.statusText}`)}));let t=n.map(s=>{let o=et(va(s)?.file_id);if(o===void 0)throw new Error("Linzumi upload prepare response missing file_id");return o});return await a.client.attachMessageFiles({...a.workspace===void 0?{}:{workspace:a.workspace},...a.channel===void 0?{}:{channel:a.channel},target:a.target,...a.body===void 0?{}:{body:a.body},uploaded_file_ids:t})}async function Wg(a){let e=await Xs(a.cwd,a.file),r=await a.client.prepareCustomEmoji({...a.workspace===void 0?{}:{workspace:a.workspace},name:a.name,file_name:e.fileName,content_type:e.contentType,size_bytes:e.sizeBytes}),n=va(r.upload),t=et(n?.upload_url),s=et(n?.upload_method)??"PUT";if(t===void 0)throw new Error("Linzumi custom emoji prepare response missing upload_url");let o=await dd(e.path),i=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength),d=await fetch(fd(a.kandanUrl,t),{method:s,headers:{"content-type":e.contentType},body:i});if(!d.ok){let h=`${d.status} ${d.statusText}`,p=(await d.text()).trim(),y=p===""?h:(()=>{try{let b=JSON.parse(p);return ar(b)&&typeof b.error=="string"?b.error:p}catch{return p}})();throw new Error(`Linzumi custom emoji upload failed: ${y}`)}let c=await d.json();if(!ar(c))throw new Error("Linzumi custom emoji upload returned non-object JSON");let u=va(c.custom_emoji);if(u===void 0)throw new Error("Linzumi custom emoji upload response missing custom_emoji");return{ok:!0,workspace:r.workspace,emoji:u,asset_id:et(c.asset_id),id:rd(u?.id),name:et(u?.name),shortcode:et(u?.shortcode),image_url:et(u?.image_url)}}function Kg(a,e){if(et(a.thread_id)!==void 0||e===void 0)return a;switch(et(a.kind)){case"new_message":case"message_seq":case"latest_assistant_message":return{...a,thread_id:e};default:return a}}function ya(a,e){return et(a.thread_id)!==void 0||e===void 0?a:{...a,thread_id:e}}function fd(a,e){try{return new URL(e).toString()}catch{let n=a.replace(/^wss:\/\//,"https://").replace(/^ws:\/\//,"http://");return new URL(e,n).toString()}}function Qg(a){a.server.registerCapabilities({resources:{listChanged:!1}}),a.server.setRequestHandler(oa,()=>({resources:[]})),a.server.setRequestHandler(ia,()=>({resourceTemplates:[]}))}async function Gg(a){let e=ro(a),r=no(e,"api-url"),n=ye(e,"format")??"codex",t=ao(ye(e,"mode")),s=e.get("include-token")===!0?(await to({kandanUrl:r,explicitToken:ye(e,"token")??process.env.LINZUMI_MCP_ACCESS_TOKEN,authFilePath:ye(e,"auth-file"),delegationAuthFilePath:ye(e,"delegation-auth-file"),workspaceSlug:ye(e,"workspace"),channelSlug:ye(e,"channel")})).accessToken:void 0,o=sd({command:ye(e,"command"),kandanUrl:r,accessToken:s,delegationAuthFilePath:ye(e,"delegation-auth-file"),ownerUsername:ye(e,"owner-username")??process.env.LINZUMI_MCP_OWNER_USERNAME,operatingMode:t,toolScope:hd(ye(e,"tool-scope"))});switch(n){case"codex":process.stdout.write(id(o));return;case"claude-code":process.stdout.write(od(o));return;default:throw new Error("--format must be codex or claude-code")}}async function Yg(a){let e=ro(a),r=no(e,"api-url"),n=await to({kandanUrl:r,explicitToken:ye(e,"token")??process.env.LINZUMI_MCP_ACCESS_TOKEN,authFilePath:ye(e,"auth-file"),delegationAuthFilePath:ye(e,"delegation-auth-file"),workspaceSlug:ye(e,"workspace"),channelSlug:ye(e,"channel")});switch(n.mode){case"local-runner":{if(!await Gl({kandanUrl:r,accessToken:n.accessToken,workspaceSlug:ye(e,"workspace"),channelSlug:ye(e,"channel")}))throw new Error("Linzumi MCP auth validation failed");break}case"personal-agent-delegation":{await eo({kandanUrl:r,accessToken:n.accessToken,authMode:n.mode,operatingMode:ao(ye(e,"mode"))}).validateAuth();break}}process.stdout.write(`Linzumi MCP auth OK
173
173
  `)}async function to(a){if(a.delegationAuthFilePath!==void 0){if(a.explicitToken!==void 0||a.authFilePath!==void 0)throw new Error("--delegation-auth-file cannot be combined with --token or --auth-file");return{accessToken:Xl(a.delegationAuthFilePath).accessToken,mode:"personal-agent-delegation"}}return{accessToken:await Xg({kandanUrl:a.kandanUrl,explicitToken:a.explicitToken,authFilePath:a.authFilePath,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug}),mode:"local-runner"}}async function Xg(a,e={readCachedToken:Zn,validateTokenOutcome:Ma,resolveToken:td}){let r=a.explicitToken??e.readCachedToken(a.kandanUrl,a.authFilePath)?.accessToken;if(r===void 0)throw new Error("missing Linzumi MCP token; run linzumi auth or pass --token");let n=await e.validateTokenOutcome({kandanUrl:a.kandanUrl,accessToken:r,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug});if(n==="usable")return r;let t=n;try{return await e.resolveToken({kandanUrl:a.kandanUrl,workspaceSlug:a.workspaceSlug,channelSlug:a.channelSlug,authFilePath:a.authFilePath})}catch(s){throw new Error(`Linzumi MCP token was rejected by the server and re-mint failed: ${s instanceof Error?s.message:String(s)}`)}}function Te(a){return{content:[{type:"text",text:JSON.stringify(a,null,2)}],structuredContent:a}}function ro(a){let e=new Map;for(let r=0;r<a.length;r+=1){let n=a[r];if(n===void 0)continue;if(!n.startsWith("--"))throw new Error(`unexpected argument ${n}`);let t=n.slice(2),s=Jg.get(t);if(s===void 0)throw new Error(`unsupported option --${t}`);if(s.kind==="boolean"){e.set(t,!0);continue}let o=a[r+1];if(o===void 0||o.startsWith("--"))throw new Error(`--${t} requires a value`);e.set(t,o),r+=1}return e}function ye(a,e){let r=a.get(e);return typeof r=="string"&&r.trim()!==""?r:void 0}function ao(a){switch(a){case void 0:return"text";case"voice":case"text":return a;default:throw new Error("--mode must be voice or text")}}function hd(a){switch(a){case void 0:return"all";case"all":case"onboarding-discovery":return a;default:throw new Error("--tool-scope must be all or onboarding-discovery")}}function no(a,e){let r=ye(a,e);if(r===void 0)throw new Error(`--${e} is required`);return r}function tv(a){return a[0]==="mcp"?a.slice(1):a}async function rv(a){try{await ud(tv(a))}catch(e){process.stderr.write(`linzumi mcp server failed: ${e instanceof Error?e.message:String(e)}
174
174
  `),process.exitCode=1}}var av=process.argv[1]!==void 0&&import.meta.url===ev(process.argv[1]).href;av&&rv(process.argv.slice(2));export{tv as mcpServerEntryArgs,rv as runMcpServerEntry};