/home/sylamedg/www/wp-content/plugins/elementor/assets/js/packages/editor-mcp/editor-mcp.min.js
/*! For license information please see editor-mcp.min.js.LICENSE.txt */
!function(){var e={484:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.schema[t],n=e.errSchemaPath+"/"+t,i=(e.opts.allErrors,e.util.toQuotedString(s));return!0===e.opts.$comment?a+=" console.log("+i+");":"function"==typeof e.opts.$comment&&(a+=" self._opts.$comment("+i+", "+e.util.toQuotedString(n)+", validate.root.schema);"),a}},553:function(e){"use strict";e.exports=function(e,t,r){var a,s=" ",n=e.level,i=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(i||""),h=e.opts.$data&&o&&o.$data;if(h?(s+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",a="schema"+n):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+l+".length "+("maxItems"==t?">":"<")+" "+a+") { ";var p=t,m=m||[];m.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxItems"==t?"more":"fewer",s+=" than ",s+=h?"' + "+a+" + '":""+o,s+=" items' "),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var f=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+f+"]); ":s+=" validate.errors = ["+f+"]; return false; ":s+=" var err = "+f+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},705:function(e,t,r){"use strict";e.exports={$ref:r(2776),allOf:r(8203),anyOf:r(8806),$comment:r(484),const:r(3458),contains:r(9372),dependencies:r(7676),enum:r(5736),format:r(2442),if:r(3022),items:r(8665),maximum:r(1525),minimum:r(1525),maxItems:r(553),minItems:r(553),maxLength:r(8601),minLength:r(8601),maxProperties:r(9468),minProperties:r(9468),multipleOf:r(7148),not:r(1948),oneOf:r(2416),pattern:r(4431),properties:r(7276),propertyNames:r(6862),required:r(4720),uniqueItems:r(8484),validate:r(9787)}},955:function(e,t,r){"use strict";var a=r(705),s=r(7710).toHash;e.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"]}],t=["type","$comment"];return e.all=s(t),e.types=s(["number","integer","string","array","object","boolean","null"]),e.forEach(function(r){r.rules=r.rules.map(function(r){var s;if("object"==typeof r){var n=Object.keys(r)[0];s=r[n],r=n,s.forEach(function(r){t.push(r),e.all[r]=!0})}return t.push(r),e.all[r]={keyword:r,code:a[r],implements:s}}),e.all.$comment={keyword:"$comment",code:a.$comment},r.type&&(e.types[r.type]=r)}),e.keywords=s(t.concat(["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"])),e.custom={},e}},1130:function(e){"use strict";e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var r,a="boolean"==typeof t.cycles&&t.cycles,s=t.cmp&&(r=t.cmp,function(e){return function(t,a){var s={key:t,value:e[t]},n={key:a,value:e[a]};return r(s,n)}}),n=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var r,i;if(Array.isArray(t)){for(i="[",r=0;r<t.length;r++)r&&(i+=","),i+=e(t[r])||"null";return i+"]"}if(null===t)return"null";if(-1!==n.indexOf(t)){if(a)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var o=n.push(t)-1,d=Object.keys(t).sort(s&&s(t));for(i="",r=0;r<d.length;r++){var c=d[r],u=e(t[c]);u&&(i&&(i+=","),i+=JSON.stringify(c)+":"+u)}return n.splice(o,1),"{"+i+"}"}}(e)}},1353:function(e,t){!function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length>1){t[0]=t[0].slice(0,-1);for(var a=t.length-1,s=1;s<a;++s)t[s]=t[s].slice(1,-1);return t[a]=t[a].slice(1),t.join("")}return t[0]}function r(e){return"(?:"+e+")"}function a(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function s(e){return e.toUpperCase()}function n(e){var a="[A-Za-z]",s="[0-9]",n=t(s,"[A-Fa-f]"),i=r(r("%[EFef]"+n+"%"+n+n+"%"+n+n)+"|"+r("%[89A-Fa-f]"+n+"%"+n+n)+"|"+r("%"+n+n)),o="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",d=t("[\\:\\/\\?\\#\\[\\]\\@]",o),c=e?"[\\uE000-\\uF8FF]":"[]",u=t(a,s,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),l=r(a+t(a,s,"[\\+\\-\\.]")+"*"),h=r(r(i+"|"+t(u,o,"[\\:]"))+"*"),p=(r(r("25[0-5]")+"|"+r("2[0-4]"+s)+"|"+r("1"+s+s)+"|"+r("[1-9]"+s)+"|"+s),r(r("25[0-5]")+"|"+r("2[0-4]"+s)+"|"+r("1"+s+s)+"|"+r("0?[1-9]"+s)+"|0?0?"+s)),m=r(p+"\\."+p+"\\."+p+"\\."+p),f=r(n+"{1,4}"),g=r(r(f+"\\:"+f)+"|"+m),v=r(r(f+"\\:")+"{6}"+g),y=r("\\:\\:"+r(f+"\\:")+"{5}"+g),_=r(r(f)+"?\\:\\:"+r(f+"\\:")+"{4}"+g),b=r(r(r(f+"\\:")+"{0,1}"+f)+"?\\:\\:"+r(f+"\\:")+"{3}"+g),w=r(r(r(f+"\\:")+"{0,2}"+f)+"?\\:\\:"+r(f+"\\:")+"{2}"+g),x=r(r(r(f+"\\:")+"{0,3}"+f)+"?\\:\\:"+f+"\\:"+g),P=r(r(r(f+"\\:")+"{0,4}"+f)+"?\\:\\:"+g),E=r(r(r(f+"\\:")+"{0,5}"+f)+"?\\:\\:"+f),k=r(r(r(f+"\\:")+"{0,6}"+f)+"?\\:\\:"),S=r([v,y,_,b,w,x,P,E,k].join("|")),R=r(r(u+"|"+i)+"+"),A=(r(S+"\\%25"+R),r(S+r("\\%25|\\%(?!"+n+"{2})")+R)),T=r("[vV]"+n+"+\\."+t(u,o,"[\\:]")+"+"),I=r("\\["+r(A+"|"+S+"|"+T)+"\\]"),O=r(r(i+"|"+t(u,o))+"*"),C=r(I+"|"+m+"(?!"+O+")|"+O),$=r(s+"*"),j=r(r(h+"@")+"?"+C+r("\\:"+$)+"?"),N=r(i+"|"+t(u,o,"[\\:\\@]")),D=r(N+"*"),F=r(N+"+"),Z=r(r(i+"|"+t(u,o,"[\\@]"))+"+"),L=r(r("\\/"+D)+"*"),M=r("\\/"+r(F+L)+"?"),q=r(Z+L),z=r(F+L),U="(?!"+N+")",H=(r(L+"|"+M+"|"+q+"|"+z+"|"+U),r(r(N+"|"+t("[\\/\\?]",c))+"*")),V=r(r(N+"|[\\/\\?]")+"*"),K=r(r("\\/\\/"+j+L)+"|"+M+"|"+z+"|"+U),Q=r(l+"\\:"+K+r("\\?"+H)+"?"+r("\\#"+V)+"?"),G=r(r("\\/\\/"+j+L)+"|"+M+"|"+q+"|"+U),B=r(G+r("\\?"+H)+"?"+r("\\#"+V)+"?");return r(Q+"|"+B),r(l+"\\:"+K+r("\\?"+H)+"?"),r(r("\\/\\/("+r("("+h+")@")+"?("+C+")"+r("\\:("+$+")")+"?)")+"?("+L+"|"+M+"|"+z+"|"+U+")"),r("\\?("+H+")"),r("\\#("+V+")"),r(r("\\/\\/("+r("("+h+")@")+"?("+C+")"+r("\\:("+$+")")+"?)")+"?("+L+"|"+M+"|"+q+"|"+U+")"),r("\\?("+H+")"),r("\\#("+V+")"),r(r("\\/\\/("+r("("+h+")@")+"?("+C+")"+r("\\:("+$+")")+"?)")+"?("+L+"|"+M+"|"+z+"|"+U+")"),r("\\?("+H+")"),r("\\#("+V+")"),r("("+h+")@"),r("\\:("+$+")"),{NOT_SCHEME:new RegExp(t("[^]",a,s,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",u,o),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",u,o),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",u,o),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",u,o),"g"),NOT_QUERY:new RegExp(t("[^\\%]",u,o,"[\\:\\@\\/\\?]",c),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",u,o,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",u,o),"g"),UNRESERVED:new RegExp(u,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",u,d),"g"),PCT_ENCODED:new RegExp(i,"g"),IPV4ADDRESS:new RegExp("^("+m+")$"),IPV6ADDRESS:new RegExp("^\\[?("+S+")"+r(r("\\%25|\\%(?!"+n+"{2})")+"("+R+")")+"?\\]?$")}}var i=n(!1),o=n(!0),d=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],a=!0,s=!1,n=void 0;try{for(var i,o=e[Symbol.iterator]();!(a=(i=o.next()).done)&&(r.push(i.value),!t||r.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{!a&&o.return&&o.return()}finally{if(s)throw n}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},c=2147483647,u=36,l=/^xn--/,h=/[^\0-\x7E]/,p=/[\x2E\u3002\uFF0E\uFF61]/g,m={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,g=String.fromCharCode;function v(e){throw new RangeError(m[e])}function y(e,t){var r=e.split("@"),a="";return r.length>1&&(a=r[0]+"@",e=r[1]),a+function(e,t){for(var r=[],a=e.length;a--;)r[a]=t(e[a]);return r}((e=e.replace(p,".")).split("."),t).join(".")}function _(e){for(var t=[],r=0,a=e.length;r<a;){var s=e.charCodeAt(r++);if(s>=55296&&s<=56319&&r<a){var n=e.charCodeAt(r++);56320==(64512&n)?t.push(((1023&s)<<10)+(1023&n)+65536):(t.push(s),r--)}else t.push(s)}return t}var b=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:u},w=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},x=function(e,t,r){var a=0;for(e=r?f(e/700):e>>1,e+=f(e/t);e>455;a+=u)e=f(e/35);return f(a+36*e/(e+38))},P=function(e){var t=[],r=e.length,a=0,s=128,n=72,i=e.lastIndexOf("-");i<0&&(i=0);for(var o=0;o<i;++o)e.charCodeAt(o)>=128&&v("not-basic"),t.push(e.charCodeAt(o));for(var d=i>0?i+1:0;d<r;){for(var l=a,h=1,p=u;;p+=u){d>=r&&v("invalid-input");var m=b(e.charCodeAt(d++));(m>=u||m>f((c-a)/h))&&v("overflow"),a+=m*h;var g=p<=n?1:p>=n+26?26:p-n;if(m<g)break;var y=u-g;h>f(c/y)&&v("overflow"),h*=y}var _=t.length+1;n=x(a-l,_,0==l),f(a/_)>c-s&&v("overflow"),s+=f(a/_),a%=_,t.splice(a++,0,s)}return String.fromCodePoint.apply(String,t)},E=function(e){var t=[],r=(e=_(e)).length,a=128,s=0,n=72,i=!0,o=!1,d=void 0;try{for(var l,h=e[Symbol.iterator]();!(i=(l=h.next()).done);i=!0){var p=l.value;p<128&&t.push(g(p))}}catch(e){o=!0,d=e}finally{try{!i&&h.return&&h.return()}finally{if(o)throw d}}var m=t.length,y=m;for(m&&t.push("-");y<r;){var b=c,P=!0,E=!1,k=void 0;try{for(var S,R=e[Symbol.iterator]();!(P=(S=R.next()).done);P=!0){var A=S.value;A>=a&&A<b&&(b=A)}}catch(e){E=!0,k=e}finally{try{!P&&R.return&&R.return()}finally{if(E)throw k}}var T=y+1;b-a>f((c-s)/T)&&v("overflow"),s+=(b-a)*T,a=b;var I=!0,O=!1,C=void 0;try{for(var $,j=e[Symbol.iterator]();!(I=($=j.next()).done);I=!0){var N=$.value;if(N<a&&++s>c&&v("overflow"),N==a){for(var D=s,F=u;;F+=u){var Z=F<=n?1:F>=n+26?26:F-n;if(D<Z)break;var L=D-Z,M=u-Z;t.push(g(w(Z+L%M,0))),D=f(L/M)}t.push(g(w(D,0))),n=x(s,T,y==m),s=0,++y}}}catch(e){O=!0,C=e}finally{try{!I&&j.return&&j.return()}finally{if(O)throw C}}++s,++a}return t.join("")},k=function(e){return y(e,function(e){return h.test(e)?"xn--"+E(e):e})},S=function(e){return y(e,function(e){return l.test(e)?P(e.slice(4).toLowerCase()):e})},R={};function A(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function T(e){for(var t="",r=0,a=e.length;r<a;){var s=parseInt(e.substr(r+1,2),16);if(s<128)t+=String.fromCharCode(s),r+=3;else if(s>=194&&s<224){if(a-r>=6){var n=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&s)<<6|63&n)}else t+=e.substr(r,6);r+=6}else if(s>=224){if(a-r>=9){var i=parseInt(e.substr(r+4,2),16),o=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function I(e,t){function r(e){var r=T(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,A).replace(t.PCT_ENCODED,s)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,A).replace(t.PCT_ENCODED,s)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,A).replace(t.PCT_ENCODED,s)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,A).replace(t.PCT_ENCODED,s)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,A).replace(t.PCT_ENCODED,s)),e}function O(e){return e.replace(/^0*(.*)/,"$1")||"0"}function C(e,t){var r=e.match(t.IPV4ADDRESS)||[],a=d(r,2)[1];return a?a.split(".").map(O).join("."):e}function $(e,t){var r=e.match(t.IPV6ADDRESS)||[],a=d(r,3),s=a[1],n=a[2];if(s){for(var i=s.toLowerCase().split("::").reverse(),o=d(i,2),c=o[0],u=o[1],l=u?u.split(":").map(O):[],h=c.split(":").map(O),p=t.IPV4ADDRESS.test(h[h.length-1]),m=p?7:8,f=h.length-m,g=Array(m),v=0;v<m;++v)g[v]=l[v]||h[f+v]||"";p&&(g[m-1]=C(g[m-1],t));var y=g.reduce(function(e,t,r){if(!t||"0"===t){var a=e[e.length-1];a&&a.index+a.length===r?a.length++:e.push({index:r,length:1})}return e},[]).sort(function(e,t){return t.length-e.length})[0],_=void 0;if(y&&y.length>1){var b=g.slice(0,y.index),w=g.slice(y.index+y.length);_=b.join(":")+"::"+w.join(":")}else _=g.join(":");return n&&(_+="%"+n),_}return e}var j=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,N=void 0==="".match(/(){0}/)[1];function D(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},a=!1!==t.iri?o:i;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var s=e.match(j);if(s){N?(r.scheme=s[1],r.userinfo=s[3],r.host=s[4],r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=s[7],r.fragment=s[8],isNaN(r.port)&&(r.port=s[5])):(r.scheme=s[1]||void 0,r.userinfo=-1!==e.indexOf("@")?s[3]:void 0,r.host=-1!==e.indexOf("//")?s[4]:void 0,r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=-1!==e.indexOf("?")?s[7]:void 0,r.fragment=-1!==e.indexOf("#")?s[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?s[4]:void 0)),r.host&&(r.host=$(C(r.host,a),a)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var n=R[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||n&&n.unicodeSupport)I(r,a);else{if(r.host&&(t.domainHost||n&&n.domainHost))try{r.host=k(r.host.replace(a.PCT_ENCODED,T).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}I(r,i)}n&&n.parse&&n.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}var F=/^\.\.?\//,Z=/^\/\.(\/|$)/,L=/^\/\.\.(\/|$)/,M=/^\/?(?:.|\n)*?(?=\/|$)/;function q(e){for(var t=[];e.length;)if(e.match(F))e=e.replace(F,"");else if(e.match(Z))e=e.replace(Z,"/");else if(e.match(L))e=e.replace(L,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(M);if(!r)throw new Error("Unexpected dot segment condition");var a=r[0];e=e.slice(a.length),t.push(a)}return t.join("")}function z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?o:i,a=[],s=R[(t.scheme||e.scheme||"").toLowerCase()];if(s&&s.serialize&&s.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||s&&s.domainHost)try{e.host=t.iri?S(e.host):k(e.host.replace(r.PCT_ENCODED,T).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}I(e,r),"suffix"!==t.reference&&e.scheme&&(a.push(e.scheme),a.push(":"));var n=function(e,t){var r=!1!==t.iri?o:i,a=[];return void 0!==e.userinfo&&(a.push(e.userinfo),a.push("@")),void 0!==e.host&&a.push($(C(String(e.host),r),r).replace(r.IPV6ADDRESS,function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"})),"number"!=typeof e.port&&"string"!=typeof e.port||(a.push(":"),a.push(String(e.port))),a.length?a.join(""):void 0}(e,t);if(void 0!==n&&("suffix"!==t.reference&&a.push("//"),a.push(n),e.path&&"/"!==e.path.charAt(0)&&a.push("/")),void 0!==e.path){var d=e.path;t.absolutePath||s&&s.absolutePath||(d=q(d)),void 0===n&&(d=d.replace(/^\/\//,"/%2F")),a.push(d)}return void 0!==e.query&&(a.push("?"),a.push(e.query)),void 0!==e.fragment&&(a.push("#"),a.push(e.fragment)),a.join("")}function U(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a={};return arguments[3]||(e=D(z(e,r),r),t=D(z(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=q(t.path||""),a.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=q(t.path||""),a.query=t.query):(t.path?("/"===t.path.charAt(0)?a.path=q(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:a.path=t.path:a.path="/"+t.path,a.path=q(a.path)),a.query=t.query):(a.path=e.path,void 0!==t.query?a.query=t.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function H(e,t){return e&&e.toString().replace(t&&t.iri?o.PCT_ENCODED:i.PCT_ENCODED,T)}var V={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},K={scheme:"https",domainHost:V.domainHost,parse:V.parse,serialize:V.serialize};function Q(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var G={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=Q(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(Q(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),a=d(r,2),s=a[0],n=a[1];e.path=s&&"/"!==s?s:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}},B={scheme:"wss",domainHost:G.domainHost,parse:G.parse,serialize:G.serialize},W={},J="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Y="[0-9A-Fa-f]",X=r(r("%[EFef]"+Y+"%"+Y+Y+"%"+Y+Y)+"|"+r("%[89A-Fa-f]"+Y+"%"+Y+Y)+"|"+r("%"+Y+Y)),ee=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),te=new RegExp(J,"g"),re=new RegExp(X,"g"),ae=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',ee),"g"),se=new RegExp(t("[^]",J,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ne=se;function ie(e){var t=T(e);return t.match(te)?t:e}var oe={scheme:"mailto",parse:function(e,t){var r=e,a=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var s=!1,n={},i=r.query.split("&"),o=0,d=i.length;o<d;++o){var c=i[o].split("=");switch(c[0]){case"to":for(var u=c[1].split(","),l=0,h=u.length;l<h;++l)a.push(u[l]);break;case"subject":r.subject=H(c[1],t);break;case"body":r.body=H(c[1],t);break;default:s=!0,n[H(c[0],t)]=H(c[1],t)}}s&&(r.headers=n)}r.query=void 0;for(var p=0,m=a.length;p<m;++p){var f=a[p].split("@");if(f[0]=H(f[0]),t.unicodeSupport)f[1]=H(f[1],t).toLowerCase();else try{f[1]=k(H(f[1],t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}a[p]=f.join("@")}return r},serialize:function(e,t){var r,a=e,n=null!=(r=e.to)?r instanceof Array?r:"number"!=typeof r.length||r.split||r.setInterval||r.call?[r]:Array.prototype.slice.call(r):[];if(n){for(var i=0,o=n.length;i<o;++i){var d=String(n[i]),c=d.lastIndexOf("@"),u=d.slice(0,c).replace(re,ie).replace(re,s).replace(ae,A),l=d.slice(c+1);try{l=t.iri?S(l):k(H(l,t).toLowerCase())}catch(e){a.error=a.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}n[i]=u+"@"+l}a.path=n.join(",")}var h=e.headers=e.headers||{};e.subject&&(h.subject=e.subject),e.body&&(h.body=e.body);var p=[];for(var m in h)h[m]!==W[m]&&p.push(m.replace(re,ie).replace(re,s).replace(se,A)+"="+h[m].replace(re,ie).replace(re,s).replace(ne,A));return p.length&&(a.query=p.join("&")),a}},de=/^([^\:]+)\:(.*)/,ce={scheme:"urn",parse:function(e,t){var r=e.path&&e.path.match(de),a=e;if(r){var s=t.scheme||a.scheme||"urn",n=r[1].toLowerCase(),i=r[2],o=s+":"+(t.nid||n),d=R[o];a.nid=n,a.nss=i,a.path=void 0,d&&(a=d.parse(a,t))}else a.error=a.error||"URN can not be parsed.";return a},serialize:function(e,t){var r=t.scheme||e.scheme||"urn",a=e.nid,s=r+":"+(t.nid||a),n=R[s];n&&(e=n.serialize(e,t));var i=e,o=e.nss;return i.path=(a||t.nid)+":"+o,i}},ue=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,le={scheme:"urn:uuid",parse:function(e,t){var r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&r.uuid.match(ue)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e,t){var r=e;return r.nss=(e.uuid||"").toLowerCase(),r}};R[V.scheme]=V,R[K.scheme]=K,R[G.scheme]=G,R[B.scheme]=B,R[oe.scheme]=oe,R[ce.scheme]=ce,R[le.scheme]=le,e.SCHEMES=R,e.pctEncChar=A,e.pctDecChars=T,e.parse=D,e.removeDotSegments=q,e.serialize=z,e.resolveComponents=U,e.resolve=function(e,t,r){var a=function(e,t){var r=e;if(t)for(var a in t)r[a]=t[a];return r}({scheme:"null"},r);return z(U(D(e,a),D(t,a),a,!0),a)},e.normalize=function(e,t){return"string"==typeof e?e=z(D(e,t),t):"object"===a(e)&&(e=D(z(e,t),t)),e},e.equal=function(e,t,r){return"string"==typeof e?e=z(D(e,r),r):"object"===a(e)&&(e=z(e,r)),"string"==typeof t?t=z(D(t,r),r):"object"===a(t)&&(t=z(t,r)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?o.ESCAPE:i.ESCAPE,A)},e.unescapeComponent=H,Object.defineProperty(e,"__esModule",{value:!0})}(t)},1373:function(e,t,r){"use strict";var a=/^[a-z_$][a-z0-9_$-]*$/i,s=r(9602),n=r(6351);e.exports={add:function(e,t){var r=this.RULES;if(r.keywords[e])throw new Error("Keyword "+e+" is already defined");if(!a.test(e))throw new Error("Keyword "+e+" is not a valid identifier");if(t){this.validateKeyword(t,!0);var n=t.type;if(Array.isArray(n))for(var i=0;i<n.length;i++)d(e,n[i],t);else d(e,n,t);var o=t.metaSchema;o&&(t.$data&&this._opts.$data&&(o={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),t.validateSchema=this.compile(o,!0))}function d(e,t,a){for(var n,i=0;i<r.length;i++){var o=r[i];if(o.type==t){n=o;break}}n||(n={type:t,rules:[]},r.push(n));var d={keyword:e,definition:a,custom:!0,code:s,implements:a.implements};n.rules.push(d),r.custom[e]=d}return r.keywords[e]=r.all[e]=!0,this},get:function(e){var t=this.RULES.custom[e];return t?t.definition:this.RULES.keywords[e]||!1},remove:function(e){var t=this.RULES;delete t.keywords[e],delete t.all[e],delete t.custom[e];for(var r=0;r<t.length;r++)for(var a=t[r].rules,s=0;s<a.length;s++)if(a[s].keyword==e){a.splice(s,1);break}return this},validate:function e(t,r){e.errors=null;var a=this._validateKeyword=this._validateKeyword||this.compile(n,!0);if(a(t))return!0;if(e.errors=a.errors,r)throw new Error("custom keyword definition is invalid: "+this.errorsText(a.errors));return!1}}},1525:function(e){"use strict";e.exports=function(e,t,r){var a,s=" ",n=e.level,i=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(i||""),h=e.opts.$data&&o&&o.$data;h?(s+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",a="schema"+n):a=o;var p="maximum"==t,m=p?"exclusiveMaximum":"exclusiveMinimum",f=e.schema[m],g=e.opts.$data&&f&&f.$data,v=p?"<":">",y=p?">":"<",_=void 0;if(!h&&"number"!=typeof o&&void 0!==o)throw new Error(t+" must be number");if(!g&&void 0!==f&&"number"!=typeof f&&"boolean"!=typeof f)throw new Error(m+" must be number or boolean");if(g){var b,w=e.util.getData(f.$data,i,e.dataPathArr),x="exclusive"+n,P="exclType"+n,E="exclIsNumber"+n,k="' + "+(R="op"+n)+" + '";s+=" var schemaExcl"+n+" = "+w+"; ",s+=" var "+x+"; var "+P+" = typeof "+(w="schemaExcl"+n)+"; if ("+P+" != 'boolean' && "+P+" != 'undefined' && "+P+" != 'number') { ",_=m,(b=b||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(_||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",!1!==e.opts.messages&&(s+=" , message: '"+m+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var S=s;s=b.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+S+"]); ":s+=" validate.errors = ["+S+"]; return false; ":s+=" var err = "+S+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+P+" == 'number' ? ( ("+x+" = "+a+" === undefined || "+w+" "+v+"= "+a+") ? "+l+" "+y+"= "+w+" : "+l+" "+y+" "+a+" ) : ( ("+x+" = "+w+" === true) ? "+l+" "+y+"= "+a+" : "+l+" "+y+" "+a+" ) || "+l+" !== "+l+") { var op"+n+" = "+x+" ? '"+v+"' : '"+v+"='; ",void 0===o&&(_=m,c=e.errSchemaPath+"/"+m,a=w,h=g)}else if(k=v,(E="number"==typeof f)&&h){var R="'"+k+"'";s+=" if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ( "+a+" === undefined || "+f+" "+v+"= "+a+" ? "+l+" "+y+"= "+f+" : "+l+" "+y+" "+a+" ) || "+l+" !== "+l+") { "}else E&&void 0===o?(x=!0,_=m,c=e.errSchemaPath+"/"+m,a=f,y+="="):(E&&(a=Math[p?"min":"max"](f,o)),f===(!E||a)?(x=!0,_=m,c=e.errSchemaPath+"/"+m,y+="="):(x=!1,k+="=")),R="'"+k+"'",s+=" if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+l+" "+y+" "+a+" || "+l+" !== "+l+") { ";return _=_||t,(b=b||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(_||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+R+", limit: "+a+", exclusive: "+x+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be "+k+" ",s+=h?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ",S=s,s=b.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+S+"]); ":s+=" validate.errors = ["+S+"]; return false; ":s+=" var err = "+S+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s}},1688:function(e){"use strict";var t=e.exports=function(){this._cache={}};t.prototype.put=function(e,t){this._cache[e]=t},t.prototype.get=function(e){return this._cache[e]},t.prototype.del=function(e){delete this._cache[e]},t.prototype.clear=function(){this._cache={}}},1780:function(e){"use strict";e.exports=JSON.parse('{"$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":true,"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":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"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":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"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":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"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":true}')},1948:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="errs__"+s,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(e.opts.strictKeywords?"object"==typeof i&&Object.keys(i).length>0||!1===i:e.util.schemaHasRules(i,e.RULES.all)){h.schema=i,h.schemaPath=o,h.errSchemaPath=d,a+=" var "+l+" = errors;  ";var m,f=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1,h.opts.allErrors&&(m=h.opts.allErrors,h.opts.allErrors=!1),a+=" "+e.validate(h)+" ",h.createErrors=!0,m&&(h.opts.allErrors=m),e.compositeRule=h.compositeRule=f,a+=" if ("+p+") {   ";var g=g||[];g.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var v=a;a=g.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else {  errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+="  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(a+=" if (false) { ");return a}},2416:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,g=p.baseId,v="prevValid"+s,y="passingSchemas"+s;a+="var "+h+" = errors , "+v+" = false , "+l+" = false , "+y+" = null; ";var _=e.compositeRule;e.compositeRule=p.compositeRule=!0;var b=i;if(b)for(var w,x=-1,P=b.length-1;x<P;)w=b[x+=1],(e.opts.strictKeywords?"object"==typeof w&&Object.keys(w).length>0||!1===w:e.util.schemaHasRules(w,e.RULES.all))?(p.schema=w,p.schemaPath=o+"["+x+"]",p.errSchemaPath=d+"/"+x,a+="  "+e.validate(p)+" ",p.baseId=g):a+=" var "+f+" = true; ",x&&(a+=" if ("+f+" && "+v+") { "+l+" = false; "+y+" = ["+y+", "+x+"]; } else { ",m+="}"),a+=" if ("+f+") { "+l+" = "+v+" = true; "+y+" = "+x+"; }";return e.compositeRule=p.compositeRule=_,a+=m+"if (!"+l+") {   var err =   ",!1!==e.createErrors?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { passingSchemas: "+y+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else {  errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a}},2442:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||"");if(!1===e.opts.format)return c&&(a+=" if (true) { "),a;var l,h=e.opts.$data&&i&&i.$data;h?(a+=" var schema"+s+" = "+e.util.getData(i.$data,n,e.dataPathArr)+"; ",l="schema"+s):l=i;var p=e.opts.unknownFormats,m=Array.isArray(p);if(h)a+=" var "+(f="format"+s)+" = formats["+l+"]; var "+(g="isObject"+s)+" = typeof "+f+" == 'object' && !("+f+" instanceof RegExp) && "+f+".validate; var "+(v="formatType"+s)+" = "+g+" && "+f+".type || 'string'; if ("+g+") { ",e.async&&(a+=" var async"+s+" = "+f+".async; "),a+=" "+f+" = "+f+".validate; } if (  ",h&&(a+=" ("+l+" !== undefined && typeof "+l+" != 'string') || "),a+=" (","ignore"!=p&&(a+=" ("+l+" && !"+f+" ",m&&(a+=" && self._opts.unknownFormats.indexOf("+l+") == -1 "),a+=") || "),a+=" ("+f+" && "+v+" == '"+r+"' && !(typeof "+f+" == 'function' ? ",e.async?a+=" (async"+s+" ? await "+f+"("+u+") : "+f+"("+u+")) ":a+=" "+f+"("+u+") ",a+=" : "+f+".test("+u+"))))) {";else{var f;if(!(f=e.formats[i])){if("ignore"==p)return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),c&&(a+=" if (true) { "),a;if(m&&p.indexOf(i)>=0)return c&&(a+=" if (true) { "),a;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var g,v=(g="object"==typeof f&&!(f instanceof RegExp)&&f.validate)&&f.type||"string";if(g){var y=!0===f.async;f=f.validate}if(v!=r)return c&&(a+=" if (true) { "),a;if(y){if(!e.async)throw new Error("async format in sync schema");a+=" if (!(await "+(_="formats"+e.util.getProperty(i)+".validate")+"("+u+"))) { "}else{a+=" if (! ";var _="formats"+e.util.getProperty(i);g&&(_+=".validate"),a+="function"==typeof f?" "+_+"("+u+") ":" "+_+".test("+u+") ",a+=") { "}}var b=b||[];b.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { format:  ",a+=h?""+l:""+e.util.toQuotedString(i),a+="  } ",!1!==e.opts.messages&&(a+=" , message: 'should match format \"",a+=h?"' + "+l+" + '":""+e.util.escapeQuotes(i),a+="\"' "),e.opts.verbose&&(a+=" , schema:  ",a+=h?"validate.schema"+o:""+e.util.toQuotedString(i),a+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var w=a;return a=b.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { "),a}},2776:function(e){"use strict";e.exports=function(e,t,r){var a,s,n=" ",i=e.level,o=e.dataLevel,d=e.schema[t],c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(o||""),h="valid"+i;if("#"==d||"#/"==d)e.isRoot?(a=e.async,s="validate"):(a=!0===e.root.schema.$async,s="root.refVal[0]");else{var p=e.resolveRef(e.baseId,d,e.isRoot);if(void 0===p){var m=e.MissingRefError.message(e.baseId,d);if("fail"==e.opts.missingRefs){e.logger.error(m),(y=y||[]).push(n),n="",!1!==e.createErrors?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(d)+"' } ",!1!==e.opts.messages&&(n+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(d)+"' "),e.opts.verbose&&(n+=" , schema: "+e.util.toQuotedString(d)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),n+=" } "):n+=" {} ";var f=n;n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+f+"]); ":n+=" validate.errors = ["+f+"]; return false; ":n+=" var err = "+f+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs)throw new e.MissingRefError(e.baseId,d,m);e.logger.warn(m),u&&(n+=" if (true) { ")}}else if(p.inline){var g=e.util.copy(e);g.level++;var v="valid"+g.level;g.schema=p.schema,g.schemaPath="",g.errSchemaPath=d,n+=" "+e.validate(g).replace(/validate\.schema/g,p.code)+" ",u&&(n+=" if ("+v+") { ")}else a=!0===p.$async||e.async&&!1!==p.$async,s=p.code}if(s){var y;(y=y||[]).push(n),n="",e.opts.passContext?n+=" "+s+".call(this, ":n+=" "+s+"( ",n+=" "+l+", (dataPath || '')",'""'!=e.errorPath&&(n+=" + "+e.errorPath);var _=n+=" , "+(o?"data"+(o-1||""):"parentData")+" , "+(o?e.dataPathArr[o]:"parentDataProperty")+", rootData)  ";if(n=y.pop(),a){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(n+=" var "+h+"; "),n+=" try { await "+_+"; ",u&&(n+=" "+h+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(n+=" "+h+" = false; "),n+=" } ",u&&(n+=" if ("+h+") { ")}else n+=" if (!"+_+") { if (vErrors === null) vErrors = "+s+".errors; else vErrors = vErrors.concat("+s+".errors); errors = vErrors.length; } ",u&&(n+=" else { ")}return n}},3020:function(e){"use strict";var t=e.exports=function(e,t,a){"function"==typeof t&&(a=t,t={}),r(t,"function"==typeof(a=t.cb||a)?a:a.pre||function(){},a.post||function(){},e,"",e)};function r(e,s,n,i,o,d,c,u,l,h){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var p in s(i,o,d,c,u,l,h),i){var m=i[p];if(Array.isArray(m)){if(p in t.arrayKeywords)for(var f=0;f<m.length;f++)r(e,s,n,m[f],o+"/"+p+"/"+f,d,o,p,i,f)}else if(p in t.propsKeywords){if(m&&"object"==typeof m)for(var g in m)r(e,s,n,m[g],o+"/"+p+"/"+a(g),d,o,p,i,g)}else(p in t.keywords||e.allKeys&&!(p in t.skipKeywords))&&r(e,s,n,m,o+"/"+p,d,o,p,i)}n(i,o,d,c,u,l,h)}}function a(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.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}},3022:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e);p.level++;var m="valid"+p.level,f=e.schema.then,g=e.schema.else,v=void 0!==f&&(e.opts.strictKeywords?"object"==typeof f&&Object.keys(f).length>0||!1===f:e.util.schemaHasRules(f,e.RULES.all)),y=void 0!==g&&(e.opts.strictKeywords?"object"==typeof g&&Object.keys(g).length>0||!1===g:e.util.schemaHasRules(g,e.RULES.all)),_=p.baseId;if(v||y){var b;p.createErrors=!1,p.schema=i,p.schemaPath=o,p.errSchemaPath=d,a+=" var "+h+" = errors; var "+l+" = true;  ";var w=e.compositeRule;e.compositeRule=p.compositeRule=!0,a+="  "+e.validate(p)+" ",p.baseId=_,p.createErrors=!0,a+="  errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }  ",e.compositeRule=p.compositeRule=w,v?(a+=" if ("+m+") {  ",p.schema=e.schema.then,p.schemaPath=e.schemaPath+".then",p.errSchemaPath=e.errSchemaPath+"/then",a+="  "+e.validate(p)+" ",p.baseId=_,a+=" "+l+" = "+m+"; ",v&&y?a+=" var "+(b="ifClause"+s)+" = 'then'; ":b="'then'",a+=" } ",y&&(a+=" else { ")):a+=" if (!"+m+") { ",y&&(p.schema=e.schema.else,p.schemaPath=e.schemaPath+".else",p.errSchemaPath=e.errSchemaPath+"/else",a+="  "+e.validate(p)+" ",p.baseId=_,a+=" "+l+" = "+m+"; ",v&&y?a+=" var "+(b="ifClause"+s)+" = 'else'; ":b="'else'",a+=" } "),a+=" if (!"+l+") {   var err =   ",!1!==e.createErrors?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { failingKeyword: "+b+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match \"' + "+b+" + '\" schema' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" }   ",c&&(a+=" else { ")}else c&&(a+=" if (true) { ");return a}},3204:function(e,t,r){"use strict";var a=r(1353),s=r(8991),n=r(7710),i=r(3867),o=r(3020);function d(e,t,r){var a=this._refs[r];if("string"==typeof a){if(!this._refs[a])return d.call(this,e,t,a);a=this._refs[a]}if((a=a||this._schemas[r])instanceof i)return m(a.schema,this._opts.inlineRefs)?a.schema:a.validate||this._compile(a);var s,n,o,u=c.call(this,t,r);return u&&(s=u.schema,t=u.root,o=u.baseId),s instanceof i?n=s.validate||e.call(this,s.schema,t,void 0,o):void 0!==s&&(n=m(s,this._opts.inlineRefs)?s:e.call(this,s,t,void 0,o)),n}function c(e,t){var r=a.parse(t),s=y(r),n=v(this._getId(e.schema));if(0===Object.keys(e.schema).length||s!==n){var o=b(s),d=this._refs[o];if("string"==typeof d)return u.call(this,e,d,r);if(d instanceof i)d.validate||this._compile(d),e=d;else{if(!((d=this._schemas[o])instanceof i))return;if(d.validate||this._compile(d),o==b(t))return{schema:d,root:e,baseId:n};e=d}if(!e.schema)return;n=v(this._getId(e.schema))}return h.call(this,r,n,e.schema,e)}function u(e,t,r){var a=c.call(this,e,t);if(a){var s=a.schema,n=a.baseId;e=a.root;var i=this._getId(s);return i&&(n=w(n,i)),h.call(this,r,n,s,e)}}e.exports=d,d.normalizeId=b,d.fullPath=v,d.url=w,d.ids=function(e){var t=b(this._getId(e)),r={"":t},i={"":v(t,!1)},d={},c=this;return o(e,{allKeys:!0},function(e,t,o,u,l,h,p){if(""!==t){var m=c._getId(e),f=r[u],g=i[u]+"/"+l;if(void 0!==p&&(g+="/"+("number"==typeof p?p:n.escapeFragment(p))),"string"==typeof m){m=f=b(f?a.resolve(f,m):m);var v=c._refs[m];if("string"==typeof v&&(v=c._refs[v]),v&&v.schema){if(!s(e,v.schema))throw new Error('id "'+m+'" resolves to more than one schema')}else if(m!=b(g))if("#"==m[0]){if(d[m]&&!s(e,d[m]))throw new Error('id "'+m+'" resolves to more than one schema');d[m]=e}else c._refs[m]=g}r[t]=f,i[t]=g}}),d},d.inlineRef=m,d.schema=c;var l=n.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function h(e,t,r,a){if(e.fragment=e.fragment||"","/"==e.fragment.slice(0,1)){for(var s=e.fragment.split("/"),i=1;i<s.length;i++){var o=s[i];if(o){if(void 0===(r=r[o=n.unescapeFragment(o)]))break;var d;if(!l[o]&&((d=this._getId(r))&&(t=w(t,d)),r.$ref)){var u=w(t,r.$ref),h=c.call(this,a,u);h&&(r=h.schema,a=h.root,t=h.baseId)}}}return void 0!==r&&r!==a.schema?{schema:r,root:a,baseId:t}:void 0}}var p=n.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function m(e,t){return!1!==t&&(void 0===t||!0===t?f(e):t?g(e)<=t:void 0)}function f(e){var t;if(Array.isArray(e)){for(var r=0;r<e.length;r++)if("object"==typeof(t=e[r])&&!f(t))return!1}else for(var a in e){if("$ref"==a)return!1;if("object"==typeof(t=e[a])&&!f(t))return!1}return!0}function g(e){var t,r=0;if(Array.isArray(e)){for(var a=0;a<e.length;a++)if("object"==typeof(t=e[a])&&(r+=g(t)),r==1/0)return 1/0}else for(var s in e){if("$ref"==s)return 1/0;if(p[s])r++;else if("object"==typeof(t=e[s])&&(r+=g(t)+1),r==1/0)return 1/0}return r}function v(e,t){return!1!==t&&(e=b(e)),y(a.parse(e))}function y(e){return a.serialize(e).split("#")[0]+"#"}var _=/#\/?$/;function b(e){return e?e.replace(_,""):""}function w(e,t){return t=b(t),a.resolve(e,t)}},3458:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="valid"+s,h=e.opts.$data&&i&&i.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(i.$data,n,e.dataPathArr)+"; "),h||(a+=" var schema"+s+" = validate.schema"+o+";"),a+="var "+l+" = equal("+u+", schema"+s+"); if (!"+l+") {   ";var p=p||[];p.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { allowedValue: schema"+s+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var m=a;return a=p.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+m+"]); ":a+=" validate.errors = ["+m+"]; return false; ":a+=" var err = "+m+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",c&&(a+=" else { "),a}},3497:function(e,t,r){"use strict";var a=r(3204);function s(e,t,r){this.message=r||s.message(e,t),this.missingRef=a.url(e,t),this.missingSchema=a.normalizeId(a.fullPath(this.missingRef))}function n(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}e.exports={Validation:n(function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0}),MissingRef:n(s)},s.message=function(e,t){return"can't resolve reference "+t+" from id "+e}},3867:function(e,t,r){"use strict";var a=r(7710);e.exports=function(e){a.copy(e,this)}},4324:function(e){"use strict";var t=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];e.exports=function(e,r){for(var a=0;a<r.length;a++){e=JSON.parse(JSON.stringify(e));var s,n=r[a].split("/"),i=e;for(s=1;s<n.length;s++)i=i[n[s]];for(s=0;s<t.length;s++){var o=t[s],d=i[o];d&&(i[o]={anyOf:[d,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return e}},4431:function(e){"use strict";e.exports=function(e,t,r){var a,s=" ",n=e.level,i=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(i||""),h=e.opts.$data&&o&&o.$data;h?(s+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",a="schema"+n):a=o,s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'string') || "),s+=" !"+(h?"(new RegExp("+a+"))":e.usePattern(o))+".test("+l+") ) {   ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern:  ",s+=h?""+a:""+e.util.toQuotedString(o),s+="  } ",!1!==e.opts.messages&&(s+=" , message: 'should match pattern \"",s+=h?"' + "+a+" + '":""+e.util.escapeQuotes(o),s+="\"' "),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+e.util.toQuotedString(o),s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},4720:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="valid"+s,h=e.opts.$data&&i&&i.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(i.$data,n,e.dataPathArr)+"; ");var p="schema"+s;if(!h)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var m=[],f=i;if(f)for(var g,v=-1,y=f.length-1;v<y;){g=f[v+=1];var _=e.schema.properties[g];_&&(e.opts.strictKeywords?"object"==typeof _&&Object.keys(_).length>0||!1===_:e.util.schemaHasRules(_,e.RULES.all))||(m[m.length]=g)}}else m=i;if(h||m.length){var b=e.errorPath,w=h||m.length>=e.opts.loopRequired,x=e.opts.ownProperties;if(c)if(a+=" var missing"+s+"; ",w){h||(a+=" var "+p+" = validate.schema"+o+"; ");var P="' + "+(T="schema"+s+"["+(R="i"+s)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(b,T,e.opts.jsonPointers)),a+=" var "+l+" = true; ",h&&(a+=" if (schema"+s+" === undefined) "+l+" = true; else if (!Array.isArray(schema"+s+")) "+l+" = false; else {"),a+=" for (var "+R+" = 0; "+R+" < "+p+".length; "+R+"++) { "+l+" = "+u+"["+p+"["+R+"]] !== undefined ",x&&(a+=" &&   Object.prototype.hasOwnProperty.call("+u+", "+p+"["+R+"]) "),a+="; if (!"+l+") break; } ",h&&(a+="  }  "),a+="  if (!"+l+") {   ",(k=k||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var E=a;a=k.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+E+"]); ":a+=" validate.errors = ["+E+"]; return false; ":a+=" var err = "+E+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var k,S=m;if(S)for(var R=-1,A=S.length-1;R<A;)O=S[R+=1],R&&(a+=" || "),a+=" ( ( "+(N=u+(j=e.util.getProperty(O)))+" === undefined ",x&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(O)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?O:j)+") ) ";a+=") {  ",P="' + "+(T="missing"+s)+" + '",e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(b,T,!0):b+" + "+T),(k=k||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",E=a,a=k.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+E+"]); ":a+=" validate.errors = ["+E+"]; return false; ":a+=" var err = "+E+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(w){var T;h||(a+=" var "+p+" = validate.schema"+o+"; "),P="' + "+(T="schema"+s+"["+(R="i"+s)+"]")+" + '",e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(b,T,e.opts.jsonPointers)),h&&(a+=" if ("+p+" && !Array.isArray("+p+")) {  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+p+" !== undefined) { "),a+=" for (var "+R+" = 0; "+R+" < "+p+".length; "+R+"++) { if ("+u+"["+p+"["+R+"]] === undefined ",x&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", "+p+"["+R+"]) "),a+=") {  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(a+="  }  ")}else{var I=m;if(I)for(var O,C=-1,$=I.length-1;C<$;){O=I[C+=1];var j=e.util.getProperty(O),N=(P=e.util.escapeQuotes(O),u+j);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(b,O,e.opts.jsonPointers)),a+=" if ( "+N+" === undefined ",x&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(O)+"') "),a+=") {  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=b}else c&&(a+=" if (true) {");return a}},5736:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="valid"+s,h=e.opts.$data&&i&&i.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(i.$data,n,e.dataPathArr)+"; ");var p="i"+s,m="schema"+s;h||(a+=" var "+m+" = validate.schema"+o+";"),a+="var "+l+";",h&&(a+=" if (schema"+s+" === undefined) "+l+" = true; else if (!Array.isArray(schema"+s+")) "+l+" = false; else {"),a+=l+" = false;for (var "+p+"=0; "+p+"<"+m+".length; "+p+"++) if (equal("+u+", "+m+"["+p+"])) { "+l+" = true; break; }",h&&(a+="  }  "),a+=" if (!"+l+") {   ";var f=f||[];f.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { allowedValues: schema"+s+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var g=a;return a=f.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",c&&(a+=" else { "),a}},6351:function(e,t,r){"use strict";var a=r(1780);e.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:a.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:a.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"}]}}}},6540:function(e,t,r){"use strict";var a=r(3204),s=r(7710),n=r(3497),i=r(1130),o=r(9787),d=s.ucs2length,c=r(8991),u=n.Validation;function l(e,t,r){var a=p.call(this,e,t,r);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:t,baseId:r},{index:a,compiling:!1})}function h(e,t,r){var a=p.call(this,e,t,r);a>=0&&this._compilations.splice(a,1)}function p(e,t,r){for(var a=0;a<this._compilations.length;a++){var s=this._compilations[a];if(s.schema==e&&s.root==t&&s.baseId==r)return a}return-1}function m(e,t){return"var pattern"+e+" = new RegExp("+s.toQuotedString(t[e])+");"}function f(e){return"var default"+e+" = defaults["+e+"];"}function g(e,t){return void 0===t[e]?"":"var refVal"+e+" = refVal["+e+"];"}function v(e){return"var customRule"+e+" = customRules["+e+"];"}function y(e,t){if(!e.length)return"";for(var r="",a=0;a<e.length;a++)r+=t(a,e);return r}e.exports=function e(t,r,p,_){var b=this,w=this._opts,x=[void 0],P={},E=[],k={},S=[],R={},A=[];r=r||{schema:t,refVal:x,refs:P};var T=l.call(this,t,r,_),I=this._compilations[T.index];if(T.compiling)return I.callValidate=function e(){var t=I.validate,r=t.apply(this,arguments);return e.errors=t.errors,r};var O=this._formats,C=this.RULES;try{var $=N(t,r,p,_);I.validate=$;var j=I.callValidate;return j&&(j.schema=$.schema,j.errors=null,j.refs=$.refs,j.refVal=$.refVal,j.root=$.root,j.$async=$.$async,w.sourceCode&&(j.source=$.source)),$}finally{h.call(this,t,r,_)}function N(t,i,l,h){var p=!i||i&&i.schema==t;if(i.schema!=r.schema)return e.call(b,t,i,l,h);var _,k=!0===t.$async,R=o({isTop:!0,schema:t,isRoot:p,baseId:h,root:i,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:n.MissingRef,RULES:C,validate:o,util:s,resolve:a,resolveRef:D,usePattern:L,useDefault:M,useCustomRule:q,opts:w,formats:O,logger:b.logger,self:b});R=y(x,g)+y(E,m)+y(S,f)+y(A,v)+R,w.processCode&&(R=w.processCode(R,t));try{_=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",R)(b,C,O,r,x,S,A,c,d,u),x[0]=_}catch(e){throw b.logger.error("Error compiling schema, function code:",R),e}return _.schema=t,_.errors=null,_.refs=P,_.refVal=x,_.root=p?_:i,k&&(_.$async=!0),!0===w.sourceCode&&(_.source={code:R,patterns:E,defaults:S}),_}function D(t,s,n){s=a.url(t,s);var i,o,d=P[s];if(void 0!==d)return Z(i=x[d],o="refVal["+d+"]");if(!n&&r.refs){var c=r.refs[s];if(void 0!==c)return Z(i=r.refVal[c],o=F(s,i))}o=F(s);var u=a.call(b,N,r,s);if(void 0===u){var l=p&&p[s];l&&(u=a.inlineRef(l,w.inlineRefs)?l:e.call(b,l,r,p,t))}if(void 0!==u)return function(e,t){var r=P[e];x[r]=t}(s,u),Z(u,o);!function(e){delete P[e]}(s)}function F(e,t){var r=x.length;return x[r]=t,P[e]=r,"refVal"+r}function Z(e,t){return"object"==typeof e||"boolean"==typeof e?{code:t,schema:e,inline:!0}:{code:t,$async:e&&!!e.$async}}function L(e){var t=k[e];return void 0===t&&(t=k[e]=E.length,E[t]=e),"pattern"+t}function M(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return s.toQuotedString(e);case"object":if(null===e)return"null";var t=i(e),r=R[t];return void 0===r&&(r=R[t]=S.length,S[r]=e),"default"+r}}function q(e,t,r,a){if(!1!==b._opts.validateSchema){var s=e.definition.dependencies;if(s&&!s.every(function(e){return Object.prototype.hasOwnProperty.call(r,e)}))throw new Error("parent schema must have all required keywords: "+s.join(","));var n=e.definition.validateSchema;if(n&&!n(t)){var i="keyword schema is invalid: "+b.errorsText(n.errors);if("log"!=b._opts.validateSchema)throw new Error(i);b.logger.error(i)}}var o,d=e.definition.compile,c=e.definition.inline,u=e.definition.macro;if(d)o=d.call(b,t,r,a);else if(u)o=u.call(b,t,r,a),!1!==w.validateSchema&&b.validateSchema(o,!0);else if(c)o=c.call(b,a,e.keyword,t,r);else if(!(o=e.definition.validate))return;if(void 0===o)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var l=A.length;return A[l]=o,{code:"customRule"+l,validate:o}}}},6862:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="errs__"+s,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(a+="var "+l+" = errors;",e.opts.strictKeywords?"object"==typeof i&&Object.keys(i).length>0||!1===i:e.util.schemaHasRules(i,e.RULES.all)){h.schema=i,h.schemaPath=o,h.errSchemaPath=d;var m="key"+s,f="idx"+s,g="i"+s,v="' + "+m+" + '",y="data"+(h.dataLevel=e.dataLevel+1),_="dataProperties"+s,b=e.opts.ownProperties,w=e.baseId;b&&(a+=" var "+_+" = undefined; "),a+=b?" "+_+" = "+_+" || Object.keys("+u+"); for (var "+f+"=0; "+f+"<"+_+".length; "+f+"++) { var "+m+" = "+_+"["+f+"]; ":" for (var "+m+" in "+u+") { ",a+=" var startErrs"+s+" = errors; ";var x=m,P=e.compositeRule;e.compositeRule=h.compositeRule=!0;var E=e.validate(h);h.baseId=w,e.util.varOccurences(E,y)<2?a+=" "+e.util.varReplace(E,y,x)+" ":a+=" var "+y+" = "+x+"; "+E+" ",e.compositeRule=h.compositeRule=P,a+=" if (!"+p+") { for (var "+g+"=startErrs"+s+"; "+g+"<errors; "+g+"++) { vErrors["+g+"].propertyName = "+m+"; }   var err =   ",!1!==e.createErrors?(a+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { propertyName: '"+v+"' } ",!1!==e.opts.messages&&(a+=" , message: 'property name \\'"+v+"\\' is invalid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),c&&(a+=" break; "),a+=" } }"}return c&&(a+="  if ("+l+" == errors) {"),a}},7048:function(e,t,r){"use strict";var a=r(3497).MissingRef;e.exports=function e(t,r,s){var n=this;if("function"!=typeof this._opts.loadSchema)throw new Error("options.loadSchema should be a function");"function"==typeof r&&(s=r,r=void 0);var i=o(t).then(function(){var e=n._addSchema(t,void 0,r);return e.validate||d(e)});return s&&i.then(function(e){s(null,e)},s),i;function o(t){var r=t.$schema;return r&&!n.getSchema(r)?e.call(n,{$ref:r},!0):Promise.resolve()}function d(e){try{return n._compile(e)}catch(t){if(t instanceof a)return function(t){var a=t.missingSchema;if(c(a))throw new Error("Schema "+a+" is loaded but "+t.missingRef+" cannot be resolved");var s=n._loadingSchemas[a];return s||(s=n._loadingSchemas[a]=n._opts.loadSchema(a)).then(i,i),s.then(function(e){if(!c(a))return o(e).then(function(){c(a)||n.addSchema(e,a,void 0,r)})}).then(function(){return d(e)});function i(){delete n._loadingSchemas[a]}function c(e){return n._refs[e]||n._schemas[e]}}(t);throw t}}}},7148:function(e){"use strict";e.exports=function(e,t,r){var a,s=" ",n=e.level,i=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(i||""),h=e.opts.$data&&o&&o.$data;if(h?(s+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",a="schema"+n):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");s+="var division"+n+";if (",h&&(s+=" "+a+" !== undefined && ( typeof "+a+" != 'number' || "),s+=" (division"+n+" = "+l+" / "+a+", ",e.opts.multipleOfPrecision?s+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":s+=" division"+n+" !== parseInt(division"+n+") ",s+=" ) ",h&&(s+="  )  "),s+=" ) {   ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be multiple of ",s+=h?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},7276:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="errs__"+s,h=e.util.copy(e),p="";h.level++;var m="valid"+h.level,f="key"+s,g="idx"+s,v=h.dataLevel=e.dataLevel+1,y="data"+v,_="dataProperties"+s,b=Object.keys(i||{}).filter($),w=e.schema.patternProperties||{},x=Object.keys(w).filter($),P=e.schema.additionalProperties,E=b.length||x.length,k=!1===P,S="object"==typeof P&&Object.keys(P).length,R=e.opts.removeAdditional,A=k||S||R,T=e.opts.ownProperties,I=e.baseId,O=e.schema.required;if(O&&(!e.opts.$data||!O.$data)&&O.length<e.opts.loopRequired)var C=e.util.toHash(O);function $(e){return"__proto__"!==e}if(a+="var "+l+" = errors;var "+m+" = true;",T&&(a+=" var "+_+" = undefined;"),A){if(a+=T?" "+_+" = "+_+" || Object.keys("+u+"); for (var "+g+"=0; "+g+"<"+_+".length; "+g+"++) { var "+f+" = "+_+"["+g+"]; ":" for (var "+f+" in "+u+") { ",E){if(a+=" var isAdditional"+s+" = !(false ",b.length)if(b.length>8)a+=" || validate.schema"+o+".hasOwnProperty("+f+") ";else{var j=b;if(j)for(var N=-1,D=j.length-1;N<D;)B=j[N+=1],a+=" || "+f+" == "+e.util.toQuotedString(B)+" "}if(x.length){var F=x;if(F)for(var Z=-1,L=F.length-1;Z<L;)ne=F[Z+=1],a+=" || "+e.usePattern(ne)+".test("+f+") "}a+=" ); if (isAdditional"+s+") { "}if("all"==R)a+=" delete "+u+"["+f+"]; ";else{var M=e.errorPath,q="' + "+f+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers)),k)if(R)a+=" delete "+u+"["+f+"]; ";else{a+=" "+m+" = false; ";var z=d;d=e.errSchemaPath+"/additionalProperties",(re=re||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { additionalProperty: '"+q+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is an invalid additional property":a+="should NOT have additional properties",a+="' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var U=a;a=re.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+U+"]); ":a+=" validate.errors = ["+U+"]; return false; ":a+=" var err = "+U+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d=z,c&&(a+=" break; ")}else if(S)if("failing"==R){a+=" var "+l+" = errors;  ";var H=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=P,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers);var V=u+"["+f+"]";h.dataPathArr[v]=f;var K=e.validate(h);h.baseId=I,e.util.varOccurences(K,y)<2?a+=" "+e.util.varReplace(K,y,V)+" ":a+=" var "+y+" = "+V+"; "+K+" ",a+=" if (!"+m+") { errors = "+l+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+u+"["+f+"]; }  ",e.compositeRule=h.compositeRule=H}else h.schema=P,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers),V=u+"["+f+"]",h.dataPathArr[v]=f,K=e.validate(h),h.baseId=I,e.util.varOccurences(K,y)<2?a+=" "+e.util.varReplace(K,y,V)+" ":a+=" var "+y+" = "+V+"; "+K+" ",c&&(a+=" if (!"+m+") break; ");e.errorPath=M}E&&(a+=" } "),a+=" }  ",c&&(a+=" if ("+m+") { ",p+="}")}var Q=e.opts.useDefaults&&!e.compositeRule;if(b.length){var G=b;if(G)for(var B,W=-1,J=G.length-1;W<J;){var Y=i[B=G[W+=1]];if(e.opts.strictKeywords?"object"==typeof Y&&Object.keys(Y).length>0||!1===Y:e.util.schemaHasRules(Y,e.RULES.all)){var X=e.util.getProperty(B),ee=(V=u+X,Q&&void 0!==Y.default);if(h.schema=Y,h.schemaPath=o+X,h.errSchemaPath=d+"/"+e.util.escapeFragment(B),h.errorPath=e.util.getPath(e.errorPath,B,e.opts.jsonPointers),h.dataPathArr[v]=e.util.toQuotedString(B),K=e.validate(h),h.baseId=I,e.util.varOccurences(K,y)<2){K=e.util.varReplace(K,y,V);var te=V}else te=y,a+=" var "+y+" = "+V+"; ";if(ee)a+=" "+K+" ";else{if(C&&C[B]){a+=" if ( "+te+" === undefined ",T&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(B)+"') "),a+=") { "+m+" = false; ",M=e.errorPath,z=d;var re,ae=e.util.escapeQuotes(B);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(M,B,e.opts.jsonPointers)),d=e.errSchemaPath+"/required",(re=re||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+ae+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+ae+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",U=a,a=re.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+U+"]); ":a+=" validate.errors = ["+U+"]; return false; ":a+=" var err = "+U+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d=z,e.errorPath=M,a+=" } else { "}else c?(a+=" if ( "+te+" === undefined ",T&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(B)+"') "),a+=") { "+m+" = true; } else { "):(a+=" if ("+te+" !== undefined ",T&&(a+=" &&   Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(B)+"') "),a+=" ) { ");a+=" "+K+" } "}}c&&(a+=" if ("+m+") { ",p+="}")}}if(x.length){var se=x;if(se)for(var ne,ie=-1,oe=se.length-1;ie<oe;)Y=w[ne=se[ie+=1]],(e.opts.strictKeywords?"object"==typeof Y&&Object.keys(Y).length>0||!1===Y:e.util.schemaHasRules(Y,e.RULES.all))&&(h.schema=Y,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ne),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ne),a+=T?" "+_+" = "+_+" || Object.keys("+u+"); for (var "+g+"=0; "+g+"<"+_+".length; "+g+"++) { var "+f+" = "+_+"["+g+"]; ":" for (var "+f+" in "+u+") { ",a+=" if ("+e.usePattern(ne)+".test("+f+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers),V=u+"["+f+"]",h.dataPathArr[v]=f,K=e.validate(h),h.baseId=I,e.util.varOccurences(K,y)<2?a+=" "+e.util.varReplace(K,y,V)+" ":a+=" var "+y+" = "+V+"; "+K+" ",c&&(a+=" if (!"+m+") break; "),a+=" } ",c&&(a+=" else "+m+" = true; "),a+=" }  ",c&&(a+=" if ("+m+") { ",p+="}"))}return c&&(a+=" "+p+" if ("+l+" == errors) {"),a}},7294:function(e){"use strict";e.exports=JSON.parse('{"$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":false}')},7539:function(e){"use strict";e.exports=function(e){for(var t,r=0,a=e.length,s=0;s<a;)r++,(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<a&&56320==(64512&(t=e.charCodeAt(s)))&&s++;return r}},7676:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="errs__"+s,h=e.util.copy(e),p="";h.level++;var m="valid"+h.level,f={},g={},v=e.opts.ownProperties;for(w in i)if("__proto__"!=w){var y=i[w],_=Array.isArray(y)?g:f;_[w]=y}a+="var "+l+" = errors;";var b=e.errorPath;for(var w in a+="var missing"+s+";",g)if((_=g[w]).length){if(a+=" if ( "+u+e.util.getProperty(w)+" !== undefined ",v&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(w)+"') "),c){a+=" && ( ";var x=_;if(x)for(var P=-1,E=x.length-1;P<E;)I=x[P+=1],P&&(a+=" || "),a+=" ( ( "+(j=u+($=e.util.getProperty(I)))+" === undefined ",v&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(I)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?I:$)+") ) ";a+=")) {  ";var k="missing"+s,S="' + "+k+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(b,k,!0):b+" + "+k);var R=R||[];R.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { property: '"+e.util.escapeQuotes(w)+"', missingProperty: '"+S+"', depsCount: "+_.length+", deps: '"+e.util.escapeQuotes(1==_.length?_[0]:_.join(", "))+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should have ",1==_.length?a+="property "+e.util.escapeQuotes(_[0]):a+="properties "+e.util.escapeQuotes(_.join(", ")),a+=" when property "+e.util.escapeQuotes(w)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var A=a;a=R.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+A+"]); ":a+=" validate.errors = ["+A+"]; return false; ":a+=" var err = "+A+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{a+=" ) { ";var T=_;if(T)for(var I,O=-1,C=T.length-1;O<C;){I=T[O+=1];var $=e.util.getProperty(I),j=(S=e.util.escapeQuotes(I),u+$);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(b,I,e.opts.jsonPointers)),a+=" if ( "+j+" === undefined ",v&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(I)+"') "),a+=") {  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { property: '"+e.util.escapeQuotes(w)+"', missingProperty: '"+S+"', depsCount: "+_.length+", deps: '"+e.util.escapeQuotes(1==_.length?_[0]:_.join(", "))+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should have ",1==_.length?a+="property "+e.util.escapeQuotes(_[0]):a+="properties "+e.util.escapeQuotes(_.join(", ")),a+=" when property "+e.util.escapeQuotes(w)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}a+=" }   ",c&&(p+="}",a+=" else { ")}e.errorPath=b;var N=h.baseId;for(var w in f)y=f[w],(e.opts.strictKeywords?"object"==typeof y&&Object.keys(y).length>0||!1===y:e.util.schemaHasRules(y,e.RULES.all))&&(a+=" "+m+" = true; if ( "+u+e.util.getProperty(w)+" !== undefined ",v&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(w)+"') "),a+=") { ",h.schema=y,h.schemaPath=o+e.util.getProperty(w),h.errSchemaPath=d+"/"+e.util.escapeFragment(w),a+="  "+e.validate(h)+" ",h.baseId=N,a+=" }  ",c&&(a+=" if ("+m+") { ",p+="}"));return c&&(a+="   "+p+" if ("+l+" == errors) {"),a}},7710:function(e,t,r){"use strict";function a(e,t,r,a){var s=a?" !== ":" === ",n=a?" || ":" && ",i=a?"!":"",o=a?"":"!";switch(e){case"null":return t+s+"null";case"array":return i+"Array.isArray("+t+")";case"object":return"("+i+t+n+"typeof "+t+s+'"object"'+n+o+"Array.isArray("+t+"))";case"integer":return"(typeof "+t+s+'"number"'+n+o+"("+t+" % 1)"+n+t+s+t+(r?n+i+"isFinite("+t+")":"")+")";case"number":return"(typeof "+t+s+'"'+e+'"'+(r?n+i+"isFinite("+t+")":"")+")";default:return"typeof "+t+s+'"'+e+'"'}}e.exports={copy:function(e,t){for(var r in t=t||{},e)t[r]=e[r];return t},checkDataType:a,checkDataTypes:function(e,t,r){if(1===e.length)return a(e[0],t,r,!0);var s="",i=n(e);for(var o in i.array&&i.object&&(s=i.null?"(":"(!"+t+" || ",s+="typeof "+t+' !== "object")',delete i.null,delete i.array,delete i.object),i.number&&delete i.integer,i)s+=(s?" && ":"")+a(o,t,r,!0);return s},coerceToTypes:function(e,t){if(Array.isArray(t)){for(var r=[],a=0;a<t.length;a++){var n=t[a];(s[n]||"array"===e&&"array"===n)&&(r[r.length]=n)}if(r.length)return r}else{if(s[t])return[t];if("array"===e&&"array"===t)return["array"]}},toHash:n,getProperty:d,escapeQuotes:c,equal:r(8991),ucs2length:r(7539),varOccurences:function(e,t){t+="[^0-9]";var r=e.match(new RegExp(t,"g"));return r?r.length:0},varReplace:function(e,t,r){return t+="([^0-9])",r=r.replace(/\$/g,"$$$$"),e.replace(new RegExp(t,"g"),r+"$1")},schemaHasRules:function(e,t){if("boolean"==typeof e)return!e;for(var r in e)if(t[r])return!0},schemaHasRulesExcept:function(e,t,r){if("boolean"==typeof e)return!e&&"not"!=r;for(var a in e)if(a!=r&&t[a])return!0},schemaUnknownRules:function(e,t){if("boolean"!=typeof e)for(var r in e)if(!t[r])return r},toQuotedString:u,getPathExpr:function(e,t,r,a){return p(e,r?"'/' + "+t+(a?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):a?"'[' + "+t+" + ']'":"'[\\'' + "+t+" + '\\']'")},getPath:function(e,t,r){return p(e,u(r?"/"+m(t):d(t)))},getData:function(e,t,r){var a,s,n,i;if(""===e)return"rootData";if("/"==e[0]){if(!l.test(e))throw new Error("Invalid JSON-pointer: "+e);s=e,n="rootData"}else{if(!(i=e.match(h)))throw new Error("Invalid JSON-pointer: "+e);if(a=+i[1],"#"==(s=i[2])){if(a>=t)throw new Error("Cannot access property/index "+a+" levels up, current level is "+t);return r[t-a]}if(a>t)throw new Error("Cannot access data "+a+" levels up, current level is "+t);if(n="data"+(t-a||""),!s)return n}for(var o=n,c=s.split("/"),u=0;u<c.length;u++){var p=c[u];p&&(o+=" && "+(n+=d(f(p))))}return o},unescapeFragment:function(e){return f(decodeURIComponent(e))},unescapeJsonPointer:f,escapeFragment:function(e){return encodeURIComponent(m(e))},escapeJsonPointer:m};var s=n(["string","number","integer","boolean","null"]);function n(e){for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;return t}var i=/^[a-z$_][a-z$_0-9]*$/i,o=/'|\\/g;function d(e){return"number"==typeof e?"["+e+"]":i.test(e)?"."+e:"['"+c(e)+"']"}function c(e){return e.replace(o,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function u(e){return"'"+c(e)+"'"}var l=/^\/(?:[^~]|~0|~1)*$/,h=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function p(e,t){return'""'==e?t:(e+" + "+t).replace(/([^\\])' \+ '/g,"$1")}function m(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function f(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}},8203:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.schema[t],n=e.schemaPath+e.util.getProperty(t),i=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,d=e.util.copy(e),c="";d.level++;var u="valid"+d.level,l=d.baseId,h=!0,p=s;if(p)for(var m,f=-1,g=p.length-1;f<g;)m=p[f+=1],(e.opts.strictKeywords?"object"==typeof m&&Object.keys(m).length>0||!1===m:e.util.schemaHasRules(m,e.RULES.all))&&(h=!1,d.schema=m,d.schemaPath=n+"["+f+"]",d.errSchemaPath=i+"/"+f,a+="  "+e.validate(d)+" ",d.baseId=l,o&&(a+=" if ("+u+") { ",c+="}"));return o&&(a+=h?" if (true) { ":" "+c.slice(0,-1)+" "),a}},8484:function(e){"use strict";e.exports=function(e,t,r){var a,s=" ",n=e.level,i=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(i||""),h="valid"+n,p=e.opts.$data&&o&&o.$data;if(p?(s+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",a="schema"+n):a=o,(o||p)&&!1!==e.opts.uniqueItems){p&&(s+=" var "+h+"; if ("+a+" === false || "+a+" === undefined) "+h+" = true; else if (typeof "+a+" != 'boolean') "+h+" = false; else { "),s+=" var i = "+l+".length , "+h+" = true , j; if (i > 1) { ";var m=e.schema.items&&e.schema.items.type,f=Array.isArray(m);if(!m||"object"==m||"array"==m||f&&(m.indexOf("object")>=0||m.indexOf("array")>=0))s+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+l+"[i], "+l+"[j])) { "+h+" = false; break outer; } } } ";else{s+=" var itemIndices = {}, item; for (;i--;) { var item = "+l+"[i]; ";var g="checkDataType"+(f?"s":"");s+=" if ("+e.util[g](m,"item",e.opts.strictNumbers,!0)+") continue; ",f&&(s+=" if (typeof item == 'string') item = '\"' + item; "),s+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}s+=" } ",p&&(s+="  }  "),s+=" if (!"+h+") {   ";var v=v||[];v.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema:  ",s+=p?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var y=s;s=v.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}},8601:function(e){"use strict";e.exports=function(e,t,r){var a,s=" ",n=e.level,i=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(i||""),h=e.opts.$data&&o&&o.$data;if(h?(s+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",a="schema"+n):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");var p="maxLength"==t?">":"<";s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),!1===e.opts.unicode?s+=" "+l+".length ":s+=" ucs2length("+l+") ",s+=" "+p+" "+a+") { ";var m=t,f=f||[];f.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(m||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT be ",s+="maxLength"==t?"longer":"shorter",s+=" than ",s+=h?"' + "+a+" + '":""+o,s+=" characters' "),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var g=s;return s=f.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+g+"]); ":s+=" validate.errors = ["+g+"]; return false; ":s+=" var err = "+g+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},8665:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,g="i"+s,v=p.dataLevel=e.dataLevel+1,y="data"+v,_=e.baseId;if(a+="var "+h+" = errors;var "+l+";",Array.isArray(i)){var b=e.schema.additionalItems;if(!1===b){a+=" "+l+" = "+u+".length <= "+i.length+"; ";var w=d;d=e.errSchemaPath+"/additionalItems",a+="  if (!"+l+") {   ";var x=x||[];x.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+i.length+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var P=a;a=x.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+P+"]); ":a+=" validate.errors = ["+P+"]; return false; ":a+=" var err = "+P+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",d=w,c&&(m+="}",a+=" else { ")}var E=i;if(E)for(var k,S=-1,R=E.length-1;S<R;)if(k=E[S+=1],e.opts.strictKeywords?"object"==typeof k&&Object.keys(k).length>0||!1===k:e.util.schemaHasRules(k,e.RULES.all)){a+=" "+f+" = true; if ("+u+".length > "+S+") { ";var A=u+"["+S+"]";p.schema=k,p.schemaPath=o+"["+S+"]",p.errSchemaPath=d+"/"+S,p.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0),p.dataPathArr[v]=S;var T=e.validate(p);p.baseId=_,e.util.varOccurences(T,y)<2?a+=" "+e.util.varReplace(T,y,A)+" ":a+=" var "+y+" = "+A+"; "+T+" ",a+=" }  ",c&&(a+=" if ("+f+") { ",m+="}")}"object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&Object.keys(b).length>0||!1===b:e.util.schemaHasRules(b,e.RULES.all))&&(p.schema=b,p.schemaPath=e.schemaPath+".additionalItems",p.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+f+" = true; if ("+u+".length > "+i.length+") {  for (var "+g+" = "+i.length+"; "+g+" < "+u+".length; "+g+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0),A=u+"["+g+"]",p.dataPathArr[v]=g,T=e.validate(p),p.baseId=_,e.util.varOccurences(T,y)<2?a+=" "+e.util.varReplace(T,y,A)+" ":a+=" var "+y+" = "+A+"; "+T+" ",c&&(a+=" if (!"+f+") break; "),a+=" } }  ",c&&(a+=" if ("+f+") { ",m+="}"))}else(e.opts.strictKeywords?"object"==typeof i&&Object.keys(i).length>0||!1===i:e.util.schemaHasRules(i,e.RULES.all))&&(p.schema=i,p.schemaPath=o,p.errSchemaPath=d,a+="  for (var "+g+" = 0; "+g+" < "+u+".length; "+g+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0),A=u+"["+g+"]",p.dataPathArr[v]=g,T=e.validate(p),p.baseId=_,e.util.varOccurences(T,y)<2?a+=" "+e.util.varReplace(T,y,A)+" ":a+=" var "+y+" = "+A+"; "+T+" ",c&&(a+=" if (!"+f+") break; "),a+=" }");return c&&(a+=" "+m+" if ("+h+" == errors) {"),a}},8725:function(e,t,r){"use strict";var a=r(6540),s=r(3204),n=r(1688),i=r(3867),o=r(1130),d=r(9428),c=r(955),u=r(4324),l=r(7710);e.exports=v,v.prototype.validate=function(e,t){var r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw new Error('no schema with key or ref "'+e+'"')}else{var a=this._addSchema(e);r=a.validate||this._compile(a)}var s=r(t);return!0!==r.$async&&(this.errors=r.errors),s},v.prototype.compile=function(e,t){var r=this._addSchema(e,void 0,t);return r.validate||this._compile(r)},v.prototype.addSchema=function(e,t,r,a){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.addSchema(e[n],void 0,r,a);return this}var i=this._getId(e);if(void 0!==i&&"string"!=typeof i)throw new Error("schema id must be string");return P(this,t=s.normalizeId(t||i)),this._schemas[t]=this._addSchema(e,r,a,!0),this},v.prototype.addMetaSchema=function(e,t,r){return this.addSchema(e,t,r,!0),this},v.prototype.validateSchema=function(e,t){var r,a,s=e.$schema;if(void 0!==s&&"string"!=typeof s)throw new Error("$schema must be a string");if(!(s=s||this._opts.defaultMeta||(r=this,a=r._opts.meta,r._opts.defaultMeta="object"==typeof a?r._getId(a)||a:r.getSchema(m)?m:void 0,r._opts.defaultMeta)))return this.logger.warn("meta-schema not available"),this.errors=null,!0;var n=this.validate(s,e);if(!n&&t){var i="schema is invalid: "+this.errorsText();if("log"!=this._opts.validateSchema)throw new Error(i);this.logger.error(i)}return n},v.prototype.getSchema=function(e){var t=y(this,e);switch(typeof t){case"object":return t.validate||this._compile(t);case"string":return this.getSchema(t);case"undefined":return function(e,t){var r=s.schema.call(e,{schema:{}},t);if(r){var n=r.schema,o=r.root,d=r.baseId,c=a.call(e,n,o,void 0,d);return e._fragments[t]=new i({ref:t,fragment:!0,schema:n,root:o,baseId:d,validate:c}),c}}(this,e)}},v.prototype.removeSchema=function(e){if(e instanceof RegExp)return _(this,this._schemas,e),_(this,this._refs,e),this;switch(typeof e){case"undefined":return _(this,this._schemas),_(this,this._refs),this._cache.clear(),this;case"string":var t=y(this,e);return t&&this._cache.del(t.cacheKey),delete this._schemas[e],delete this._refs[e],this;case"object":var r=this._opts.serialize,a=r?r(e):e;this._cache.del(a);var n=this._getId(e);n&&(n=s.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this},v.prototype.addFormat=function(e,t){return"string"==typeof t&&(t=new RegExp(t)),this._formats[e]=t,this},v.prototype.errorsText=function(e,t){if(!(e=e||this.errors))return"No errors";for(var r=void 0===(t=t||{}).separator?", ":t.separator,a=void 0===t.dataVar?"data":t.dataVar,s="",n=0;n<e.length;n++){var i=e[n];i&&(s+=a+i.dataPath+" "+i.message+r)}return s.slice(0,-r.length)},v.prototype._addSchema=function(e,t,r,a){if("object"!=typeof e&&"boolean"!=typeof e)throw new Error("schema should be object or boolean");var n=this._opts.serialize,o=n?n(e):e,d=this._cache.get(o);if(d)return d;a=a||!1!==this._opts.addUsedSchema;var c=s.normalizeId(this._getId(e));c&&a&&P(this,c);var u,l=!1!==this._opts.validateSchema&&!t;l&&!(u=c&&c==s.normalizeId(e.$schema))&&this.validateSchema(e,!0);var h=s.ids.call(this,e),p=new i({id:c,schema:e,localRefs:h,cacheKey:o,meta:r});return"#"!=c[0]&&a&&(this._refs[c]=p),this._cache.put(o,p),l&&u&&this.validateSchema(e,!0),p},v.prototype._compile=function(e,t){if(e.compiling)return e.validate=n,n.schema=e.schema,n.errors=null,n.root=t||n,!0===e.schema.$async&&(n.$async=!0),n;var r,s;e.compiling=!0,e.meta&&(r=this._opts,this._opts=this._metaOpts);try{s=a.call(this,e.schema,t,e.localRefs)}catch(t){throw delete e.validate,t}finally{e.compiling=!1,e.meta&&(this._opts=r)}return e.validate=s,e.refs=s.refs,e.refVal=s.refVal,e.root=s.root,s;function n(){var t=e.validate,r=t.apply(this,arguments);return n.errors=t.errors,r}},v.prototype.compileAsync=r(7048);var h=r(1373);v.prototype.addKeyword=h.add,v.prototype.getKeyword=h.get,v.prototype.removeKeyword=h.remove,v.prototype.validateKeyword=h.validate;var p=r(3497);v.ValidationError=p.Validation,v.MissingRefError=p.MissingRef,v.$dataMetaSchema=u;var m="http://json-schema.org/draft-07/schema",f=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],g=["/properties"];function v(e){if(!(this instanceof v))return new v(e);e=this._opts=l.copy(e)||{},function(e){var t=e._opts.logger;if(!1===t)e.logger={log:E,warn:E,error:E};else{if(void 0===t&&(t=console),!("object"==typeof t&&t.log&&t.warn&&t.error))throw new Error("logger must implement log, warn and error methods");e.logger=t}}(this),this._schemas={},this._refs={},this._fragments={},this._formats=d(e.format),this._cache=e.cache||new n,this._loadingSchemas={},this._compilations=[],this.RULES=c(),this._getId=function(e){switch(e.schemaId){case"auto":return x;case"id":return b;default:return w}}(e),e.loopRequired=e.loopRequired||1/0,"property"==e.errorDataPath&&(e._errorDataPathProperty=!0),void 0===e.serialize&&(e.serialize=o),this._metaOpts=function(e){for(var t=l.copy(e._opts),r=0;r<f.length;r++)delete t[f[r]];return t}(this),e.formats&&function(e){for(var t in e._opts.formats){var r=e._opts.formats[t];e.addFormat(t,r)}}(this),e.keywords&&function(e){for(var t in e._opts.keywords){var r=e._opts.keywords[t];e.addKeyword(t,r)}}(this),function(e){var t;if(e._opts.$data&&(t=r(7294),e.addMetaSchema(t,t.$id,!0)),!1!==e._opts.meta){var a=r(1780);e._opts.$data&&(a=u(a,g)),e.addMetaSchema(a,m,!0),e._refs["http://json-schema.org/schema"]=m}}(this),"object"==typeof e.meta&&this.addMetaSchema(e.meta),e.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),function(e){var t=e._opts.schemas;if(t)if(Array.isArray(t))e.addSchema(t);else for(var r in t)e.addSchema(t[r],r)}(this)}function y(e,t){return t=s.normalizeId(t),e._schemas[t]||e._refs[t]||e._fragments[t]}function _(e,t,r){for(var a in t){var s=t[a];s.meta||r&&!r.test(a)||(e._cache.del(s.cacheKey),delete t[a])}}function b(e){return e.$id&&this.logger.warn("schema $id ignored",e.$id),e.id}function w(e){return e.id&&this.logger.warn("schema id ignored",e.id),e.$id}function x(e){if(e.$id&&e.id&&e.$id!=e.id)throw new Error("schema $id is different from id");return e.$id||e.id}function P(e,t){if(e._schemas[t]||e._refs[t])throw new Error('schema with key or id "'+t+'" already exists')}function E(){}},8806:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,g=i.every(function(t){return e.opts.strictKeywords?"object"==typeof t&&Object.keys(t).length>0||!1===t:e.util.schemaHasRules(t,e.RULES.all)});if(g){var v=p.baseId;a+=" var "+h+" = errors; var "+l+" = false;  ";var y=e.compositeRule;e.compositeRule=p.compositeRule=!0;var _=i;if(_)for(var b,w=-1,x=_.length-1;w<x;)b=_[w+=1],p.schema=b,p.schemaPath=o+"["+w+"]",p.errSchemaPath=d+"/"+w,a+="  "+e.validate(p)+" ",p.baseId=v,a+=" "+l+" = "+l+" || "+f+"; if (!"+l+") { ",m+="}";e.compositeRule=p.compositeRule=y,a+=" "+m+" if (!"+l+") {   var err =   ",!1!==e.createErrors?(a+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } else {  errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else c&&(a+=" if (true) { ");return a}},8991:function(e){"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var a,s,n;if(Array.isArray(t)){if((a=t.length)!=r.length)return!1;for(s=a;0!==s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((a=(n=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=a;0!==s--;)if(!Object.prototype.hasOwnProperty.call(r,n[s]))return!1;for(s=a;0!==s--;){var i=n[s];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r}},9372:function(e){"use strict";e.exports=function(e,t,r){var a=" ",s=e.level,n=e.dataLevel,i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(n||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e);p.level++;var m="valid"+p.level,f="i"+s,g=p.dataLevel=e.dataLevel+1,v="data"+g,y=e.baseId,_=e.opts.strictKeywords?"object"==typeof i&&Object.keys(i).length>0||!1===i:e.util.schemaHasRules(i,e.RULES.all);if(a+="var "+h+" = errors;var "+l+";",_){var b=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.schema=i,p.schemaPath=o,p.errSchemaPath=d,a+=" var "+m+" = false; for (var "+f+" = 0; "+f+" < "+u+".length; "+f+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers,!0);var w=u+"["+f+"]";p.dataPathArr[g]=f;var x=e.validate(p);p.baseId=y,e.util.varOccurences(x,v)<2?a+=" "+e.util.varReplace(x,v,w)+" ":a+=" var "+v+" = "+w+"; "+x+" ",a+=" if ("+m+") break; }  ",e.compositeRule=p.compositeRule=b,a+="  if (!"+m+") {"}else a+=" if ("+u+".length == 0) {";var P=P||[];P.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var E=a;return a=P.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+E+"]); ":a+=" validate.errors = ["+E+"]; return false; ":a+=" var err = "+E+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",_&&(a+="  errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a}},9428:function(e,t,r){"use strict";var a=r(7710),s=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,o=/^(?=.{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,d=/^(?:[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,c=/^(?:(?:[^\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,u=/^(?:(?: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,l=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,h=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,m=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function f(e){return e="full"==e?"full":"fast",a.copy(f[e])}function g(e){var t=e.match(s);if(!t)return!1;var r=+t[1],a=+t[2],i=+t[3];return a>=1&&a<=12&&i>=1&&i<=(2==a&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(r)?29:n[a])}function v(e,t){var r=e.match(i);if(!r)return!1;var a=r[1],s=r[2],n=r[3],o=r[5];return(a<=23&&s<=59&&n<=59||23==a&&59==s&&60==n)&&(!t||o)}e.exports=f,f.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":c,url:u,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:o,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:w,uuid:l,"json-pointer":h,"json-pointer-uri-fragment":p,"relative-json-pointer":m},f.full={date:g,time:v,"date-time":function(e){var t=e.split(y);return 2==t.length&&g(t[0])&&v(t[1],!0)},uri:function(e){return _.test(e)&&d.test(e)},"uri-reference":/^(?:[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,"uri-template":c,url:u,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:o,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:w,uuid:l,"json-pointer":h,"json-pointer-uri-fragment":p,"relative-json-pointer":m};var y=/t|\s/i,_=/\/|:/,b=/[^\\]\\Z/;function w(e){if(b.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}},9468:function(e){"use strict";e.exports=function(e,t,r){var a,s=" ",n=e.level,i=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(i||""),h=e.opts.$data&&o&&o.$data;if(h?(s+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",a="schema"+n):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+l+").length "+("maxProperties"==t?">":"<")+" "+a+") { ";var p=t,m=m||[];m.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxProperties"==t?"more":"fewer",s+=" than ",s+=h?"' + "+a+" + '":""+o,s+=" properties' "),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var f=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+f+"]); ":s+=" validate.errors = ["+f+"]; return false; ":s+=" var err = "+f+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}},9602:function(e){"use strict";e.exports=function(e,t,r){var a,s,n=" ",i=e.level,o=e.dataLevel,d=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,h="data"+(o||""),p="valid"+i,m="errs__"+i,f=e.opts.$data&&d&&d.$data;f?(n+=" var schema"+i+" = "+e.util.getData(d.$data,o,e.dataPathArr)+"; ",s="schema"+i):s=d;var g,v,y,_,b,w=this,x="definition"+i,P=w.definition,E="";if(f&&P.$data){b="keywordValidate"+i;var k=P.validateSchema;n+=" var "+x+" = RULES.custom['"+t+"'].definition; var "+b+" = "+x+".validate;"}else{if(!(_=e.useCustomRule(w,d,e.schema,e)))return;s="validate.schema"+c,b=_.code,g=P.compile,v=P.inline,y=P.macro}var S=b+".errors",R="i"+i,A="ruleErr"+i,T=P.async;if(T&&!e.async)throw new Error("async keyword in sync schema");if(v||y||(n+=S+" = null;"),n+="var "+m+" = errors;var "+p+";",f&&P.$data&&(E+="}",n+=" if ("+s+" === undefined) { "+p+" = true; } else { ",k&&(E+="}",n+=" "+p+" = "+x+".validateSchema("+s+"); if ("+p+") { ")),v)P.statements?n+=" "+_.validate+" ":n+=" "+p+" = "+_.validate+"; ";else if(y){var I=e.util.copy(e);E="",I.level++;var O="valid"+I.level;I.schema=_.validate,I.schemaPath="";var C=e.compositeRule;e.compositeRule=I.compositeRule=!0;var $=e.validate(I).replace(/validate\.schema/g,b);e.compositeRule=I.compositeRule=C,n+=" "+$}else{(F=F||[]).push(n),n="",n+="  "+b+".call( ",e.opts.passContext?n+="this":n+="self",g||!1===P.schema?n+=" , "+h+" ":n+=" , "+s+" , "+h+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",'""'!=e.errorPath&&(n+=" + "+e.errorPath);var j=o?"data"+(o-1||""):"parentData",N=o?e.dataPathArr[o]:"parentDataProperty",D=n+=" , "+j+" , "+N+" , rootData )  ";n=F.pop(),!1===P.errors?(n+=" "+p+" = ",T&&(n+="await "),n+=D+"; "):n+=T?" var "+(S="customErrors"+i)+" = null; try { "+p+" = await "+D+"; } catch (e) { "+p+" = false; if (e instanceof ValidationError) "+S+" = e.errors; else throw e; } ":" "+S+" = null; "+p+" = "+D+"; "}if(P.modifying&&(n+=" if ("+j+") "+h+" = "+j+"["+N+"];"),n+=""+E,P.valid)l&&(n+=" if (true) { ");else{var F;n+=" if ( ",void 0===P.valid?(n+=" !",n+=y?""+O:""+p):n+=" "+!P.valid+" ",n+=") { ",a=w.keyword,(F=F||[]).push(n),n="",(F=F||[]).push(n),n="",!1!==e.createErrors?(n+=" { keyword: '"+(a||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+w.keyword+"' } ",!1!==e.opts.messages&&(n+=" , message: 'should pass \""+w.keyword+"\" keyword validation' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var Z=n;n=F.pop(),!e.compositeRule&&l?e.async?n+=" throw new ValidationError(["+Z+"]); ":n+=" validate.errors = ["+Z+"]; return false; ":n+=" var err = "+Z+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var L=n;n=F.pop(),v?P.errors?"full"!=P.errors&&(n+="  for (var "+R+"="+m+"; "+R+"<errors; "+R+"++) { var "+A+" = vErrors["+R+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+A+".schema = "+s+"; "+A+".data = "+h+"; "),n+=" } "):!1===P.errors?n+=" "+L+" ":(n+=" if ("+m+" == errors) { "+L+" } else {  for (var "+R+"="+m+"; "+R+"<errors; "+R+"++) { var "+A+" = vErrors["+R+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(n+=" "+A+".schema = "+s+"; "+A+".data = "+h+"; "),n+=" } } "):y?(n+="   var err =   ",!1!==e.createErrors?(n+=" { keyword: '"+(a||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+w.keyword+"' } ",!1!==e.opts.messages&&(n+=" , message: 'should pass \""+w.keyword+"\" keyword validation' "),e.opts.verbose&&(n+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&l&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; ")):!1===P.errors?n+=" "+L+" ":(n+=" if (Array.isArray("+S+")) { if (vErrors === null) vErrors = "+S+"; else vErrors = vErrors.concat("+S+"); errors = vErrors.length;  for (var "+R+"="+m+"; "+R+"<errors; "+R+"++) { var "+A+" = vErrors["+R+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+";  "+A+'.schemaPath = "'+u+'";  ',e.opts.verbose&&(n+=" "+A+".schema = "+s+"; "+A+".data = "+h+"; "),n+=" } } else { "+L+" } "),n+=" } ",l&&(n+=" else { ")}return n}},9787:function(e){"use strict";e.exports=function(e,t,r){var a="",s=!0===e.schema.$async,n=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var o=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(o){var d="unknown keyword: "+o;if("log"!==e.opts.strictKeywords)throw new Error(d);e.logger.warn(d)}}if(e.isTop&&(a+=" var validate = ",s&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" /*# sourceURL="+i+" */ ")),"boolean"==typeof e.schema||!n&&!e.schema.$ref){t="false schema";var c=e.level,u=e.dataLevel,l=e.schema[t],h=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,m=!e.opts.allErrors,f="data"+(u||""),g="valid"+c;if(!1===e.schema){e.isTop?m=!0:a+=" var "+g+" = false; ",(V=V||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ";var v=a;a=V.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?a+=s?" return data; ":" validate.errors = null; return true; ":a+=" var "+g+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var y=e.isTop;if(c=e.level=0,u=e.dataLevel=0,f="data",e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],void 0!==e.schema.default&&e.opts.useDefaults&&e.opts.strictDefaults){var _="default is ignored in the schema root";if("log"!==e.opts.strictDefaults)throw new Error(_);e.logger.warn(_)}a+=" var vErrors = null; ",a+=" var errors = 0;     ",a+=" if (rootData === undefined) rootData = data; "}else{if(c=e.level,f="data"+((u=e.dataLevel)||""),i&&(e.baseId=e.resolve.url(e.baseId,i)),s&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+c+" = errors;"}g="valid"+c,m=!e.opts.allErrors;var b="",w="",x=e.schema.type,P=Array.isArray(x);if(x&&e.opts.nullable&&!0===e.schema.nullable&&(P?-1==x.indexOf("null")&&(x=x.concat("null")):"null"!=x&&(x=[x,"null"],P=!0)),P&&1==x.length&&(x=x[0],P=!1),e.schema.$ref&&n){if("fail"==e.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');!0!==e.opts.extendRefs&&(n=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),x){if(e.opts.coerceTypes)var E=e.util.coerceToTypes(e.opts.coerceTypes,x);var k=e.RULES.types[x];if(E||P||!0===k||k&&!J(k)){h=e.schemaPath+".type",p=e.errSchemaPath+"/type",h=e.schemaPath+".type",p=e.errSchemaPath+"/type";var S=P?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[S](x,f,e.opts.strictNumbers,!0)+") { ",E){var R="dataType"+c,A="coerced"+c;a+=" var "+R+" = typeof "+f+"; var "+A+" = undefined; ","array"==e.opts.coerceTypes&&(a+=" if ("+R+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+R+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+A+" = "+f+"; } "),a+=" if ("+A+" !== undefined) ; ";var T=E;if(T)for(var I,O=-1,C=T.length-1;O<C;)"string"==(I=T[O+=1])?a+=" else if ("+R+" == 'number' || "+R+" == 'boolean') "+A+" = '' + "+f+"; else if ("+f+" === null) "+A+" = ''; ":"number"==I||"integer"==I?(a+=" else if ("+R+" == 'boolean' || "+f+" === null || ("+R+" == 'string' && "+f+" && "+f+" == +"+f+" ","integer"==I&&(a+=" && !("+f+" % 1)"),a+=")) "+A+" = +"+f+"; "):"boolean"==I?a+=" else if ("+f+" === 'false' || "+f+" === 0 || "+f+" === null) "+A+" = false; else if ("+f+" === 'true' || "+f+" === 1) "+A+" = true; ":"null"==I?a+=" else if ("+f+" === '' || "+f+" === 0 || "+f+" === false) "+A+" = null; ":"array"==e.opts.coerceTypes&&"array"==I&&(a+=" else if ("+R+" == 'string' || "+R+" == 'number' || "+R+" == 'boolean' || "+f+" == null) "+A+" = ["+f+"]; ");a+=" else {   ",(V=V||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",a+=P?""+x.join(","):""+x,a+="' } ",!1!==e.opts.messages&&(a+=" , message: 'should be ",a+=P?""+x.join(","):""+x,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ",v=a,a=V.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } if ("+A+" !== undefined) {  ";var $=u?"data"+(u-1||""):"parentData";a+=" "+f+" = "+A+"; ",u||(a+="if ("+$+" !== undefined)"),a+=" "+$+"["+(u?e.dataPathArr[u]:"parentDataProperty")+"] = "+A+"; } "}else(V=V||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",a+=P?""+x.join(","):""+x,a+="' } ",!1!==e.opts.messages&&(a+=" , message: 'should be ",a+=P?""+x.join(","):""+x,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ",v=a,a=V.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";a+=" } "}}if(e.schema.$ref&&!n)a+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",m&&(a+=" } if (errors === ",a+=y?"0":"errs_"+c,a+=") { ",w+="}");else{var j=e.RULES;if(j)for(var N=-1,D=j.length-1;N<D;)if(J(k=j[N+=1])){if(k.type&&(a+=" if ("+e.util.checkDataType(k.type,f,e.opts.strictNumbers)+") { "),e.opts.useDefaults)if("object"==k.type&&e.schema.properties){l=e.schema.properties;var F=Object.keys(l);if(F)for(var Z,L=-1,M=F.length-1;L<M;)if(void 0!==(U=l[Z=F[L+=1]]).default){var q=f+e.util.getProperty(Z);if(e.compositeRule){if(e.opts.strictDefaults){if(_="default is ignored for: "+q,"log"!==e.opts.strictDefaults)throw new Error(_);e.logger.warn(_)}}else a+=" if ("+q+" === undefined ","empty"==e.opts.useDefaults&&(a+=" || "+q+" === null || "+q+" === '' "),a+=" ) "+q+" = ","shared"==e.opts.useDefaults?a+=" "+e.useDefault(U.default)+" ":a+=" "+JSON.stringify(U.default)+" ",a+="; "}}else if("array"==k.type&&Array.isArray(e.schema.items)){var z=e.schema.items;if(z){O=-1;for(var U,H=z.length-1;O<H;)if(void 0!==(U=z[O+=1]).default)if(q=f+"["+O+"]",e.compositeRule){if(e.opts.strictDefaults){if(_="default is ignored for: "+q,"log"!==e.opts.strictDefaults)throw new Error(_);e.logger.warn(_)}}else a+=" if ("+q+" === undefined ","empty"==e.opts.useDefaults&&(a+=" || "+q+" === null || "+q+" === '' "),a+=" ) "+q+" = ","shared"==e.opts.useDefaults?a+=" "+e.useDefault(U.default)+" ":a+=" "+JSON.stringify(U.default)+" ",a+="; "}}var V,K=k.rules;if(K)for(var Q,G=-1,B=K.length-1;G<B;)if(Y(Q=K[G+=1])){var W=Q.code(e,Q.keyword,k.type);W&&(a+=" "+W+" ",m&&(b+="}"))}if(m&&(a+=" "+b+" ",b=""),k.type&&(a+=" } ",x&&x===k.type&&!E))a+=" else { ",h=e.schemaPath+".type",p=e.errSchemaPath+"/type",(V=V||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",a+=P?""+x.join(","):""+x,a+="' } ",!1!==e.opts.messages&&(a+=" , message: 'should be ",a+=P?""+x.join(","):""+x,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ",v=a,a=V.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ";m&&(a+=" if (errors === ",a+=y?"0":"errs_"+c,a+=") { ",w+="}")}}function J(e){for(var t=e.rules,r=0;r<t.length;r++)if(Y(t[r]))return!0}function Y(t){return void 0!==e.schema[t.keyword]||t.implements&&function(t){for(var r=t.implements,a=0;a<r.length;a++)if(void 0!==e.schema[r[a]])return!0}(t)}return m&&(a+=" "+w+" "),y?(s?(a+=" if (errors === 0) return data;           ",a+=" else throw new ValidationError(vErrors); "):(a+=" validate.errors = vErrors; ",a+=" return errors === 0;       "),a+=" }; return validate;"):a+=" var "+g+" = errors === errs_"+c+";",a}}},t={};function r(a){var s=t[a];if(void 0!==s)return s.exports;var n=t[a]={exports:{}};return e[a].call(n.exports,n,n.exports,r),n.exports}r.d=function(e,t){for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};!function(){"use strict";r.r(a),r.d(a,{McpServer:function(){return co},ResourceTemplate:function(){return uo},SamplingMessageSchema:function(){return ri},activateMcpRegistration:function(){return wo},createSampler:function(){return To},getAngieSdk:function(){return Co},getMCPByDomain:function(){return Po},init:function(){return So},registerMcp:function(){return bo},toolPrompts:function(){return Oo}});var e,t,s,n,i,o,d,c,u,l=window.elementorV2.editorV1Adapters;(function(e){e.POST_MESSAGE="postMessage"})(e||(e={})),function(e){e.POST_MESSAGE="postMessage"}(t||(t={})),function(e){e.STREAMABLE_HTTP="streamableHttp",e.SSE="sse"}(s||(s={})),function(e){e.LOCAL="local",e.REMOTE="remote"}(n||(n={})),function(e){e.SDK_ANGIE_READY_PING="sdk-angie-ready-ping",e.SDK_ANGIE_REFRESH_PING="sdk-angie-refresh-ping",e.SDK_REQUEST_CLIENT_CREATION="sdk-request-client-creation",e.SDK_REQUEST_INIT_SERVER="sdk-request-init-server",e.SDK_TRIGGER_ANGIE="sdk-trigger-angie",e.SDK_TRIGGER_ANGIE_RESPONSE="sdk-trigger-angie-response"}(i||(i={})),function(e){e.SET="ANGIE_SET_LOCALSTORAGE",e.GET="ANGIE_GET_LOCALSTORAGE"}(o||(o={})),function(e){e.RESET_HASH="reset-hash",e.HOST_READY="host/ready",e.ANGIE_LOADED="angie/loaded",e.ANGIE_READY="angie/ready"}(d||(d={}));class h{isAngieReady=!1;readyPromise;readyResolve;constructor(){if(this.readyPromise=new Promise(e=>{this.readyResolve=e}),"undefined"==typeof window)return;let e=0;const t=()=>{if(this.isAngieReady||e>=500)return void(!this.isAngieReady&&e>=500&&this.handleDetectionTimeout());const r=new MessageChannel;r.port1.onmessage=e=>{this.handleAngieReady(e.data),r.port1.close(),r.port2.close()};const a={type:i.SDK_ANGIE_READY_PING,timestamp:Date.now()};window.postMessage(a,window.location.origin,[r.port2]),e++,setTimeout(t,500)};t()}handleAngieReady(e){this.isAngieReady=!0;const t={isReady:!0,version:e.version,capabilities:e.capabilities};this.readyResolve&&this.readyResolve(t)}handleDetectionTimeout(){this.readyResolve&&this.readyResolve({isReady:!1}),console.warn("AngieMcpSdk: AngieDetector: Detection timeout - Angie may not be available")}isReady(){return this.isAngieReady}async waitForReady(){return this.readyPromise}}class p{queue=[];isProcessing=!1;add(e){const t={id:this.generateId(e),config:e,timestamp:Date.now(),status:"pending"};return this.queue.push(t),console.log(`RegistrationQueue: Added server "${e.name}" to queue`),t}getAll(){return[...this.queue]}getPending(){return this.queue.filter(e=>"pending"===e.status)}updateStatus(e,t,r){const a=this.queue.find(t=>t.id===e);a&&(a.status=t,r?a.error=r:"pending"!==t&&"registered"!==t||delete a.error,console.log(`RegistrationQueue: Updated server ${e} status to ${t}`))}async processQueue(e){if(this.isProcessing)return void console.log("RegistrationQueue: Already processing queue");this.isProcessing=!0;const t=this.getPending();console.log(`RegistrationQueue: Processing ${t.length} pending registrations`);try{for(const r of t)try{await e(r),this.updateStatus(r.id,"registered")}catch(e){const t=e instanceof Error?e.message:String(e);this.updateStatus(r.id,"failed",t),console.error(`RegistrationQueue: Failed to process registration ${r.id}:`,t)}}finally{this.isProcessing=!1}}clear(){this.queue=[],console.log("RegistrationQueue: Cleared all registrations")}resetAllToPending(){if(this.isProcessing)return console.log("RegistrationQueue: Cannot reset to pending - processing in progress"),!1;const e=this.queue.filter(e=>"registered"===e.status).length,t=this.queue.filter(e=>"failed"===e.status).length;return this.queue.forEach(e=>{"pending"!==e.status&&(e.status="pending",delete e.error)}),console.log(`RegistrationQueue: Reset ${e+t} registrations to pending`),!0}remove(e){const t=this.queue.findIndex(t=>t.id===e);return-1!==t&&(this.queue.splice(t,1),console.log(`RegistrationQueue: Removed registration ${e}`),!0)}generateId(e){return`reg_${e.name}_${e.version}_${Date.now()}`}}class m{async requestClientCreation(e){const{config:r}=e,a={serverId:e.id,serverName:r.name,serverVersion:r.version,description:r.description,transport:r.transport||t.POST_MESSAGE,capabilities:r.capabilities,instanceId:e.instanceId};return"type"in r&&"remote"===r.type&&(a.remote={url:r.url}),new Promise((e,t)=>{const r=new MessageChannel,s=setTimeout(()=>{t(new Error("Client creation request timed out after 15000ms"))},15e3);r.port1.onmessage=t=>{clearTimeout(s),e(t.data)};const n={type:i.SDK_REQUEST_CLIENT_CREATION,payload:a,timestamp:Date.now()};window.postMessage(n,window.location.origin,[r.port2])})}}!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),a={};for(const e of r)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(c||(c={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(u||(u={}));const f=c.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),g=e=>{switch(typeof e){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(e)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(e)?f.array:null===e?f.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?f.promise:"undefined"!=typeof Map&&e instanceof Map?f.map:"undefined"!=typeof Set&&e instanceof Set?f.set:"undefined"!=typeof Date&&e instanceof Date?f.date:f.object;default:return f.unknown}},v=c.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"]);class y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(a);else if("invalid_return_type"===s.code)a(s.returnTypeError);else if("invalid_arguments"===s.code)a(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){const r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,c.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const a of this.issues)if(a.path.length>0){const r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const _=(e,t)=>{let r;switch(e.code){case v.invalid_type:r=e.received===f.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case v.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,c.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:r=`Unrecognized key(s) in object: ${c.joinValues(e.keys,", ")}`;break;case v.invalid_union:r="Invalid input";break;case v.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${c.joinValues(e.options)}`;break;case v.invalid_enum_value:r=`Invalid enum value. Expected ${c.joinValues(e.options)}, received '${e.received}'`;break;case v.invalid_arguments:r="Invalid function arguments";break;case v.invalid_return_type:r="Invalid function return type";break;case v.invalid_date:r="Invalid date";break;case v.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:c.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case v.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case v.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case v.custom:r="Invalid input";break;case v.invalid_intersection_types:r="Intersection results could not be merged";break;case v.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case v.not_finite:r="Number must be finite";break;default:r=t.defaultError,c.assertNever(e)}return{message:r}};let b=_;var w;function x(e,t){const r=b,a=(e=>{const{data:t,path:r,errorMaps:a,issueData:s}=e,n=[...r,...s.path||[]],i={...s,path:n};if(void 0!==s.message)return{...s,path:n,message:s.message};let o="";const d=a.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...s,path:n,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===_?void 0:_].filter(e=>!!e)});e.common.issues.push(a)}!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(w||(w={}));class P{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if("aborted"===a.status)return E;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return P.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:t,value:s}=a;if("aborted"===t.status)return E;if("aborted"===s.status)return E;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!a.alwaysSet||(r[t.value]=s.value)}return{status:e.value,value:r}}}const E=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),S=e=>({status:"valid",value:e}),R=e=>"aborted"===e.status,A=e=>"dirty"===e.status,T=e=>"valid"===e.status,I=e=>"undefined"!=typeof Promise&&e instanceof Promise;class O{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}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}}const C=(e,t)=>{if(T(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function $(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:a,description:s}=e;if(t&&(r||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{const{message:n}=e;return"invalid_enum_value"===t.code?{message:n??s.defaultError}:void 0===s.data?{message:n??a??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:n??r??s.defaultError}},description:s}}class j{get description(){return this._def.description}_getType(e){return g(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:g(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:g(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(I(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:g(e)},a=this._parseSync({data:e,path:r.path,parent:r});return C(r,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:g(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return T(r)?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>T(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:g(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(I(a)?a:Promise.resolve(a));return C(r,s)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,a)=>{const s=e(t),n=()=>a.addIssue({code:v.custom,...r(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then(e=>!!e||(n(),!1)):!!s||(n(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new Ne({schema:this,typeName:He.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:e=>this["~validate"](e)}}optional(){return De.create(this,this._def)}nullable(){return Fe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.create(this)}promise(){return je.create(this,this._def)}or(e){return be.create([this,e],this._def)}and(e){return Ee.create(this,e,this._def)}transform(e){return new Ne({...$(this._def),schema:this,typeName:He.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ze({...$(this._def),innerType:this,defaultValue:t,typeName:He.ZodDefault})}brand(){return new qe({typeName:He.ZodBranded,type:this,...$(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Le({...$(this._def),innerType:this,catchValue:t,typeName:He.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ze.create(this,e)}readonly(){return Ue.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const N=/^c[^\s-]{8,}$/i,D=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Z=/^[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,L=/^[a-z0-9_-]{21}$/i,M=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,q=/^[-+]?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)?)??$/,z=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let U;const H=/^(?:(?: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])$/,V=/^(?:(?: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])$/,K=/^(([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]))$/,Q=/^(([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])$/,G=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,W="((\\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])))",J=new RegExp(`^${W}$`);function Y(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function X(e){return new RegExp(`^${Y(e)}$`)}function ee(e){let t=`${W}T${Y(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function te(e,t){return!("v4"!==t&&t||!H.test(e))||!("v6"!==t&&t||!K.test(e))}function re(e,t){if(!M.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(a));return!("object"!=typeof s||null===s||"typ"in s&&"JWT"!==s?.typ||!s.alg||t&&s.alg!==t)}catch{return!1}}function ae(e,t){return!("v4"!==t&&t||!V.test(e))||!("v6"!==t&&t||!Q.test(e))}class se extends j{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.string,received:t.parsedType}),E}const t=new P;let r;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),x(r,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),x(r,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const s=e.data.length>a.value,n=e.data.length<a.value;(s||n)&&(r=this._getOrReturnCtx(e,r),s?x(r,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):n&&x(r,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)z.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"email",code:v.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)U||(U=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),U.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"emoji",code:v.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Z.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"uuid",code:v.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)L.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"nanoid",code:v.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)N.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"cuid",code:v.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)D.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"cuid2",code:v.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)F.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"ulid",code:v.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),x(r,{validation:"url",code:v.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"regex",code:v.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),x(r,{code:v.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),x(r,{code:v.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),x(r,{code:v.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?ee(a).test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{code:v.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?J.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{code:v.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?X(a).test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{code:v.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?q.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"duration",code:v.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?te(e.data,a.version)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"ip",code:v.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?re(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"jwt",code:v.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?ae(e.data,a.version)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"cidr",code:v.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?G.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"base64",code:v.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?B.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"base64url",code:v.invalid_string,message:a.message}),t.dirty()):c.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:v.invalid_string,...w.errToObj(r)})}_addCheck(e){return new se({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...w.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...w.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...w.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...w.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...w.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...w.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...w.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...w.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...w.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...w.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...w.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.errToObj(t)})}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new se({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new se({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new se({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ne(e,t){const r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}se.create=e=>new se({checks:[],typeName:He.ZodString,coerce:e?.coerce??!1,...$(e)});class ie extends j{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)!==f.number){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.number,received:t.parsedType}),E}let t;const r=new P;for(const a of this._def.checks)"int"===a.kind?c.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:v.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:v.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:v.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==ne(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:v.not_finite,message:a.message}),r.dirty()):c.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,r,a){return new ie({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:w.toString(a)}]})}_addCheck(e){return new ie({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&c.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ie.create=e=>new ie({checks:[],typeName:He.ZodNumber,coerce:e?.coerce||!1,...$(e)});class oe extends j{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)!==f.bigint)return this._getInvalidInput(e);let t;const r=new P;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:v.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:v.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),x(t,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):c.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.bigint,received:t.parsedType}),E}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,r,a){return new oe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:w.toString(a)}]})}_addCheck(e){return new oe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}oe.create=e=>new oe({checks:[],typeName:He.ZodBigInt,coerce:e?.coerce??!1,...$(e)});class de extends j{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==f.boolean){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.boolean,received:t.parsedType}),E}return S(e.data)}}de.create=e=>new de({typeName:He.ZodBoolean,coerce:e?.coerce||!1,...$(e)});class ce extends j{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.date,received:t.parsedType}),E}if(Number.isNaN(e.data.getTime()))return x(this._getOrReturnCtx(e),{code:v.invalid_date}),E;const t=new P;let r;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),x(r,{code:v.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),x(r,{code:v.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):c.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ce({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ce.create=e=>new ce({checks:[],coerce:e?.coerce||!1,typeName:He.ZodDate,...$(e)});class ue extends j{_parse(e){if(this._getType(e)!==f.symbol){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.symbol,received:t.parsedType}),E}return S(e.data)}}ue.create=e=>new ue({typeName:He.ZodSymbol,...$(e)});class le extends j{_parse(e){if(this._getType(e)!==f.undefined){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.undefined,received:t.parsedType}),E}return S(e.data)}}le.create=e=>new le({typeName:He.ZodUndefined,...$(e)});class he extends j{_parse(e){if(this._getType(e)!==f.null){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.null,received:t.parsedType}),E}return S(e.data)}}he.create=e=>new he({typeName:He.ZodNull,...$(e)});class pe extends j{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}}pe.create=e=>new pe({typeName:He.ZodAny,...$(e)});class me extends j{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}}me.create=e=>new me({typeName:He.ZodUnknown,...$(e)});class fe extends j{_parse(e){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.never,received:t.parsedType}),E}}fe.create=e=>new fe({typeName:He.ZodNever,...$(e)});class ge extends j{_parse(e){if(this._getType(e)!==f.undefined){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.void,received:t.parsedType}),E}return S(e.data)}}ge.create=e=>new ge({typeName:He.ZodVoid,...$(e)});class ve extends j{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==f.array)return x(t,{code:v.invalid_type,expected:f.array,received:t.parsedType}),E;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,s=t.data.length<a.exactLength.value;(e||s)&&(x(t,{code:e?v.too_big:v.too_small,minimum:s?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(x(t,{code:v.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(x(t,{code:v.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new O(t,e,t.path,r)))).then(e=>P.mergeArray(r,e));const s=[...t.data].map((e,r)=>a.type._parseSync(new O(t,e,t.path,r)));return P.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new ve({...this._def,minLength:{value:e,message:w.toString(t)}})}max(e,t){return new ve({...this._def,maxLength:{value:e,message:w.toString(t)}})}length(e,t){return new ve({...this._def,exactLength:{value:e,message:w.toString(t)}})}nonempty(e){return this.min(1,e)}}function ye(e){if(e instanceof _e){const t={};for(const r in e.shape){const a=e.shape[r];t[r]=De.create(ye(a))}return new _e({...e._def,shape:()=>t})}return e instanceof ve?new ve({...e._def,type:ye(e.element)}):e instanceof De?De.create(ye(e.unwrap())):e instanceof Fe?Fe.create(ye(e.unwrap())):e instanceof ke?ke.create(e.items.map(e=>ye(e))):e}ve.create=(e,t)=>new ve({type:e,minLength:null,maxLength:null,exactLength:null,typeName:He.ZodArray,...$(t)});class _e extends j{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=c.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.object,received:t.parsedType}),E}const{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),n=[];if(!(this._def.catchall instanceof fe&&"strip"===this._def.unknownKeys))for(const e in r.data)s.includes(e)||n.push(e);const i=[];for(const e of s){const t=a[e],s=r.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new O(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof fe){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of n)i.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)n.length>0&&(x(r,{code:v.unrecognized_keys,keys:n}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of n){const a=r.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new O(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>P.mergeObjectSync(t,e)):P.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new _e({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{const a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:w.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new _e({...this._def,unknownKeys:"strip"})}passthrough(){return new _e({...this._def,unknownKeys:"passthrough"})}extend(e){return new _e({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new _e({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:He.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new _e({...this._def,catchall:e})}pick(e){const t={};for(const r of c.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new _e({...this._def,shape:()=>t})}omit(e){const t={};for(const r of c.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new _e({...this._def,shape:()=>t})}deepPartial(){return ye(this)}partial(e){const t={};for(const r of c.objectKeys(this.shape)){const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new _e({...this._def,shape:()=>t})}required(e){const t={};for(const r of c.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof De;)e=e._def.innerType;t[r]=e}return new _e({...this._def,shape:()=>t})}keyof(){return Oe(c.objectKeys(this.shape))}}_e.create=(e,t)=>new _e({shape:()=>e,unknownKeys:"strip",catchall:fe.create(),typeName:He.ZodObject,...$(t)}),_e.strictCreate=(e,t)=>new _e({shape:()=>e,unknownKeys:"strict",catchall:fe.create(),typeName:He.ZodObject,...$(t)}),_e.lazycreate=(e,t)=>new _e({shape:e,unknownKeys:"strip",catchall:fe.create(),typeName:He.ZodObject,...$(t)});class be extends j{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map(e=>new y(e.ctx.common.issues));return x(t,{code:v.invalid_union,unionErrors:r}),E});{let e;const a=[];for(const s of r){const r={...t,common:{...t.common,issues:[]},parent:null},n=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=a.map(e=>new y(e));return x(t,{code:v.invalid_union,unionErrors:s}),E}}get options(){return this._def.options}}be.create=(e,t)=>new be({options:e,typeName:He.ZodUnion,...$(t)});const we=e=>e instanceof Te?we(e.schema):e instanceof Ne?we(e.innerType()):e instanceof Ie?[e.value]:e instanceof Ce?e.options:e instanceof $e?c.objectValues(e.enum):e instanceof Ze?we(e._def.innerType):e instanceof le?[void 0]:e instanceof he?[null]:e instanceof De?[void 0,...we(e.unwrap())]:e instanceof Fe?[null,...we(e.unwrap())]:e instanceof qe||e instanceof Ue?we(e.unwrap()):e instanceof Le?we(e._def.innerType):[];class xe extends j{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return x(t,{code:v.invalid_type,expected:f.object,received:t.parsedType}),E;const r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(x(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const a=new Map;for(const r of t){const t=we(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,r)}}return new xe({typeName:He.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$(r)})}}function Pe(e,t){const r=g(e),a=g(t);if(e===t)return{valid:!0,data:e};if(r===f.object&&a===f.object){const r=c.objectKeys(t),a=c.objectKeys(e).filter(e=>-1!==r.indexOf(e)),s={...e,...t};for(const r of a){const a=Pe(e[r],t[r]);if(!a.valid)return{valid:!1};s[r]=a.data}return{valid:!0,data:s}}if(r===f.array&&a===f.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let a=0;a<e.length;a++){const s=Pe(e[a],t[a]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return r===f.date&&a===f.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class Ee extends j{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if(R(e)||R(a))return E;const s=Pe(e.value,a.value);return s.valid?((A(e)||A(a))&&t.dirty(),{status:t.value,value:s.data}):(x(r,{code:v.invalid_intersection_types}),E)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ee.create=(e,t,r)=>new Ee({left:e,right:t,typeName:He.ZodIntersection,...$(r)});class ke extends j{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.array)return x(r,{code:v.invalid_type,expected:f.array,received:r.parsedType}),E;if(r.data.length<this._def.items.length)return x(r,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&r.data.length>this._def.items.length&&(x(r,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new O(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>P.mergeArray(t,e)):P.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ke({...this._def,rest:e})}}ke.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ke({items:e,typeName:He.ZodTuple,rest:null,...$(t)})};class Se extends j{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return x(r,{code:v.invalid_type,expected:f.object,received:r.parsedType}),E;const a=[],s=this._def.keyType,n=this._def.valueType;for(const e in r.data)a.push({key:s._parse(new O(r,e,r.path,e)),value:n._parse(new O(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?P.mergeObjectAsync(t,a):P.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new Se(t instanceof j?{keyType:e,valueType:t,typeName:He.ZodRecord,...$(r)}:{keyType:se.create(),valueType:e,typeName:He.ZodRecord,...$(t)})}}class Re extends j{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.map)return x(r,{code:v.invalid_type,expected:f.map,received:r.parsedType}),E;const a=this._def.keyType,s=this._def.valueType,n=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new O(r,e,r.path,[n,"key"])),value:s._parse(new O(r,t,r.path,[n,"value"]))}));if(r.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const r of n){const a=await r.key,s=await r.value;if("aborted"===a.status||"aborted"===s.status)return E;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}})}{const e=new Map;for(const r of n){const a=r.key,s=r.value;if("aborted"===a.status||"aborted"===s.status)return E;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}}}Re.create=(e,t,r)=>new Re({valueType:t,keyType:e,typeName:He.ZodMap,...$(r)});class Ae extends j{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.set)return x(r,{code:v.invalid_type,expected:f.set,received:r.parsedType}),E;const a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(x(r,{code:v.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(x(r,{code:v.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const s=this._def.valueType;function n(e){const r=new Set;for(const a of e){if("aborted"===a.status)return E;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}const i=[...r.data.values()].map((e,t)=>s._parse(new O(r,e,r.path,t)));return r.common.async?Promise.all(i).then(e=>n(e)):n(i)}min(e,t){return new Ae({...this._def,minSize:{value:e,message:w.toString(t)}})}max(e,t){return new Ae({...this._def,maxSize:{value:e,message:w.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ae.create=(e,t)=>new Ae({valueType:e,minSize:null,maxSize:null,typeName:He.ZodSet,...$(t)});class Te extends j{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Te.create=(e,t)=>new Te({getter:e,typeName:He.ZodLazy,...$(t)});class Ie extends j{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return x(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Oe(e,t){return new Ce({values:e,typeName:He.ZodEnum,...$(t)})}Ie.create=(e,t)=>new Ie({value:e,typeName:He.ZodLiteral,...$(t)});class Ce extends j{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return x(t,{expected:c.joinValues(r),received:t.parsedType,code:v.invalid_type}),E}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return x(t,{received:t.data,code:v.invalid_enum_value,options:r}),E}return S(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ce.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ce.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Ce.create=Oe;class $e extends j{_parse(e){const t=c.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==f.string&&r.parsedType!==f.number){const e=c.objectValues(t);return x(r,{expected:c.joinValues(e),received:r.parsedType,code:v.invalid_type}),E}if(this._cache||(this._cache=new Set(c.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=c.objectValues(t);return x(r,{received:r.data,code:v.invalid_enum_value,options:e}),E}return S(e.data)}get enum(){return this._def.values}}$e.create=(e,t)=>new $e({values:e,typeName:He.ZodNativeEnum,...$(t)});class je extends j{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&!1===t.common.async)return x(t,{code:v.invalid_type,expected:f.promise,received:t.parsedType}),E;const r=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return S(r.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}je.create=(e,t)=>new je({type:e,typeName:He.ZodPromise,...$(t)});class Ne extends j{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===He.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:e=>{x(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===a.type){const e=a.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return E;const a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?E:"dirty"===a.status||"dirty"===t.value?k(a.value):a});{if("aborted"===t.value)return E;const a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?E:"dirty"===a.status||"dirty"===t.value?k(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?E:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?E:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))))}if("transform"===a.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!T(e))return E;const n=a.transform(e.value,s);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>T(e)?Promise.resolve(a.transform(e.value,s)).then(e=>({status:t.value,value:e})):E)}c.assertNever(a)}}Ne.create=(e,t,r)=>new Ne({schema:e,typeName:He.ZodEffects,effect:t,...$(r)}),Ne.createWithPreprocess=(e,t,r)=>new Ne({schema:t,effect:{type:"preprocess",transform:e},typeName:He.ZodEffects,...$(r)});class De extends j{_parse(e){return this._getType(e)===f.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}De.create=(e,t)=>new De({innerType:e,typeName:He.ZodOptional,...$(t)});class Fe extends j{_parse(e){return this._getType(e)===f.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Fe.create=(e,t)=>new Fe({innerType:e,typeName:He.ZodNullable,...$(t)});class Ze extends j{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===f.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ze.create=(e,t)=>new Ze({innerType:e,typeName:He.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$(t)});class Le extends j{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return I(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new y(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Le.create=(e,t)=>new Le({innerType:e,typeName:He.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$(t)});class Me extends j{_parse(e){if(this._getType(e)!==f.nan){const t=this._getOrReturnCtx(e);return x(t,{code:v.invalid_type,expected:f.nan,received:t.parsedType}),E}return{status:"valid",value:e.data}}}Me.create=e=>new Me({typeName:He.ZodNaN,...$(e)}),Symbol("zod_brand");class qe extends j{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ze extends j{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?E:"dirty"===e.status?(t.dirty(),k(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?E:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ze({in:e,out:t,typeName:He.ZodPipeline})}}class Ue extends j{_parse(e){const t=this._def.innerType._parse(e),r=e=>(T(e)&&(e.value=Object.freeze(e.value)),e);return I(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}var He;Ue.create=(e,t)=>new Ue({innerType:e,typeName:He.ZodReadonly,...$(t)}),_e.lazycreate,function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(He||(He={}));const Ve=se.create,Ke=ie.create,Qe=(Me.create,oe.create,de.create),Ge=(ce.create,ue.create,le.create,he.create,pe.create,me.create),Be=(fe.create,ge.create,ve.create),We=_e.create,Je=(_e.strictCreate,be.create),Ye=xe.create,Xe=(Ee.create,ke.create,Se.create),et=(Re.create,Ae.create,Te.create,Ie.create),tt=Ce.create,rt=($e.create,je.create,Ne.create,De.create),at=(Fe.create,Ne.createWithPreprocess,ze.create,"2.0"),st=Je([Ve(),Ke().int()]),nt=Ve(),it=We({progressToken:rt(st)}).passthrough(),ot=We({_meta:rt(it)}).passthrough(),dt=We({method:Ve(),params:rt(ot)}),ct=We({_meta:rt(We({}).passthrough())}).passthrough(),ut=We({method:Ve(),params:rt(ct)}),lt=We({_meta:rt(We({}).passthrough())}).passthrough(),ht=Je([Ve(),Ke().int()]),pt=We({jsonrpc:et(at),id:ht}).merge(dt).strict(),mt=We({jsonrpc:et(at)}).merge(ut).strict(),ft=We({jsonrpc:et(at),id:ht,result:lt}).strict();var gt;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(gt||(gt={}));const vt=Je([pt,mt,ft,We({jsonrpc:et(at),id:ht,error:We({code:Ke().int(),message:Ve(),data:rt(Ge())})}).strict()]),yt=lt.strict(),_t=ut.extend({method:et("notifications/cancelled"),params:ct.extend({requestId:ht,reason:Ve().optional()})}),bt=We({name:Ve(),title:rt(Ve())}).passthrough(),wt=bt.extend({version:Ve()}),xt=We({experimental:rt(We({}).passthrough()),sampling:rt(We({}).passthrough()),elicitation:rt(We({}).passthrough()),roots:rt(We({listChanged:rt(Qe())}).passthrough())}).passthrough(),Pt=dt.extend({method:et("initialize"),params:ot.extend({protocolVersion:Ve(),capabilities:xt,clientInfo:wt})}),Et=We({experimental:rt(We({}).passthrough()),logging:rt(We({}).passthrough()),completions:rt(We({}).passthrough()),prompts:rt(We({listChanged:rt(Qe())}).passthrough()),resources:rt(We({subscribe:rt(Qe()),listChanged:rt(Qe())}).passthrough()),tools:rt(We({listChanged:rt(Qe())}).passthrough())}).passthrough(),kt=lt.extend({protocolVersion:Ve(),capabilities:Et,serverInfo:wt,instructions:rt(Ve())}),St=ut.extend({method:et("notifications/initialized")}),Rt=dt.extend({method:et("ping")}),At=We({progress:Ke(),total:rt(Ke()),message:rt(Ve())}).passthrough(),Tt=ut.extend({method:et("notifications/progress"),params:ct.merge(At).extend({progressToken:st})}),It=dt.extend({params:ot.extend({cursor:rt(nt)}).optional()}),Ot=lt.extend({nextCursor:rt(nt)}),Ct=We({uri:Ve(),mimeType:rt(Ve()),_meta:rt(We({}).passthrough())}).passthrough(),$t=Ct.extend({text:Ve()}),jt=Ve().refine(e=>{try{return atob(e),!0}catch(e){return!1}},{message:"Invalid Base64 string"}),Nt=Ct.extend({blob:jt}),Dt=bt.extend({uri:Ve(),description:rt(Ve()),mimeType:rt(Ve()),_meta:rt(We({}).passthrough())}),Ft=bt.extend({uriTemplate:Ve(),description:rt(Ve()),mimeType:rt(Ve()),_meta:rt(We({}).passthrough())}),Zt=It.extend({method:et("resources/list")}),Lt=Ot.extend({resources:Be(Dt)}),Mt=It.extend({method:et("resources/templates/list")}),qt=Ot.extend({resourceTemplates:Be(Ft)}),zt=dt.extend({method:et("resources/read"),params:ot.extend({uri:Ve()})}),Ut=lt.extend({contents:Be(Je([$t,Nt]))}),Ht=ut.extend({method:et("notifications/resources/list_changed")}),Vt=dt.extend({method:et("resources/subscribe"),params:ot.extend({uri:Ve()})}),Kt=dt.extend({method:et("resources/unsubscribe"),params:ot.extend({uri:Ve()})}),Qt=ut.extend({method:et("notifications/resources/updated"),params:ct.extend({uri:Ve()})}),Gt=We({name:Ve(),description:rt(Ve()),required:rt(Qe())}).passthrough(),Bt=bt.extend({description:rt(Ve()),arguments:rt(Be(Gt)),_meta:rt(We({}).passthrough())}),Wt=It.extend({method:et("prompts/list")}),Jt=Ot.extend({prompts:Be(Bt)}),Yt=dt.extend({method:et("prompts/get"),params:ot.extend({name:Ve(),arguments:rt(Xe(Ve()))})}),Xt=We({type:et("text"),text:Ve(),_meta:rt(We({}).passthrough())}).passthrough(),er=We({type:et("image"),data:jt,mimeType:Ve(),_meta:rt(We({}).passthrough())}).passthrough(),tr=We({type:et("audio"),data:jt,mimeType:Ve(),_meta:rt(We({}).passthrough())}).passthrough(),rr=We({type:et("resource"),resource:Je([$t,Nt]),_meta:rt(We({}).passthrough())}).passthrough(),ar=Je([Xt,er,tr,Dt.extend({type:et("resource_link")}),rr]),sr=We({role:tt(["user","assistant"]),content:ar}).passthrough(),nr=lt.extend({description:rt(Ve()),messages:Be(sr)}),ir=ut.extend({method:et("notifications/prompts/list_changed")}),or=We({title:rt(Ve()),readOnlyHint:rt(Qe()),destructiveHint:rt(Qe()),idempotentHint:rt(Qe()),openWorldHint:rt(Qe())}).passthrough(),dr=bt.extend({description:rt(Ve()),inputSchema:We({type:et("object"),properties:rt(We({}).passthrough()),required:rt(Be(Ve()))}).passthrough(),outputSchema:rt(We({type:et("object"),properties:rt(We({}).passthrough()),required:rt(Be(Ve()))}).passthrough()),annotations:rt(or),_meta:rt(We({}).passthrough())}),cr=It.extend({method:et("tools/list")}),ur=Ot.extend({tools:Be(dr)}),lr=lt.extend({content:Be(ar).default([]),structuredContent:We({}).passthrough().optional(),isError:rt(Qe())}),hr=(lr.or(lt.extend({toolResult:Ge()})),dt.extend({method:et("tools/call"),params:ot.extend({name:Ve(),arguments:rt(Xe(Ge()))})})),pr=ut.extend({method:et("notifications/tools/list_changed")}),mr=tt(["debug","info","notice","warning","error","critical","alert","emergency"]),fr=dt.extend({method:et("logging/setLevel"),params:ot.extend({level:mr})}),gr=ut.extend({method:et("notifications/message"),params:ct.extend({level:mr,logger:rt(Ve()),data:Ge()})}),vr=We({name:Ve().optional()}).passthrough(),yr=We({hints:rt(Be(vr)),costPriority:rt(Ke().min(0).max(1)),speedPriority:rt(Ke().min(0).max(1)),intelligencePriority:rt(Ke().min(0).max(1))}).passthrough(),_r=We({role:tt(["user","assistant"]),content:Je([Xt,er,tr])}).passthrough(),br=dt.extend({method:et("sampling/createMessage"),params:ot.extend({messages:Be(_r),systemPrompt:rt(Ve()),includeContext:rt(tt(["none","thisServer","allServers"])),temperature:rt(Ke()),maxTokens:Ke().int(),stopSequences:rt(Be(Ve())),metadata:rt(We({}).passthrough()),modelPreferences:rt(yr)})}),wr=lt.extend({model:Ve(),stopReason:rt(tt(["endTurn","stopSequence","maxTokens"]).or(Ve())),role:tt(["user","assistant"]),content:Ye("type",[Xt,er,tr])}),xr=Je([We({type:et("boolean"),title:rt(Ve()),description:rt(Ve()),default:rt(Qe())}).passthrough(),We({type:et("string"),title:rt(Ve()),description:rt(Ve()),minLength:rt(Ke()),maxLength:rt(Ke()),format:rt(tt(["email","uri","date","date-time"]))}).passthrough(),We({type:tt(["number","integer"]),title:rt(Ve()),description:rt(Ve()),minimum:rt(Ke()),maximum:rt(Ke())}).passthrough(),We({type:et("string"),title:rt(Ve()),description:rt(Ve()),enum:Be(Ve()),enumNames:rt(Be(Ve()))}).passthrough()]),Pr=dt.extend({method:et("elicitation/create"),params:ot.extend({message:Ve(),requestedSchema:We({type:et("object"),properties:Xe(Ve(),xr),required:rt(Be(Ve()))}).passthrough()})}),Er=lt.extend({action:tt(["accept","decline","cancel"]),content:rt(Xe(Ve(),Ge()))}),kr=We({type:et("ref/resource"),uri:Ve()}).passthrough(),Sr=We({type:et("ref/prompt"),name:Ve()}).passthrough(),Rr=dt.extend({method:et("completion/complete"),params:ot.extend({ref:Je([Sr,kr]),argument:We({name:Ve(),value:Ve()}).passthrough(),context:rt(We({arguments:rt(Xe(Ve(),Ve()))}))})}),Ar=lt.extend({completion:We({values:Be(Ve()).max(100),total:rt(Ke().int()),hasMore:rt(Qe())}).passthrough()}),Tr=We({uri:Ve().startsWith("file://"),name:rt(Ve()),_meta:rt(We({}).passthrough())}).passthrough(),Ir=dt.extend({method:et("roots/list")}),Or=lt.extend({roots:Be(Tr)}),Cr=ut.extend({method:et("notifications/roots/list_changed")});Je([Rt,Pt,Rr,fr,Yt,Wt,Zt,Mt,zt,Vt,Kt,hr,cr]),Je([_t,Tt,St,Cr]),Je([yt,wr,Er,Or]),Je([Rt,br,Pr,Ir]),Je([_t,Tt,gr,Qt,Ht,pr,ir]),Je([yt,kt,Ar,nr,Jt,Lt,qt,Ut,lr,ur]),Error;class $r{sessionId;onmessage;onerror;onclose;_port;_started=!1;_closed=!1;constructor(e,t){if(!e)throw new Error("MessagePort is required");this._port=e,this.sessionId=t||this.generateId(),this._port.onmessage=e=>{try{const t=vt.parse(e.data);this.onmessage?.(t)}catch(e){const t=new Error(`Failed to parse message: ${e}`);this.onerror?.(t)}},this._port.onmessageerror=e=>{const t=new Error(`MessagePort error: ${JSON.stringify(e)}`);this.onerror?.(t)}}static generateSessionId(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,10)}`}async start(){if(this._started)throw new Error("BrowserContextTransport already started! If using Client or Server class, note that connect() calls start() automatically.");if(this._closed)throw new Error("Cannot start a closed BrowserContextTransport");this._started=!0,this._port.start()}async send(e){if(this._closed)throw new Error("Cannot send on a closed BrowserContextTransport");return new Promise((t,r)=>{try{this._port.postMessage(e),t()}catch(e){const t=e instanceof Error?e:new Error(String(e));this.onerror?.(t),r(t)}})}async close(){this._closed||(this._closed=!0,this._port.close(),this.onclose?.())}generateId(){return $r.generateSessionId()}}let jr=null;const Nr=()=>(jr&&document.contains(jr)||(jr=document.querySelector('iframe[src*="angie/"]')),jr),Dr=(e,t)=>{console.log("postMessageToAngieIframe",e,t);const r=Nr();if(!r?.contentWindow)return!1;const a=t||(()=>{const e=Nr();if(!e)return null;try{return new URL(e.src).origin}catch(e){return console.error("Error parsing iframe URL:",e),null}})();return a?(r.contentWindow.postMessage(e,a),!0):(console.error("Could not determine target origin for Angie iframe"),!1)};let Fr=!1;const Zr=(e,t)=>{const r=document.getElementById("angie-sidebar-container");r&&r.setAttribute("aria-hidden",t?"false":"true"),t?e.removeAttribute("tabindex"):e.setAttribute("tabindex","-1")},Lr=(e,t)=>{e.postMessage({status:"success",payload:t})},Mr=(e,t)=>{e.postMessage({status:"error",payload:t})};var qr;(qr||(qr={})).POST_MESSAGE="postMessage";const zr={open:!1,iframe:null,iframeUrlObject:null};function Ur(){const e=new URL(window.location.href);e.searchParams.set("start-oauth","1"),console.log("OAuth: Redirecting to wp-admin with OAuth:",e.toString()),window.location.href=e.toString()}var Hr,Vr,Kr;!function(e){e.SDK_ANGIE_ALL_SERVERS_REGISTERED="sdk-angie-all-servers-registered",e.SDK_ANGIE_READY_PING="sdk-angie-ready-ping",e.SDK_REQUEST_CLIENT_CREATION="sdk-request-client-creation",e.SDK_TRIGGER_ANGIE="sdk-trigger-angie",e.SDK_TRIGGER_ANGIE_RESPONSE="sdk-trigger-angie-response",e.ANGIE_SIDEBAR_RESIZED="angie-sidebar-resized",e.ANGIE_SIDEBAR_TOGGLED="angie-sidebar-toggled",e.ANGIE_CHAT_TOGGLE="angie-chat-toggle",e.ANGIE_STUDIO_TOGGLE="angie-studio-toggle",e.ANGIE_NAVIGATE_TO_URL="angie/navigate-to-url",e.ANGIE_PAGE_RELOAD="angie/page-reload"}(Hr||(Hr={}));class Qr{angieDetector;registrationQueue;clientManager;isInitialized=!1;instanceId;constructor(){this.instanceId=Math.random().toString(36).substring(2,8),console.log(`AngieMcpSdk: Constructor called - initializing SDK (Instance: ${this.instanceId})`),this.angieDetector=new h,this.registrationQueue=new p,this.clientManager=new m,console.log(`AngieMcpSdk: Setting up event handlers (Instance: ${this.instanceId})`),this.setupAngieReadyHandler(),this.setupServerInitHandler(),this.setupReRegistrationHandler(),console.log(`AngieMcpSdk: SDK initialization complete (Instance: ${this.instanceId})`)}async loadSidebar(e){!function(){if("undefined"==typeof document||Fr)return;const e="angie-sidebar-styles";if(document.getElementById(e))return void(Fr=!0);const t=document.createElement("style");t.id=e,t.textContent="/* Angie Sidebar - CSS Variables */\n:root {\n    --angie-sidebar-z-index: 1200; /* below MUI popups, elementor popups and media library modal */\n    --angie-sidebar-width: 330px;\n    --angie-sidebar-transition: margin 0.3s ease-in-out, transform 0.3s ease-in-out;\n    /* Direction-aware transform values for sidebar positioning */\n    --angie-sidebar-hide-transform: translateX(-100%); /* LTR: hide to the left */\n    --angie-sidebar-show-transform: translateX(0);\n}\n\n/* RTL-specific transform values */\n[dir=\"rtl\"] {\n    --angie-sidebar-hide-transform: translateX(100%); /* RTL: hide to the right */\n}\n\n/* Respect user's motion preferences */\n@media (prefers-reduced-motion: reduce) {\n    :root {\n        --angie-sidebar-transition: none;\n    }\n}\n\n/* Apply transitions only when user is actively toggling */\nbody.angie-sidebar-transitioning {\n    transition: var(--angie-sidebar-transition) !important;\n}\n\nbody.angie-sidebar-transitioning #angie-sidebar-container {\n    transition: var(--angie-sidebar-transition) !important;\n}\n\n/* LTR Layout (default) - Push content to the right */\n@media (min-width: 768px) {\n    body.angie-sidebar-active {\n        padding-inline-start: var(--angie-sidebar-width) !important;\n    }\n\n    body.angie-sidebar-active #angie-body-top-padding {\n        width: 100%;\n        height: 8px;\n    }\n\n    /* Push WordPress Admin Bar - LTR */\n    body.angie-sidebar-active #wpadminbar {\n        inset-inline-start: var(--angie-sidebar-width) !important;\n        inset-inline-end: 8px !important;\n        width: calc(100% - 8px - var(--angie-sidebar-width)) !important;\n        margin-top: 8px;\n    }\n\n    /* Sidebar container - LTR */\n    #angie-sidebar-container {\n        position: fixed;\n        top: 0;\n        inset-inline-start: 0;\n        width: var(--angie-sidebar-width);\n        height: 100vh;\n        z-index: var(--angie-sidebar-z-index) !important; /* below elementor popups and media library modal */\n        background: #FCFCFC;\n        transform: var(--angie-sidebar-hide-transform);\n        outline: none;\n        overflow: hidden;\n        /* No default transition - only when transitioning */\n    }\n\n    /* Resize handle */\n    #angie-sidebar-container::after {\n        content: '';\n        position: absolute;\n        top: 0;\n        inset-inline-end: 0;\n        width: 4px;\n        height: 100%;\n        cursor: ew-resize;\n        background: transparent;\n        z-index: 1000001;\n    }\n\n    /* Pink border during resize */\n    #angie-sidebar-container.angie-resizing {\n        border-inline-end-color: #ff69b4 !important;\n        border-inline-end-width: 2px !important;\n    }\n\n    /* Disable iframe pointer events during resize */\n    #angie-sidebar-container.angie-resizing iframe#angie-iframe {\n        pointer-events: none !important;\n    }\n}\n\n/* Active states */\nbody.angie-sidebar-active #angie-sidebar-container {\n    transform: var(--angie-sidebar-show-transform);\n}\n\n/* Studio mode - sidebar takes full width */\n@media (min-width: 768px) {\n    html.angie-studio-active body.angie-sidebar-active #angie-sidebar-container {\n        width: 100%;\n    }\n}\n\n/* High contrast mode support */\n@media (prefers-contrast: high) {\n    #angie-sidebar-container {\n        border-color: #000;\n        box-shadow: none;\n    }\n}\n\n/* Screen reader only class */\n.angie-sr-only {\n    position: absolute;\n    width: 1px;\n    height: 1px;\n    padding: 0;\n    margin: -1px;\n    overflow: hidden;\n    clip: rect(0, 0, 0, 0);\n    white-space: nowrap;\n    border: 0;\n}\n\n/* Plugin conflict resolution */\nbody.angie-sidebar-active {\n    /* Reset common conflicting styles */\n    box-sizing: border-box !important;\n    position: relative !important;\n}\n\n#angie-sidebar-toggle {\n    z-index: 99999 !important;\n}\n";const r=document.head||document.getElementsByTagName("head")[0];r.insertBefore(t,r.firstChild),Fr=!0}(),"undefined"!=typeof window&&(window.toggleAngieSidebar=function(e){return function(t,r){const a=document.body,s=document.getElementById("angie-sidebar-container");if(!s)return void console.warn("Angie Sidebar: Required elements not found!");const n=a.classList.contains("angie-sidebar-active"),i=void 0!==t?t:!n;r||(a.classList.add("angie-sidebar-transitioning"),setTimeout(function(){a.classList.remove("angie-sidebar-transitioning")},300)),i?a.classList.add("angie-sidebar-active"):a.classList.remove("angie-sidebar-active"),i&&setTimeout(function(){Dr({type:"focusInput"})},r?0:300),e&&e(i,s,r),function(e){try{localStorage.setItem("angie_sidebar_state",e)}catch(e){console.warn("localStorage not available")}}(i?"open":"closed");const o=new CustomEvent("angieSidebarToggle",{detail:{isOpen:i,sidebar:s,skipTransition:r}});document.dispatchEvent(o),Dr({type:Hr.ANGIE_SIDEBAR_TOGGLED,payload:{state:i?"opened":"closed"}})}}(void 0),window.addEventListener("message",function(e){if(e.data&&"toggleAngieSidebar"===e.data.type){const{force:t,skipTransition:r}=e.data.payload||{};window.toggleAngieSidebar&&window.toggleAngieSidebar(t,r)}})),await(async e=>{if(window.screen.availWidth<=768)return void console.log("Angie: Mobile detected, skipping iframe injection");let t=document.getElementById("angie-sidebar-container");if(!t){const e=performance.now();if(console.log("⏱️ Waiting for sidebar container..."),await new Promise(e=>{let r=0;const a=setInterval(()=>{t=document.getElementById("angie-sidebar-container"),r++,(t||r>20)&&(clearInterval(a),t&&e())},100);setTimeout(()=>{if(clearInterval(a),t)return void e();const r=new MutationObserver(()=>{t=document.getElementById("angie-sidebar-container"),t&&(r.disconnect(),e())});r.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>{r.disconnect(),e()},8e3)},2e3)}),console.log(`⏱️ Sidebar container detection took: ${(performance.now()-e).toFixed(2)}ms`),!t)return void console.error("Angie: Sidebar container not found")}const{iframe:r,iframeUrlObject:a}=await(async e=>{const t=e.origin,r=new URL(e.path,t),a=r.pathname.slice(1).replace(/\//,"--")+"-"+Math.random().toString(36).substring(7);return new Promise(s=>{const n=new URL(t);n.pathname=r.pathname;const i=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(n.searchParams.append("colorScheme",e.uiTheme||i||"light"),n.searchParams.append("sdkVersion",e.sdkVersion),n.searchParams.append("instanceId",a),n.searchParams.append("origin",window.location.origin),e.isRTL&&n.searchParams.append("isRTL",e.isRTL?"true":"false"),"localhost"===window.location.hostname&&window.location.search.includes("debug_error")){const e=new URLSearchParams(window.location.search).get("debug_error");e&&n.searchParams.append("debug_error",e)}r.searchParams.forEach((e,t)=>{n.searchParams.set(t,e)}),n.searchParams.set("ver",(new Date).getTime().toString());const o=e.parent||document,c=o.createElement("iframe"),u={"background-color":"transparent","color-scheme":"normal",...e.css};window.addEventListener("message",async e=>{if(e.origin===n.origin)switch(e.data.type){case d.ANGIE_READY:s({iframe:c,iframeUrlObject:n});break;case d.ANGIE_LOADED:c.contentWindow?.postMessage({type:d.HOST_READY,instanceId:a},n.origin)}}),c.setAttribute("src",n.href),c.id="angie-iframe",c.setAttribute("frameborder","0"),c.setAttribute("scrolling","no"),c.setAttribute("style",Object.entries(u).map(([e,t])=>`${e}: ${t}`).join("; ")),c.setAttribute("allow","clipboard-write; clipboard-read"),e.insertCallback?e.insertCallback(c):o.body.appendChild(c)})})({origin:e.origin||"https://angie.elementor.com",path:"angie/wp-admin",insertCallback:e=>{console.log("Injecting Angie iframe into sidebar container"),e.setAttribute("title","Angie AI Assistant"),e.setAttribute("role","application"),e.setAttribute("aria-label","Angie AI Assistant Interface");const r=document.getElementById("angie-sidebar-loading");r&&(r.textContent=""),t?.appendChild(e),Zr(e,!0),e.addEventListener("load",()=>{e.focus()})},css:{width:"100%",height:"100%",border:"none",outline:"none"},uiTheme:e.uiTheme,isRTL:e.isRTL,sdkVersion:"1.0.3"});zr.iframe=r,zr.iframeUrlObject=a,window.addEventListener("message",e=>{if(e.origin===zr.iframeUrlObject?.origin)switch(e.data.type){case o.SET:window.localStorage.setItem(e.data.key,e.data.value);break;case o.GET:const t=e.ports[0],r=window.localStorage.getItem(e.data.key);t.postMessage({value:r})}}),(e=>{window.addEventListener("message",async t=>{const r=t.origin===window.location.origin,a=t.origin===e.iframeUrlObject?.origin;if(r||a)switch(t?.data?.type){case Hr.SDK_ANGIE_ALL_SERVERS_REGISTERED:break;case Hr.SDK_ANGIE_READY_PING:const r=t.ports[0];console.log("Angie is ready",t),Lr(r,{message:"Angie is ready"});break;case Hr.SDK_REQUEST_CLIENT_CREATION:const a=t.data.payload;try{const r=t.ports[0],s=new MessageChannel;s.port1.onmessage=e=>{r.postMessage({success:!0,data:e.data})};const n={type:Hr.SDK_REQUEST_CLIENT_CREATION,payload:{success:!0,...a,clientId:`dynamic-client-${a.serverName}-${a.serverVersion}-${Date.now()}`,requestId:t.data.payload.requestId},timestamp:Date.now()};if(!e.iframe)throw new Error("Iframe not found");e.iframe.contentWindow?.postMessage(n,e.iframeUrlObject?.origin||"",[s.port2])}catch(e){console.error(`AngieMcpSdk:Failed to create client for SDK server "${a.serverName}":`,e)}break;case Hr.SDK_TRIGGER_ANGIE:console.log("SDK Trigger Angie received",t.data);try{const{requestId:r,prompt:a,context:s}=t.data.payload;if(!e.iframe)throw new Error("Iframe not found");e.iframe.contentWindow?.postMessage({type:Hr.SDK_TRIGGER_ANGIE,payload:{requestId:r,prompt:a,context:s}},e.iframeUrlObject?.origin||""),window.postMessage({type:Hr.SDK_TRIGGER_ANGIE_RESPONSE,payload:{success:!0,requestId:r,response:"Angie triggered successfully"}},window.location.origin)}catch(e){console.error("Failed to trigger Angie:",e),window.postMessage({type:Hr.SDK_TRIGGER_ANGIE_RESPONSE,payload:{success:!1,requestId:t.data.payload?.requestId,error:e instanceof Error?e.message:"Unknown error"}},window.location.origin)}}})})(zr),window.addEventListener("message",e=>{if(e.origin===zr.iframeUrlObject?.origin)switch(e.data.type){case"OAUTH_GET_CODE_AND_STATE":(e=>{const t=new URLSearchParams(window.location.search),r=t.get("oauth_code"),a=t.get("oauth_state");if(r&&a)Lr(e,{code:r,state:a});else{const s=t.get("oauth_error");if(s){Mr(e,{message:s,code:r||null,state:a||null});const t=new URL(window.location.href);t.searchParams.delete("oauth_error"),history.replaceState({},"",t.toString())}else Lr(e,{message:"No OAuth error found"})}})(e.ports[0]);break;case"OAUTH_GET_TOP_URL":console.log("OAuth: Iframe requested top window URL via MessageChannel"),Lr(e.ports[0],{topUrl:window.location.href});break;case"OAUTH_REDIRECT_TOP_WINDOW":console.log("OAuth: Iframe requested top window redirect to:",e.data.payload.url),window.location.href=e.data.payload.url;break;case"OAUTH_UPDATE_URL":console.log("OAuth: Iframe requested URL update to:",e.data.payload.url),function(e,t){if(!history?.replaceState)return console.warn("history.replaceState not supported in this browser"),void Mr(t,{message:"URL update not supported in this browser"});try{const r=window.location.href;history.replaceState({},"",e),function(e,t){const r=new URL(t),a=new URL(e),s=r.searchParams,n=a.searchParams,i=["oauth_code","oauth_state","start-oauth"];return i.some(e=>n?.has(e))&&!i.some(e=>s?.has(e))}(r,e)&&function(){console.log("OAuth parameters cleaned, opening sidebar");try{localStorage.setItem("angie_sidebar_state","open")}catch(e){console.warn("localStorage not available")}setTimeout(()=>{window.toggleAngieSidebar(!0)},500)}(),Lr(t,{message:"URL updated successfully"})}catch(e){console.warn("Failed to update URL via history.replaceState:",e),Mr(t,{message:"URL update failed: "+(e instanceof Error?e.message:"Unknown error")})}}(e.data.payload.url,e.ports[0]);break;case"ANGIE_REDIRECT_TO_WP_ADMIN_WITH_OAUTH":Ur();break;case"ANGIE_REDIRECT_TO_AUTH_ORIGIN_LOGOUT":try{Ur()}catch(e){console.error("OAuth: Auth origin logout fallback failed:",e),window.location.reload()}}}),window.addEventListener("message",async t=>{if([window.location.origin,e.origin||"https://angie.elementor.com"].includes(t.origin))if(t?.data?.type===Hr.ANGIE_CHAT_TOGGLE)zr.open=t.data.open,zr.iframe&&Zr(zr.iframe,zr.open);else if(t?.data?.type===Hr.ANGIE_STUDIO_TOGGLE){const e=t.data.isStudioOpen;if(!zr.iframe)return;if(e)document.documentElement.classList.add("angie-studio-active");else{const e=function(){if("undefined"==typeof window)return 370;try{const e=window.localStorage.getItem("angie_sidebar_width");if(e){const t=parseInt(e,10);if(t>=350&&t<=590)return t}}catch(e){console.warn("localStorage not available")}return 370}();document.documentElement.style.setProperty("--angie-sidebar-width",`${e}px`),document.documentElement.classList.remove("angie-studio-active")}}else if(t?.data?.type===Hr.ANGIE_NAVIGATE_TO_URL){const{url:e=""}=t.data;if(!((e,t=[])=>{const r=0===t.length&&"undefined"!=typeof window?[window.location.origin]:t;if(!e.startsWith("http"))return!1;try{const t=new URL(e);return r.includes(t.origin)}catch{return!1}})(e))throw new Error("Angie: Invalid URL - navigation blocked for security reasons");window.location.assign(e)}else t?.data?.type===Hr.ANGIE_PAGE_RELOAD?(console.log("Angie requested page reload - database operations completed"),window.location.reload()):t?.data?.type===d.RESET_HASH&&(window.location.hash="",Lr(t.ports[0],{message:"Hash reset successfully"}))})})({origin:e?.origin||"https://angie.elementor.com",uiTheme:e?.uiTheme||"light",isRTL:e?.isRTL||!1,...e}),this.setupPromptHashDetection()}setupReRegistrationHandler(){window.addEventListener("message",e=>{if(e.data?.type===i.SDK_ANGIE_REFRESH_PING)if(console.log(`AngieMcpSdk: Angie refresh ping received (Instance: ${this.instanceId})`),this.registrationQueue.resetAllToPending()){const e=this.registrationQueue.getPending().length;console.log(`AngieMcpSdk: Successfully reset ${e} registrations, processing queue (Instance: ${this.instanceId})`),this.handleAngieReady()}else console.log(`AngieMcpSdk: Skipping queue reset - processing already in progress (Instance: ${this.instanceId})`)})}setupAngieReadyHandler(){this.angieDetector.waitForReady().then(e=>{e.isReady?this.handleAngieReady():console.warn("AngieMcpSdk: Angie not detected - servers will remain queued")}).catch(e=>{console.error("AngieMcpSdk: Error waiting for Angie:",e)})}async handleAngieReady(){console.log(`AngieMcpSdk: Angie is ready, processing queued registrations (Instance: ${this.instanceId})`);try{await this.registrationQueue.processQueue(async e=>{console.log(`AngieMcpSdk: processQueue callback called for "${e.config.name}" (Instance: ${this.instanceId})`),await this.processRegistration(e)}),this.isInitialized=!0,console.log(`AngieMcpSdk: Initialization complete (Instance: ${this.instanceId})`)}catch(e){console.error(`AngieMcpSdk: Error processing registration queue (Instance: ${this.instanceId}):`,e)}}async processRegistration(e){console.log(`AngieMcpSdk: Processing registration for server "${e.config.name}" (ID: ${e.id}) (Instance: ${this.instanceId})`);try{console.log(`AngieMcpSdk: Calling clientManager.requestClientCreation for "${e.config.name}" (Instance: ${this.instanceId})`);const t={...e,instanceId:this.instanceId};await this.clientManager.requestClientCreation(t),console.log(`AngieMcpSdk: Successfully registered server "${e.config.name}" (Instance: ${this.instanceId})`)}catch(t){throw console.error(`AngieMcpSdk: Failed to register server "${e.config.name}" (Instance: ${this.instanceId}):`,t),t}}registerLocalServer(e){return e.type=n.LOCAL,e.transport=t.POST_MESSAGE,this.registerServer(e)}registerRemoteServer(e){return e.type=n.REMOTE,this.registerServer(e)}isLocalServerConfig(e){return e.type===n.LOCAL||!e.type&&"server"in e}isRemoteServerConfig(e){return e.type===n.REMOTE&&"url"in e}async registerServer(e){if(!e.type)return console.warn("AngieMcpSdk: for a local server, please use registerLocalServer instead of registerServer"),void this.registerLocalServer(e);if(console.log(`AngieMcpSdk: registerServer called for "${e.name}" (Instance: ${this.instanceId})`),!e.name)throw new Error("Server name is required");if(!e.description)throw new Error("Server description is required");if(this.isLocalServerConfig(e)&&!e.server)throw new Error("Server instance is required for local servers");console.log(`AngieMcpSdk: Registering server "${e.name}" (Instance: ${this.instanceId})`);const t=this.registrationQueue.add(e);if(console.log(`AngieMcpSdk: Added registration to queue: ${t.id} (Instance: ${this.instanceId})`),this.angieDetector.isReady())try{await this.processRegistration(t),this.registrationQueue.updateStatus(t.id,"registered"),console.log(`AngieMcpSdk: Server "${e.name}" registered successfully (Instance: ${this.instanceId})`)}catch(e){const r=e instanceof Error?e.message:String(e);throw this.registrationQueue.updateStatus(t.id,"failed",r),e}else console.log(`AngieMcpSdk: Server "${e.name}" queued until Angie is ready (Instance: ${this.instanceId})`)}getRegistrations(){return this.registrationQueue.getAll()}getPendingRegistrations(){return this.registrationQueue.getPending()}isAngieReady(){return this.angieDetector.isReady()}isReady(){return this.isInitialized}async waitForReady(){if(!(await this.angieDetector.waitForReady()).isReady)throw new Error("Angie is not available");for(;!this.isInitialized;)await new Promise(e=>setTimeout(e,100))}async triggerAngie(e){if(!this.isAngieReady())throw new Error("Angie is not ready. Please wait for Angie to be available before triggering.");const t=this.generateRequestId(),r=e.options?.timeout||3e4;return new Promise((a,s)=>{const n=setTimeout(()=>{s(new Error("Angie trigger request timed out"))},r),o=e=>{e.data?.type===i.SDK_TRIGGER_ANGIE_RESPONSE&&e.data?.payload?.requestId===t&&(clearTimeout(n),window.removeEventListener("message",o),a(e.data.payload))};window.addEventListener("message",o);const d={type:i.SDK_TRIGGER_ANGIE,payload:{requestId:t,prompt:e.prompt,options:e.options,context:{pageUrl:window.location.href,pageTitle:document.title,...e.context}},timestamp:Date.now()};console.log(`AngieMcpSdk: Triggering Angie with prompt (Request ID: ${t}, Instance: ${this.instanceId})`),window.postMessage(d,window.location.origin)})}destroy(){this.registrationQueue.clear(),console.log(`AngieMcpSdk: SDK destroyed (Instance: ${this.instanceId})`)}setupServerInitHandler(){window.addEventListener("message",e=>{e.data?.type===i.SDK_REQUEST_INIT_SERVER&&(console.log(`AngieMcpSdk: Server init request received (Instance: ${this.instanceId})`),this.handleServerInitRequest(e))})}handleServerInitRequest(e){const{clientId:t,serverId:r,instanceId:a}=e.data.payload||{};if(t&&r)if(console.log(`AngieMcpSdk: Server init request received - Request instanceId: ${a}, This instanceId: ${this.instanceId} (Instance: ${this.instanceId})`),a&&a!==this.instanceId)console.log(`AngieMcpSdk: Ignoring server init request for different instance. Request instanceId: ${a}, this instanceId: ${this.instanceId}`);else{console.log(`AngieMcpSdk: Handling server init request for clientId: ${t}, serverId: ${r} (Instance: ${this.instanceId})`);try{const t=this.registrationQueue.getAll().find(e=>e.id===r);if(!t)return void console.error(`AngieMcpSdk: No registration found for serverId: ${r} (Instance: ${this.instanceId})`);if("type"in t.config&&"remote"===t.config.type)return void console.log(`AngieMcpSdk: Remote server registration detected; skipping local connect (Instance: ${this.instanceId})`);const a=e.ports[0];if(!a)return void console.error(`AngieMcpSdk: No port provided in server init request (Instance: ${this.instanceId})`);const s=t.config.server,n=new $r(a);s.connect(n),console.log(`AngieMcpSdk: Server "${t.config.name}" initialized successfully (Instance: ${this.instanceId})`)}catch(e){console.error(`AngieMcpSdk: Error initializing server for clientId ${t} (Instance: ${this.instanceId}):`,e)}}else console.error(`AngieMcpSdk: Invalid server init request - missing clientId or serverId (Instance: ${this.instanceId})`)}generateRequestId(){return`${this.instanceId}-${Date.now()}-${Math.random().toString(36).substring(2,8)}`}async handlePromptHash(){const e=window.location.hash;if(e.startsWith("#angie-prompt="))try{const t=e.replace("#angie-prompt=",""),r=decodeURIComponent(t);if(!r)return void console.warn("AngieMcpSdk: Empty prompt detected in hash");console.log("AngieMcpSdk: Detected prompt in hash:",r),await this.waitForReady();const a=await this.triggerAngie({prompt:r,context:{source:"hash-parameter",pageUrl:window.location.href,timestamp:(new Date).toISOString()}});console.log("AngieMcpSdk: Triggered successfully from hash:",a),window.location.hash=""}catch(e){console.error("AngieMcpSdk: Failed to trigger from hash:",e)}}setupPromptHashDetection(){this.handlePromptHash(),window.addEventListener("hashchange",()=>this.handlePromptHash())}}!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),a={};for(const e of r)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Vr||(Vr={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Kr||(Kr={}));const Gr=Vr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Br=e=>{switch(typeof e){case"undefined":return Gr.undefined;case"string":return Gr.string;case"number":return Number.isNaN(e)?Gr.nan:Gr.number;case"boolean":return Gr.boolean;case"function":return Gr.function;case"bigint":return Gr.bigint;case"symbol":return Gr.symbol;case"object":return Array.isArray(e)?Gr.array:null===e?Gr.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Gr.promise:"undefined"!=typeof Map&&e instanceof Map?Gr.map:"undefined"!=typeof Set&&e instanceof Set?Gr.set:"undefined"!=typeof Date&&e instanceof Date?Gr.date:Gr.object;default:return Gr.unknown}},Wr=Vr.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"]);class Jr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(a);else if("invalid_return_type"===s.code)a(s.returnTypeError);else if("invalid_arguments"===s.code)a(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){const r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof Jr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Vr.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const a of this.issues)if(a.path.length>0){const r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}Jr.create=e=>new Jr(e);var Yr=(e,t)=>{let r;switch(e.code){case Wr.invalid_type:r=e.received===Gr.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Wr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Vr.jsonStringifyReplacer)}`;break;case Wr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Vr.joinValues(e.keys,", ")}`;break;case Wr.invalid_union:r="Invalid input";break;case Wr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Vr.joinValues(e.options)}`;break;case Wr.invalid_enum_value:r=`Invalid enum value. Expected ${Vr.joinValues(e.options)}, received '${e.received}'`;break;case Wr.invalid_arguments:r="Invalid function arguments";break;case Wr.invalid_return_type:r="Invalid function return type";break;case Wr.invalid_date:r="Invalid date";break;case Wr.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Vr.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Wr.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Wr.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Wr.custom:r="Invalid input";break;case Wr.invalid_intersection_types:r="Intersection results could not be merged";break;case Wr.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Wr.not_finite:r="Number must be finite";break;default:r=t.defaultError,Vr.assertNever(e)}return{message:r}};let Xr=Yr;var ea;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(ea||(ea={}));function ta(e,t){const r=Xr,a=(e=>{const{data:t,path:r,errorMaps:a,issueData:s}=e,n=[...r,...s.path||[]],i={...s,path:n};if(void 0!==s.message)return{...s,path:n,message:s.message};let o="";const d=a.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...s,path:n,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Yr?void 0:Yr].filter(e=>!!e)});e.common.issues.push(a)}class ra{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if("aborted"===a.status)return aa;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return ra.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:t,value:s}=a;if("aborted"===t.status)return aa;if("aborted"===s.status)return aa;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!a.alwaysSet||(r[t.value]=s.value)}return{status:e.value,value:r}}}const aa=Object.freeze({status:"aborted"}),sa=e=>({status:"dirty",value:e}),na=e=>({status:"valid",value:e}),ia=e=>"aborted"===e.status,oa=e=>"dirty"===e.status,da=e=>"valid"===e.status,ca=e=>"undefined"!=typeof Promise&&e instanceof Promise;class ua{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}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}}const la=(e,t)=>{if(da(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Jr(e.common.issues);return this._error=t,this._error}}};function ha(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:a,description:s}=e;if(t&&(r||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{const{message:n}=e;return"invalid_enum_value"===t.code?{message:n??s.defaultError}:void 0===s.data?{message:n??a??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:n??r??s.defaultError}},description:s}}class pa{get description(){return this._def.description}_getType(e){return Br(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ra,ctx:{common:e.parent.common,data:e.data,parsedType:Br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ca(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},a=this._parseSync({data:e,path:r.path,parent:r});return la(r,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return da(r)?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>da(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Br(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(ca(a)?a:Promise.resolve(a));return la(r,s)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,a)=>{const s=e(t),n=()=>a.addIssue({code:Wr.custom,...r(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then(e=>!!e||(n(),!1)):!!s||(n(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new ms({schema:this,typeName:Ps.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:e=>this["~validate"](e)}}optional(){return fs.create(this,this._def)}nullable(){return gs.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wa.create(this)}promise(){return ps.create(this,this._def)}or(e){return Xa.create([this,e],this._def)}and(e){return as.create(this,e,this._def)}transform(e){return new ms({...ha(this._def),schema:this,typeName:Ps.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new vs({...ha(this._def),innerType:this,defaultValue:t,typeName:Ps.ZodDefault})}brand(){return new bs({typeName:Ps.ZodBranded,type:this,...ha(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ys({...ha(this._def),innerType:this,catchValue:t,typeName:Ps.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ws.create(this,e)}readonly(){return xs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ma=/^c[^\s-]{8,}$/i,fa=/^[0-9a-z]+$/,ga=/^[0-9A-HJKMNP-TV-Z]{26}$/i,va=/^[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,ya=/^[a-z0-9_-]{21}$/i,_a=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ba=/^[-+]?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)?)??$/,wa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let xa;const Pa=/^(?:(?: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])$/,Ea=/^(?:(?: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])$/,ka=/^(([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]))$/,Sa=/^(([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])$/,Ra=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Aa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ta="((\\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])))",Ia=new RegExp(`^${Ta}$`);function Oa(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function Ca(e){return new RegExp(`^${Oa(e)}$`)}function $a(e){let t=`${Ta}T${Oa(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ja(e,t){return!("v4"!==t&&t||!Pa.test(e))||!("v6"!==t&&t||!ka.test(e))}function Na(e,t){if(!_a.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(a));return!("object"!=typeof s||null===s||"typ"in s&&"JWT"!==s?.typ||!s.alg||t&&s.alg!==t)}catch{return!1}}function Da(e,t){return!("v4"!==t&&t||!Ea.test(e))||!("v6"!==t&&t||!Sa.test(e))}class Fa extends pa{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Gr.string){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.string,received:t.parsedType}),aa}const t=new ra;let r;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const s=e.data.length>a.value,n=e.data.length<a.value;(s||n)&&(r=this._getOrReturnCtx(e,r),s?ta(r,{code:Wr.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):n&&ta(r,{code:Wr.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)wa.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"email",code:Wr.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)xa||(xa=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),xa.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"emoji",code:Wr.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)va.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"uuid",code:Wr.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)ya.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"nanoid",code:Wr.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)ma.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"cuid",code:Wr.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)fa.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"cuid2",code:Wr.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)ga.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"ulid",code:Wr.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),ta(r,{validation:"url",code:Wr.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"regex",code:Wr.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?$a(a).test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?Ia.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?Ca(a).test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?ba.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"duration",code:Wr.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?ja(e.data,a.version)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"ip",code:Wr.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?Na(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"jwt",code:Wr.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?Da(e.data,a.version)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"cidr",code:Wr.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?Ra.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"base64",code:Wr.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?Aa.test(e.data)||(r=this._getOrReturnCtx(e,r),ta(r,{validation:"base64url",code:Wr.invalid_string,message:a.message}),t.dirty()):Vr.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:Wr.invalid_string,...ea.errToObj(r)})}_addCheck(e){return new Fa({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ea.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ea.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ea.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ea.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ea.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ea.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ea.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ea.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ea.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ea.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ea.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ea.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ea.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ea.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...ea.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ea.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ea.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...ea.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ea.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ea.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ea.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ea.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ea.errToObj(t)})}nonempty(e){return this.min(1,ea.errToObj(e))}trim(){return new Fa({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Fa({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Fa({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Za(e,t){const r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}Fa.create=e=>new Fa({checks:[],typeName:Ps.ZodString,coerce:e?.coerce??!1,...ha(e)});class La extends pa{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)!==Gr.number){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.number,received:t.parsedType}),aa}let t;const r=new ra;for(const a of this._def.checks)"int"===a.kind?Vr.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ta(t,{code:Wr.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),ta(t,{code:Wr.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ta(t,{code:Wr.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==Za(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ta(t,{code:Wr.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ta(t,{code:Wr.not_finite,message:a.message}),r.dirty()):Vr.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ea.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ea.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ea.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ea.toString(t))}setLimit(e,t,r,a){return new La({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ea.toString(a)}]})}_addCheck(e){return new La({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ea.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ea.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ea.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ea.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ea.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ea.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ea.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ea.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ea.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&Vr.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}La.create=e=>new La({checks:[],typeName:Ps.ZodNumber,coerce:e?.coerce||!1,...ha(e)});class Ma extends pa{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)!==Gr.bigint)return this._getInvalidInput(e);let t;const r=new ra;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),ta(t,{code:Wr.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ta(t,{code:Wr.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ta(t,{code:Wr.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):Vr.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.bigint,received:t.parsedType}),aa}gte(e,t){return this.setLimit("min",e,!0,ea.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ea.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ea.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ea.toString(t))}setLimit(e,t,r,a){return new Ma({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ea.toString(a)}]})}_addCheck(e){return new Ma({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ea.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ea.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ea.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ea.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ea.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Ma.create=e=>new Ma({checks:[],typeName:Ps.ZodBigInt,coerce:e?.coerce??!1,...ha(e)});class qa extends pa{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==Gr.boolean){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.boolean,received:t.parsedType}),aa}return na(e.data)}}qa.create=e=>new qa({typeName:Ps.ZodBoolean,coerce:e?.coerce||!1,...ha(e)});class za extends pa{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Gr.date){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.date,received:t.parsedType}),aa}if(Number.isNaN(e.data.getTime()))return ta(this._getOrReturnCtx(e),{code:Wr.invalid_date}),aa;const t=new ra;let r;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),ta(r,{code:Wr.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Vr.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new za({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ea.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ea.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}za.create=e=>new za({checks:[],coerce:e?.coerce||!1,typeName:Ps.ZodDate,...ha(e)});class Ua extends pa{_parse(e){if(this._getType(e)!==Gr.symbol){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.symbol,received:t.parsedType}),aa}return na(e.data)}}Ua.create=e=>new Ua({typeName:Ps.ZodSymbol,...ha(e)});class Ha extends pa{_parse(e){if(this._getType(e)!==Gr.undefined){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.undefined,received:t.parsedType}),aa}return na(e.data)}}Ha.create=e=>new Ha({typeName:Ps.ZodUndefined,...ha(e)});class Va extends pa{_parse(e){if(this._getType(e)!==Gr.null){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.null,received:t.parsedType}),aa}return na(e.data)}}Va.create=e=>new Va({typeName:Ps.ZodNull,...ha(e)});class Ka extends pa{constructor(){super(...arguments),this._any=!0}_parse(e){return na(e.data)}}Ka.create=e=>new Ka({typeName:Ps.ZodAny,...ha(e)});class Qa extends pa{constructor(){super(...arguments),this._unknown=!0}_parse(e){return na(e.data)}}Qa.create=e=>new Qa({typeName:Ps.ZodUnknown,...ha(e)});class Ga extends pa{_parse(e){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.never,received:t.parsedType}),aa}}Ga.create=e=>new Ga({typeName:Ps.ZodNever,...ha(e)});class Ba extends pa{_parse(e){if(this._getType(e)!==Gr.undefined){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.void,received:t.parsedType}),aa}return na(e.data)}}Ba.create=e=>new Ba({typeName:Ps.ZodVoid,...ha(e)});class Wa extends pa{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==Gr.array)return ta(t,{code:Wr.invalid_type,expected:Gr.array,received:t.parsedType}),aa;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,s=t.data.length<a.exactLength.value;(e||s)&&(ta(t,{code:e?Wr.too_big:Wr.too_small,minimum:s?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(ta(t,{code:Wr.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(ta(t,{code:Wr.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new ua(t,e,t.path,r)))).then(e=>ra.mergeArray(r,e));const s=[...t.data].map((e,r)=>a.type._parseSync(new ua(t,e,t.path,r)));return ra.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new Wa({...this._def,minLength:{value:e,message:ea.toString(t)}})}max(e,t){return new Wa({...this._def,maxLength:{value:e,message:ea.toString(t)}})}length(e,t){return new Wa({...this._def,exactLength:{value:e,message:ea.toString(t)}})}nonempty(e){return this.min(1,e)}}function Ja(e){if(e instanceof Ya){const t={};for(const r in e.shape){const a=e.shape[r];t[r]=fs.create(Ja(a))}return new Ya({...e._def,shape:()=>t})}return e instanceof Wa?new Wa({...e._def,type:Ja(e.element)}):e instanceof fs?fs.create(Ja(e.unwrap())):e instanceof gs?gs.create(Ja(e.unwrap())):e instanceof ss?ss.create(e.items.map(e=>Ja(e))):e}Wa.create=(e,t)=>new Wa({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ps.ZodArray,...ha(t)});class Ya extends pa{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Vr.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Gr.object){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.object,received:t.parsedType}),aa}const{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),n=[];if(!(this._def.catchall instanceof Ga&&"strip"===this._def.unknownKeys))for(const e in r.data)s.includes(e)||n.push(e);const i=[];for(const e of s){const t=a[e],s=r.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new ua(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Ga){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of n)i.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)n.length>0&&(ta(r,{code:Wr.unrecognized_keys,keys:n}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of n){const a=r.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new ua(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>ra.mergeObjectSync(t,e)):ra.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return ea.errToObj,new Ya({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{const a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:ea.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Ya({...this._def,unknownKeys:"strip"})}passthrough(){return new Ya({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ya({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ya({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ps.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ya({...this._def,catchall:e})}pick(e){const t={};for(const r of Vr.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new Ya({...this._def,shape:()=>t})}omit(e){const t={};for(const r of Vr.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new Ya({...this._def,shape:()=>t})}deepPartial(){return Ja(this)}partial(e){const t={};for(const r of Vr.objectKeys(this.shape)){const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new Ya({...this._def,shape:()=>t})}required(e){const t={};for(const r of Vr.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof fs;)e=e._def.innerType;t[r]=e}return new Ya({...this._def,shape:()=>t})}keyof(){return us(Vr.objectKeys(this.shape))}}Ya.create=(e,t)=>new Ya({shape:()=>e,unknownKeys:"strip",catchall:Ga.create(),typeName:Ps.ZodObject,...ha(t)}),Ya.strictCreate=(e,t)=>new Ya({shape:()=>e,unknownKeys:"strict",catchall:Ga.create(),typeName:Ps.ZodObject,...ha(t)}),Ya.lazycreate=(e,t)=>new Ya({shape:e,unknownKeys:"strip",catchall:Ga.create(),typeName:Ps.ZodObject,...ha(t)});class Xa extends pa{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map(e=>new Jr(e.ctx.common.issues));return ta(t,{code:Wr.invalid_union,unionErrors:r}),aa});{let e;const a=[];for(const s of r){const r={...t,common:{...t.common,issues:[]},parent:null},n=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=a.map(e=>new Jr(e));return ta(t,{code:Wr.invalid_union,unionErrors:s}),aa}}get options(){return this._def.options}}Xa.create=(e,t)=>new Xa({options:e,typeName:Ps.ZodUnion,...ha(t)});const es=e=>e instanceof ds?es(e.schema):e instanceof ms?es(e.innerType()):e instanceof cs?[e.value]:e instanceof ls?e.options:e instanceof hs?Vr.objectValues(e.enum):e instanceof vs?es(e._def.innerType):e instanceof Ha?[void 0]:e instanceof Va?[null]:e instanceof fs?[void 0,...es(e.unwrap())]:e instanceof gs?[null,...es(e.unwrap())]:e instanceof bs||e instanceof xs?es(e.unwrap()):e instanceof ys?es(e._def.innerType):[];class ts extends pa{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Gr.object)return ta(t,{code:Wr.invalid_type,expected:Gr.object,received:t.parsedType}),aa;const r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(ta(t,{code:Wr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),aa)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const a=new Map;for(const r of t){const t=es(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,r)}}return new ts({typeName:Ps.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...ha(r)})}}function rs(e,t){const r=Br(e),a=Br(t);if(e===t)return{valid:!0,data:e};if(r===Gr.object&&a===Gr.object){const r=Vr.objectKeys(t),a=Vr.objectKeys(e).filter(e=>-1!==r.indexOf(e)),s={...e,...t};for(const r of a){const a=rs(e[r],t[r]);if(!a.valid)return{valid:!1};s[r]=a.data}return{valid:!0,data:s}}if(r===Gr.array&&a===Gr.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let a=0;a<e.length;a++){const s=rs(e[a],t[a]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return r===Gr.date&&a===Gr.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class as extends pa{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if(ia(e)||ia(a))return aa;const s=rs(e.value,a.value);return s.valid?((oa(e)||oa(a))&&t.dirty(),{status:t.value,value:s.data}):(ta(r,{code:Wr.invalid_intersection_types}),aa)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}as.create=(e,t,r)=>new as({left:e,right:t,typeName:Ps.ZodIntersection,...ha(r)});class ss extends pa{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gr.array)return ta(r,{code:Wr.invalid_type,expected:Gr.array,received:r.parsedType}),aa;if(r.data.length<this._def.items.length)return ta(r,{code:Wr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),aa;!this._def.rest&&r.data.length>this._def.items.length&&(ta(r,{code:Wr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new ua(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>ra.mergeArray(t,e)):ra.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ss({...this._def,rest:e})}}ss.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ss({items:e,typeName:Ps.ZodTuple,rest:null,...ha(t)})};class ns extends pa{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gr.object)return ta(r,{code:Wr.invalid_type,expected:Gr.object,received:r.parsedType}),aa;const a=[],s=this._def.keyType,n=this._def.valueType;for(const e in r.data)a.push({key:s._parse(new ua(r,e,r.path,e)),value:n._parse(new ua(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?ra.mergeObjectAsync(t,a):ra.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new ns(t instanceof pa?{keyType:e,valueType:t,typeName:Ps.ZodRecord,...ha(r)}:{keyType:Fa.create(),valueType:e,typeName:Ps.ZodRecord,...ha(t)})}}class is extends pa{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gr.map)return ta(r,{code:Wr.invalid_type,expected:Gr.map,received:r.parsedType}),aa;const a=this._def.keyType,s=this._def.valueType,n=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new ua(r,e,r.path,[n,"key"])),value:s._parse(new ua(r,t,r.path,[n,"value"]))}));if(r.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const r of n){const a=await r.key,s=await r.value;if("aborted"===a.status||"aborted"===s.status)return aa;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}})}{const e=new Map;for(const r of n){const a=r.key,s=r.value;if("aborted"===a.status||"aborted"===s.status)return aa;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}}}is.create=(e,t,r)=>new is({valueType:t,keyType:e,typeName:Ps.ZodMap,...ha(r)});class os extends pa{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Gr.set)return ta(r,{code:Wr.invalid_type,expected:Gr.set,received:r.parsedType}),aa;const a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(ta(r,{code:Wr.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(ta(r,{code:Wr.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const s=this._def.valueType;function n(e){const r=new Set;for(const a of e){if("aborted"===a.status)return aa;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}const i=[...r.data.values()].map((e,t)=>s._parse(new ua(r,e,r.path,t)));return r.common.async?Promise.all(i).then(e=>n(e)):n(i)}min(e,t){return new os({...this._def,minSize:{value:e,message:ea.toString(t)}})}max(e,t){return new os({...this._def,maxSize:{value:e,message:ea.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}os.create=(e,t)=>new os({valueType:e,minSize:null,maxSize:null,typeName:Ps.ZodSet,...ha(t)});class ds extends pa{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ds.create=(e,t)=>new ds({getter:e,typeName:Ps.ZodLazy,...ha(t)});class cs extends pa{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ta(t,{received:t.data,code:Wr.invalid_literal,expected:this._def.value}),aa}return{status:"valid",value:e.data}}get value(){return this._def.value}}function us(e,t){return new ls({values:e,typeName:Ps.ZodEnum,...ha(t)})}cs.create=(e,t)=>new cs({value:e,typeName:Ps.ZodLiteral,...ha(t)});class ls extends pa{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return ta(t,{expected:Vr.joinValues(r),received:t.parsedType,code:Wr.invalid_type}),aa}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return ta(t,{received:t.data,code:Wr.invalid_enum_value,options:r}),aa}return na(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ls.create(e,{...this._def,...t})}exclude(e,t=this._def){return ls.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ls.create=us;class hs extends pa{_parse(e){const t=Vr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Gr.string&&r.parsedType!==Gr.number){const e=Vr.objectValues(t);return ta(r,{expected:Vr.joinValues(e),received:r.parsedType,code:Wr.invalid_type}),aa}if(this._cache||(this._cache=new Set(Vr.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=Vr.objectValues(t);return ta(r,{received:r.data,code:Wr.invalid_enum_value,options:e}),aa}return na(e.data)}get enum(){return this._def.values}}hs.create=(e,t)=>new hs({values:e,typeName:Ps.ZodNativeEnum,...ha(t)});class ps extends pa{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Gr.promise&&!1===t.common.async)return ta(t,{code:Wr.invalid_type,expected:Gr.promise,received:t.parsedType}),aa;const r=t.parsedType===Gr.promise?t.data:Promise.resolve(t.data);return na(r.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ps.create=(e,t)=>new ps({type:e,typeName:Ps.ZodPromise,...ha(t)});class ms extends pa{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ps.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:e=>{ta(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===a.type){const e=a.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return aa;const a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?aa:"dirty"===a.status||"dirty"===t.value?sa(a.value):a});{if("aborted"===t.value)return aa;const a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?aa:"dirty"===a.status||"dirty"===t.value?sa(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?aa:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?aa:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))))}if("transform"===a.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!da(e))return aa;const n=a.transform(e.value,s);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>da(e)?Promise.resolve(a.transform(e.value,s)).then(e=>({status:t.value,value:e})):aa)}Vr.assertNever(a)}}ms.create=(e,t,r)=>new ms({schema:e,typeName:Ps.ZodEffects,effect:t,...ha(r)}),ms.createWithPreprocess=(e,t,r)=>new ms({schema:t,effect:{type:"preprocess",transform:e},typeName:Ps.ZodEffects,...ha(r)});class fs extends pa{_parse(e){return this._getType(e)===Gr.undefined?na(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}fs.create=(e,t)=>new fs({innerType:e,typeName:Ps.ZodOptional,...ha(t)});class gs extends pa{_parse(e){return this._getType(e)===Gr.null?na(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}gs.create=(e,t)=>new gs({innerType:e,typeName:Ps.ZodNullable,...ha(t)});class vs extends pa{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===Gr.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}vs.create=(e,t)=>new vs({innerType:e,typeName:Ps.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ha(t)});class ys extends pa{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ca(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Jr(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new Jr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ys.create=(e,t)=>new ys({innerType:e,typeName:Ps.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ha(t)});class _s extends pa{_parse(e){if(this._getType(e)!==Gr.nan){const t=this._getOrReturnCtx(e);return ta(t,{code:Wr.invalid_type,expected:Gr.nan,received:t.parsedType}),aa}return{status:"valid",value:e.data}}}_s.create=e=>new _s({typeName:Ps.ZodNaN,...ha(e)}),Symbol("zod_brand");class bs extends pa{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ws extends pa{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?aa:"dirty"===e.status?(t.dirty(),sa(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?aa:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ws({in:e,out:t,typeName:Ps.ZodPipeline})}}class xs extends pa{_parse(e){const t=this._def.innerType._parse(e),r=e=>(da(e)&&(e.value=Object.freeze(e.value)),e);return ca(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}var Ps;xs.create=(e,t)=>new xs({innerType:e,typeName:Ps.ZodReadonly,...ha(t)}),Ya.lazycreate,function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Ps||(Ps={}));const Es=Fa.create,ks=La.create,Ss=(_s.create,Ma.create,qa.create),Rs=(za.create,Ua.create,Ha.create,Va.create,Ka.create,Qa.create),As=(Ga.create,Ba.create,Wa.create),Ts=Ya.create,Is=(Ya.strictCreate,Xa.create),Os=ts.create,Cs=(as.create,ss.create,ns.create),$s=(is.create,os.create,ds.create,cs.create),js=ls.create,Ns=(hs.create,ps.create,ms.create,fs.create),Ds=(gs.create,ms.createWithPreprocess,ws.create,"2025-06-18"),Fs=[Ds,"2025-03-26","2024-11-05","2024-10-07"],Zs="2.0",Ls=Is([Es(),ks().int()]),Ms=Es(),qs=Ts({progressToken:Ns(Ls)}).passthrough(),zs=Ts({_meta:Ns(qs)}).passthrough(),Us=Ts({method:Es(),params:Ns(zs)}),Hs=Ts({_meta:Ns(Ts({}).passthrough())}).passthrough(),Vs=Ts({method:Es(),params:Ns(Hs)}),Ks=Ts({_meta:Ns(Ts({}).passthrough())}).passthrough(),Qs=Is([Es(),ks().int()]),Gs=Ts({jsonrpc:$s(Zs),id:Qs}).merge(Us).strict(),Bs=Ts({jsonrpc:$s(Zs)}).merge(Vs).strict(),Ws=Ts({jsonrpc:$s(Zs),id:Qs,result:Ks}).strict(),Js=e=>Ws.safeParse(e).success;var Ys;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(Ys||(Ys={}));const Xs=Ts({jsonrpc:$s(Zs),id:Qs,error:Ts({code:ks().int(),message:Es(),data:Ns(Rs())})}).strict(),en=(Is([Gs,Bs,Ws,Xs]),Ks.strict()),tn=Vs.extend({method:$s("notifications/cancelled"),params:Hs.extend({requestId:Qs,reason:Es().optional()})}),rn=Ts({name:Es(),title:Ns(Es())}).passthrough(),an=rn.extend({version:Es()}),sn=Ts({experimental:Ns(Ts({}).passthrough()),sampling:Ns(Ts({}).passthrough()),elicitation:Ns(Ts({}).passthrough()),roots:Ns(Ts({listChanged:Ns(Ss())}).passthrough())}).passthrough(),nn=Us.extend({method:$s("initialize"),params:zs.extend({protocolVersion:Es(),capabilities:sn,clientInfo:an})}),on=Ts({experimental:Ns(Ts({}).passthrough()),logging:Ns(Ts({}).passthrough()),completions:Ns(Ts({}).passthrough()),prompts:Ns(Ts({listChanged:Ns(Ss())}).passthrough()),resources:Ns(Ts({subscribe:Ns(Ss()),listChanged:Ns(Ss())}).passthrough()),tools:Ns(Ts({listChanged:Ns(Ss())}).passthrough())}).passthrough(),dn=Ks.extend({protocolVersion:Es(),capabilities:on,serverInfo:an,instructions:Ns(Es())}),cn=Vs.extend({method:$s("notifications/initialized")}),un=Us.extend({method:$s("ping")}),ln=Ts({progress:ks(),total:Ns(ks()),message:Ns(Es())}).passthrough(),hn=Vs.extend({method:$s("notifications/progress"),params:Hs.merge(ln).extend({progressToken:Ls})}),pn=Us.extend({params:zs.extend({cursor:Ns(Ms)}).optional()}),mn=Ks.extend({nextCursor:Ns(Ms)}),fn=Ts({uri:Es(),mimeType:Ns(Es()),_meta:Ns(Ts({}).passthrough())}).passthrough(),gn=fn.extend({text:Es()}),vn=Es().refine(e=>{try{return atob(e),!0}catch(e){return!1}},{message:"Invalid Base64 string"}),yn=fn.extend({blob:vn}),_n=rn.extend({uri:Es(),description:Ns(Es()),mimeType:Ns(Es()),_meta:Ns(Ts({}).passthrough())}),bn=rn.extend({uriTemplate:Es(),description:Ns(Es()),mimeType:Ns(Es()),_meta:Ns(Ts({}).passthrough())}),wn=pn.extend({method:$s("resources/list")}),xn=mn.extend({resources:As(_n)}),Pn=pn.extend({method:$s("resources/templates/list")}),En=mn.extend({resourceTemplates:As(bn)}),kn=Us.extend({method:$s("resources/read"),params:zs.extend({uri:Es()})}),Sn=Ks.extend({contents:As(Is([gn,yn]))}),Rn=Vs.extend({method:$s("notifications/resources/list_changed")}),An=Us.extend({method:$s("resources/subscribe"),params:zs.extend({uri:Es()})}),Tn=Us.extend({method:$s("resources/unsubscribe"),params:zs.extend({uri:Es()})}),In=Vs.extend({method:$s("notifications/resources/updated"),params:Hs.extend({uri:Es()})}),On=Ts({name:Es(),description:Ns(Es()),required:Ns(Ss())}).passthrough(),Cn=rn.extend({description:Ns(Es()),arguments:Ns(As(On)),_meta:Ns(Ts({}).passthrough())}),$n=pn.extend({method:$s("prompts/list")}),jn=mn.extend({prompts:As(Cn)}),Nn=Us.extend({method:$s("prompts/get"),params:zs.extend({name:Es(),arguments:Ns(Cs(Es()))})}),Dn=Ts({type:$s("text"),text:Es(),_meta:Ns(Ts({}).passthrough())}).passthrough(),Fn=Ts({type:$s("image"),data:vn,mimeType:Es(),_meta:Ns(Ts({}).passthrough())}).passthrough(),Zn=Ts({type:$s("audio"),data:vn,mimeType:Es(),_meta:Ns(Ts({}).passthrough())}).passthrough(),Ln=Ts({type:$s("resource"),resource:Is([gn,yn]),_meta:Ns(Ts({}).passthrough())}).passthrough(),Mn=Is([Dn,Fn,Zn,_n.extend({type:$s("resource_link")}),Ln]),qn=Ts({role:js(["user","assistant"]),content:Mn}).passthrough(),zn=Ks.extend({description:Ns(Es()),messages:As(qn)}),Un=Vs.extend({method:$s("notifications/prompts/list_changed")}),Hn=Ts({title:Ns(Es()),readOnlyHint:Ns(Ss()),destructiveHint:Ns(Ss()),idempotentHint:Ns(Ss()),openWorldHint:Ns(Ss())}).passthrough(),Vn=rn.extend({description:Ns(Es()),inputSchema:Ts({type:$s("object"),properties:Ns(Ts({}).passthrough()),required:Ns(As(Es()))}).passthrough(),outputSchema:Ns(Ts({type:$s("object"),properties:Ns(Ts({}).passthrough()),required:Ns(As(Es()))}).passthrough()),annotations:Ns(Hn),_meta:Ns(Ts({}).passthrough())}),Kn=pn.extend({method:$s("tools/list")}),Qn=mn.extend({tools:As(Vn)}),Gn=Ks.extend({content:As(Mn).default([]),structuredContent:Ts({}).passthrough().optional(),isError:Ns(Ss())}),Bn=(Gn.or(Ks.extend({toolResult:Rs()})),Us.extend({method:$s("tools/call"),params:zs.extend({name:Es(),arguments:Ns(Cs(Rs()))})})),Wn=Vs.extend({method:$s("notifications/tools/list_changed")}),Jn=js(["debug","info","notice","warning","error","critical","alert","emergency"]),Yn=Us.extend({method:$s("logging/setLevel"),params:zs.extend({level:Jn})}),Xn=Vs.extend({method:$s("notifications/message"),params:Hs.extend({level:Jn,logger:Ns(Es()),data:Rs()})}),ei=Ts({name:Es().optional()}).passthrough(),ti=Ts({hints:Ns(As(ei)),costPriority:Ns(ks().min(0).max(1)),speedPriority:Ns(ks().min(0).max(1)),intelligencePriority:Ns(ks().min(0).max(1))}).passthrough(),ri=Ts({role:js(["user","assistant"]),content:Is([Dn,Fn,Zn])}).passthrough(),ai=Us.extend({method:$s("sampling/createMessage"),params:zs.extend({messages:As(ri),systemPrompt:Ns(Es()),includeContext:Ns(js(["none","thisServer","allServers"])),temperature:Ns(ks()),maxTokens:ks().int(),stopSequences:Ns(As(Es())),metadata:Ns(Ts({}).passthrough()),modelPreferences:Ns(ti)})}),si=Ks.extend({model:Es(),stopReason:Ns(js(["endTurn","stopSequence","maxTokens"]).or(Es())),role:js(["user","assistant"]),content:Os("type",[Dn,Fn,Zn])}),ni=Is([Ts({type:$s("boolean"),title:Ns(Es()),description:Ns(Es()),default:Ns(Ss())}).passthrough(),Ts({type:$s("string"),title:Ns(Es()),description:Ns(Es()),minLength:Ns(ks()),maxLength:Ns(ks()),format:Ns(js(["email","uri","date","date-time"]))}).passthrough(),Ts({type:js(["number","integer"]),title:Ns(Es()),description:Ns(Es()),minimum:Ns(ks()),maximum:Ns(ks())}).passthrough(),Ts({type:$s("string"),title:Ns(Es()),description:Ns(Es()),enum:As(Es()),enumNames:Ns(As(Es()))}).passthrough()]),ii=Us.extend({method:$s("elicitation/create"),params:zs.extend({message:Es(),requestedSchema:Ts({type:$s("object"),properties:Cs(Es(),ni),required:Ns(As(Es()))}).passthrough()})}),oi=Ks.extend({action:js(["accept","decline","cancel"]),content:Ns(Cs(Es(),Rs()))}),di=Ts({type:$s("ref/resource"),uri:Es()}).passthrough(),ci=Ts({type:$s("ref/prompt"),name:Es()}).passthrough(),ui=Us.extend({method:$s("completion/complete"),params:zs.extend({ref:Is([ci,di]),argument:Ts({name:Es(),value:Es()}).passthrough(),context:Ns(Ts({arguments:Ns(Cs(Es(),Es()))}))})}),li=Ks.extend({completion:Ts({values:As(Es()).max(100),total:Ns(ks().int()),hasMore:Ns(Ss())}).passthrough()}),hi=Ts({uri:Es().startsWith("file://"),name:Ns(Es()),_meta:Ns(Ts({}).passthrough())}).passthrough(),pi=Us.extend({method:$s("roots/list")}),mi=Ks.extend({roots:As(hi)}),fi=Vs.extend({method:$s("notifications/roots/list_changed")});Is([un,nn,ui,Yn,Nn,$n,wn,Pn,kn,An,Tn,Bn,Kn]),Is([tn,hn,cn,fi]),Is([en,si,oi,mi]),Is([un,ai,ii,pi]),Is([tn,hn,Xn,In,Rn,Wn,Un]),Is([en,dn,li,zn,jn,xn,En,Sn,Gn,Qn]);class gi extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}}class vi{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(tn,e=>{const t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)}),this.setNotificationHandler(hn,e=>{this._onprogress(e)}),this.setRequestHandler(un,e=>({}))}_setupTimeout(e,t,r,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:a})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new gi(Ys.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,r,a;this._transport=e;const s=null===(t=this.transport)||void 0===t?void 0:t.onclose;this._transport.onclose=()=>{null==s||s(),this._onclose()};const n=null===(r=this.transport)||void 0===r?void 0:r.onerror;this._transport.onerror=e=>{null==n||n(e),this._onerror(e)};const i=null===(a=this._transport)||void 0===a?void 0:a.onmessage;this._transport.onmessage=(e,t)=>{var r;null==i||i(e,t),Js(e)||(r=e,Xs.safeParse(r).success)?this._onresponse(e):(e=>Gs.safeParse(e).success)(e)?this._onrequest(e,t):(e=>Bs.safeParse(e).success)(e)?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);const r=new gi(Ys.ConnectionClosed,"Connection closed");for(const e of t.values())e(r)}_onerror(e){var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}_onnotification(e){var t;const r=null!==(t=this._notificationHandlers.get(e.method))&&void 0!==t?t:this.fallbackNotificationHandler;void 0!==r&&Promise.resolve().then(()=>r(e)).catch(e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r,a;const s=null!==(r=this._requestHandlers.get(e.method))&&void 0!==r?r:this.fallbackRequestHandler,n=this._transport;if(void 0===s)return void(null==n||n.send({jsonrpc:"2.0",id:e.id,error:{code:Ys.MethodNotFound,message:"Method not found"}}).catch(e=>this._onerror(new Error(`Failed to send an error response: ${e}`))));const i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);const o={signal:i.signal,sessionId:null==n?void 0:n.sessionId,_meta:null===(a=e.params)||void 0===a?void 0:a._meta,sendNotification:t=>this.notification(t,{relatedRequestId:e.id}),sendRequest:(t,r,a)=>this.request(t,r,{...a,relatedRequestId:e.id}),authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo};Promise.resolve().then(()=>s(e,o)).then(t=>{if(!i.signal.aborted)return null==n?void 0:n.send({result:t,jsonrpc:"2.0",id:e.id})},t=>{var r;if(!i.signal.aborted)return null==n?void 0:n.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:Ys.InternalError,message:null!==(r=t.message)&&void 0!==r?r:"Internal error"}})}).catch(e=>this._onerror(new Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...r}=e.params,a=Number(t),s=this._progressHandlers.get(a);if(!s)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const n=this._responseHandlers.get(a),i=this._timeoutInfo.get(a);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){return void n(e)}s(r)}_onresponse(e){const t=Number(e.id),r=this._responseHandlers.get(t);void 0!==r?(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Js(e)?r(e):r(new gi(e.error.code,e.error.message,e.error.data))):this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`))}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}request(e,t,r){const{relatedRequestId:a,resumptionToken:s,onresumptiontoken:n}=null!=r?r:{};return new Promise((i,o)=>{var d,c,u,l,h,p;if(!this._transport)return void o(new Error("Not connected"));!0===(null===(d=this._options)||void 0===d?void 0:d.enforceStrictCapabilities)&&this.assertCapabilityForMethod(e.method),null===(c=null==r?void 0:r.signal)||void 0===c||c.throwIfAborted();const m=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:m};(null==r?void 0:r.onprogress)&&(this._progressHandlers.set(m,r.onprogress),f.params={...e.params,_meta:{...(null===(u=e.params)||void 0===u?void 0:u._meta)||{},progressToken:m}});const g=e=>{var t;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(e)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:n}).catch(e=>this._onerror(new Error(`Failed to send cancellation: ${e}`))),o(e)};this._responseHandlers.set(m,e=>{var a;if(!(null===(a=null==r?void 0:r.signal)||void 0===a?void 0:a.aborted)){if(e instanceof Error)return o(e);try{const r=t.parse(e.result);i(r)}catch(e){o(e)}}}),null===(l=null==r?void 0:r.signal)||void 0===l||l.addEventListener("abort",()=>{var e;g(null===(e=null==r?void 0:r.signal)||void 0===e?void 0:e.reason)});const v=null!==(h=null==r?void 0:r.timeout)&&void 0!==h?h:6e4;this._setupTimeout(m,v,null==r?void 0:r.maxTotalTimeout,()=>g(new gi(Ys.RequestTimeout,"Request timed out",{timeout:v})),null!==(p=null==r?void 0:r.resetTimeoutOnProgress)&&void 0!==p&&p),this._transport.send(f,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:n}).catch(e=>{this._cleanupTimeout(m),o(e)})})}async notification(e,t){var r,a;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),(null!==(a=null===(r=this._options)||void 0===r?void 0:r.debouncedNotificationMethods)&&void 0!==a?a:[]).includes(e.method)&&!e.params&&!(null==t?void 0:t.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then(()=>{var r;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const a={...e,jsonrpc:"2.0"};null===(r=this._transport)||void 0===r||r.send(a,t).catch(e=>this._onerror(e))})}const s={...e,jsonrpc:"2.0"};await this._transport.send(s,t)}setRequestHandler(e,t){const r=e.shape.method.value;this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,a)=>Promise.resolve(t(e.parse(r),a)))}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,t){this._notificationHandlers.set(e.shape.method.value,r=>Promise.resolve(t(e.parse(r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}var yi=r(8725);class _i extends vi{constructor(e,t){var r;super(t),this._serverInfo=e,this._capabilities=null!==(r=null==t?void 0:t.capabilities)&&void 0!==r?r:{},this._instructions=null==t?void 0:t.instructions,this.setRequestHandler(nn,e=>this._oninitialize(e)),this.setNotificationHandler(cn,()=>{var e;return null===(e=this.oninitialized)||void 0===e?void 0:e.call(this)})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");var t,r;this._capabilities=(t=this._capabilities,r=e,Object.entries(r).reduce((e,[t,r])=>(e[t]=r&&"object"==typeof r&&e[t]?{...e[t],...r}:r,e),{...t}))}assertCapabilityForMethod(e){var t,r,a;switch(e){case"sampling/createMessage":if(!(null===(t=this._clientCapabilities)||void 0===t?void 0:t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(null===(r=this._clientCapabilities)||void 0===r?void 0:r.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(null===(a=this._clientCapabilities)||void 0===a?void 0:a.roots))throw new Error(`Client does not support listing roots (required for ${e})`)}}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})`)}}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})`)}}async _oninitialize(e){const t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Fs.includes(t)?t:Ds,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"},en)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},si,t)}async elicitInput(e,t){const r=await this.request({method:"elicitation/create",params:e},oi,t);if("accept"===r.action&&r.content)try{const t=new yi,a=t.compile(e.requestedSchema);if(!a(r.content))throw new gi(Ys.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorsText(a.errors)}`)}catch(e){if(e instanceof gi)throw e;throw new gi(Ys.InternalError,`Error validating elicitation response: ${e}`)}return r}async listRoots(e,t){return this.request({method:"roots/list",params:e},mi,t)}async sendLoggingMessage(e){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"})}}const bi=Symbol("Let zodToJsonSchema decide on which parser to use"),wi={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"},xi=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function Pi(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?xi(t,e.currentPath):t.join("/")}}function Ei(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function ki(e,t,r,a,s){e[t]=r,Ei(e,t,a,s)}function Si(e,t){return Yi(e.type._def,t)}function Ri(e,t,r){const a=r??t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((r,a)=>Ri(e,t,r))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Ai(e,t)}}const Ai=(e,t)=>{const r={type:"integer",format:"unix-time"};if("openApi3"===t.target)return r;for(const a of e.checks)switch(a.kind){case"min":ki(r,"minimum",a.value,a.message,t);break;case"max":ki(r,"maximum",a.value,a.message,t)}return r};let Ti;const Ii=/^[cC][^\s-]{8,}$/,Oi=/^[0-9a-z]+$/,Ci=/^[0-9A-HJKMNP-TV-Z]{26}$/,$i=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,ji=()=>(void 0===Ti&&(Ti=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ti),Ni=/^(?:(?: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])$/,Di=/^(([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])$/,Fi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Zi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Li=/^[a-zA-Z0-9_-]{21}$/,Mi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function qi(e,t){const r={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":ki(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":ki(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Hi(r,"email",a.message,t);break;case"format:idn-email":Hi(r,"idn-email",a.message,t);break;case"pattern:zod":Vi(r,$i,a.message,t)}break;case"url":Hi(r,"uri",a.message,t);break;case"uuid":Hi(r,"uuid",a.message,t);break;case"regex":Vi(r,a.regex,a.message,t);break;case"cuid":Vi(r,Ii,a.message,t);break;case"cuid2":Vi(r,Oi,a.message,t);break;case"startsWith":Vi(r,RegExp(`^${zi(a.value,t)}`),a.message,t);break;case"endsWith":Vi(r,RegExp(`${zi(a.value,t)}$`),a.message,t);break;case"datetime":Hi(r,"date-time",a.message,t);break;case"date":Hi(r,"date",a.message,t);break;case"time":Hi(r,"time",a.message,t);break;case"duration":Hi(r,"duration",a.message,t);break;case"length":ki(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),ki(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":Vi(r,RegExp(zi(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&Hi(r,"ipv4",a.message,t),"v4"!==a.version&&Hi(r,"ipv6",a.message,t);break;case"base64url":Vi(r,Zi,a.message,t);break;case"jwt":Vi(r,Mi,a.message,t);break;case"cidr":"v6"!==a.version&&Vi(r,Ni,a.message,t),"v4"!==a.version&&Vi(r,Di,a.message,t);break;case"emoji":Vi(r,ji(),a.message,t);break;case"ulid":Vi(r,Ci,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Hi(r,"binary",a.message,t);break;case"contentEncoding:base64":ki(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":Vi(r,Fi,a.message,t)}break;case"nanoid":Vi(r,Li,a.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:(()=>{})()}return r}function zi(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)Ui.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}const Ui=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Hi(e,t,r,a){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):ki(e,"format",t,r,a)}function Vi(e,t,r,a){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:Ki(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):ki(e,"pattern",Ki(t,a),r,a)}function Ki(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;const r=e.flags.includes("i"),a=e.flags.includes("m"),s=e.flags.includes("s"),n=r?e.source.toLowerCase():e.source;let i="",o=!1,d=!1,c=!1;for(let e=0;e<n.length;e++)if(o)i+=n[e],o=!1;else{if(r)if(d){if(n[e].match(/[a-z]/)){c?(i+=n[e],i+=`${n[e-2]}-${n[e]}`.toUpperCase(),c=!1):"-"===n[e+1]&&n[e+2]?.match(/[a-z]/)?(i+=n[e],c=!0):i+=`${n[e]}${n[e].toUpperCase()}`;continue}}else if(n[e].match(/[a-z]/)){i+=`[${n[e]}${n[e].toUpperCase()}]`;continue}if(a){if("^"===n[e]){i+="(^|(?<=[\r\n]))";continue}if("$"===n[e]){i+="($|(?=[\r\n]))";continue}}s&&"."===n[e]?i+=d?`${n[e]}\r\n`:`[${n[e]}\r\n]`:(i+=n[e],"\\"===n[e]?o=!0:d&&"]"===n[e]?d=!1:d||"["!==n[e]||(d=!0))}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function Qi(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===Ps.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:Yi(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??Pi(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};const r={type:"object",additionalProperties:Yi(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===Ps.ZodString&&e.keyType._def.checks?.length){const{type:a,...s}=qi(e.keyType._def,t);return{...r,propertyNames:s}}if(e.keyType?._def.typeName===Ps.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===Ps.ZodBranded&&e.keyType._def.type._def.typeName===Ps.ZodString&&e.keyType._def.type._def.checks?.length){const{type:a,...s}=Si(e.keyType._def,t);return{...r,propertyNames:s}}return r}const Gi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},Bi=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>Yi(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0};function Wi(e){try{return e.isOptional()}catch{return!0}}const Ji=(e,t,r)=>{switch(t){case Ps.ZodString:return qi(e,r);case Ps.ZodNumber:return function(e,t){const r={type:"number"};if(!e.checks)return r;for(const a of e.checks)switch(a.kind){case"int":r.type="integer",Ei(r,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?ki(r,"minimum",a.value,a.message,t):ki(r,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(r.exclusiveMinimum=!0),ki(r,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?ki(r,"maximum",a.value,a.message,t):ki(r,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(r.exclusiveMaximum=!0),ki(r,"maximum",a.value,a.message,t));break;case"multipleOf":ki(r,"multipleOf",a.value,a.message,t)}return r}(e,r);case Ps.ZodObject:return function(e,t){const r="openAi"===t.target,a={type:"object",properties:{}},s=[],n=e.shape();for(const e in n){let i=n[e];if(void 0===i||void 0===i._def)continue;let o=Wi(i);o&&r&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const d=Yi(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==d&&(a.properties[e]=d,o||s.push(e))}s.length&&(a.required=s);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Yi(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==i&&(a.additionalProperties=i),a}(e,r);case Ps.ZodBigInt:return function(e,t){const r={type:"integer",format:"int64"};if(!e.checks)return r;for(const a of e.checks)switch(a.kind){case"min":"jsonSchema7"===t.target?a.inclusive?ki(r,"minimum",a.value,a.message,t):ki(r,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(r.exclusiveMinimum=!0),ki(r,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?ki(r,"maximum",a.value,a.message,t):ki(r,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(r.exclusiveMaximum=!0),ki(r,"maximum",a.value,a.message,t));break;case"multipleOf":ki(r,"multipleOf",a.value,a.message,t)}return r}(e,r);case Ps.ZodBoolean:return{type:"boolean"};case Ps.ZodDate:return Ri(e,r);case Ps.ZodUndefined:return function(e){return{not:Pi(e)}}(r);case Ps.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(r);case Ps.ZodArray:return function(e,t){const r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==Ps.ZodAny&&(r.items=Yi(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&ki(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&ki(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(ki(r,"minItems",e.exactLength.value,e.exactLength.message,t),ki(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}(e,r);case Ps.ZodUnion:case Ps.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return Bi(e,t);const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(e=>e._def.typeName in Gi&&(!e._def.checks||!e._def.checks.length))){const e=r.reduce((e,t)=>{const r=Gi[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(r.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=r.reduce((e,t)=>{const r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===r.length){const t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:r.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(r.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:r.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return Bi(e,t)}(e,r);case Ps.ZodIntersection:return function(e,t){const r=[Yi(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Yi(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let a="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const s=[];return r.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:r,...a}=e;t=a}else a=void 0;s.push(t)}else s.push(...e.allOf),void 0===e.unevaluatedProperties&&(a=void 0);var t}),s.length?{allOf:s,...a}:void 0}(e,r);case Ps.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,r)=>Yi(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Yi(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,r)=>Yi(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,r);case Ps.ZodRecord:return Qi(e,r);case Ps.ZodLiteral:return function(e,t){const r=typeof e.value;return"bigint"!==r&&"number"!==r&&"boolean"!==r&&"string"!==r?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===r?"integer":r,enum:[e.value]}:{type:"bigint"===r?"integer":r,const:e.value}}(e,r);case Ps.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Ps.ZodNativeEnum:return function(e){const t=e.values,r=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),a=Array.from(new Set(r.map(e=>typeof e)));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:r}}(e);case Ps.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:Gi[e.innerType._def.typeName],nullable:!0}:{type:[Gi[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const r=Yi(e.innerType._def,{...t,currentPath:[...t.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}const r=Yi(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}(e,r);case Ps.ZodOptional:return((e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Yi(e.innerType._def,t);const r=Yi(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Pi(t)},r]}:Pi(t)})(e,r);case Ps.ZodMap:return function(e,t){return"record"===t.mapStrategy?Qi(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Yi(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Pi(t),Yi(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Pi(t)],minItems:2,maxItems:2}}}(e,r);case Ps.ZodSet:return function(e,t){const r={type:"array",uniqueItems:!0,items:Yi(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&ki(r,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&ki(r,"maxItems",e.maxSize.value,e.maxSize.message,t),r}(e,r);case Ps.ZodLazy:return()=>e.getter()._def;case Ps.ZodPromise:return function(e,t){return Yi(e.type._def,t)}(e,r);case Ps.ZodNaN:case Ps.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Pi({...e,currentPath:[...e.currentPath,"not"]})}}(r);case Ps.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Yi(e.schema._def,t):Pi(t)}(e,r);case Ps.ZodAny:return Pi(r);case Ps.ZodUnknown:return function(e){return Pi(e)}(r);case Ps.ZodDefault:return function(e,t){return{...Yi(e.innerType._def,t),default:e.defaultValue()}}(e,r);case Ps.ZodBranded:return Si(e,r);case Ps.ZodReadonly:case Ps.ZodCatch:return((e,t)=>Yi(e.innerType._def,t))(e,r);case Ps.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Yi(e.in._def,t);if("output"===t.pipeStrategy)return Yi(e.out._def,t);const r=Yi(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[r,Yi(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]})].filter(e=>void 0!==e)}})(e,r);case Ps.ZodFunction:case Ps.ZodVoid:case Ps.ZodSymbol:default:return}};function Yi(e,t,r=!1){const a=t.seen.get(e);if(t.override){const s=t.override?.(e,t,a,r);if(s!==bi)return s}if(a&&!r){const e=Xi(a,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const n=Ji(e,e.typeName,t),i="function"==typeof n?Yi(n(),t):n;if(i&&eo(e,t,i),t.postProcess){const r=t.postProcess(i,e,t);return s.jsonSchema=i,r}return s.jsonSchema=i,i}const Xi=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:xi(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Pi(t)):"seen"===t.$refStrategy?Pi(t):void 0}},eo=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r),to=(e,t)=>{const r=(e=>{const t=(e=>"string"==typeof e?{...wi,name:e}:{...wi,...e})(e),r=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}})(t);let a="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,a])=>({...e,[t]:Yi(a._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0)??Pi(r)}),{}):void 0;const s="string"==typeof t?t:"title"===t?.nameStrategy?void 0:t?.name,n=Yi(e._def,void 0===s?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??Pi(r),i="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==i&&(n.title=i),r.flags.hasReferencedOpenAiAnyType&&(a||(a={}),a[r.openAiAnyTypeName]||(a[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===r.$refStrategy?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const o=void 0===s?a?{...n,[r.definitionPath]:a}:n:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...a,[s]:n}};return"jsonSchema7"===r.target?o.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==r.target&&"openAi"!==r.target||(o.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===r.target&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var ro;!function(e){e.Completable="McpCompletable"}(ro||(ro={}));class ao extends pa{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}function so(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:a,description:s}=e;if(t&&(r||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{var n,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:s.defaultError}:void 0===s.data?{message:null!==(n=null!=o?o:a)&&void 0!==n?n:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(i=null!=o?o:r)&&void 0!==i?i:s.defaultError}},description:s}}ao.create=(e,t)=>new ao({type:e,typeName:ro.Completable,complete:t.complete,...so(t)});const no=1e6,io=1e6;class oo{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,r){if(e.length>t)throw new Error(`${r} exceeds maximum length of ${t} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>"string"==typeof e?[]:e.names)}constructor(e){oo.validateLength(e,no,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const t=[];let r="",a=0,s=0;for(;a<e.length;)if("{"===e[a]){r&&(t.push(r),r="");const n=e.indexOf("}",a);if(-1===n)throw new Error("Unclosed template expression");if(s++,s>1e4)throw new Error("Template contains too many expressions (max 10000)");const i=e.slice(a+1,n),o=this.getOperator(i),d=i.includes("*"),c=this.getNames(i),u=c[0];for(const e of c)oo.validateLength(e,io,"Variable name");t.push({name:u,operator:o,names:c,exploded:d}),a=n+1}else r+=e[a],a++;return r&&t.push(r),t}getOperator(e){return["+","#",".","/","?","&"].find(t=>e.startsWith(t))||""}getNames(e){const t=this.getOperator(e);return e.slice(t.length).split(",").map(e=>e.replace("*","").trim()).filter(e=>e.length>0)}encodeValue(e,t){return oo.validateLength(e,io,"Variable value"),"+"===t||"#"===t?encodeURI(e):encodeURIComponent(e)}expandPart(e,t){if("?"===e.operator||"&"===e.operator){const r=e.names.map(r=>{const a=t[r];if(void 0===a)return"";const s=Array.isArray(a)?a.map(t=>this.encodeValue(t,e.operator)).join(","):this.encodeValue(a.toString(),e.operator);return`${r}=${s}`}).filter(e=>e.length>0);return 0===r.length?"":("?"===e.operator?"?":"&")+r.join("&")}if(e.names.length>1){const r=e.names.map(e=>t[e]).filter(e=>void 0!==e);return 0===r.length?"":r.map(e=>Array.isArray(e)?e[0]:e).join(",")}const r=t[e.name];if(void 0===r)return"";const a=(Array.isArray(r)?r:[r]).map(t=>this.encodeValue(t,e.operator));switch(e.operator){case"":case"+":default:return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/")}}expand(e){let t="",r=!1;for(const a of this.parts){if("string"==typeof a){t+=a;continue}const s=this.expandPart(a,e);s&&("?"!==a.operator&&"&"!==a.operator||!r?t+=s:t+=s.replace("?","&"),"?"!==a.operator&&"&"!==a.operator||(r=!0))}return t}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const t=[];for(const t of e.names)oo.validateLength(t,io,"Variable name");if("?"===e.operator||"&"===e.operator){for(let r=0;r<e.names.length;r++){const a=e.names[r],s=0===r?"\\"+e.operator:"&";t.push({pattern:s+this.escapeRegExp(a)+"=([^&]+)",name:a})}return t}let r;const a=e.name;switch(e.operator){case"":r=e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)";break;case"+":case"#":r="(.+)";break;case".":r="\\.([^/,]+)";break;case"/":r="/"+(e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)");break;default:r="([^/]+)"}return t.push({pattern:r,name:a}),t}match(e){oo.validateLength(e,no,"URI");let t="^";const r=[];for(const e of this.parts)if("string"==typeof e)t+=this.escapeRegExp(e);else{const a=this.partToRegExp(e);for(const{pattern:s,name:n}of a)t+=s,r.push({name:n,exploded:e.exploded})}t+="$",oo.validateLength(t,1e6,"Generated regex pattern");const a=new RegExp(t),s=e.match(a);if(!s)return null;const n={};for(let e=0;e<r.length;e++){const{name:t,exploded:a}=r[e],i=s[e+1],o=t.replace("*","");a&&i.includes(",")?n[o]=i.split(","):n[o]=i}return n}}class co{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new _i(e,t)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Kn.shape.method.value),this.server.assertCanSetRequestHandler(Bn.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Kn,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{const r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?to(t.inputSchema,{strictUnions:!0}):lo,annotations:t.annotations};return t.outputSchema&&(r.outputSchema=to(t.outputSchema,{strictUnions:!0})),r})})),this.server.setRequestHandler(Bn,async(e,t)=>{const r=this._registeredTools[e.params.name];if(!r)throw new gi(Ys.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new gi(Ys.InvalidParams,`Tool ${e.params.name} disabled`);let a;if(r.inputSchema){const s=await r.inputSchema.safeParseAsync(e.params.arguments);if(!s.success)throw new gi(Ys.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${s.error.message}`);const n=s.data,i=r.callback;try{a=await Promise.resolve(i(n,t))}catch(e){a={content:[{type:"text",text:e instanceof Error?e.message:String(e)}],isError:!0}}}else{const e=r.callback;try{a=await Promise.resolve(e(t))}catch(e){a={content:[{type:"text",text:e instanceof Error?e.message:String(e)}],isError:!0}}}if(r.outputSchema&&!a.isError){if(!a.structuredContent)throw new gi(Ys.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);const t=await r.outputSchema.safeParseAsync(a.structuredContent);if(!t.success)throw new gi(Ys.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${t.error.message}`)}return a}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(ui.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ui,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 gi(Ys.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){const r=this._registeredPrompts[t.name];if(!r)throw new gi(Ys.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new gi(Ys.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return fo;const a=r.argsSchema.shape[e.params.argument.name];if(!(a instanceof ao))return fo;const s=a._def;return mo(await s.complete(e.params.argument.value,e.params.context))}async handleResourceCompletion(e,t){const r=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return fo;throw new gi(Ys.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?mo(await a(e.params.argument.value,e.params.context)):fo}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(wn.shape.method.value),this.server.assertCanSetRequestHandler(Pn.shape.method.value),this.server.assertCanSetRequestHandler(kn.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(wn,async(e,t)=>{const r=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),a=[];for(const e of Object.values(this._registeredResourceTemplates)){if(!e.resourceTemplate.listCallback)continue;const r=await e.resourceTemplate.listCallback(t);for(const t of r.resources)a.push({...e.metadata,...t})}return{resources:[...r,...a]}}),this.server.setRequestHandler(Pn,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(kn,async(e,t)=>{const r=new URL(e.params.uri),a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new gi(Ys.InvalidParams,`Resource ${r} disabled`);return a.readCallback(r,t)}for(const e of Object.values(this._registeredResourceTemplates)){const a=e.resourceTemplate.uriTemplate.match(r.toString());if(a)return e.readCallback(r,a,t)}throw new gi(Ys.InvalidParams,`Resource ${r} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler($n.shape.method.value),this.server.assertCanSetRequestHandler(Nn.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler($n,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>{return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?(r=t.argsSchema,Object.entries(r.shape).map(([e,t])=>({name:e,description:t.description,required:!t.isOptional()}))):void 0};var r})})),this.server.setRequestHandler(Nn,async(e,t)=>{const r=this._registeredPrompts[e.params.name];if(!r)throw new gi(Ys.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new gi(Ys.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){const a=await r.argsSchema.safeParseAsync(e.params.arguments);if(!a.success)throw new gi(Ys.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${a.error.message}`);const s=a.data,n=r.callback;return await Promise.resolve(n(s,t))}{const e=r.callback;return await Promise.resolve(e(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...r){let a;"object"==typeof r[0]&&(a=r.shift());const s=r[0];if("string"==typeof t){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const r=this._createRegisteredResource(e,void 0,t,a,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const r=this._createRegisteredResourceTemplate(e,void 0,t,a,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}}registerResource(e,t,r,a){if("string"==typeof t){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const s=this._createRegisteredResource(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const s=this._createRegisteredResourceTemplate(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,t,r,a,s){const n={name:e,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>n.update({enabled:!1}),enable:()=>n.update({enabled:!0}),remove:()=>n.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=n)),void 0!==e.name&&(n.name=e.name),void 0!==e.title&&(n.title=e.title),void 0!==e.metadata&&(n.metadata=e.metadata),void 0!==e.callback&&(n.readCallback=e.callback),void 0!==e.enabled&&(n.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=n,n}_createRegisteredResourceTemplate(e,t,r,a,s){const n={resourceTemplate:r,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>n.update({enabled:!1}),enable:()=>n.update({enabled:!0}),remove:()=>n.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=n)),void 0!==t.title&&(n.title=t.title),void 0!==t.template&&(n.resourceTemplate=t.template),void 0!==t.metadata&&(n.metadata=t.metadata),void 0!==t.callback&&(n.readCallback=t.callback),void 0!==t.enabled&&(n.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=n,n}_createRegisteredPrompt(e,t,r,a,s){const n={title:t,description:r,argsSchema:void 0===a?void 0:Ts(a),callback:s,enabled:!0,disable:()=>n.update({enabled:!1}),enable:()=>n.update({enabled:!0}),remove:()=>n.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=n)),void 0!==t.title&&(n.title=t.title),void 0!==t.description&&(n.description=t.description),void 0!==t.argsSchema&&(n.argsSchema=Ts(t.argsSchema)),void 0!==t.callback&&(n.callback=t.callback),void 0!==t.enabled&&(n.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=n,n}_createRegisteredTool(e,t,r,a,s,n,i){const o={title:t,description:r,inputSchema:void 0===a?void 0:Ts(a),outputSchema:void 0===s?void 0:Ts(s),annotations:n,callback:i,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredTools[e],t.name&&(this._registeredTools[t.name]=o)),void 0!==t.title&&(o.title=t.title),void 0!==t.description&&(o.description=t.description),void 0!==t.paramsSchema&&(o.inputSchema=Ts(t.paramsSchema)),void 0!==t.callback&&(o.callback=t.callback),void 0!==t.annotations&&(o.annotations=t.annotations),void 0!==t.enabled&&(o.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=o,this.setToolRequestHandlers(),this.sendToolListChanged(),o}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let r,a,s;if("string"==typeof t[0]&&(r=t.shift()),t.length>1){const e=t[0];ho(e)?(a=t.shift(),t.length>1&&"object"==typeof t[0]&&null!==t[0]&&!ho(t[0])&&(s=t.shift())):"object"==typeof e&&null!==e&&(s=t.shift())}const n=t[0];return this._createRegisteredTool(e,void 0,r,a,void 0,s,n)}registerTool(e,t,r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:a,description:s,inputSchema:n,outputSchema:i,annotations:o}=t;return this._createRegisteredTool(e,a,s,n,i,o,r)}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let r,a;"string"==typeof t[0]&&(r=t.shift()),t.length>1&&(a=t.shift());const s=t[0],n=this._createRegisteredPrompt(e,void 0,r,a,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),n}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:a,description:s,argsSchema:n}=t,i=this._createRegisteredPrompt(e,a,s,n,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return void 0!==this.server.transport}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class uo{constructor(e,t){this._callbacks=t,this._uriTemplate="string"==typeof e?new oo(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){var t;return null===(t=this._callbacks.complete)||void 0===t?void 0:t[e]}}const lo={type:"object",properties:{}};function ho(e){return"object"==typeof e&&null!==e&&(0===Object.keys(e).length||Object.values(e).some(po))}function po(e){return null!==e&&"object"==typeof e&&"parse"in e&&"function"==typeof e.parse&&"safeParse"in e&&"function"==typeof e.safeParse}function mo(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}const fo={completion:{values:[],hasMore:!1}},go=new Proxy({},{get:()=>function(...e){}}),vo={},yo={};let _o=void 0!==globalThis.jest;const bo=(e,t)=>{if(_o)throw new Error("MCP Registration is already activated. Cannot register new MCP servers.");const r=xo(t);vo[r]=e};async function wo(e){if(_o)return;_o=!0;const t=Object.entries(vo);for await(const r of t){const[t,a]=r;await e.registerServer({name:`editor-${t}`,server:a,version:"1.0.0",description:yo[t]||t})}}const xo=e=>{if(!e||!/^[a-z_]+$/.test(e))throw new Error("Not alphabet");return e},Po=(e,t)=>{const r=`editor-${xo(e)}`;if(void 0!==globalThis.jest)return{addTool:()=>{},setMCPDescription:()=>{},getActiveChatInfo(){return{sessionId:"mock-session-id",expiresAt:Date.now()+36e5}},mcpServer:go};vo[e]||(vo[e]=new co({name:r,version:"1.0.0"},{instructions:t?.instructions}));const a=vo[e],{addTool:s}=(n=a,{addTool:function(e){const t=e.outputSchema,r=e.schema?e.schema:{};if(_o)throw new Error("MCP Registration is already activated. Cannot add new tools.");n.registerTool(e.name,{description:e.description,inputSchema:r,outputSchema:t,title:e.name,annotations:{destructiveHint:e.isDestrcutive,readOnlyHint:!e.isDestrcutive&&void 0,title:e.name}},async function(t,r){try{const a=await e.handler(e.schema?t:{},r);return{structuredContent:"string"==typeof a?void 0:a,content:[{type:"text",text:"string"==typeof a?a:JSON.stringify(a)},...e.resourceList||[]]}}catch(e){return{isError:!0,content:[{type:"text",text:e.message||"Unknown error"}]}}})}});var n;return{mcpServer:a,addTool:s,setMCPDescription:t=>{yo[e]=t},getActiveChatInfo:()=>{const e=localStorage.getItem("angie_active_chat_id");if(!e)return{expiresAt:0,sessionId:""};const t=JSON.parse(e);return{expiresAt:t.expiresAt,sessionId:t.sessionId}}}};let Eo;const ko=()=>globalThis.__ELEMENTOR_MCP_DISABLED__?{}:(Eo||(Eo=new Qr),Eo);function So(){return(0,l.isExperimentActive)("editor_mcp")?ko().waitForReady():Promise.resolve()}document.addEventListener("DOMContentLoaded",()=>{(0,l.isExperimentActive)("editor_mcp")?ko().waitForReady().then(()=>wo(Eo)):Promise.resolve()},{once:!0});const Ro={maxTokens:1e4,modelPreferences:"openai",model:"gpt-4o"},Ao={type:"object",properties:{content:{type:"string",description:"Result"}},required:["content"],additionalProperties:!1},To=(e,t=Ro)=>{const{maxTokens:r=1e3,modelPreferences:a="openai",model:s="gpt-4o"}=t;return async t=>{const n={...t.systemPrompt?{systemPrompt:t.systemPrompt}:{}},i=await e.sendRequest({method:"sampling/createMessage",params:{maxTokens:r,modelPreferences:{hints:[{name:a}]},metadata:{model:s,...n,structured_output:t.structuredOutput||Ao},messages:t.messages}},ri);try{return JSON.parse(i.content.text)}catch{return i.content}}};class Io{_description="";_parameters={};_examples=[];_furtherInstructions=[];constructor(e){this.name=e}description(e){return void 0===e?this._description:(this._description=e,this)}parameter(e,t){return void 0===t?this._parameters[e]:(this._parameters[e]=`**${e}**:\n${t}`,this)}instruction(e){return this._furtherInstructions.push(e),this}example(e){return this._examples.push(e),this}get examples(){return this._examples.join("\n\n")}prompt(){return`# ${this.name}\n# Description\n${this._description}\n\n${this._parameters.length?"# Parameters":""}\n${Object.values(this._parameters).join("\n\n")}\n\n${this._examples.length?"# Examples":""}\n${this.examples}\n\n${this._furtherInstructions.length?"# Further Instructions":""}\n${this._furtherInstructions.join("\n\n")}\n`.trim()}}const Oo=e=>new Io(e),Co=()=>ko()}(),(window.elementorV2=window.elementorV2||{}).editorMcp=a}(),window.elementorV2.editorMcp?.init?.();