@intelliweave/embedded 1.8.63 → 1.9.65-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/component.d.ts +270 -286
- package/dist/component/component.js +21 -19
- package/dist/intelliweave-wordpress.zip +0 -0
- package/dist/node/node.d.ts +728 -690
- package/dist/node/node.js +16 -14
- package/dist/react/react.d.ts +675 -693
- package/dist/react/react.js +21 -19
- package/dist/script-tag/script-tag.js +65 -42
- package/dist/webpack/index.d.ts +389 -351
- package/dist/webpack/index.js +23 -21
- package/package.json +4 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{b as te,c as ws,d as Cs,e as Pe}from"./chunk-AIYMQX7V.js";var Nd=te((Gi,Dd)=>{"use strict";(function(r,e){typeof Gi=="object"&&typeof Dd<"u"?e(Gi):typeof define=="function"&&define.amd?define(["exports"],e):e(r.URI=r.URI||{})})(Gi,function(r){"use strict";function e(){for(var w=arguments.length,b=Array(w),k=0;k<w;k++)b[k]=arguments[k];if(b.length>1){b[0]=b[0].slice(0,-1);for(var P=b.length-1,N=1;N<P;++N)b[N]=b[N].slice(1,-1);return b[P]=b[P].slice(1),b.join("")}else return b[0]}function t(w){return"(?:"+w+")"}function a(w){return w===void 0?"undefined":w===null?"null":Object.prototype.toString.call(w).split(" ").pop().split("]").shift().toLowerCase()}function n(w){return w.toUpperCase()}function i(w){return w!=null?w instanceof Array?w:typeof w.length!="number"||w.split||w.setInterval||w.call?[w]:Array.prototype.slice.call(w):[]}function o(w,b){var k=w;if(b)for(var P in b)k[P]=b[P];return k}function s(w){var b="[A-Za-z]",k="[\\x0D]",P="[0-9]",N="[\\x22]",q=e(P,"[A-Fa-f]"),ce="[\\x0A]",ve="[\\x20]",we=t(t("%[EFef]"+q+"%"+q+q+"%"+q+q)+"|"+t("%[89A-Fa-f]"+q+"%"+q+q)+"|"+t("%"+q+q)),Ke="[\\:\\/\\?\\#\\[\\]\\@]",be="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",Me=e(Ke,be),$e=w?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Oe=w?"[\\uE000-\\uF8FF]":"[]",_e=e(b,P,"[\\-\\.\\_\\~]",$e),Fe=t(b+e(b,P,"[\\+\\-\\.]")+"*"),xe=t(t(we+"|"+e(_e,be,"[\\:]"))+"*"),jr=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("[1-9]"+P)+"|"+P),Ct=t(t("25[0-5]")+"|"+t("2[0-4]"+P)+"|"+t("1"+P+P)+"|"+t("0?[1-9]"+P)+"|0?0?"+P),Ot=t(Ct+"\\."+Ct+"\\."+Ct+"\\."+Ct),Ae=t(q+"{1,4}"),kt=t(t(Ae+"\\:"+Ae)+"|"+Ot),Lt=t(t(Ae+"\\:")+"{6}"+kt),er=t("\\:\\:"+t(Ae+"\\:")+"{5}"+kt),qr=t(t(Ae)+"?\\:\\:"+t(Ae+"\\:")+"{4}"+kt),ur=t(t(t(Ae+"\\:")+"{0,1}"+Ae)+"?\\:\\:"+t(Ae+"\\:")+"{3}"+kt),ha=t(t(t(Ae+"\\:")+"{0,2}"+Ae)+"?\\:\\:"+t(Ae+"\\:")+"{2}"+kt),oi=t(t(t(Ae+"\\:")+"{0,3}"+Ae)+"?\\:\\:"+Ae+"\\:"+kt),si=t(t(t(Ae+"\\:")+"{0,4}"+Ae)+"?\\:\\:"+kt),xn=t(t(t(Ae+"\\:")+"{0,5}"+Ae)+"?\\:\\:"+Ae),An=t(t(t(Ae+"\\:")+"{0,6}"+Ae)+"?\\:\\:"),dr=t([Lt,er,qr,ur,ha,oi,si,xn,An].join("|")),In=t(t(_e+"|"+we)+"+"),Ss=t(dr+"\\%25"+In),Kr=t(dr+t("\\%25|\\%(?!"+q+"{2})")+In),If=t("[vV]"+q+"+\\."+e(_e,be,"[\\:]")+"+"),Rf=t("\\["+t(Kr+"|"+dr+"|"+If)+"\\]"),su=t(t(we+"|"+e(_e,be))+"*"),ga=t(Rf+"|"+Ot+"(?!"+su+")|"+su),fa=t(P+"*"),lu=t(t(xe+"@")+"?"+ga+t("\\:"+fa)+"?"),ya=t(we+"|"+e(_e,be,"[\\:\\@]")),Pf=t(ya+"*"),cu=t(ya+"+"),Df=t(t(we+"|"+e(_e,be,"[\\@]"))+"+"),pr=t(t("\\/"+Pf)+"*"),Rn=t("\\/"+t(cu+pr)+"?"),Es=t(Df+pr),li=t(cu+pr),Pn="(?!"+ya+")",Kk=t(pr+"|"+Rn+"|"+Es+"|"+li+"|"+Pn),Dn=t(t(ya+"|"+e("[\\/\\?]",Oe))+"*"),ba=t(t(ya+"|[\\/\\?]")+"*"),uu=t(t("\\/\\/"+lu+pr)+"|"+Rn+"|"+li+"|"+Pn),Nf=t(Fe+"\\:"+uu+t("\\?"+Dn)+"?"+t("\\#"+ba)+"?"),Of=t(t("\\/\\/"+lu+pr)+"|"+Rn+"|"+Es+"|"+Pn),Lf=t(Of+t("\\?"+Dn)+"?"+t("\\#"+ba)+"?"),$k=t(Nf+"|"+Lf),Xk=t(Fe+"\\:"+uu+t("\\?"+Dn)+"?"),Yk="^("+Fe+")\\:"+t(t("\\/\\/("+t("("+xe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?)")+"?("+pr+"|"+Rn+"|"+li+"|"+Pn+")")+t("\\?("+Dn+")")+"?"+t("\\#("+ba+")")+"?$",Zk="^(){0}"+t(t("\\/\\/("+t("("+xe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?)")+"?("+pr+"|"+Rn+"|"+Es+"|"+Pn+")")+t("\\?("+Dn+")")+"?"+t("\\#("+ba+")")+"?$",Jk="^("+Fe+")\\:"+t(t("\\/\\/("+t("("+xe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?)")+"?("+pr+"|"+Rn+"|"+li+"|"+Pn+")")+t("\\?("+Dn+")")+"?$",Qk="^"+t("\\#("+ba+")")+"?$",eT="^"+t("("+xe+")@")+"?("+ga+")"+t("\\:("+fa+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",b,P,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",_e,be),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",_e,be),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",_e,be),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",_e,be),"g"),NOT_QUERY:new RegExp(e("[^\\%]",_e,be,"[\\:\\@\\/\\?]",Oe),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",_e,be,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",_e,be),"g"),UNRESERVED:new RegExp(_e,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",_e,Me),"g"),PCT_ENCODED:new RegExp(we,"g"),IPV4ADDRESS:new RegExp("^("+Ot+")$"),IPV6ADDRESS:new RegExp("^\\[?("+dr+")"+t(t("\\%25|\\%(?!"+q+"{2})")+"("+In+")")+"?\\]?$")}}var l=s(!1),c=s(!0),u=function(){function w(b,k){var P=[],N=!0,q=!1,ce=void 0;try{for(var ve=b[Symbol.iterator](),we;!(N=(we=ve.next()).done)&&(P.push(we.value),!(k&&P.length===k));N=!0);}catch(Ke){q=!0,ce=Ke}finally{try{!N&&ve.return&&ve.return()}finally{if(q)throw ce}}return P}return function(b,k){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return w(b,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(w){if(Array.isArray(w)){for(var b=0,k=Array(w.length);b<w.length;b++)k[b]=w[b];return k}else return Array.from(w)},m=2147483647,d=36,g=1,f=26,y=38,v=700,T=72,E=128,I="-",D=/^xn--/,C=/[^\0-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,F={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},R=d-g,G=Math.floor,z=String.fromCharCode;function O(w){throw new RangeError(F[w])}function x(w,b){for(var k=[],P=w.length;P--;)k[P]=b(w[P]);return k}function A(w,b){var k=w.split("@"),P="";k.length>1&&(P=k[0]+"@",w=k[1]),w=w.replace(M,".");var N=w.split("."),q=x(N,b).join(".");return P+q}function B(w){for(var b=[],k=0,P=w.length;k<P;){var N=w.charCodeAt(k++);if(N>=55296&&N<=56319&&k<P){var q=w.charCodeAt(k++);(q&64512)==56320?b.push(((N&1023)<<10)+(q&1023)+65536):(b.push(N),k--)}else b.push(N)}return b}var X=function(b){return String.fromCodePoint.apply(String,p(b))},K=function(b){return b-48<10?b-22:b-65<26?b-65:b-97<26?b-97:d},Q=function(b,k){return b+22+75*(b<26)-((k!=0)<<5)},Z=function(b,k,P){var N=0;for(b=P?G(b/v):b>>1,b+=G(b/k);b>R*f>>1;N+=d)b=G(b/R);return G(N+(R+1)*b/(b+y))},_=function(b){var k=[],P=b.length,N=0,q=E,ce=T,ve=b.lastIndexOf(I);ve<0&&(ve=0);for(var we=0;we<ve;++we)b.charCodeAt(we)>=128&&O("not-basic"),k.push(b.charCodeAt(we));for(var Ke=ve>0?ve+1:0;Ke<P;){for(var be=N,Me=1,$e=d;;$e+=d){Ke>=P&&O("invalid-input");var Oe=K(b.charCodeAt(Ke++));(Oe>=d||Oe>G((m-N)/Me))&&O("overflow"),N+=Oe*Me;var _e=$e<=ce?g:$e>=ce+f?f:$e-ce;if(Oe<_e)break;var Fe=d-_e;Me>G(m/Fe)&&O("overflow"),Me*=Fe}var xe=k.length+1;ce=Z(N-be,xe,be==0),G(N/xe)>m-q&&O("overflow"),q+=G(N/xe),N%=xe,k.splice(N++,0,q)}return String.fromCodePoint.apply(String,k)},fe=function(b){var k=[];b=B(b);var P=b.length,N=E,q=0,ce=T,ve=!0,we=!1,Ke=void 0;try{for(var be=b[Symbol.iterator](),Me;!(ve=(Me=be.next()).done);ve=!0){var $e=Me.value;$e<128&&k.push(z($e))}}catch(Kr){we=!0,Ke=Kr}finally{try{!ve&&be.return&&be.return()}finally{if(we)throw Ke}}var Oe=k.length,_e=Oe;for(Oe&&k.push(I);_e<P;){var Fe=m,xe=!0,jr=!1,Ct=void 0;try{for(var Ot=b[Symbol.iterator](),Ae;!(xe=(Ae=Ot.next()).done);xe=!0){var kt=Ae.value;kt>=N&&kt<Fe&&(Fe=kt)}}catch(Kr){jr=!0,Ct=Kr}finally{try{!xe&&Ot.return&&Ot.return()}finally{if(jr)throw Ct}}var Lt=_e+1;Fe-N>G((m-q)/Lt)&&O("overflow"),q+=(Fe-N)*Lt,N=Fe;var er=!0,qr=!1,ur=void 0;try{for(var ha=b[Symbol.iterator](),oi;!(er=(oi=ha.next()).done);er=!0){var si=oi.value;if(si<N&&++q>m&&O("overflow"),si==N){for(var xn=q,An=d;;An+=d){var dr=An<=ce?g:An>=ce+f?f:An-ce;if(xn<dr)break;var In=xn-dr,Ss=d-dr;k.push(z(Q(dr+In%Ss,0))),xn=G(In/Ss)}k.push(z(Q(xn,0))),ce=Z(q,Lt,_e==Oe),q=0,++_e}}}catch(Kr){qr=!0,ur=Kr}finally{try{!er&&ha.return&&ha.return()}finally{if(qr)throw ur}}++q,++N}return k.join("")},Ie=function(b){return A(b,function(k){return D.test(k)?_(k.slice(4).toLowerCase()):k})},S=function(b){return A(b,function(k){return C.test(k)?"xn--"+fe(k):k})},ne={version:"2.1.0",ucs2:{decode:B,encode:X},decode:_,encode:fe,toASCII:S,toUnicode:Ie},Te={};function Be(w){var b=w.charCodeAt(0),k=void 0;return b<16?k="%0"+b.toString(16).toUpperCase():b<128?k="%"+b.toString(16).toUpperCase():b<2048?k="%"+(b>>6|192).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase():k="%"+(b>>12|224).toString(16).toUpperCase()+"%"+(b>>6&63|128).toString(16).toUpperCase()+"%"+(b&63|128).toString(16).toUpperCase(),k}function We(w){for(var b="",k=0,P=w.length;k<P;){var N=parseInt(w.substr(k+1,2),16);if(N<128)b+=String.fromCharCode(N),k+=3;else if(N>=194&&N<224){if(P-k>=6){var q=parseInt(w.substr(k+4,2),16);b+=String.fromCharCode((N&31)<<6|q&63)}else b+=w.substr(k,6);k+=6}else if(N>=224){if(P-k>=9){var ce=parseInt(w.substr(k+4,2),16),ve=parseInt(w.substr(k+7,2),16);b+=String.fromCharCode((N&15)<<12|(ce&63)<<6|ve&63)}else b+=w.substr(k,9);k+=9}else b+=w.substr(k,3),k+=3}return b}function Re(w,b){function k(P){var N=We(P);return N.match(b.UNRESERVED)?N:P}return w.scheme&&(w.scheme=String(w.scheme).replace(b.PCT_ENCODED,k).toLowerCase().replace(b.NOT_SCHEME,"")),w.userinfo!==void 0&&(w.userinfo=String(w.userinfo).replace(b.PCT_ENCODED,k).replace(b.NOT_USERINFO,Be).replace(b.PCT_ENCODED,n)),w.host!==void 0&&(w.host=String(w.host).replace(b.PCT_ENCODED,k).toLowerCase().replace(b.NOT_HOST,Be).replace(b.PCT_ENCODED,n)),w.path!==void 0&&(w.path=String(w.path).replace(b.PCT_ENCODED,k).replace(w.scheme?b.NOT_PATH:b.NOT_PATH_NOSCHEME,Be).replace(b.PCT_ENCODED,n)),w.query!==void 0&&(w.query=String(w.query).replace(b.PCT_ENCODED,k).replace(b.NOT_QUERY,Be).replace(b.PCT_ENCODED,n)),w.fragment!==void 0&&(w.fragment=String(w.fragment).replace(b.PCT_ENCODED,k).replace(b.NOT_FRAGMENT,Be).replace(b.PCT_ENCODED,n)),w}function ut(w){return w.replace(/^0*(.*)/,"$1")||"0"}function Se(w,b){var k=w.match(b.IPV4ADDRESS)||[],P=u(k,2),N=P[1];return N?N.split(".").map(ut).join("."):w}function Ce(w,b){var k=w.match(b.IPV6ADDRESS)||[],P=u(k,3),N=P[1],q=P[2];if(N){for(var ce=N.toLowerCase().split("::").reverse(),ve=u(ce,2),we=ve[0],Ke=ve[1],be=Ke?Ke.split(":").map(ut):[],Me=we.split(":").map(ut),$e=b.IPV4ADDRESS.test(Me[Me.length-1]),Oe=$e?7:8,_e=Me.length-Oe,Fe=Array(Oe),xe=0;xe<Oe;++xe)Fe[xe]=be[xe]||Me[_e+xe]||"";$e&&(Fe[Oe-1]=Se(Fe[Oe-1],b));var jr=Fe.reduce(function(Lt,er,qr){if(!er||er==="0"){var ur=Lt[Lt.length-1];ur&&ur.index+ur.length===qr?ur.length++:Lt.push({index:qr,length:1})}return Lt},[]),Ct=jr.sort(function(Lt,er){return er.length-Lt.length})[0],Ot=void 0;if(Ct&&Ct.length>1){var Ae=Fe.slice(0,Ct.index),kt=Fe.slice(Ct.index+Ct.length);Ot=Ae.join(":")+"::"+kt.join(":")}else Ot=Fe.join(":");return q&&(Ot+="%"+q),Ot}else return w}var gt=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,je="".match(/(){0}/)[1]===void 0;function ye(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k={},P=b.iri!==!1?c:l;b.reference==="suffix"&&(w=(b.scheme?b.scheme+":":"")+"//"+w);var N=w.match(gt);if(N){je?(k.scheme=N[1],k.userinfo=N[3],k.host=N[4],k.port=parseInt(N[5],10),k.path=N[6]||"",k.query=N[7],k.fragment=N[8],isNaN(k.port)&&(k.port=N[5])):(k.scheme=N[1]||void 0,k.userinfo=w.indexOf("@")!==-1?N[3]:void 0,k.host=w.indexOf("//")!==-1?N[4]:void 0,k.port=parseInt(N[5],10),k.path=N[6]||"",k.query=w.indexOf("?")!==-1?N[7]:void 0,k.fragment=w.indexOf("#")!==-1?N[8]:void 0,isNaN(k.port)&&(k.port=w.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?N[4]:void 0)),k.host&&(k.host=Ce(Se(k.host,P),P)),k.scheme===void 0&&k.userinfo===void 0&&k.host===void 0&&k.port===void 0&&!k.path&&k.query===void 0?k.reference="same-document":k.scheme===void 0?k.reference="relative":k.fragment===void 0?k.reference="absolute":k.reference="uri",b.reference&&b.reference!=="suffix"&&b.reference!==k.reference&&(k.error=k.error||"URI is not a "+b.reference+" reference.");var q=Te[(b.scheme||k.scheme||"").toLowerCase()];if(!b.unicodeSupport&&(!q||!q.unicodeSupport)){if(k.host&&(b.domainHost||q&&q.domainHost))try{k.host=ne.toASCII(k.host.replace(P.PCT_ENCODED,We).toLowerCase())}catch(ce){k.error=k.error||"Host's domain name can not be converted to ASCII via punycode: "+ce}Re(k,l)}else Re(k,P);q&&q.parse&&q.parse(k,b)}else k.error=k.error||"URI can not be parsed.";return k}function Wt(w,b){var k=b.iri!==!1?c:l,P=[];return w.userinfo!==void 0&&(P.push(w.userinfo),P.push("@")),w.host!==void 0&&P.push(Ce(Se(String(w.host),k),k).replace(k.IPV6ADDRESS,function(N,q,ce){return"["+q+(ce?"%25"+ce:"")+"]"})),(typeof w.port=="number"||typeof w.port=="string")&&(P.push(":"),P.push(String(w.port))),P.length?P.join(""):void 0}var Pt=/^\.\.?\//,cr=/^\/\.(\/|$)/,Qt=/^\/\.\.(\/|$)/,qe=/^\/?(?:.|\n)*?(?=\/|$)/;function ft(w){for(var b=[];w.length;)if(w.match(Pt))w=w.replace(Pt,"");else if(w.match(cr))w=w.replace(cr,"/");else if(w.match(Qt))w=w.replace(Qt,"/"),b.pop();else if(w==="."||w==="..")w="";else{var k=w.match(qe);if(k){var P=k[0];w=w.slice(P.length),b.push(P)}else throw new Error("Unexpected dot segment condition")}return b.join("")}function at(w){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},k=b.iri?c:l,P=[],N=Te[(b.scheme||w.scheme||"").toLowerCase()];if(N&&N.serialize&&N.serialize(w,b),w.host&&!k.IPV6ADDRESS.test(w.host)){if(b.domainHost||N&&N.domainHost)try{w.host=b.iri?ne.toUnicode(w.host):ne.toASCII(w.host.replace(k.PCT_ENCODED,We).toLowerCase())}catch(ve){w.error=w.error||"Host's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+ve}}Re(w,k),b.reference!=="suffix"&&w.scheme&&(P.push(w.scheme),P.push(":"));var q=Wt(w,b);if(q!==void 0&&(b.reference!=="suffix"&&P.push("//"),P.push(q),w.path&&w.path.charAt(0)!=="/"&&P.push("/")),w.path!==void 0){var ce=w.path;!b.absolutePath&&(!N||!N.absolutePath)&&(ce=ft(ce)),q===void 0&&(ce=ce.replace(/^\/\//,"/%2F")),P.push(ce)}return w.query!==void 0&&(P.push("?"),P.push(w.query)),w.fragment!==void 0&&(P.push("#"),P.push(w.fragment)),P.join("")}function Qe(w,b){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P=arguments[3],N={};return P||(w=ye(at(w,k),k),b=ye(at(b,k),k)),k=k||{},!k.tolerant&&b.scheme?(N.scheme=b.scheme,N.userinfo=b.userinfo,N.host=b.host,N.port=b.port,N.path=ft(b.path||""),N.query=b.query):(b.userinfo!==void 0||b.host!==void 0||b.port!==void 0?(N.userinfo=b.userinfo,N.host=b.host,N.port=b.port,N.path=ft(b.path||""),N.query=b.query):(b.path?(b.path.charAt(0)==="/"?N.path=ft(b.path):((w.userinfo!==void 0||w.host!==void 0||w.port!==void 0)&&!w.path?N.path="/"+b.path:w.path?N.path=w.path.slice(0,w.path.lastIndexOf("/")+1)+b.path:N.path=b.path,N.path=ft(N.path)),N.query=b.query):(N.path=w.path,b.query!==void 0?N.query=b.query:N.query=w.query),N.userinfo=w.userinfo,N.host=w.host,N.port=w.port),N.scheme=w.scheme),N.fragment=b.fragment,N}function Dt(w,b,k){var P=o({scheme:"null"},k);return at(Qe(ye(w,P),ye(b,P),P,!0),P)}function dt(w,b){return typeof w=="string"?w=at(ye(w,b),b):a(w)==="object"&&(w=ye(at(w,b),b)),w}function L(w,b,k){return typeof w=="string"?w=at(ye(w,k),k):a(w)==="object"&&(w=at(w,k)),typeof b=="string"?b=at(ye(b,k),k):a(b)==="object"&&(b=at(b,k)),w===b}function V(w,b){return w&&w.toString().replace(!b||!b.iri?l.ESCAPE:c.ESCAPE,Be)}function J(w,b){return w&&w.toString().replace(!b||!b.iri?l.PCT_ENCODED:c.PCT_ENCODED,We)}var le={scheme:"http",domainHost:!0,parse:function(b,k){return b.host||(b.error=b.error||"HTTP URIs must have a host."),b},serialize:function(b,k){var P=String(b.scheme).toLowerCase()==="https";return(b.port===(P?443:80)||b.port==="")&&(b.port=void 0),b.path||(b.path="/"),b}},Ee={scheme:"https",domainHost:le.domainHost,parse:le.parse,serialize:le.serialize};function yt(w){return typeof w.secure=="boolean"?w.secure:String(w.scheme).toLowerCase()==="wss"}var wt={scheme:"ws",domainHost:!0,parse:function(b,k){var P=b;return P.secure=yt(P),P.resourceName=(P.path||"/")+(P.query?"?"+P.query:""),P.path=void 0,P.query=void 0,P},serialize:function(b,k){if((b.port===(yt(b)?443:80)||b.port==="")&&(b.port=void 0),typeof b.secure=="boolean"&&(b.scheme=b.secure?"wss":"ws",b.secure=void 0),b.resourceName){var P=b.resourceName.split("?"),N=u(P,2),q=N[0],ce=N[1];b.path=q&&q!=="/"?q:void 0,b.query=ce,b.resourceName=void 0}return b.fragment=void 0,b}},Nt={scheme:"wss",domainHost:wt.domainHost,parse:wt.parse,serialize:wt.serialize},Vr={},Wr=!0,it="[A-Za-z0-9\\-\\.\\_\\~"+(Wr?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",et="[0-9A-Fa-f]",jt=t(t("%[EFef]"+et+"%"+et+et+"%"+et+et)+"|"+t("%[89A-Fa-f]"+et+"%"+et+et)+"|"+t("%"+et+et)),_f="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Sf="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Ef=e(Sf,'[\\"\\\\]'),wf="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Cf=new RegExp(it,"g"),Tn=new RegExp(jt,"g"),kf=new RegExp(e("[^]",_f,"[\\.]",'[\\"]',Ef),"g"),nu=new RegExp(e("[^]",it,wf),"g"),Tf=nu;function _s(w){var b=We(w);return b.match(Cf)?b:w}var au={scheme:"mailto",parse:function(b,k){var P=b,N=P.to=P.path?P.path.split(","):[];if(P.path=void 0,P.query){for(var q=!1,ce={},ve=P.query.split("&"),we=0,Ke=ve.length;we<Ke;++we){var be=ve[we].split("=");switch(be[0]){case"to":for(var Me=be[1].split(","),$e=0,Oe=Me.length;$e<Oe;++$e)N.push(Me[$e]);break;case"subject":P.subject=J(be[1],k);break;case"body":P.body=J(be[1],k);break;default:q=!0,ce[J(be[0],k)]=J(be[1],k);break}}q&&(P.headers=ce)}P.query=void 0;for(var _e=0,Fe=N.length;_e<Fe;++_e){var xe=N[_e].split("@");if(xe[0]=J(xe[0]),k.unicodeSupport)xe[1]=J(xe[1],k).toLowerCase();else try{xe[1]=ne.toASCII(J(xe[1],k).toLowerCase())}catch(jr){P.error=P.error||"Email address's domain name can not be converted to ASCII via punycode: "+jr}N[_e]=xe.join("@")}return P},serialize:function(b,k){var P=b,N=i(b.to);if(N){for(var q=0,ce=N.length;q<ce;++q){var ve=String(N[q]),we=ve.lastIndexOf("@"),Ke=ve.slice(0,we).replace(Tn,_s).replace(Tn,n).replace(kf,Be),be=ve.slice(we+1);try{be=k.iri?ne.toUnicode(be):ne.toASCII(J(be,k).toLowerCase())}catch(_e){P.error=P.error||"Email address's domain name can not be converted to "+(k.iri?"Unicode":"ASCII")+" via punycode: "+_e}N[q]=Ke+"@"+be}P.path=N.join(",")}var Me=b.headers=b.headers||{};b.subject&&(Me.subject=b.subject),b.body&&(Me.body=b.body);var $e=[];for(var Oe in Me)Me[Oe]!==Vr[Oe]&&$e.push(Oe.replace(Tn,_s).replace(Tn,n).replace(nu,Be)+"="+Me[Oe].replace(Tn,_s).replace(Tn,n).replace(Tf,Be));return $e.length&&(P.query=$e.join("&")),P}},xf=/^([^\:]+)\:(.*)/,iu={scheme:"urn",parse:function(b,k){var P=b.path&&b.path.match(xf),N=b;if(P){var q=k.scheme||N.scheme||"urn",ce=P[1].toLowerCase(),ve=P[2],we=q+":"+(k.nid||ce),Ke=Te[we];N.nid=ce,N.nss=ve,N.path=void 0,Ke&&(N=Ke.parse(N,k))}else N.error=N.error||"URN can not be parsed.";return N},serialize:function(b,k){var P=k.scheme||b.scheme||"urn",N=b.nid,q=P+":"+(k.nid||N),ce=Te[q];ce&&(b=ce.serialize(b,k));var ve=b,we=b.nss;return ve.path=(N||k.nid)+":"+we,ve}},Af=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ou={scheme:"urn:uuid",parse:function(b,k){var P=b;return P.uuid=P.nss,P.nss=void 0,!k.tolerant&&(!P.uuid||!P.uuid.match(Af))&&(P.error=P.error||"UUID is not valid."),P},serialize:function(b,k){var P=b;return P.nss=(b.uuid||"").toLowerCase(),P}};Te[le.scheme]=le,Te[Ee.scheme]=Ee,Te[wt.scheme]=wt,Te[Nt.scheme]=Nt,Te[au.scheme]=au,Te[iu.scheme]=iu,Te[ou.scheme]=ou,r.SCHEMES=Te,r.pctEncChar=Be,r.pctDecChars=We,r.parse=ye,r.removeDotSegments=ft,r.serialize=at,r.resolveComponents=Qe,r.resolve=Dt,r.normalize=dt,r.equal=L,r.escapeComponent=V,r.unescapeComponent=J,Object.defineProperty(r,"__esModule",{value:!0})})});var zi=te((AA,Od)=>{"use strict";Od.exports=function r(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var a,n,i;if(Array.isArray(e)){if(a=e.length,a!=t.length)return!1;for(n=a;n--!==0;)if(!r(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(i=Object.keys(e),a=i.length,a!==Object.keys(t).length)return!1;for(n=a;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;for(n=a;n--!==0;){var o=i[n];if(!r(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}});var Md=te((IA,Ld)=>{"use strict";Ld.exports=function(e){for(var t=0,a=e.length,n=0,i;n<a;)t++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<a&&(i=e.charCodeAt(n),(i&64512)==56320&&n++);return t}});var mn=te((RA,Gd)=>{"use strict";Gd.exports={copy:i_,checkDataType:ol,checkDataTypes:o_,coerceToTypes:s_,toHash:ll,getProperty:cl,escapeQuotes:ul,equal:zi(),ucs2length:Md(),varOccurences:u_,varReplace:d_,schemaHasRules:p_,schemaHasRulesExcept:m_,schemaUnknownRules:h_,toQuotedString:sl,getPathExpr:g_,getPath:f_,getData:v_,unescapeFragment:__,unescapeJsonPointer:pl,escapeFragment:S_,escapeJsonPointer:dl};function i_(r,e){e=e||{};for(var t in r)e[t]=r[t];return e}function ol(r,e,t,a){var n=a?" !== ":" === ",i=a?" || ":" && ",o=a?"!":"",s=a?"":"!";switch(r){case"null":return e+n+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+i+"typeof "+e+n+'"object"'+i+s+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+n+'"number"'+i+s+"("+e+" % 1)"+i+e+n+e+(t?i+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+n+'"'+r+'"'+(t?i+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+n+'"'+r+'"'}}function o_(r,e,t){switch(r.length){case 1:return ol(r[0],e,t,!0);default:var a="",n=ll(r);n.array&&n.object&&(a=n.null?"(":"(!"+e+" || ",a+="typeof "+e+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer;for(var i in n)a+=(a?" && ":"")+ol(i,e,t,!0);return a}}var Fd=ll(["string","number","integer","boolean","null"]);function s_(r,e){if(Array.isArray(e)){for(var t=[],a=0;a<e.length;a++){var n=e[a];(Fd[n]||r==="array"&&n==="array")&&(t[t.length]=n)}if(t.length)return t}else{if(Fd[e])return[e];if(r==="array"&&e==="array")return["array"]}}function ll(r){for(var e={},t=0;t<r.length;t++)e[r[t]]=!0;return e}var l_=/^[a-z$_][a-z$_0-9]*$/i,c_=/'|\\/g;function cl(r){return typeof r=="number"?"["+r+"]":l_.test(r)?"."+r:"['"+ul(r)+"']"}function ul(r){return r.replace(c_,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function u_(r,e){e+="[^0-9]";var t=r.match(new RegExp(e,"g"));return t?t.length:0}function d_(r,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),r.replace(new RegExp(e,"g"),t+"$1")}function p_(r,e){if(typeof r=="boolean")return!r;for(var t in r)if(e[t])return!0}function m_(r,e,t){if(typeof r=="boolean")return!r&&t!="not";for(var a in r)if(a!=t&&e[a])return!0}function h_(r,e){if(typeof r!="boolean"){for(var t in r)if(!e[t])return t}}function sl(r){return"'"+ul(r)+"'"}function g_(r,e,t,a){var n=t?"'/' + "+e+(a?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):a?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Bd(r,n)}function f_(r,e,t){var a=sl(t?"/"+dl(e):cl(e));return Bd(r,a)}var y_=/^\/(?:[^~]|~0|~1)*$/,b_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function v_(r,e,t){var a,n,i,o;if(r==="")return"rootData";if(r[0]=="/"){if(!y_.test(r))throw new Error("Invalid JSON-pointer: "+r);n=r,i="rootData"}else{if(o=r.match(b_),!o)throw new Error("Invalid JSON-pointer: "+r);if(a=+o[1],n=o[2],n=="#"){if(a>=e)throw new Error("Cannot access property/index "+a+" levels up, current level is "+e);return t[e-a]}if(a>e)throw new Error("Cannot access data "+a+" levels up, current level is "+e);if(i="data"+(e-a||""),!n)return i}for(var s=i,l=n.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(i+=cl(pl(u)),s+=" && "+i)}return s}function Bd(r,e){return r=='""'?e:(r+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function __(r){return pl(decodeURIComponent(r))}function S_(r){return encodeURIComponent(dl(r))}function dl(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}function pl(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}});var ml=te((PA,zd)=>{"use strict";var E_=mn();zd.exports=w_;function w_(r){E_.copy(r,this)}});var Hd=te((DA,Ud)=>{"use strict";var Nr=Ud.exports=function(r,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var a=typeof t=="function"?t:t.pre||function(){},n=t.post||function(){};Ui(e,a,n,r,"",r)};Nr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Nr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Nr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Nr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Ui(r,e,t,a,n,i,o,s,l,c){if(a&&typeof a=="object"&&!Array.isArray(a)){e(a,n,i,o,s,l,c);for(var u in a){var p=a[u];if(Array.isArray(p)){if(u in Nr.arrayKeywords)for(var m=0;m<p.length;m++)Ui(r,e,t,p[m],n+"/"+u+"/"+m,i,n,u,a,m)}else if(u in Nr.propsKeywords){if(p&&typeof p=="object")for(var d in p)Ui(r,e,t,p[d],n+"/"+u+"/"+C_(d),i,n,u,a,d)}else(u in Nr.keywords||r.allKeys&&!(u in Nr.skipKeywords))&&Ui(r,e,t,p,n+"/"+u,i,n,u,a)}t(a,n,i,o,s,l,c)}}function C_(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ki=te((NA,qd)=>{"use strict";var ka=Nd(),Vd=zi(),ji=mn(),Hi=ml(),k_=Hd();qd.exports=Lr;Lr.normalizeId=Or;Lr.fullPath=Vi;Lr.url=Wi;Lr.ids=R_;Lr.inlineRef=hl;Lr.schema=qi;function Lr(r,e,t){var a=this._refs[t];if(typeof a=="string")if(this._refs[a])a=this._refs[a];else return Lr.call(this,r,e,a);if(a=a||this._schemas[t],a instanceof Hi)return hl(a.schema,this._opts.inlineRefs)?a.schema:a.validate||this._compile(a);var n=qi.call(this,e,t),i,o,s;return n&&(i=n.schema,e=n.root,s=n.baseId),i instanceof Hi?o=i.validate||r.call(this,i.schema,e,void 0,s):i!==void 0&&(o=hl(i,this._opts.inlineRefs)?i:r.call(this,i,e,void 0,s)),o}function qi(r,e){var t=ka.parse(e),a=jd(t),n=Vi(this._getId(r.schema));if(Object.keys(r.schema).length===0||a!==n){var i=Or(a),o=this._refs[i];if(typeof o=="string")return T_.call(this,r,o,t);if(o instanceof Hi)o.validate||this._compile(o),r=o;else if(o=this._schemas[i],o instanceof Hi){if(o.validate||this._compile(o),i==Or(e))return{schema:o,root:r,baseId:n};r=o}else return;if(!r.schema)return;n=Vi(this._getId(r.schema))}return Wd.call(this,t,n,r.schema,r)}function T_(r,e,t){var a=qi.call(this,r,e);if(a){var n=a.schema,i=a.baseId;r=a.root;var o=this._getId(n);return o&&(i=Wi(i,o)),Wd.call(this,t,i,n,r)}}var x_=ji.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Wd(r,e,t,a){if(r.fragment=r.fragment||"",r.fragment.slice(0,1)=="/"){for(var n=r.fragment.split("/"),i=1;i<n.length;i++){var o=n[i];if(o){if(o=ji.unescapeFragment(o),t=t[o],t===void 0)break;var s;if(!x_[o]&&(s=this._getId(t),s&&(e=Wi(e,s)),t.$ref)){var l=Wi(e,t.$ref),c=qi.call(this,a,l);c&&(t=c.schema,a=c.root,e=c.baseId)}}}if(t!==void 0&&t!==a.schema)return{schema:t,root:a,baseId:e}}}var A_=ji.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function hl(r,e){if(e===!1)return!1;if(e===void 0||e===!0)return gl(r);if(e)return fl(r)<=e}function gl(r){var e;if(Array.isArray(r)){for(var t=0;t<r.length;t++)if(e=r[t],typeof e=="object"&&!gl(e))return!1}else for(var a in r)if(a=="$ref"||(e=r[a],typeof e=="object"&&!gl(e)))return!1;return!0}function fl(r){var e=0,t;if(Array.isArray(r)){for(var a=0;a<r.length;a++)if(t=r[a],typeof t=="object"&&(e+=fl(t)),e==1/0)return 1/0}else for(var n in r){if(n=="$ref")return 1/0;if(A_[n])e++;else if(t=r[n],typeof t=="object"&&(e+=fl(t)+1),e==1/0)return 1/0}return e}function Vi(r,e){e!==!1&&(r=Or(r));var t=ka.parse(r);return jd(t)}function jd(r){return ka.serialize(r).split("#")[0]+"#"}var I_=/#\/?$/;function Or(r){return r?r.replace(I_,""):""}function Wi(r,e){return e=Or(e),ka.resolve(r,e)}function R_(r){var e=Or(this._getId(r)),t={"":e},a={"":Vi(e,!1)},n={},i=this;return k_(r,{allKeys:!0},function(o,s,l,c,u,p,m){if(s!==""){var d=i._getId(o),g=t[c],f=a[c]+"/"+u;if(m!==void 0&&(f+="/"+(typeof m=="number"?m:ji.escapeFragment(m))),typeof d=="string"){d=g=Or(g?ka.resolve(g,d):d);var y=i._refs[d];if(typeof y=="string"&&(y=i._refs[y]),y&&y.schema){if(!Vd(o,y.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=Or(f))if(d[0]=="#"){if(n[d]&&!Vd(o,n[d]))throw new Error('id "'+d+'" resolves to more than one schema');n[d]=o}else i._refs[d]=f}t[s]=g,a[s]=f}}),n}});var $i=te((OA,$d)=>{"use strict";var yl=Ki();$d.exports={Validation:Kd(P_),MissingRef:Kd(bl)};function P_(r){this.message="validation failed",this.errors=r,this.ajv=this.validation=!0}bl.message=function(r,e){return"can't resolve reference "+e+" from id "+r};function bl(r,e,t){this.message=t||bl.message(r,e),this.missingRef=yl.url(r,e),this.missingSchema=yl.normalizeId(yl.fullPath(this.missingRef))}function Kd(r){return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}});var vl=te((LA,Xd)=>{"use strict";Xd.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,a=e.cmp&&function(i){return function(o){return function(s,l){var c={key:s,value:o[s]},u={key:l,value:o[l]};return i(c,u)}}}(e.cmp),n=[];return function i(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var s,l;if(Array.isArray(o)){for(l="[",s=0;s<o.length;s++)s&&(l+=","),l+=i(o[s])||"null";return l+"]"}if(o===null)return"null";if(n.indexOf(o)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=n.push(o)-1,u=Object.keys(o).sort(a&&a(o));for(l="",s=0;s<u.length;s++){var p=u[s],m=i(o[p]);m&&(l&&(l+=","),l+=JSON.stringify(p)+":"+m)}return n.splice(c,1),"{"+l+"}"}}(r)}});var _l=te((MA,Yd)=>{"use strict";Yd.exports=function(e,t,a){var n="",i=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),s=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(n+=" var validate = ",i&&(e.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",s&&(e.opts.sourceCode||e.opts.processCode)&&(n+=" "+("/*# sourceURL="+s+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var t="false schema",u=e.level,p=e.dataLevel,m=e.schema[t],d=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,D=!e.opts.allErrors,F,f="data"+(p||""),I="valid"+u;if(e.schema===!1){e.isTop?D=!0:n+=" var "+I+" = false; ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?i?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+I+" = true; ";return e.isTop&&(n+=" }; return validate; "),n}if(e.isTop){var T=e.isTop,u=e.level=0,p=e.dataLevel=0,f="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var E="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,p=e.dataLevel,f="data"+(p||"");if(s&&(e.baseId=e.resolve.url(e.baseId,s)),i&&!e.async)throw new Error("async schema in sync schema");n+=" var errs_"+u+" = errors;"}var I="valid"+u,D=!e.opts.allErrors,C="",M="",F,R=e.schema.type,G=Array.isArray(R);if(R&&e.opts.nullable&&e.schema.nullable===!0&&(G?R.indexOf("null")==-1&&(R=R.concat("null")):R!="null"&&(R=[R,"null"],G=!0)),G&&R.length==1&&(R=R[0],G=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(n+=" "+e.RULES.all.$comment.code(e,"$comment")),R){if(e.opts.coerceTypes)var z=e.util.coerceToTypes(e.opts.coerceTypes,R);var O=e.RULES.types[R];if(z||G||O===!0||O&&!qe(O)){var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",d=e.schemaPath+".type",g=e.errSchemaPath+"/type",x=G?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[x](R,f,e.opts.strictNumbers,!0)+") { ",z){var A="dataType"+u,B="coerced"+u;n+=" var "+A+" = typeof "+f+"; var "+B+" = undefined; ",e.opts.coerceTypes=="array"&&(n+=" if ("+A+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+A+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+B+" = "+f+"; } "),n+=" if ("+B+" !== undefined) ; ";var X=z;if(X)for(var K,Q=-1,Z=X.length-1;Q<Z;)K=X[Q+=1],K=="string"?n+=" else if ("+A+" == 'number' || "+A+" == 'boolean') "+B+" = '' + "+f+"; else if ("+f+" === null) "+B+" = ''; ":K=="number"||K=="integer"?(n+=" else if ("+A+" == 'boolean' || "+f+" === null || ("+A+" == 'string' && "+f+" && "+f+" == +"+f+" ",K=="integer"&&(n+=" && !("+f+" % 1)"),n+=")) "+B+" = +"+f+"; "):K=="boolean"?n+=" else if ("+f+" === 'false' || "+f+" === 0 || "+f+" === null) "+B+" = false; else if ("+f+" === 'true' || "+f+" === 1) "+B+" = true; ":K=="null"?n+=" else if ("+f+" === '' || "+f+" === 0 || "+f+" === false) "+B+" = null; ":e.opts.coerceTypes=="array"&&K=="array"&&(n+=" else if ("+A+" == 'string' || "+A+" == 'number' || "+A+" == 'boolean' || "+f+" == null) "+B+" = ["+f+"]; ");n+=" else { ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+R.join(","):n+=""+R,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+R.join(","):n+=""+R,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } if ("+B+" !== undefined) { ";var _=p?"data"+(p-1||""):"parentData",fe=p?e.dataPathArr[p]:"parentDataProperty";n+=" "+f+" = "+B+"; ",p||(n+="if ("+_+" !== undefined)"),n+=" "+_+"["+fe+"] = "+B+"; } "}else{var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+R.join(","):n+=""+R,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+R.join(","):n+=""+R,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}n+=" } "}}if(e.schema.$ref&&!o)n+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",D&&(n+=" } if (errors === ",T?n+="0":n+="errs_"+u,n+=") { ",M+="}");else{var Ie=e.RULES;if(Ie){for(var O,S=-1,ne=Ie.length-1;S<ne;)if(O=Ie[S+=1],qe(O)){if(O.type&&(n+=" if ("+e.util.checkDataType(O.type,f,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(O.type=="object"&&e.schema.properties){var m=e.schema.properties,Te=Object.keys(m),Be=Te;if(Be)for(var We,Re=-1,ut=Be.length-1;Re<ut;){We=Be[Re+=1];var Se=m[We];if(Se.default!==void 0){var Ce=f+e.util.getProperty(We);if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else n+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ce+" === null || "+Ce+" === '' "),n+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Se.default)+" ":n+=" "+JSON.stringify(Se.default)+" ",n+="; "}}}else if(O.type=="array"&&Array.isArray(e.schema.items)){var gt=e.schema.items;if(gt){for(var Se,Q=-1,je=gt.length-1;Q<je;)if(Se=gt[Q+=1],Se.default!==void 0){var Ce=f+"["+Q+"]";if(e.compositeRule){if(e.opts.strictDefaults){var E="default is ignored for: "+Ce;if(e.opts.strictDefaults==="log")e.logger.warn(E);else throw new Error(E)}}else n+=" if ("+Ce+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ce+" === null || "+Ce+" === '' "),n+=" ) "+Ce+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Se.default)+" ":n+=" "+JSON.stringify(Se.default)+" ",n+="; "}}}}var ye=O.rules;if(ye){for(var Wt,Pt=-1,cr=ye.length-1;Pt<cr;)if(Wt=ye[Pt+=1],ft(Wt)){var Qt=Wt.code(e,Wt.keyword,O.type);Qt&&(n+=" "+Qt+" ",D&&(C+="}"))}}if(D&&(n+=" "+C+" ",C=""),O.type&&(n+=" } ",R&&R===O.type&&!z)){n+=" else { ";var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(F||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+R.join(","):n+=""+R,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+R.join(","):n+=""+R,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&D?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } "}D&&(n+=" if (errors === ",T?n+="0":n+="errs_"+u,n+=") { ",M+="}")}}}D&&(n+=" "+M+" "),T?(i?(n+=" if (errors === 0) return data; ",n+=" else throw new ValidationError(vErrors); "):(n+=" validate.errors = vErrors; ",n+=" return errors === 0; "),n+=" }; return validate;"):n+=" var "+I+" = errors === errs_"+u+";";function qe(Qe){for(var Dt=Qe.rules,dt=0;dt<Dt.length;dt++)if(ft(Dt[dt]))return!0}function ft(Qe){return e.schema[Qe.keyword]!==void 0||Qe.implements&&at(Qe)}function at(Qe){for(var Dt=Qe.implements,dt=0;dt<Dt.length;dt++)if(e.schema[Dt[dt]]!==void 0)return!0}return n}});var tp=te((FA,ep)=>{"use strict";var Xi=Ki(),Zi=mn(),Jd=$i(),D_=vl(),Zd=_l(),N_=Zi.ucs2length,O_=zi(),L_=Jd.Validation;ep.exports=Sl;function Sl(r,e,t,a){var n=this,i=this._opts,o=[void 0],s={},l=[],c={},u=[],p={},m=[];e=e||{schema:r,refVal:o,refs:s};var d=M_.call(this,r,e,a),g=this._compilations[d.index];if(d.compiling)return g.callValidate=E;var f=this._formats,y=this.RULES;try{var v=I(r,e,t,a);g.validate=v;var T=g.callValidate;return T&&(T.schema=v.schema,T.errors=null,T.refs=v.refs,T.refVal=v.refVal,T.root=v.root,T.$async=v.$async,i.sourceCode&&(T.source=v.source)),v}finally{F_.call(this,r,e,a)}function E(){var x=g.validate,A=x.apply(this,arguments);return E.errors=x.errors,A}function I(x,A,B,X){var K=!A||A&&A.schema==x;if(A.schema!=e.schema)return Sl.call(n,x,A,B,X);var Q=x.$async===!0,Z=Zd({isTop:!0,schema:x,isRoot:K,baseId:X,root:A,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Jd.MissingRef,RULES:y,validate:Zd,util:Zi,resolve:Xi,resolveRef:D,usePattern:G,useDefault:z,useCustomRule:O,opts:i,formats:f,logger:n.logger,self:n});Z=Yi(o,z_)+Yi(l,B_)+Yi(u,G_)+Yi(m,U_)+Z,i.processCode&&(Z=i.processCode(Z,x));var _;try{var fe=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Z);_=fe(n,y,f,e,o,u,m,O_,N_,L_),o[0]=_}catch(Ie){throw n.logger.error("Error compiling schema, function code:",Z),Ie}return _.schema=x,_.errors=null,_.refs=s,_.refVal=o,_.root=K?_:A,Q&&(_.$async=!0),i.sourceCode===!0&&(_.source={code:Z,patterns:l,defaults:u}),_}function D(x,A,B){A=Xi.url(x,A);var X=s[A],K,Q;if(X!==void 0)return K=o[X],Q="refVal["+X+"]",R(K,Q);if(!B&&e.refs){var Z=e.refs[A];if(Z!==void 0)return K=e.refVal[Z],Q=C(A,K),R(K,Q)}Q=C(A);var _=Xi.call(n,I,e,A);if(_===void 0){var fe=t&&t[A];fe&&(_=Xi.inlineRef(fe,i.inlineRefs)?fe:Sl.call(n,fe,e,t,x))}if(_===void 0)M(A);else return F(A,_),R(_,Q)}function C(x,A){var B=o.length;return o[B]=A,s[x]=B,"refVal"+B}function M(x){delete s[x]}function F(x,A){var B=s[x];o[B]=A}function R(x,A){return typeof x=="object"||typeof x=="boolean"?{code:A,schema:x,inline:!0}:{code:A,$async:x&&!!x.$async}}function G(x){var A=c[x];return A===void 0&&(A=c[x]=l.length,l[A]=x),"pattern"+A}function z(x){switch(typeof x){case"boolean":case"number":return""+x;case"string":return Zi.toQuotedString(x);case"object":if(x===null)return"null";var A=D_(x),B=p[A];return B===void 0&&(B=p[A]=u.length,u[B]=x),"default"+B}}function O(x,A,B,X){if(n._opts.validateSchema!==!1){var K=x.definition.dependencies;if(K&&!K.every(function(Be){return Object.prototype.hasOwnProperty.call(B,Be)}))throw new Error("parent schema must have all required keywords: "+K.join(","));var Q=x.definition.validateSchema;if(Q){var Z=Q(A);if(!Z){var _="keyword schema is invalid: "+n.errorsText(Q.errors);if(n._opts.validateSchema=="log")n.logger.error(_);else throw new Error(_)}}}var fe=x.definition.compile,Ie=x.definition.inline,S=x.definition.macro,ne;if(fe)ne=fe.call(n,A,B,X);else if(S)ne=S.call(n,A,B,X),i.validateSchema!==!1&&n.validateSchema(ne,!0);else if(Ie)ne=Ie.call(n,X,x.keyword,A,B);else if(ne=x.definition.validate,!ne)return;if(ne===void 0)throw new Error('custom keyword "'+x.keyword+'"failed to compile');var Te=m.length;return m[Te]=ne,{code:"customRule"+Te,validate:ne}}}function M_(r,e,t){var a=Qd.call(this,r,e,t);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:r,root:e,baseId:t},{index:a,compiling:!1})}function F_(r,e,t){var a=Qd.call(this,r,e,t);a>=0&&this._compilations.splice(a,1)}function Qd(r,e,t){for(var a=0;a<this._compilations.length;a++){var n=this._compilations[a];if(n.schema==r&&n.root==e&&n.baseId==t)return a}return-1}function B_(r,e){return"var pattern"+r+" = new RegExp("+Zi.toQuotedString(e[r])+");"}function G_(r){return"var default"+r+" = defaults["+r+"];"}function z_(r,e){return e[r]===void 0?"":"var refVal"+r+" = refVal["+r+"];"}function U_(r){return"var customRule"+r+" = customRules["+r+"];"}function Yi(r,e){if(!r.length)return"";for(var t="",a=0;a<r.length;a++)t+=e(a,r);return t}});var np=te((BA,rp)=>{"use strict";var Ji=rp.exports=function(){this._cache={}};Ji.prototype.put=function(e,t){this._cache[e]=t};Ji.prototype.get=function(e){return this._cache[e]};Ji.prototype.del=function(e){delete this._cache[e]};Ji.prototype.clear=function(){this._cache={}}});var gp=te((GA,hp)=>{"use strict";var H_=mn(),V_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,W_=[0,31,28,31,30,31,30,31,31,30,31,30,31],j_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,ap=/^(?=.{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,q_=/^(?:[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,K_=/^(?:[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,ip=/^(?:(?:[^\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,op=/^(?:(?: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,sp=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,lp=/^(?:\/(?:[^~/]|~0|~1)*)*$/,cp=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,up=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;hp.exports=Qi;function Qi(r){return r=r=="full"?"full":"fast",H_.copy(Qi[r])}Qi.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":ip,url:op,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:ap,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:mp,uuid:sp,"json-pointer":lp,"json-pointer-uri-fragment":cp,"relative-json-pointer":up};Qi.full={date:dp,time:pp,"date-time":Y_,uri:J_,"uri-reference":K_,"uri-template":ip,url:op,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:ap,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:mp,uuid:sp,"json-pointer":lp,"json-pointer-uri-fragment":cp,"relative-json-pointer":up};function $_(r){return r%4===0&&(r%100!==0||r%400===0)}function dp(r){var e=r.match(V_);if(!e)return!1;var t=+e[1],a=+e[2],n=+e[3];return a>=1&&a<=12&&n>=1&&n<=(a==2&&$_(t)?29:W_[a])}function pp(r,e){var t=r.match(j_);if(!t)return!1;var a=t[1],n=t[2],i=t[3],o=t[5];return(a<=23&&n<=59&&i<=59||a==23&&n==59&&i==60)&&(!e||o)}var X_=/t|\s/i;function Y_(r){var e=r.split(X_);return e.length==2&&dp(e[0])&&pp(e[1],!0)}var Z_=/\/|:/;function J_(r){return Z_.test(r)&&q_.test(r)}var Q_=/[^\\]\\Z/;function mp(r){if(Q_.test(r))return!1;try{return new RegExp(r),!0}catch{return!1}}});var yp=te((zA,fp)=>{"use strict";fp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(o||""),p="valid"+i,m,d;if(s=="#"||s=="#/")e.isRoot?(m=e.async,d="validate"):(m=e.root.schema.$async===!0,d="root.refVal[0]");else{var g=e.resolveRef(e.baseId,s,e.isRoot);if(g===void 0){var f=e.MissingRefError.message(e.baseId,s);if(e.opts.missingRefs=="fail"){e.logger.error(f);var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(s)+"' } ",e.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(s)+"' "),e.opts.verbose&&(n+=" , schema: "+e.util.toQuotedString(s)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),n+=" } "):n+=" {} ";var v=n;n=y.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(n+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(f),c&&(n+=" if (true) { ");else throw new e.MissingRefError(e.baseId,s,f)}else if(g.inline){var T=e.util.copy(e);T.level++;var E="valid"+T.level;T.schema=g.schema,T.schemaPath="",T.errSchemaPath=s;var I=e.validate(T).replace(/validate\.schema/g,g.code);n+=" "+I+" ",c&&(n+=" if ("+E+") { ")}else m=g.$async===!0||e.async&&g.$async!==!1,d=g.code}if(d){var y=y||[];y.push(n),n="",e.opts.passContext?n+=" "+d+".call(this, ":n+=" "+d+"( ",n+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var D=o?"data"+(o-1||""):"parentData",C=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+D+" , "+C+", rootData) ";var M=n;if(n=y.pop(),m){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(n+=" var "+p+"; "),n+=" try { await "+M+"; ",c&&(n+=" "+p+" = 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; ",c&&(n+=" "+p+" = false; "),n+=" } ",c&&(n+=" if ("+p+") { ")}else n+=" if (!"+M+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(n+=" else { ")}return n}});var vp=te((UA,bp)=>{"use strict";bp.exports=function(e,t,a){var n=" ",i=e.schema[t],o=e.schemaPath+e.util.getProperty(t),s=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var p="valid"+c.level,m=c.baseId,d=!0,g=i;if(g)for(var f,y=-1,v=g.length-1;y<v;)f=g[y+=1],(e.opts.strictKeywords?typeof f=="object"&&Object.keys(f).length>0||f===!1:e.util.schemaHasRules(f,e.RULES.all))&&(d=!1,c.schema=f,c.schemaPath=o+"["+y+"]",c.errSchemaPath=s+"/"+y,n+=" "+e.validate(c)+" ",c.baseId=m,l&&(n+=" if ("+p+") { ",u+="}"));return l&&(d?n+=" if (true) { ":n+=" "+u.slice(0,-1)+" "),n}});var Sp=te((HA,_p)=>{"use strict";_p.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v=s.every(function(F){return e.opts.strictKeywords?typeof F=="object"&&Object.keys(F).length>0||F===!1:e.util.schemaHasRules(F,e.RULES.all)});if(v){var T=g.baseId;n+=" var "+d+" = errors; var "+m+" = false; ";var E=e.compositeRule;e.compositeRule=g.compositeRule=!0;var I=s;if(I)for(var D,C=-1,M=I.length-1;C<M;)D=I[C+=1],g.schema=D,g.schemaPath=l+"["+C+"]",g.errSchemaPath=c+"/"+C,n+=" "+e.validate(g)+" ",g.baseId=T,n+=" "+m+" = "+m+" || "+y+"; if (!"+m+") { ",f+="}";e.compositeRule=g.compositeRule=E,n+=" "+f+" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else u&&(n+=" if (true) { ");return n}});var wp=te((VA,Ep)=>{"use strict";Ep.exports=function(e,t,a){var n=" ",i=e.schema[t],o=e.errSchemaPath+"/"+t,s=!e.opts.allErrors,l=e.util.toQuotedString(i);return e.opts.$comment===!0?n+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(n+=" self._opts.$comment("+l+", "+e.util.toQuotedString(o)+", validate.root.schema);"),n}});var kp=te((WA,Cp)=>{"use strict";Cp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s,d||(n+=" var schema"+i+" = validate.schema"+l+";"),n+="var "+m+" = equal("+p+", schema"+i+"); if (!"+m+") { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var xp=te((jA,Tp)=>{"use strict";Tp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v="i"+i,T=g.dataLevel=e.dataLevel+1,E="data"+T,I=e.baseId,D=e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all);if(n+="var "+d+" = errors;var "+m+";",D){var C=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=s,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+y+" = false; for (var "+v+" = 0; "+v+" < "+p+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var M=p+"["+v+"]";g.dataPathArr[T]=v;var F=e.validate(g);g.baseId=I,e.util.varOccurences(F,E)<2?n+=" "+e.util.varReplace(F,E,M)+" ":n+=" var "+E+" = "+M+"; "+F+" ",n+=" if ("+y+") break; } ",e.compositeRule=g.compositeRule=C,n+=" "+f+" if (!"+y+") {"}else n+=" if ("+p+".length == 0) {";var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var G=n;return n=R.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+G+"]); ":n+=" validate.errors = ["+G+"]; return false; ":n+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",D&&(n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),n}});var Ip=te((qA,Ap)=>{"use strict";Ap.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y={},v={},T=e.opts.ownProperties;for(C in s)if(C!="__proto__"){var E=s[C],I=Array.isArray(E)?v:y;I[C]=E}n+="var "+m+" = errors;";var D=e.errorPath;n+="var missing"+i+";";for(var C in v)if(I=v[C],I.length){if(n+=" if ( "+p+e.util.getProperty(C)+" !== undefined ",T&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(C)+"') "),u){n+=" && ( ";var M=I;if(M)for(var F,R=-1,G=M.length-1;R<G;){F=M[R+=1],R&&(n+=" || ");var z=e.util.getProperty(F),O=p+z;n+=" ( ( "+O+" === undefined ",T&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:z)+") ) "}n+=")) { ";var x="missing"+i,A="' + "+x+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(D,x,!0):D+" + "+x);var B=B||[];B.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+A+"', depsCount: "+I.length+", deps: '"+e.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",I.length==1?n+="property "+e.util.escapeQuotes(I[0]):n+="properties "+e.util.escapeQuotes(I.join(", ")),n+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var X=n;n=B.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+X+"]); ":n+=" validate.errors = ["+X+"]; return false; ":n+=" var err = "+X+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var K=I;if(K)for(var F,Q=-1,Z=K.length-1;Q<Z;){F=K[Q+=1];var z=e.util.getProperty(F),A=e.util.escapeQuotes(F),O=p+z;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(D,F,e.opts.jsonPointers)),n+=" if ( "+O+" === undefined ",T&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(C)+"', missingProperty: '"+A+"', depsCount: "+I.length+", deps: '"+e.util.escapeQuotes(I.length==1?I[0]:I.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",I.length==1?n+="property "+e.util.escapeQuotes(I[0]):n+="properties "+e.util.escapeQuotes(I.join(", ")),n+=" when property "+e.util.escapeQuotes(C)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}n+=" } ",u&&(g+="}",n+=" else { ")}e.errorPath=D;var _=d.baseId;for(var C in y){var E=y[C];(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all))&&(n+=" "+f+" = true; if ( "+p+e.util.getProperty(C)+" !== undefined ",T&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(C)+"') "),n+=") { ",d.schema=E,d.schemaPath=l+e.util.getProperty(C),d.errSchemaPath=c+"/"+e.util.escapeFragment(C),n+=" "+e.validate(d)+" ",d.baseId=_,n+=" } ",u&&(n+=" if ("+f+") { ",g+="}"))}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Pp=te((KA,Rp)=>{"use strict";Rp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s;var f="i"+i,y="schema"+i;d||(n+=" var "+y+" = validate.schema"+l+";"),n+="var "+m+";",d&&(n+=" if (schema"+i+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+i+")) "+m+" = false; else {"),n+=""+m+" = false;for (var "+f+"=0; "+f+"<"+y+".length; "+f+"++) if (equal("+p+", "+y+"["+f+"])) { "+m+" = true; break; }",d&&(n+=" } "),n+=" if (!"+m+") { ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;return n=v.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var Np=te(($A,Dp)=>{"use strict";Dp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||"");if(e.opts.format===!1)return u&&(n+=" if (true) { "),n;var m=e.opts.$data&&s&&s.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s;var g=e.opts.unknownFormats,f=Array.isArray(g);if(m){var y="format"+i,v="isObject"+i,T="formatType"+i;n+=" var "+y+" = formats["+d+"]; var "+v+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+T+" = "+v+" && "+y+".type || 'string'; if ("+v+") { ",e.async&&(n+=" var async"+i+" = "+y+".async; "),n+=" "+y+" = "+y+".validate; } if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" (",g!="ignore"&&(n+=" ("+d+" && !"+y+" ",f&&(n+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),n+=") || "),n+=" ("+y+" && "+T+" == '"+a+"' && !(typeof "+y+" == 'function' ? ",e.async?n+=" (async"+i+" ? await "+y+"("+p+") : "+y+"("+p+")) ":n+=" "+y+"("+p+") ",n+=" : "+y+".test("+p+"))))) {"}else{var y=e.formats[s];if(!y){if(g=="ignore")return e.logger.warn('unknown format "'+s+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(n+=" if (true) { "),n;if(f&&g.indexOf(s)>=0)return u&&(n+=" if (true) { "),n;throw new Error('unknown format "'+s+'" is used in schema at path "'+e.errSchemaPath+'"')}var v=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,T=v&&y.type||"string";if(v){var E=y.async===!0;y=y.validate}if(T!=a)return u&&(n+=" if (true) { "),n;if(E){if(!e.async)throw new Error("async format in sync schema");var I="formats"+e.util.getProperty(s)+".validate";n+=" if (!(await "+I+"("+p+"))) { "}else{n+=" if (! ";var I="formats"+e.util.getProperty(s);v&&(I+=".validate"),typeof y=="function"?n+=" "+I+"("+p+") ":n+=" "+I+".test("+p+") ",n+=") { "}}var D=D||[];D.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",m?n+=""+d:n+=""+e.util.toQuotedString(s),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match format "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(s),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(s),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var C=n;return n=D.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var Lp=te((XA,Op)=>{"use strict";Op.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e);g.level++;var f="valid"+g.level,y=e.schema.then,v=e.schema.else,T=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),E=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),I=g.baseId;if(T||E){var D;g.createErrors=!1,g.schema=s,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+d+" = errors; var "+m+" = true; ";var C=e.compositeRule;e.compositeRule=g.compositeRule=!0,n+=" "+e.validate(g)+" ",g.baseId=I,g.createErrors=!0,n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=C,T?(n+=" if ("+f+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",n+=" "+e.validate(g)+" ",g.baseId=I,n+=" "+m+" = "+f+"; ",T&&E?(D="ifClause"+i,n+=" var "+D+" = 'then'; "):D="'then'",n+=" } ",E&&(n+=" else { ")):n+=" if (!"+f+") { ",E&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",n+=" "+e.validate(g)+" ",g.baseId=I,n+=" "+m+" = "+f+"; ",T&&E?(D="ifClause"+i,n+=" var "+D+" = 'else'; "):D="'else'",n+=" } "),n+=" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+D+" } ",e.opts.messages!==!1&&(n+=` , message: 'should match "' + `+D+` + '" schema' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var Fp=te((YA,Mp)=>{"use strict";Mp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v="i"+i,T=g.dataLevel=e.dataLevel+1,E="data"+T,I=e.baseId;if(n+="var "+d+" = errors;var "+m+";",Array.isArray(s)){var D=e.schema.additionalItems;if(D===!1){n+=" "+m+" = "+p+".length <= "+s.length+"; ";var C=c;c=e.errSchemaPath+"/additionalItems",n+=" if (!"+m+") { ";var M=M||[];M.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+s.length+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+s.length+" items' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var F=n;n=M.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++; ",n+=" } ",c=C,u&&(f+="}",n+=" else { ")}var R=s;if(R){for(var G,z=-1,O=R.length-1;z<O;)if(G=R[z+=1],e.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:e.util.schemaHasRules(G,e.RULES.all)){n+=" "+y+" = true; if ("+p+".length > "+z+") { ";var x=p+"["+z+"]";g.schema=G,g.schemaPath=l+"["+z+"]",g.errSchemaPath=c+"/"+z,g.errorPath=e.util.getPathExpr(e.errorPath,z,e.opts.jsonPointers,!0),g.dataPathArr[T]=z;var A=e.validate(g);g.baseId=I,e.util.varOccurences(A,E)<2?n+=" "+e.util.varReplace(A,E,x)+" ":n+=" var "+E+" = "+x+"; "+A+" ",n+=" } ",u&&(n+=" if ("+y+") { ",f+="}")}}if(typeof D=="object"&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))){g.schema=D,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+p+".length > "+s.length+") { for (var "+v+" = "+s.length+"; "+v+" < "+p+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var x=p+"["+v+"]";g.dataPathArr[T]=v;var A=e.validate(g);g.baseId=I,e.util.varOccurences(A,E)<2?n+=" "+e.util.varReplace(A,E,x)+" ":n+=" var "+E+" = "+x+"; "+A+" ",u&&(n+=" if (!"+y+") break; "),n+=" } } ",u&&(n+=" if ("+y+") { ",f+="}")}}else if(e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all)){g.schema=s,g.schemaPath=l,g.errSchemaPath=c,n+=" for (var "+v+" = 0; "+v+" < "+p+".length; "+v+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0);var x=p+"["+v+"]";g.dataPathArr[T]=v;var A=e.validate(g);g.baseId=I,e.util.varOccurences(A,E)<2?n+=" "+e.util.varReplace(A,E,x)+" ":n+=" var "+E+" = "+x+"; "+A+" ",u&&(n+=" if (!"+y+") break; "),n+=" }"}return u&&(n+=" "+f+" if ("+d+" == errors) {"),n}});var El=te((ZA,Bp)=>{"use strict";Bp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,I,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s;var g=t=="maximum",f=g?"exclusiveMaximum":"exclusiveMinimum",y=e.schema[f],v=e.opts.$data&&y&&y.$data,T=g?"<":">",E=g?">":"<",I=void 0;if(!(m||typeof s=="number"||s===void 0))throw new Error(t+" must be number");if(!(v||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(f+" must be number or boolean");if(v){var D=e.util.getData(y.$data,o,e.dataPathArr),C="exclusive"+i,M="exclType"+i,F="exclIsNumber"+i,R="op"+i,G="' + "+R+" + '";n+=" var schemaExcl"+i+" = "+D+"; ",D="schemaExcl"+i,n+=" var "+C+"; var "+M+" = typeof "+D+"; if ("+M+" != 'boolean' && "+M+" != 'undefined' && "+M+" != 'number') { ";var I=f,z=z||[];z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(I||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var O=n;n=z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+O+"]); ":n+=" validate.errors = ["+O+"]; return false; ":n+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+M+" == 'number' ? ( ("+C+" = "+d+" === undefined || "+D+" "+T+"= "+d+") ? "+p+" "+E+"= "+D+" : "+p+" "+E+" "+d+" ) : ( ("+C+" = "+D+" === true) ? "+p+" "+E+"= "+d+" : "+p+" "+E+" "+d+" ) || "+p+" !== "+p+") { var op"+i+" = "+C+" ? '"+T+"' : '"+T+"='; ",s===void 0&&(I=f,c=e.errSchemaPath+"/"+f,d=D,m=v)}else{var F=typeof y=="number",G=T;if(F&&m){var R="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" ( "+d+" === undefined || "+y+" "+T+"= "+d+" ? "+p+" "+E+"= "+y+" : "+p+" "+E+" "+d+" ) || "+p+" !== "+p+") { "}else{F&&s===void 0?(C=!0,I=f,c=e.errSchemaPath+"/"+f,d=y,E+="="):(F&&(d=Math[g?"min":"max"](y,s)),y===(F?d:!0)?(C=!0,I=f,c=e.errSchemaPath+"/"+f,E+="="):(C=!1,G+="="));var R="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+" "+E+" "+d+" || "+p+" !== "+p+") { "}}I=I||t;var z=z||[];z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(I||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+R+", limit: "+d+", exclusive: "+C+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+G+" ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var O=n;return n=z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+O+"]); ":n+=" validate.errors = ["+O+"]; return false; ":n+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var wl=te((JA,Gp)=>{"use strict";Gp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");var g=t=="maxItems"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+".length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxItems"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+s,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var v=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Cl=te((QA,zp)=>{"use strict";zp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");var g=t=="maxLength"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?n+=" "+p+".length ":n+=" ucs2length("+p+") ",n+=" "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",t=="maxLength"?n+="longer":n+="shorter",n+=" than ",m?n+="' + "+d+" + '":n+=""+s,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var v=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var kl=te((eI,Up)=>{"use strict";Up.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");var g=t=="maxProperties"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" Object.keys("+p+").length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxProperties"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+s,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var v=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+v+"]); ":n+=" validate.errors = ["+v+"]; return false; ":n+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Vp=te((tI,Hp)=>{"use strict";Hp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s,!(m||typeof s=="number"))throw new Error(t+" must be number");n+="var division"+i+";if (",m&&(n+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),n+=" (division"+i+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":n+=" division"+i+" !== parseInt(division"+i+") ",n+=" ) ",m&&(n+=" ) "),n+=" ) { ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var f=n;return n=g.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++; ",n+="} ",u&&(n+=" else { "),n}});var jp=te((rI,Wp)=>{"use strict";Wp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e);d.level++;var g="valid"+d.level;if(e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all)){d.schema=s,d.schemaPath=l,d.errSchemaPath=c,n+=" var "+m+" = errors; ";var f=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var y;d.opts.allErrors&&(y=d.opts.allErrors,d.opts.allErrors=!1),n+=" "+e.validate(d)+" ",d.createErrors=!0,y&&(d.opts.allErrors=y),e.compositeRule=d.compositeRule=f,n+=" if ("+g+") { ";var v=v||[];v.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;n=v.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ");return n}});var Kp=te((nI,qp)=>{"use strict";qp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,v=g.baseId,T="prevValid"+i,E="passingSchemas"+i;n+="var "+d+" = errors , "+T+" = false , "+m+" = false , "+E+" = null; ";var I=e.compositeRule;e.compositeRule=g.compositeRule=!0;var D=s;if(D)for(var C,M=-1,F=D.length-1;M<F;)C=D[M+=1],(e.opts.strictKeywords?typeof C=="object"&&Object.keys(C).length>0||C===!1:e.util.schemaHasRules(C,e.RULES.all))?(g.schema=C,g.schemaPath=l+"["+M+"]",g.errSchemaPath=c+"/"+M,n+=" "+e.validate(g)+" ",g.baseId=v):n+=" var "+y+" = true; ",M&&(n+=" if ("+y+" && "+T+") { "+m+" = false; "+E+" = ["+E+", "+M+"]; } else { ",f+="}"),n+=" if ("+y+") { "+m+" = "+T+" = true; "+E+" = "+M+"; }";return e.compositeRule=g.compositeRule=I,n+=""+f+"if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+E+" } ",e.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n}});var Xp=te((aI,$p)=>{"use strict";$p.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m=e.opts.$data&&s&&s.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",d="schema"+i):d=s;var g=m?"(new RegExp("+d+"))":e.usePattern(s);n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" !"+g+".test("+p+") ) { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",m?n+=""+d:n+=""+e.util.toQuotedString(s),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(s),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(s),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Zp=te((iI,Yp)=>{"use strict";Yp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y="key"+i,v="idx"+i,T=d.dataLevel=e.dataLevel+1,E="data"+T,I="dataProperties"+i,D=Object.keys(s||{}).filter(Q),C=e.schema.patternProperties||{},M=Object.keys(C).filter(Q),F=e.schema.additionalProperties,R=D.length||M.length,G=F===!1,z=typeof F=="object"&&Object.keys(F).length,O=e.opts.removeAdditional,x=G||z||O,A=e.opts.ownProperties,B=e.baseId,X=e.schema.required;if(X&&!(e.opts.$data&&X.$data)&&X.length<e.opts.loopRequired)var K=e.util.toHash(X);function Q(J){return J!=="__proto__"}if(n+="var "+m+" = errors;var "+f+" = true;",A&&(n+=" var "+I+" = undefined;"),x){if(A?n+=" "+I+" = "+I+" || Object.keys("+p+"); for (var "+v+"=0; "+v+"<"+I+".length; "+v+"++) { var "+y+" = "+I+"["+v+"]; ":n+=" for (var "+y+" in "+p+") { ",R){if(n+=" var isAdditional"+i+" = !(false ",D.length)if(D.length>8)n+=" || validate.schema"+l+".hasOwnProperty("+y+") ";else{var Z=D;if(Z)for(var _,fe=-1,Ie=Z.length-1;fe<Ie;)_=Z[fe+=1],n+=" || "+y+" == "+e.util.toQuotedString(_)+" "}if(M.length){var S=M;if(S)for(var ne,Te=-1,Be=S.length-1;Te<Be;)ne=S[Te+=1],n+=" || "+e.usePattern(ne)+".test("+y+") "}n+=" ); if (isAdditional"+i+") { "}if(O=="all")n+=" delete "+p+"["+y+"]; ";else{var We=e.errorPath,Re="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),G)if(O)n+=" delete "+p+"["+y+"]; ";else{n+=" "+f+" = false; ";var ut=c;c=e.errSchemaPath+"/additionalProperties";var Se=Se||[];Se.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Re+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is an invalid additional property":n+="should NOT have additional properties",n+="' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ce=n;n=Se.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ce+"]); ":n+=" validate.errors = ["+Ce+"]; return false; ":n+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=ut,u&&(n+=" break; ")}else if(z)if(O=="failing"){n+=" var "+m+" = errors; ";var gt=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=F,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var je=p+"["+y+"]";d.dataPathArr[T]=y;var ye=e.validate(d);d.baseId=B,e.util.varOccurences(ye,E)<2?n+=" "+e.util.varReplace(ye,E,je)+" ":n+=" var "+E+" = "+je+"; "+ye+" ",n+=" if (!"+f+") { errors = "+m+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+y+"]; } ",e.compositeRule=d.compositeRule=gt}else{d.schema=F,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var je=p+"["+y+"]";d.dataPathArr[T]=y;var ye=e.validate(d);d.baseId=B,e.util.varOccurences(ye,E)<2?n+=" "+e.util.varReplace(ye,E,je)+" ":n+=" var "+E+" = "+je+"; "+ye+" ",u&&(n+=" if (!"+f+") break; ")}e.errorPath=We}R&&(n+=" } "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}var Wt=e.opts.useDefaults&&!e.compositeRule;if(D.length){var Pt=D;if(Pt)for(var _,cr=-1,Qt=Pt.length-1;cr<Qt;){_=Pt[cr+=1];var qe=s[_];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){var ft=e.util.getProperty(_),je=p+ft,at=Wt&&qe.default!==void 0;d.schema=qe,d.schemaPath=l+ft,d.errSchemaPath=c+"/"+e.util.escapeFragment(_),d.errorPath=e.util.getPath(e.errorPath,_,e.opts.jsonPointers),d.dataPathArr[T]=e.util.toQuotedString(_);var ye=e.validate(d);if(d.baseId=B,e.util.varOccurences(ye,E)<2){ye=e.util.varReplace(ye,E,je);var Qe=je}else{var Qe=E;n+=" var "+E+" = "+je+"; "}if(at)n+=" "+ye+" ";else{if(K&&K[_]){n+=" if ( "+Qe+" === undefined ",A&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = false; ";var We=e.errorPath,ut=c,Dt=e.util.escapeQuotes(_);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(We,_,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var Se=Se||[];Se.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Dt+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+Dt+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ce=n;n=Se.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ce+"]); ":n+=" validate.errors = ["+Ce+"]; return false; ":n+=" var err = "+Ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=ut,e.errorPath=We,n+=" } else { "}else u?(n+=" if ( "+Qe+" === undefined ",A&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = true; } else { "):(n+=" if ("+Qe+" !== undefined ",A&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=" ) { ");n+=" "+ye+" } "}}u&&(n+=" if ("+f+") { ",g+="}")}}if(M.length){var dt=M;if(dt)for(var ne,L=-1,V=dt.length-1;L<V;){ne=dt[L+=1];var qe=C[ne];if(e.opts.strictKeywords?typeof qe=="object"&&Object.keys(qe).length>0||qe===!1:e.util.schemaHasRules(qe,e.RULES.all)){d.schema=qe,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ne),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ne),A?n+=" "+I+" = "+I+" || Object.keys("+p+"); for (var "+v+"=0; "+v+"<"+I+".length; "+v+"++) { var "+y+" = "+I+"["+v+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" if ("+e.usePattern(ne)+".test("+y+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var je=p+"["+y+"]";d.dataPathArr[T]=y;var ye=e.validate(d);d.baseId=B,e.util.varOccurences(ye,E)<2?n+=" "+e.util.varReplace(ye,E,je)+" ":n+=" var "+E+" = "+je+"; "+ye+" ",u&&(n+=" if (!"+f+") break; "),n+=" } ",u&&(n+=" else "+f+" = true; "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}}}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Qp=te((oI,Jp)=>{"use strict";Jp.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level;if(n+="var "+m+" = errors;",e.opts.strictKeywords?typeof s=="object"&&Object.keys(s).length>0||s===!1:e.util.schemaHasRules(s,e.RULES.all)){d.schema=s,d.schemaPath=l,d.errSchemaPath=c;var y="key"+i,v="idx"+i,T="i"+i,E="' + "+y+" + '",I=d.dataLevel=e.dataLevel+1,D="data"+I,C="dataProperties"+i,M=e.opts.ownProperties,F=e.baseId;M&&(n+=" var "+C+" = undefined; "),M?n+=" "+C+" = "+C+" || Object.keys("+p+"); for (var "+v+"=0; "+v+"<"+C+".length; "+v+"++) { var "+y+" = "+C+"["+v+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" var startErrs"+i+" = errors; ";var R=y,G=e.compositeRule;e.compositeRule=d.compositeRule=!0;var z=e.validate(d);d.baseId=F,e.util.varOccurences(z,D)<2?n+=" "+e.util.varReplace(z,D,R)+" ":n+=" var "+D+" = "+R+"; "+z+" ",e.compositeRule=d.compositeRule=G,n+=" if (!"+f+") { for (var "+T+"=startErrs"+i+"; "+T+"<errors; "+T+"++) { vErrors["+T+"].propertyName = "+y+"; } var err = ",e.createErrors!==!1?(n+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+E+"' } ",e.opts.messages!==!1&&(n+=" , message: 'property name \\'"+E+"\\' is invalid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),u&&(n+=" break; "),n+=" } }"}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var tm=te((sI,em)=>{"use strict";em.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s;var f="schema"+i;if(!d)if(s.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var y=[],v=s;if(v)for(var T,E=-1,I=v.length-1;E<I;){T=v[E+=1];var D=e.schema.properties[T];D&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))||(y[y.length]=T)}}else var y=s;if(d||y.length){var C=e.errorPath,M=d||y.length>=e.opts.loopRequired,F=e.opts.ownProperties;if(u)if(n+=" var missing"+i+"; ",M){d||(n+=" var "+f+" = validate.schema"+l+"; ");var R="i"+i,G="schema"+i+"["+R+"]",z="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,G,e.opts.jsonPointers)),n+=" var "+m+" = true; ",d&&(n+=" if (schema"+i+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+i+")) "+m+" = false; else {"),n+=" for (var "+R+" = 0; "+R+" < "+f+".length; "+R+"++) { "+m+" = "+p+"["+f+"["+R+"]] !== undefined ",F&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", "+f+"["+R+"]) "),n+="; if (!"+m+") break; } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var O=O||[];O.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;n=O.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var A=y;if(A)for(var B,R=-1,X=A.length-1;R<X;){B=A[R+=1],R&&(n+=" || ");var K=e.util.getProperty(B),Q=p+K;n+=" ( ( "+Q+" === undefined ",F&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?B:K)+") ) "}n+=") { ";var G="missing"+i,z="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(C,G,!0):C+" + "+G);var O=O||[];O.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;n=O.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(M){d||(n+=" var "+f+" = validate.schema"+l+"; ");var R="i"+i,G="schema"+i+"["+R+"]",z="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(C,G,e.opts.jsonPointers)),d&&(n+=" if ("+f+" && !Array.isArray("+f+")) { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+f+" !== undefined) { "),n+=" for (var "+R+" = 0; "+R+" < "+f+".length; "+R+"++) { if ("+p+"["+f+"["+R+"]] === undefined ",F&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+f+"["+R+"]) "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(n+=" } ")}else{var Z=y;if(Z)for(var B,_=-1,fe=Z.length-1;_<fe;){B=Z[_+=1];var K=e.util.getProperty(B),z=e.util.escapeQuotes(B),Q=p+K;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(C,B,e.opts.jsonPointers)),n+=" if ( "+Q+" === undefined ",F&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+z+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+z+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=C}else u&&(n+=" if (true) {");return n}});var nm=te((lI,rm)=>{"use strict";rm.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(o||""),m="valid"+i,d=e.opts.$data&&s&&s.$data,g;if(d?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",g="schema"+i):g=s,(s||d)&&e.opts.uniqueItems!==!1){d&&(n+=" var "+m+"; if ("+g+" === false || "+g+" === undefined) "+m+" = true; else if (typeof "+g+" != 'boolean') "+m+" = false; else { "),n+=" var i = "+p+".length , "+m+" = true , j; if (i > 1) { ";var f=e.schema.items&&e.schema.items.type,y=Array.isArray(f);if(!f||f=="object"||f=="array"||y&&(f.indexOf("object")>=0||f.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+m+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var v="checkDataType"+(y?"s":"");n+=" if ("+e.util[v](f,"item",e.opts.strictNumbers,!0)+") continue; ",y&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+m+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var T=T||[];T.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(n+=" , schema: ",d?n+="validate.schema"+l:n+=""+s,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var E=n;n=T.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+E+"]); ":n+=" validate.errors = ["+E+"]; return false; ":n+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var im=te((cI,am)=>{"use strict";am.exports={$ref:yp(),allOf:vp(),anyOf:Sp(),$comment:wp(),const:kp(),contains:xp(),dependencies:Ip(),enum:Pp(),format:Np(),if:Lp(),items:Fp(),maximum:El(),minimum:El(),maxItems:wl(),minItems:wl(),maxLength:Cl(),minLength:Cl(),maxProperties:kl(),minProperties:kl(),multipleOf:Vp(),not:jp(),oneOf:Kp(),pattern:Xp(),properties:Zp(),propertyNames:Qp(),required:tm(),uniqueItems:nm(),validate:_l()}});var lm=te((uI,sm)=>{"use strict";var om=im(),Tl=mn().toHash;sm.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"],a=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],n=["number","integer","string","array","object","boolean","null"];return e.all=Tl(t),e.types=Tl(n),e.forEach(function(i){i.rules=i.rules.map(function(o){var s;if(typeof o=="object"){var l=Object.keys(o)[0];s=o[l],o=l,s.forEach(function(u){t.push(u),e.all[u]=!0})}t.push(o);var c=e.all[o]={keyword:o,code:om[o],implements:s};return c}),e.all.$comment={keyword:"$comment",code:om.$comment},i.type&&(e.types[i.type]=i)}),e.keywords=Tl(t.concat(a)),e.custom={},e}});var dm=te((dI,um)=>{"use strict";var cm=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];um.exports=function(r,e){for(var t=0;t<e.length;t++){r=JSON.parse(JSON.stringify(r));var a=e[t].split("/"),n=r,i;for(i=1;i<a.length;i++)n=n[a[i]];for(i=0;i<cm.length;i++){var o=cm[i],s=n[o];s&&(n[o]={anyOf:[s,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return r}});var hm=te((pI,mm)=>{"use strict";var eS=$i().MissingRef;mm.exports=pm;function pm(r,e,t){var a=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var n=i(r).then(function(){var s=a._addSchema(r,void 0,e);return s.validate||o(s)});return t&&n.then(function(s){t(null,s)},t),n;function i(s){var l=s.$schema;return l&&!a.getSchema(l)?pm.call(a,{$ref:l},!0):Promise.resolve()}function o(s){try{return a._compile(s)}catch(c){if(c instanceof eS)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var p=a._loadingSchemas[u];return p||(p=a._loadingSchemas[u]=a._opts.loadSchema(u),p.then(m,m)),p.then(function(g){if(!d(u))return i(g).then(function(){d(u)||a.addSchema(g,u,void 0,e)})}).then(function(){return o(s)});function m(){delete a._loadingSchemas[u]}function d(g){return a._refs[g]||a._schemas[g]}}}}});var fm=te((mI,gm)=>{"use strict";gm.exports=function(e,t,a){var n=" ",i=e.level,o=e.dataLevel,s=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p,m="data"+(o||""),d="valid"+i,g="errs__"+i,f=e.opts.$data&&s&&s.$data,y;f?(n+=" var schema"+i+" = "+e.util.getData(s.$data,o,e.dataPathArr)+"; ",y="schema"+i):y=s;var v=this,T="definition"+i,E=v.definition,I="",D,C,M,F,R;if(f&&E.$data){R="keywordValidate"+i;var G=E.validateSchema;n+=" var "+T+" = RULES.custom['"+t+"'].definition; var "+R+" = "+T+".validate;"}else{if(F=e.useCustomRule(v,s,e.schema,e),!F)return;y="validate.schema"+l,R=F.code,D=E.compile,C=E.inline,M=E.macro}var z=R+".errors",O="i"+i,x="ruleErr"+i,A=E.async;if(A&&!e.async)throw new Error("async keyword in sync schema");if(C||M||(n+=""+z+" = null;"),n+="var "+g+" = errors;var "+d+";",f&&E.$data&&(I+="}",n+=" if ("+y+" === undefined) { "+d+" = true; } else { ",G&&(I+="}",n+=" "+d+" = "+T+".validateSchema("+y+"); if ("+d+") { ")),C)E.statements?n+=" "+F.validate+" ":n+=" "+d+" = "+F.validate+"; ";else if(M){var B=e.util.copy(e),I="";B.level++;var X="valid"+B.level;B.schema=F.validate,B.schemaPath="";var K=e.compositeRule;e.compositeRule=B.compositeRule=!0;var Q=e.validate(B).replace(/validate\.schema/g,R);e.compositeRule=B.compositeRule=K,n+=" "+Q}else{var Z=Z||[];Z.push(n),n="",n+=" "+R+".call( ",e.opts.passContext?n+="this":n+="self",D||E.schema===!1?n+=" , "+m+" ":n+=" , "+y+" , "+m+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var _=o?"data"+(o-1||""):"parentData",fe=o?e.dataPathArr[o]:"parentDataProperty";n+=" , "+_+" , "+fe+" , rootData ) ";var Ie=n;n=Z.pop(),E.errors===!1?(n+=" "+d+" = ",A&&(n+="await "),n+=""+Ie+"; "):A?(z="customErrors"+i,n+=" var "+z+" = null; try { "+d+" = await "+Ie+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+z+" = e.errors; else throw e; } "):n+=" "+z+" = null; "+d+" = "+Ie+"; "}if(E.modifying&&(n+=" if ("+_+") "+m+" = "+_+"["+fe+"];"),n+=""+I,E.valid)u&&(n+=" if (true) { ");else{n+=" if ( ",E.valid===void 0?(n+=" !",M?n+=""+X:n+=""+d):n+=" "+!E.valid+" ",n+=") { ",p=v.keyword;var Z=Z||[];Z.push(n),n="";var Z=Z||[];Z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var S=n;n=Z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+S+"]); ":n+=" validate.errors = ["+S+"]; return false; ":n+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var ne=n;n=Z.pop(),C?E.errors?E.errors!="full"&&(n+=" for (var "+O+"="+g+"; "+O+"<errors; "+O+"++) { var "+x+" = vErrors["+O+"]; if ("+x+".dataPath === undefined) "+x+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+x+".schemaPath === undefined) { "+x+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+x+".schema = "+y+"; "+x+".data = "+m+"; "),n+=" } "):E.errors===!1?n+=" "+ne+" ":(n+=" if ("+g+" == errors) { "+ne+" } else { for (var "+O+"="+g+"; "+O+"<errors; "+O+"++) { var "+x+" = vErrors["+O+"]; if ("+x+".dataPath === undefined) "+x+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+x+".schemaPath === undefined) { "+x+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+x+".schema = "+y+"; "+x+".data = "+m+"; "),n+=" } } "):M?(n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+v.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+v.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; ")):E.errors===!1?n+=" "+ne+" ":(n+=" if (Array.isArray("+z+")) { if (vErrors === null) vErrors = "+z+"; else vErrors = vErrors.concat("+z+"); errors = vErrors.length; for (var "+O+"="+g+"; "+O+"<errors; "+O+"++) { var "+x+" = vErrors["+O+"]; if ("+x+".dataPath === undefined) "+x+".dataPath = (dataPath || '') + "+e.errorPath+"; "+x+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(n+=" "+x+".schema = "+y+"; "+x+".data = "+m+"; "),n+=" } } else { "+ne+" } "),n+=" } ",u&&(n+=" else { ")}return n}});var xl=te((hI,tS)=>{tS.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var vm=te((gI,bm)=>{"use strict";var ym=xl();bm.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:ym.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:ym.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var Sm=te((fI,_m)=>{"use strict";var rS=/^[a-z_$][a-z0-9_$-]*$/i,nS=fm(),aS=vm();_m.exports={add:iS,get:oS,remove:sS,validate:Al};function iS(r,e){var t=this.RULES;if(t.keywords[r])throw new Error("Keyword "+r+" is already defined");if(!rS.test(r))throw new Error("Keyword "+r+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var a=e.type;if(Array.isArray(a))for(var n=0;n<a.length;n++)o(r,a[n],e);else o(r,a,e);var i=e.metaSchema;i&&(e.$data&&this._opts.$data&&(i={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(i,!0))}t.keywords[r]=t.all[r]=!0;function o(s,l,c){for(var u,p=0;p<t.length;p++){var m=t[p];if(m.type==l){u=m;break}}u||(u={type:l,rules:[]},t.push(u));var d={keyword:s,definition:c,custom:!0,code:nS,implements:c.implements};u.rules.push(d),t.custom[s]=d}return this}function oS(r){var e=this.RULES.custom[r];return e?e.definition:this.RULES.keywords[r]||!1}function sS(r){var e=this.RULES;delete e.keywords[r],delete e.all[r],delete e.custom[r];for(var t=0;t<e.length;t++)for(var a=e[t].rules,n=0;n<a.length;n++)if(a[n].keyword==r){a.splice(n,1);break}return this}function Al(r,e){Al.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(aS,!0);if(t(r))return!0;if(Al.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var Em=te((yI,lS)=>{lS.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Dm=te((bI,Pm)=>{"use strict";var Cm=tp(),hn=Ki(),cS=np(),km=ml(),uS=vl(),dS=gp(),pS=lm(),Tm=dm(),xm=mn();Pm.exports=Ge;Ge.prototype.validate=hS;Ge.prototype.compile=gS;Ge.prototype.addSchema=fS;Ge.prototype.addMetaSchema=yS;Ge.prototype.validateSchema=bS;Ge.prototype.getSchema=_S;Ge.prototype.removeSchema=ES;Ge.prototype.addFormat=RS;Ge.prototype.errorsText=IS;Ge.prototype._addSchema=wS;Ge.prototype._compile=CS;Ge.prototype.compileAsync=hm();var ro=Sm();Ge.prototype.addKeyword=ro.add;Ge.prototype.getKeyword=ro.get;Ge.prototype.removeKeyword=ro.remove;Ge.prototype.validateKeyword=ro.validate;var Am=$i();Ge.ValidationError=Am.Validation;Ge.MissingRefError=Am.MissingRef;Ge.$dataMetaSchema=Tm;var to="http://json-schema.org/draft-07/schema",wm=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],mS=["/properties"];function Ge(r){if(!(this instanceof Ge))return new Ge(r);r=this._opts=xm.copy(r)||{},MS(this),this._schemas={},this._refs={},this._fragments={},this._formats=dS(r.format),this._cache=r.cache||new cS,this._loadingSchemas={},this._compilations=[],this.RULES=pS(),this._getId=kS(r),r.loopRequired=r.loopRequired||1/0,r.errorDataPath=="property"&&(r._errorDataPathProperty=!0),r.serialize===void 0&&(r.serialize=uS),this._metaOpts=LS(this),r.formats&&NS(this),r.keywords&&OS(this),PS(this),typeof r.meta=="object"&&this.addMetaSchema(r.meta),r.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),DS(this)}function hS(r,e){var t;if(typeof r=="string"){if(t=this.getSchema(r),!t)throw new Error('no schema with key or ref "'+r+'"')}else{var a=this._addSchema(r);t=a.validate||this._compile(a)}var n=t(e);return t.$async!==!0&&(this.errors=t.errors),n}function gS(r,e){var t=this._addSchema(r,void 0,e);return t.validate||this._compile(t)}function fS(r,e,t,a){if(Array.isArray(r)){for(var n=0;n<r.length;n++)this.addSchema(r[n],void 0,t,a);return this}var i=this._getId(r);if(i!==void 0&&typeof i!="string")throw new Error("schema id must be string");return e=hn.normalizeId(e||i),Rm(this,e),this._schemas[e]=this._addSchema(r,t,a,!0),this}function yS(r,e,t){return this.addSchema(r,e,t,!0),this}function bS(r,e){var t=r.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||vS(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var a=this.validate(t,r);if(!a&&e){var n="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(n);else throw new Error(n)}return a}function vS(r){var e=r._opts.meta;return r._opts.defaultMeta=typeof e=="object"?r._getId(e)||e:r.getSchema(to)?to:void 0,r._opts.defaultMeta}function _S(r){var e=Im(this,r);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return SS(this,r)}}function SS(r,e){var t=hn.schema.call(r,{schema:{}},e);if(t){var a=t.schema,n=t.root,i=t.baseId,o=Cm.call(r,a,n,void 0,i);return r._fragments[e]=new km({ref:e,fragment:!0,schema:a,root:n,baseId:i,validate:o}),o}}function Im(r,e){return e=hn.normalizeId(e),r._schemas[e]||r._refs[e]||r._fragments[e]}function ES(r){if(r instanceof RegExp)return eo(this,this._schemas,r),eo(this,this._refs,r),this;switch(typeof r){case"undefined":return eo(this,this._schemas),eo(this,this._refs),this._cache.clear(),this;case"string":var e=Im(this,r);return e&&this._cache.del(e.cacheKey),delete this._schemas[r],delete this._refs[r],this;case"object":var t=this._opts.serialize,a=t?t(r):r;this._cache.del(a);var n=this._getId(r);n&&(n=hn.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this}function eo(r,e,t){for(var a in e){var n=e[a];!n.meta&&(!t||t.test(a))&&(r._cache.del(n.cacheKey),delete e[a])}}function wS(r,e,t,a){if(typeof r!="object"&&typeof r!="boolean")throw new Error("schema should be object or boolean");var n=this._opts.serialize,i=n?n(r):r,o=this._cache.get(i);if(o)return o;a=a||this._opts.addUsedSchema!==!1;var s=hn.normalizeId(this._getId(r));s&&a&&Rm(this,s);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=s&&s==hn.normalizeId(r.$schema))&&this.validateSchema(r,!0);var u=hn.ids.call(this,r),p=new km({id:s,schema:r,localRefs:u,cacheKey:i,meta:t});return s[0]!="#"&&a&&(this._refs[s]=p),this._cache.put(i,p),l&&c&&this.validateSchema(r,!0),p}function CS(r,e){if(r.compiling)return r.validate=n,n.schema=r.schema,n.errors=null,n.root=e||n,r.schema.$async===!0&&(n.$async=!0),n;r.compiling=!0;var t;r.meta&&(t=this._opts,this._opts=this._metaOpts);var a;try{a=Cm.call(this,r.schema,e,r.localRefs)}catch(i){throw delete r.validate,i}finally{r.compiling=!1,r.meta&&(this._opts=t)}return r.validate=a,r.refs=a.refs,r.refVal=a.refVal,r.root=a.root,a;function n(){var i=r.validate,o=i.apply(this,arguments);return n.errors=i.errors,o}}function kS(r){switch(r.schemaId){case"auto":return AS;case"id":return TS;default:return xS}}function TS(r){return r.$id&&this.logger.warn("schema $id ignored",r.$id),r.id}function xS(r){return r.id&&this.logger.warn("schema id ignored",r.id),r.$id}function AS(r){if(r.$id&&r.id&&r.$id!=r.id)throw new Error("schema $id is different from id");return r.$id||r.id}function IS(r,e){if(r=r||this.errors,!r)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,a=e.dataVar===void 0?"data":e.dataVar,n="",i=0;i<r.length;i++){var o=r[i];o&&(n+=a+o.dataPath+" "+o.message+t)}return n.slice(0,-t.length)}function RS(r,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[r]=e,this}function PS(r){var e;if(r._opts.$data&&(e=Em(),r.addMetaSchema(e,e.$id,!0)),r._opts.meta!==!1){var t=xl();r._opts.$data&&(t=Tm(t,mS)),r.addMetaSchema(t,to,!0),r._refs["http://json-schema.org/schema"]=to}}function DS(r){var e=r._opts.schemas;if(e)if(Array.isArray(e))r.addSchema(e);else for(var t in e)r.addSchema(e[t],t)}function NS(r){for(var e in r._opts.formats){var t=r._opts.formats[e];r.addFormat(e,t)}}function OS(r){for(var e in r._opts.keywords){var t=r._opts.keywords[e];r.addKeyword(e,t)}}function Rm(r,e){if(r._schemas[e]||r._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function LS(r){for(var e=xm.copy(r._opts),t=0;t<wm.length;t++)delete e[wm[t]];return e}function MS(r){var e=r._opts.logger;if(e===!1)r.logger={log:Il,warn:Il,error:Il};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");r.logger=e}}function Il(){}});var Kg=te((i2,qg)=>{"use strict";var ts=Object.prototype.hasOwnProperty,jg=Object.prototype.toString,Gg=Object.defineProperty,zg=Object.getOwnPropertyDescriptor,Ug=function(e){return typeof Array.isArray=="function"?Array.isArray(e):jg.call(e)==="[object Array]"},Hg=function(e){if(!e||jg.call(e)!=="[object Object]")return!1;var t=ts.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&ts.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!a)return!1;var n;for(n in e);return typeof n>"u"||ts.call(e,n)},Vg=function(e,t){Gg&&t.name==="__proto__"?Gg(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Wg=function(e,t){if(t==="__proto__")if(ts.call(e,t)){if(zg)return zg(e,t).value}else return;return e[t]};qg.exports=function r(){var e,t,a,n,i,o,s=arguments[0],l=1,c=arguments.length,u=!1;for(typeof s=="boolean"&&(u=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(e=arguments[l],e!=null)for(t in e)a=Wg(s,t),n=Wg(e,t),s!==n&&(u&&n&&(Hg(n)||(i=Ug(n)))?(i?(i=!1,o=a&&Ug(a)?a:[]):o=a&&Hg(a)?a:{},Vg(s,{name:t,newValue:r(u,o,n)})):typeof n<"u"&&Vg(s,{name:t,newValue:n}));return s}});var yf=te(he=>{"use strict";var ai=Symbol.for("react.element"),Dk=Symbol.for("react.portal"),Nk=Symbol.for("react.fragment"),Ok=Symbol.for("react.strict_mode"),Lk=Symbol.for("react.profiler"),Mk=Symbol.for("react.provider"),Fk=Symbol.for("react.context"),Bk=Symbol.for("react.forward_ref"),Gk=Symbol.for("react.suspense"),zk=Symbol.for("react.memo"),Uk=Symbol.for("react.lazy"),of=Symbol.iterator;function Hk(r){return r===null||typeof r!="object"?null:(r=of&&r[of]||r["@@iterator"],typeof r=="function"?r:null)}var cf={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uf=Object.assign,df={};function ma(r,e,t){this.props=r,this.context=e,this.refs=df,this.updater=t||cf}ma.prototype.isReactComponent={};ma.prototype.setState=function(r,e){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,r,e,"setState")};ma.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function pf(){}pf.prototype=ma.prototype;function Qc(r,e,t){this.props=r,this.context=e,this.refs=df,this.updater=t||cf}var eu=Qc.prototype=new pf;eu.constructor=Qc;uf(eu,ma.prototype);eu.isPureReactComponent=!0;var sf=Array.isArray,mf=Object.prototype.hasOwnProperty,tu={current:null},hf={key:!0,ref:!0,__self:!0,__source:!0};function gf(r,e,t){var a,n={},i=null,o=null;if(e!=null)for(a in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)mf.call(e,a)&&!hf.hasOwnProperty(a)&&(n[a]=e[a]);var s=arguments.length-2;if(s===1)n.children=t;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];n.children=l}if(r&&r.defaultProps)for(a in s=r.defaultProps,s)n[a]===void 0&&(n[a]=s[a]);return{$$typeof:ai,type:r,key:i,ref:o,props:n,_owner:tu.current}}function Vk(r,e){return{$$typeof:ai,type:r.type,key:e,ref:r.ref,props:r.props,_owner:r._owner}}function ru(r){return typeof r=="object"&&r!==null&&r.$$typeof===ai}function Wk(r){var e={"=":"=0",":":"=2"};return"$"+r.replace(/[=:]/g,function(t){return e[t]})}var lf=/\/+/g;function Jc(r,e){return typeof r=="object"&&r!==null&&r.key!=null?Wk(""+r.key):e.toString(36)}function bs(r,e,t,a,n){var i=typeof r;(i==="undefined"||i==="boolean")&&(r=null);var o=!1;if(r===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(r.$$typeof){case ai:case Dk:o=!0}}if(o)return o=r,n=n(o),r=a===""?"."+Jc(o,0):a,sf(n)?(t="",r!=null&&(t=r.replace(lf,"$&/")+"/"),bs(n,e,t,"",function(c){return c})):n!=null&&(ru(n)&&(n=Vk(n,t+(!n.key||o&&o.key===n.key?"":(""+n.key).replace(lf,"$&/")+"/")+r)),e.push(n)),1;if(o=0,a=a===""?".":a+":",sf(r))for(var s=0;s<r.length;s++){i=r[s];var l=a+Jc(i,s);o+=bs(i,e,t,l,n)}else if(l=Hk(r),typeof l=="function")for(r=l.call(r),s=0;!(i=r.next()).done;)i=i.value,l=a+Jc(i,s++),o+=bs(i,e,t,l,n);else if(i==="object")throw e=String(r),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function ys(r,e,t){if(r==null)return r;var a=[],n=0;return bs(r,a,"","",function(i){return e.call(t,i,n++)}),a}function jk(r){if(r._status===-1){var e=r._result;e=e(),e.then(function(t){(r._status===0||r._status===-1)&&(r._status=1,r._result=t)},function(t){(r._status===0||r._status===-1)&&(r._status=2,r._result=t)}),r._status===-1&&(r._status=0,r._result=e)}if(r._status===1)return r._result.default;throw r._result}var ht={current:null},vs={transition:null},qk={ReactCurrentDispatcher:ht,ReactCurrentBatchConfig:vs,ReactCurrentOwner:tu};function ff(){throw Error("act(...) is not supported in production builds of React.")}he.Children={map:ys,forEach:function(r,e,t){ys(r,function(){e.apply(this,arguments)},t)},count:function(r){var e=0;return ys(r,function(){e++}),e},toArray:function(r){return ys(r,function(e){return e})||[]},only:function(r){if(!ru(r))throw Error("React.Children.only expected to receive a single React element child.");return r}};he.Component=ma;he.Fragment=Nk;he.Profiler=Lk;he.PureComponent=Qc;he.StrictMode=Ok;he.Suspense=Gk;he.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qk;he.act=ff;he.cloneElement=function(r,e,t){if(r==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+r+".");var a=uf({},r.props),n=r.key,i=r.ref,o=r._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=tu.current),e.key!==void 0&&(n=""+e.key),r.type&&r.type.defaultProps)var s=r.type.defaultProps;for(l in e)mf.call(e,l)&&!hf.hasOwnProperty(l)&&(a[l]=e[l]===void 0&&s!==void 0?s[l]:e[l])}var l=arguments.length-2;if(l===1)a.children=t;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];a.children=s}return{$$typeof:ai,type:r.type,key:n,ref:i,props:a,_owner:o}};he.createContext=function(r){return r={$$typeof:Fk,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},r.Provider={$$typeof:Mk,_context:r},r.Consumer=r};he.createElement=gf;he.createFactory=function(r){var e=gf.bind(null,r);return e.type=r,e};he.createRef=function(){return{current:null}};he.forwardRef=function(r){return{$$typeof:Bk,render:r}};he.isValidElement=ru;he.lazy=function(r){return{$$typeof:Uk,_payload:{_status:-1,_result:r},_init:jk}};he.memo=function(r,e){return{$$typeof:zk,type:r,compare:e===void 0?null:e}};he.startTransition=function(r){var e=vs.transition;vs.transition={};try{r()}finally{vs.transition=e}};he.unstable_act=ff;he.useCallback=function(r,e){return ht.current.useCallback(r,e)};he.useContext=function(r){return ht.current.useContext(r)};he.useDebugValue=function(){};he.useDeferredValue=function(r){return ht.current.useDeferredValue(r)};he.useEffect=function(r,e){return ht.current.useEffect(r,e)};he.useId=function(){return ht.current.useId()};he.useImperativeHandle=function(r,e,t){return ht.current.useImperativeHandle(r,e,t)};he.useInsertionEffect=function(r,e){return ht.current.useInsertionEffect(r,e)};he.useLayoutEffect=function(r,e){return ht.current.useLayoutEffect(r,e)};he.useMemo=function(r,e){return ht.current.useMemo(r,e)};he.useReducer=function(r,e,t){return ht.current.useReducer(r,e,t)};he.useRef=function(r){return ht.current.useRef(r)};he.useState=function(r){return ht.current.useState(r)};he.useSyncExternalStore=function(r,e,t){return ht.current.useSyncExternalStore(r,e,t)};he.useTransition=function(){return ht.current.useTransition()};he.version="18.3.1"});var vf=te((LF,bf)=>{"use strict";bf.exports=yf()});var tt=[];for(ci=0;ci<256;++ci)tt.push((ci+256).toString(16).slice(1));var ci;function du(r,e=0){return(tt[r[e+0]]+tt[r[e+1]]+tt[r[e+2]]+tt[r[e+3]]+"-"+tt[r[e+4]]+tt[r[e+5]]+"-"+tt[r[e+6]]+tt[r[e+7]]+"-"+tt[r[e+8]]+tt[r[e+9]]+"-"+tt[r[e+10]]+tt[r[e+11]]+tt[r[e+12]]+tt[r[e+13]]+tt[r[e+14]]+tt[r[e+15]]).toLowerCase()}var ui,Mf=new Uint8Array(16);function ks(){if(!ui&&(ui=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ui))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ui(Mf)}var Ff=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ts={randomUUID:Ff};function Bf(r,e,t){if(Ts.randomUUID&&!e&&!r)return Ts.randomUUID();r=r||{};var a=r.random||(r.rng||ks)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){t=t||0;for(var n=0;n<16;++n)e[t+n]=a[n];return e}return du(a)}var Tt=Bf;function xs(r){let e=(r||"").split(`
|
|
1
|
+
import{b as ae,c as mc,d as hc,e as Oe}from"./chunk-AIYMQX7V.js";var Ih=ae((Ro,Ah)=>{"use strict";(function(r,e){typeof Ro=="object"&&typeof Ah<"u"?e(Ro):typeof define=="function"&&define.amd?define(["exports"],e):e(r.URI=r.URI||{})})(Ro,function(r){"use strict";function e(){for(var w=arguments.length,v=Array(w),C=0;C<w;C++)v[C]=arguments[C];if(v.length>1){v[0]=v[0].slice(0,-1);for(var D=v.length-1,N=1;N<D;++N)v[N]=v[N].slice(1,-1);return v[D]=v[D].slice(1),v.join("")}else return v[0]}function t(w){return"(?:"+w+")"}function a(w){return w===void 0?"undefined":w===null?"null":Object.prototype.toString.call(w).split(" ").pop().split("]").shift().toLowerCase()}function n(w){return w.toUpperCase()}function i(w){return w!=null?w instanceof Array?w:typeof w.length!="number"||w.split||w.setInterval||w.call?[w]:Array.prototype.slice.call(w):[]}function s(w,v){var C=w;if(v)for(var D in v)C[D]=v[D];return C}function o(w){var v="[A-Za-z]",C="[\\x0D]",D="[0-9]",N="[\\x22]",$=e(D,"[A-Fa-f]"),pe="[\\x0A]",Ee="[\\x20]",Te=t(t("%[EFef]"+$+"%"+$+$+"%"+$+$)+"|"+t("%[89A-Fa-f]"+$+"%"+$+$)+"|"+t("%"+$+$)),Ze="[\\:\\/\\?\\#\\[\\]\\@]",Se="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",ze=e(Ze,Se),Qe=w?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Fe=w?"[\\uE000-\\uF8FF]":"[]",we=e(v,D,"[\\-\\.\\_\\~]",Qe),Ue=t(v+e(v,D,"[\\+\\-\\.]")+"*"),Pe=t(t(Te+"|"+e(we,Se,"[\\:]"))+"*"),_n=t(t("25[0-5]")+"|"+t("2[0-4]"+D)+"|"+t("1"+D+D)+"|"+t("[1-9]"+D)+"|"+D),Mt=t(t("25[0-5]")+"|"+t("2[0-4]"+D)+"|"+t("1"+D+D)+"|"+t("0?[1-9]"+D)+"|0?0?"+D),Wt=t(Mt+"\\."+Mt+"\\."+Mt+"\\."+Mt),De=t($+"{1,4}"),Ot=t(t(De+"\\:"+De)+"|"+Wt),qt=t(t(De+"\\:")+"{6}"+Ot),gr=t("\\:\\:"+t(De+"\\:")+"{5}"+Ot),Sn=t(t(De)+"?\\:\\:"+t(De+"\\:")+"{4}"+Ot),Ar=t(t(t(De+"\\:")+"{0,1}"+De)+"?\\:\\:"+t(De+"\\:")+"{3}"+Ot),di=t(t(t(De+"\\:")+"{0,2}"+De)+"?\\:\\:"+t(De+"\\:")+"{2}"+Ot),Es=t(t(t(De+"\\:")+"{0,3}"+De)+"?\\:\\:"+De+"\\:"+Ot),ws=t(t(t(De+"\\:")+"{0,4}"+De)+"?\\:\\:"+Ot),sa=t(t(t(De+"\\:")+"{0,5}"+De)+"?\\:\\:"+De),oa=t(t(t(De+"\\:")+"{0,6}"+De)+"?\\:\\:"),Ir=t([qt,gr,Sn,Ar,di,Es,ws,sa,oa].join("|")),la=t(t(we+"|"+Te)+"+"),dc=t(Ir+"\\%25"+la),En=t(Ir+t("\\%25|\\%(?!"+$+"{2})")+la),Cv=t("[vV]"+$+"+\\."+e(we,Se,"[\\:]")+"+"),xv=t("\\["+t(En+"|"+Ir+"|"+Cv)+"\\]"),Ep=t(t(Te+"|"+e(we,Se))+"*"),pi=t(xv+"|"+Wt+"(?!"+Ep+")|"+Ep),mi=t(D+"*"),wp=t(t(Pe+"@")+"?"+pi+t("\\:"+mi)+"?"),hi=t(Te+"|"+e(we,Se,"[\\:\\@]")),Tv=t(hi+"*"),kp=t(hi+"+"),Av=t(t(Te+"|"+e(we,Se,"[\\@]"))+"+"),Rr=t(t("\\/"+Tv)+"*"),ca=t("\\/"+t(kp+Rr)+"?"),pc=t(Av+Rr),ks=t(kp+Rr),ua="(?!"+hi+")",EI=t(Rr+"|"+ca+"|"+pc+"|"+ks+"|"+ua),da=t(t(hi+"|"+e("[\\/\\?]",Fe))+"*"),gi=t(t(hi+"|[\\/\\?]")+"*"),Cp=t(t("\\/\\/"+wp+Rr)+"|"+ca+"|"+ks+"|"+ua),Iv=t(Ue+"\\:"+Cp+t("\\?"+da)+"?"+t("\\#"+gi)+"?"),Rv=t(t("\\/\\/"+wp+Rr)+"|"+ca+"|"+pc+"|"+ua),Pv=t(Rv+t("\\?"+da)+"?"+t("\\#"+gi)+"?"),wI=t(Iv+"|"+Pv),kI=t(Ue+"\\:"+Cp+t("\\?"+da)+"?"),CI="^("+Ue+")\\:"+t(t("\\/\\/("+t("("+Pe+")@")+"?("+pi+")"+t("\\:("+mi+")")+"?)")+"?("+Rr+"|"+ca+"|"+ks+"|"+ua+")")+t("\\?("+da+")")+"?"+t("\\#("+gi+")")+"?$",xI="^(){0}"+t(t("\\/\\/("+t("("+Pe+")@")+"?("+pi+")"+t("\\:("+mi+")")+"?)")+"?("+Rr+"|"+ca+"|"+pc+"|"+ua+")")+t("\\?("+da+")")+"?"+t("\\#("+gi+")")+"?$",TI="^("+Ue+")\\:"+t(t("\\/\\/("+t("("+Pe+")@")+"?("+pi+")"+t("\\:("+mi+")")+"?)")+"?("+Rr+"|"+ca+"|"+ks+"|"+ua+")")+t("\\?("+da+")")+"?$",AI="^"+t("\\#("+gi+")")+"?$",II="^"+t("("+Pe+")@")+"?("+pi+")"+t("\\:("+mi+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",v,D,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",we,Se),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",we,Se),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",we,Se),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",we,Se),"g"),NOT_QUERY:new RegExp(e("[^\\%]",we,Se,"[\\:\\@\\/\\?]",Fe),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",we,Se,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",we,Se),"g"),UNRESERVED:new RegExp(we,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",we,ze),"g"),PCT_ENCODED:new RegExp(Te,"g"),IPV4ADDRESS:new RegExp("^("+Wt+")$"),IPV6ADDRESS:new RegExp("^\\[?("+Ir+")"+t(t("\\%25|\\%(?!"+$+"{2})")+"("+la+")")+"?\\]?$")}}var l=o(!1),c=o(!0),u=function(){function w(v,C){var D=[],N=!0,$=!1,pe=void 0;try{for(var Ee=v[Symbol.iterator](),Te;!(N=(Te=Ee.next()).done)&&(D.push(Te.value),!(C&&D.length===C));N=!0);}catch(Ze){$=!0,pe=Ze}finally{try{!N&&Ee.return&&Ee.return()}finally{if($)throw pe}}return D}return function(v,C){if(Array.isArray(v))return v;if(Symbol.iterator in Object(v))return w(v,C);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(w){if(Array.isArray(w)){for(var v=0,C=Array(w.length);v<w.length;v++)C[v]=w[v];return C}else return Array.from(w)},m=2147483647,d=36,g=1,f=26,y=38,b=700,x=72,S=128,A="-",R=/^xn--/,k=/[^\0-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=d-g,G=Math.floor,U=String.fromCharCode;function M(w){throw new RangeError(B[w])}function T(w,v){for(var C=[],D=w.length;D--;)C[D]=v(w[D]);return C}function I(w,v){var C=w.split("@"),D="";C.length>1&&(D=C[0]+"@",w=C[1]),w=w.replace(O,".");var N=w.split("."),$=T(N,v).join(".");return D+$}function F(w){for(var v=[],C=0,D=w.length;C<D;){var N=w.charCodeAt(C++);if(N>=55296&&N<=56319&&C<D){var $=w.charCodeAt(C++);($&64512)==56320?v.push(((N&1023)<<10)+($&1023)+65536):(v.push(N),C--)}else v.push(N)}return v}var Y=function(v){return String.fromCodePoint.apply(String,p(v))},K=function(v){return v-48<10?v-22:v-65<26?v-65:v-97<26?v-97:d},ee=function(v,C){return v+22+75*(v<26)-((C!=0)<<5)},Z=function(v,C,D){var N=0;for(v=D?G(v/b):v>>1,v+=G(v/C);v>P*f>>1;N+=d)v=G(v/P);return G(N+(P+1)*v/(v+y))},_=function(v){var C=[],D=v.length,N=0,$=S,pe=x,Ee=v.lastIndexOf(A);Ee<0&&(Ee=0);for(var Te=0;Te<Ee;++Te)v.charCodeAt(Te)>=128&&M("not-basic"),C.push(v.charCodeAt(Te));for(var Ze=Ee>0?Ee+1:0;Ze<D;){for(var Se=N,ze=1,Qe=d;;Qe+=d){Ze>=D&&M("invalid-input");var Fe=K(v.charCodeAt(Ze++));(Fe>=d||Fe>G((m-N)/ze))&&M("overflow"),N+=Fe*ze;var we=Qe<=pe?g:Qe>=pe+f?f:Qe-pe;if(Fe<we)break;var Ue=d-we;ze>G(m/Ue)&&M("overflow"),ze*=Ue}var Pe=C.length+1;pe=Z(N-Se,Pe,Se==0),G(N/Pe)>m-$&&M("overflow"),$+=G(N/Pe),N%=Pe,C.splice(N++,0,$)}return String.fromCodePoint.apply(String,C)},ve=function(v){var C=[];v=F(v);var D=v.length,N=S,$=0,pe=x,Ee=!0,Te=!1,Ze=void 0;try{for(var Se=v[Symbol.iterator](),ze;!(Ee=(ze=Se.next()).done);Ee=!0){var Qe=ze.value;Qe<128&&C.push(U(Qe))}}catch(En){Te=!0,Ze=En}finally{try{!Ee&&Se.return&&Se.return()}finally{if(Te)throw Ze}}var Fe=C.length,we=Fe;for(Fe&&C.push(A);we<D;){var Ue=m,Pe=!0,_n=!1,Mt=void 0;try{for(var Wt=v[Symbol.iterator](),De;!(Pe=(De=Wt.next()).done);Pe=!0){var Ot=De.value;Ot>=N&&Ot<Ue&&(Ue=Ot)}}catch(En){_n=!0,Mt=En}finally{try{!Pe&&Wt.return&&Wt.return()}finally{if(_n)throw Mt}}var qt=we+1;Ue-N>G((m-$)/qt)&&M("overflow"),$+=(Ue-N)*qt,N=Ue;var gr=!0,Sn=!1,Ar=void 0;try{for(var di=v[Symbol.iterator](),Es;!(gr=(Es=di.next()).done);gr=!0){var ws=Es.value;if(ws<N&&++$>m&&M("overflow"),ws==N){for(var sa=$,oa=d;;oa+=d){var Ir=oa<=pe?g:oa>=pe+f?f:oa-pe;if(sa<Ir)break;var la=sa-Ir,dc=d-Ir;C.push(U(ee(Ir+la%dc,0))),sa=G(la/dc)}C.push(U(ee(sa,0))),pe=Z($,qt,we==Fe),$=0,++we}}}catch(En){Sn=!0,Ar=En}finally{try{!gr&&di.return&&di.return()}finally{if(Sn)throw Ar}}++$,++N}return C.join("")},Ne=function(v){return I(v,function(C){return R.test(C)?_(C.slice(4).toLowerCase()):C})},E=function(v){return I(v,function(C){return k.test(C)?"xn--"+ve(C):C})},se={version:"2.1.0",ucs2:{decode:F,encode:Y},decode:_,encode:ve,toASCII:E,toUnicode:Ne},Re={};function Ve(w){var v=w.charCodeAt(0),C=void 0;return v<16?C="%0"+v.toString(16).toUpperCase():v<128?C="%"+v.toString(16).toUpperCase():v<2048?C="%"+(v>>6|192).toString(16).toUpperCase()+"%"+(v&63|128).toString(16).toUpperCase():C="%"+(v>>12|224).toString(16).toUpperCase()+"%"+(v>>6&63|128).toString(16).toUpperCase()+"%"+(v&63|128).toString(16).toUpperCase(),C}function Xe(w){for(var v="",C=0,D=w.length;C<D;){var N=parseInt(w.substr(C+1,2),16);if(N<128)v+=String.fromCharCode(N),C+=3;else if(N>=194&&N<224){if(D-C>=6){var $=parseInt(w.substr(C+4,2),16);v+=String.fromCharCode((N&31)<<6|$&63)}else v+=w.substr(C,6);C+=6}else if(N>=224){if(D-C>=9){var pe=parseInt(w.substr(C+4,2),16),Ee=parseInt(w.substr(C+7,2),16);v+=String.fromCharCode((N&15)<<12|(pe&63)<<6|Ee&63)}else v+=w.substr(C,9);C+=9}else v+=w.substr(C,3),C+=3}return v}function Me(w,v){function C(D){var N=Xe(D);return N.match(v.UNRESERVED)?N:D}return w.scheme&&(w.scheme=String(w.scheme).replace(v.PCT_ENCODED,C).toLowerCase().replace(v.NOT_SCHEME,"")),w.userinfo!==void 0&&(w.userinfo=String(w.userinfo).replace(v.PCT_ENCODED,C).replace(v.NOT_USERINFO,Ve).replace(v.PCT_ENCODED,n)),w.host!==void 0&&(w.host=String(w.host).replace(v.PCT_ENCODED,C).toLowerCase().replace(v.NOT_HOST,Ve).replace(v.PCT_ENCODED,n)),w.path!==void 0&&(w.path=String(w.path).replace(v.PCT_ENCODED,C).replace(w.scheme?v.NOT_PATH:v.NOT_PATH_NOSCHEME,Ve).replace(v.PCT_ENCODED,n)),w.query!==void 0&&(w.query=String(w.query).replace(v.PCT_ENCODED,C).replace(v.NOT_QUERY,Ve).replace(v.PCT_ENCODED,n)),w.fragment!==void 0&&(w.fragment=String(w.fragment).replace(v.PCT_ENCODED,C).replace(v.NOT_FRAGMENT,Ve).replace(v.PCT_ENCODED,n)),w}function _t(w){return w.replace(/^0*(.*)/,"$1")||"0"}function Ce(w,v){var C=w.match(v.IPV4ADDRESS)||[],D=u(C,2),N=D[1];return N?N.split(".").map(_t).join("."):w}function Ae(w,v){var C=w.match(v.IPV6ADDRESS)||[],D=u(C,3),N=D[1],$=D[2];if(N){for(var pe=N.toLowerCase().split("::").reverse(),Ee=u(pe,2),Te=Ee[0],Ze=Ee[1],Se=Ze?Ze.split(":").map(_t):[],ze=Te.split(":").map(_t),Qe=v.IPV4ADDRESS.test(ze[ze.length-1]),Fe=Qe?7:8,we=ze.length-Fe,Ue=Array(Fe),Pe=0;Pe<Fe;++Pe)Ue[Pe]=Se[Pe]||ze[we+Pe]||"";Qe&&(Ue[Fe-1]=Ce(Ue[Fe-1],v));var _n=Ue.reduce(function(qt,gr,Sn){if(!gr||gr==="0"){var Ar=qt[qt.length-1];Ar&&Ar.index+Ar.length===Sn?Ar.length++:qt.push({index:Sn,length:1})}return qt},[]),Mt=_n.sort(function(qt,gr){return gr.length-qt.length})[0],Wt=void 0;if(Mt&&Mt.length>1){var De=Ue.slice(0,Mt.index),Ot=Ue.slice(Mt.index+Mt.length);Wt=De.join(":")+"::"+Ot.join(":")}else Wt=Ue.join(":");return $&&(Wt+="%"+$),Wt}else return w}var Ct=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Ye="".match(/(){0}/)[1]===void 0;function _e(w){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C={},D=v.iri!==!1?c:l;v.reference==="suffix"&&(w=(v.scheme?v.scheme+":":"")+"//"+w);var N=w.match(Ct);if(N){Ye?(C.scheme=N[1],C.userinfo=N[3],C.host=N[4],C.port=parseInt(N[5],10),C.path=N[6]||"",C.query=N[7],C.fragment=N[8],isNaN(C.port)&&(C.port=N[5])):(C.scheme=N[1]||void 0,C.userinfo=w.indexOf("@")!==-1?N[3]:void 0,C.host=w.indexOf("//")!==-1?N[4]:void 0,C.port=parseInt(N[5],10),C.path=N[6]||"",C.query=w.indexOf("?")!==-1?N[7]:void 0,C.fragment=w.indexOf("#")!==-1?N[8]:void 0,isNaN(C.port)&&(C.port=w.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?N[4]:void 0)),C.host&&(C.host=Ae(Ce(C.host,D),D)),C.scheme===void 0&&C.userinfo===void 0&&C.host===void 0&&C.port===void 0&&!C.path&&C.query===void 0?C.reference="same-document":C.scheme===void 0?C.reference="relative":C.fragment===void 0?C.reference="absolute":C.reference="uri",v.reference&&v.reference!=="suffix"&&v.reference!==C.reference&&(C.error=C.error||"URI is not a "+v.reference+" reference.");var $=Re[(v.scheme||C.scheme||"").toLowerCase()];if(!v.unicodeSupport&&(!$||!$.unicodeSupport)){if(C.host&&(v.domainHost||$&&$.domainHost))try{C.host=se.toASCII(C.host.replace(D.PCT_ENCODED,Xe).toLowerCase())}catch(pe){C.error=C.error||"Host's domain name can not be converted to ASCII via punycode: "+pe}Me(C,l)}else Me(C,D);$&&$.parse&&$.parse(C,v)}else C.error=C.error||"URI can not be parsed.";return C}function ir(w,v){var C=v.iri!==!1?c:l,D=[];return w.userinfo!==void 0&&(D.push(w.userinfo),D.push("@")),w.host!==void 0&&D.push(Ae(Ce(String(w.host),C),C).replace(C.IPV6ADDRESS,function(N,$,pe){return"["+$+(pe?"%25"+pe:"")+"]"})),(typeof w.port=="number"||typeof w.port=="string")&&(D.push(":"),D.push(String(w.port))),D.length?D.join(""):void 0}var Ht=/^\.\.?\//,Tr=/^\/\.(\/|$)/,hr=/^\/\.\.(\/|$)/,Je=/^\/?(?:.|\n)*?(?=\/|$)/;function xt(w){for(var v=[];w.length;)if(w.match(Ht))w=w.replace(Ht,"");else if(w.match(Tr))w=w.replace(Tr,"/");else if(w.match(hr))w=w.replace(hr,"/"),v.pop();else if(w==="."||w==="..")w="";else{var C=w.match(Je);if(C){var D=C[0];w=w.slice(D.length),v.push(D)}else throw new Error("Unexpected dot segment condition")}return v.join("")}function mt(w){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=v.iri?c:l,D=[],N=Re[(v.scheme||w.scheme||"").toLowerCase()];if(N&&N.serialize&&N.serialize(w,v),w.host&&!C.IPV6ADDRESS.test(w.host)){if(v.domainHost||N&&N.domainHost)try{w.host=v.iri?se.toUnicode(w.host):se.toASCII(w.host.replace(C.PCT_ENCODED,Xe).toLowerCase())}catch(Ee){w.error=w.error||"Host's domain name can not be converted to "+(v.iri?"Unicode":"ASCII")+" via punycode: "+Ee}}Me(w,C),v.reference!=="suffix"&&w.scheme&&(D.push(w.scheme),D.push(":"));var $=ir(w,v);if($!==void 0&&(v.reference!=="suffix"&&D.push("//"),D.push($),w.path&&w.path.charAt(0)!=="/"&&D.push("/")),w.path!==void 0){var pe=w.path;!v.absolutePath&&(!N||!N.absolutePath)&&(pe=xt(pe)),$===void 0&&(pe=pe.replace(/^\/\//,"/%2F")),D.push(pe)}return w.query!==void 0&&(D.push("?"),D.push(w.query)),w.fragment!==void 0&&(D.push("#"),D.push(w.fragment)),D.join("")}function ot(w,v){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=arguments[3],N={};return D||(w=_e(mt(w,C),C),v=_e(mt(v,C),C)),C=C||{},!C.tolerant&&v.scheme?(N.scheme=v.scheme,N.userinfo=v.userinfo,N.host=v.host,N.port=v.port,N.path=xt(v.path||""),N.query=v.query):(v.userinfo!==void 0||v.host!==void 0||v.port!==void 0?(N.userinfo=v.userinfo,N.host=v.host,N.port=v.port,N.path=xt(v.path||""),N.query=v.query):(v.path?(v.path.charAt(0)==="/"?N.path=xt(v.path):((w.userinfo!==void 0||w.host!==void 0||w.port!==void 0)&&!w.path?N.path="/"+v.path:w.path?N.path=w.path.slice(0,w.path.lastIndexOf("/")+1)+v.path:N.path=v.path,N.path=xt(N.path)),N.query=v.query):(N.path=w.path,v.query!==void 0?N.query=v.query:N.query=w.query),N.userinfo=w.userinfo,N.host=w.host,N.port=w.port),N.scheme=w.scheme),N.fragment=v.fragment,N}function Vt(w,v,C){var D=s({scheme:"null"},C);return mt(ot(_e(w,D),_e(v,D),D,!0),D)}function St(w,v){return typeof w=="string"?w=mt(_e(w,v),v):a(w)==="object"&&(w=_e(mt(w,v),v)),w}function L(w,v,C){return typeof w=="string"?w=mt(_e(w,C),C):a(w)==="object"&&(w=mt(w,C)),typeof v=="string"?v=mt(_e(v,C),C):a(v)==="object"&&(v=mt(v,C)),w===v}function j(w,v){return w&&w.toString().replace(!v||!v.iri?l.ESCAPE:c.ESCAPE,Ve)}function Q(w,v){return w&&w.toString().replace(!v||!v.iri?l.PCT_ENCODED:c.PCT_ENCODED,Xe)}var de={scheme:"http",domainHost:!0,parse:function(v,C){return v.host||(v.error=v.error||"HTTP URIs must have a host."),v},serialize:function(v,C){var D=String(v.scheme).toLowerCase()==="https";return(v.port===(D?443:80)||v.port==="")&&(v.port=void 0),v.path||(v.path="/"),v}},xe={scheme:"https",domainHost:de.domainHost,parse:de.parse,serialize:de.serialize};function Tt(w){return typeof w.secure=="boolean"?w.secure:String(w.scheme).toLowerCase()==="wss"}var Nt={scheme:"ws",domainHost:!0,parse:function(v,C){var D=v;return D.secure=Tt(D),D.resourceName=(D.path||"/")+(D.query?"?"+D.query:""),D.path=void 0,D.query=void 0,D},serialize:function(v,C){if((v.port===(Tt(v)?443:80)||v.port==="")&&(v.port=void 0),typeof v.secure=="boolean"&&(v.scheme=v.secure?"wss":"ws",v.secure=void 0),v.resourceName){var D=v.resourceName.split("?"),N=u(D,2),$=N[0],pe=N[1];v.path=$&&$!=="/"?$:void 0,v.query=pe,v.resourceName=void 0}return v.fragment=void 0,v}},jt={scheme:"wss",domainHost:Nt.domainHost,parse:Nt.parse,serialize:Nt.serialize},bn={},vn=!0,ht="[A-Za-z0-9\\-\\.\\_\\~"+(vn?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",lt="[0-9A-Fa-f]",sr=t(t("%[EFef]"+lt+"%"+lt+lt+"%"+lt+lt)+"|"+t("%[89A-Fa-f]"+lt+"%"+lt+lt)+"|"+t("%"+lt+lt)),fv="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",yv="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",bv=e(yv,'[\\"\\\\]'),vv="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",_v=new RegExp(ht,"g"),ia=new RegExp(sr,"g"),Sv=new RegExp(e("[^]",fv,"[\\.]",'[\\"]',bv),"g"),bp=new RegExp(e("[^]",ht,vv),"g"),Ev=bp;function uc(w){var v=Xe(w);return v.match(_v)?v:w}var vp={scheme:"mailto",parse:function(v,C){var D=v,N=D.to=D.path?D.path.split(","):[];if(D.path=void 0,D.query){for(var $=!1,pe={},Ee=D.query.split("&"),Te=0,Ze=Ee.length;Te<Ze;++Te){var Se=Ee[Te].split("=");switch(Se[0]){case"to":for(var ze=Se[1].split(","),Qe=0,Fe=ze.length;Qe<Fe;++Qe)N.push(ze[Qe]);break;case"subject":D.subject=Q(Se[1],C);break;case"body":D.body=Q(Se[1],C);break;default:$=!0,pe[Q(Se[0],C)]=Q(Se[1],C);break}}$&&(D.headers=pe)}D.query=void 0;for(var we=0,Ue=N.length;we<Ue;++we){var Pe=N[we].split("@");if(Pe[0]=Q(Pe[0]),C.unicodeSupport)Pe[1]=Q(Pe[1],C).toLowerCase();else try{Pe[1]=se.toASCII(Q(Pe[1],C).toLowerCase())}catch(_n){D.error=D.error||"Email address's domain name can not be converted to ASCII via punycode: "+_n}N[we]=Pe.join("@")}return D},serialize:function(v,C){var D=v,N=i(v.to);if(N){for(var $=0,pe=N.length;$<pe;++$){var Ee=String(N[$]),Te=Ee.lastIndexOf("@"),Ze=Ee.slice(0,Te).replace(ia,uc).replace(ia,n).replace(Sv,Ve),Se=Ee.slice(Te+1);try{Se=C.iri?se.toUnicode(Se):se.toASCII(Q(Se,C).toLowerCase())}catch(we){D.error=D.error||"Email address's domain name can not be converted to "+(C.iri?"Unicode":"ASCII")+" via punycode: "+we}N[$]=Ze+"@"+Se}D.path=N.join(",")}var ze=v.headers=v.headers||{};v.subject&&(ze.subject=v.subject),v.body&&(ze.body=v.body);var Qe=[];for(var Fe in ze)ze[Fe]!==bn[Fe]&&Qe.push(Fe.replace(ia,uc).replace(ia,n).replace(bp,Ve)+"="+ze[Fe].replace(ia,uc).replace(ia,n).replace(Ev,Ve));return Qe.length&&(D.query=Qe.join("&")),D}},wv=/^([^\:]+)\:(.*)/,_p={scheme:"urn",parse:function(v,C){var D=v.path&&v.path.match(wv),N=v;if(D){var $=C.scheme||N.scheme||"urn",pe=D[1].toLowerCase(),Ee=D[2],Te=$+":"+(C.nid||pe),Ze=Re[Te];N.nid=pe,N.nss=Ee,N.path=void 0,Ze&&(N=Ze.parse(N,C))}else N.error=N.error||"URN can not be parsed.";return N},serialize:function(v,C){var D=C.scheme||v.scheme||"urn",N=v.nid,$=D+":"+(C.nid||N),pe=Re[$];pe&&(v=pe.serialize(v,C));var Ee=v,Te=v.nss;return Ee.path=(N||C.nid)+":"+Te,Ee}},kv=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Sp={scheme:"urn:uuid",parse:function(v,C){var D=v;return D.uuid=D.nss,D.nss=void 0,!C.tolerant&&(!D.uuid||!D.uuid.match(kv))&&(D.error=D.error||"UUID is not valid."),D},serialize:function(v,C){var D=v;return D.nss=(v.uuid||"").toLowerCase(),D}};Re[de.scheme]=de,Re[xe.scheme]=xe,Re[Nt.scheme]=Nt,Re[jt.scheme]=jt,Re[vp.scheme]=vp,Re[_p.scheme]=_p,Re[Sp.scheme]=Sp,r.SCHEMES=Re,r.pctEncChar=Ve,r.pctDecChars=Xe,r.parse=_e,r.removeDotSegments=xt,r.serialize=mt,r.resolveComponents=ot,r.resolve=Vt,r.normalize=St,r.equal=L,r.escapeComponent=j,r.unescapeComponent=Q,Object.defineProperty(r,"__esModule",{value:!0})})});var Po=ae(($D,Rh)=>{"use strict";Rh.exports=function r(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var a,n,i;if(Array.isArray(e)){if(a=e.length,a!=t.length)return!1;for(n=a;n--!==0;)if(!r(e[n],t[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(i=Object.keys(e),a=i.length,a!==Object.keys(t).length)return!1;for(n=a;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;for(n=a;n--!==0;){var s=i[n];if(!r(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}});var Dh=ae((KD,Ph)=>{"use strict";Ph.exports=function(e){for(var t=0,a=e.length,n=0,i;n<a;)t++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<a&&(i=e.charCodeAt(n),(i&64512)==56320&&n++);return t}});var qn=ae((XD,Oh)=>{"use strict";Oh.exports={copy:Mw,checkDataType:Su,checkDataTypes:Ow,coerceToTypes:Lw,toHash:wu,getProperty:ku,escapeQuotes:Cu,equal:Po(),ucs2length:Dh(),varOccurences:Gw,varReplace:zw,schemaHasRules:Uw,schemaHasRulesExcept:Hw,schemaUnknownRules:Vw,toQuotedString:Eu,getPathExpr:jw,getPath:Ww,getData:Kw,unescapeFragment:Xw,unescapeJsonPointer:Tu,escapeFragment:Yw,escapeJsonPointer:xu};function Mw(r,e){e=e||{};for(var t in r)e[t]=r[t];return e}function Su(r,e,t,a){var n=a?" !== ":" === ",i=a?" || ":" && ",s=a?"!":"",o=a?"":"!";switch(r){case"null":return e+n+"null";case"array":return s+"Array.isArray("+e+")";case"object":return"("+s+e+i+"typeof "+e+n+'"object"'+i+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+n+'"number"'+i+o+"("+e+" % 1)"+i+e+n+e+(t?i+s+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+n+'"'+r+'"'+(t?i+s+"isFinite("+e+")":"")+")";default:return"typeof "+e+n+'"'+r+'"'}}function Ow(r,e,t){switch(r.length){case 1:return Su(r[0],e,t,!0);default:var a="",n=wu(r);n.array&&n.object&&(a=n.null?"(":"(!"+e+" || ",a+="typeof "+e+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer;for(var i in n)a+=(a?" && ":"")+Su(i,e,t,!0);return a}}var Nh=wu(["string","number","integer","boolean","null"]);function Lw(r,e){if(Array.isArray(e)){for(var t=[],a=0;a<e.length;a++){var n=e[a];(Nh[n]||r==="array"&&n==="array")&&(t[t.length]=n)}if(t.length)return t}else{if(Nh[e])return[e];if(r==="array"&&e==="array")return["array"]}}function wu(r){for(var e={},t=0;t<r.length;t++)e[r[t]]=!0;return e}var Bw=/^[a-z$_][a-z$_0-9]*$/i,Fw=/'|\\/g;function ku(r){return typeof r=="number"?"["+r+"]":Bw.test(r)?"."+r:"['"+Cu(r)+"']"}function Cu(r){return r.replace(Fw,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Gw(r,e){e+="[^0-9]";var t=r.match(new RegExp(e,"g"));return t?t.length:0}function zw(r,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),r.replace(new RegExp(e,"g"),t+"$1")}function Uw(r,e){if(typeof r=="boolean")return!r;for(var t in r)if(e[t])return!0}function Hw(r,e,t){if(typeof r=="boolean")return!r&&t!="not";for(var a in r)if(a!=t&&e[a])return!0}function Vw(r,e){if(typeof r!="boolean"){for(var t in r)if(!e[t])return t}}function Eu(r){return"'"+Cu(r)+"'"}function jw(r,e,t,a){var n=t?"'/' + "+e+(a?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):a?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Mh(r,n)}function Ww(r,e,t){var a=Eu(t?"/"+xu(e):ku(e));return Mh(r,a)}var qw=/^\/(?:[^~]|~0|~1)*$/,$w=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Kw(r,e,t){var a,n,i,s;if(r==="")return"rootData";if(r[0]=="/"){if(!qw.test(r))throw new Error("Invalid JSON-pointer: "+r);n=r,i="rootData"}else{if(s=r.match($w),!s)throw new Error("Invalid JSON-pointer: "+r);if(a=+s[1],n=s[2],n=="#"){if(a>=e)throw new Error("Cannot access property/index "+a+" levels up, current level is "+e);return t[e-a]}if(a>e)throw new Error("Cannot access data "+a+" levels up, current level is "+e);if(i="data"+(e-a||""),!n)return i}for(var o=i,l=n.split("/"),c=0;c<l.length;c++){var u=l[c];u&&(i+=ku(Tu(u)),o+=" && "+i)}return o}function Mh(r,e){return r=='""'?e:(r+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Xw(r){return Tu(decodeURIComponent(r))}function Yw(r){return encodeURIComponent(xu(r))}function xu(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}function Tu(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}});var Au=ae((YD,Lh)=>{"use strict";var Jw=qn();Lh.exports=Zw;function Zw(r){Jw.copy(r,this)}});var Fh=ae((JD,Bh)=>{"use strict";var ln=Bh.exports=function(r,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var a=typeof t=="function"?t:t.pre||function(){},n=t.post||function(){};Do(e,a,n,r,"",r)};ln.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};ln.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ln.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ln.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Do(r,e,t,a,n,i,s,o,l,c){if(a&&typeof a=="object"&&!Array.isArray(a)){e(a,n,i,s,o,l,c);for(var u in a){var p=a[u];if(Array.isArray(p)){if(u in ln.arrayKeywords)for(var m=0;m<p.length;m++)Do(r,e,t,p[m],n+"/"+u+"/"+m,i,n,u,a,m)}else if(u in ln.propsKeywords){if(p&&typeof p=="object")for(var d in p)Do(r,e,t,p[d],n+"/"+u+"/"+Qw(d),i,n,u,a,d)}else(u in ln.keywords||r.allKeys&&!(u in ln.skipKeywords))&&Do(r,e,t,p,n+"/"+u,i,n,u,a)}t(a,n,i,s,o,l,c)}}function Qw(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}});var Fo=ae((ZD,Hh)=>{"use strict";var Ui=Ih(),Gh=Po(),Lo=qn(),No=Au(),ek=Fh();Hh.exports=un;un.normalizeId=cn;un.fullPath=Mo;un.url=Oo;un.ids=ik;un.inlineRef=Iu;un.schema=Bo;function un(r,e,t){var a=this._refs[t];if(typeof a=="string")if(this._refs[a])a=this._refs[a];else return un.call(this,r,e,a);if(a=a||this._schemas[t],a instanceof No)return Iu(a.schema,this._opts.inlineRefs)?a.schema:a.validate||this._compile(a);var n=Bo.call(this,e,t),i,s,o;return n&&(i=n.schema,e=n.root,o=n.baseId),i instanceof No?s=i.validate||r.call(this,i.schema,e,void 0,o):i!==void 0&&(s=Iu(i,this._opts.inlineRefs)?i:r.call(this,i,e,void 0,o)),s}function Bo(r,e){var t=Ui.parse(e),a=Uh(t),n=Mo(this._getId(r.schema));if(Object.keys(r.schema).length===0||a!==n){var i=cn(a),s=this._refs[i];if(typeof s=="string")return tk.call(this,r,s,t);if(s instanceof No)s.validate||this._compile(s),r=s;else if(s=this._schemas[i],s instanceof No){if(s.validate||this._compile(s),i==cn(e))return{schema:s,root:r,baseId:n};r=s}else return;if(!r.schema)return;n=Mo(this._getId(r.schema))}return zh.call(this,t,n,r.schema,r)}function tk(r,e,t){var a=Bo.call(this,r,e);if(a){var n=a.schema,i=a.baseId;r=a.root;var s=this._getId(n);return s&&(i=Oo(i,s)),zh.call(this,t,i,n,r)}}var rk=Lo.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function zh(r,e,t,a){if(r.fragment=r.fragment||"",r.fragment.slice(0,1)=="/"){for(var n=r.fragment.split("/"),i=1;i<n.length;i++){var s=n[i];if(s){if(s=Lo.unescapeFragment(s),t=t[s],t===void 0)break;var o;if(!rk[s]&&(o=this._getId(t),o&&(e=Oo(e,o)),t.$ref)){var l=Oo(e,t.$ref),c=Bo.call(this,a,l);c&&(t=c.schema,a=c.root,e=c.baseId)}}}if(t!==void 0&&t!==a.schema)return{schema:t,root:a,baseId:e}}}var nk=Lo.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Iu(r,e){if(e===!1)return!1;if(e===void 0||e===!0)return Ru(r);if(e)return Pu(r)<=e}function Ru(r){var e;if(Array.isArray(r)){for(var t=0;t<r.length;t++)if(e=r[t],typeof e=="object"&&!Ru(e))return!1}else for(var a in r)if(a=="$ref"||(e=r[a],typeof e=="object"&&!Ru(e)))return!1;return!0}function Pu(r){var e=0,t;if(Array.isArray(r)){for(var a=0;a<r.length;a++)if(t=r[a],typeof t=="object"&&(e+=Pu(t)),e==1/0)return 1/0}else for(var n in r){if(n=="$ref")return 1/0;if(nk[n])e++;else if(t=r[n],typeof t=="object"&&(e+=Pu(t)+1),e==1/0)return 1/0}return e}function Mo(r,e){e!==!1&&(r=cn(r));var t=Ui.parse(r);return Uh(t)}function Uh(r){return Ui.serialize(r).split("#")[0]+"#"}var ak=/#\/?$/;function cn(r){return r?r.replace(ak,""):""}function Oo(r,e){return e=cn(e),Ui.resolve(r,e)}function ik(r){var e=cn(this._getId(r)),t={"":e},a={"":Mo(e,!1)},n={},i=this;return ek(r,{allKeys:!0},function(s,o,l,c,u,p,m){if(o!==""){var d=i._getId(s),g=t[c],f=a[c]+"/"+u;if(m!==void 0&&(f+="/"+(typeof m=="number"?m:Lo.escapeFragment(m))),typeof d=="string"){d=g=cn(g?Ui.resolve(g,d):d);var y=i._refs[d];if(typeof y=="string"&&(y=i._refs[y]),y&&y.schema){if(!Gh(s,y.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=cn(f))if(d[0]=="#"){if(n[d]&&!Gh(s,n[d]))throw new Error('id "'+d+'" resolves to more than one schema');n[d]=s}else i._refs[d]=f}t[o]=g,a[o]=f}}),n}});var Go=ae((QD,jh)=>{"use strict";var Du=Fo();jh.exports={Validation:Vh(sk),MissingRef:Vh(Nu)};function sk(r){this.message="validation failed",this.errors=r,this.ajv=this.validation=!0}Nu.message=function(r,e){return"can't resolve reference "+e+" from id "+r};function Nu(r,e,t){this.message=t||Nu.message(r,e),this.missingRef=Du.url(r,e),this.missingSchema=Du.normalizeId(Du.fullPath(this.missingRef))}function Vh(r){return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}});var Mu=ae((eN,Wh)=>{"use strict";Wh.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,a=e.cmp&&function(i){return function(s){return function(o,l){var c={key:o,value:s[o]},u={key:l,value:s[l]};return i(c,u)}}}(e.cmp),n=[];return function i(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var o,l;if(Array.isArray(s)){for(l="[",o=0;o<s.length;o++)o&&(l+=","),l+=i(s[o])||"null";return l+"]"}if(s===null)return"null";if(n.indexOf(s)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=n.push(s)-1,u=Object.keys(s).sort(a&&a(s));for(l="",o=0;o<u.length;o++){var p=u[o],m=i(s[p]);m&&(l&&(l+=","),l+=JSON.stringify(p)+":"+m)}return n.splice(c,1),"{"+l+"}"}}(r)}});var Ou=ae((tN,qh)=>{"use strict";qh.exports=function(e,t,a){var n="",i=e.schema.$async===!0,s=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var l=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(l){var c="unknown keyword: "+l;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(n+=" var validate = ",i&&(e.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(n+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(s||e.schema.$ref)){var t="false schema",u=e.level,p=e.dataLevel,m=e.schema[t],d=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,R=!e.opts.allErrors,B,f="data"+(p||""),A="valid"+u;if(e.schema===!1){e.isTop?R=!0:n+=" var "+A+" = false; ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(B||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&R?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?i?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+A+" = true; ";return e.isTop&&(n+=" }; return validate; "),n}if(e.isTop){var x=e.isTop,u=e.level=0,p=e.dataLevel=0,f="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var S="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var u=e.level,p=e.dataLevel,f="data"+(p||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),i&&!e.async)throw new Error("async schema in sync schema");n+=" var errs_"+u+" = errors;"}var A="valid"+u,R=!e.opts.allErrors,k="",O="",B,P=e.schema.type,G=Array.isArray(P);if(P&&e.opts.nullable&&e.schema.nullable===!0&&(G?P.indexOf("null")==-1&&(P=P.concat("null")):P!="null"&&(P=[P,"null"],G=!0)),G&&P.length==1&&(P=P[0],G=!1),e.schema.$ref&&s){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(s=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(n+=" "+e.RULES.all.$comment.code(e,"$comment")),P){if(e.opts.coerceTypes)var U=e.util.coerceToTypes(e.opts.coerceTypes,P);var M=e.RULES.types[P];if(U||G||M===!0||M&&!Je(M)){var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",d=e.schemaPath+".type",g=e.errSchemaPath+"/type",T=G?"checkDataTypes":"checkDataType";if(n+=" if ("+e.util[T](P,f,e.opts.strictNumbers,!0)+") { ",U){var I="dataType"+u,F="coerced"+u;n+=" var "+I+" = typeof "+f+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(n+=" if ("+I+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+I+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+F+" = "+f+"; } "),n+=" if ("+F+" !== undefined) ; ";var Y=U;if(Y)for(var K,ee=-1,Z=Y.length-1;ee<Z;)K=Y[ee+=1],K=="string"?n+=" else if ("+I+" == 'number' || "+I+" == 'boolean') "+F+" = '' + "+f+"; else if ("+f+" === null) "+F+" = ''; ":K=="number"||K=="integer"?(n+=" else if ("+I+" == 'boolean' || "+f+" === null || ("+I+" == 'string' && "+f+" && "+f+" == +"+f+" ",K=="integer"&&(n+=" && !("+f+" % 1)"),n+=")) "+F+" = +"+f+"; "):K=="boolean"?n+=" else if ("+f+" === 'false' || "+f+" === 0 || "+f+" === null) "+F+" = false; else if ("+f+" === 'true' || "+f+" === 1) "+F+" = true; ":K=="null"?n+=" else if ("+f+" === '' || "+f+" === 0 || "+f+" === false) "+F+" = null; ":e.opts.coerceTypes=="array"&&K=="array"&&(n+=" else if ("+I+" == 'string' || "+I+" == 'number' || "+I+" == 'boolean' || "+f+" == null) "+F+" = ["+f+"]; ");n+=" else { ";var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(B||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+P.join(","):n+=""+P,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+P.join(","):n+=""+P,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&R?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } if ("+F+" !== undefined) { ";var _=p?"data"+(p-1||""):"parentData",ve=p?e.dataPathArr[p]:"parentDataProperty";n+=" "+f+" = "+F+"; ",p||(n+="if ("+_+" !== undefined)"),n+=" "+_+"["+ve+"] = "+F+"; } "}else{var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(B||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+P.join(","):n+=""+P,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+P.join(","):n+=""+P,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&R?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}n+=" } "}}if(e.schema.$ref&&!s)n+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",R&&(n+=" } if (errors === ",x?n+="0":n+="errs_"+u,n+=") { ",O+="}");else{var Ne=e.RULES;if(Ne){for(var M,E=-1,se=Ne.length-1;E<se;)if(M=Ne[E+=1],Je(M)){if(M.type&&(n+=" if ("+e.util.checkDataType(M.type,f,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(M.type=="object"&&e.schema.properties){var m=e.schema.properties,Re=Object.keys(m),Ve=Re;if(Ve)for(var Xe,Me=-1,_t=Ve.length-1;Me<_t;){Xe=Ve[Me+=1];var Ce=m[Xe];if(Ce.default!==void 0){var Ae=f+e.util.getProperty(Xe);if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+Ae;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else n+=" if ("+Ae+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ae+" === null || "+Ae+" === '' "),n+=" ) "+Ae+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Ce.default)+" ":n+=" "+JSON.stringify(Ce.default)+" ",n+="; "}}}else if(M.type=="array"&&Array.isArray(e.schema.items)){var Ct=e.schema.items;if(Ct){for(var Ce,ee=-1,Ye=Ct.length-1;ee<Ye;)if(Ce=Ct[ee+=1],Ce.default!==void 0){var Ae=f+"["+ee+"]";if(e.compositeRule){if(e.opts.strictDefaults){var S="default is ignored for: "+Ae;if(e.opts.strictDefaults==="log")e.logger.warn(S);else throw new Error(S)}}else n+=" if ("+Ae+" === undefined ",e.opts.useDefaults=="empty"&&(n+=" || "+Ae+" === null || "+Ae+" === '' "),n+=" ) "+Ae+" = ",e.opts.useDefaults=="shared"?n+=" "+e.useDefault(Ce.default)+" ":n+=" "+JSON.stringify(Ce.default)+" ",n+="; "}}}}var _e=M.rules;if(_e){for(var ir,Ht=-1,Tr=_e.length-1;Ht<Tr;)if(ir=_e[Ht+=1],xt(ir)){var hr=ir.code(e,ir.keyword,M.type);hr&&(n+=" "+hr+" ",R&&(k+="}"))}}if(R&&(n+=" "+k+" ",k=""),M.type&&(n+=" } ",P&&P===M.type&&!U)){n+=" else { ";var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(B||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: { type: '",G?n+=""+P.join(","):n+=""+P,n+="' } ",e.opts.messages!==!1&&(n+=" , message: 'should be ",G?n+=""+P.join(","):n+=""+P,n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&R?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } "}R&&(n+=" if (errors === ",x?n+="0":n+="errs_"+u,n+=") { ",O+="}")}}}R&&(n+=" "+O+" "),x?(i?(n+=" if (errors === 0) return data; ",n+=" else throw new ValidationError(vErrors); "):(n+=" validate.errors = vErrors; ",n+=" return errors === 0; "),n+=" }; return validate;"):n+=" var "+A+" = errors === errs_"+u+";";function Je(ot){for(var Vt=ot.rules,St=0;St<Vt.length;St++)if(xt(Vt[St]))return!0}function xt(ot){return e.schema[ot.keyword]!==void 0||ot.implements&&mt(ot)}function mt(ot){for(var Vt=ot.implements,St=0;St<Vt.length;St++)if(e.schema[Vt[St]]!==void 0)return!0}return n}});var Jh=ae((rN,Yh)=>{"use strict";var zo=Fo(),Ho=qn(),Kh=Go(),ok=Mu(),$h=Ou(),lk=Ho.ucs2length,ck=Po(),uk=Kh.Validation;Yh.exports=Lu;function Lu(r,e,t,a){var n=this,i=this._opts,s=[void 0],o={},l=[],c={},u=[],p={},m=[];e=e||{schema:r,refVal:s,refs:o};var d=dk.call(this,r,e,a),g=this._compilations[d.index];if(d.compiling)return g.callValidate=S;var f=this._formats,y=this.RULES;try{var b=A(r,e,t,a);g.validate=b;var x=g.callValidate;return x&&(x.schema=b.schema,x.errors=null,x.refs=b.refs,x.refVal=b.refVal,x.root=b.root,x.$async=b.$async,i.sourceCode&&(x.source=b.source)),b}finally{pk.call(this,r,e,a)}function S(){var T=g.validate,I=T.apply(this,arguments);return S.errors=T.errors,I}function A(T,I,F,Y){var K=!I||I&&I.schema==T;if(I.schema!=e.schema)return Lu.call(n,T,I,F,Y);var ee=T.$async===!0,Z=$h({isTop:!0,schema:T,isRoot:K,baseId:Y,root:I,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Kh.MissingRef,RULES:y,validate:$h,util:Ho,resolve:zo,resolveRef:R,usePattern:G,useDefault:U,useCustomRule:M,opts:i,formats:f,logger:n.logger,self:n});Z=Uo(s,gk)+Uo(l,mk)+Uo(u,hk)+Uo(m,fk)+Z,i.processCode&&(Z=i.processCode(Z,T));var _;try{var ve=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Z);_=ve(n,y,f,e,s,u,m,ck,lk,uk),s[0]=_}catch(Ne){throw n.logger.error("Error compiling schema, function code:",Z),Ne}return _.schema=T,_.errors=null,_.refs=o,_.refVal=s,_.root=K?_:I,ee&&(_.$async=!0),i.sourceCode===!0&&(_.source={code:Z,patterns:l,defaults:u}),_}function R(T,I,F){I=zo.url(T,I);var Y=o[I],K,ee;if(Y!==void 0)return K=s[Y],ee="refVal["+Y+"]",P(K,ee);if(!F&&e.refs){var Z=e.refs[I];if(Z!==void 0)return K=e.refVal[Z],ee=k(I,K),P(K,ee)}ee=k(I);var _=zo.call(n,A,e,I);if(_===void 0){var ve=t&&t[I];ve&&(_=zo.inlineRef(ve,i.inlineRefs)?ve:Lu.call(n,ve,e,t,T))}if(_===void 0)O(I);else return B(I,_),P(_,ee)}function k(T,I){var F=s.length;return s[F]=I,o[T]=F,"refVal"+F}function O(T){delete o[T]}function B(T,I){var F=o[T];s[F]=I}function P(T,I){return typeof T=="object"||typeof T=="boolean"?{code:I,schema:T,inline:!0}:{code:I,$async:T&&!!T.$async}}function G(T){var I=c[T];return I===void 0&&(I=c[T]=l.length,l[I]=T),"pattern"+I}function U(T){switch(typeof T){case"boolean":case"number":return""+T;case"string":return Ho.toQuotedString(T);case"object":if(T===null)return"null";var I=ok(T),F=p[I];return F===void 0&&(F=p[I]=u.length,u[F]=T),"default"+F}}function M(T,I,F,Y){if(n._opts.validateSchema!==!1){var K=T.definition.dependencies;if(K&&!K.every(function(Ve){return Object.prototype.hasOwnProperty.call(F,Ve)}))throw new Error("parent schema must have all required keywords: "+K.join(","));var ee=T.definition.validateSchema;if(ee){var Z=ee(I);if(!Z){var _="keyword schema is invalid: "+n.errorsText(ee.errors);if(n._opts.validateSchema=="log")n.logger.error(_);else throw new Error(_)}}}var ve=T.definition.compile,Ne=T.definition.inline,E=T.definition.macro,se;if(ve)se=ve.call(n,I,F,Y);else if(E)se=E.call(n,I,F,Y),i.validateSchema!==!1&&n.validateSchema(se,!0);else if(Ne)se=Ne.call(n,Y,T.keyword,I,F);else if(se=T.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+T.keyword+'"failed to compile');var Re=m.length;return m[Re]=se,{code:"customRule"+Re,validate:se}}}function dk(r,e,t){var a=Xh.call(this,r,e,t);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:r,root:e,baseId:t},{index:a,compiling:!1})}function pk(r,e,t){var a=Xh.call(this,r,e,t);a>=0&&this._compilations.splice(a,1)}function Xh(r,e,t){for(var a=0;a<this._compilations.length;a++){var n=this._compilations[a];if(n.schema==r&&n.root==e&&n.baseId==t)return a}return-1}function mk(r,e){return"var pattern"+r+" = new RegExp("+Ho.toQuotedString(e[r])+");"}function hk(r){return"var default"+r+" = defaults["+r+"];"}function gk(r,e){return e[r]===void 0?"":"var refVal"+r+" = refVal["+r+"];"}function fk(r){return"var customRule"+r+" = customRules["+r+"];"}function Uo(r,e){if(!r.length)return"";for(var t="",a=0;a<r.length;a++)t+=e(a,r);return t}});var Qh=ae((nN,Zh)=>{"use strict";var Vo=Zh.exports=function(){this._cache={}};Vo.prototype.put=function(e,t){this._cache[e]=t};Vo.prototype.get=function(e){return this._cache[e]};Vo.prototype.del=function(e){delete this._cache[e]};Vo.prototype.clear=function(){this._cache={}}});var dg=ae((aN,ug)=>{"use strict";var yk=qn(),bk=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,vk=[0,31,28,31,30,31,30,31,31,30,31,30,31],_k=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,eg=/^(?=.{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,Sk=/^(?:[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,Ek=/^(?:[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,tg=/^(?:(?:[^\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,rg=/^(?:(?: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,ng=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ag=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ig=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,sg=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;ug.exports=jo;function jo(r){return r=r=="full"?"full":"fast",yk.copy(jo[r])}jo.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":tg,url:rg,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:eg,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:cg,uuid:ng,"json-pointer":ag,"json-pointer-uri-fragment":ig,"relative-json-pointer":sg};jo.full={date:og,time:lg,"date-time":Ck,uri:Tk,"uri-reference":Ek,"uri-template":tg,url:rg,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:eg,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:cg,uuid:ng,"json-pointer":ag,"json-pointer-uri-fragment":ig,"relative-json-pointer":sg};function wk(r){return r%4===0&&(r%100!==0||r%400===0)}function og(r){var e=r.match(bk);if(!e)return!1;var t=+e[1],a=+e[2],n=+e[3];return a>=1&&a<=12&&n>=1&&n<=(a==2&&wk(t)?29:vk[a])}function lg(r,e){var t=r.match(_k);if(!t)return!1;var a=t[1],n=t[2],i=t[3],s=t[5];return(a<=23&&n<=59&&i<=59||a==23&&n==59&&i==60)&&(!e||s)}var kk=/t|\s/i;function Ck(r){var e=r.split(kk);return e.length==2&&og(e[0])&&lg(e[1],!0)}var xk=/\/|:/;function Tk(r){return xk.test(r)&&Sk.test(r)}var Ak=/[^\\]\\Z/;function cg(r){if(Ak.test(r))return!1;try{return new RegExp(r),!0}catch{return!1}}});var mg=ae((iN,pg)=>{"use strict";pg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(s||""),p="valid"+i,m,d;if(o=="#"||o=="#/")e.isRoot?(m=e.async,d="validate"):(m=e.root.schema.$async===!0,d="root.refVal[0]");else{var g=e.resolveRef(e.baseId,o,e.isRoot);if(g===void 0){var f=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(f);var y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(l)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(n+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),n+=" } "):n+=" {} ";var b=n;n=y.pop(),!e.compositeRule&&c?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(n+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(f),c&&(n+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,f)}else if(g.inline){var x=e.util.copy(e);x.level++;var S="valid"+x.level;x.schema=g.schema,x.schemaPath="",x.errSchemaPath=o;var A=e.validate(x).replace(/validate\.schema/g,g.code);n+=" "+A+" ",c&&(n+=" if ("+S+") { ")}else m=g.$async===!0||e.async&&g.$async!==!1,d=g.code}if(d){var y=y||[];y.push(n),n="",e.opts.passContext?n+=" "+d+".call(this, ":n+=" "+d+"( ",n+=" "+u+", (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var R=s?"data"+(s-1||""):"parentData",k=s?e.dataPathArr[s]:"parentDataProperty";n+=" , "+R+" , "+k+", rootData) ";var O=n;if(n=y.pop(),m){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(n+=" var "+p+"; "),n+=" try { await "+O+"; ",c&&(n+=" "+p+" = 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; ",c&&(n+=" "+p+" = false; "),n+=" } ",c&&(n+=" if ("+p+") { ")}else n+=" if (!"+O+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(n+=" else { ")}return n}});var gg=ae((sN,hg)=>{"use strict";hg.exports=function(e,t,a){var n=" ",i=e.schema[t],s=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,c=e.util.copy(e),u="";c.level++;var p="valid"+c.level,m=c.baseId,d=!0,g=i;if(g)for(var f,y=-1,b=g.length-1;y<b;)f=g[y+=1],(e.opts.strictKeywords?typeof f=="object"&&Object.keys(f).length>0||f===!1:e.util.schemaHasRules(f,e.RULES.all))&&(d=!1,c.schema=f,c.schemaPath=s+"["+y+"]",c.errSchemaPath=o+"/"+y,n+=" "+e.validate(c)+" ",c.baseId=m,l&&(n+=" if ("+p+") { ",u+="}"));return l&&(d?n+=" if (true) { ":n+=" "+u.slice(0,-1)+" "),n}});var yg=ae((oN,fg)=>{"use strict";fg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,b=o.every(function(B){return e.opts.strictKeywords?typeof B=="object"&&Object.keys(B).length>0||B===!1:e.util.schemaHasRules(B,e.RULES.all)});if(b){var x=g.baseId;n+=" var "+d+" = errors; var "+m+" = false; ";var S=e.compositeRule;e.compositeRule=g.compositeRule=!0;var A=o;if(A)for(var R,k=-1,O=A.length-1;k<O;)R=A[k+=1],g.schema=R,g.schemaPath=l+"["+k+"]",g.errSchemaPath=c+"/"+k,n+=" "+e.validate(g)+" ",g.baseId=x,n+=" "+m+" = "+m+" || "+y+"; if (!"+m+") { ",f+="}";e.compositeRule=g.compositeRule=S,n+=" "+f+" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else u&&(n+=" if (true) { ");return n}});var vg=ae((lN,bg)=>{"use strict";bg.exports=function(e,t,a){var n=" ",i=e.schema[t],s=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,l=e.util.toQuotedString(i);return e.opts.$comment===!0?n+=" console.log("+l+");":typeof e.opts.$comment=="function"&&(n+=" self._opts.$comment("+l+", "+e.util.toQuotedString(s)+", validate.root.schema);"),n}});var Sg=ae((cN,_g)=>{"use strict";_g.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+i,d=e.opts.$data&&o&&o.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",g="schema"+i):g=o,d||(n+=" var schema"+i+" = validate.schema"+l+";"),n+="var "+m+" = equal("+p+", schema"+i+"); if (!"+m+") { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var wg=ae((uN,Eg)=>{"use strict";Eg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,b="i"+i,x=g.dataLevel=e.dataLevel+1,S="data"+x,A=e.baseId,R=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(n+="var "+d+" = errors;var "+m+";",R){var k=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=o,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+y+" = false; for (var "+b+" = 0; "+b+" < "+p+".length; "+b+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,b,e.opts.jsonPointers,!0);var O=p+"["+b+"]";g.dataPathArr[x]=b;var B=e.validate(g);g.baseId=A,e.util.varOccurences(B,S)<2?n+=" "+e.util.varReplace(B,S,O)+" ":n+=" var "+S+" = "+O+"; "+B+" ",n+=" if ("+y+") break; } ",e.compositeRule=g.compositeRule=k,n+=" "+f+" if (!"+y+") {"}else n+=" if ("+p+".length == 0) {";var P=P||[];P.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var G=n;return n=P.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+G+"]); ":n+=" validate.errors = ["+G+"]; return false; ":n+=" var err = "+G+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",R&&(n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(n+=" } "),n}});var Cg=ae((dN,kg)=>{"use strict";kg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y={},b={},x=e.opts.ownProperties;for(k in o)if(k!="__proto__"){var S=o[k],A=Array.isArray(S)?b:y;A[k]=S}n+="var "+m+" = errors;";var R=e.errorPath;n+="var missing"+i+";";for(var k in b)if(A=b[k],A.length){if(n+=" if ( "+p+e.util.getProperty(k)+" !== undefined ",x&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(k)+"') "),u){n+=" && ( ";var O=A;if(O)for(var B,P=-1,G=O.length-1;P<G;){B=O[P+=1],P&&(n+=" || ");var U=e.util.getProperty(B),M=p+U;n+=" ( ( "+M+" === undefined ",x&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?B:U)+") ) "}n+=")) { ";var T="missing"+i,I="' + "+T+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(R,T,!0):R+" + "+T);var F=F||[];F.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(k)+"', missingProperty: '"+I+"', depsCount: "+A.length+", deps: '"+e.util.escapeQuotes(A.length==1?A[0]:A.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",A.length==1?n+="property "+e.util.escapeQuotes(A[0]):n+="properties "+e.util.escapeQuotes(A.join(", ")),n+=" when property "+e.util.escapeQuotes(k)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Y=n;n=F.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Y+"]); ":n+=" validate.errors = ["+Y+"]; return false; ":n+=" var err = "+Y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{n+=" ) { ";var K=A;if(K)for(var B,ee=-1,Z=K.length-1;ee<Z;){B=K[ee+=1];var U=e.util.getProperty(B),I=e.util.escapeQuotes(B),M=p+U;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(R,B,e.opts.jsonPointers)),n+=" if ( "+M+" === undefined ",x&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(B)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(k)+"', missingProperty: '"+I+"', depsCount: "+A.length+", deps: '"+e.util.escapeQuotes(A.length==1?A[0]:A.join(", "))+"' } ",e.opts.messages!==!1&&(n+=" , message: 'should have ",A.length==1?n+="property "+e.util.escapeQuotes(A[0]):n+="properties "+e.util.escapeQuotes(A.join(", ")),n+=" when property "+e.util.escapeQuotes(k)+" is present' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}n+=" } ",u&&(g+="}",n+=" else { ")}e.errorPath=R;var _=d.baseId;for(var k in y){var S=y[k];(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all))&&(n+=" "+f+" = true; if ( "+p+e.util.getProperty(k)+" !== undefined ",x&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(k)+"') "),n+=") { ",d.schema=S,d.schemaPath=l+e.util.getProperty(k),d.errSchemaPath=c+"/"+e.util.escapeFragment(k),n+=" "+e.validate(d)+" ",d.baseId=_,n+=" } ",u&&(n+=" if ("+f+") { ",g+="}"))}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Tg=ae((pN,xg)=>{"use strict";xg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+i,d=e.opts.$data&&o&&o.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",g="schema"+i):g=o;var f="i"+i,y="schema"+i;d||(n+=" var "+y+" = validate.schema"+l+";"),n+="var "+m+";",d&&(n+=" if (schema"+i+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+i+")) "+m+" = false; else {"),n+=""+m+" = false;for (var "+f+"=0; "+f+"<"+y+".length; "+f+"++) if (equal("+p+", "+y+"["+f+"])) { "+m+" = true; break; }",d&&(n+=" } "),n+=" if (!"+m+") { ";var b=b||[];b.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+i+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;return n=b.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",u&&(n+=" else { "),n}});var Ig=ae((mN,Ag)=>{"use strict";Ag.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||"");if(e.opts.format===!1)return u&&(n+=" if (true) { "),n;var m=e.opts.$data&&o&&o.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+i):d=o;var g=e.opts.unknownFormats,f=Array.isArray(g);if(m){var y="format"+i,b="isObject"+i,x="formatType"+i;n+=" var "+y+" = formats["+d+"]; var "+b+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+x+" = "+b+" && "+y+".type || 'string'; if ("+b+") { ",e.async&&(n+=" var async"+i+" = "+y+".async; "),n+=" "+y+" = "+y+".validate; } if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" (",g!="ignore"&&(n+=" ("+d+" && !"+y+" ",f&&(n+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),n+=") || "),n+=" ("+y+" && "+x+" == '"+a+"' && !(typeof "+y+" == 'function' ? ",e.async?n+=" (async"+i+" ? await "+y+"("+p+") : "+y+"("+p+")) ":n+=" "+y+"("+p+") ",n+=" : "+y+".test("+p+"))))) {"}else{var y=e.formats[o];if(!y){if(g=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),u&&(n+=" if (true) { "),n;if(f&&g.indexOf(o)>=0)return u&&(n+=" if (true) { "),n;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var b=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,x=b&&y.type||"string";if(b){var S=y.async===!0;y=y.validate}if(x!=a)return u&&(n+=" if (true) { "),n;if(S){if(!e.async)throw new Error("async format in sync schema");var A="formats"+e.util.getProperty(o)+".validate";n+=" if (!(await "+A+"("+p+"))) { "}else{n+=" if (! ";var A="formats"+e.util.getProperty(o);b&&(A+=".validate"),typeof y=="function"?n+=" "+A+"("+p+") ":n+=" "+A+".test("+p+") ",n+=") { "}}var R=R||[];R.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",m?n+=""+d:n+=""+e.util.toQuotedString(o),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match format "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(o),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(o),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var k=n;return n=R.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+k+"]); ":n+=" validate.errors = ["+k+"]; return false; ":n+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var Pg=ae((hN,Rg)=>{"use strict";Rg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e);g.level++;var f="valid"+g.level,y=e.schema.then,b=e.schema.else,x=y!==void 0&&(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all)),S=b!==void 0&&(e.opts.strictKeywords?typeof b=="object"&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all)),A=g.baseId;if(x||S){var R;g.createErrors=!1,g.schema=o,g.schemaPath=l,g.errSchemaPath=c,n+=" var "+d+" = errors; var "+m+" = true; ";var k=e.compositeRule;e.compositeRule=g.compositeRule=!0,n+=" "+e.validate(g)+" ",g.baseId=A,g.createErrors=!0,n+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=k,x?(n+=" if ("+f+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",n+=" "+e.validate(g)+" ",g.baseId=A,n+=" "+m+" = "+f+"; ",x&&S?(R="ifClause"+i,n+=" var "+R+" = 'then'; "):R="'then'",n+=" } ",S&&(n+=" else { ")):n+=" if (!"+f+") { ",S&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",n+=" "+e.validate(g)+" ",g.baseId=A,n+=" "+m+" = "+f+"; ",x&&S?(R="ifClause"+i,n+=" var "+R+" = 'else'; "):R="'else'",n+=" } "),n+=" if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+R+" } ",e.opts.messages!==!1&&(n+=` , message: 'should match "' + `+R+` + '" schema' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var Ng=ae((gN,Dg)=>{"use strict";Dg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,b="i"+i,x=g.dataLevel=e.dataLevel+1,S="data"+x,A=e.baseId;if(n+="var "+d+" = errors;var "+m+";",Array.isArray(o)){var R=e.schema.additionalItems;if(R===!1){n+=" "+m+" = "+p+".length <= "+o.length+"; ";var k=c;c=e.errSchemaPath+"/additionalItems",n+=" if (!"+m+") { ";var O=O||[];O.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var B=n;n=O.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+B+"]); ":n+=" validate.errors = ["+B+"]; return false; ":n+=" var err = "+B+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",c=k,u&&(f+="}",n+=" else { ")}var P=o;if(P){for(var G,U=-1,M=P.length-1;U<M;)if(G=P[U+=1],e.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:e.util.schemaHasRules(G,e.RULES.all)){n+=" "+y+" = true; if ("+p+".length > "+U+") { ";var T=p+"["+U+"]";g.schema=G,g.schemaPath=l+"["+U+"]",g.errSchemaPath=c+"/"+U,g.errorPath=e.util.getPathExpr(e.errorPath,U,e.opts.jsonPointers,!0),g.dataPathArr[x]=U;var I=e.validate(g);g.baseId=A,e.util.varOccurences(I,S)<2?n+=" "+e.util.varReplace(I,S,T)+" ":n+=" var "+S+" = "+T+"; "+I+" ",n+=" } ",u&&(n+=" if ("+y+") { ",f+="}")}}if(typeof R=="object"&&(e.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:e.util.schemaHasRules(R,e.RULES.all))){g.schema=R,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+p+".length > "+o.length+") { for (var "+b+" = "+o.length+"; "+b+" < "+p+".length; "+b+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,b,e.opts.jsonPointers,!0);var T=p+"["+b+"]";g.dataPathArr[x]=b;var I=e.validate(g);g.baseId=A,e.util.varOccurences(I,S)<2?n+=" "+e.util.varReplace(I,S,T)+" ":n+=" var "+S+" = "+T+"; "+I+" ",u&&(n+=" if (!"+y+") break; "),n+=" } } ",u&&(n+=" if ("+y+") { ",f+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){g.schema=o,g.schemaPath=l,g.errSchemaPath=c,n+=" for (var "+b+" = 0; "+b+" < "+p+".length; "+b+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,b,e.opts.jsonPointers,!0);var T=p+"["+b+"]";g.dataPathArr[x]=b;var I=e.validate(g);g.baseId=A,e.util.varOccurences(I,S)<2?n+=" "+e.util.varReplace(I,S,T)+" ":n+=" var "+S+" = "+T+"; "+I+" ",u&&(n+=" if (!"+y+") break; "),n+=" }"}return u&&(n+=" "+f+" if ("+d+" == errors) {"),n}});var Bu=ae((fN,Mg)=>{"use strict";Mg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,A,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+i):d=o;var g=t=="maximum",f=g?"exclusiveMaximum":"exclusiveMinimum",y=e.schema[f],b=e.opts.$data&&y&&y.$data,x=g?"<":">",S=g?">":"<",A=void 0;if(!(m||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(b||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(f+" must be number or boolean");if(b){var R=e.util.getData(y.$data,s,e.dataPathArr),k="exclusive"+i,O="exclType"+i,B="exclIsNumber"+i,P="op"+i,G="' + "+P+" + '";n+=" var schemaExcl"+i+" = "+R+"; ",R="schemaExcl"+i,n+=" var "+k+"; var "+O+" = typeof "+R+"; if ("+O+" != 'boolean' && "+O+" != 'undefined' && "+O+" != 'number') { ";var A=f,U=U||[];U.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(A||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: '"+f+" should be boolean' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var M=n;n=U.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+M+"]); ":n+=" validate.errors = ["+M+"]; return false; ":n+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+O+" == 'number' ? ( ("+k+" = "+d+" === undefined || "+R+" "+x+"= "+d+") ? "+p+" "+S+"= "+R+" : "+p+" "+S+" "+d+" ) : ( ("+k+" = "+R+" === true) ? "+p+" "+S+"= "+d+" : "+p+" "+S+" "+d+" ) || "+p+" !== "+p+") { var op"+i+" = "+k+" ? '"+x+"' : '"+x+"='; ",o===void 0&&(A=f,c=e.errSchemaPath+"/"+f,d=R,m=b)}else{var B=typeof y=="number",G=x;if(B&&m){var P="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" ( "+d+" === undefined || "+y+" "+x+"= "+d+" ? "+p+" "+S+"= "+y+" : "+p+" "+S+" "+d+" ) || "+p+" !== "+p+") { "}else{B&&o===void 0?(k=!0,A=f,c=e.errSchemaPath+"/"+f,d=y,S+="="):(B&&(d=Math[g?"min":"max"](y,o)),y===(B?d:!0)?(k=!0,A=f,c=e.errSchemaPath+"/"+f,S+="="):(k=!1,G+="="));var P="'"+G+"'";n+=" if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+" "+S+" "+d+" || "+p+" !== "+p+") { "}}A=A||t;var U=U||[];U.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(A||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+P+", limit: "+d+", exclusive: "+k+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be "+G+" ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var M=n;return n=U.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+M+"]); ":n+=" validate.errors = ["+M+"]; return false; ":n+=" var err = "+M+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { "),n}});var Fu=ae((yN,Og)=>{"use strict";Og.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+i):d=o,!(m||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxItems"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" "+p+".length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxItems"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+o,n+=" items' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var b=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Gu=ae((bN,Lg)=>{"use strict";Lg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+i):d=o,!(m||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxLength"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?n+=" "+p+".length ":n+=" ucs2length("+p+") ",n+=" "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be ",t=="maxLength"?n+="longer":n+="shorter",n+=" than ",m?n+="' + "+d+" + '":n+=""+o,n+=" characters' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var b=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var zu=ae((vN,Bg)=>{"use strict";Bg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,f,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+i):d=o,!(m||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxProperties"?">":"<";n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),n+=" Object.keys("+p+").length "+g+" "+d+") { ";var f=t,y=y||[];y.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(f||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have ",t=="maxProperties"?n+="more":n+="fewer",n+=" than ",m?n+="' + "+d+" + '":n+=""+o,n+=" properties' "),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var b=n;return n=y.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var Gg=ae((_N,Fg)=>{"use strict";Fg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;if(m?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+i):d=o,!(m||typeof o=="number"))throw new Error(t+" must be number");n+="var division"+i+";if (",m&&(n+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),n+=" (division"+i+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":n+=" division"+i+" !== parseInt(division"+i+") ",n+=" ) ",m&&(n+=" ) "),n+=" ) { ";var g=g||[];g.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",m?n+="' + "+d:n+=""+d+"'"),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var f=n;return n=g.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++; ",n+="} ",u&&(n+=" else { "),n}});var Ug=ae((SN,zg)=>{"use strict";zg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="errs__"+i,d=e.util.copy(e);d.level++;var g="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c,n+=" var "+m+" = errors; ";var f=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var y;d.opts.allErrors&&(y=d.opts.allErrors,d.opts.allErrors=!1),n+=" "+e.validate(d)+" ",d.createErrors=!0,y&&(d.opts.allErrors=y),e.compositeRule=d.compositeRule=f,n+=" if ("+g+") { ";var b=b||[];b.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var x=n;n=b.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+x+"]); ":n+=" validate.errors = ["+x+"]; return false; ":n+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+m+"; if (vErrors !== null) { if ("+m+") vErrors.length = "+m+"; else vErrors = null; } ",e.opts.allErrors&&(n+=" } ")}else n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ");return n}});var Vg=ae((EN,Hg)=>{"use strict";Hg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+i,d="errs__"+i,g=e.util.copy(e),f="";g.level++;var y="valid"+g.level,b=g.baseId,x="prevValid"+i,S="passingSchemas"+i;n+="var "+d+" = errors , "+x+" = false , "+m+" = false , "+S+" = null; ";var A=e.compositeRule;e.compositeRule=g.compositeRule=!0;var R=o;if(R)for(var k,O=-1,B=R.length-1;O<B;)k=R[O+=1],(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))?(g.schema=k,g.schemaPath=l+"["+O+"]",g.errSchemaPath=c+"/"+O,n+=" "+e.validate(g)+" ",g.baseId=b):n+=" var "+y+" = true; ",O&&(n+=" if ("+y+" && "+x+") { "+m+" = false; "+S+" = ["+S+", "+O+"]; } else { ",f+="}"),n+=" if ("+y+") { "+m+" = "+x+" = true; "+S+" = "+O+"; }";return e.compositeRule=g.compositeRule=A,n+=""+f+"if (!"+m+") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+S+" } ",e.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(n+=" } "),n}});var Wg=ae((wN,jg)=>{"use strict";jg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m=e.opts.$data&&o&&o.$data,d;m?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",d="schema"+i):d=o;var g=m?"(new RegExp("+d+"))":e.usePattern(o);n+="if ( ",m&&(n+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),n+=" !"+g+".test("+p+") ) { ";var f=f||[];f.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",m?n+=""+d:n+=""+e.util.toQuotedString(o),n+=" } ",e.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,m?n+="' + "+d+" + '":n+=""+e.util.escapeQuotes(o),n+=`"' `),e.opts.verbose&&(n+=" , schema: ",m?n+="validate.schema"+l:n+=""+e.util.toQuotedString(o),n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var y=n;return n=f.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",u&&(n+=" else { "),n}});var $g=ae((kN,qg)=>{"use strict";qg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level,y="key"+i,b="idx"+i,x=d.dataLevel=e.dataLevel+1,S="data"+x,A="dataProperties"+i,R=Object.keys(o||{}).filter(ee),k=e.schema.patternProperties||{},O=Object.keys(k).filter(ee),B=e.schema.additionalProperties,P=R.length||O.length,G=B===!1,U=typeof B=="object"&&Object.keys(B).length,M=e.opts.removeAdditional,T=G||U||M,I=e.opts.ownProperties,F=e.baseId,Y=e.schema.required;if(Y&&!(e.opts.$data&&Y.$data)&&Y.length<e.opts.loopRequired)var K=e.util.toHash(Y);function ee(Q){return Q!=="__proto__"}if(n+="var "+m+" = errors;var "+f+" = true;",I&&(n+=" var "+A+" = undefined;"),T){if(I?n+=" "+A+" = "+A+" || Object.keys("+p+"); for (var "+b+"=0; "+b+"<"+A+".length; "+b+"++) { var "+y+" = "+A+"["+b+"]; ":n+=" for (var "+y+" in "+p+") { ",P){if(n+=" var isAdditional"+i+" = !(false ",R.length)if(R.length>8)n+=" || validate.schema"+l+".hasOwnProperty("+y+") ";else{var Z=R;if(Z)for(var _,ve=-1,Ne=Z.length-1;ve<Ne;)_=Z[ve+=1],n+=" || "+y+" == "+e.util.toQuotedString(_)+" "}if(O.length){var E=O;if(E)for(var se,Re=-1,Ve=E.length-1;Re<Ve;)se=E[Re+=1],n+=" || "+e.usePattern(se)+".test("+y+") "}n+=" ); if (isAdditional"+i+") { "}if(M=="all")n+=" delete "+p+"["+y+"]; ";else{var Xe=e.errorPath,Me="' + "+y+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers)),G)if(M)n+=" delete "+p+"["+y+"]; ";else{n+=" "+f+" = false; ";var _t=c;c=e.errSchemaPath+"/additionalProperties";var Ce=Ce||[];Ce.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Me+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is an invalid additional property":n+="should NOT have additional properties",n+="' "),e.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ae=n;n=Ce.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ae+"]); ":n+=" validate.errors = ["+Ae+"]; return false; ":n+=" var err = "+Ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=_t,u&&(n+=" break; ")}else if(U)if(M=="failing"){n+=" var "+m+" = errors; ";var Ct=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=B,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var Ye=p+"["+y+"]";d.dataPathArr[x]=y;var _e=e.validate(d);d.baseId=F,e.util.varOccurences(_e,S)<2?n+=" "+e.util.varReplace(_e,S,Ye)+" ":n+=" var "+S+" = "+Ye+"; "+_e+" ",n+=" if (!"+f+") { errors = "+m+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+y+"]; } ",e.compositeRule=d.compositeRule=Ct}else{d.schema=B,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var Ye=p+"["+y+"]";d.dataPathArr[x]=y;var _e=e.validate(d);d.baseId=F,e.util.varOccurences(_e,S)<2?n+=" "+e.util.varReplace(_e,S,Ye)+" ":n+=" var "+S+" = "+Ye+"; "+_e+" ",u&&(n+=" if (!"+f+") break; ")}e.errorPath=Xe}P&&(n+=" } "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}var ir=e.opts.useDefaults&&!e.compositeRule;if(R.length){var Ht=R;if(Ht)for(var _,Tr=-1,hr=Ht.length-1;Tr<hr;){_=Ht[Tr+=1];var Je=o[_];if(e.opts.strictKeywords?typeof Je=="object"&&Object.keys(Je).length>0||Je===!1:e.util.schemaHasRules(Je,e.RULES.all)){var xt=e.util.getProperty(_),Ye=p+xt,mt=ir&&Je.default!==void 0;d.schema=Je,d.schemaPath=l+xt,d.errSchemaPath=c+"/"+e.util.escapeFragment(_),d.errorPath=e.util.getPath(e.errorPath,_,e.opts.jsonPointers),d.dataPathArr[x]=e.util.toQuotedString(_);var _e=e.validate(d);if(d.baseId=F,e.util.varOccurences(_e,S)<2){_e=e.util.varReplace(_e,S,Ye);var ot=Ye}else{var ot=S;n+=" var "+S+" = "+Ye+"; "}if(mt)n+=" "+_e+" ";else{if(K&&K[_]){n+=" if ( "+ot+" === undefined ",I&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = false; ";var Xe=e.errorPath,_t=c,Vt=e.util.escapeQuotes(_);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Xe,_,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var Ce=Ce||[];Ce.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+Vt+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+Vt+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var Ae=n;n=Ce.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+Ae+"]); ":n+=" validate.errors = ["+Ae+"]; return false; ":n+=" var err = "+Ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=_t,e.errorPath=Xe,n+=" } else { "}else u?(n+=" if ( "+ot+" === undefined ",I&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=") { "+f+" = true; } else { "):(n+=" if ("+ot+" !== undefined ",I&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(_)+"') "),n+=" ) { ");n+=" "+_e+" } "}}u&&(n+=" if ("+f+") { ",g+="}")}}if(O.length){var St=O;if(St)for(var se,L=-1,j=St.length-1;L<j;){se=St[L+=1];var Je=k[se];if(e.opts.strictKeywords?typeof Je=="object"&&Object.keys(Je).length>0||Je===!1:e.util.schemaHasRules(Je,e.RULES.all)){d.schema=Je,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),I?n+=" "+A+" = "+A+" || Object.keys("+p+"); for (var "+b+"=0; "+b+"<"+A+".length; "+b+"++) { var "+y+" = "+A+"["+b+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" if ("+e.usePattern(se)+".test("+y+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,y,e.opts.jsonPointers);var Ye=p+"["+y+"]";d.dataPathArr[x]=y;var _e=e.validate(d);d.baseId=F,e.util.varOccurences(_e,S)<2?n+=" "+e.util.varReplace(_e,S,Ye)+" ":n+=" var "+S+" = "+Ye+"; "+_e+" ",u&&(n+=" if (!"+f+") break; "),n+=" } ",u&&(n+=" else "+f+" = true; "),n+=" } ",u&&(n+=" if ("+f+") { ",g+="}")}}}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Xg=ae((CN,Kg)=>{"use strict";Kg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="errs__"+i,d=e.util.copy(e),g="";d.level++;var f="valid"+d.level;if(n+="var "+m+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=l,d.errSchemaPath=c;var y="key"+i,b="idx"+i,x="i"+i,S="' + "+y+" + '",A=d.dataLevel=e.dataLevel+1,R="data"+A,k="dataProperties"+i,O=e.opts.ownProperties,B=e.baseId;O&&(n+=" var "+k+" = undefined; "),O?n+=" "+k+" = "+k+" || Object.keys("+p+"); for (var "+b+"=0; "+b+"<"+k+".length; "+b+"++) { var "+y+" = "+k+"["+b+"]; ":n+=" for (var "+y+" in "+p+") { ",n+=" var startErrs"+i+" = errors; ";var P=y,G=e.compositeRule;e.compositeRule=d.compositeRule=!0;var U=e.validate(d);d.baseId=B,e.util.varOccurences(U,R)<2?n+=" "+e.util.varReplace(U,R,P)+" ":n+=" var "+R+" = "+P+"; "+U+" ",e.compositeRule=d.compositeRule=G,n+=" if (!"+f+") { for (var "+x+"=startErrs"+i+"; "+x+"<errors; "+x+"++) { vErrors["+x+"].propertyName = "+y+"; } var err = ",e.createErrors!==!1?(n+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+S+"' } ",e.opts.messages!==!1&&(n+=" , message: 'property name \\'"+S+"\\' is invalid' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),u&&(n+=" break; "),n+=" } }"}return u&&(n+=" "+g+" if ("+m+" == errors) {"),n}});var Jg=ae((xN,Yg)=>{"use strict";Yg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+i,d=e.opts.$data&&o&&o.$data,g;d?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",g="schema"+i):g=o;var f="schema"+i;if(!d)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var y=[],b=o;if(b)for(var x,S=-1,A=b.length-1;S<A;){x=b[S+=1];var R=e.schema.properties[x];R&&(e.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:e.util.schemaHasRules(R,e.RULES.all))||(y[y.length]=x)}}else var y=o;if(d||y.length){var k=e.errorPath,O=d||y.length>=e.opts.loopRequired,B=e.opts.ownProperties;if(u)if(n+=" var missing"+i+"; ",O){d||(n+=" var "+f+" = validate.schema"+l+"; ");var P="i"+i,G="schema"+i+"["+P+"]",U="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,G,e.opts.jsonPointers)),n+=" var "+m+" = true; ",d&&(n+=" if (schema"+i+" === undefined) "+m+" = true; else if (!Array.isArray(schema"+i+")) "+m+" = false; else {"),n+=" for (var "+P+" = 0; "+P+" < "+f+".length; "+P+"++) { "+m+" = "+p+"["+f+"["+P+"]] !== undefined ",B&&(n+=" && Object.prototype.hasOwnProperty.call("+p+", "+f+"["+P+"]) "),n+="; if (!"+m+") break; } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var M=M||[];M.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;n=M.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var I=y;if(I)for(var F,P=-1,Y=I.length-1;P<Y;){F=I[P+=1],P&&(n+=" || ");var K=e.util.getProperty(F),ee=p+K;n+=" ( ( "+ee+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") && (missing"+i+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:K)+") ) "}n+=") { ";var G="missing"+i,U="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(k,G,!0):k+" + "+G);var M=M||[];M.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var T=n;n=M.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+T+"]); ":n+=" validate.errors = ["+T+"]; return false; ":n+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else if(O){d||(n+=" var "+f+" = validate.schema"+l+"; ");var P="i"+i,G="schema"+i+"["+P+"]",U="' + "+G+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(k,G,e.opts.jsonPointers)),d&&(n+=" if ("+f+" && !Array.isArray("+f+")) { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+f+" !== undefined) { "),n+=" for (var "+P+" = 0; "+P+" < "+f+".length; "+P+"++) { if ("+p+"["+f+"["+P+"]] === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+f+"["+P+"]) "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(n+=" } ")}else{var Z=y;if(Z)for(var F,_=-1,ve=Z.length-1;_<ve;){F=Z[_+=1];var K=e.util.getProperty(F),U=e.util.escapeQuotes(F),ee=p+K;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(k,F,e.opts.jsonPointers)),n+=" if ( "+ee+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),n+=") { var err = ",e.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+U+"' } ",e.opts.messages!==!1&&(n+=" , message: '",e.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+U+"\\'",n+="' "),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=k}else u&&(n+=" if (true) {");return n}});var Qg=ae((TN,Zg)=>{"use strict";Zg.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(s||""),m="valid"+i,d=e.opts.$data&&o&&o.$data,g;if(d?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",g="schema"+i):g=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(n+=" var "+m+"; if ("+g+" === false || "+g+" === undefined) "+m+" = true; else if (typeof "+g+" != 'boolean') "+m+" = false; else { "),n+=" var i = "+p+".length , "+m+" = true , j; if (i > 1) { ";var f=e.schema.items&&e.schema.items.type,y=Array.isArray(f);if(!f||f=="object"||f=="array"||y&&(f.indexOf("object")>=0||f.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+m+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var b="checkDataType"+(y?"s":"");n+=" if ("+e.util[b](f,"item",e.opts.strictNumbers,!0)+") continue; ",y&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+m+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",d&&(n+=" } "),n+=" if (!"+m+") { ";var x=x||[];x.push(n),n="",e.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(n+=" , schema: ",d?n+="validate.schema"+l:n+=""+o,n+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),n+=" } "):n+=" {} ";var S=n;n=x.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+S+"]); ":n+=" validate.errors = ["+S+"]; return false; ":n+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u&&(n+=" else { ")}else u&&(n+=" if (true) { ");return n}});var tf=ae((AN,ef)=>{"use strict";ef.exports={$ref:mg(),allOf:gg(),anyOf:yg(),$comment:vg(),const:Sg(),contains:wg(),dependencies:Cg(),enum:Tg(),format:Ig(),if:Pg(),items:Ng(),maximum:Bu(),minimum:Bu(),maxItems:Fu(),minItems:Fu(),maxLength:Gu(),minLength:Gu(),maxProperties:zu(),minProperties:zu(),multipleOf:Gg(),not:Ug(),oneOf:Vg(),pattern:Wg(),properties:$g(),propertyNames:Xg(),required:Jg(),uniqueItems:Qg(),validate:Ou()}});var af=ae((IN,nf)=>{"use strict";var rf=tf(),Uu=qn().toHash;nf.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"],a=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],n=["number","integer","string","array","object","boolean","null"];return e.all=Uu(t),e.types=Uu(n),e.forEach(function(i){i.rules=i.rules.map(function(s){var o;if(typeof s=="object"){var l=Object.keys(s)[0];o=s[l],s=l,o.forEach(function(u){t.push(u),e.all[u]=!0})}t.push(s);var c=e.all[s]={keyword:s,code:rf[s],implements:o};return c}),e.all.$comment={keyword:"$comment",code:rf.$comment},i.type&&(e.types[i.type]=i)}),e.keywords=Uu(t.concat(a)),e.custom={},e}});var lf=ae((RN,of)=>{"use strict";var sf=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];of.exports=function(r,e){for(var t=0;t<e.length;t++){r=JSON.parse(JSON.stringify(r));var a=e[t].split("/"),n=r,i;for(i=1;i<a.length;i++)n=n[a[i]];for(i=0;i<sf.length;i++){var s=sf[i],o=n[s];o&&(n[s]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return r}});var df=ae((PN,uf)=>{"use strict";var Ik=Go().MissingRef;uf.exports=cf;function cf(r,e,t){var a=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var n=i(r).then(function(){var o=a._addSchema(r,void 0,e);return o.validate||s(o)});return t&&n.then(function(o){t(null,o)},t),n;function i(o){var l=o.$schema;return l&&!a.getSchema(l)?cf.call(a,{$ref:l},!0):Promise.resolve()}function s(o){try{return a._compile(o)}catch(c){if(c instanceof Ik)return l(c);throw c}function l(c){var u=c.missingSchema;if(d(u))throw new Error("Schema "+u+" is loaded but "+c.missingRef+" cannot be resolved");var p=a._loadingSchemas[u];return p||(p=a._loadingSchemas[u]=a._opts.loadSchema(u),p.then(m,m)),p.then(function(g){if(!d(u))return i(g).then(function(){d(u)||a.addSchema(g,u,void 0,e)})}).then(function(){return s(o)});function m(){delete a._loadingSchemas[u]}function d(g){return a._refs[g]||a._schemas[g]}}}}});var mf=ae((DN,pf)=>{"use strict";pf.exports=function(e,t,a){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],l=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p,m="data"+(s||""),d="valid"+i,g="errs__"+i,f=e.opts.$data&&o&&o.$data,y;f?(n+=" var schema"+i+" = "+e.util.getData(o.$data,s,e.dataPathArr)+"; ",y="schema"+i):y=o;var b=this,x="definition"+i,S=b.definition,A="",R,k,O,B,P;if(f&&S.$data){P="keywordValidate"+i;var G=S.validateSchema;n+=" var "+x+" = RULES.custom['"+t+"'].definition; var "+P+" = "+x+".validate;"}else{if(B=e.useCustomRule(b,o,e.schema,e),!B)return;y="validate.schema"+l,P=B.code,R=S.compile,k=S.inline,O=S.macro}var U=P+".errors",M="i"+i,T="ruleErr"+i,I=S.async;if(I&&!e.async)throw new Error("async keyword in sync schema");if(k||O||(n+=""+U+" = null;"),n+="var "+g+" = errors;var "+d+";",f&&S.$data&&(A+="}",n+=" if ("+y+" === undefined) { "+d+" = true; } else { ",G&&(A+="}",n+=" "+d+" = "+x+".validateSchema("+y+"); if ("+d+") { ")),k)S.statements?n+=" "+B.validate+" ":n+=" "+d+" = "+B.validate+"; ";else if(O){var F=e.util.copy(e),A="";F.level++;var Y="valid"+F.level;F.schema=B.validate,F.schemaPath="";var K=e.compositeRule;e.compositeRule=F.compositeRule=!0;var ee=e.validate(F).replace(/validate\.schema/g,P);e.compositeRule=F.compositeRule=K,n+=" "+ee}else{var Z=Z||[];Z.push(n),n="",n+=" "+P+".call( ",e.opts.passContext?n+="this":n+="self",R||S.schema===!1?n+=" , "+m+" ":n+=" , "+y+" , "+m+" , validate.schema"+e.schemaPath+" ",n+=" , (dataPath || '')",e.errorPath!='""'&&(n+=" + "+e.errorPath);var _=s?"data"+(s-1||""):"parentData",ve=s?e.dataPathArr[s]:"parentDataProperty";n+=" , "+_+" , "+ve+" , rootData ) ";var Ne=n;n=Z.pop(),S.errors===!1?(n+=" "+d+" = ",I&&(n+="await "),n+=""+Ne+"; "):I?(U="customErrors"+i,n+=" var "+U+" = null; try { "+d+" = await "+Ne+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+U+" = e.errors; else throw e; } "):n+=" "+U+" = null; "+d+" = "+Ne+"; "}if(S.modifying&&(n+=" if ("+_+") "+m+" = "+_+"["+ve+"];"),n+=""+A,S.valid)u&&(n+=" if (true) { ");else{n+=" if ( ",S.valid===void 0?(n+=" !",O?n+=""+Y:n+=""+d):n+=" "+!S.valid+" ",n+=") { ",p=b.keyword;var Z=Z||[];Z.push(n),n="";var Z=Z||[];Z.push(n),n="",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+b.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+b.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var E=n;n=Z.pop(),!e.compositeRule&&u?e.async?n+=" throw new ValidationError(["+E+"]); ":n+=" validate.errors = ["+E+"]; return false; ":n+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=n;n=Z.pop(),k?S.errors?S.errors!="full"&&(n+=" for (var "+M+"="+g+"; "+M+"<errors; "+M+"++) { var "+T+" = vErrors["+M+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+T+".schemaPath === undefined) { "+T+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+T+".schema = "+y+"; "+T+".data = "+m+"; "),n+=" } "):S.errors===!1?n+=" "+se+" ":(n+=" if ("+g+" == errors) { "+se+" } else { for (var "+M+"="+g+"; "+M+"<errors; "+M+"++) { var "+T+" = vErrors["+M+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+T+".schemaPath === undefined) { "+T+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(n+=" "+T+".schema = "+y+"; "+T+".data = "+m+"; "),n+=" } } "):O?(n+=" var err = ",e.createErrors!==!1?(n+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+b.keyword+"' } ",e.opts.messages!==!1&&(n+=` , message: 'should pass "`+b.keyword+`" keyword validation' `),e.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&u&&(e.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; ")):S.errors===!1?n+=" "+se+" ":(n+=" if (Array.isArray("+U+")) { if (vErrors === null) vErrors = "+U+"; else vErrors = vErrors.concat("+U+"); errors = vErrors.length; for (var "+M+"="+g+"; "+M+"<errors; "+M+"++) { var "+T+" = vErrors["+M+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+e.errorPath+"; "+T+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(n+=" "+T+".schema = "+y+"; "+T+".data = "+m+"; "),n+=" } } else { "+se+" } "),n+=" } ",u&&(n+=" else { ")}return n}});var Hu=ae((NN,Rk)=>{Rk.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var ff=ae((MN,gf)=>{"use strict";var hf=Hu();gf.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:hf.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:hf.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var bf=ae((ON,yf)=>{"use strict";var Pk=/^[a-z_$][a-z0-9_$-]*$/i,Dk=mf(),Nk=ff();yf.exports={add:Mk,get:Ok,remove:Lk,validate:Vu};function Mk(r,e){var t=this.RULES;if(t.keywords[r])throw new Error("Keyword "+r+" is already defined");if(!Pk.test(r))throw new Error("Keyword "+r+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var a=e.type;if(Array.isArray(a))for(var n=0;n<a.length;n++)s(r,a[n],e);else s(r,a,e);var i=e.metaSchema;i&&(e.$data&&this._opts.$data&&(i={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(i,!0))}t.keywords[r]=t.all[r]=!0;function s(o,l,c){for(var u,p=0;p<t.length;p++){var m=t[p];if(m.type==l){u=m;break}}u||(u={type:l,rules:[]},t.push(u));var d={keyword:o,definition:c,custom:!0,code:Dk,implements:c.implements};u.rules.push(d),t.custom[o]=d}return this}function Ok(r){var e=this.RULES.custom[r];return e?e.definition:this.RULES.keywords[r]||!1}function Lk(r){var e=this.RULES;delete e.keywords[r],delete e.all[r],delete e.custom[r];for(var t=0;t<e.length;t++)for(var a=e[t].rules,n=0;n<a.length;n++)if(a[n].keyword==r){a.splice(n,1);break}return this}function Vu(r,e){Vu.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Nk,!0);if(t(r))return!0;if(Vu.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var vf=ae((LN,Bk)=>{Bk.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var If=ae((BN,Af)=>{"use strict";var Sf=Jh(),$n=Fo(),Fk=Qh(),Ef=Au(),Gk=Mu(),zk=dg(),Uk=af(),wf=lf(),kf=qn();Af.exports=je;je.prototype.validate=Vk;je.prototype.compile=jk;je.prototype.addSchema=Wk;je.prototype.addMetaSchema=qk;je.prototype.validateSchema=$k;je.prototype.getSchema=Xk;je.prototype.removeSchema=Jk;je.prototype.addFormat=iC;je.prototype.errorsText=aC;je.prototype._addSchema=Zk;je.prototype._compile=Qk;je.prototype.compileAsync=df();var $o=bf();je.prototype.addKeyword=$o.add;je.prototype.getKeyword=$o.get;je.prototype.removeKeyword=$o.remove;je.prototype.validateKeyword=$o.validate;var Cf=Go();je.ValidationError=Cf.Validation;je.MissingRefError=Cf.MissingRef;je.$dataMetaSchema=wf;var qo="http://json-schema.org/draft-07/schema",_f=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Hk=["/properties"];function je(r){if(!(this instanceof je))return new je(r);r=this._opts=kf.copy(r)||{},dC(this),this._schemas={},this._refs={},this._fragments={},this._formats=zk(r.format),this._cache=r.cache||new Fk,this._loadingSchemas={},this._compilations=[],this.RULES=Uk(),this._getId=eC(r),r.loopRequired=r.loopRequired||1/0,r.errorDataPath=="property"&&(r._errorDataPathProperty=!0),r.serialize===void 0&&(r.serialize=Gk),this._metaOpts=uC(this),r.formats&&lC(this),r.keywords&&cC(this),sC(this),typeof r.meta=="object"&&this.addMetaSchema(r.meta),r.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),oC(this)}function Vk(r,e){var t;if(typeof r=="string"){if(t=this.getSchema(r),!t)throw new Error('no schema with key or ref "'+r+'"')}else{var a=this._addSchema(r);t=a.validate||this._compile(a)}var n=t(e);return t.$async!==!0&&(this.errors=t.errors),n}function jk(r,e){var t=this._addSchema(r,void 0,e);return t.validate||this._compile(t)}function Wk(r,e,t,a){if(Array.isArray(r)){for(var n=0;n<r.length;n++)this.addSchema(r[n],void 0,t,a);return this}var i=this._getId(r);if(i!==void 0&&typeof i!="string")throw new Error("schema id must be string");return e=$n.normalizeId(e||i),Tf(this,e),this._schemas[e]=this._addSchema(r,t,a,!0),this}function qk(r,e,t){return this.addSchema(r,e,t,!0),this}function $k(r,e){var t=r.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||Kk(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var a=this.validate(t,r);if(!a&&e){var n="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(n);else throw new Error(n)}return a}function Kk(r){var e=r._opts.meta;return r._opts.defaultMeta=typeof e=="object"?r._getId(e)||e:r.getSchema(qo)?qo:void 0,r._opts.defaultMeta}function Xk(r){var e=xf(this,r);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Yk(this,r)}}function Yk(r,e){var t=$n.schema.call(r,{schema:{}},e);if(t){var a=t.schema,n=t.root,i=t.baseId,s=Sf.call(r,a,n,void 0,i);return r._fragments[e]=new Ef({ref:e,fragment:!0,schema:a,root:n,baseId:i,validate:s}),s}}function xf(r,e){return e=$n.normalizeId(e),r._schemas[e]||r._refs[e]||r._fragments[e]}function Jk(r){if(r instanceof RegExp)return Wo(this,this._schemas,r),Wo(this,this._refs,r),this;switch(typeof r){case"undefined":return Wo(this,this._schemas),Wo(this,this._refs),this._cache.clear(),this;case"string":var e=xf(this,r);return e&&this._cache.del(e.cacheKey),delete this._schemas[r],delete this._refs[r],this;case"object":var t=this._opts.serialize,a=t?t(r):r;this._cache.del(a);var n=this._getId(r);n&&(n=$n.normalizeId(n),delete this._schemas[n],delete this._refs[n])}return this}function Wo(r,e,t){for(var a in e){var n=e[a];!n.meta&&(!t||t.test(a))&&(r._cache.del(n.cacheKey),delete e[a])}}function Zk(r,e,t,a){if(typeof r!="object"&&typeof r!="boolean")throw new Error("schema should be object or boolean");var n=this._opts.serialize,i=n?n(r):r,s=this._cache.get(i);if(s)return s;a=a||this._opts.addUsedSchema!==!1;var o=$n.normalizeId(this._getId(r));o&&a&&Tf(this,o);var l=this._opts.validateSchema!==!1&&!e,c;l&&!(c=o&&o==$n.normalizeId(r.$schema))&&this.validateSchema(r,!0);var u=$n.ids.call(this,r),p=new Ef({id:o,schema:r,localRefs:u,cacheKey:i,meta:t});return o[0]!="#"&&a&&(this._refs[o]=p),this._cache.put(i,p),l&&c&&this.validateSchema(r,!0),p}function Qk(r,e){if(r.compiling)return r.validate=n,n.schema=r.schema,n.errors=null,n.root=e||n,r.schema.$async===!0&&(n.$async=!0),n;r.compiling=!0;var t;r.meta&&(t=this._opts,this._opts=this._metaOpts);var a;try{a=Sf.call(this,r.schema,e,r.localRefs)}catch(i){throw delete r.validate,i}finally{r.compiling=!1,r.meta&&(this._opts=t)}return r.validate=a,r.refs=a.refs,r.refVal=a.refVal,r.root=a.root,a;function n(){var i=r.validate,s=i.apply(this,arguments);return n.errors=i.errors,s}}function eC(r){switch(r.schemaId){case"auto":return nC;case"id":return tC;default:return rC}}function tC(r){return r.$id&&this.logger.warn("schema $id ignored",r.$id),r.id}function rC(r){return r.id&&this.logger.warn("schema id ignored",r.id),r.$id}function nC(r){if(r.$id&&r.id&&r.$id!=r.id)throw new Error("schema $id is different from id");return r.$id||r.id}function aC(r,e){if(r=r||this.errors,!r)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,a=e.dataVar===void 0?"data":e.dataVar,n="",i=0;i<r.length;i++){var s=r[i];s&&(n+=a+s.dataPath+" "+s.message+t)}return n.slice(0,-t.length)}function iC(r,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[r]=e,this}function sC(r){var e;if(r._opts.$data&&(e=vf(),r.addMetaSchema(e,e.$id,!0)),r._opts.meta!==!1){var t=Hu();r._opts.$data&&(t=wf(t,Hk)),r.addMetaSchema(t,qo,!0),r._refs["http://json-schema.org/schema"]=qo}}function oC(r){var e=r._opts.schemas;if(e)if(Array.isArray(e))r.addSchema(e);else for(var t in e)r.addSchema(e[t],t)}function lC(r){for(var e in r._opts.formats){var t=r._opts.formats[e];r.addFormat(e,t)}}function cC(r){for(var e in r._opts.keywords){var t=r._opts.keywords[e];r.addKeyword(e,t)}}function Tf(r,e){if(r._schemas[e]||r._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function uC(r){for(var e=kf.copy(r._opts),t=0;t<_f.length;t++)delete e[_f[t]];return e}function dC(r){var e=r._opts.logger;if(e===!1)r.logger={log:ju,warn:ju,error:ju};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");r.logger=e}}function ju(){}});var jb=ae((w3,Vb)=>{"use strict";var Wl=Object.prototype.hasOwnProperty,Hb=Object.prototype.toString,Lb=Object.defineProperty,Bb=Object.getOwnPropertyDescriptor,Fb=function(e){return typeof Array.isArray=="function"?Array.isArray(e):Hb.call(e)==="[object Array]"},Gb=function(e){if(!e||Hb.call(e)!=="[object Object]")return!1;var t=Wl.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&Wl.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!a)return!1;var n;for(n in e);return typeof n>"u"||Wl.call(e,n)},zb=function(e,t){Lb&&t.name==="__proto__"?Lb(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Ub=function(e,t){if(t==="__proto__")if(Wl.call(e,t)){if(Bb)return Bb(e,t).value}else return;return e[t]};Vb.exports=function r(){var e,t,a,n,i,s,o=arguments[0],l=1,c=arguments.length,u=!1;for(typeof o=="boolean"&&(u=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<c;++l)if(e=arguments[l],e!=null)for(t in e)a=Ub(o,t),n=Ub(e,t),o!==n&&(u&&n&&(Gb(n)||(i=Fb(n)))?(i?(i=!1,s=a&&Fb(a)?a:[]):s=a&&Gb(a)?a:{},zb(o,{name:t,newValue:r(u,s,n)})):typeof n<"u"&&zb(o,{name:t,newValue:n}));return o}});var mv=ae(be=>{"use strict";var _s=Symbol.for("react.element"),oI=Symbol.for("react.portal"),lI=Symbol.for("react.fragment"),cI=Symbol.for("react.strict_mode"),uI=Symbol.for("react.profiler"),dI=Symbol.for("react.provider"),pI=Symbol.for("react.context"),mI=Symbol.for("react.forward_ref"),hI=Symbol.for("react.suspense"),gI=Symbol.for("react.memo"),fI=Symbol.for("react.lazy"),rv=Symbol.iterator;function yI(r){return r===null||typeof r!="object"?null:(r=rv&&r[rv]||r["@@iterator"],typeof r=="function"?r:null)}var iv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},sv=Object.assign,ov={};function ui(r,e,t){this.props=r,this.context=e,this.refs=ov,this.updater=t||iv}ui.prototype.isReactComponent={};ui.prototype.setState=function(r,e){if(typeof r!="object"&&typeof r!="function"&&r!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,r,e,"setState")};ui.prototype.forceUpdate=function(r){this.updater.enqueueForceUpdate(this,r,"forceUpdate")};function lv(){}lv.prototype=ui.prototype;function hp(r,e,t){this.props=r,this.context=e,this.refs=ov,this.updater=t||iv}var gp=hp.prototype=new lv;gp.constructor=hp;sv(gp,ui.prototype);gp.isPureReactComponent=!0;var nv=Array.isArray,cv=Object.prototype.hasOwnProperty,fp={current:null},uv={key:!0,ref:!0,__self:!0,__source:!0};function dv(r,e,t){var a,n={},i=null,s=null;if(e!=null)for(a in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)cv.call(e,a)&&!uv.hasOwnProperty(a)&&(n[a]=e[a]);var o=arguments.length-2;if(o===1)n.children=t;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];n.children=l}if(r&&r.defaultProps)for(a in o=r.defaultProps,o)n[a]===void 0&&(n[a]=o[a]);return{$$typeof:_s,type:r,key:i,ref:s,props:n,_owner:fp.current}}function bI(r,e){return{$$typeof:_s,type:r.type,key:e,ref:r.ref,props:r.props,_owner:r._owner}}function yp(r){return typeof r=="object"&&r!==null&&r.$$typeof===_s}function vI(r){var e={"=":"=0",":":"=2"};return"$"+r.replace(/[=:]/g,function(t){return e[t]})}var av=/\/+/g;function mp(r,e){return typeof r=="object"&&r!==null&&r.key!=null?vI(""+r.key):e.toString(36)}function lc(r,e,t,a,n){var i=typeof r;(i==="undefined"||i==="boolean")&&(r=null);var s=!1;if(r===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(r.$$typeof){case _s:case oI:s=!0}}if(s)return s=r,n=n(s),r=a===""?"."+mp(s,0):a,nv(n)?(t="",r!=null&&(t=r.replace(av,"$&/")+"/"),lc(n,e,t,"",function(c){return c})):n!=null&&(yp(n)&&(n=bI(n,t+(!n.key||s&&s.key===n.key?"":(""+n.key).replace(av,"$&/")+"/")+r)),e.push(n)),1;if(s=0,a=a===""?".":a+":",nv(r))for(var o=0;o<r.length;o++){i=r[o];var l=a+mp(i,o);s+=lc(i,e,t,l,n)}else if(l=yI(r),typeof l=="function")for(r=l.call(r),o=0;!(i=r.next()).done;)i=i.value,l=a+mp(i,o++),s+=lc(i,e,t,l,n);else if(i==="object")throw e=String(r),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return s}function oc(r,e,t){if(r==null)return r;var a=[],n=0;return lc(r,a,"","",function(i){return e.call(t,i,n++)}),a}function _I(r){if(r._status===-1){var e=r._result;e=e(),e.then(function(t){(r._status===0||r._status===-1)&&(r._status=1,r._result=t)},function(t){(r._status===0||r._status===-1)&&(r._status=2,r._result=t)}),r._status===-1&&(r._status=0,r._result=e)}if(r._status===1)return r._result.default;throw r._result}var kt={current:null},cc={transition:null},SI={ReactCurrentDispatcher:kt,ReactCurrentBatchConfig:cc,ReactCurrentOwner:fp};function pv(){throw Error("act(...) is not supported in production builds of React.")}be.Children={map:oc,forEach:function(r,e,t){oc(r,function(){e.apply(this,arguments)},t)},count:function(r){var e=0;return oc(r,function(){e++}),e},toArray:function(r){return oc(r,function(e){return e})||[]},only:function(r){if(!yp(r))throw Error("React.Children.only expected to receive a single React element child.");return r}};be.Component=ui;be.Fragment=lI;be.Profiler=uI;be.PureComponent=hp;be.StrictMode=cI;be.Suspense=hI;be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=SI;be.act=pv;be.cloneElement=function(r,e,t){if(r==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+r+".");var a=sv({},r.props),n=r.key,i=r.ref,s=r._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,s=fp.current),e.key!==void 0&&(n=""+e.key),r.type&&r.type.defaultProps)var o=r.type.defaultProps;for(l in e)cv.call(e,l)&&!uv.hasOwnProperty(l)&&(a[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)a.children=t;else if(1<l){o=Array(l);for(var c=0;c<l;c++)o[c]=arguments[c+2];a.children=o}return{$$typeof:_s,type:r.type,key:n,ref:i,props:a,_owner:s}};be.createContext=function(r){return r={$$typeof:pI,_currentValue:r,_currentValue2:r,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},r.Provider={$$typeof:dI,_context:r},r.Consumer=r};be.createElement=dv;be.createFactory=function(r){var e=dv.bind(null,r);return e.type=r,e};be.createRef=function(){return{current:null}};be.forwardRef=function(r){return{$$typeof:mI,render:r}};be.isValidElement=yp;be.lazy=function(r){return{$$typeof:fI,_payload:{_status:-1,_result:r},_init:_I}};be.memo=function(r,e){return{$$typeof:gI,type:r,compare:e===void 0?null:e}};be.startTransition=function(r){var e=cc.transition;cc.transition={};try{r()}finally{cc.transition=e}};be.unstable_act=pv;be.useCallback=function(r,e){return kt.current.useCallback(r,e)};be.useContext=function(r){return kt.current.useContext(r)};be.useDebugValue=function(){};be.useDeferredValue=function(r){return kt.current.useDeferredValue(r)};be.useEffect=function(r,e){return kt.current.useEffect(r,e)};be.useId=function(){return kt.current.useId()};be.useImperativeHandle=function(r,e,t){return kt.current.useImperativeHandle(r,e,t)};be.useInsertionEffect=function(r,e){return kt.current.useInsertionEffect(r,e)};be.useLayoutEffect=function(r,e){return kt.current.useLayoutEffect(r,e)};be.useMemo=function(r,e){return kt.current.useMemo(r,e)};be.useReducer=function(r,e,t){return kt.current.useReducer(r,e,t)};be.useRef=function(r){return kt.current.useRef(r)};be.useState=function(r){return kt.current.useState(r)};be.useSyncExternalStore=function(r,e,t){return kt.current.useSyncExternalStore(r,e,t)};be.useTransition=function(){return kt.current.useTransition()};be.version="18.3.1"});var gv=ae((QH,hv)=>{"use strict";hv.exports=mv()});var ct=[];for(Cs=0;Cs<256;++Cs)ct.push((Cs+256).toString(16).slice(1));var Cs;function xp(r,e=0){return(ct[r[e+0]]+ct[r[e+1]]+ct[r[e+2]]+ct[r[e+3]]+"-"+ct[r[e+4]]+ct[r[e+5]]+"-"+ct[r[e+6]]+ct[r[e+7]]+"-"+ct[r[e+8]]+ct[r[e+9]]+"-"+ct[r[e+10]]+ct[r[e+11]]+ct[r[e+12]]+ct[r[e+13]]+ct[r[e+14]]+ct[r[e+15]]).toLowerCase()}var xs,Dv=new Uint8Array(16);function gc(){if(!xs&&(xs=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!xs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xs(Dv)}var Nv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),fc={randomUUID:Nv};function Mv(r,e,t){if(fc.randomUUID&&!e&&!r)return fc.randomUUID();r=r||{};var a=r.random||(r.rng||gc)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){t=t||0;for(var n=0;n<16;++n)e[t+n]=a[n];return e}return xp(a)}var $t=Mv;function yc(r){let e=(r||"").split(`
|
|
2
2
|
`);for(;e.length>0&&e[0].trim()=="";)e.shift();for(;e.length>0&&e[e.length-1].trim()=="";)e.pop();let t=1/0;for(let a of e){let n=a.match(/^\s*/)?.[0].length||0;t=Math.min(t,n)}return t>0&&t<1/0&&(e=e.map(a=>a.substring(t))),e.join(`
|
|
3
|
-
`)}var
|
|
3
|
+
`)}var Ov={};function $r(){return typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:Ov}function Be(){return $r().intelliweave=$r().intelliweave||$r().webWeaver||{},$r().intelliweave}async function*Tp(r){let e="",t=function*(){for(;;){let i=e.indexOf(`
|
|
4
4
|
|
|
5
|
-
`);if(i==-1)break;let
|
|
6
|
-
`);for(let c of l){i=c.indexOf(": ");let u=c.slice(0,i),p=c.slice(i+2);i==-1&&(u=c,p=""),u&&(
|
|
7
|
-
`+p:
|
|
5
|
+
`);if(i==-1)break;let s=e.slice(0,i);e=e.slice(i+2);let o={},l=s.split(`
|
|
6
|
+
`);for(let c of l){i=c.indexOf(": ");let u=c.slice(0,i),p=c.slice(i+2);i==-1&&(u=c,p=""),u&&(o[u]!==void 0?o[u]+=`
|
|
7
|
+
`+p:o[u]=p)}yield o}},a=new TextDecoder,n=r.getReader();for(;;){let{done:i,value:s}=await n.read();if(i)break;e+=a.decode(s,{stream:!0}),yield*t()}e+=a.decode()+`
|
|
8
8
|
|
|
9
|
-
`,yield*t()}function
|
|
9
|
+
`,yield*t()}function Ap(){if(Be().userID)return Be().userID||"";if(typeof localStorage<"u"){let r=localStorage.getItem("intelliweave.uid")||"";return r||(r=$t(),localStorage.setItem("intelliweave.uid",r),r)}else return $t()}function Ip(r){let e=r;if(e?.type=="object"&&e.properties)return r;let t={type:"object",properties:{},required:[]};if(r&&Array.isArray(r)){let a=r;for(let n of a)t.properties[n.name]={type:n.type||"string",description:n.description||""}}return t}var Ts=class Ts{constructor(e){this.module="IntelliWeave";this.module=e}get debugEnabled(){return Ts.debug?!0:typeof window<"u"&&Be().debug}log(...e){this.debugEnabled&&console.log(`[IntelliWeave > ${this.module}]`,...e)}debug(...e){this.debugEnabled&&console.debug(`[IntelliWeave > ${this.module}]`,...e)}info(...e){this.debugEnabled&&console.info(`[IntelliWeave > ${this.module}]`,...e)}warn(...e){console.warn(`[IntelliWeave > ${this.module}]`,...e)}error(...e){console.error(`[IntelliWeave > ${this.module}]`,...e)}timer(e,...t){let a=Date.now();return this.debug(`[${e} 0ms] Started`,...t),(...n)=>this.debug(`[${e} ${Math.floor(Date.now()-a)}ms]`,...n)}};Ts.debug=!1;var ge=Ts;var Rp=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~",[161],[162],[163],[164],[165],[166],[167],[168],[169],[170],[171],[172],[174],[175],[176],[177],[178],[179],[180],[181],[182],[183],[184],[185],[186],[187],[188],[189],[190],[191],[192],[193],[194],[195],[196],[197],[198],[199],[200],[201],[202],[203],[204],[205],[206],[207],[208],[209],[210],[211],[212],[213],[214],[215],[216],[217],[218],[219],[220],[221],[222],[223],[224],[225],[226],[227],[228],[229],[230],[231],[232],[233],[234],[235],[236],[237],[238],[239],[240],[241],[242],[243],[244],[245],[246],[247],[248],[249],[250],[251],[252],[253],[254],[255],"\0","","","","","","","\x07","\b"," ",`
|
|
10
10
|
`,"\v","\f","\r","","","","","","","","","","","","","","\x1B","","","",""," ","\x7F",[128],[129],[130],[131],[132],[133],[134],[135],[136],[137],[138],[139],[140],[141],[142],[143],[144],[145],[146],[147],[148],[149],[150],[151],[152],[153],[154],[155],[156],[157],[158],[159],[160],[173]," "," ","in"," t"," ","er"," ","on"," a","re","at","st","en","or"," th",`
|
|
11
11
|
|
|
12
12
|
`," c","le"," s","it","an","ar","al"," the",`;
|
|
@@ -3236,7 +3236,7 @@ import{b as te,c as ws,d as Cs,e as Pe}from"./chunk-AIYMQX7V.js";var Nd=te((Gi,D
|
|
|
3236
3236
|
|
|
3237
3237
|
|
|
3238
3238
|
|
|
3239
|
-
`," lup","_Reference"," BATCH"," intertwined","<Cell"," Cabr","nation"," isConnected",".removeListener"," cong","_ti"," Silicone"," \uACB0\uACFC"," WAN"," Gibraltar","/response"," person","chants","VIP","emergency","PixelFormat","-Am"," southwestern","_pll","ifers","_ONCE"," Fayette",".ncbi","_Panel",".Qual"," polys"," createStackNavigator","\uFFFDt"," layoffs"," Blanco","Feat"," Vimeo","_chi","_lifetime","POINTS",",private"," unbearable","printing"," cgi",".BACK"," interns"," Newly","infeld","(IB"," Kata"," Defendants","Thr","\u9884","_VF","FFFFFFFF"," davidjl"," bitterly","Suggestions",".setCancelable","FINAL","asons","_rwlock","_WRAPPER"," happiest","(rowIndex","\xF3sito","TOTYPE","Automation","LogFile"," consolation","\u30C0"," t\xEAm"," prer","rgyz"," Geg"," dto",".defaultValue"," Kami"," ASE","optimized"," \uD3EC"," originates","errMsg"," espa\xE7o","(SYS"," McB","dance","_detected"," fr\xFC"," ","<Date","(comb"," Decide","\\Field"," Proposed","Rib"," dislikes"," Wien"," Document"," traf"," storia"," Tells","')==","Cri","(VALUE"," Burnett",",void"," danh"," ccp","Blockchain",':"-"`\n'],
|
|
3239
|
+
`," lup","_Reference"," BATCH"," intertwined","<Cell"," Cabr","nation"," isConnected",".removeListener"," cong","_ti"," Silicone"," \uACB0\uACFC"," WAN"," Gibraltar","/response"," person","chants","VIP","emergency","PixelFormat","-Am"," southwestern","_pll","ifers","_ONCE"," Fayette",".ncbi","_Panel",".Qual"," polys"," createStackNavigator","\uFFFDt"," layoffs"," Blanco","Feat"," Vimeo","_chi","_lifetime","POINTS",",private"," unbearable","printing"," cgi",".BACK"," interns"," Newly","infeld","(IB"," Kata"," Defendants","Thr","\u9884","_VF","FFFFFFFF"," davidjl"," bitterly","Suggestions",".setCancelable","FINAL","asons","_rwlock","_WRAPPER"," happiest","(rowIndex","\xF3sito","TOTYPE","Automation","LogFile"," consolation","\u30C0"," t\xEAm"," prer","rgyz"," Geg"," dto",".defaultValue"," Kami"," ASE","optimized"," \uD3EC"," originates","errMsg"," espa\xE7o","(SYS"," McB","dance","_detected"," fr\xFC"," ","<Date","(comb"," Decide","\\Field"," Proposed","Rib"," dislikes"," Wien"," Document"," traf"," storia"," Tells","')==","Cri","(VALUE"," Burnett",",void"," danh"," ccp","Blockchain",':"-"`\n'],Pp=["IClient","ISODE","Issuer",`)}\r
|
|
3240
3240
|
`,",but"," Uph","(Sub"," t\xE9l\xE9phone"," onDataChange"," marshaller","-analytics",",content"," debacle","_ValueChanged"," fauna"," #=>"," foyer","'utilisation"," M\xFCller"," Fetish"," defaultManager"," backtrack","Bah","Explicit","_ASCII"," mActivity","(Msg"," \uAC8C"," TERMS"," Angie","HSV"," Mosque",".Names","\uD2BC","reste","_parms"," gaping"," cropping","DataFrame"," responsiveness","_undo","_tran",".terminate"," italiane"," walkthrough"," attractiveness","\u0434\u0435","_STS","_learn"," chocolates","ierarchical","-thinking"," )))","ishments",".Logf"," TMZ"," Canary","foil"," Vaccine",".vx"," Surround","Intermediate"," iov","vais",`';";
|
|
3241
3241
|
`,`\uFF5E
|
|
3242
3242
|
|
|
@@ -3246,16 +3246,39 @@ import{b as te,c as ws,d as Cs,e as Pe}from"./chunk-AIYMQX7V.js";var Nd=te((Gi,D
|
|
|
3246
3246
|
`," spac"," rookies","(describing","ngen",[224,174,191,224,174],".rdf",".Mutex"," kneeling"," QE","setMax","ReadStream"," ventas","sut","cmpeq",".WriteAllText"," Experienced","$__"," kaum"," LIS"," documentos","_HEALTH","icontains"," artisans","OWNER"," blinked","getDisplay"," toen"," rowNum"," avril"," invis"," Kear","toBeInTheDocument","apur"," racked"," McMaster","_ATTRIB","Haz"," factura","/ts"," \u0440\u0430\u0437\u043C\u0435\u0440"," zf"," shortfall",".fasta"," CONSTANT",".managed","gems","SharedPointer"," blurry","brightness","(components",` ..."
|
|
3247
3247
|
|
|
3248
3248
|
`,"SELL"," Illustrator",".getChannel"," trouv\xE9","ysters"," vois"," Linden"," emojis"," brawl"," MSR"," Elo"," Croatian","PopupMenu","Lewis",".JWT"," astonished","Bush","(itemId"," detachment"," Encore","\u5C14"," rekl"," cram",")$/",".getHost","_recommend","-HT","_calibration","Authenticate",".firebaseapp","UNIX"," Camera"," HEAP","Ideal",".office"," goofy","(Symbol"," jouer","_partitions"," rapidement"," GNUNET","idUser"," supervise","(Contact","AWN","\u3058"," naam"," aust","\u5728\u7EBF","_softmax","AllowAnonymous","ammable","ROUTE","*D"," aden"," Cristina"," Cristiano"," bloodstream","subclass","_persona","CHILD","-know"," navigationOptions"," Zukunft"," Pixar","Tyler"," underworld"," sincerity"," dispenser"," kter","idders",".addNode","-checked"," keyst"," WTO",".signals"," adventurer"," Pang","\\R","=pos"," dispensaries"," Closet",'("{\\"',"ideon"," n\xE9cessaire",`()"
|
|
3249
|
-
`,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],zf=gu.concat(fu);gu.length=0;fu.length=0;var yu=zf;var Nn="all";var bu=r=>r<=127;function As(r){if(r.length===0)return!1;let e=r.charCodeAt(r.length-1);return e>=55296&&e<=56319}function Uf(r){let e=0;for(;e<r.length;){let t=r[e],a=0,n=0;if(t<=127)a=1,n=t;else if((t&224)===192){if(a=2,n=t&31,t<=193)return!1}else if((t&240)===224)a=3,n=t&15;else if((t&248)===240){if(a=4,n=t&7,t>244)return!1}else return!1;if(e+a>r.length)return!1;for(let i=1;i<a;i++){let o=r[e+i];if(o===void 0||(o&192)!==128)return!1;n=n<<6|o&63}if(a===2&&n<128||a===3&&n<2048||a===4&&n<65536||n>=55296&&n<=57343||n>1114111)return!1;e+=a}return!0}var Hf=new TextDecoder("utf8",{fatal:!1});function vu(r){if(Uf(r))return Hf.decode(r)}function _u(r,e){let t=Math.min(r.length,e.length);for(let a=0;a<t;a++)if(r[a]!==e[a])return r[a]-e[a];return r.length-e.length}function Su(r){let e=0;return r.forEach(t=>{e=Math.max(e,t)}),e}function Is(r){return r.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function Rs(r){let t=[...r].map(Is).join("|");return new RegExp(`(${t})`)}var pi=new Uint8Array(0),On=new TextDecoder("utf8"),mi=class{constructor({bytePairRankDecoder:e,specialTokensEncoder:t,tokenSplitRegex:a,mergeCacheSize:n=1e5}){Pe(this,"mergeableBytePairRankCount");Pe(this,"bytePairRankDecoder");Pe(this,"bytePairNonUtfRankDecoder",new Map);Pe(this,"bytePairNonUtfSortedEncoder");Pe(this,"bytePairStringRankEncoder");Pe(this,"tokenSplitRegex");Pe(this,"specialTokensEncoder");Pe(this,"specialTokensDecoder");Pe(this,"specialTokenPatternRegex");Pe(this,"textEncoder",new TextEncoder);Pe(this,"mergeCache");Pe(this,"mergeCacheSize");this.bytePairRankDecoder=e,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=n,n>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(e).length;let i=[];e.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);i.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=i.sort((l,c)=>_u(l[0],c[0])),this.specialTokensEncoder=t??new Map,this.specialTokensDecoder=t?new Map([...t].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=a;let s=[...this.specialTokensEncoder.keys()].map(Is).join("|");try{this.specialTokenPatternRegex=new RegExp(s,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(e){this.mergeCacheSize===0&&e>0&&(this.mergeCache=new Map),this.mergeCacheSize=e,e===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(e,t){let a=0,n=0;for(;;){let i=this.findNextSpecialToken(e,t,a),o=i?.[0],s=o??e.length,l=a===0&&s===e.length?e:e.slice(a,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n=1,yield[u];continue}let p=this.bytePairEncode(c);n=p.length,yield p}if(o!==void 0){let c=i[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],a=o+c.length,n=1}else break}return n}encodeNative(e,t){let a=0,n=[];for(;;){let i=this.findNextSpecialToken(e,t,a),o=i?.[0],s=o??e.length,l=a===0&&s===e.length?e:e.slice(a,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n.push(u);continue}let p=this.bytePairEncode(c);n.push(...p)}if(o!==void 0){let c=i[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n.push(u),a=o+c.length}else break}return n}countNative(e,t){let a=0,n=0;for(;;){let i=this.findNextSpecialToken(e,t,a),o=i?.[0],s=o??e.length,l=a===0&&s===e.length?e:e.slice(a,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){n++;continue}let p=this.bytePairEncode(c);n+=p.length}if(o!==void 0){let c=i[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n++,a=o+c.length}else break}return n}*decodeNativeGenerator(e){for(let t of e){let a=this.tryDecodeToken(t);a&&(yield a)}}decodeNative(e){let t="",a=pi;for(let n of e){let i=this.tryDecodeToken(n);if(i===void 0)throw new Error(`Token ${n} is not in the byte pair encoder.`);if(typeof i=="string")a!==pi&&(t+=On.decode(a,{stream:!0}),a=pi),t+=i;else{let o=new Uint8Array(a.length+i.length);o.set(a),o.set(i,a.length),a=o}}return a!==pi&&(t+=On.decode(a,{stream:!0})),t}async*decodeNativeAsyncIterable(e){for await(let t of e){let a=this.tryDecodeToken(t);a&&(yield a)}}getBpeRankFromString(e){return this.bytePairStringRankEncoder.get(e)}getBpeRankFromStringOrThrow(e){let t=this.getBpeRankFromString(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e}`);return t}getBpeRankFromBytes(e){let t=vu(e);if(t!==void 0)return this.getBpeRankFromString(t);let a=this.binarySearch(e);if(a!==-1)return this.bytePairNonUtfSortedEncoder[a][1]}getBpeRankFromBytesOrThrow(e){let t=this.getBpeRankFromBytes(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e.toString()}`);return t}binarySearch(e){let t=0,a=this.bytePairNonUtfSortedEncoder.length-1;for(;t<=a;){let n=t+a>>>1,i=this.bytePairNonUtfSortedEncoder[n][0],o=0,s=Math.min(i.length,e.length);for(let l=0;l<s&&(o=i[l]-e[l],o===0);l++);if(o===0&&(o=i.length-e.length),o===0)return n;o<0?t=n+1:a=n-1}return-1}findNextSpecialToken(e,t,a){let n=a;for(;;){this.specialTokenPatternRegex.lastIndex=n;let i=this.specialTokenPatternRegex.exec(e);if(!i)return;let o=i[0];if(t?.has(o))return[i.index+n,o];n=i.index+n+1}}tryDecodeToken(e){let t=this.bytePairRankDecoder[e];if(typeof t=="string")return t;if(typeof t=="object"){let a=this.bytePairNonUtfRankDecoder.get(e);if(a)return a}return this.specialTokensDecoder.get(e)}addToMergeCache(e,t){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let a=this.mergeCache.keys().next().value;this.mergeCache.delete(a)}this.mergeCache.set(e,t)}}bytePairEncode(e){if(e.length===1&&bu(e.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(e)];if(this.mergeCache?.has(e)){let n=this.mergeCache.get(e);return this.mergeCache.delete(e),this.mergeCache.set(e,n),n}let t=this.textEncoder.encode(e),a=this.bytePairMerge(t);return this.addToMergeCache(e,a),a}bytePairMerge(e){let t=[],a=[],n=(o,s=t[o],l=t[o+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=e.subarray(s,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let o=0;o<=e.length;o++)t.push(o),o<e.length-1?a.push(n(o,o,o+2)):a.push(Number.POSITIVE_INFINITY);for(;t.length>1;){let o=Number.POSITIVE_INFINITY,s=-1;for(let l=0;l<a.length-1;l++){let c=a[l];c<o&&(o=c,s=l)}if(o===Number.POSITIVE_INFINITY||s===-1)break;t.splice(s+1,1),a.splice(s,1),a[s]=n(s),s>0&&(a[s-1]=n(s-1))}let i=[];for(let o=0;o<t.length-1;o++){let s=t[o],l=t[o+1],c=this.getBpeRankFromBytesOrThrow(e.subarray(s,l));i.push(c)}return i}};var Eu={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},Wf={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},jf={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},wu={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},Cu={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},ku={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},Tu={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},qf={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},Kf={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},$f={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},Xf={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},Yf={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Zf={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Jf={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},xu={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},Qf={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},ey={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},ty={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Au={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},ry={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},ny={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},ay={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},Iu={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},iy={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},Ru={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},oy={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},Pu={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},Ps={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},sy={...Ps,humanName:"GPT-4 1106 Preview"},Du={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},Nu={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},ly={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},cy={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},uy={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},dy={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},py={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},Ds={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},Mu={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},my=Mu,hy={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},gy={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},fy={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},yy={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},by={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},vy={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},_y={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Sy={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Ey={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},wy={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},Cy={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},ky={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},Ty={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Ou={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},xy={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},Ay={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Lu={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Iy={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},Ry={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},Py={...Ds,humanName:"GPT-4 32k 0314"},Dy={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Ny={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Oy={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Ly={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},My={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Fy={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},By={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Gy={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},zy={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Uy={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Hy={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},Vy={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},Wy={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},jy={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},qy={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},Ky={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},$y={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},Ns={o1:Cu,"o1-2024-12-17":Cu,"o1-preview":ku,"o1-preview-2024-09-12":ku,"o1-mini":Tu,"o1-mini-2024-09-12":Tu,"o3-mini":qf,"chatgpt-4o-latest":oy,"gpt-4o":Eu,"gpt-4o-2024-11-20":Wf,"gpt-4o-2024-08-06":Eu,"gpt-4o-2024-05-13":jf,"gpt-4o-mini":wu,"gpt-4o-mini-2024-07-18":wu,"gpt-4o-realtime-preview":Yf,"gpt-4o-realtime-preview-2024-10-01":Zf,"gpt-4o-realtime-preview-2024-12-17":Jf,"gpt-4o-mini-realtime-preview":xu,"gpt-4o-mini-realtime-preview-2024-12-17":xu,"gpt-4o-audio-preview":Qf,"gpt-4o-audio-preview-2024-10-01":ey,"gpt-4o-audio-preview-2024-12-17":ty,"gpt-4o-mini-audio-preview":Au,"gpt-4o-mini-audio-preview-2024-12-17":Au,"gpt-4o-2024-08-06-finetune":ry,"gpt-4o-mini-2024-07-18-finetune":ny,"gpt-4o-mini-training":Iu,"gpt-4o-mini-training-2024-07-18":Iu,"davinci-002-finetune":uy,"babbage-002-finetune":py,"gpt-4-turbo":Ru,"gpt-4-turbo-2024-04-09":Ru,"gpt-4-turbo-preview":Ps,"gpt-4-0125-preview":Ps,"gpt-4-1106-preview":sy,"gpt-4":Pu,"gpt-4-0613":Pu,"gpt-3.5-turbo":Du,"gpt-3.5-turbo-0125":Du,"gpt-3.5-turbo-1106":ly,"gpt-3.5-turbo-finetune":ay,"gpt-3.5-turbo-16k":iy,"gpt-4-32k":Ds,"gpt-4-32k-0613":Ds,"gpt-4-vision-preview":Mu,"gpt-4-1106-vision-preview":my,"gpt-4-0314":Iy,"gpt-4-32k-0314":Py,"gpt-3.5-turbo-0613":hy,"gpt-3.5-turbo-16k-0613":gy,"gpt-3.5-turbo-0301":Ry},hi={...Ns,"text-embedding-3-small":Kf,"text-embedding-3-large":$f,"text-embedding-ada-002":Xf,"gpt-3.5-turbo-instruct":Nu,"gpt-3.5-turbo-instruct-0914":Nu,"davinci-002":cy,"babbage-002":dy,"text-ada-001":fy,"text-babbage-001":yy,"text-curie-001":by,"text-davinci-001":vy,"text-davinci-002":_y,"text-davinci-003":Sy,ada:Ey,babbage:wy,curie:Cy,davinci:ky,"code-davinci-002":Ty,"code-davinci-001":Ou,"davinci-codex":Ou,"code-davinci-edit-001":xy,"code-cushman-002":Ay,"code-cushman-001":Lu,"cushman-codex":Lu,"code-search-ada-code-001":Ly,"code-search-ada-text-001":My,"text-davinci-edit-001":Fy,"text-similarity-ada-001":Dy,"text-search-ada-doc-001":Ny,"text-search-ada-query-001":Oy,"text-similarity-babbage-001":By,"text-search-babbage-doc-001":Gy,"text-search-babbage-query-001":zy,"code-search-babbage-code-001":Uy,"code-search-babbage-text-001":Hy,"text-similarity-curie-001":Vy,"text-search-curie-doc-001":Wy,"text-search-curie-query-001":jy,"text-similarity-davinci-001":qy,"text-search-davinci-doc-001":Ky,"text-search-davinci-query-001":$y};var Mt="<|endoftext|>",kr="<|fim_prefix|>",Tr="<|fim_middle|>",xr="<|fim_suffix|>",Ln="<|im_start|>",Mn="<|im_end|>",Ar="<|im_sep|>",Fn="<|endofprompt|>";var Fu=Object.fromEntries(Object.entries(Ns).map(([r,e])=>[r,e.encoding])),Bu=Object.fromEntries(Object.entries(hi).map(([r,e])=>[r,e.encoding])),Xy={messageSeparator:`
|
|
3249
|
+
`,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],Lv=Rp.concat(Pp);Rp.length=0;Pp.length=0;var Dp=Lv;var pa="all";var Np=r=>r<=127;function bc(r){if(r.length===0)return!1;let e=r.charCodeAt(r.length-1);return e>=55296&&e<=56319}function Bv(r){let e=0;for(;e<r.length;){let t=r[e],a=0,n=0;if(t<=127)a=1,n=t;else if((t&224)===192){if(a=2,n=t&31,t<=193)return!1}else if((t&240)===224)a=3,n=t&15;else if((t&248)===240){if(a=4,n=t&7,t>244)return!1}else return!1;if(e+a>r.length)return!1;for(let i=1;i<a;i++){let s=r[e+i];if(s===void 0||(s&192)!==128)return!1;n=n<<6|s&63}if(a===2&&n<128||a===3&&n<2048||a===4&&n<65536||n>=55296&&n<=57343||n>1114111)return!1;e+=a}return!0}var Fv=new TextDecoder("utf8",{fatal:!1});function Mp(r){if(Bv(r))return Fv.decode(r)}function Op(r,e){let t=Math.min(r.length,e.length);for(let a=0;a<t;a++)if(r[a]!==e[a])return r[a]-e[a];return r.length-e.length}function Lp(r){let e=0;return r.forEach(t=>{e=Math.max(e,t)}),e}function vc(r){return r.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function _c(r){let t=[...r].map(vc).join("|");return new RegExp(`(${t})`)}var As=new Uint8Array(0),ma=new TextDecoder("utf8"),Is=class{constructor({bytePairRankDecoder:e,specialTokensEncoder:t,tokenSplitRegex:a,mergeCacheSize:n=1e5}){Oe(this,"mergeableBytePairRankCount");Oe(this,"bytePairRankDecoder");Oe(this,"bytePairNonUtfRankDecoder",new Map);Oe(this,"bytePairNonUtfSortedEncoder");Oe(this,"bytePairStringRankEncoder");Oe(this,"tokenSplitRegex");Oe(this,"specialTokensEncoder");Oe(this,"specialTokensDecoder");Oe(this,"specialTokenPatternRegex");Oe(this,"textEncoder",new TextEncoder);Oe(this,"mergeCache");Oe(this,"mergeCacheSize");this.bytePairRankDecoder=e,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=n,n>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(e).length;let i=[];e.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);i.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=i.sort((l,c)=>Op(l[0],c[0])),this.specialTokensEncoder=t??new Map,this.specialTokensDecoder=t?new Map([...t].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=a;let o=[...this.specialTokensEncoder.keys()].map(vc).join("|");try{this.specialTokenPatternRegex=new RegExp(o,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(e){this.mergeCacheSize===0&&e>0&&(this.mergeCache=new Map),this.mergeCacheSize=e,e===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(e,t){let a=0,n=0;for(;;){let i=this.findNextSpecialToken(e,t,a),s=i?.[0],o=s??e.length,l=a===0&&o===e.length?e:e.slice(a,o);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n=1,yield[u];continue}let p=this.bytePairEncode(c);n=p.length,yield p}if(s!==void 0){let c=i[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],a=s+c.length,n=1}else break}return n}encodeNative(e,t){let a=0,n=[];for(;;){let i=this.findNextSpecialToken(e,t,a),s=i?.[0],o=s??e.length,l=a===0&&o===e.length?e:e.slice(a,o);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){n.push(u);continue}let p=this.bytePairEncode(c);n.push(...p)}if(s!==void 0){let c=i[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n.push(u),a=s+c.length}else break}return n}countNative(e,t){let a=0,n=0;for(;;){let i=this.findNextSpecialToken(e,t,a),s=i?.[0],o=s??e.length,l=a===0&&o===e.length?e:e.slice(a,o);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){n++;continue}let p=this.bytePairEncode(c);n+=p.length}if(s!==void 0){let c=i[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);n++,a=s+c.length}else break}return n}*decodeNativeGenerator(e){for(let t of e){let a=this.tryDecodeToken(t);a&&(yield a)}}decodeNative(e){let t="",a=As;for(let n of e){let i=this.tryDecodeToken(n);if(i===void 0)throw new Error(`Token ${n} is not in the byte pair encoder.`);if(typeof i=="string")a!==As&&(t+=ma.decode(a,{stream:!0}),a=As),t+=i;else{let s=new Uint8Array(a.length+i.length);s.set(a),s.set(i,a.length),a=s}}return a!==As&&(t+=ma.decode(a,{stream:!0})),t}async*decodeNativeAsyncIterable(e){for await(let t of e){let a=this.tryDecodeToken(t);a&&(yield a)}}getBpeRankFromString(e){return this.bytePairStringRankEncoder.get(e)}getBpeRankFromStringOrThrow(e){let t=this.getBpeRankFromString(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e}`);return t}getBpeRankFromBytes(e){let t=Mp(e);if(t!==void 0)return this.getBpeRankFromString(t);let a=this.binarySearch(e);if(a!==-1)return this.bytePairNonUtfSortedEncoder[a][1]}getBpeRankFromBytesOrThrow(e){let t=this.getBpeRankFromBytes(e);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${e.toString()}`);return t}binarySearch(e){let t=0,a=this.bytePairNonUtfSortedEncoder.length-1;for(;t<=a;){let n=t+a>>>1,i=this.bytePairNonUtfSortedEncoder[n][0],s=0,o=Math.min(i.length,e.length);for(let l=0;l<o&&(s=i[l]-e[l],s===0);l++);if(s===0&&(s=i.length-e.length),s===0)return n;s<0?t=n+1:a=n-1}return-1}findNextSpecialToken(e,t,a){let n=a;for(;;){this.specialTokenPatternRegex.lastIndex=n;let i=this.specialTokenPatternRegex.exec(e);if(!i)return;let s=i[0];if(t?.has(s))return[i.index+n,s];n=i.index+n+1}}tryDecodeToken(e){let t=this.bytePairRankDecoder[e];if(typeof t=="string")return t;if(typeof t=="object"){let a=this.bytePairNonUtfRankDecoder.get(e);if(a)return a}return this.specialTokensDecoder.get(e)}addToMergeCache(e,t){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let a=this.mergeCache.keys().next().value;this.mergeCache.delete(a)}this.mergeCache.set(e,t)}}bytePairEncode(e){if(e.length===1&&Np(e.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(e)];if(this.mergeCache?.has(e)){let n=this.mergeCache.get(e);return this.mergeCache.delete(e),this.mergeCache.set(e,n),n}let t=this.textEncoder.encode(e),a=this.bytePairMerge(t);return this.addToMergeCache(e,a),a}bytePairMerge(e){let t=[],a=[],n=(s,o=t[s],l=t[s+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=e.subarray(o,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let s=0;s<=e.length;s++)t.push(s),s<e.length-1?a.push(n(s,s,s+2)):a.push(Number.POSITIVE_INFINITY);for(;t.length>1;){let s=Number.POSITIVE_INFINITY,o=-1;for(let l=0;l<a.length-1;l++){let c=a[l];c<s&&(s=c,o=l)}if(s===Number.POSITIVE_INFINITY||o===-1)break;t.splice(o+1,1),a.splice(o,1),a[o]=n(o),o>0&&(a[o-1]=n(o-1))}let i=[];for(let s=0;s<t.length-1;s++){let o=t[s],l=t[s+1],c=this.getBpeRankFromBytesOrThrow(e.subarray(o,l));i.push(c)}return i}};var Bp={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},zv={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},Uv={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},Fp={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},Gp={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},zp={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},Up={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},Hv={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},Vv={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},jv={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},Wv={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},qv={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},$v={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Kv={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Hp={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},Xv={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Yv={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Jv={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Vp={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},Zv={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},Qv={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},e_={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},jp={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},t_={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},Wp={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},r_={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},qp={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},Sc={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},n_={...Sc,humanName:"GPT-4 1106 Preview"},$p={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},Kp={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},a_={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},i_={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},s_={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},o_={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},l_={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},Ec={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},Jp={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},c_=Jp,u_={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},d_={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},p_={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},m_={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},h_={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},g_={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},f_={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},y_={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},b_={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},v_={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},__={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},S_={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},E_={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Xp={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},w_={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},k_={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Yp={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},C_={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},x_={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},T_={...Ec,humanName:"GPT-4 32k 0314"},A_={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},I_={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},R_={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},P_={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},D_={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},N_={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},M_={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},O_={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},L_={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},B_={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},F_={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},G_={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},z_={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},U_={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},H_={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},V_={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},j_={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},wc={o1:Gp,"o1-2024-12-17":Gp,"o1-preview":zp,"o1-preview-2024-09-12":zp,"o1-mini":Up,"o1-mini-2024-09-12":Up,"o3-mini":Hv,"chatgpt-4o-latest":r_,"gpt-4o":Bp,"gpt-4o-2024-11-20":zv,"gpt-4o-2024-08-06":Bp,"gpt-4o-2024-05-13":Uv,"gpt-4o-mini":Fp,"gpt-4o-mini-2024-07-18":Fp,"gpt-4o-realtime-preview":qv,"gpt-4o-realtime-preview-2024-10-01":$v,"gpt-4o-realtime-preview-2024-12-17":Kv,"gpt-4o-mini-realtime-preview":Hp,"gpt-4o-mini-realtime-preview-2024-12-17":Hp,"gpt-4o-audio-preview":Xv,"gpt-4o-audio-preview-2024-10-01":Yv,"gpt-4o-audio-preview-2024-12-17":Jv,"gpt-4o-mini-audio-preview":Vp,"gpt-4o-mini-audio-preview-2024-12-17":Vp,"gpt-4o-2024-08-06-finetune":Zv,"gpt-4o-mini-2024-07-18-finetune":Qv,"gpt-4o-mini-training":jp,"gpt-4o-mini-training-2024-07-18":jp,"davinci-002-finetune":s_,"babbage-002-finetune":l_,"gpt-4-turbo":Wp,"gpt-4-turbo-2024-04-09":Wp,"gpt-4-turbo-preview":Sc,"gpt-4-0125-preview":Sc,"gpt-4-1106-preview":n_,"gpt-4":qp,"gpt-4-0613":qp,"gpt-3.5-turbo":$p,"gpt-3.5-turbo-0125":$p,"gpt-3.5-turbo-1106":a_,"gpt-3.5-turbo-finetune":e_,"gpt-3.5-turbo-16k":t_,"gpt-4-32k":Ec,"gpt-4-32k-0613":Ec,"gpt-4-vision-preview":Jp,"gpt-4-1106-vision-preview":c_,"gpt-4-0314":C_,"gpt-4-32k-0314":T_,"gpt-3.5-turbo-0613":u_,"gpt-3.5-turbo-16k-0613":d_,"gpt-3.5-turbo-0301":x_},Rs={...wc,"text-embedding-3-small":Vv,"text-embedding-3-large":jv,"text-embedding-ada-002":Wv,"gpt-3.5-turbo-instruct":Kp,"gpt-3.5-turbo-instruct-0914":Kp,"davinci-002":i_,"babbage-002":o_,"text-ada-001":p_,"text-babbage-001":m_,"text-curie-001":h_,"text-davinci-001":g_,"text-davinci-002":f_,"text-davinci-003":y_,ada:b_,babbage:v_,curie:__,davinci:S_,"code-davinci-002":E_,"code-davinci-001":Xp,"davinci-codex":Xp,"code-davinci-edit-001":w_,"code-cushman-002":k_,"code-cushman-001":Yp,"cushman-codex":Yp,"code-search-ada-code-001":P_,"code-search-ada-text-001":D_,"text-davinci-edit-001":N_,"text-similarity-ada-001":A_,"text-search-ada-doc-001":I_,"text-search-ada-query-001":R_,"text-similarity-babbage-001":M_,"text-search-babbage-doc-001":O_,"text-search-babbage-query-001":L_,"code-search-babbage-code-001":B_,"code-search-babbage-text-001":F_,"text-similarity-curie-001":G_,"text-search-curie-doc-001":z_,"text-search-curie-query-001":U_,"text-similarity-davinci-001":H_,"text-search-davinci-doc-001":V_,"text-search-davinci-query-001":j_};var Kt="<|endoftext|>",Kr="<|fim_prefix|>",Xr="<|fim_middle|>",Yr="<|fim_suffix|>",ha="<|im_start|>",ga="<|im_end|>",Jr="<|im_sep|>",fa="<|endofprompt|>";var Zp=Object.fromEntries(Object.entries(wc).map(([r,e])=>[r,e.encoding])),Qp=Object.fromEntries(Object.entries(Rs).map(([r,e])=>[r,e.encoding])),W_={messageSeparator:`
|
|
3250
3250
|
`,roleSeparator:`
|
|
3251
|
-
`},
|
|
3252
|
-
`;this.itemPadding=0;this.sortFunction=(e,t)=>e.sortOrder!==t.sortOrder?e.sortOrder-t.sortOrder:e.dateAdded!==t.dateAdded?e.dateAdded-t.dateAdded:e.content.localeCompare(t.content)}setItemPadding(e){return this.itemPadding=e,this.recalculateTokens(),this}sortBy(e){return this.sortFunction=e,this.items.sort(this.sortFunction),this}setSeparator(e){return this.separator==e?this:(this.separator=e,this.recalculateTokens(),this)}setWeight(e){return this.weight=e,this}recalculateTokens(){this.tokenCount=this.items.reduce((e,t)=>(t.tokenCount
|
|
3251
|
+
`},q_={messageSeparator:"",roleSeparator:Jr},em=Object.fromEntries(Object.keys(Zp).flatMap(r=>r.startsWith("gpt-4")?[[r,q_]]:r.startsWith("gpt-3.5-turbo")?[[r,W_]]:[])),rR=Object.keys(Zp);var ya=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,Ps=/(?:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+/giu;function tm(r){return{tokenSplitRegex:Ps,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Kt,100257],[Kr,100258],[Xr,100259],[Yr,100260],[ha,100264],[ga,100265],[Jr,100266],[fa,100276]])}}function rm(r){return{tokenSplitRegex:Ps,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Kt,199999],[Kr,2e5],[Xr,200001],[Yr,200002],[ha,200003],[ga,200004],[Jr,200005],[fa,200006]])}}function nm(r){return{expectedVocabularySize:50281,tokenSplitRegex:ya,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Kt,50256]])}}function am(r){return{tokenSplitRegex:ya,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Kt,50256],[Kr,50281],[Xr,50282],[Yr,50283]])}}function im(r){return{expectedVocabularySize:50257,tokenSplitRegex:ya,bytePairRankDecoder:r,specialTokensEncoder:new Map([[Kt,50256]])}}function kc(r,e){let t=e(r);switch(r.toLowerCase()){case"r50k_base":return im(t);case"p50k_base":return nm(t);case"p50k_edit":return am(t);case"cl100k_base":return tm(t);case"o200k_base":return rm(t);default:throw new Error(`Unknown encoding name: ${r}`)}}var Pr=class Pr{constructor({bytePairRankDecoder:e,specialTokensEncoder:t,expectedVocabularySize:a,modelName:n,...i}){Oe(this,"modelName");Oe(this,"bytePairEncodingCoreProcessor");Oe(this,"specialTokensEncoder");Oe(this,"specialTokensSet");Oe(this,"allSpecialTokenRegex");Oe(this,"defaultSpecialTokenConfig");Oe(this,"vocabularySize");this.specialTokensEncoder=t,this.specialTokensSet=new Set(this.specialTokensEncoder.keys()),this.allSpecialTokenRegex=_c(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new Is({bytePairRankDecoder:e,specialTokensEncoder:t,...i}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let s=Math.max(e.length-1,Lp(t));if(this.vocabularySize=this.bytePairEncodingCoreProcessor.mergeableBytePairRankCount+t.size,a!==void 0){if(this.vocabularySize!==a)throw new Error("The number of mergeable tokens and special tokens must be equal to expectedVocabularySize.");if(s!==a-1)throw new Error(`The model encodings are invalid. The maximum token value must be equal to expectedVocabularySize - 1. Currently ${s}, expected ${a-1}`)}this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),this.encodeGenerator=this.encodeGenerator.bind(this),this.decodeGenerator=this.decodeGenerator.bind(this),this.decodeAsyncGenerator=this.decodeAsyncGenerator.bind(this),this.decodeAsync=this.decodeAsync.bind(this),this.isWithinTokenLimit=this.isWithinTokenLimit.bind(this),this.encodeChat=this.encodeChat.bind(this),this.encodeChatGenerator=this.encodeChatGenerator.bind(this),this.countTokens=this.countTokens.bind(this),this.setMergeCacheSize=this.setMergeCacheSize.bind(this),this.clearMergeCache=this.clearMergeCache.bind(this),this.estimateCost=this.estimateCost.bind(this),this.modelName=n}static getEncodingApi(e,t){let a=kc(e,t);return new Pr(a)}static getEncodingApiForModel(e,t){let a=Qp[e],n=kc(a,t);return new Pr({...n,modelName:e})}processSpecialTokens({allowedSpecial:e,disallowedSpecial:t}={}){let a;if(e===pa||e?.has(pa)){e=new Set(this.specialTokensSet);let n=e;if(t===pa)throw new Error('allowedSpecial and disallowedSpecial cannot both be set to "all".');typeof t=="object"?t.forEach(i=>n.delete(i)):t=new Set}if(!t||t===pa||t.has(pa)){t=new Set(this.specialTokensSet);let n=t;e?.size?(e.forEach(i=>n.delete(i)),t.forEach(i=>e.delete(i)),t.size>0&&(a=_c(t))):a=this.allSpecialTokenRegex}return{allowedSpecial:e,regexPattern:a}}encodeGenerator(e,t){let a=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(a.regexPattern){let n=e.match(a.regexPattern);if(n!==null)throw new Error(`Disallowed special token found: ${n[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNativeGenerator(e,a.allowedSpecial)}encode(e,t){let a=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(a.regexPattern){let n=e.match(a.regexPattern);if(n!==null)throw new Error(`Disallowed special token found: ${n[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNative(e,a.allowedSpecial)}*encodeChatGenerator(e,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let a=em[t],n=this.specialTokensEncoder.get(ha),i=this.specialTokensEncoder.get(ga);if(!a||n===void 0||i===void 0)throw new Error(`Model '${t}' does not support chat.`);let s=new Set([Jr]),{messageSeparator:o,roleSeparator:l}=a,c=o.length>0?this.encode(o):[],u=l.length>0?this.encode(l,{allowedSpecial:s}):[],p=new Map;for(let{role:m="system",name:d=m,content:g}of e){if(g===void 0)throw new Error("Content must be defined for all messages.");yield[n];let f=p.get(d)??this.encode(d);p.set(d,f),yield f,u.length>0&&(yield u),yield*this.encodeGenerator(g),yield[i],yield c}yield[n],yield*this.encodeGenerator("assistant"),u.length>0&&(yield u)}encodeChat(e,t=this.modelName){return[...this.encodeChatGenerator(e,t)].flat()}isWithinTokenLimit(e,t){let a=typeof e=="string"?this.encodeGenerator(e):this.encodeChatGenerator(e),n=0;for(let i of a)if(n+=i.length,n>t)return!1;return n}countTokens(e,t){if(typeof e=="string"){let i=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(i.regexPattern){let s=e.match(i.regexPattern);if(s!==null)throw new Error(`Disallowed special token found: ${s[0]}`)}return this.bytePairEncodingCoreProcessor.countNative(e,i.allowedSpecial)}let a=this.encodeChatGenerator(e),n=0;for(let i of a)n+=i.length;return n}setMergeCacheSize(e){this.bytePairEncodingCoreProcessor.setMergeCacheSize(e)}clearMergeCache(){this.bytePairEncodingCoreProcessor.clearMergeCache()}decode(e){return this.bytePairEncodingCoreProcessor.decodeNative(e)}*decodeGenerator(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeGenerator(e),a="";for(let n of t)a+=typeof n=="string"?n:ma.decode(n,{stream:!0}),!(a.length===0||bc(a))&&(yield a,a="");a.length>0&&(yield a)}async*decodeAsyncGenerator(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),a="";for await(let n of t)a+=typeof n=="string"?n:ma.decode(n,{stream:!0}),!(a.length===0||bc(a))&&(yield a,a="");a.length>0&&(yield a)}async decodeAsync(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),a="";for await(let n of t)a+=typeof n=="string"?n:ma.decode(n,{stream:!0});return a}estimateCost(e,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let a=Rs[t];if(!a)throw new Error(`Unknown model: ${t}`);if(!a.cost)throw new Error(`No cost information available for model: ${t}`);let n=a.cost,i={},s=e/1e6;return n.input!==void 0&&(i.input=n.input*s),n.output!==void 0&&(i.output=n.output*s),n.batchInput!==void 0&&(i.batchInput=n.batchInput*s),n.batchOutput!==void 0&&(i.batchOutput=n.batchOutput*s),i}};Oe(Pr,"EndOfPrompt",fa),Oe(Pr,"EndOfText",Kt),Oe(Pr,"FimMiddle",Xr),Oe(Pr,"FimPrefix",Kr),Oe(Pr,"FimSuffix",Yr);var Ds=Pr;var $_=Ds.getEncodingApi("cl100k_base",()=>Dp),{decode:UR,decodeAsyncGenerator:HR,decodeGenerator:VR,encode:jR,encodeGenerator:WR,isWithinTokenLimit:qR,countTokens:wn,encodeChat:$R,encodeChatGenerator:KR,vocabularySize:XR,setMergeCacheSize:YR,clearMergeCache:JR,estimateCost:ZR}=$_;var Ns=class{constructor(){this.size=4096;this.groups=[]}createGroup(e){let t=new Cc;return t.id=e,this.groups.push(t),t}group(e){return this.groups.find(t=>t.id===e)}countTokens(){return this.groups.reduce((e,t)=>e+t.tokenCount,0)}removeOverflow(){let e=this.countTokens(),t=this.groups.reduce((a,n)=>a+n.weight,0);for(;e>this.size;){let a=this.groups.slice().sort((i,s)=>{let o=Math.floor(i.weight/t*this.size),l=Math.floor(s.weight/t*this.size),c=i.tokenCount-o;return s.tokenCount-l-c}),n=this.removeOneItem(a);if(!n)throw new Error("Too many items in the token window that cannot be removed.");e-=n.tokenCount}}removeOneItem(e){for(let t of e){let a=t.items.findIndex(i=>!i.cannotRemove);if(a===-1)continue;let n=t.items[a];return t.items.splice(a,1),t.tokenCount-=n.tokenCount,n}return null}},Cc=class{constructor(){this.id="";this.items=[];this.weight=1;this.tokenCount=0;this.separator=`
|
|
3252
|
+
`;this.itemPadding=0;this.sortFunction=(e,t)=>e.sortOrder!==t.sortOrder?e.sortOrder-t.sortOrder:e.dateAdded!==t.dateAdded?e.dateAdded-t.dateAdded:e.content.localeCompare(t.content)}setItemPadding(e){return this.itemPadding=e,this.recalculateTokens(),this}sortBy(e){return this.sortFunction=e,this.items.sort(this.sortFunction),this}setSeparator(e){return this.separator==e?this:(this.separator=e,this.recalculateTokens(),this)}setWeight(e){return this.weight=e,this}recalculateTokens(){this.tokenCount=this.items.reduce((e,t)=>(t.tokenCount=wn(t.content)+wn(this.separator)+this.itemPadding,e+t.tokenCount),0)}add(e){typeof e=="string"&&(e={content:e});let t=e;t.id===void 0&&(t.id=$t());let a=this.items.find(n=>n.id===t.id);return a?(this.tokenCount-=a.tokenCount,Object.assign(a,t),t=a):this.items.push(t),t.dateAdded===void 0&&(t.dateAdded=Date.now()),t.sortOrder===void 0&&(t.sortOrder=0),t.disabled===void 0&&(t.disabled=!1),t.tokenCount=t.disabled?0:wn(e.content)+wn(this.separator)+this.itemPadding,this.tokenCount+=t.tokenCount,this.items.sort(this.sortFunction),t}getAllAsString(){return this.getAll().map(e=>e.content).join(this.separator)}getAll(){return this.items.filter(e=>!e.disabled)}empty(){this.items=[],this.tokenCount=0}};var ba=class{constructor(e){this.id="";this.metadata={};this.maxToolCallsPerMessage=10;this.stats={tokensUsed:0};this.tokenWindow=(()=>{let e=new Ns;return e.createGroup("context").setSeparator(`
|
|
3253
|
+
|
|
3254
|
+
`),e.createGroup("actions").setItemPadding(25),e.createGroup("messages").setItemPadding(10),e})();this.config=e,this.tokenWindow.size=this.config.maxTokens||16e3}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(e){throw new Error("Not implemented")}addUserMessage(e){throw new Error("Not implemented")}addAssistantMessage(e){throw new Error("Not implemented")}onBeforeIncomingMessage(e){}resetConversation(){this.messageGroup.empty(),this.toolGroup.empty(),this.contextGroup.empty()}async trimMessages(){this.tokenWindow.removeOverflow()}registerTool(e){return this.toolGroup.add({id:e.name,customData:e,cannotRemove:e.isContext,sortOrder:101,disabled:e.disabled,content:JSON.stringify(e)})}};var va=1,Dr=new ge("ChatGPT"),Ms=class extends ba{async sendMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+va++,content:JSON.stringify(t),customData:t}),await this.processMessages();let n=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return n?.role=="assistant"&&n.content||""}addAssistantMessage(e){let t={role:"assistant",content:e};this.messageGroup.add({id:"msg-"+va++,content:JSON.stringify(t),customData:t})}addUserMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+va++,content:JSON.stringify(t),customData:t})}getMessages(){return this.messageGroup.items.map(e=>e.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),Dr.debugEnabled&&Dr.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(a=>a.customData),messages:this.messageGroup.items.map(a=>a.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let t=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(t?.role=="user"||t?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(t?.role=="assistant"&&t?.tool_calls?.length){for(let a of t.tool_calls)await this.processToolCall(a);await this.processMessages()}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendRequest(e){let t={};return t["Content-Type"]="application/json",this.config.apiKey&&(t.Authorization=`Bearer ${this.config.apiKey}`),await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:t,body:JSON.stringify(e)})}async sendToAPI(e){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let t=0;for(let o=this.messageGroup.items.length-1;o>=0;o--){let l=this.messageGroup.items[o].customData;if(l.role=="assistant"&&l.tool_calls){if(t+=1,t>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(l.role=="user")break}Dr.debugEnabled&&Dr.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(o=>o.customData),messages:this.messageGroup.items.map(o=>o.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let a={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(o=>o.customData)]};for(let o of this.toolGroup.getAll()){let l=o.customData;l.description&&l.description.length>1024&&Dr.warn(`Tool description for "${l.name}" is too long, it will be truncated.`);let c={type:"function",function:{name:l.name,description:(l.description||"").substring(0,1024),parameters:l.params}};a.tools.push(c)}if(a.user||delete a.user,a.tools.length||delete a.tools,e)return a;let n=await this.sendRequest(a);if(!n.ok){let o=`${n.status} ${n.statusText}`;try{let c=await n.json();o=c.errorText||c.error?.message||c.error||o}catch{}let l=new Error(o);throw l.code=n.status,l}let i=null,s=null;if(this.config.stream){for await(let l of Tp(n.body)){if(l.data=="[DONE]")break;if(!l.data)continue;let c=JSON.parse(l.data);if(s){for(let u in c.choices[0].delta)if(typeof c.choices[0].delta[u]=="string"){if(u=="role"&&s[u]==c.choices[0].delta[u])continue;s[u]=(s[u]||"")+c.choices[0].delta[u]}for(let u of c.choices[0].delta.tool_calls||[]){if(s.tool_calls||(s.tool_calls=[]),!s.tool_calls[u.index]){s.tool_calls[u.index]=u;continue}let p=s.tool_calls[u.index];p.function=p.function||{},p.function.name=(p.function.name||"")+(u.function?.name||""),p.function.arguments=(p.function.arguments||"")+(u.function?.arguments||"")}}else s={chunkID:c.id,...c.choices[0].delta};s?.content&&!s.content.startsWith("{")&&this.config.onAIMessage?.(s.content,!0)}let o=wn(JSON.stringify(a)+JSON.stringify(s)||"");this.stats.tokensUsed+=o,Dr.debug(`Estimated ${o} tokens for streaming response, total used: ${this.stats.tokensUsed}`)}else i=await n.json(),this.stats.tokensUsed+=i?.usage?.total_tokens||0,Dr.debug(`Used ${i?.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),s=i?.choices?.[0]?.message;if(s||(Dr.warn("No response block in API response."),s={role:"assistant",content:""}),s.role=="user")throw new Error("API returned a user message, which is not allowed.");this.onBeforeIncomingMessage(s),this.messageGroup.add({id:"msg-"+va++,content:JSON.stringify(s),customData:s}),s.content&&this.config.onAIMessage?.(s.content,!1)}async processToolCall(e){try{let a=this.toolGroup.items.find(o=>o.id==e.function.name)?.customData;if(!a)throw new Error(`Tool "${e.function.name}" not found.`);let n=JSON.parse(e.function.arguments);this.config.onAIToolStart?.(e.function.name,n);let i=await a.callback(n);typeof i!="string"&&(i=JSON.stringify(i)||""),(i===""||i==="undefined")&&(i="success");let s={role:"tool",content:i,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+va++,content:JSON.stringify(s),customData:s})}catch(t){Dr.warn(`Unable to process tool call for "${e?.function?.name}"`,t);let a={role:"tool",content:`Error: ${t.message}`,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+va++,content:JSON.stringify(a),customData:a})}}};function re(r,e,t,a,n){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}function z(r,e,t,a){if(t==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!a:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?a:t==="a"?a.call(r):a?a.value:e.get(r)}var xc=function(){let{crypto:r}=globalThis;if(r?.randomUUID)return xc=r.randomUUID.bind(r),r.randomUUID();let e=new Uint8Array(1),t=r?()=>r.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,a=>(+a^t()&15>>+a/4).toString(16))};function Nr(r){return typeof r=="object"&&r!==null&&("name"in r&&r.name==="AbortError"||"message"in r&&String(r.message).includes("FetchRequestCanceledException"))}var fi=r=>{if(r instanceof Error)return r;if(typeof r=="object"&&r!==null){try{if(Object.prototype.toString.call(r)==="[object Error]"){let e=new Error(r.message,r.cause?{cause:r.cause}:{});return r.stack&&(e.stack=r.stack),r.cause&&!e.cause&&(e.cause=r.cause),r.name&&(e.name=r.name),e}}catch{}try{return new Error(JSON.stringify(r))}catch{}}return new Error(r)};var te=class extends Error{},nt=class r extends te{constructor(e,t,a,n){super(`${r.makeMessage(e,t,a)}`),this.status=e,this.headers=n,this.requestID=n?.get("request-id"),this.error=t}static makeMessage(e,t,a){let n=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):a;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,t,a,n){if(!e||!n)return new Zr({message:a,cause:fi(t)});let i=t;return e===400?new Sa(e,i,a,n):e===401?new Ea(e,i,a,n):e===403?new wa(e,i,a,n):e===404?new ka(e,i,a,n):e===409?new Ca(e,i,a,n):e===422?new xa(e,i,a,n):e===429?new Ta(e,i,a,n):e>=500?new Aa(e,i,a,n):new r(e,i,a,n)}},ut=class extends nt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Zr=class extends nt{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},_a=class extends Zr{constructor({message:e}={}){super({message:e??"Request timed out."})}},Sa=class extends nt{},Ea=class extends nt{},wa=class extends nt{},ka=class extends nt{},Ca=class extends nt{},xa=class extends nt{},Ta=class extends nt{},Aa=class extends nt{};var X_=/^[a-z][a-z0-9+.-]*:/i,sm=r=>X_.test(r),Tc=r=>(Tc=Array.isArray,Tc(r)),Ac=Tc;function Ic(r){return typeof r!="object"?{}:r??{}}function om(r){if(!r)return!0;for(let e in r)return!1;return!0}function lm(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var cm=(r,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new te(`${r} must be an integer`);if(e<0)throw new te(`${r} must be a positive integer`);return e};var Os=r=>{try{return JSON.parse(r)}catch{return}};var um=r=>new Promise(e=>setTimeout(e,r));var Qr="0.60.0";var hm=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function Y_(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var J_=()=>{let r=Y_();if(r==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qr,"X-Stainless-OS":pm(Deno.build.os),"X-Stainless-Arch":dm(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(r==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qr,"X-Stainless-OS":pm(globalThis.process.platform??"unknown"),"X-Stainless-Arch":dm(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Z_();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Qr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Z_(){if(typeof navigator>"u"||!navigator)return null;let r=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:t}of r){let a=t.exec(navigator.userAgent);if(a){let n=a[1]||0,i=a[2]||0,s=a[3]||0;return{browser:e,version:`${n}.${i}.${s}`}}}return null}var dm=r=>r==="x32"?"x32":r==="x86_64"||r==="x64"?"x64":r==="arm"?"arm":r==="aarch64"||r==="arm64"?"arm64":r?`other:${r}`:"unknown",pm=r=>(r=r.toLowerCase(),r.includes("ios")?"iOS":r==="android"?"Android":r==="darwin"?"MacOS":r==="win32"?"Windows":r==="freebsd"?"FreeBSD":r==="openbsd"?"OpenBSD":r==="linux"?"Linux":r?`Other:${r}`:"Unknown"),mm,gm=()=>mm??(mm=J_());function fm(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Rc(...r){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...r)}function Ls(r){let e=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator]();return Rc({start(){},async pull(t){let{done:a,value:n}=await e.next();a?t.close():t.enqueue(n)},async cancel(){await e.return?.()}})}function yi(r){if(r[Symbol.asyncIterator])return r;let e=r.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function ym(r){if(r===null||typeof r!="object")return;if(r[Symbol.asyncIterator]){await r[Symbol.asyncIterator]().return?.();return}let e=r.getReader(),t=e.cancel();e.releaseLock(),await t}var bm=({headers:r,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});function Sm(r){let e=0;for(let n of r)e+=n.length;let t=new Uint8Array(e),a=0;for(let n of r)t.set(n,a),a+=n.length;return t}var vm;function bi(r){let e;return(vm??(e=new globalThis.TextEncoder,vm=e.encode.bind(e)))(r)}var _m;function Pc(r){let e;return(_m??(e=new globalThis.TextDecoder,_m=e.decode.bind(e)))(r)}var Lt,Bt,Mr=class{constructor(){Lt.set(this,void 0),Bt.set(this,void 0),re(this,Lt,new Uint8Array,"f"),re(this,Bt,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?bi(e):e;re(this,Lt,Sm([z(this,Lt,"f"),t]),"f");let a=[],n;for(;(n=tS(z(this,Lt,"f"),z(this,Bt,"f")))!=null;){if(n.carriage&&z(this,Bt,"f")==null){re(this,Bt,n.index,"f");continue}if(z(this,Bt,"f")!=null&&(n.index!==z(this,Bt,"f")+1||n.carriage)){a.push(Pc(z(this,Lt,"f").subarray(0,z(this,Bt,"f")-1))),re(this,Lt,z(this,Lt,"f").subarray(z(this,Bt,"f")),"f"),re(this,Bt,null,"f");continue}let i=z(this,Bt,"f")!==null?n.preceding-1:n.preceding,s=Pc(z(this,Lt,"f").subarray(0,i));a.push(s),re(this,Lt,z(this,Lt,"f").subarray(n.index),"f"),re(this,Bt,null,"f")}return a}flush(){return z(this,Lt,"f").length?this.decode(`
|
|
3255
|
+
`):[]}};Lt=new WeakMap,Bt=new WeakMap;Mr.NEWLINE_CHARS=new Set([`
|
|
3256
|
+
`,"\r"]);Mr.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function tS(r,e){for(let n=e??0;n<r.length;n++){if(r[n]===10)return{preceding:n,index:n+1,carriage:!1};if(r[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function Em(r){for(let a=0;a<r.length-1;a++){if(r[a]===10&&r[a+1]===10||r[a]===13&&r[a+1]===13)return a+2;if(r[a]===13&&r[a+1]===10&&a+3<r.length&&r[a+2]===13&&r[a+3]===10)return a+4}return-1}var Fs={off:0,error:200,warn:300,info:400,debug:500},Dc=(r,e,t)=>{if(r){if(lm(Fs,r))return r;at(t).warn(`${e} was set to ${JSON.stringify(r)}, expected one of ${JSON.stringify(Object.keys(Fs))}`)}};function vi(){}function Bs(r,e,t){return!e||Fs[r]>Fs[t]?vi:e[r].bind(e)}var rS={error:vi,warn:vi,info:vi,debug:vi},wm=new WeakMap;function at(r){let e=r.logger,t=r.logLevel??"off";if(!e)return rS;let a=wm.get(e);if(a&&a[0]===t)return a[1];let n={error:Bs("error",e,t),warn:Bs("warn",e,t),info:Bs("info",e,t),debug:Bs("debug",e,t)};return wm.set(e,[t,n]),n}var Or=r=>(r.options&&(r.options={...r.options},delete r.options.headers),r.headers&&(r.headers=Object.fromEntries((r.headers instanceof Headers?[...r.headers]:Object.entries(r.headers)).map(([e,t])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":t]))),"retryOfRequestLogID"in r&&(r.retryOfRequestLogID&&(r.retryOf=r.retryOfRequestLogID),delete r.retryOfRequestLogID),r);var _i,fr=class r{constructor(e,t,a){this.iterator=e,_i.set(this,void 0),this.controller=t,re(this,_i,a,"f")}static fromSSEResponse(e,t,a){let n=!1,i=a?at(a):console;async function*s(){if(n)throw new te("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let o=!1;try{for await(let l of nS(e,t)){if(l.event==="completion")try{yield JSON.parse(l.data)}catch(c){throw i.error("Could not parse message into JSON:",l.data),i.error("From chunk:",l.raw),c}if(l.event==="message_start"||l.event==="message_delta"||l.event==="message_stop"||l.event==="content_block_start"||l.event==="content_block_delta"||l.event==="content_block_stop")try{yield JSON.parse(l.data)}catch(c){throw i.error("Could not parse message into JSON:",l.data),i.error("From chunk:",l.raw),c}if(l.event!=="ping"&&l.event==="error")throw new nt(void 0,Os(l.data)??l.data,void 0,e.headers)}o=!0}catch(l){if(Nr(l))return;throw l}finally{o||t.abort()}}return new r(s,t,a)}static fromReadableStream(e,t,a){let n=!1;async function*i(){let o=new Mr,l=yi(e);for await(let c of l)for(let u of o.decode(c))yield u;for(let c of o.flush())yield c}async function*s(){if(n)throw new te("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let o=!1;try{for await(let l of i())o||l&&(yield JSON.parse(l));o=!0}catch(l){if(Nr(l))return;throw l}finally{o||t.abort()}}return new r(s,t,a)}[(_i=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],a=this.iterator(),n=i=>({next:()=>{if(i.length===0){let s=a.next();e.push(s),t.push(s)}return i.shift()}});return[new r(()=>n(e),this.controller,z(this,_i,"f")),new r(()=>n(t),this.controller,z(this,_i,"f"))]}toReadableStream(){let e=this,t;return Rc({async start(){t=e[Symbol.asyncIterator]()},async pull(a){try{let{value:n,done:i}=await t.next();if(i)return a.close();let s=bi(JSON.stringify(n)+`
|
|
3257
|
+
`);a.enqueue(s)}catch(n){a.error(n)}},async cancel(){await t.return?.()}})}};async function*nS(r,e){if(!r.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new te("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new te("Attempted to iterate over a response with no body");let t=new Nc,a=new Mr,n=yi(r.body);for await(let i of aS(n))for(let s of a.decode(i)){let o=t.decode(s);o&&(yield o)}for(let i of a.flush()){let s=t.decode(i);s&&(yield s)}}async function*aS(r){let e=new Uint8Array;for await(let t of r){if(t==null)continue;let a=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?bi(t):t,n=new Uint8Array(e.length+a.length);n.set(e),n.set(a,e.length),e=n;let i;for(;(i=Em(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var Nc=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
|
|
3258
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,a,n]=iS(e,":");return n.startsWith(" ")&&(n=n.substring(1)),t==="event"?this.event=n:t==="data"&&this.data.push(n),null}};function iS(r,e){let t=r.indexOf(e);return t!==-1?[r.substring(0,t),e,r.substring(t+e.length)]:[r,"",""]}async function Gs(r,e){let{response:t,requestLogID:a,retryOfRequestLogID:n,startTime:i}=e,s=await(async()=>{if(e.options.stream)return at(r).debug("response",t.status,t.url,t.headers,t.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(t,e.controller):fr.fromSSEResponse(t,e.controller);if(t.status===204)return null;if(e.options.__binaryResponse)return t;let l=t.headers.get("content-type")?.split(";")[0]?.trim();if(l?.includes("application/json")||l?.endsWith("+json")){let p=await t.json();return Mc(p,t)}return await t.text()})();return at(r).debug(`[${a}] response parsed`,Or({retryOfRequestLogID:n,url:t.url,status:t.status,body:s,durationMs:Date.now()-i})),s}function Mc(r,e){return!r||typeof r!="object"||Array.isArray(r)?r:Object.defineProperty(r,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}var Si,kn=class r extends Promise{constructor(e,t,a=Gs){super(n=>{n(null)}),this.responsePromise=t,this.parseResponse=a,Si.set(this,void 0),re(this,Si,e,"f")}_thenUnwrap(e){return new r(z(this,Si,"f"),this.responsePromise,async(t,a)=>Mc(e(await this.parseResponse(t,a),a),a.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(z(this,Si,"f"),e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Si=new WeakMap;var zs,Oc=class{constructor(e,t,a,n){zs.set(this,void 0),re(this,zs,e,"f"),this.options=n,this.response=t,this.body=a}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new te("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await z(this,zs,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(zs=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},Ei=class extends kn{constructor(e,t,a){super(e,t,async(n,i)=>new a(n,i.response,await Gs(n,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},Xt=class extends Oc{constructor(e,t,a,n){super(e,t,a,n),this.data=a.data||[],this.has_more=a.has_more||!1,this.first_id=a.first_id||null,this.last_id=a.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let t=this.first_id;return t?{...this.options,query:{...Ic(this.options.query),before_id:t}}:null}let e=this.last_id;return e?{...this.options,query:{...Ic(this.options.query),after_id:e}}:null}};var Bc=()=>{if(typeof File>"u"){let{process:r}=globalThis,e=typeof r?.versions?.node=="string"&&parseInt(r.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Cn(r,e,t){return Bc(),new File(r,e??"unknown_file",t)}function wi(r){return(typeof r=="object"&&r!==null&&("name"in r&&r.name&&String(r.name)||"url"in r&&r.url&&String(r.url)||"filename"in r&&r.filename&&String(r.filename)||"path"in r&&r.path&&String(r.path))||"").split(/[\\/]/).pop()||void 0}var Fc=r=>r!=null&&typeof r=="object"&&typeof r[Symbol.asyncIterator]=="function";var Cm=async(r,e)=>({...r,body:await lS(r.body,e)}),km=new WeakMap;function oS(r){let e=typeof r=="function"?r:r.fetch,t=km.get(e);if(t)return t;let a=(async()=>{try{let n="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new n(i).text()}catch{return!0}})();return km.set(e,a),a}var lS=async(r,e)=>{if(!await oS(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let t=new FormData;return await Promise.all(Object.entries(r||{}).map(([a,n])=>Lc(t,a,n))),t},cS=r=>r instanceof Blob&&"name"in r;var Lc=async(r,e,t)=>{if(t!==void 0){if(t==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")r.append(e,String(t));else if(t instanceof Response){let a={},n=t.headers.get("Content-Type");n&&(a={type:n}),r.append(e,Cn([await t.blob()],wi(t),a))}else if(Fc(t))r.append(e,Cn([await new Response(Ls(t)).blob()],wi(t)));else if(cS(t))r.append(e,Cn([t],wi(t),{type:t.type}));else if(Array.isArray(t))await Promise.all(t.map(a=>Lc(r,e+"[]",a)));else if(typeof t=="object")await Promise.all(Object.entries(t).map(([a,n])=>Lc(r,`${e}[${a}]`,n)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${t} instead`)}};var xm=r=>r!=null&&typeof r=="object"&&typeof r.size=="number"&&typeof r.type=="string"&&typeof r.text=="function"&&typeof r.slice=="function"&&typeof r.arrayBuffer=="function",uS=r=>r!=null&&typeof r=="object"&&typeof r.name=="string"&&typeof r.lastModified=="number"&&xm(r),dS=r=>r!=null&&typeof r=="object"&&typeof r.url=="string"&&typeof r.blob=="function";async function Us(r,e,t){if(Bc(),r=await r,e||(e=wi(r)),uS(r))return r instanceof File&&e==null&&t==null?r:Cn([await r.arrayBuffer()],e??r.name,{type:r.type,lastModified:r.lastModified,...t});if(dS(r)){let n=await r.blob();return e||(e=new URL(r.url).pathname.split(/[\\/]/).pop()),Cn(await Gc(n),e,t)}let a=await Gc(r);if(!t?.type){let n=a.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof n=="string"&&(t={...t,type:n})}return Cn(a,e,t)}async function Gc(r){let e=[];if(typeof r=="string"||ArrayBuffer.isView(r)||r instanceof ArrayBuffer)e.push(r);else if(xm(r))e.push(r instanceof Blob?r:await r.arrayBuffer());else if(Fc(r))for await(let t of r)e.push(...await Gc(t));else{let t=r?.constructor?.name;throw new Error(`Unexpected data type: ${typeof r}${t?`; constructor: ${t}`:""}${pS(r)}`)}return e}function pS(r){return typeof r!="object"||r===null?"":`; props: [${Object.getOwnPropertyNames(r).map(t=>`"${t}"`).join(", ")}]`}var et=class{constructor(e){this._client=e}};var Tm=Symbol.for("brand.privateNullableHeaders");function*hS(r){if(!r)return;if(Tm in r){let{values:a,nulls:n}=r;yield*a.entries();for(let i of n)yield[i,null];return}let e=!1,t;r instanceof Headers?t=r.entries():Ac(r)?t=r:(e=!0,t=Object.entries(r??{}));for(let a of t){let n=a[0];if(typeof n!="string")throw new TypeError("expected header name to be a string");let i=Ac(a[1])?a[1]:[a[1]],s=!1;for(let o of i)o!==void 0&&(e&&!s&&(s=!0,yield[n,null]),yield[n,o])}}var ke=r=>{let e=new Headers,t=new Set;for(let a of r){let n=new Set;for(let[i,s]of hS(a)){let o=i.toLowerCase();n.has(o)||(e.delete(i),n.add(o)),s===null?(e.delete(i),t.add(o)):(e.append(i,s),t.delete(o))}}return{[Tm]:!0,values:e,nulls:t}};function Im(r){return r.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Am=Object.freeze(Object.create(null)),gS=(r=Im)=>function(t,...a){if(t.length===1)return t[0];let n=!1,i=[],s=t.reduce((u,p,m)=>{/[?#]/.test(p)&&(n=!0);let d=a[m],g=(n?encodeURIComponent:r)(""+d);return m!==a.length&&(d==null||typeof d=="object"&&d.toString===Object.getPrototypeOf(Object.getPrototypeOf(d.hasOwnProperty??Am)??Am)?.toString)&&(g=d+"",i.push({start:u.length+p.length,length:g.length,error:`Value of type ${Object.prototype.toString.call(d).slice(8,-1)} is not a valid path parameter`})),u+p+(m===a.length?"":g)},""),o=s.split(/[?#]/,1)[0],l=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=l.exec(o))!==null;)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(i.sort((u,p)=>u.start-p.start),i.length>0){let u=0,p=i.reduce((m,d)=>{let g=" ".repeat(d.start-u),f="^".repeat(d.length);return u=d.start+d.length,m+g+f},"");throw new te(`Path parameters result in path with invalid segments:
|
|
3259
|
+
${i.map(m=>m.error).join(`
|
|
3260
|
+
`)}
|
|
3261
|
+
${s}
|
|
3262
|
+
${p}`)}return s},gt=gS(Im);var Ia=class extends et{list(e={},t){let{betas:a,...n}=e??{};return this._client.getAPIList("/v1/files",Xt,{query:n,...t,headers:ke([{"anthropic-beta":[...a??[],"files-api-2025-04-14"].toString()},t?.headers])})}delete(e,t={},a){let{betas:n}=t??{};return this._client.delete(gt`/v1/files/${e}`,{...a,headers:ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},a?.headers])})}download(e,t={},a){let{betas:n}=t??{};return this._client.get(gt`/v1/files/${e}/content`,{...a,headers:ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},a?.headers]),__binaryResponse:!0})}retrieveMetadata(e,t={},a){let{betas:n}=t??{};return this._client.get(gt`/v1/files/${e}`,{...a,headers:ke([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},a?.headers])})}upload(e,t){let{betas:a,...n}=e;return this._client.post("/v1/files",Cm({body:n,...t,headers:ke([{"anthropic-beta":[...a??[],"files-api-2025-04-14"].toString()},t?.headers])},this._client))}};var Ra=class extends et{retrieve(e,t={},a){let{betas:n}=t??{};return this._client.get(gt`/v1/models/${e}?beta=true`,{...a,headers:ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},a?.headers])})}list(e={},t){let{betas:a,...n}=e??{};return this._client.getAPIList("/v1/models?beta=true",Xt,{query:n,...t,headers:ke([{...a?.toString()!=null?{"anthropic-beta":a?.toString()}:void 0},t?.headers])})}};var Pa=class r{constructor(e,t){this.iterator=e,this.controller=t}async*decoder(){let e=new Mr;for await(let t of this.iterator)for(let a of e.decode(t))yield JSON.parse(a);for(let t of e.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,t){if(!e.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new te("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new te("Attempted to iterate over a response with no body");return new r(yi(e.body),t)}};var Da=class extends et{create(e,t){let{betas:a,...n}=e;return this._client.post("/v1/messages/batches?beta=true",{body:n,...t,headers:ke([{"anthropic-beta":[...a??[],"message-batches-2024-09-24"].toString()},t?.headers])})}retrieve(e,t={},a){let{betas:n}=t??{};return this._client.get(gt`/v1/messages/batches/${e}?beta=true`,{...a,headers:ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},a?.headers])})}list(e={},t){let{betas:a,...n}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",Xt,{query:n,...t,headers:ke([{"anthropic-beta":[...a??[],"message-batches-2024-09-24"].toString()},t?.headers])})}delete(e,t={},a){let{betas:n}=t??{};return this._client.delete(gt`/v1/messages/batches/${e}?beta=true`,{...a,headers:ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},a?.headers])})}cancel(e,t={},a){let{betas:n}=t??{};return this._client.post(gt`/v1/messages/batches/${e}/cancel?beta=true`,{...a,headers:ke([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},a?.headers])})}async results(e,t={},a){let n=await this.retrieve(e);if(!n.results_url)throw new te(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);let{betas:i}=t??{};return this._client.get(n.results_url,{...a,headers:ke([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},a?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((s,o)=>Pa.fromResponse(o.response,o.controller))}};var vS=r=>{let e=0,t=[];for(;e<r.length;){let a=r[e];if(a==="\\"){e++;continue}if(a==="{"){t.push({type:"brace",value:"{"}),e++;continue}if(a==="}"){t.push({type:"brace",value:"}"}),e++;continue}if(a==="["){t.push({type:"paren",value:"["}),e++;continue}if(a==="]"){t.push({type:"paren",value:"]"}),e++;continue}if(a===":"){t.push({type:"separator",value:":"}),e++;continue}if(a===","){t.push({type:"delimiter",value:","}),e++;continue}if(a==='"'){let o="",l=!1;for(a=r[++e];a!=='"';){if(e===r.length){l=!0;break}if(a==="\\"){if(e++,e===r.length){l=!0;break}o+=a+r[e],a=r[++e]}else o+=a,a=r[++e]}a=r[++e],l||t.push({type:"string",value:o});continue}if(a&&/\s/.test(a)){e++;continue}let i=/[0-9]/;if(a&&i.test(a)||a==="-"||a==="."){let o="";for(a==="-"&&(o+=a,a=r[++e]);a&&i.test(a)||a===".";)o+=a,a=r[++e];t.push({type:"number",value:o});continue}let s=/[a-z]/i;if(a&&s.test(a)){let o="";for(;a&&s.test(a)&&e!==r.length;)o+=a,a=r[++e];if(o=="true"||o=="false"||o==="null")t.push({type:"name",value:o});else{e++;continue}continue}e++}return t},Na=r=>{if(r.length===0)return r;let e=r[r.length-1];switch(e.type){case"separator":return r=r.slice(0,r.length-1),Na(r);break;case"number":let t=e.value[e.value.length-1];if(t==="."||t==="-")return r=r.slice(0,r.length-1),Na(r);case"string":let a=r[r.length-2];if(a?.type==="delimiter")return r=r.slice(0,r.length-1),Na(r);if(a?.type==="brace"&&a.value==="{")return r=r.slice(0,r.length-1),Na(r);break;case"delimiter":return r=r.slice(0,r.length-1),Na(r);break}return r},_S=r=>{let e=[];return r.map(t=>{t.type==="brace"&&(t.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),t.type==="paren"&&(t.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(t=>{t==="}"?r.push({type:"brace",value:"}"}):t==="]"&&r.push({type:"paren",value:"]"})}),r},SS=r=>{let e="";return r.map(t=>{switch(t.type){case"string":e+='"'+t.value+'"';break;default:e+=t.value;break}}),e},Hs=r=>JSON.parse(SS(_S(Na(vS(r)))));var Yt,en,ki,Vs,Ci,xi,js,Ti,Lr,Ai,Ws,qs,Ma,$s,Ks,zc,Rm,Xs,Uc,Hc,Vc,Pm,Dm="__json_buf";function Nm(r){return r.type==="tool_use"||r.type==="server_tool_use"||r.type==="mcp_tool_use"}var Ys=class r{constructor(){Yt.add(this),this.messages=[],this.receivedMessages=[],en.set(this,void 0),this.controller=new AbortController,ki.set(this,void 0),Vs.set(this,()=>{}),Ci.set(this,()=>{}),xi.set(this,void 0),js.set(this,()=>{}),Ti.set(this,()=>{}),Lr.set(this,{}),Ai.set(this,!1),Ws.set(this,!1),qs.set(this,!1),Ma.set(this,!1),$s.set(this,void 0),Ks.set(this,void 0),Xs.set(this,e=>{if(re(this,Ws,!0,"f"),Nr(e)&&(e=new ut),e instanceof ut)return re(this,qs,!0,"f"),this._emit("abort",e);if(e instanceof te)return this._emit("error",e);if(e instanceof Error){let t=new te(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new te(String(e)))}),re(this,ki,new Promise((e,t)=>{re(this,Vs,e,"f"),re(this,Ci,t,"f")}),"f"),re(this,xi,new Promise((e,t)=>{re(this,js,e,"f"),re(this,Ti,t,"f")}),"f"),z(this,ki,"f").catch(()=>{}),z(this,xi,"f").catch(()=>{})}get response(){return z(this,$s,"f")}get request_id(){return z(this,Ks,"f")}async withResponse(){let e=await z(this,ki,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new r;return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,a){let n=new r;for(let i of t.messages)n._addMessageParam(i);return n._run(()=>n._createMessage(e,{...t,stream:!0},{...a,headers:{...a?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},z(this,Xs,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit("message",e)}async _createMessage(e,t,a){let n=a?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{z(this,Yt,"m",Uc).call(this);let{response:s,data:o}=await e.create({...t,stream:!0},{...a,signal:this.controller.signal}).withResponse();this._connected(s);for await(let l of o)z(this,Yt,"m",Hc).call(this,l);if(o.controller.signal?.aborted)throw new ut;z(this,Yt,"m",Vc).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}_connected(e){this.ended||(re(this,$s,e,"f"),re(this,Ks,e?.headers.get("request-id"),"f"),z(this,Vs,"f").call(this,e),this._emit("connect"))}get ended(){return z(this,Ai,"f")}get errored(){return z(this,Ws,"f")}get aborted(){return z(this,qs,"f")}abort(){this.controller.abort()}on(e,t){return(z(this,Lr,"f")[e]||(z(this,Lr,"f")[e]=[])).push({listener:t}),this}off(e,t){let a=z(this,Lr,"f")[e];if(!a)return this;let n=a.findIndex(i=>i.listener===t);return n>=0&&a.splice(n,1),this}once(e,t){return(z(this,Lr,"f")[e]||(z(this,Lr,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,a)=>{re(this,Ma,!0,"f"),e!=="error"&&this.once("error",a),this.once(e,t)})}async done(){re(this,Ma,!0,"f"),await z(this,xi,"f")}get currentMessage(){return z(this,en,"f")}async finalMessage(){return await this.done(),z(this,Yt,"m",zc).call(this)}async finalText(){return await this.done(),z(this,Yt,"m",Rm).call(this)}_emit(e,...t){if(z(this,Ai,"f"))return;e==="end"&&(re(this,Ai,!0,"f"),z(this,js,"f").call(this));let a=z(this,Lr,"f")[e];if(a&&(z(this,Lr,"f")[e]=a.filter(n=>!n.once),a.forEach(({listener:n})=>n(...t))),e==="abort"){let n=t[0];!z(this,Ma,"f")&&!a?.length&&Promise.reject(n),z(this,Ci,"f").call(this,n),z(this,Ti,"f").call(this,n),this._emit("end");return}if(e==="error"){let n=t[0];!z(this,Ma,"f")&&!a?.length&&Promise.reject(n),z(this,Ci,"f").call(this,n),z(this,Ti,"f").call(this,n),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",z(this,Yt,"m",zc).call(this))}async _fromReadableStream(e,t){let a=t?.signal,n;a&&(a.aborted&&this.controller.abort(),n=this.controller.abort.bind(this.controller),a.addEventListener("abort",n));try{z(this,Yt,"m",Uc).call(this),this._connected(null);let i=fr.fromReadableStream(e,this.controller);for await(let s of i)z(this,Yt,"m",Hc).call(this,s);if(i.controller.signal?.aborted)throw new ut;z(this,Yt,"m",Vc).call(this)}finally{a&&n&&a.removeEventListener("abort",n)}}[(en=new WeakMap,ki=new WeakMap,Vs=new WeakMap,Ci=new WeakMap,xi=new WeakMap,js=new WeakMap,Ti=new WeakMap,Lr=new WeakMap,Ai=new WeakMap,Ws=new WeakMap,qs=new WeakMap,Ma=new WeakMap,$s=new WeakMap,Ks=new WeakMap,Xs=new WeakMap,Yt=new WeakSet,zc=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Rm=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter(a=>a.type==="text").map(a=>a.text);if(t.length===0)throw new te("stream ended without producing a content block with type=text");return t.join(" ")},Uc=function(){this.ended||re(this,en,void 0,"f")},Hc=function(t){if(this.ended)return;let a=z(this,Yt,"m",Pm).call(this,t);switch(this._emit("streamEvent",t,a),t.type){case"content_block_delta":{let n=a.content.at(-1);switch(t.delta.type){case"text_delta":{n.type==="text"&&this._emit("text",t.delta.text,n.text||"");break}case"citations_delta":{n.type==="text"&&this._emit("citation",t.delta.citation,n.citations??[]);break}case"input_json_delta":{Nm(n)&&n.input&&this._emit("inputJson",t.delta.partial_json,n.input);break}case"thinking_delta":{n.type==="thinking"&&this._emit("thinking",t.delta.thinking,n.thinking);break}case"signature_delta":{n.type==="thinking"&&this._emit("signature",n.signature);break}default:t.delta}break}case"message_stop":{this._addMessageParam(a),this._addMessage(a,!0);break}case"content_block_stop":{this._emit("contentBlock",a.content.at(-1));break}case"message_start":{re(this,en,a,"f");break}case"content_block_start":case"message_delta":break}},Vc=function(){if(this.ended)throw new te("stream has ended, this shouldn't happen");let t=z(this,en,"f");if(!t)throw new te("request ended without sending any chunks");return re(this,en,void 0,"f"),t},Pm=function(t){let a=z(this,en,"f");if(t.type==="message_start"){if(a)throw new te(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!a)throw new te(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return a;case"message_delta":return a.container=t.delta.container,a.stop_reason=t.delta.stop_reason,a.stop_sequence=t.delta.stop_sequence,a.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null&&(a.usage.input_tokens=t.usage.input_tokens),t.usage.cache_creation_input_tokens!=null&&(a.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens),t.usage.cache_read_input_tokens!=null&&(a.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens),t.usage.server_tool_use!=null&&(a.usage.server_tool_use=t.usage.server_tool_use),a;case"content_block_start":return a.content.push(t.content_block),a;case"content_block_delta":{let n=a.content.at(t.index);switch(t.delta.type){case"text_delta":{n?.type==="text"&&(a.content[t.index]={...n,text:(n.text||"")+t.delta.text});break}case"citations_delta":{n?.type==="text"&&(a.content[t.index]={...n,citations:[...n.citations??[],t.delta.citation]});break}case"input_json_delta":{if(n&&Nm(n)){let i=n[Dm]||"";i+=t.delta.partial_json;let s={...n};if(Object.defineProperty(s,Dm,{value:i,enumerable:!1,writable:!0}),i)try{s.input=Hs(i)}catch(o){let l=new te(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${o}. JSON: ${i}`);z(this,Xs,"f").call(this,l)}a.content[t.index]=s}break}case"thinking_delta":{n?.type==="thinking"&&(a.content[t.index]={...n,thinking:n.thinking+t.delta.thinking});break}case"signature_delta":{n?.type==="thinking"&&(a.content[t.index]={...n,signature:t.delta.signature});break}default:t.delta}return a}case"content_block_stop":return a}},Symbol.asyncIterator)](){let e=[],t=[],a=!1;return this.on("streamEvent",n=>{let i=t.shift();i?i.resolve(n):e.push(n)}),this.on("end",()=>{a=!0;for(let n of t)n.resolve(void 0);t.length=0}),this.on("abort",n=>{a=!0;for(let i of t)i.reject(n);t.length=0}),this.on("error",n=>{a=!0;for(let i of t)i.reject(n);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:a?{value:void 0,done:!0}:new Promise((i,s)=>t.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new fr(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var Js={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};var Mm={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"},xn=class extends et{constructor(){super(...arguments),this.batches=new Da(this._client)}create(e,t){let{betas:a,...n}=e;n.model in Mm&&console.warn(`The model '${n.model}' is deprecated and will reach end-of-life on ${Mm[n.model]}
|
|
3263
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let i=this._client._options.timeout;if(!n.stream&&i==null){let s=Js[n.model]??void 0;i=this._client.calculateNonstreamingTimeout(n.max_tokens,s)}return this._client.post("/v1/messages?beta=true",{body:n,timeout:i??6e5,...t,headers:ke([{...a?.toString()!=null?{"anthropic-beta":a?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}stream(e,t){return Ys.createMessage(this,e,t)}countTokens(e,t){let{betas:a,...n}=e;return this._client.post("/v1/messages/count_tokens?beta=true",{body:n,...t,headers:ke([{"anthropic-beta":[...a??[],"token-counting-2024-11-01"].toString()},t?.headers])})}};xn.Batches=Da;var yr=class extends et{constructor(){super(...arguments),this.models=new Ra(this._client),this.messages=new xn(this._client),this.files=new Ia(this._client)}};yr.Models=Ra;yr.Messages=xn;yr.Files=Ia;var Tn=class extends et{create(e,t){let{betas:a,...n}=e;return this._client.post("/v1/complete",{body:n,timeout:this._client._options.timeout??6e5,...t,headers:ke([{...a?.toString()!=null?{"anthropic-beta":a?.toString()}:void 0},t?.headers]),stream:e.stream??!1})}};var Jt,tn,Ii,Zs,Ri,Pi,Qs,Di,Br,Ni,eo,to,Oa,ro,no,jc,Om,Wc,qc,$c,Kc,Lm,Bm="__json_buf";function Fm(r){return r.type==="tool_use"||r.type==="server_tool_use"}var ao=class r{constructor(){Jt.add(this),this.messages=[],this.receivedMessages=[],tn.set(this,void 0),this.controller=new AbortController,Ii.set(this,void 0),Zs.set(this,()=>{}),Ri.set(this,()=>{}),Pi.set(this,void 0),Qs.set(this,()=>{}),Di.set(this,()=>{}),Br.set(this,{}),Ni.set(this,!1),eo.set(this,!1),to.set(this,!1),Oa.set(this,!1),ro.set(this,void 0),no.set(this,void 0),Wc.set(this,e=>{if(re(this,eo,!0,"f"),Nr(e)&&(e=new ut),e instanceof ut)return re(this,to,!0,"f"),this._emit("abort",e);if(e instanceof te)return this._emit("error",e);if(e instanceof Error){let t=new te(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new te(String(e)))}),re(this,Ii,new Promise((e,t)=>{re(this,Zs,e,"f"),re(this,Ri,t,"f")}),"f"),re(this,Pi,new Promise((e,t)=>{re(this,Qs,e,"f"),re(this,Di,t,"f")}),"f"),z(this,Ii,"f").catch(()=>{}),z(this,Pi,"f").catch(()=>{})}get response(){return z(this,ro,"f")}get request_id(){return z(this,no,"f")}async withResponse(){let e=await z(this,Ii,"f");if(!e)throw new Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let t=new r;return t._run(()=>t._fromReadableStream(e)),t}static createMessage(e,t,a){let n=new r;for(let i of t.messages)n._addMessageParam(i);return n._run(()=>n._createMessage(e,{...t,stream:!0},{...a,headers:{...a?.headers,"X-Stainless-Helper-Method":"stream"}})),n}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},z(this,Wc,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit("message",e)}async _createMessage(e,t,a){let n=a?.signal,i;n&&(n.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),n.addEventListener("abort",i));try{z(this,Jt,"m",qc).call(this);let{response:s,data:o}=await e.create({...t,stream:!0},{...a,signal:this.controller.signal}).withResponse();this._connected(s);for await(let l of o)z(this,Jt,"m",$c).call(this,l);if(o.controller.signal?.aborted)throw new ut;z(this,Jt,"m",Kc).call(this)}finally{n&&i&&n.removeEventListener("abort",i)}}_connected(e){this.ended||(re(this,ro,e,"f"),re(this,no,e?.headers.get("request-id"),"f"),z(this,Zs,"f").call(this,e),this._emit("connect"))}get ended(){return z(this,Ni,"f")}get errored(){return z(this,eo,"f")}get aborted(){return z(this,to,"f")}abort(){this.controller.abort()}on(e,t){return(z(this,Br,"f")[e]||(z(this,Br,"f")[e]=[])).push({listener:t}),this}off(e,t){let a=z(this,Br,"f")[e];if(!a)return this;let n=a.findIndex(i=>i.listener===t);return n>=0&&a.splice(n,1),this}once(e,t){return(z(this,Br,"f")[e]||(z(this,Br,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,a)=>{re(this,Oa,!0,"f"),e!=="error"&&this.once("error",a),this.once(e,t)})}async done(){re(this,Oa,!0,"f"),await z(this,Pi,"f")}get currentMessage(){return z(this,tn,"f")}async finalMessage(){return await this.done(),z(this,Jt,"m",jc).call(this)}async finalText(){return await this.done(),z(this,Jt,"m",Om).call(this)}_emit(e,...t){if(z(this,Ni,"f"))return;e==="end"&&(re(this,Ni,!0,"f"),z(this,Qs,"f").call(this));let a=z(this,Br,"f")[e];if(a&&(z(this,Br,"f")[e]=a.filter(n=>!n.once),a.forEach(({listener:n})=>n(...t))),e==="abort"){let n=t[0];!z(this,Oa,"f")&&!a?.length&&Promise.reject(n),z(this,Ri,"f").call(this,n),z(this,Di,"f").call(this,n),this._emit("end");return}if(e==="error"){let n=t[0];!z(this,Oa,"f")&&!a?.length&&Promise.reject(n),z(this,Ri,"f").call(this,n),z(this,Di,"f").call(this,n),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",z(this,Jt,"m",jc).call(this))}async _fromReadableStream(e,t){let a=t?.signal,n;a&&(a.aborted&&this.controller.abort(),n=this.controller.abort.bind(this.controller),a.addEventListener("abort",n));try{z(this,Jt,"m",qc).call(this),this._connected(null);let i=fr.fromReadableStream(e,this.controller);for await(let s of i)z(this,Jt,"m",$c).call(this,s);if(i.controller.signal?.aborted)throw new ut;z(this,Jt,"m",Kc).call(this)}finally{a&&n&&a.removeEventListener("abort",n)}}[(tn=new WeakMap,Ii=new WeakMap,Zs=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,Qs=new WeakMap,Di=new WeakMap,Br=new WeakMap,Ni=new WeakMap,eo=new WeakMap,to=new WeakMap,Oa=new WeakMap,ro=new WeakMap,no=new WeakMap,Wc=new WeakMap,Jt=new WeakSet,jc=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Om=function(){if(this.receivedMessages.length===0)throw new te("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter(a=>a.type==="text").map(a=>a.text);if(t.length===0)throw new te("stream ended without producing a content block with type=text");return t.join(" ")},qc=function(){this.ended||re(this,tn,void 0,"f")},$c=function(t){if(this.ended)return;let a=z(this,Jt,"m",Lm).call(this,t);switch(this._emit("streamEvent",t,a),t.type){case"content_block_delta":{let n=a.content.at(-1);switch(t.delta.type){case"text_delta":{n.type==="text"&&this._emit("text",t.delta.text,n.text||"");break}case"citations_delta":{n.type==="text"&&this._emit("citation",t.delta.citation,n.citations??[]);break}case"input_json_delta":{Fm(n)&&n.input&&this._emit("inputJson",t.delta.partial_json,n.input);break}case"thinking_delta":{n.type==="thinking"&&this._emit("thinking",t.delta.thinking,n.thinking);break}case"signature_delta":{n.type==="thinking"&&this._emit("signature",n.signature);break}default:t.delta}break}case"message_stop":{this._addMessageParam(a),this._addMessage(a,!0);break}case"content_block_stop":{this._emit("contentBlock",a.content.at(-1));break}case"message_start":{re(this,tn,a,"f");break}case"content_block_start":case"message_delta":break}},Kc=function(){if(this.ended)throw new te("stream has ended, this shouldn't happen");let t=z(this,tn,"f");if(!t)throw new te("request ended without sending any chunks");return re(this,tn,void 0,"f"),t},Lm=function(t){let a=z(this,tn,"f");if(t.type==="message_start"){if(a)throw new te(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!a)throw new te(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return a;case"message_delta":return a.stop_reason=t.delta.stop_reason,a.stop_sequence=t.delta.stop_sequence,a.usage.output_tokens=t.usage.output_tokens,t.usage.input_tokens!=null&&(a.usage.input_tokens=t.usage.input_tokens),t.usage.cache_creation_input_tokens!=null&&(a.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens),t.usage.cache_read_input_tokens!=null&&(a.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens),t.usage.server_tool_use!=null&&(a.usage.server_tool_use=t.usage.server_tool_use),a;case"content_block_start":return a.content.push({...t.content_block}),a;case"content_block_delta":{let n=a.content.at(t.index);switch(t.delta.type){case"text_delta":{n?.type==="text"&&(a.content[t.index]={...n,text:(n.text||"")+t.delta.text});break}case"citations_delta":{n?.type==="text"&&(a.content[t.index]={...n,citations:[...n.citations??[],t.delta.citation]});break}case"input_json_delta":{if(n&&Fm(n)){let i=n[Bm]||"";i+=t.delta.partial_json;let s={...n};Object.defineProperty(s,Bm,{value:i,enumerable:!1,writable:!0}),i&&(s.input=Hs(i)),a.content[t.index]=s}break}case"thinking_delta":{n?.type==="thinking"&&(a.content[t.index]={...n,thinking:n.thinking+t.delta.thinking});break}case"signature_delta":{n?.type==="thinking"&&(a.content[t.index]={...n,signature:t.delta.signature});break}default:t.delta}return a}case"content_block_stop":return a}},Symbol.asyncIterator)](){let e=[],t=[],a=!1;return this.on("streamEvent",n=>{let i=t.shift();i?i.resolve(n):e.push(n)}),this.on("end",()=>{a=!0;for(let n of t)n.resolve(void 0);t.length=0}),this.on("abort",n=>{a=!0;for(let i of t)i.reject(n);t.length=0}),this.on("error",n=>{a=!0;for(let i of t)i.reject(n);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:a?{value:void 0,done:!0}:new Promise((i,s)=>t.push({resolve:i,reject:s})).then(i=>i?{value:i,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new fr(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};var La=class extends et{create(e,t){return this._client.post("/v1/messages/batches",{body:e,...t})}retrieve(e,t){return this._client.get(gt`/v1/messages/batches/${e}`,t)}list(e={},t){return this._client.getAPIList("/v1/messages/batches",Xt,{query:e,...t})}delete(e,t){return this._client.delete(gt`/v1/messages/batches/${e}`,t)}cancel(e,t){return this._client.post(gt`/v1/messages/batches/${e}/cancel`,t)}async results(e,t){let a=await this.retrieve(e);if(!a.results_url)throw new te(`No batch \`results_url\`; Has it finished processing? ${a.processing_status} - ${a.id}`);return this._client.get(a.results_url,{...t,headers:ke([{Accept:"application/binary"},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((n,i)=>Pa.fromResponse(i.response,i.controller))}};var rn=class extends et{constructor(){super(...arguments),this.batches=new La(this._client)}create(e,t){e.model in Gm&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${Gm[e.model]}
|
|
3264
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);let a=this._client._options.timeout;if(!e.stream&&a==null){let n=Js[e.model]??void 0;a=this._client.calculateNonstreamingTimeout(e.max_tokens,n)}return this._client.post("/v1/messages",{body:e,timeout:a??6e5,...t,stream:e.stream??!1})}stream(e,t){return ao.createMessage(this,e,t)}countTokens(e,t){return this._client.post("/v1/messages/count_tokens",{body:e,...t})}},Gm={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-5-sonnet-20241022":"October 22, 2025","claude-3-5-sonnet-20240620":"October 22, 2025"};rn.Batches=La;var An=class extends et{retrieve(e,t={},a){let{betas:n}=t??{};return this._client.get(gt`/v1/models/${e}`,{...a,headers:ke([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},a?.headers])})}list(e={},t){let{betas:a,...n}=e??{};return this._client.getAPIList("/v1/models",Xt,{query:n,...t,headers:ke([{...a?.toString()!=null?{"anthropic-beta":a?.toString()}:void 0},t?.headers])})}};var Mi=r=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[r]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(r)?.trim()};var Xc,Yc,io,zm,He=class{constructor({baseURL:e=Mi("ANTHROPIC_BASE_URL"),apiKey:t=Mi("ANTHROPIC_API_KEY")??null,authToken:a=Mi("ANTHROPIC_AUTH_TOKEN")??null,...n}={}){Xc.add(this),io.set(this,void 0);let i={apiKey:t,authToken:a,...n,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&hm())throw new te(`It looks like you're running in a browser-like environment.
|
|
3265
|
+
|
|
3266
|
+
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
3267
|
+
If you understand the risks and have appropriate mitigations in place,
|
|
3268
|
+
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
3269
|
+
|
|
3270
|
+
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
3271
|
+
`);this.baseURL=i.baseURL,this.timeout=i.timeout??Yc.DEFAULT_TIMEOUT,this.logger=i.logger??console;let s="warn";this.logLevel=s,this.logLevel=Dc(i.logLevel,"ClientOptions.logLevel",this)??Dc(Mi("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??s,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??fm(),re(this,io,bm,"f"),this._options=i,this.apiKey=t,this.authToken=a}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(this.apiKey&&e.get("x-api-key"))&&!t.has("x-api-key")&&!(this.authToken&&e.get("authorization"))&&!t.has("authorization"))throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(e){return ke([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return ke([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return ke([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Object.entries(e).filter(([t,a])=>typeof a<"u").map(([t,a])=>{if(typeof a=="string"||typeof a=="number"||typeof a=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(a)}`;if(a===null)return`${encodeURIComponent(t)}=`;throw new te(`Cannot stringify type ${typeof a}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${Qr}`}defaultIdempotencyKey(){return`stainless-node-retry-${xc()}`}makeStatusError(e,t,a,n){return nt.generate(e,t,a,n)}buildURL(e,t,a){let n=!z(this,Xc,"m",zm).call(this)&&a||this.baseURL,i=sm(e)?new URL(e):new URL(n+(n.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery();return om(s)||(t={...s,...t}),typeof t=="object"&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new te("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:t,options:a}){}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,a){return this.request(Promise.resolve(a).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new kn(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,a){let n=await e,i=n.maxRetries??this.maxRetries;t==null&&(t=i),await this.prepareOptions(n);let{req:s,url:o,timeout:l}=await this.buildRequest(n,{retryCount:i-t});await this.prepareRequest(s,{url:o,options:n});let c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),u=a===void 0?"":`, retryOf: ${a}`,p=Date.now();if(at(this).debug(`[${c}] sending request`,Or({retryOfRequestLogID:a,method:n.method,url:o,options:n,headers:s.headers})),n.signal?.aborted)throw new ut;let m=new AbortController,d=await this.fetchWithTimeout(o,s,l,m).catch(fi),g=Date.now();if(d instanceof Error){let b=`retrying, ${t} attempts remaining`;if(n.signal?.aborted)throw new ut;let x=Nr(d)||/timed? ?out/i.test(String(d)+("cause"in d?String(d.cause):""));if(t)return at(this).info(`[${c}] connection ${x?"timed out":"failed"} - ${b}`),at(this).debug(`[${c}] connection ${x?"timed out":"failed"} (${b})`,Or({retryOfRequestLogID:a,url:o,durationMs:g-p,message:d.message})),this.retryRequest(n,t,a??c);throw at(this).info(`[${c}] connection ${x?"timed out":"failed"} - error; no more retries left`),at(this).debug(`[${c}] connection ${x?"timed out":"failed"} (error; no more retries left)`,Or({retryOfRequestLogID:a,url:o,durationMs:g-p,message:d.message})),x?new _a:new Zr({cause:d})}let f=[...d.headers.entries()].filter(([b])=>b==="request-id").map(([b,x])=>", "+b+": "+JSON.stringify(x)).join(""),y=`[${c}${u}${f}] ${s.method} ${o} ${d.ok?"succeeded":"failed"} with status ${d.status} in ${g-p}ms`;if(!d.ok){let b=await this.shouldRetry(d);if(t&&b){let O=`retrying, ${t} attempts remaining`;return await ym(d.body),at(this).info(`${y} - ${O}`),at(this).debug(`[${c}] response error (${O})`,Or({retryOfRequestLogID:a,url:d.url,status:d.status,headers:d.headers,durationMs:g-p})),this.retryRequest(n,t,a??c,d.headers)}let x=b?"error; no more retries left":"error; not retryable";at(this).info(`${y} - ${x}`);let S=await d.text().catch(O=>fi(O).message),A=Os(S),R=A?void 0:S;throw at(this).debug(`[${c}] response error (${x})`,Or({retryOfRequestLogID:a,url:d.url,status:d.status,headers:d.headers,message:R,durationMs:Date.now()-p})),this.makeStatusError(d.status,A,R,d.headers)}return at(this).info(y),at(this).debug(`[${c}] response start`,Or({retryOfRequestLogID:a,url:d.url,status:d.status,headers:d.headers,durationMs:g-p})),{response:d,options:n,controller:m,requestLogID:c,retryOfRequestLogID:a,startTime:p}}getAPIList(e,t,a){return this.requestAPIList(t,{method:"get",path:e,...a})}requestAPIList(e,t){let a=this.makeRequest(t,null,void 0);return new Ei(this,a,e)}async fetchWithTimeout(e,t,a,n){let{signal:i,method:s,...o}=t||{};i&&i.addEventListener("abort",()=>n.abort());let l=setTimeout(()=>n.abort(),a),c=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body=="object"&&o.body!==null&&Symbol.asyncIterator in o.body,u={signal:n.signal,...c?{duplex:"half"}:{},method:"GET",...o};s&&(u.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(l)}}async shouldRetry(e){let t=e.headers.get("x-should-retry");return t==="true"?!0:t==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,a,n){let i,s=n?.get("retry-after-ms");if(s){let l=parseFloat(s);Number.isNaN(l)||(i=l)}let o=n?.get("retry-after");if(o&&!i){let l=parseFloat(o);Number.isNaN(l)?i=Date.parse(o)-Date.now():i=l*1e3}if(!(i&&0<=i&&i<60*1e3)){let l=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,l)}return await um(i),this.makeRequest(e,t-1,a)}calculateDefaultRetryTimeoutMillis(e,t){let i=t-e,s=Math.min(.5*Math.pow(2,i),8),o=1-Math.random()*.25;return s*o*1e3}calculateNonstreamingTimeout(e,t){if(36e5*e/128e3>6e5||t!=null&&e>t)throw new te("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(e,{retryCount:t=0}={}){let a={...e},{method:n,path:i,query:s,defaultBaseURL:o}=a,l=this.buildURL(i,s,o);"timeout"in a&&cm("timeout",a.timeout),a.timeout=a.timeout??this.timeout;let{bodyHeaders:c,body:u}=this.buildBody({options:a}),p=await this.buildHeaders({options:e,method:n,bodyHeaders:c,retryCount:t});return{req:{method:n,headers:p,...a.signal&&{signal:a.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...a.fetchOptions??{}},url:l,timeout:a.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:a,retryCount:n}){let i={};this.idempotencyHeader&&t!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let s=ke([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(n),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...gm(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,a,e.headers]);return this.validateHeaders(s),s.values}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let a=ke([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&a.values.has("content-type")||e instanceof Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:Ls(e)}:z(this,io,"f").call(this,{body:e,headers:a})}};Yc=He,io=new WeakMap,Xc=new WeakSet,zm=function(){return this.baseURL!=="https://api.anthropic.com"};He.Anthropic=Yc;He.HUMAN_PROMPT=`
|
|
3272
|
+
|
|
3273
|
+
Human:`;He.AI_PROMPT=`
|
|
3274
|
+
|
|
3275
|
+
Assistant:`;He.DEFAULT_TIMEOUT=6e5;He.AnthropicError=te;He.APIError=nt;He.APIConnectionError=Zr;He.APIConnectionTimeoutError=_a;He.APIUserAbortError=ut;He.NotFoundError=ka;He.ConflictError=Ca;He.RateLimitError=Ta;He.BadRequestError=Sa;He.AuthenticationError=Ea;He.InternalServerError=Aa;He.PermissionDeniedError=wa;He.UnprocessableEntityError=xa;He.toFile=Us;var or=class extends He{constructor(){super(...arguments),this.completions=new Tn(this),this.messages=new rn(this),this.models=new An(this),this.beta=new yr(this)}};or.Completions=Tn;or.Messages=rn;or.Models=An;or.Beta=yr;var{HUMAN_PROMPT:CS,AI_PROMPT:xS}=or;var so=1,oo=new ge("AnthropicChat"),lo=class extends ba{addUserMessage(e){let t={role:"user",content:e||""};this.messageGroup.add({id:"msg-"+so++,content:JSON.stringify(t),customData:t})}addAssistantMessage(e){let t={role:"assistant",content:e||""};this.messageGroup.add({id:"msg-"+so++,content:JSON.stringify(t),customData:t})}async sendMessage(e){this.addUserMessage(e);let t=new or({apiKey:this.config.apiKey,baseURL:this.config.endpoint,dangerouslyAllowBrowser:!0}),a=!0,n="",i="";for(;a;){a=!1,await this.config.onBeforeMessageProcessing?.(),await this.trimMessages(),oo.debug("Before processing state",{messages:this.messageGroup.getAll().map(m=>m.customData),tools:this.toolGroup.getAll().map(m=>m.customData),context:this.contextGroup.getAll().map(m=>m.content)});let s=this.toolGroup.getAll().map(m=>({name:m.customData?.name||"",description:m.customData?.description||"",input_schema:{type:"object",required:m.customData?.params.required||[],properties:m.customData?.params.properties||{}}})),o;if(this.config.stream){let m=t.messages.stream({model:this.config.model,max_tokens:4096,system:this.contextGroup.getAllAsString(),messages:this.messageGroup.getAll().map(d=>d.customData),tools:s,stream:!0});m.on("text",d=>{i+=d,this.config.onAIMessage?.(i,!0)}),o=await m.finalMessage()}else o=await t.messages.create({model:this.config.model,max_tokens:4096,system:this.contextGroup.getAllAsString(),messages:this.messageGroup.items.map(m=>m.customData),tools:s});oo.debug("Message received",o);let l=!0;Array.isArray(o.content)&&o.content.length==0&&(l=!1);let c={role:o.role,content:o.content};l&&this.messageGroup.add({id:"msg-"+so++,content:JSON.stringify(c),customData:c});let u=[];for(let m of o.content)m.type=="thinking"?oo.debug(`AI is thinking: ${m.thinking}`):m.type=="text"?n+=m.text||`
|
|
3253
3276
|
|
|
3254
|
-
`),e.createGroup("actions").setItemPadding(25),e.createGroup("messages").setItemPadding(10),e})();this.config={...this.config,...e},this.tokenWindow.size=this.config.maxTokens||4096}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(t),customData:t}),await this.processMessages();let n=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return n?.role=="assistant"&&n.content||""}addAssistantMessage(e){let t={role:"assistant",content:e};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(t),customData:t})}addUserMessage(e){let t={role:"user",content:e};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(t),customData:t})}getMessages(){return this.messageGroup.items.map(e=>e.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),hr.debugEnabled&&hr.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(a=>a.customData),messages:this.messageGroup.items.map(a=>a.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let t=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(t?.role=="user"||t?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(t?.role=="assistant"&&t?.tool_calls?.length){for(let a of t.tool_calls)await this.processToolCall(a);await this.processMessages()}}async trimMessages(){for(this.tokenWindow.removeOverflow();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendToAPI(e){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let t=0;for(let l=this.messageGroup.items.length-1;l>=0;l--){let c=this.messageGroup.items[l].customData;if(c.role=="assistant"&&c.tool_calls){if(t+=1,t>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(c.role=="user")break}hr.debugEnabled&&hr.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(l=>l.customData),messages:this.messageGroup.items.map(l=>l.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let a={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(l=>l.customData)]};for(let l of this.toolGroup.getAll()){let c=l.customData;c.description&&c.description.length>1024&&hr.warn(`Tool description for "${c.name}" is too long, it will be truncated.`);let u={type:"function",function:{name:c.name,description:(c.description||"").substring(0,1024),parameters:c.params}};a.tools.push(u)}a.user||delete a.user,a.tools.length||delete a.tools;let n={};if(n["Content-Type"]="application/json",this.config.apiKey&&(n.Authorization=`Bearer ${this.config.apiKey}`),e)return a;let i=await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:n,body:JSON.stringify(a)});if(!i.ok){let l=`${i.status} ${i.statusText}`;try{let u=await i.json();l=u.errorText||u.error?.message||u.error||l}catch{}let c=new Error(l);throw c.code=i.status,c}let o=null,s=null;if(this.config.stream){for await(let c of pu(i.body)){if(c.data=="[DONE]")break;if(!c.data)continue;let u=JSON.parse(c.data);if(s){for(let p in u.choices[0].delta)if(typeof u.choices[0].delta[p]=="string"){if(p=="role"&&s[p]==u.choices[0].delta[p])continue;s[p]=(s[p]||"")+u.choices[0].delta[p]}for(let p of u.choices[0].delta.tool_calls||[]){if(s.tool_calls||(s.tool_calls=[]),!s.tool_calls[p.index]){s.tool_calls[p.index]=p;continue}let m=s.tool_calls[p.index];m.function=m.function||{},m.function.name=(m.function.name||"")+(p.function?.name||""),m.function.arguments=(m.function.arguments||"")+(p.function?.arguments||"")}}else s={chunkID:u.id,...u.choices[0].delta};s?.content&&!s.content.startsWith("{")&&this.config.onAIMessage?.(s.content,!0)}let l=$r(JSON.stringify(a)+JSON.stringify(s)||"");this.stats.tokensUsed+=l,hr.debug(`Estimated ${l} tokens for streaming response, total used: ${this.stats.tokensUsed}`)}else o=await i.json(),this.stats.tokensUsed+=o.usage?.total_tokens||0,hr.debug(`Used ${o.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),s=o.choices?.[0]?.message;if(s||(hr.warn("No response block in API response."),s={role:"assistant",content:""}),s.role=="user")throw new Error("API returned a user message, which is not allowed.");this.processIncomingMessage(s),this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(s),customData:s}),s.content&&this.config.onAIMessage?.(s.content,!1)}processIncomingMessage(e){}registerTool(e){this.toolGroup.add({id:e.name,cannotRemove:!e.canRemove,content:JSON.stringify(e),customData:e})}async processToolCall(e){try{let a=this.toolGroup.items.find(s=>s.id==e.function.name)?.customData;if(!a)throw new Error(`Tool "${e.function.name}" not found.`);let n=JSON.parse(e.function.arguments);this.config.onAIToolStart?.(e.function.name,n);let i=await a.callback(n);typeof i!="string"&&(i=JSON.stringify(i)||""),(i===""||i==="undefined")&&(i="success");let o={role:"tool",content:i,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(o),customData:o})}catch(t){hr.warn(`Unable to process tool call for "${e?.function?.name}"`,t);let a={role:"tool",content:`Error: ${t.message}`,tool_call_id:e.id};this.messageGroup.add({id:"msg-"+Gn++,content:JSON.stringify(a),customData:a})}}resetConversation(){this.messageGroup.empty(),this.toolGroup.empty(),this.contextGroup.empty()}};var De=function(){return De=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++){t=arguments[a];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},De.apply(this,arguments)};function Jy(r,e,t,a){function n(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function s(u){try{c(a.next(u))}catch(p){o(p)}}function l(u){try{c(a.throw(u))}catch(p){o(p)}}function c(u){u.done?i(u.value):n(u.value).then(s,l)}c((a=a.apply(r,e||[])).next())})}function Qy(r,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,n,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(a)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(a=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,n=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],n=0}finally{a=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function de(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],a=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ue(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var a=t.call(r),n,i=[],o;try{for(;(e===void 0||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(s){o={error:s}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(o)throw o.error}}return i}var eb="ENTRIES",Xu="KEYS",Yu="VALUES",rt="",Ms=function(){function r(e,t){var a=e._tree,n=Array.from(a.keys());this.set=e,this._type=t,this._path=n.length>0?[{node:a,keys:n}]:[]}return r.prototype.next=function(){var e=this.dive();return this.backtrack(),e},r.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=zn(this._path),t=e.node,a=e.keys;if(zn(a)===rt)return{done:!1,value:this.result()};var n=t.get(zn(a));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()},r.prototype.backtrack=function(){if(this._path.length!==0){var e=zn(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},r.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var t=e.keys;return zn(t)}).filter(function(e){return e!==rt}).join("")},r.prototype.value=function(){return zn(this._path).node.get(rt)},r.prototype.result=function(){switch(this._type){case Yu:return this.value();case Xu:return this.key();default:return[this.key(),this.value()]}},r.prototype[Symbol.iterator]=function(){return this},r}(),zn=function(r){return r[r.length-1]},tb=function(r,e,t){var a=new Map;if(e===void 0)return a;for(var n=e.length+1,i=n+t,o=new Uint8Array(i*n).fill(t+1),s=0;s<n;++s)o[s]=s;for(var l=1;l<i;++l)o[l*n]=l;return Zu(r,e,t,a,o,1,n,""),a},Zu=function(r,e,t,a,n,i,o,s){var l,c,u=i*o;try{e:for(var p=de(r.keys()),m=p.next();!m.done;m=p.next()){var d=m.value;if(d===rt){var g=n[u-1];g<=t&&a.set(s,[r.get(d),g])}else{for(var f=i,y=0;y<d.length;++y,++f){for(var v=d[y],T=o*f,E=T-o,I=n[T],D=Math.max(0,f-t-1),C=Math.min(o-1,f+t),M=D;M<C;++M){var F=v!==e[M],R=n[E+M]+ +F,G=n[E+M+1]+1,z=n[T+M]+1,O=n[T+M+1]=Math.min(R,G,z);O<I&&(I=O)}if(I>t)continue e}Zu(r.get(d),e,t,a,n,f,o,s+d)}}}catch(x){l={error:x}}finally{try{m&&!m.done&&(c=p.return)&&c.call(p)}finally{if(l)throw l.error}}},Fs=function(){function r(e,t){e===void 0&&(e=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=e,this._prefix=t}return r.prototype.atPrefix=function(e){var t,a;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var n=Ue(_i(this._tree,e.slice(this._prefix.length)),2),i=n[0],o=n[1];if(i===void 0){var s=Ue(js(o),2),l=s[0],c=s[1];try{for(var u=de(l.keys()),p=u.next();!p.done;p=u.next()){var m=p.value;if(m!==rt&&m.startsWith(c)){var d=new Map;return d.set(m.slice(c.length),l.get(m)),new r(d,e)}}}catch(g){t={error:g}}finally{try{p&&!p.done&&(a=u.return)&&a.call(u)}finally{if(t)throw t.error}}}return new r(i,e)},r.prototype.clear=function(){this._size=void 0,this._tree.clear()},r.prototype.delete=function(e){return this._size=void 0,rb(this._tree,e)},r.prototype.entries=function(){return new Ms(this,eb)},r.prototype.forEach=function(e){var t,a;try{for(var n=de(this),i=n.next();!i.done;i=n.next()){var o=Ue(i.value,2),s=o[0],l=o[1];e(s,l,this)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},r.prototype.fuzzyGet=function(e,t){return tb(this._tree,e,t)},r.prototype.get=function(e){var t=Hs(this._tree,e);return t!==void 0?t.get(rt):void 0},r.prototype.has=function(e){var t=Hs(this._tree,e);return t!==void 0&&t.has(rt)},r.prototype.keys=function(){return new Ms(this,Xu)},r.prototype.set=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Bs(this._tree,e);return a.set(rt,t),this},Object.defineProperty(r.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),r.prototype.update=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Bs(this._tree,e);return a.set(rt,t(a.get(rt))),this},r.prototype.fetch=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Bs(this._tree,e),n=a.get(rt);return n===void 0&&a.set(rt,n=t()),n},r.prototype.values=function(){return new Ms(this,Yu)},r.prototype[Symbol.iterator]=function(){return this.entries()},r.from=function(e){var t,a,n=new r;try{for(var i=de(e),o=i.next();!o.done;o=i.next()){var s=Ue(o.value,2),l=s[0],c=s[1];n.set(l,c)}}catch(u){t={error:u}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}return n},r.fromObject=function(e){return r.from(Object.entries(e))},r}(),_i=function(r,e,t){var a,n;if(t===void 0&&(t=[]),e.length===0||r==null)return[r,t];try{for(var i=de(r.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;if(s!==rt&&e.startsWith(s))return t.push([r,s]),_i(r.get(s),e.slice(s.length),t)}}catch(l){a={error:l}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return t.push([r,e]),_i(void 0,"",t)},Hs=function(r,e){var t,a;if(e.length===0||r==null)return r;try{for(var n=de(r.keys()),i=n.next();!i.done;i=n.next()){var o=i.value;if(o!==rt&&e.startsWith(o))return Hs(r.get(o),e.slice(o.length))}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},Bs=function(r,e){var t,a,n=e.length;e:for(var i=0;r&&i<n;){try{for(var o=(t=void 0,de(r.keys())),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!==rt&&e[i]===l[0]){for(var c=Math.min(n-i,l.length),u=1;u<c&&e[i+u]===l[u];)++u;var p=r.get(l);if(u===l.length)r=p;else{var m=new Map;m.set(l.slice(u),p),r.set(e.slice(i,i+u),m),r.delete(l),r=m}i+=u;continue e}}}catch(g){t={error:g}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(t)throw t.error}}var d=new Map;return r.set(e.slice(i),d),d}return r},rb=function(r,e){var t=Ue(_i(r,e),2),a=t[0],n=t[1];if(a!==void 0){if(a.delete(rt),a.size===0)Ju(n);else if(a.size===1){var i=Ue(a.entries().next().value,2),o=i[0],s=i[1];Qu(n,o,s)}}},Ju=function(r){if(r.length!==0){var e=Ue(js(r),2),t=e[0],a=e[1];if(t.delete(a),t.size===0)Ju(r.slice(0,-1));else if(t.size===1){var n=Ue(t.entries().next().value,2),i=n[0],o=n[1];i!==rt&&Qu(r.slice(0,-1),i,o)}}},Qu=function(r,e,t){if(r.length!==0){var a=Ue(js(r),2),n=a[0],i=a[1];n.set(i+e,t),n.delete(i)}},js=function(r){return r[r.length-1]},va,qs="or",ed="and",nb="and_not",td=function(){function r(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var t=e.autoVacuum==null||e.autoVacuum===!0?Us:e.autoVacuum;this._options=De(De(De({},zs),e),{autoVacuum:t,searchOptions:De(De({},ju),e.searchOptions||{}),autoSuggestOptions:De(De({},lb),e.autoSuggestOptions||{})}),this._index=new Fs,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Ws,this.addFields(this._options.fields)}return r.prototype.add=function(e){var t,a,n,i,o,s,l=this._options,c=l.extractField,u=l.tokenize,p=l.processTerm,m=l.fields,d=l.idField,g=c(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));if(this._idToShortId.has(g))throw new Error("MiniSearch: duplicate ID ".concat(g));var f=this.addDocumentId(g);this.saveStoredFields(f,e);try{for(var y=de(m),v=y.next();!v.done;v=y.next()){var T=v.value,E=c(e,T);if(E!=null){var I=u(E.toString(),T),D=this._fieldIds[T],C=new Set(I).size;this.addFieldLength(f,D,this._documentCount-1,C);try{for(var M=(n=void 0,de(I)),F=M.next();!F.done;F=M.next()){var R=F.value,G=p(R,T);if(Array.isArray(G))try{for(var z=(o=void 0,de(G)),O=z.next();!O.done;O=z.next()){var x=O.value;this.addTerm(D,f,x)}}catch(A){o={error:A}}finally{try{O&&!O.done&&(s=z.return)&&s.call(z)}finally{if(o)throw o.error}}else G&&this.addTerm(D,f,G)}}catch(A){n={error:A}}finally{try{F&&!F.done&&(i=M.return)&&i.call(M)}finally{if(n)throw n.error}}}}}catch(A){t={error:A}}finally{try{v&&!v.done&&(a=y.return)&&a.call(y)}finally{if(t)throw t.error}}},r.prototype.addAll=function(e){var t,a;try{for(var n=de(e),i=n.next();!i.done;i=n.next()){var o=i.value;this.add(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},r.prototype.addAllAsync=function(e,t){var a=this;t===void 0&&(t={});var n=t.chunkSize,i=n===void 0?10:n,o={chunk:[],promise:Promise.resolve()},s=e.reduce(function(u,p,m){var d=u.chunk,g=u.promise;return d.push(p),(m+1)%i===0?{chunk:[],promise:g.then(function(){return new Promise(function(f){return setTimeout(f,0)})}).then(function(){return a.addAll(d)})}:{chunk:d,promise:g}},o),l=s.chunk,c=s.promise;return c.then(function(){return a.addAll(l)})},r.prototype.remove=function(e){var t,a,n,i,o,s,l=this._options,c=l.tokenize,u=l.processTerm,p=l.extractField,m=l.fields,d=l.idField,g=p(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));var f=this._idToShortId.get(g);if(f==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(g,": it is not in the index"));try{for(var y=de(m),v=y.next();!v.done;v=y.next()){var T=v.value,E=p(e,T);if(E!=null){var I=c(E.toString(),T),D=this._fieldIds[T],C=new Set(I).size;this.removeFieldLength(f,D,this._documentCount,C);try{for(var M=(n=void 0,de(I)),F=M.next();!F.done;F=M.next()){var R=F.value,G=u(R,T);if(Array.isArray(G))try{for(var z=(o=void 0,de(G)),O=z.next();!O.done;O=z.next()){var x=O.value;this.removeTerm(D,f,x)}}catch(A){o={error:A}}finally{try{O&&!O.done&&(s=z.return)&&s.call(z)}finally{if(o)throw o.error}}else G&&this.removeTerm(D,f,G)}}catch(A){n={error:A}}finally{try{F&&!F.done&&(i=M.return)&&i.call(M)}finally{if(n)throw n.error}}}}}catch(A){t={error:A}}finally{try{v&&!v.done&&(a=y.return)&&a.call(y)}finally{if(t)throw t.error}}this._storedFields.delete(f),this._documentIds.delete(f),this._idToShortId.delete(g),this._fieldLength.delete(f),this._documentCount-=1},r.prototype.removeAll=function(e){var t,a;if(e)try{for(var n=de(e),i=n.next();!i.done;i=n.next()){var o=i.value;this.remove(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Fs,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},r.prototype.discard=function(e){var t=this,a=this._idToShortId.get(e);if(a==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(a),this._storedFields.delete(a),(this._fieldLength.get(a)||[]).forEach(function(n,i){t.removeFieldLength(a,i,t._documentCount,n)}),this._fieldLength.delete(a),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},r.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,t=e.minDirtFactor,a=e.minDirtCount,n=e.batchSize,i=e.batchWait;this.conditionalVacuum({batchSize:n,batchWait:i},{minDirtCount:a,minDirtFactor:t})}},r.prototype.discardAll=function(e){var t,a,n=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var i=de(e),o=i.next();!o.done;o=i.next()){var s=o.value;this.discard(s)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()},r.prototype.replace=function(e){var t=this._options,a=t.idField,n=t.extractField,i=n(e,a);this.discard(i),this.add(e)},r.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},r.prototype.conditionalVacuum=function(e,t){var a=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var n=a._enqueuedVacuumConditions;return a._enqueuedVacuumConditions=Ws,a.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},r.prototype.performVacuuming=function(e,t){return Jy(this,void 0,void 0,function(){var a,n,i,o,s,l,c,u,p,m,d,g,f,y,v,T,E,I,D,C,M,F,R,G,z;return Qy(this,function(O){switch(O.label){case 0:if(a=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];n=e.batchSize||Vs.batchSize,i=e.batchWait||Vs.batchWait,o=1,O.label=1;case 1:O.trys.push([1,7,8,9]),s=de(this._index),l=s.next(),O.label=2;case 2:if(l.done)return[3,6];c=Ue(l.value,2),u=c[0],p=c[1];try{for(m=(F=void 0,de(p)),d=m.next();!d.done;d=m.next()){g=Ue(d.value,2),f=g[0],y=g[1];try{for(v=(G=void 0,de(y)),T=v.next();!T.done;T=v.next())E=Ue(T.value,1),I=E[0],!this._documentIds.has(I)&&(y.size<=1?p.delete(f):y.delete(I))}catch(x){G={error:x}}finally{try{T&&!T.done&&(z=v.return)&&z.call(v)}finally{if(G)throw G.error}}}}catch(x){F={error:x}}finally{try{d&&!d.done&&(R=m.return)&&R.call(m)}finally{if(F)throw F.error}}return this._index.get(u).size===0&&this._index.delete(u),o%n!==0?[3,4]:[4,new Promise(function(x){return setTimeout(x,i)})];case 3:O.sent(),O.label=4;case 4:o+=1,O.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return D=O.sent(),C={error:D},[3,9];case 8:try{l&&!l.done&&(M=s.return)&&M.call(s)}finally{if(C)throw C.error}return[7];case 9:this._dirtCount-=a,O.label=10;case 10:return[4,null];case 11:return O.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},r.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var t=e.minDirtCount,a=e.minDirtFactor;return t=t||Us.minDirtCount,a=a||Us.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=a},Object.defineProperty(r.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),r.prototype.has=function(e){return this._idToShortId.has(e)},r.prototype.getStoredFields=function(e){var t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)},r.prototype.search=function(e,t){var a,n;t===void 0&&(t={});var i=this.executeQuery(e,t),o=[];try{for(var s=de(i),l=s.next();!l.done;l=s.next()){var c=Ue(l.value,2),u=c[0],p=c[1],m=p.score,d=p.terms,g=p.match,f=d.length||1,y={id:this._documentIds.get(u),score:m*f,terms:Object.keys(g),queryTerms:d,match:g};Object.assign(y,this._storedFields.get(u)),(t.filter==null||t.filter(y))&&o.push(y)}}catch(v){a={error:v}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return e===r.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||o.sort(Ku),o},r.prototype.autoSuggest=function(e,t){var a,n,i,o;t===void 0&&(t={}),t=De(De({},this._options.autoSuggestOptions),t);var s=new Map;try{for(var l=de(this.search(e,t)),c=l.next();!c.done;c=l.next()){var u=c.value,p=u.score,m=u.terms,d=m.join(" "),g=s.get(d);g!=null?(g.score+=p,g.count+=1):s.set(d,{score:p,terms:m,count:1})}}catch(D){a={error:D}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(a)throw a.error}}var f=[];try{for(var y=de(s),v=y.next();!v.done;v=y.next()){var T=Ue(v.value,2),g=T[0],E=T[1],p=E.score,m=E.terms,I=E.count;f.push({suggestion:g,terms:m,score:p/I})}}catch(D){i={error:D}}finally{try{v&&!v.done&&(o=y.return)&&o.call(y)}finally{if(i)throw i.error}}return f.sort(Ku),f},Object.defineProperty(r.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),r.loadJSON=function(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),t)},r.getDefault=function(e){if(zs.hasOwnProperty(e))return Gs(zs,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},r.loadJS=function(e,t){var a,n,i,o,s,l,c=e.index,u=e.documentCount,p=e.nextId,m=e.documentIds,d=e.fieldIds,g=e.fieldLength,f=e.averageFieldLength,y=e.storedFields,v=e.dirtCount,T=e.serializationVersion;if(T!==1&&T!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var E=new r(t);E._documentCount=u,E._nextId=p,E._documentIds=vi(m),E._idToShortId=new Map,E._fieldIds=d,E._fieldLength=vi(g),E._avgFieldLength=f,E._storedFields=vi(y),E._dirtCount=v||0,E._index=new Fs;try{for(var I=de(E._documentIds),D=I.next();!D.done;D=I.next()){var C=Ue(D.value,2),M=C[0],F=C[1];E._idToShortId.set(F,M)}}catch(Z){a={error:Z}}finally{try{D&&!D.done&&(n=I.return)&&n.call(I)}finally{if(a)throw a.error}}try{for(var R=de(c),G=R.next();!G.done;G=R.next()){var z=Ue(G.value,2),O=z[0],x=z[1],A=new Map;try{for(var B=(s=void 0,de(Object.keys(x))),X=B.next();!X.done;X=B.next()){var K=X.value,Q=x[K];T===1&&(Q=Q.ds),A.set(parseInt(K,10),vi(Q))}}catch(Z){s={error:Z}}finally{try{X&&!X.done&&(l=B.return)&&l.call(B)}finally{if(s)throw s.error}}E._index.set(O,A)}}catch(Z){i={error:Z}}finally{try{G&&!G.done&&(o=R.return)&&o.call(R)}finally{if(i)throw i.error}}return E},r.prototype.executeQuery=function(e,t){var a=this;if(t===void 0&&(t={}),e===r.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){var n=De(De(De({},t),e),{queries:void 0}),i=e.queries.map(function(y){return a.executeQuery(y,n)});return this.combineResults(i,n.combineWith)}var o=this._options,s=o.tokenize,l=o.processTerm,c=o.searchOptions,u=De(De({tokenize:s,processTerm:l},c),t),p=u.tokenize,m=u.processTerm,d=p(e).flatMap(function(y){return m(y)}).filter(function(y){return!!y}),g=d.map(sb(u)),f=g.map(function(y){return a.executeQuerySpec(y,u)});return this.combineResults(f,u.combineWith)},r.prototype.executeQuerySpec=function(e,t){var a,n,i,o,s=De(De({},this._options.searchOptions),t),l=(s.fields||this._options.fields).reduce(function(K,Q){var Z;return De(De({},K),(Z={},Z[Q]=Gs(s.boost,Q)||1,Z))},{}),c=s.boostDocument,u=s.weights,p=s.maxFuzzy,m=s.bm25,d=De(De({},ju.weights),u),g=d.fuzzy,f=d.prefix,y=this._index.get(e.term),v=this.termResults(e.term,e.term,1,y,l,c,m),T,E;if(e.prefix&&(T=this._index.atPrefix(e.term)),e.fuzzy){var I=e.fuzzy===!0?.2:e.fuzzy,D=I<1?Math.min(p,Math.round(e.term.length*I)):I;D&&(E=this._index.fuzzyGet(e.term,D))}if(T)try{for(var C=de(T),M=C.next();!M.done;M=C.next()){var F=Ue(M.value,2),R=F[0],G=F[1],z=R.length-e.term.length;if(z){E?.delete(R);var O=f*R.length/(R.length+.3*z);this.termResults(e.term,R,O,G,l,c,m,v)}}}catch(K){a={error:K}}finally{try{M&&!M.done&&(n=C.return)&&n.call(C)}finally{if(a)throw a.error}}if(E)try{for(var x=de(E.keys()),A=x.next();!A.done;A=x.next()){var R=A.value,B=Ue(E.get(R),2),X=B[0],z=B[1];if(z){var O=g*R.length/(R.length+z);this.termResults(e.term,R,O,X,l,c,m,v)}}}catch(K){i={error:K}}finally{try{A&&!A.done&&(o=x.return)&&o.call(x)}finally{if(i)throw i.error}}return v},r.prototype.executeWildcardQuery=function(e){var t,a,n=new Map,i=De(De({},this._options.searchOptions),e);try{for(var o=de(this._documentIds),s=o.next();!s.done;s=o.next()){var l=Ue(s.value,2),c=l[0],u=l[1],p=i.boostDocument?i.boostDocument(u,"",this._storedFields.get(c)):1;n.set(c,{score:p,terms:[],match:{}})}}catch(m){t={error:m}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(t)throw t.error}}return n},r.prototype.combineResults=function(e,t){if(t===void 0&&(t=qs),e.length===0)return new Map;var a=t.toLowerCase();return e.reduce(ab[a])||new Map},r.prototype.toJSON=function(){var e,t,a,n,i=[];try{for(var o=de(this._index),s=o.next();!s.done;s=o.next()){var l=Ue(s.value,2),c=l[0],u=l[1],p={};try{for(var m=(a=void 0,de(u)),d=m.next();!d.done;d=m.next()){var g=Ue(d.value,2),f=g[0],y=g[1];p[f]=Object.fromEntries(y)}}catch(v){a={error:v}}finally{try{d&&!d.done&&(n=m.return)&&n.call(m)}finally{if(a)throw a.error}}i.push([c,p])}}catch(v){e={error:v}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:i,serializationVersion:2}},r.prototype.termResults=function(e,t,a,n,i,o,s,l){var c,u,p,m,d;if(l===void 0&&(l=new Map),n==null)return l;try{for(var g=de(Object.keys(i)),f=g.next();!f.done;f=g.next()){var y=f.value,v=i[y],T=this._fieldIds[y],E=n.get(T);if(E!=null){var I=E.size,D=this._avgFieldLength[T];try{for(var C=(p=void 0,de(E.keys())),M=C.next();!M.done;M=C.next()){var F=M.value;if(!this._documentIds.has(F)){this.removeTerm(T,F,t),I-=1;continue}var R=o?o(this._documentIds.get(F),t,this._storedFields.get(F)):1;if(R){var G=E.get(F),z=this._fieldLength.get(F)[T],O=ob(G,I,this._documentCount,z,D,s),x=a*v*R*O,A=l.get(F);if(A){A.score+=x,cb(A.terms,e);var B=Gs(A.match,t);B?B.push(y):A.match[t]=[y]}else l.set(F,{score:x,terms:[e],match:(d={},d[t]=[y],d)})}}}catch(X){p={error:X}}finally{try{M&&!M.done&&(m=C.return)&&m.call(C)}finally{if(p)throw p.error}}}}}catch(X){c={error:X}}finally{try{f&&!f.done&&(u=g.return)&&u.call(g)}finally{if(c)throw c.error}}return l},r.prototype.addTerm=function(e,t,a){var n=this._index.fetch(a,$u),i=n.get(e);if(i==null)i=new Map,i.set(t,1),n.set(e,i);else{var o=i.get(t);i.set(t,(o||0)+1)}},r.prototype.removeTerm=function(e,t,a){if(!this._index.has(a)){this.warnDocumentChanged(t,e,a);return}var n=this._index.fetch(a,$u),i=n.get(e);i==null||i.get(t)==null?this.warnDocumentChanged(t,e,a):i.get(t)<=1?i.size<=1?n.delete(e):i.delete(t):i.set(t,i.get(t)-1),this._index.get(a).size===0&&this._index.delete(a)},r.prototype.warnDocumentChanged=function(e,t,a){var n,i;try{for(var o=de(Object.keys(this._fieldIds)),s=o.next();!s.done;s=o.next()){var l=s.value;if(this._fieldIds[l]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(a,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){n={error:c}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}},r.prototype.addDocumentId=function(e){var t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t},r.prototype.addFields=function(e){for(var t=0;t<e.length;t++)this._fieldIds[e[t]]=t},r.prototype.addFieldLength=function(e,t,a,n){var i=this._fieldLength.get(e);i==null&&this._fieldLength.set(e,i=[]),i[t]=n;var o=this._avgFieldLength[t]||0,s=o*a+n;this._avgFieldLength[t]=s/(a+1)},r.prototype.removeFieldLength=function(e,t,a,n){if(a===1){this._avgFieldLength[t]=0;return}var i=this._avgFieldLength[t]*a-n;this._avgFieldLength[t]=i/(a-1)},r.prototype.saveStoredFields=function(e,t){var a,n,i=this._options,o=i.storeFields,s=i.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var c=de(o),u=c.next();!u.done;u=c.next()){var p=u.value,m=s(t,p);m!==void 0&&(l[p]=m)}}catch(d){a={error:d}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(a)throw a.error}}}},r.wildcard=Symbol("*"),r}(),Gs=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},ab=(va={},va[qs]=function(r,e){var t,a;try{for(var n=de(e.keys()),i=n.next();!i.done;i=n.next()){var o=i.value,s=r.get(o);if(s==null)r.set(o,e.get(o));else{var l=e.get(o),c=l.score,u=l.terms,p=l.match;s.score=s.score+c,s.match=Object.assign(s.match,p),qu(s.terms,u)}}}catch(m){t={error:m}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}return r},va[ed]=function(r,e){var t,a,n=new Map;try{for(var i=de(e.keys()),o=i.next();!o.done;o=i.next()){var s=o.value,l=r.get(s);if(l!=null){var c=e.get(s),u=c.score,p=c.terms,m=c.match;qu(l.terms,p),n.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(d){t={error:d}}finally{try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}return n},va[nb]=function(r,e){var t,a;try{for(var n=de(e.keys()),i=n.next();!i.done;i=n.next()){var o=i.value;r.delete(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}return r},va),ib={k:1.2,b:.7,d:.5},ob=function(r,e,t,a,n,i){var o=i.k,s=i.b,l=i.d,c=Math.log(1+(t-e+.5)/(e+.5));return c*(l+r*(o+1)/(r+o*(1-s+s*a/n)))},sb=function(r){return function(e,t,a){var n=typeof r.fuzzy=="function"?r.fuzzy(e,t,a):r.fuzzy||!1,i=typeof r.prefix=="function"?r.prefix(e,t,a):r.prefix===!0;return{term:e,fuzzy:n,prefix:i}}},zs={idField:"id",extractField:function(r,e){return r[e]},tokenize:function(r){return r.split(ub)},processTerm:function(r){return r.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(r,e){typeof console?.[r]=="function"&&console[r](e)},autoVacuum:!0},ju={combineWith:qs,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:ib},lb={combineWith:ed,prefix:function(r,e,t){return e===t.length-1}},Vs={batchSize:1e3,batchWait:10},Ws={minDirtFactor:.1,minDirtCount:20},Us=De(De({},Vs),Ws),cb=function(r,e){r.includes(e)||r.push(e)},qu=function(r,e){var t,a;try{for(var n=de(e),i=n.next();!i.done;i=n.next()){var o=i.value;r.includes(o)||r.push(o)}}catch(s){t={error:s}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},Ku=function(r,e){var t=r.score,a=e.score;return a-t},$u=function(){return new Map},vi=function(r){var e,t,a=new Map;try{for(var n=de(Object.keys(r)),i=n.next();!i.done;i=n.next()){var o=i.value;a.set(parseInt(o,10),r[o])}}catch(s){e={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return a},ub=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var rd=[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(r,e)=>{let t=await e.knowledgeBase.search(r.query),a=e;a._lastKBsearch=r.query,a._nextRequestUseKBitems=t,e.submitAnalyticsEvent({type:"kb-search",query:r.query,results:t});let n=t.filter(o=>o.type!="action").map(o=>"id="+o.id).join(", ")||"(none)",i=t.filter(o=>o.type=="action").map(o=>"name="+o._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${n}. New tools available: ${i}.`}}];var h={};ws(h,{BRAND:()=>Mb,DIRTY:()=>Xr,EMPTY_PATH:()=>hb,INVALID:()=>ee,NEVER:()=>_v,OK:()=>ot,ParseStatus:()=>nt,Schema:()=>ue,ZodAny:()=>Pr,ZodArray:()=>br,ZodBigInt:()=>Zr,ZodBoolean:()=>Jr,ZodBranded:()=>Sa,ZodCatch:()=>un,ZodDate:()=>Qr,ZodDefault:()=>cn,ZodDiscriminatedUnion:()=>wi,ZodEffects:()=>Gt,ZodEnum:()=>sn,ZodError:()=>bt,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>ki,ZodIntersection:()=>nn,ZodIssueCode:()=>U,ZodLazy:()=>an,ZodLiteral:()=>on,ZodMap:()=>qn,ZodNaN:()=>$n,ZodNativeEnum:()=>ln,ZodNever:()=>qt,ZodNull:()=>tn,ZodNullable:()=>nr,ZodNumber:()=>Yr,ZodObject:()=>vt,ZodOptional:()=>Ft,ZodParsedType:()=>j,ZodPipeline:()=>Ea,ZodPromise:()=>Dr,ZodReadonly:()=>dn,ZodRecord:()=>Ci,ZodSchema:()=>ue,ZodSet:()=>Kn,ZodString:()=>Rr,ZodSymbol:()=>Wn,ZodTransformer:()=>Gt,ZodTuple:()=>rr,ZodType:()=>ue,ZodUndefined:()=>en,ZodUnion:()=>rn,ZodUnknown:()=>yr,ZodVoid:()=>jn,addIssueToContext:()=>W,any:()=>jb,array:()=>Xb,bigint:()=>zb,boolean:()=>md,coerce:()=>vv,custom:()=>ud,date:()=>Ub,datetimeRegex:()=>ld,defaultErrorMap:()=>gr,discriminatedUnion:()=>Qb,effect:()=>dv,enum:()=>lv,function:()=>iv,getErrorMap:()=>Un,getParsedType:()=>tr,instanceof:()=>Bb,intersection:()=>ev,isAborted:()=>Si,isAsync:()=>Hn,isDirty:()=>Ei,isValid:()=>Ir,late:()=>Fb,lazy:()=>ov,literal:()=>sv,makeIssue:()=>_a,map:()=>nv,nan:()=>Gb,nativeEnum:()=>cv,never:()=>Kb,null:()=>Wb,nullable:()=>mv,number:()=>pd,object:()=>Yb,objectUtil:()=>Ks,oboolean:()=>bv,onumber:()=>yv,optional:()=>pv,ostring:()=>fv,pipeline:()=>gv,preprocess:()=>hv,promise:()=>uv,quotelessJson:()=>db,record:()=>rv,set:()=>av,setErrorMap:()=>mb,strictObject:()=>Zb,string:()=>dd,symbol:()=>Hb,transformer:()=>dv,tuple:()=>tv,undefined:()=>Vb,union:()=>Jb,unknown:()=>qb,util:()=>pe,void:()=>$b});var pe;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let o of n)i[o]=o;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(s=>typeof n[n[s]]!="number"),o={};for(let s of i)o[s]=n[s];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push(o);return i},r.find=(n,i)=>{for(let o of n)if(i(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function a(n,i=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}r.joinValues=a,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(pe||(pe={}));var Ks;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ks||(Ks={}));var j=pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),tr=r=>{switch(typeof r){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(r)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":return Array.isArray(r)?j.array:r===null?j.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?j.promise:typeof Map<"u"&&r instanceof Map?j.map:typeof Set<"u"&&r instanceof Set?j.set:typeof Date<"u"&&r instanceof Date?j.date:j.object;default:return j.unknown}};var U=pe.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"]),db=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),bt=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},a={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)a._errors.push(t(o));else{let s=a,l=0;for(;l<o.path.length;){let c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return n(this),a}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,pe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},a=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};bt.create=r=>new bt(r);var pb=(r,e)=>{let t;switch(r.code){case U.invalid_type:r.received===j.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case U.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,pe.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:t=`Unrecognized key(s) in object: ${pe.joinValues(r.keys,", ")}`;break;case U.invalid_union:t="Invalid input";break;case U.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${pe.joinValues(r.options)}`;break;case U.invalid_enum_value:t=`Invalid enum value. Expected ${pe.joinValues(r.options)}, received '${r.received}'`;break;case U.invalid_arguments:t="Invalid function arguments";break;case U.invalid_return_type:t="Invalid function return type";break;case U.invalid_date:t="Invalid date";break;case U.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:pe.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case U.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case U.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case U.custom:t="Invalid input";break;case U.invalid_intersection_types:t="Intersection results could not be merged";break;case U.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case U.not_finite:t="Number must be finite";break;default:t=e.defaultError,pe.assertNever(r)}return{message:t}},gr=pb;var nd=gr;function mb(r){nd=r}function Un(){return nd}var _a=r=>{let{data:e,path:t,errorMaps:a,issueData:n}=r,i=[...t,...n.path||[]],o={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let s="",l=a.filter(c=>!!c).slice().reverse();for(let c of l)s=c(o,{data:e,defaultError:s}).message;return{...n,path:i,message:s}},hb=[];function W(r,e){let t=Un(),a=_a({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===gr?void 0:gr].filter(n=>!!n)});r.common.issues.push(a)}var nt=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let a=[];for(let n of t){if(n.status==="aborted")return ee;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){let a=[];for(let n of t){let i=await n.key,o=await n.value;a.push({key:i,value:o})}return r.mergeObjectSync(e,a)}static mergeObjectSync(e,t){let a={};for(let n of t){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return ee;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(a[i.value]=o.value)}return{status:e.value,value:a}}},ee=Object.freeze({status:"aborted"}),Xr=r=>({status:"dirty",value:r}),ot=r=>({status:"valid",value:r}),Si=r=>r.status==="aborted",Ei=r=>r.status==="dirty",Ir=r=>r.status==="valid",Hn=r=>typeof Promise<"u"&&r instanceof Promise;var Y;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(Y||(Y={}));var Bt=class{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}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}},ad=(r,e)=>{if(Ir(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new bt(r.common.issues);return this._error=t,this._error}}};function se(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:a,description:n}=r;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,s)=>{let{message:l}=r;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??a??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??t??s.defaultError}},description:n}}var ue=class{get description(){return this._def.description}_getType(e){return tr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:tr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nt,ctx:{common:e.parent.common,data:e.data,parsedType:tr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Hn(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){let a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)},n=this._parseSync({data:e,path:a.path,parent:a});return ad(a,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:t});return Ir(a)?{value:a.value}:{issues:t.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>Ir(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){let a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){let a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:tr(e)},n=this._parse({data:e,path:a.path,parent:a}),i=await(Hn(n)?n:Promise.resolve(n));return ad(a,i)}refine(e,t){let a=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let o=e(n),s=()=>i.addIssue({code:U.custom,...a(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,t){return this._refinement((a,n)=>e(a)?!0:(n.addIssue(typeof t=="function"?t(a,n):t),!1))}_refinement(e){return new Gt({schema:this,typeName:re.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:t=>this["~validate"](t)}}optional(){return Ft.create(this,this._def)}nullable(){return nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return br.create(this)}promise(){return Dr.create(this,this._def)}or(e){return rn.create([this,e],this._def)}and(e){return nn.create(this,e,this._def)}transform(e){return new Gt({...se(this._def),schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new cn({...se(this._def),innerType:this,defaultValue:t,typeName:re.ZodDefault})}brand(){return new Sa({typeName:re.ZodBranded,type:this,...se(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new un({...se(this._def),innerType:this,catchValue:t,typeName:re.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ea.create(this,e)}readonly(){return dn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},gb=/^c[^\s-]{8,}$/i,fb=/^[0-9a-z]+$/,yb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bb=/^[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,vb=/^[a-z0-9_-]{21}$/i,_b=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sb=/^[-+]?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)?)??$/,Eb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$s,Cb=/^(?:(?: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])$/,kb=/^(?:(?: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])$/,Tb=/^(([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]))$/,xb=/^(([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])$/,Ab=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ib=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,od="((\\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])))",Rb=new RegExp(`^${od}$`);function sd(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Pb(r){return new RegExp(`^${sd(r)}$`)}function ld(r){let e=`${od}T${sd(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Db(r,e){return!!((e==="v4"||!e)&&Cb.test(r)||(e==="v6"||!e)&&Tb.test(r))}function Nb(r,e){if(!_b.test(r))return!1;try{let[t]=r.split("."),a=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Ob(r,e){return!!((e==="v4"||!e)&&kb.test(r)||(e==="v6"||!e)&&xb.test(r))}var Rr=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j.string){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_type,expected:j.string,received:i.parsedType}),ee}let a=new nt,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(n=this._getOrReturnCtx(e,n),o?W(n,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&W(n,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),a.dirty())}else if(i.kind==="email")Eb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"email",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="emoji")$s||($s=new RegExp(wb,"u")),$s.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"emoji",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="uuid")bb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"uuid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="nanoid")vb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"nanoid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid")gb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cuid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid2")fb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cuid2",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="ulid")yb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"ulid",code:U.invalid_string,message:i.message}),a.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),W(n,{validation:"url",code:U.invalid_string,message:i.message}),a.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"regex",code:U.invalid_string,message:i.message}),a.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),a.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{startsWith:i.value},message:i.message}),a.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{endsWith:i.value},message:i.message}),a.dirty()):i.kind==="datetime"?ld(i).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:"datetime",message:i.message}),a.dirty()):i.kind==="date"?Rb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:"date",message:i.message}),a.dirty()):i.kind==="time"?Pb(i).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:"time",message:i.message}),a.dirty()):i.kind==="duration"?Sb.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"duration",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="ip"?Db(e.data,i.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"ip",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="jwt"?Nb(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"jwt",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="cidr"?Ob(e.data,i.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cidr",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="base64"?Ab.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"base64",code:U.invalid_string,message:i.message}),a.dirty()):i.kind==="base64url"?Ib.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"base64url",code:U.invalid_string,message:i.message}),a.dirty()):pe.assertNever(i);return{status:a.value,value:e.data}}_regex(e,t,a){return this.refinement(n=>e.test(n),{validation:t,code:U.invalid_string,...Y.errToObj(a)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Y.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Y.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Y.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Y.errToObj(t)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Rr.create=r=>new Rr({checks:[],typeName:re.ZodString,coerce:r?.coerce??!1,...se(r)});function Lb(r,e){let t=(r.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=t>a?t:a,i=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return i%o/10**n}var Yr=class r extends ue{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)!==j.number){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_type,expected:j.number,received:i.parsedType}),ee}let a,n=new nt;for(let i of this._def.checks)i.kind==="int"?pe.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),W(a,{code:U.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?Lb(e.data,i.value)!==0&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),W(a,{code:U.not_finite,message:i.message}),n.dirty()):pe.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Y.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&pe.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(t===null||a.value>t)&&(t=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Yr.create=r=>new Yr({checks:[],typeName:re.ZodNumber,coerce:r?.coerce||!1,...se(r)});var Zr=class r extends ue{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)!==j.bigint)return this._getInvalidInput(e);let a,n=new nt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),W(a,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):pe.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:j.bigint,received:t.parsedType}),ee}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:Y.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Zr.create=r=>new Zr({checks:[],typeName:re.ZodBigInt,coerce:r?.coerce??!1,...se(r)});var Jr=class extends ue{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j.boolean){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.boolean,received:a.parsedType}),ee}return ot(e.data)}};Jr.create=r=>new Jr({typeName:re.ZodBoolean,coerce:r?.coerce||!1,...se(r)});var Qr=class r extends ue{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j.date){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_type,expected:j.date,received:i.parsedType}),ee}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return W(i,{code:U.invalid_date}),ee}let a=new nt,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):pe.assertNever(i);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Qr.create=r=>new Qr({checks:[],coerce:r?.coerce||!1,typeName:re.ZodDate,...se(r)});var Wn=class extends ue{_parse(e){if(this._getType(e)!==j.symbol){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.symbol,received:a.parsedType}),ee}return ot(e.data)}};Wn.create=r=>new Wn({typeName:re.ZodSymbol,...se(r)});var en=class extends ue{_parse(e){if(this._getType(e)!==j.undefined){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.undefined,received:a.parsedType}),ee}return ot(e.data)}};en.create=r=>new en({typeName:re.ZodUndefined,...se(r)});var tn=class extends ue{_parse(e){if(this._getType(e)!==j.null){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.null,received:a.parsedType}),ee}return ot(e.data)}};tn.create=r=>new tn({typeName:re.ZodNull,...se(r)});var Pr=class extends ue{constructor(){super(...arguments),this._any=!0}_parse(e){return ot(e.data)}};Pr.create=r=>new Pr({typeName:re.ZodAny,...se(r)});var yr=class extends ue{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ot(e.data)}};yr.create=r=>new yr({typeName:re.ZodUnknown,...se(r)});var qt=class extends ue{_parse(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:j.never,received:t.parsedType}),ee}};qt.create=r=>new qt({typeName:re.ZodNever,...se(r)});var jn=class extends ue{_parse(e){if(this._getType(e)!==j.undefined){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.void,received:a.parsedType}),ee}return ot(e.data)}};jn.create=r=>new jn({typeName:re.ZodVoid,...se(r)});var br=class r extends ue{_parse(e){let{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==j.array)return W(t,{code:U.invalid_type,expected:j.array,received:t.parsedType}),ee;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(o||s)&&(W(t,{code:o?U.too_big:U.too_small,minimum:s?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(W(t,{code:U.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(W(t,{code:U.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((o,s)=>n.type._parseAsync(new Bt(t,o,t.path,s)))).then(o=>nt.mergeArray(a,o));let i=[...t.data].map((o,s)=>n.type._parseSync(new Bt(t,o,t.path,s)));return nt.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:Y.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:Y.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:Y.toString(t)}})}nonempty(e){return this.min(1,e)}};br.create=(r,e)=>new br({type:r,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray,...se(e)});function Vn(r){if(r instanceof vt){let e={};for(let t in r.shape){let a=r.shape[t];e[t]=Ft.create(Vn(a))}return new vt({...r._def,shape:()=>e})}else return r instanceof br?new br({...r._def,type:Vn(r.element)}):r instanceof Ft?Ft.create(Vn(r.unwrap())):r instanceof nr?nr.create(Vn(r.unwrap())):r instanceof rr?rr.create(r.items.map(e=>Vn(e))):r}var vt=class r extends ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=pe.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==j.object){let c=this._getOrReturnCtx(e);return W(c,{code:U.invalid_type,expected:j.object,received:c.parsedType}),ee}let{status:a,ctx:n}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof qt&&this._def.unknownKeys==="strip"))for(let c in n.data)o.includes(c)||s.push(c);let l=[];for(let c of o){let u=i[c],p=n.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Bt(n,p,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof qt){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")s.length>0&&(W(n,{code:U.unrecognized_keys,keys:s}),a.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let p=n.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Bt(n,p,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,m=await u.value;c.push({key:p,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>nt.mergeObjectSync(a,c)):nt.mergeObjectSync(a,l)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,a)=>{let n=this._def.errorMap?.(t,a).message??a.defaultError;return t.code==="unrecognized_keys"?{message:Y.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:re.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let a of pe.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let a of pe.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}deepPartial(){return Vn(this)}partial(e){let t={};for(let a of pe.objectKeys(this.shape)){let n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let a of pe.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let i=this.shape[a];for(;i instanceof Ft;)i=i._def.innerType;t[a]=i}return new r({...this._def,shape:()=>t})}keyof(){return cd(pe.objectKeys(this.shape))}};vt.create=(r,e)=>new vt({shape:()=>r,unknownKeys:"strip",catchall:qt.create(),typeName:re.ZodObject,...se(e)});vt.strictCreate=(r,e)=>new vt({shape:()=>r,unknownKeys:"strict",catchall:qt.create(),typeName:re.ZodObject,...se(e)});vt.lazycreate=(r,e)=>new vt({shape:r,unknownKeys:"strip",catchall:qt.create(),typeName:re.ZodObject,...se(e)});var rn=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a=this._def.options;function n(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(s=>new bt(s.ctx.common.issues));return W(t,{code:U.invalid_union,unionErrors:o}),ee}if(t.common.async)return Promise.all(a.map(async i=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let l of a){let c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(l=>new bt(l));return W(t,{code:U.invalid_union,unionErrors:s}),ee}}get options(){return this._def.options}};rn.create=(r,e)=>new rn({options:r,typeName:re.ZodUnion,...se(e)});var fr=r=>r instanceof an?fr(r.schema):r instanceof Gt?fr(r.innerType()):r instanceof on?[r.value]:r instanceof sn?r.options:r instanceof ln?pe.objectValues(r.enum):r instanceof cn?fr(r._def.innerType):r instanceof en?[void 0]:r instanceof tn?[null]:r instanceof Ft?[void 0,...fr(r.unwrap())]:r instanceof nr?[null,...fr(r.unwrap())]:r instanceof Sa||r instanceof dn?fr(r.unwrap()):r instanceof un?fr(r._def.innerType):[],wi=class r extends ue{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.object)return W(t,{code:U.invalid_type,expected:j.object,received:t.parsedType}),ee;let a=this.discriminator,n=t.data[a],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(W(t,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){let n=new Map;for(let i of t){let o=fr(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(n.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);n.set(s,i)}}return new r({typeName:re.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...se(a)})}};function Xs(r,e){let t=tr(r),a=tr(e);if(r===e)return{valid:!0,data:r};if(t===j.object&&a===j.object){let n=pe.objectKeys(e),i=pe.objectKeys(r).filter(s=>n.indexOf(s)!==-1),o={...r,...e};for(let s of i){let l=Xs(r[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===j.array&&a===j.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<r.length;i++){let o=r[i],s=e[i],l=Xs(o,s);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===j.date&&a===j.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var nn=class extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=(i,o)=>{if(Si(i)||Si(o))return ee;let s=Xs(i.value,o.value);return s.valid?((Ei(i)||Ei(o))&&t.dirty(),{status:t.value,value:s.data}):(W(a,{code:U.invalid_intersection_types}),ee)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};nn.create=(r,e,t)=>new nn({left:r,right:e,typeName:re.ZodIntersection,...se(t)});var rr=class r extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.array)return W(a,{code:U.invalid_type,expected:j.array,received:a.parsedType}),ee;if(a.data.length<this._def.items.length)return W(a,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ee;!this._def.rest&&a.data.length>this._def.items.length&&(W(a,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...a.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new Bt(a,o,a.path,s)):null}).filter(o=>!!o);return a.common.async?Promise.all(i).then(o=>nt.mergeArray(t,o)):nt.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};rr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rr({items:r,typeName:re.ZodTuple,rest:null,...se(e)})};var Ci=class r extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.object)return W(a,{code:U.invalid_type,expected:j.object,received:a.parsedType}),ee;let n=[],i=this._def.keyType,o=this._def.valueType;for(let s in a.data)n.push({key:i._parse(new Bt(a,s,a.path,s)),value:o._parse(new Bt(a,a.data[s],a.path,s)),alwaysSet:s in a.data});return a.common.async?nt.mergeObjectAsync(t,n):nt.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return t instanceof ue?new r({keyType:e,valueType:t,typeName:re.ZodRecord,...se(a)}):new r({keyType:Rr.create(),valueType:e,typeName:re.ZodRecord,...se(t)})}},qn=class extends ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.map)return W(a,{code:U.invalid_type,expected:j.map,received:a.parsedType}),ee;let n=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map(([s,l],c)=>({key:n._parse(new Bt(a,s,a.path,[c,"key"])),value:i._parse(new Bt(a,l,a.path,[c,"value"]))}));if(a.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ee;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ee;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}}}};qn.create=(r,e,t)=>new qn({valueType:e,keyType:r,typeName:re.ZodMap,...se(t)});var Kn=class r extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==j.set)return W(a,{code:U.invalid_type,expected:j.set,received:a.parsedType}),ee;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(W(a,{code:U.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(W(a,{code:U.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return ee;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let s=[...a.data.values()].map((l,c)=>i._parse(new Bt(a,l,a.path,c)));return a.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new r({...this._def,minSize:{value:e,message:Y.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:Y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Kn.create=(r,e)=>new Kn({valueType:r,minSize:null,maxSize:null,typeName:re.ZodSet,...se(e)});var ki=class r extends ue{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.function)return W(t,{code:U.invalid_type,expected:j.function,received:t.parsedType}),ee;function a(s,l){return _a({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Un(),gr].filter(c=>!!c),issueData:{code:U.invalid_arguments,argumentsError:l}})}function n(s,l){return _a({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Un(),gr].filter(c=>!!c),issueData:{code:U.invalid_return_type,returnTypeError:l}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Dr){let s=this;return ot(async function(...l){let c=new bt([]),u=await s._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(a(l,d)),c}),p=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(n(p,d)),c})})}else{let s=this;return ot(function(...l){let c=s._def.args.safeParse(l,i);if(!c.success)throw new bt([a(l,c.error)]);let u=Reflect.apply(o,this,c.data),p=s._def.returns.safeParse(u,i);if(!p.success)throw new bt([n(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:rr.create(e).rest(yr.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new r({args:e||rr.create([]).rest(yr.create()),returns:t||yr.create(),typeName:re.ZodFunction,...se(a)})}},an=class extends ue{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};an.create=(r,e)=>new an({getter:r,typeName:re.ZodLazy,...se(e)});var on=class extends ue{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return W(t,{received:t.data,code:U.invalid_literal,expected:this._def.value}),ee}return{status:"valid",value:e.data}}get value(){return this._def.value}};on.create=(r,e)=>new on({value:r,typeName:re.ZodLiteral,...se(e)});function cd(r,e){return new sn({values:r,typeName:re.ZodEnum,...se(e)})}var sn=class r extends ue{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),a=this._def.values;return W(t,{expected:pe.joinValues(a),received:t.parsedType,code:U.invalid_type}),ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),a=this._def.values;return W(t,{received:t.data,code:U.invalid_enum_value,options:a}),ee}return ot(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(a=>!e.includes(a)),{...this._def,...t})}};sn.create=cd;var ln=class extends ue{_parse(e){let t=pe.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==j.string&&a.parsedType!==j.number){let n=pe.objectValues(t);return W(a,{expected:pe.joinValues(n),received:a.parsedType,code:U.invalid_type}),ee}if(this._cache||(this._cache=new Set(pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=pe.objectValues(t);return W(a,{received:a.data,code:U.invalid_enum_value,options:n}),ee}return ot(e.data)}get enum(){return this._def.values}};ln.create=(r,e)=>new ln({values:r,typeName:re.ZodNativeEnum,...se(e)});var Dr=class extends ue{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.promise&&t.common.async===!1)return W(t,{code:U.invalid_type,expected:j.promise,received:t.parsedType}),ee;let a=t.parsedType===j.promise?t.data:Promise.resolve(t.data);return ot(a.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Dr.create=(r,e)=>new Dr({type:r,typeName:re.ZodPromise,...se(e)});var Gt=class extends ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:o=>{W(a,o),o.fatal?t.abort():t.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(a.data,i);if(a.common.async)return Promise.resolve(o).then(async s=>{if(t.value==="aborted")return ee;let l=await this._def.schema._parseAsync({data:s,path:a.path,parent:a});return l.status==="aborted"?ee:l.status==="dirty"?Xr(l.value):t.value==="dirty"?Xr(l.value):l});{if(t.value==="aborted")return ee;let s=this._def.schema._parseSync({data:o,path:a.path,parent:a});return s.status==="aborted"?ee:s.status==="dirty"?Xr(s.value):t.value==="dirty"?Xr(s.value):s}}if(n.type==="refinement"){let o=s=>{let l=n.refinement(s,i);if(a.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?ee:(s.status==="dirty"&&t.dirty(),o(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>s.status==="aborted"?ee:(s.status==="dirty"&&t.dirty(),o(s.value).then(()=>({status:t.value,value:s.value}))))}if(n.type==="transform")if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Ir(o))return ee;let s=n.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>Ir(o)?Promise.resolve(n.transform(o.value,i)).then(s=>({status:t.value,value:s})):ee);pe.assertNever(n)}};Gt.create=(r,e,t)=>new Gt({schema:r,typeName:re.ZodEffects,effect:e,...se(t)});Gt.createWithPreprocess=(r,e,t)=>new Gt({schema:e,effect:{type:"preprocess",transform:r},typeName:re.ZodEffects,...se(t)});var Ft=class extends ue{_parse(e){return this._getType(e)===j.undefined?ot(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ft.create=(r,e)=>new Ft({innerType:r,typeName:re.ZodOptional,...se(e)});var nr=class extends ue{_parse(e){return this._getType(e)===j.null?ot(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(r,e)=>new nr({innerType:r,typeName:re.ZodNullable,...se(e)});var cn=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return t.parsedType===j.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};cn.create=(r,e)=>new cn({innerType:r,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...se(e)});var un=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Hn(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new bt(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};un.create=(r,e)=>new un({innerType:r,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...se(e)});var $n=class extends ue{_parse(e){if(this._getType(e)!==j.nan){let a=this._getOrReturnCtx(e);return W(a,{code:U.invalid_type,expected:j.nan,received:a.parsedType}),ee}return{status:"valid",value:e.data}}};$n.create=r=>new $n({typeName:re.ZodNaN,...se(r)});var Mb=Symbol("zod_brand"),Sa=class extends ue{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},Ea=class r extends ue{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ee:i.status==="dirty"?(t.dirty(),Xr(i.value)):this._def.out._parseAsync({data:i.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?ee:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,t){return new r({in:e,out:t,typeName:re.ZodPipeline})}},dn=class extends ue{_parse(e){let t=this._def.innerType._parse(e),a=n=>(Ir(n)&&(n.value=Object.freeze(n.value)),n);return Hn(t)?t.then(n=>a(n)):a(t)}unwrap(){return this._def.innerType}};dn.create=(r,e)=>new dn({innerType:r,typeName:re.ZodReadonly,...se(e)});function id(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function ud(r,e={},t){return r?Pr.create().superRefine((a,n)=>{let i=r(a);if(i instanceof Promise)return i.then(o=>{if(!o){let s=id(e,a),l=s.fatal??t??!0;n.addIssue({code:"custom",...s,fatal:l})}});if(!i){let o=id(e,a),s=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:s})}}):Pr.create()}var Fb={object:vt.lazycreate},re;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(re||(re={}));var Bb=(r,e={message:`Input not instance of ${r.name}`})=>ud(t=>t instanceof r,e),dd=Rr.create,pd=Yr.create,Gb=$n.create,zb=Zr.create,md=Jr.create,Ub=Qr.create,Hb=Wn.create,Vb=en.create,Wb=tn.create,jb=Pr.create,qb=yr.create,Kb=qt.create,$b=jn.create,Xb=br.create,Yb=vt.create,Zb=vt.strictCreate,Jb=rn.create,Qb=wi.create,ev=nn.create,tv=rr.create,rv=Ci.create,nv=qn.create,av=Kn.create,iv=ki.create,ov=an.create,sv=on.create,lv=sn.create,cv=ln.create,uv=Dr.create,dv=Gt.create,pv=Ft.create,mv=nr.create,hv=Gt.createWithPreprocess,gv=Ea.create,fv=()=>dd().optional(),yv=()=>pd().optional(),bv=()=>md().optional(),vv={string:r=>Rr.create({...r,coerce:!0}),number:r=>Yr.create({...r,coerce:!0}),boolean:r=>Jr.create({...r,coerce:!0}),bigint:r=>Zr.create({...r,coerce:!0}),date:r=>Qr.create({...r,coerce:!0})};var _v=ee;var Xn="2025-03-26",hd=[Xn,"2024-11-05","2024-10-07"],Ti="2.0",gd=h.union([h.string(),h.number().int()]),fd=h.string(),Sv=h.object({progressToken:h.optional(gd)}).passthrough(),Kt=h.object({_meta:h.optional(Sv)}).passthrough(),xt=h.object({method:h.string(),params:h.optional(Kt)}),wa=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),ar=h.object({method:h.string(),params:h.optional(wa)}),$t=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),xi=h.union([h.string(),h.number().int()]),yd=h.object({jsonrpc:h.literal(Ti),id:xi}).merge(xt).strict(),Ai=r=>yd.safeParse(r).success,bd=h.object({jsonrpc:h.literal(Ti)}).merge(ar).strict(),vd=r=>bd.safeParse(r).success,_d=h.object({jsonrpc:h.literal(Ti),id:xi,result:$t}).strict(),Ca=r=>_d.safeParse(r).success,zt;(function(r){r[r.ConnectionClosed=-32e3]="ConnectionClosed",r[r.RequestTimeout=-32001]="RequestTimeout",r[r.ParseError=-32700]="ParseError",r[r.InvalidRequest=-32600]="InvalidRequest",r[r.MethodNotFound=-32601]="MethodNotFound",r[r.InvalidParams=-32602]="InvalidParams",r[r.InternalError=-32603]="InternalError"})(zt||(zt={}));var Sd=h.object({jsonrpc:h.literal(Ti),id:xi,error:h.object({code:h.number().int(),message:h.string(),data:h.optional(h.unknown())})}).strict(),Ed=r=>Sd.safeParse(r).success,Yn=h.union([yd,bd,_d,Sd]),pn=$t.strict(),Ii=ar.extend({method:h.literal("notifications/cancelled"),params:wa.extend({requestId:xi,reason:h.string().optional()})}),wd=h.object({name:h.string(),version:h.string()}).passthrough(),Ev=h.object({experimental:h.optional(h.object({}).passthrough()),sampling:h.optional(h.object({}).passthrough()),roots:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),wv=xt.extend({method:h.literal("initialize"),params:Kt.extend({protocolVersion:h.string(),capabilities:Ev,clientInfo:wd})});var Cv=h.object({experimental:h.optional(h.object({}).passthrough()),logging:h.optional(h.object({}).passthrough()),completions:h.optional(h.object({}).passthrough()),prompts:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough()),resources:h.optional(h.object({subscribe:h.optional(h.boolean()),listChanged:h.optional(h.boolean())}).passthrough()),tools:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),Ys=$t.extend({protocolVersion:h.string(),capabilities:Cv,serverInfo:wd,instructions:h.optional(h.string())}),Cd=ar.extend({method:h.literal("notifications/initialized")}),kd=r=>Cd.safeParse(r).success,Ri=xt.extend({method:h.literal("ping")}),kv=h.object({progress:h.number(),total:h.optional(h.number()),message:h.optional(h.string())}).passthrough(),Pi=ar.extend({method:h.literal("notifications/progress"),params:wa.merge(kv).extend({progressToken:gd})}),Di=xt.extend({params:Kt.extend({cursor:h.optional(fd)}).optional()}),Ni=$t.extend({nextCursor:h.optional(fd)}),Td=h.object({uri:h.string(),mimeType:h.optional(h.string())}).passthrough(),xd=Td.extend({text:h.string()}),Ad=Td.extend({blob:h.string().base64()}),Tv=h.object({uri:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),xv=h.object({uriTemplate:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),Av=Di.extend({method:h.literal("resources/list")}),Zs=Ni.extend({resources:h.array(Tv)}),Iv=Di.extend({method:h.literal("resources/templates/list")}),Js=Ni.extend({resourceTemplates:h.array(xv)}),Rv=xt.extend({method:h.literal("resources/read"),params:Kt.extend({uri:h.string()})}),Qs=$t.extend({contents:h.array(h.union([xd,Ad]))}),Pv=ar.extend({method:h.literal("notifications/resources/list_changed")}),Dv=xt.extend({method:h.literal("resources/subscribe"),params:Kt.extend({uri:h.string()})}),Nv=xt.extend({method:h.literal("resources/unsubscribe"),params:Kt.extend({uri:h.string()})}),Ov=ar.extend({method:h.literal("notifications/resources/updated"),params:wa.extend({uri:h.string()})}),Lv=h.object({name:h.string(),description:h.optional(h.string()),required:h.optional(h.boolean())}).passthrough(),Mv=h.object({name:h.string(),description:h.optional(h.string()),arguments:h.optional(h.array(Lv))}).passthrough(),Fv=Di.extend({method:h.literal("prompts/list")}),el=Ni.extend({prompts:h.array(Mv)}),Bv=xt.extend({method:h.literal("prompts/get"),params:Kt.extend({name:h.string(),arguments:h.optional(h.record(h.string()))})}),Oi=h.object({type:h.literal("text"),text:h.string()}).passthrough(),Li=h.object({type:h.literal("image"),data:h.string().base64(),mimeType:h.string()}).passthrough(),Mi=h.object({type:h.literal("audio"),data:h.string().base64(),mimeType:h.string()}).passthrough(),Id=h.object({type:h.literal("resource"),resource:h.union([xd,Ad])}).passthrough(),Gv=h.object({role:h.enum(["user","assistant"]),content:h.union([Oi,Li,Mi,Id])}).passthrough(),tl=$t.extend({description:h.optional(h.string()),messages:h.array(Gv)}),zv=ar.extend({method:h.literal("notifications/prompts/list_changed")}),Uv=h.object({title:h.optional(h.string()),readOnlyHint:h.optional(h.boolean()),destructiveHint:h.optional(h.boolean()),idempotentHint:h.optional(h.boolean()),openWorldHint:h.optional(h.boolean())}).passthrough(),Hv=h.object({name:h.string(),description:h.optional(h.string()),inputSchema:h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough(),outputSchema:h.optional(h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough()),annotations:h.optional(Uv)}).passthrough(),Vv=Di.extend({method:h.literal("tools/list")}),rl=Ni.extend({tools:h.array(Hv)}),Fi=$t.extend({content:h.array(h.union([Oi,Li,Mi,Id])).default([]),structuredContent:h.object({}).passthrough().optional(),isError:h.optional(h.boolean())}),bA=Fi.or($t.extend({toolResult:h.unknown()})),Wv=xt.extend({method:h.literal("tools/call"),params:Kt.extend({name:h.string(),arguments:h.optional(h.record(h.unknown()))})}),nl=ar.extend({method:h.literal("notifications/tools/list_changed")}),Rd=h.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),jv=xt.extend({method:h.literal("logging/setLevel"),params:Kt.extend({level:Rd})}),al=ar.extend({method:h.literal("notifications/message"),params:wa.extend({level:Rd,logger:h.optional(h.string()),data:h.unknown()})}),qv=h.object({name:h.string().optional()}).passthrough(),Kv=h.object({hints:h.optional(h.array(qv)),costPriority:h.optional(h.number().min(0).max(1)),speedPriority:h.optional(h.number().min(0).max(1)),intelligencePriority:h.optional(h.number().min(0).max(1))}).passthrough(),$v=h.object({role:h.enum(["user","assistant"]),content:h.union([Oi,Li,Mi])}).passthrough(),Xv=xt.extend({method:h.literal("sampling/createMessage"),params:Kt.extend({messages:h.array($v),systemPrompt:h.optional(h.string()),includeContext:h.optional(h.enum(["none","thisServer","allServers"])),temperature:h.optional(h.number()),maxTokens:h.number().int(),stopSequences:h.optional(h.array(h.string())),metadata:h.optional(h.object({}).passthrough()),modelPreferences:h.optional(Kv)})}),Yv=$t.extend({model:h.string(),stopReason:h.optional(h.enum(["endTurn","stopSequence","maxTokens"]).or(h.string())),role:h.enum(["user","assistant"]),content:h.discriminatedUnion("type",[Oi,Li,Mi])}),Zv=h.object({type:h.literal("ref/resource"),uri:h.string()}).passthrough(),Jv=h.object({type:h.literal("ref/prompt"),name:h.string()}).passthrough(),Qv=xt.extend({method:h.literal("completion/complete"),params:Kt.extend({ref:h.union([Jv,Zv]),argument:h.object({name:h.string(),value:h.string()}).passthrough()})}),il=$t.extend({completion:h.object({values:h.array(h.string()).max(100),total:h.optional(h.number().int()),hasMore:h.optional(h.boolean())}).passthrough()}),e_=h.object({uri:h.string().startsWith("file://"),name:h.optional(h.string())}).passthrough(),t_=xt.extend({method:h.literal("roots/list")}),r_=$t.extend({roots:h.array(e_)}),n_=ar.extend({method:h.literal("notifications/roots/list_changed")}),vA=h.union([Ri,wv,Qv,jv,Bv,Fv,Av,Iv,Rv,Dv,Nv,Wv,Vv]),_A=h.union([Ii,Pi,Cd,n_]),SA=h.union([pn,Yv,r_]),EA=h.union([Ri,Xv,t_]),wA=h.union([Ii,Pi,al,Ov,Pv,nl,zv]),CA=h.union([pn,Ys,il,tl,el,Zs,Js,Qs,Fi,rl]),Ut=class extends Error{constructor(e,t,a){super(`MCP error ${e}: ${t}`),this.code=e,this.data=a,this.name="McpError"}};var a_=6e4,Bi=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(Ii,t=>{let a=this._requestHandlerAbortControllers.get(t.params.requestId);a?.abort(t.params.reason)}),this.setNotificationHandler(Pi,t=>{this._onprogress(t)}),this.setRequestHandler(Ri,t=>({}))}_setupTimeout(e,t,a,n,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ut(zt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=t=>{this._onerror(t)},this._transport.onmessage=(t,a)=>{Ca(t)||Ed(t)?this._onresponse(t):Ai(t)?this._onrequest(t,a):vd(t)?this._onnotification(t):this._onerror(new Error(`Unknown message type: ${JSON.stringify(t)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let a=new Ut(zt.ConnectionClosed,"Connection closed");for(let n of t.values())n(a)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let a=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;a!==void 0&&Promise.resolve().then(()=>a(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,t){var a,n,i,o;let s=(a=this._requestHandlers.get(e.method))!==null&&a!==void 0?a:this.fallbackRequestHandler;if(s===void 0){(n=this._transport)===null||n===void 0||n.send({jsonrpc:"2.0",id:e.id,error:{code:zt.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let c={signal:l.signal,sessionId:(i=this._transport)===null||i===void 0?void 0:i.sessionId,_meta:(o=e.params)===null||o===void 0?void 0:o._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,p,m)=>this.request(u,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id};Promise.resolve().then(()=>s(e,c)).then(u=>{var p;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var p,m;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:zt.InternalError,message:(m=u.message)!==null&&m!==void 0?m:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...a}=e.params,n=Number(t),i=this._progressHandlers.get(n);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(n),s=this._timeoutInfo.get(n);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(l){o(l);return}i(a)}_onresponse(e){let t=Number(e.id),a=this._responseHandlers.get(t);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Ca(e))a(e);else{let n=new Ut(e.error.code,e.error.message,e.error.data);a(n)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,a){let{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}=a??{};return new Promise((s,l)=>{var c,u,p,m,d,g;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=a?.signal)===null||u===void 0||u.throwIfAborted();let f=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:f};a?.onprogress&&(this._progressHandlers.set(f,a.onprogress),y.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:f}});let v=I=>{var D;this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),(D=this._transport)===null||D===void 0||D.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(I)}},{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`))),l(I)};this._responseHandlers.set(f,I=>{var D;if(!(!((D=a?.signal)===null||D===void 0)&&D.aborted)){if(I instanceof Error)return l(I);try{let C=t.parse(I.result);s(C)}catch(C){l(C)}}}),(m=a?.signal)===null||m===void 0||m.addEventListener("abort",()=>{var I;v((I=a?.signal)===null||I===void 0?void 0:I.reason)});let T=(d=a?.timeout)!==null&&d!==void 0?d:a_,E=()=>v(new Ut(zt.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,a?.maxTotalTimeout,E,(g=a?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(y,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:o}).catch(I=>{this._cleanupTimeout(f),l(I)})})}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let a={...e,jsonrpc:"2.0"};await this._transport.send(a,t)}setRequestHandler(e,t){let a=e.shape.method.value;this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(n,i)=>Promise.resolve(t(e.parse(n),i)))}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,a=>Promise.resolve(t(e.parse(a))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Pd(r,e){return Object.entries(e).reduce((t,[a,n])=>(n&&typeof n=="object"?t[a]=t[a]?{...t[a],...n}:n:t[a]=n,t),{...r})}var Nm=Cs(Dm(),1),Ta=class extends Bi{constructor(e,t){var a;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(a=t?.capabilities)!==null&&a!==void 0?a:{},this._ajv=new Nm.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Pd(this._capabilities,e)}assertCapability(e,t){var a;if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let a=await this.request({method:"initialize",params:{protocolVersion:Xn,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ys,t);if(a===void 0)throw new Error(`Server sent invalid initialize result: ${a}`);if(!hd.includes(a.protocolVersion))throw new Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,this._instructions=a.instructions,await this.notification({method:"notifications/initialized"})}catch(a){throw this.close(),a}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,a,n,i,o;switch(e){case"logging/setLevel":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var t;switch(e){case"notifications/roots/list_changed":if(!(!((t=this._capabilities.roots)===null||t===void 0)&&t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},pn,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},il,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},pn,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},tl,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},el,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},Zs,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Js,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Qs,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},pn,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},pn,t)}async callTool(e,t=Fi,a){let n=await this.request({method:"tools/call",params:e},t,a),i=this.getToolOutputValidator(e.name);if(i){if(!n.structuredContent&&!n.isError)throw new Ut(zt.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{if(!i(n.structuredContent))throw new Ut(zt.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(o){throw o instanceof Ut?o:new Ut(zt.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return n}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let a=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,a)}catch(a){console.warn(`Failed to compile output schema for tool ${t.name}: ${a}`)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let a=await this.request({method:"tools/list",params:e},rl,t);return this.cacheToolOutputSchemas(a.tools),a}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Rl;Rl=globalThis.crypto;async function FS(r){return(await Rl).getRandomValues(new Uint8Array(r))}async function BS(r){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",a=await FS(r);for(let n=0;n<r;n++){let i=a[n]%e.length;t+=e[i]}return t}async function GS(r){return await BS(r)}async function zS(r){let e=await(await Rl).subtle.digest("SHA-256",new TextEncoder().encode(r));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Pl(r){if(r||(r=43),r<43||r>128)throw`Expected a length between 43 and 128. Received ${r}.`;let e=await GS(r),t=await zS(e);return{code_verifier:e,code_challenge:t}}var Om=h.object({resource:h.string().url(),authorization_servers:h.array(h.string().url()).optional(),jwks_uri:h.string().url().optional(),scopes_supported:h.array(h.string()).optional(),bearer_methods_supported:h.array(h.string()).optional(),resource_signing_alg_values_supported:h.array(h.string()).optional(),resource_name:h.string().optional(),resource_documentation:h.string().optional(),resource_policy_uri:h.string().url().optional(),resource_tos_uri:h.string().url().optional(),tls_client_certificate_bound_access_tokens:h.boolean().optional(),authorization_details_types_supported:h.array(h.string()).optional(),dpop_signing_alg_values_supported:h.array(h.string()).optional(),dpop_bound_access_tokens_required:h.boolean().optional()}).passthrough(),Lm=h.object({issuer:h.string(),authorization_endpoint:h.string(),token_endpoint:h.string(),registration_endpoint:h.string().optional(),scopes_supported:h.array(h.string()).optional(),response_types_supported:h.array(h.string()),response_modes_supported:h.array(h.string()).optional(),grant_types_supported:h.array(h.string()).optional(),token_endpoint_auth_methods_supported:h.array(h.string()).optional(),token_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),service_documentation:h.string().optional(),revocation_endpoint:h.string().optional(),revocation_endpoint_auth_methods_supported:h.array(h.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),introspection_endpoint:h.string().optional(),introspection_endpoint_auth_methods_supported:h.array(h.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),code_challenge_methods_supported:h.array(h.string()).optional()}).passthrough(),Dl=h.object({access_token:h.string(),token_type:h.string(),expires_in:h.number().optional(),scope:h.string().optional(),refresh_token:h.string().optional()}).strip(),CI=h.object({error:h.string(),error_description:h.string().optional(),error_uri:h.string().optional()}),US=h.object({redirect_uris:h.array(h.string()).refine(r=>r.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:h.string().optional(),grant_types:h.array(h.string()).optional(),response_types:h.array(h.string()).optional(),client_name:h.string().optional(),client_uri:h.string().optional(),logo_uri:h.string().optional(),scope:h.string().optional(),contacts:h.array(h.string()).optional(),tos_uri:h.string().optional(),policy_uri:h.string().optional(),jwks_uri:h.string().optional(),jwks:h.any().optional(),software_id:h.string().optional(),software_version:h.string().optional()}).strip(),HS=h.object({client_id:h.string(),client_secret:h.string().optional(),client_id_issued_at:h.number().optional(),client_secret_expires_at:h.number().optional()}).strip(),Mm=US.merge(HS),kI=h.object({error:h.string(),error_description:h.string().optional()}).strip(),TI=h.object({token:h.string(),token_type_hint:h.string().optional()}).strip();var _t=class extends Error{constructor(e){super(e??"Unauthorized")}};async function Mr(r,{serverUrl:e,authorizationCode:t,scope:a,resourceMetadataUrl:n}){let i=e;try{let m=await VS(n||e);m.authorization_servers&&m.authorization_servers.length>0&&(i=m.authorization_servers[0])}catch(m){console.warn("Could not load OAuth Protected Resource metadata, falling back to /.well-known/oauth-authorization-server",m)}let o=await WS(i),s=await Promise.resolve(r.clientInformation());if(!s){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!r.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await $S(i,{metadata:o,clientMetadata:r.clientMetadata});await r.saveClientInformation(m),s=m}if(t!==void 0){let m=await r.codeVerifier(),d=await qS(i,{metadata:o,clientInformation:s,authorizationCode:t,codeVerifier:m,redirectUri:r.redirectUrl});return await r.saveTokens(d),"AUTHORIZED"}let l=await r.tokens();if(l?.refresh_token)try{let m=await KS(i,{metadata:o,clientInformation:s,refreshToken:l.refresh_token});return await r.saveTokens(m),"AUTHORIZED"}catch(m){console.error("Could not refresh OAuth tokens:",m)}let c=r.state?await r.state():void 0,{authorizationUrl:u,codeVerifier:p}=await jS(i,{metadata:o,clientInformation:s,state:c,redirectUrl:r.redirectUrl,scope:a||r.clientMetadata.scope});return await r.saveCodeVerifier(p),await r.redirectToAuthorization(u),"REDIRECT"}function no(r){let e=r.headers.get("WWW-Authenticate");if(!e)return;let[t,a]=e.split(" ");if(t.toLowerCase()!=="bearer"||!a){console.log("Invalid WWW-Authenticate header format, expected 'Bearer'");return}let i=/resource_metadata="([^"]*)"/.exec(e);if(i)try{return new URL(i[1])}catch{console.log("Invalid resource metadata url: ",i[1]);return}}async function VS(r,e){var t;let a;e?.resourceMetadataUrl?a=new URL(e?.resourceMetadataUrl):a=new URL("/.well-known/oauth-protected-resource",r);let n;try{n=await fetch(a,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:Xn}})}catch(i){if(i instanceof TypeError)n=await fetch(a);else throw i}if(n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Om.parse(await n.json())}async function WS(r,e){var t;let a=new URL("/.well-known/oauth-authorization-server",r),n;try{n=await fetch(a,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:Xn}})}catch(i){if(i instanceof TypeError)n=await fetch(a);else throw i}if(n.status!==404){if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth metadata`);return Lm.parse(await n.json())}}async function jS(r,{metadata:e,clientInformation:t,redirectUrl:a,scope:n,state:i}){let o="code",s="S256",l;if(e){if(l=new URL(e.authorization_endpoint),!e.response_types_supported.includes(o))throw new Error(`Incompatible auth server: does not support response type ${o}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(s))throw new Error(`Incompatible auth server: does not support code challenge method ${s}`)}else l=new URL("/authorize",r);let c=await Pl(),u=c.code_verifier,p=c.code_challenge;return l.searchParams.set("response_type",o),l.searchParams.set("client_id",t.client_id),l.searchParams.set("code_challenge",p),l.searchParams.set("code_challenge_method",s),l.searchParams.set("redirect_uri",String(a)),i&&l.searchParams.set("state",i),n&&l.searchParams.set("scope",n),{authorizationUrl:l,codeVerifier:u}}async function qS(r,{metadata:e,clientInformation:t,authorizationCode:a,codeVerifier:n,redirectUri:i}){let o="authorization_code",s;if(e){if(s=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(o))throw new Error(`Incompatible auth server: does not support grant type ${o}`)}else s=new URL("/token",r);let l=new URLSearchParams({grant_type:o,client_id:t.client_id,code:a,code_verifier:n,redirect_uri:String(i)});t.client_secret&&l.set("client_secret",t.client_secret);let c=await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return Dl.parse(await c.json())}async function KS(r,{metadata:e,clientInformation:t,refreshToken:a}){let n="refresh_token",i;if(e){if(i=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(n))throw new Error(`Incompatible auth server: does not support grant type ${n}`)}else i=new URL("/token",r);let o=new URLSearchParams({grant_type:n,client_id:t.client_id,refresh_token:a});t.client_secret&&o.set("client_secret",t.client_secret);let s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:o});if(!s.ok)throw new Error(`Token refresh failed: HTTP ${s.status}`);return Dl.parse({refresh_token:a,...await s.json()})}async function $S(r,{metadata:e,clientMetadata:t}){let a;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(e.registration_endpoint)}else a=new URL("/register",r);let n=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`Dynamic client registration failed: HTTP ${n.status}`);return Mm.parse(await n.json())}var ao=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Nl(r){}function io(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Nl,onError:t=Nl,onRetry:a=Nl,onComment:n}=r,i="",o=!0,s,l="",c="";function u(f){let y=o?f.replace(/^\xEF\xBB\xBF/,""):f,[v,T]=XS(`${i}${y}`);for(let E of v)p(E);i=T,o=!1}function p(f){if(f===""){d();return}if(f.startsWith(":")){n&&n(f.slice(f.startsWith(": ")?2:1));return}let y=f.indexOf(":");if(y!==-1){let v=f.slice(0,y),T=f[y+1]===" "?2:1,E=f.slice(y+T);m(v,E,f);return}m(f,"",f)}function m(f,y,v){switch(f){case"event":c=y;break;case"data":l=`${l}${y}
|
|
3255
|
-
`;break;case"id":
|
|
3256
|
-
`)?l.slice(0,-1):l}),
|
|
3257
|
-
`,a),
|
|
3258
|
-
`&&a++}}return[e,t]}var oo=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:a}={}){let n;super({start(i){n=io({onEvent:o=>{i.enqueue(o)},onError(o){e==="terminate"?i.error(o):typeof e=="function"&&e(o)},onRetry:t,onComment:a})},transform(i){n.feed(i)}})}};var YS={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},xa=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},so=class{constructor(e,t){var a;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._sessionId=t?.sessionId,this._reconnectionOptions=(a=t?.reconnectionOptions)!==null&&a!==void 0?a:YS}async _authThenStart(){var e;if(!this._authProvider)throw new _t("No auth provider");let t;try{t=await Mr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(a){throw(e=this.onerror)===null||e===void 0||e.call(this,a),a}if(t!=="AUTHORIZED")throw new _t;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}return this._sessionId&&(t["mcp-session-id"]=this._sessionId),new Headers({...t,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}async _startOrAuthSse(e){var t,a;let{resumptionToken:n}=e;try{let i=await this._commonHeaders();i.set("Accept","text/event-stream"),n&&i.set("last-event-id",n);let o=await fetch(this._url,{method:"GET",headers:i,signal:(t=this._abortController)===null||t===void 0?void 0:t.signal});if(!o.ok){if(o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new xa(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e)}catch(i){throw(a=this.onerror)===null||a===void 0||a.call(this,i),i}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,a=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(a,e),n)}_scheduleReconnection(e,t=0){var a;let n=this._reconnectionOptions.maxRetries;if(n>0&&t>=n){(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let i=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var s;(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},i)}_handleSseStream(e,t){if(!e)return;let{onresumptiontoken:a,replayMessageId:n}=t,i;(async()=>{var s,l,c,u;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new oo).getReader();for(;;){let{value:m,done:d}=await p.read();if(d)break;if(m.id&&(i=m.id,a?.(m.id)),!m.event||m.event==="message")try{let g=Yn.parse(JSON.parse(m.data));n!==void 0&&Ca(g)&&(g.id=n),(s=this.onmessage)===null||s===void 0||s.call(this,g)}catch(g){(l=this.onerror)===null||l===void 0||l.call(this,g)}}}catch(p){if((c=this.onerror)===null||c===void 0||c.call(this,new Error(`SSE stream disconnected: ${p}`)),this._abortController&&!this._abortController.signal.aborted&&i!==void 0)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n},0)}catch(m){(u=this.onerror)===null||u===void 0||u.call(this,new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new _t("No auth provider");if(await Mr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new _t("Failed to authorize")}async close(){var e,t;(e=this._abortController)===null||e===void 0||e.abort(),(t=this.onclose)===null||t===void 0||t.call(this)}async send(e,t){var a,n,i;try{let{resumptionToken:o,onresumptiontoken:s}=t||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Ai(e)?e.id:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let l=await this._commonHeaders();l.set("content-type","application/json"),l.set("accept","application/json, text/event-stream");let c={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},u=await fetch(this._url,c),p=u.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!u.ok){if(u.status===401&&this._authProvider){if(this._resourceMetadataUrl=no(u),await Mr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new _t;return this.send(e)}let f=await u.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${f}`)}if(u.status===202){kd(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let d=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,g=u.headers.get("content-type");if(d)if(g?.includes("text/event-stream"))this._handleSseStream(u.body,{onresumptiontoken:s});else if(g?.includes("application/json")){let f=await u.json(),y=Array.isArray(f)?f.map(v=>Yn.parse(v)):[Yn.parse(f)];for(let v of y)(n=this.onmessage)===null||n===void 0||n.call(this,v)}else throw new xa(-1,`Unexpected content type: ${g}`)}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}get sessionId(){return this._sessionId}async terminateSession(){var e,t;if(this._sessionId)try{let a=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},i=await fetch(this._url,n);if(!i.ok&&i.status!==405)throw new xa(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(a){throw(t=this.onerror)===null||t===void 0||t.call(this,a),a}}};var co=class extends Event{constructor(e,t){var a,n;super(e),this.code=(a=t?.code)!=null?a:void 0,this.message=(n=t?.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,a){return a(Fm(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Fm(this),t)}};function ZS(r){let e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function Ol(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(Ol).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${Ol(r.cause)}`:r.message:`${r}`}function Fm(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var Gm=r=>{throw TypeError(r)},Hl=(r,e,t)=>e.has(r)||Gm("Cannot "+t),me=(r,e,t)=>(Hl(r,e,"read from private field"),t?t.call(r):e.get(r)),Xe=(r,e,t)=>e.has(r)?Gm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Le=(r,e,t,a)=>(Hl(r,e,"write to private field"),e.set(r,t),t),vr=(r,e,t)=>(Hl(r,e,"access private method"),t),St,gn,Zn,lo,uo,Ra,ea,Pa,Fr,Jn,ta,Qn,Aa,Xt,Ll,Ml,Fl,Bm,Bl,Gl,Ia,zl,Ul,fn=class extends EventTarget{constructor(e,t){var a,n;super(),Xe(this,Xt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Xe(this,St),Xe(this,gn),Xe(this,Zn),Xe(this,lo),Xe(this,uo),Xe(this,Ra),Xe(this,ea),Xe(this,Pa,null),Xe(this,Fr),Xe(this,Jn),Xe(this,ta,null),Xe(this,Qn,null),Xe(this,Aa,null),Xe(this,Ml,async i=>{var o;me(this,Jn).reset();let{body:s,redirected:l,status:c,headers:u}=i;if(c===204){vr(this,Xt,Ia).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Le(this,Zn,new URL(i.url)):Le(this,Zn,void 0),c!==200){vr(this,Xt,Ia).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){vr(this,Xt,Ia).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(me(this,St)===this.CLOSED)return;Le(this,St,this.OPEN);let p=new Event("open");if((o=me(this,Aa))==null||o.call(this,p),this.dispatchEvent(p),typeof s!="object"||!s||!("getReader"in s)){vr(this,Xt,Ia).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}let m=new TextDecoder,d=s.getReader(),g=!0;do{let{done:f,value:y}=await d.read();y&&me(this,Jn).feed(m.decode(y,{stream:!f})),f&&(g=!1,me(this,Jn).reset(),vr(this,Xt,zl).call(this))}while(g)}),Xe(this,Fl,i=>{Le(this,Fr,void 0),!(i.name==="AbortError"||i.type==="aborted")&&vr(this,Xt,zl).call(this,Ol(i))}),Xe(this,Bl,i=>{typeof i.id=="string"&&Le(this,Pa,i.id);let o=new MessageEvent(i.event||"message",{data:i.data,origin:me(this,Zn)?me(this,Zn).origin:me(this,gn).origin,lastEventId:i.id||""});me(this,Qn)&&(!i.event||i.event==="message")&&me(this,Qn).call(this,o),this.dispatchEvent(o)}),Xe(this,Gl,i=>{Le(this,Ra,i)}),Xe(this,Ul,()=>{Le(this,ea,void 0),me(this,St)===this.CONNECTING&&vr(this,Xt,Ll).call(this)});try{if(e instanceof URL)Le(this,gn,e);else if(typeof e=="string")Le(this,gn,new URL(e,JS()));else throw new Error("Invalid URL")}catch{throw ZS("An invalid or illegal string was specified")}Le(this,Jn,io({onEvent:me(this,Bl),onRetry:me(this,Gl)})),Le(this,St,this.CONNECTING),Le(this,Ra,3e3),Le(this,uo,(a=t?.fetch)!=null?a:globalThis.fetch),Le(this,lo,(n=t?.withCredentials)!=null?n:!1),vr(this,Xt,Ll).call(this)}get readyState(){return me(this,St)}get url(){return me(this,gn).href}get withCredentials(){return me(this,lo)}get onerror(){return me(this,ta)}set onerror(e){Le(this,ta,e)}get onmessage(){return me(this,Qn)}set onmessage(e){Le(this,Qn,e)}get onopen(){return me(this,Aa)}set onopen(e){Le(this,Aa,e)}addEventListener(e,t,a){let n=t;super.addEventListener(e,n,a)}removeEventListener(e,t,a){let n=t;super.removeEventListener(e,n,a)}close(){me(this,ea)&&clearTimeout(me(this,ea)),me(this,St)!==this.CLOSED&&(me(this,Fr)&&me(this,Fr).abort(),Le(this,St,this.CLOSED),Le(this,Fr,void 0))}};St=new WeakMap,gn=new WeakMap,Zn=new WeakMap,lo=new WeakMap,uo=new WeakMap,Ra=new WeakMap,ea=new WeakMap,Pa=new WeakMap,Fr=new WeakMap,Jn=new WeakMap,ta=new WeakMap,Qn=new WeakMap,Aa=new WeakMap,Xt=new WeakSet,Ll=function(){Le(this,St,this.CONNECTING),Le(this,Fr,new AbortController),me(this,uo)(me(this,gn),vr(this,Xt,Bm).call(this)).then(me(this,Ml)).catch(me(this,Fl))},Ml=new WeakMap,Fl=new WeakMap,Bm=function(){var r;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...me(this,Pa)?{"Last-Event-ID":me(this,Pa)}:void 0},cache:"no-store",signal:(r=me(this,Fr))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Bl=new WeakMap,Gl=new WeakMap,Ia=function(r,e){var t;me(this,St)!==this.CLOSED&&Le(this,St,this.CLOSED);let a=new co("error",{code:e,message:r});(t=me(this,ta))==null||t.call(this,a),this.dispatchEvent(a)},zl=function(r,e){var t;if(me(this,St)===this.CLOSED)return;Le(this,St,this.CONNECTING);let a=new co("error",{code:e,message:r});(t=me(this,ta))==null||t.call(this,a),this.dispatchEvent(a),Le(this,ea,setTimeout(me(this,Ul),me(this,Ra)))},Ul=new WeakMap,fn.CONNECTING=0,fn.OPEN=1,fn.CLOSED=2;function JS(){let r="document"in globalThis?globalThis.document:void 0;return r&&typeof r=="object"&&"baseURI"in r&&typeof r.baseURI=="string"?r.baseURI:void 0}var Vl=class extends Error{constructor(e,t,a){super(`SSE error: ${t}`),this.code=e,this.event=a}},po=class{constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider}async _authThenStart(){var e;if(!this._authProvider)throw new _t("No auth provider");let t;try{t=await Mr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(a){throw(e=this.onerror)===null||e===void 0||e.call(this,a),a}if(t!=="AUTHORIZED")throw new _t;return await this._startOrAuth()}async _commonHeaders(){var e;let t={...(e=this._requestInit)===null||e===void 0?void 0:e.headers};if(this._authProvider){let a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}return t}_startOrAuth(){return new Promise((e,t)=>{var a;this._eventSource=new fn(this._url.href,(a=this._eventSourceInit)!==null&&a!==void 0?a:{fetch:(n,i)=>this._commonHeaders().then(o=>fetch(n,{...i,headers:{...o,Accept:"text/event-stream"}}))}),this._abortController=new AbortController,this._eventSource.onerror=n=>{var i;if(n.code===401&&this._authProvider){this._authThenStart().then(e,t);return}let o=new Vl(n.code,n.message,n);t(o),(i=this.onerror)===null||i===void 0||i.call(this,o)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",n=>{var i;let o=n;try{if(this._endpoint=new URL(o.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(s){t(s),(i=this.onerror)===null||i===void 0||i.call(this,s),this.close();return}e()}),this._eventSource.onmessage=n=>{var i,o;let s=n,l;try{l=Yn.parse(JSON.parse(s.data))}catch(c){(i=this.onerror)===null||i===void 0||i.call(this,c);return}(o=this.onmessage)===null||o===void 0||o.call(this,l)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new _t("No auth provider");if(await Mr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new _t("Failed to authorize")}async close(){var e,t,a;(e=this._abortController)===null||e===void 0||e.abort(),(t=this._eventSource)===null||t===void 0||t.close(),(a=this.onclose)===null||a===void 0||a.call(this)}async send(e){var t,a,n;if(!this._endpoint)throw new Error("Not connected");try{let i=await this._commonHeaders(),o=new Headers({...i,...(t=this._requestInit)===null||t===void 0?void 0:t.headers});o.set("content-type","application/json");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},l=await fetch(this._endpoint,s);if(!l.ok){if(l.status===401&&this._authProvider){if(this._resourceMetadataUrl=no(l),await Mr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new _t;return this.send(e)}let c=await l.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${l.status}): ${c}`)}}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}};var _r={name:"@intelliweave/embedded",version:"1.8.63",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && IW_TESTER_API_KEY=97150cfc-5b97-413e-8da3-e86d01f70057 tsx --test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@modelcontextprotocol/sdk":"^1.12.1","@types/json-schema":"^7.0.15","gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var Ye=new ge("MCPKnowledgeClient"),mo=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){Ye.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let t=new Ta({name:_r.name,version:_r.version}),a=new so(new URL(this.config.baseURL));return await t.connect(a),Ye.debug("Connected with HTTP streaming mode"),t}).catch(async t=>{let a=new Ta({name:_r.name,version:_r.version}),n=new po(new URL(this.config.baseURL));return await a.connect(n),Ye.debug("Connected with SSE mode"),a});return await this.disconnect(),this.client=e,e.onerror=t=>{Ye.error(`MCP client error: ${t.message}`)},e.onclose=()=>{Ye.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(al,t=>{t.params.level=="critical"?Ye.error(`[Server] ${t.params.data}`):t.params.level=="emergency"?Ye.error(`[Server] ${t.params.data}`):t.params.level=="error"?Ye.error(`[Server] ${t.params.data}`):t.params.level=="warning"?Ye.warn(`[Server] ${t.params.data}`):t.params.level=="info"?Ye.info(`[Server] ${t.params.data}`):t.params.level=="debug"?Ye.debug(`[Server] ${t.params.data}`):Ye.log(`[Server] ${t.params.data}`)}),e.setNotificationHandler(nl,t=>{Ye.debug("Tool list changed",t),this.fetchTools()}),Ye.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],t;for(;;){let n=await this.client.listTools({cursor:t});t=n.nextCursor;for(let i of n.tools||[])e.push(i);if(!n?.tools?.length||!t)break}let a=[];for(let n of e){let i=!!(this.config.searchToolName&&n.name==this.config.searchToolName&&!this.config.searchToolVisible);a.push({id:n.name,name:n.name,content:n.description||"",type:"action",isContext:!0,parameters:n.inputSchema,action:o=>this.performToolCall(n.name,o),disabled:i})}Ye.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=a}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let t=this.iwActions.slice(),a=await this.performSearchCall(e);return t=t.concat(a),this.lastSearchQuery=e,this.lastSearchResults=t,Ye.debug(`Search completed, found ${t.length} items.`),t}async performSearchCall(e){let t=[];if(!this.config.searchToolName)return t;let a=this.tools.find(i=>i.name==this.config.searchToolName);if(!a)return Ye.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),t;let n;if(a.inputSchema.required?.length==1){let i=a.inputSchema.required[0];n=await this.performToolCall(this.config.searchToolName,{[i]:e})}else if(a.inputSchema.properties&&Object.keys(a.inputSchema.properties).length==1){let i=Object.keys(a.inputSchema.properties)[0];n=await this.performToolCall(this.config.searchToolName,{[i]:e})}else n=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(n))for(let i=0;i<n.length;i++){let o=n[i];t.push({id:this.config.id+":"+this.config.searchToolName+":"+i,name:`Search result ${i+1} in ${this.config.searchToolName}`,type:"info",content:typeof o=="string"?o:JSON.stringify(o)})}else t.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof n=="string"?n:JSON.stringify(n)});return t}async performToolCall(e,t){await this.connect(),Ye.debug(`Performing tool call for ${e} with params:`,t),this.stats.toolsCalled+=1;let a=await this.client.callTool({name:e,arguments:t});if(a.isError){let n=a.content?.[0]?.text||"Unknown error";throw Ye.error(`Error calling tool ${e}: ${n}`),new Error(`Error calling tool ${e}: ${n}`)}if(Array.isArray(a.content)&&a.content.length==1&&a.content[0].type=="text")try{return JSON.parse(a.content[0].text)}catch{}return a.content||[]}};var eE=new ge("Statistics"),Da=[];async function pt(r,e){let t={...e,event_id:Tt(),event_date:new Date().toISOString(),sdk_version:_r.version,conversation_id:r?.conversationID||"",api_key:r?.apiKey||"",user_id:r?.userID||""};if(Da.push(t),!r||(await new Promise(n=>setTimeout(n,5e3)),Da.length===0))return;let a=Da.slice();Da.length=0;try{let n=await fetch(r.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:a})});if(!n.ok)throw new Error(`Analytics submission failed: ${n.status} ${n.statusText}`)}catch(n){eE.warn("Failed to submit analytics event:",n),Da.push(...a);return}}var yn=new ge("KnowledgeBase"),Wl=1,ho=class r{constructor(e){this._sources=[{id:"core.internal",query:async()=>rd}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=e}registerSource(e,t){let a=e;return typeof e=="function"&&(t=e,a=`source.${Wl++}`),this._sources.push({id:a,query:t}),a}removeSource(e){this._sources=this.sources.filter(t=>t.id!==e&&t.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(t=>t.id!==e)}get sources(){let e=this._sources;return Ne().knowledgeBaseSources&&(e=e.concat(Ne().knowledgeBaseSources)),e=e.concat(this._windowSources),e=e.filter(t=>!t.disabled),e}async search(e){let t=Date.now();yn.debug(`Searching knowledge base for: ${e}`);let a=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});a.query=e,a.entries=[],a.sources=[],typeof document<"u"&&document.dispatchEvent(a),this._windowSources=a.sources;let i=(await Promise.all(this.sources.map(async c=>{try{let u=Date.now(),p=await c.query(e);return yn.debug(`Source '${c.id}' took ${Date.now()-u}ms`),p||[]}catch(u){return yn.warn(`Knowledge source '${c.id}' failed:`,u),[]}}))).flat();i=i.concat(a.entries),i=i.concat(this.manualEntries),Ne().knowledgeBase&&(i=i.concat(Ne().knowledgeBase)),i=i.filter(c=>c&&!c.disabled);for(let c=0;c<i.length;c++){let u=i[c];u.id=u.id||`temp.${c}`,u._functionID=u.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!u.action&&u.type=="tour"&&(u.action=p=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!u.action&&u.type=="info"&&(u.action=p=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")})}let o=new td({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});o.addAll(i);let l=o.search(e).map(c=>i.find(u=>u.id==c.id));for(let c of i)c.isContext&&(l.find(u=>u.id===c.id)||l.push(c));return this.lastResults=l,pt(this.ai,{event_type:"kb_search",value:l.length,value_str:"",event_properties:{search_time_ms:Date.now()-t,sources_searched:this.sources.length}}),yn.debug("Found results:",l),l}getCachedEntry(e){return this.lastResults.find(t=>t.id==e||t._functionID==e)}registerSourceFromURL(e,t){t||(t=`external.${Wl++}`),yn.debug(`Registering remote knowledge base source: ${e}`);let a=[],n=[],i=!0,o=async(l,c)=>{yn.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,extra:this.ai.extra,actionID:l.id,parameters:c},p=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!p.ok)throw new Error(`HTTP Error ${p.status} ${p.statusText}`);let m=await p.json();return s(m.updateItems||[]),m.response},s=l=>{for(let c of l){if(!c.id){yn.warn("KB item skipped since it has no ID.",c);continue}let u=a.find(p=>p.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}a.push({...c,action:p=>o(c,p)})}};this.registerSource(t,async l=>{if(i&&n.includes(l))return a;let c={type:"search",userID:this.ai?.userID||"",extra:this.ai?.extra||{},query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let p=await u.json();return i=!p.noCache,n.includes(l)||n.push(l),s(p.items),a})}clone(){let e=new r(this.ai);return e._sources=this._sources,e._windowSources=this._windowSources,e.manualEntries=this.manualEntries,e}registerMCPSource(e){e.id||(e.id=`external.${Wl++}`);let t=new mo(e);return this.registerSource(e.id,a=>t.search(a)),t}};var go=class{constructor(e){this.ai=e}async boolean(e){let t=await this.instruct({...e,instruction:`${e.instruction}
|
|
3277
|
+
`:m.type=="tool_use"&&u.push(this.performToolCall(m));let p=await Promise.all(u);if(p.length>0){let m={role:"user",content:p};this.messageGroup.add({id:"msg-"+so++,content:JSON.stringify(m),customData:m}),a=!0}this.config.onAIMessage?.(n,!0),this.stats.tokensUsed+=o.usage.input_tokens+o.usage.output_tokens}return n=n.trim(),this.config.onAIMessage?.(n,!1),n}async performToolCall(e){try{let t=this.toolGroup.getAll().find(n=>n.customData?.name==e.name);if(!t)throw new Error(`Tool ${e.name} not found`);this.config.onAIToolStart?.(e.name,e.input);let a=await t.customData.callback(e.input);return typeof a!="string"&&(a=JSON.stringify(a)||""),(a===""||a==="undefined")&&(a="success"),{type:"tool_result",tool_use_id:e.id,content:String(a||"")}}catch(t){return oo.error(`Error performing tool call ${e.name}: ${t.message||t.toString()}`),{type:"tool_result",tool_use_id:e.id,content:`Error performing tool call ${e.name}: ${t.message||t.toString()}`}}}async trimMessages(){for(await super.trimMessages();this.messageGroup.items[0].customData?.content?.type=="tool_result";)this.messageGroup.items.shift()}};var Le=function(){return Le=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++){t=arguments[a];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Le.apply(this,arguments)};function TS(r,e,t,a){function n(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function o(u){try{c(a.next(u))}catch(p){s(p)}}function l(u){try{c(a.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):n(u.value).then(o,l)}c((a=a.apply(r,e||[])).next())})}function AS(r,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},a,n,i,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(u){return l([c,u])}}function l(c){if(a)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(a=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,n=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],n=0}finally{a=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function he(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],a=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function qe(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var a=t.call(r),n,i=[],s;try{for(;(e===void 0||e-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(o){s={error:o}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(s)throw s.error}}return i}var IS="ENTRIES",Wm="KEYS",qm="VALUES",dt="",Jc=function(){function r(e,t){var a=e._tree,n=Array.from(a.keys());this.set=e,this._type=t,this._path=n.length>0?[{node:a,keys:n}]:[]}return r.prototype.next=function(){var e=this.dive();return this.backtrack(),e},r.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=Ba(this._path),t=e.node,a=e.keys;if(Ba(a)===dt)return{done:!1,value:this.result()};var n=t.get(Ba(a));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()},r.prototype.backtrack=function(){if(this._path.length!==0){var e=Ba(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},r.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var t=e.keys;return Ba(t)}).filter(function(e){return e!==dt}).join("")},r.prototype.value=function(){return Ba(this._path).node.get(dt)},r.prototype.result=function(){switch(this._type){case qm:return this.value();case Wm:return this.key();default:return[this.key(),this.value()]}},r.prototype[Symbol.iterator]=function(){return this},r}(),Ba=function(r){return r[r.length-1]},RS=function(r,e,t){var a=new Map;if(e===void 0)return a;for(var n=e.length+1,i=n+t,s=new Uint8Array(i*n).fill(t+1),o=0;o<n;++o)s[o]=o;for(var l=1;l<i;++l)s[l*n]=l;return $m(r,e,t,a,s,1,n,""),a},$m=function(r,e,t,a,n,i,s,o){var l,c,u=i*s;try{e:for(var p=he(r.keys()),m=p.next();!m.done;m=p.next()){var d=m.value;if(d===dt){var g=n[u-1];g<=t&&a.set(o,[r.get(d),g])}else{for(var f=i,y=0;y<d.length;++y,++f){for(var b=d[y],x=s*f,S=x-s,A=n[x],R=Math.max(0,f-t-1),k=Math.min(s-1,f+t),O=R;O<k;++O){var B=b!==e[O],P=n[S+O]+ +B,G=n[S+O+1]+1,U=n[x+O]+1,M=n[x+O+1]=Math.min(P,G,U);M<A&&(A=M)}if(A>t)continue e}$m(r.get(d),e,t,a,n,f,s,o+d)}}}catch(T){l={error:T}}finally{try{m&&!m.done&&(c=p.return)&&c.call(p)}finally{if(l)throw l.error}}},Zc=function(){function r(e,t){e===void 0&&(e=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=e,this._prefix=t}return r.prototype.atPrefix=function(e){var t,a;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var n=qe(uo(this._tree,e.slice(this._prefix.length)),2),i=n[0],s=n[1];if(i===void 0){var o=qe(su(s),2),l=o[0],c=o[1];try{for(var u=he(l.keys()),p=u.next();!p.done;p=u.next()){var m=p.value;if(m!==dt&&m.startsWith(c)){var d=new Map;return d.set(m.slice(c.length),l.get(m)),new r(d,e)}}}catch(g){t={error:g}}finally{try{p&&!p.done&&(a=u.return)&&a.call(u)}finally{if(t)throw t.error}}}return new r(i,e)},r.prototype.clear=function(){this._size=void 0,this._tree.clear()},r.prototype.delete=function(e){return this._size=void 0,PS(this._tree,e)},r.prototype.entries=function(){return new Jc(this,IS)},r.prototype.forEach=function(e){var t,a;try{for(var n=he(this),i=n.next();!i.done;i=n.next()){var s=qe(i.value,2),o=s[0],l=s[1];e(o,l,this)}}catch(c){t={error:c}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},r.prototype.fuzzyGet=function(e,t){return RS(this._tree,e,t)},r.prototype.get=function(e){var t=nu(this._tree,e);return t!==void 0?t.get(dt):void 0},r.prototype.has=function(e){var t=nu(this._tree,e);return t!==void 0&&t.has(dt)},r.prototype.keys=function(){return new Jc(this,Wm)},r.prototype.set=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Qc(this._tree,e);return a.set(dt,t),this},Object.defineProperty(r.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),r.prototype.update=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Qc(this._tree,e);return a.set(dt,t(a.get(dt))),this},r.prototype.fetch=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var a=Qc(this._tree,e),n=a.get(dt);return n===void 0&&a.set(dt,n=t()),n},r.prototype.values=function(){return new Jc(this,qm)},r.prototype[Symbol.iterator]=function(){return this.entries()},r.from=function(e){var t,a,n=new r;try{for(var i=he(e),s=i.next();!s.done;s=i.next()){var o=qe(s.value,2),l=o[0],c=o[1];n.set(l,c)}}catch(u){t={error:u}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}return n},r.fromObject=function(e){return r.from(Object.entries(e))},r}(),uo=function(r,e,t){var a,n;if(t===void 0&&(t=[]),e.length===0||r==null)return[r,t];try{for(var i=he(r.keys()),s=i.next();!s.done;s=i.next()){var o=s.value;if(o!==dt&&e.startsWith(o))return t.push([r,o]),uo(r.get(o),e.slice(o.length),t)}}catch(l){a={error:l}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return t.push([r,e]),uo(void 0,"",t)},nu=function(r,e){var t,a;if(e.length===0||r==null)return r;try{for(var n=he(r.keys()),i=n.next();!i.done;i=n.next()){var s=i.value;if(s!==dt&&e.startsWith(s))return nu(r.get(s),e.slice(s.length))}}catch(o){t={error:o}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},Qc=function(r,e){var t,a,n=e.length;e:for(var i=0;r&&i<n;){try{for(var s=(t=void 0,he(r.keys())),o=s.next();!o.done;o=s.next()){var l=o.value;if(l!==dt&&e[i]===l[0]){for(var c=Math.min(n-i,l.length),u=1;u<c&&e[i+u]===l[u];)++u;var p=r.get(l);if(u===l.length)r=p;else{var m=new Map;m.set(l.slice(u),p),r.set(e.slice(i,i+u),m),r.delete(l),r=m}i+=u;continue e}}}catch(g){t={error:g}}finally{try{o&&!o.done&&(a=s.return)&&a.call(s)}finally{if(t)throw t.error}}var d=new Map;return r.set(e.slice(i),d),d}return r},PS=function(r,e){var t=qe(uo(r,e),2),a=t[0],n=t[1];if(a!==void 0){if(a.delete(dt),a.size===0)Km(n);else if(a.size===1){var i=qe(a.entries().next().value,2),s=i[0],o=i[1];Xm(n,s,o)}}},Km=function(r){if(r.length!==0){var e=qe(su(r),2),t=e[0],a=e[1];if(t.delete(a),t.size===0)Km(r.slice(0,-1));else if(t.size===1){var n=qe(t.entries().next().value,2),i=n[0],s=n[1];i!==dt&&Xm(r.slice(0,-1),i,s)}}},Xm=function(r,e,t){if(r.length!==0){var a=qe(su(r),2),n=a[0],i=a[1];n.set(i+e,t),n.delete(i)}},su=function(r){return r[r.length-1]},Oi,ou="or",Ym="and",DS="and_not",Jm=function(){function r(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var t=e.autoVacuum==null||e.autoVacuum===!0?ru:e.autoVacuum;this._options=Le(Le(Le({},tu),e),{autoVacuum:t,searchOptions:Le(Le({},Um),e.searchOptions||{}),autoSuggestOptions:Le(Le({},BS),e.autoSuggestOptions||{})}),this._index=new Zc,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=iu,this.addFields(this._options.fields)}return r.prototype.add=function(e){var t,a,n,i,s,o,l=this._options,c=l.extractField,u=l.tokenize,p=l.processTerm,m=l.fields,d=l.idField,g=c(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));if(this._idToShortId.has(g))throw new Error("MiniSearch: duplicate ID ".concat(g));var f=this.addDocumentId(g);this.saveStoredFields(f,e);try{for(var y=he(m),b=y.next();!b.done;b=y.next()){var x=b.value,S=c(e,x);if(S!=null){var A=u(S.toString(),x),R=this._fieldIds[x],k=new Set(A).size;this.addFieldLength(f,R,this._documentCount-1,k);try{for(var O=(n=void 0,he(A)),B=O.next();!B.done;B=O.next()){var P=B.value,G=p(P,x);if(Array.isArray(G))try{for(var U=(s=void 0,he(G)),M=U.next();!M.done;M=U.next()){var T=M.value;this.addTerm(R,f,T)}}catch(I){s={error:I}}finally{try{M&&!M.done&&(o=U.return)&&o.call(U)}finally{if(s)throw s.error}}else G&&this.addTerm(R,f,G)}}catch(I){n={error:I}}finally{try{B&&!B.done&&(i=O.return)&&i.call(O)}finally{if(n)throw n.error}}}}}catch(I){t={error:I}}finally{try{b&&!b.done&&(a=y.return)&&a.call(y)}finally{if(t)throw t.error}}},r.prototype.addAll=function(e){var t,a;try{for(var n=he(e),i=n.next();!i.done;i=n.next()){var s=i.value;this.add(s)}}catch(o){t={error:o}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},r.prototype.addAllAsync=function(e,t){var a=this;t===void 0&&(t={});var n=t.chunkSize,i=n===void 0?10:n,s={chunk:[],promise:Promise.resolve()},o=e.reduce(function(u,p,m){var d=u.chunk,g=u.promise;return d.push(p),(m+1)%i===0?{chunk:[],promise:g.then(function(){return new Promise(function(f){return setTimeout(f,0)})}).then(function(){return a.addAll(d)})}:{chunk:d,promise:g}},s),l=o.chunk,c=o.promise;return c.then(function(){return a.addAll(l)})},r.prototype.remove=function(e){var t,a,n,i,s,o,l=this._options,c=l.tokenize,u=l.processTerm,p=l.extractField,m=l.fields,d=l.idField,g=p(e,d);if(g==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));var f=this._idToShortId.get(g);if(f==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(g,": it is not in the index"));try{for(var y=he(m),b=y.next();!b.done;b=y.next()){var x=b.value,S=p(e,x);if(S!=null){var A=c(S.toString(),x),R=this._fieldIds[x],k=new Set(A).size;this.removeFieldLength(f,R,this._documentCount,k);try{for(var O=(n=void 0,he(A)),B=O.next();!B.done;B=O.next()){var P=B.value,G=u(P,x);if(Array.isArray(G))try{for(var U=(s=void 0,he(G)),M=U.next();!M.done;M=U.next()){var T=M.value;this.removeTerm(R,f,T)}}catch(I){s={error:I}}finally{try{M&&!M.done&&(o=U.return)&&o.call(U)}finally{if(s)throw s.error}}else G&&this.removeTerm(R,f,G)}}catch(I){n={error:I}}finally{try{B&&!B.done&&(i=O.return)&&i.call(O)}finally{if(n)throw n.error}}}}}catch(I){t={error:I}}finally{try{b&&!b.done&&(a=y.return)&&a.call(y)}finally{if(t)throw t.error}}this._storedFields.delete(f),this._documentIds.delete(f),this._idToShortId.delete(g),this._fieldLength.delete(f),this._documentCount-=1},r.prototype.removeAll=function(e){var t,a;if(e)try{for(var n=he(e),i=n.next();!i.done;i=n.next()){var s=i.value;this.remove(s)}}catch(o){t={error:o}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Zc,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},r.prototype.discard=function(e){var t=this,a=this._idToShortId.get(e);if(a==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(a),this._storedFields.delete(a),(this._fieldLength.get(a)||[]).forEach(function(n,i){t.removeFieldLength(a,i,t._documentCount,n)}),this._fieldLength.delete(a),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},r.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,t=e.minDirtFactor,a=e.minDirtCount,n=e.batchSize,i=e.batchWait;this.conditionalVacuum({batchSize:n,batchWait:i},{minDirtCount:a,minDirtFactor:t})}},r.prototype.discardAll=function(e){var t,a,n=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var i=he(e),s=i.next();!s.done;s=i.next()){var o=s.value;this.discard(o)}}catch(l){t={error:l}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()},r.prototype.replace=function(e){var t=this._options,a=t.idField,n=t.extractField,i=n(e,a);this.discard(i),this.add(e)},r.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},r.prototype.conditionalVacuum=function(e,t){var a=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var n=a._enqueuedVacuumConditions;return a._enqueuedVacuumConditions=iu,a.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},r.prototype.performVacuuming=function(e,t){return TS(this,void 0,void 0,function(){var a,n,i,s,o,l,c,u,p,m,d,g,f,y,b,x,S,A,R,k,O,B,P,G,U;return AS(this,function(M){switch(M.label){case 0:if(a=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];n=e.batchSize||au.batchSize,i=e.batchWait||au.batchWait,s=1,M.label=1;case 1:M.trys.push([1,7,8,9]),o=he(this._index),l=o.next(),M.label=2;case 2:if(l.done)return[3,6];c=qe(l.value,2),u=c[0],p=c[1];try{for(m=(B=void 0,he(p)),d=m.next();!d.done;d=m.next()){g=qe(d.value,2),f=g[0],y=g[1];try{for(b=(G=void 0,he(y)),x=b.next();!x.done;x=b.next())S=qe(x.value,1),A=S[0],!this._documentIds.has(A)&&(y.size<=1?p.delete(f):y.delete(A))}catch(T){G={error:T}}finally{try{x&&!x.done&&(U=b.return)&&U.call(b)}finally{if(G)throw G.error}}}}catch(T){B={error:T}}finally{try{d&&!d.done&&(P=m.return)&&P.call(m)}finally{if(B)throw B.error}}return this._index.get(u).size===0&&this._index.delete(u),s%n!==0?[3,4]:[4,new Promise(function(T){return setTimeout(T,i)})];case 3:M.sent(),M.label=4;case 4:s+=1,M.label=5;case 5:return l=o.next(),[3,2];case 6:return[3,9];case 7:return R=M.sent(),k={error:R},[3,9];case 8:try{l&&!l.done&&(O=o.return)&&O.call(o)}finally{if(k)throw k.error}return[7];case 9:this._dirtCount-=a,M.label=10;case 10:return[4,null];case 11:return M.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},r.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var t=e.minDirtCount,a=e.minDirtFactor;return t=t||ru.minDirtCount,a=a||ru.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=a},Object.defineProperty(r.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),r.prototype.has=function(e){return this._idToShortId.has(e)},r.prototype.getStoredFields=function(e){var t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)},r.prototype.search=function(e,t){var a,n;t===void 0&&(t={});var i=this.executeQuery(e,t),s=[];try{for(var o=he(i),l=o.next();!l.done;l=o.next()){var c=qe(l.value,2),u=c[0],p=c[1],m=p.score,d=p.terms,g=p.match,f=d.length||1,y={id:this._documentIds.get(u),score:m*f,terms:Object.keys(g),queryTerms:d,match:g};Object.assign(y,this._storedFields.get(u)),(t.filter==null||t.filter(y))&&s.push(y)}}catch(b){a={error:b}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return e===r.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||s.sort(Vm),s},r.prototype.autoSuggest=function(e,t){var a,n,i,s;t===void 0&&(t={}),t=Le(Le({},this._options.autoSuggestOptions),t);var o=new Map;try{for(var l=he(this.search(e,t)),c=l.next();!c.done;c=l.next()){var u=c.value,p=u.score,m=u.terms,d=m.join(" "),g=o.get(d);g!=null?(g.score+=p,g.count+=1):o.set(d,{score:p,terms:m,count:1})}}catch(R){a={error:R}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(a)throw a.error}}var f=[];try{for(var y=he(o),b=y.next();!b.done;b=y.next()){var x=qe(b.value,2),g=x[0],S=x[1],p=S.score,m=S.terms,A=S.count;f.push({suggestion:g,terms:m,score:p/A})}}catch(R){i={error:R}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(i)throw i.error}}return f.sort(Vm),f},Object.defineProperty(r.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),r.loadJSON=function(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),t)},r.getDefault=function(e){if(tu.hasOwnProperty(e))return eu(tu,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},r.loadJS=function(e,t){var a,n,i,s,o,l,c=e.index,u=e.documentCount,p=e.nextId,m=e.documentIds,d=e.fieldIds,g=e.fieldLength,f=e.averageFieldLength,y=e.storedFields,b=e.dirtCount,x=e.serializationVersion;if(x!==1&&x!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var S=new r(t);S._documentCount=u,S._nextId=p,S._documentIds=co(m),S._idToShortId=new Map,S._fieldIds=d,S._fieldLength=co(g),S._avgFieldLength=f,S._storedFields=co(y),S._dirtCount=b||0,S._index=new Zc;try{for(var A=he(S._documentIds),R=A.next();!R.done;R=A.next()){var k=qe(R.value,2),O=k[0],B=k[1];S._idToShortId.set(B,O)}}catch(Z){a={error:Z}}finally{try{R&&!R.done&&(n=A.return)&&n.call(A)}finally{if(a)throw a.error}}try{for(var P=he(c),G=P.next();!G.done;G=P.next()){var U=qe(G.value,2),M=U[0],T=U[1],I=new Map;try{for(var F=(o=void 0,he(Object.keys(T))),Y=F.next();!Y.done;Y=F.next()){var K=Y.value,ee=T[K];x===1&&(ee=ee.ds),I.set(parseInt(K,10),co(ee))}}catch(Z){o={error:Z}}finally{try{Y&&!Y.done&&(l=F.return)&&l.call(F)}finally{if(o)throw o.error}}S._index.set(M,I)}}catch(Z){i={error:Z}}finally{try{G&&!G.done&&(s=P.return)&&s.call(P)}finally{if(i)throw i.error}}return S},r.prototype.executeQuery=function(e,t){var a=this;if(t===void 0&&(t={}),e===r.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){var n=Le(Le(Le({},t),e),{queries:void 0}),i=e.queries.map(function(y){return a.executeQuery(y,n)});return this.combineResults(i,n.combineWith)}var s=this._options,o=s.tokenize,l=s.processTerm,c=s.searchOptions,u=Le(Le({tokenize:o,processTerm:l},c),t),p=u.tokenize,m=u.processTerm,d=p(e).flatMap(function(y){return m(y)}).filter(function(y){return!!y}),g=d.map(LS(u)),f=g.map(function(y){return a.executeQuerySpec(y,u)});return this.combineResults(f,u.combineWith)},r.prototype.executeQuerySpec=function(e,t){var a,n,i,s,o=Le(Le({},this._options.searchOptions),t),l=(o.fields||this._options.fields).reduce(function(K,ee){var Z;return Le(Le({},K),(Z={},Z[ee]=eu(o.boost,ee)||1,Z))},{}),c=o.boostDocument,u=o.weights,p=o.maxFuzzy,m=o.bm25,d=Le(Le({},Um.weights),u),g=d.fuzzy,f=d.prefix,y=this._index.get(e.term),b=this.termResults(e.term,e.term,1,y,l,c,m),x,S;if(e.prefix&&(x=this._index.atPrefix(e.term)),e.fuzzy){var A=e.fuzzy===!0?.2:e.fuzzy,R=A<1?Math.min(p,Math.round(e.term.length*A)):A;R&&(S=this._index.fuzzyGet(e.term,R))}if(x)try{for(var k=he(x),O=k.next();!O.done;O=k.next()){var B=qe(O.value,2),P=B[0],G=B[1],U=P.length-e.term.length;if(U){S?.delete(P);var M=f*P.length/(P.length+.3*U);this.termResults(e.term,P,M,G,l,c,m,b)}}}catch(K){a={error:K}}finally{try{O&&!O.done&&(n=k.return)&&n.call(k)}finally{if(a)throw a.error}}if(S)try{for(var T=he(S.keys()),I=T.next();!I.done;I=T.next()){var P=I.value,F=qe(S.get(P),2),Y=F[0],U=F[1];if(U){var M=g*P.length/(P.length+U);this.termResults(e.term,P,M,Y,l,c,m,b)}}}catch(K){i={error:K}}finally{try{I&&!I.done&&(s=T.return)&&s.call(T)}finally{if(i)throw i.error}}return b},r.prototype.executeWildcardQuery=function(e){var t,a,n=new Map,i=Le(Le({},this._options.searchOptions),e);try{for(var s=he(this._documentIds),o=s.next();!o.done;o=s.next()){var l=qe(o.value,2),c=l[0],u=l[1],p=i.boostDocument?i.boostDocument(u,"",this._storedFields.get(c)):1;n.set(c,{score:p,terms:[],match:{}})}}catch(m){t={error:m}}finally{try{o&&!o.done&&(a=s.return)&&a.call(s)}finally{if(t)throw t.error}}return n},r.prototype.combineResults=function(e,t){if(t===void 0&&(t=ou),e.length===0)return new Map;var a=t.toLowerCase();return e.reduce(NS[a])||new Map},r.prototype.toJSON=function(){var e,t,a,n,i=[];try{for(var s=he(this._index),o=s.next();!o.done;o=s.next()){var l=qe(o.value,2),c=l[0],u=l[1],p={};try{for(var m=(a=void 0,he(u)),d=m.next();!d.done;d=m.next()){var g=qe(d.value,2),f=g[0],y=g[1];p[f]=Object.fromEntries(y)}}catch(b){a={error:b}}finally{try{d&&!d.done&&(n=m.return)&&n.call(m)}finally{if(a)throw a.error}}i.push([c,p])}}catch(b){e={error:b}}finally{try{o&&!o.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:i,serializationVersion:2}},r.prototype.termResults=function(e,t,a,n,i,s,o,l){var c,u,p,m,d;if(l===void 0&&(l=new Map),n==null)return l;try{for(var g=he(Object.keys(i)),f=g.next();!f.done;f=g.next()){var y=f.value,b=i[y],x=this._fieldIds[y],S=n.get(x);if(S!=null){var A=S.size,R=this._avgFieldLength[x];try{for(var k=(p=void 0,he(S.keys())),O=k.next();!O.done;O=k.next()){var B=O.value;if(!this._documentIds.has(B)){this.removeTerm(x,B,t),A-=1;continue}var P=s?s(this._documentIds.get(B),t,this._storedFields.get(B)):1;if(P){var G=S.get(B),U=this._fieldLength.get(B)[x],M=OS(G,A,this._documentCount,U,R,o),T=a*b*P*M,I=l.get(B);if(I){I.score+=T,FS(I.terms,e);var F=eu(I.match,t);F?F.push(y):I.match[t]=[y]}else l.set(B,{score:T,terms:[e],match:(d={},d[t]=[y],d)})}}}catch(Y){p={error:Y}}finally{try{O&&!O.done&&(m=k.return)&&m.call(k)}finally{if(p)throw p.error}}}}}catch(Y){c={error:Y}}finally{try{f&&!f.done&&(u=g.return)&&u.call(g)}finally{if(c)throw c.error}}return l},r.prototype.addTerm=function(e,t,a){var n=this._index.fetch(a,jm),i=n.get(e);if(i==null)i=new Map,i.set(t,1),n.set(e,i);else{var s=i.get(t);i.set(t,(s||0)+1)}},r.prototype.removeTerm=function(e,t,a){if(!this._index.has(a)){this.warnDocumentChanged(t,e,a);return}var n=this._index.fetch(a,jm),i=n.get(e);i==null||i.get(t)==null?this.warnDocumentChanged(t,e,a):i.get(t)<=1?i.size<=1?n.delete(e):i.delete(t):i.set(t,i.get(t)-1),this._index.get(a).size===0&&this._index.delete(a)},r.prototype.warnDocumentChanged=function(e,t,a){var n,i;try{for(var s=he(Object.keys(this._fieldIds)),o=s.next();!o.done;o=s.next()){var l=o.value;if(this._fieldIds[l]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(a,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){n={error:c}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},r.prototype.addDocumentId=function(e){var t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t},r.prototype.addFields=function(e){for(var t=0;t<e.length;t++)this._fieldIds[e[t]]=t},r.prototype.addFieldLength=function(e,t,a,n){var i=this._fieldLength.get(e);i==null&&this._fieldLength.set(e,i=[]),i[t]=n;var s=this._avgFieldLength[t]||0,o=s*a+n;this._avgFieldLength[t]=o/(a+1)},r.prototype.removeFieldLength=function(e,t,a,n){if(a===1){this._avgFieldLength[t]=0;return}var i=this._avgFieldLength[t]*a-n;this._avgFieldLength[t]=i/(a-1)},r.prototype.saveStoredFields=function(e,t){var a,n,i=this._options,s=i.storeFields,o=i.extractField;if(!(s==null||s.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var c=he(s),u=c.next();!u.done;u=c.next()){var p=u.value,m=o(t,p);m!==void 0&&(l[p]=m)}}catch(d){a={error:d}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(a)throw a.error}}}},r.wildcard=Symbol("*"),r}(),eu=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)?r[e]:void 0},NS=(Oi={},Oi[ou]=function(r,e){var t,a;try{for(var n=he(e.keys()),i=n.next();!i.done;i=n.next()){var s=i.value,o=r.get(s);if(o==null)r.set(s,e.get(s));else{var l=e.get(s),c=l.score,u=l.terms,p=l.match;o.score=o.score+c,o.match=Object.assign(o.match,p),Hm(o.terms,u)}}}catch(m){t={error:m}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}return r},Oi[Ym]=function(r,e){var t,a,n=new Map;try{for(var i=he(e.keys()),s=i.next();!s.done;s=i.next()){var o=s.value,l=r.get(o);if(l!=null){var c=e.get(o),u=c.score,p=c.terms,m=c.match;Hm(l.terms,p),n.set(o,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(d){t={error:d}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(t)throw t.error}}return n},Oi[DS]=function(r,e){var t,a;try{for(var n=he(e.keys()),i=n.next();!i.done;i=n.next()){var s=i.value;r.delete(s)}}catch(o){t={error:o}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}return r},Oi),MS={k:1.2,b:.7,d:.5},OS=function(r,e,t,a,n,i){var s=i.k,o=i.b,l=i.d,c=Math.log(1+(t-e+.5)/(e+.5));return c*(l+r*(s+1)/(r+s*(1-o+o*a/n)))},LS=function(r){return function(e,t,a){var n=typeof r.fuzzy=="function"?r.fuzzy(e,t,a):r.fuzzy||!1,i=typeof r.prefix=="function"?r.prefix(e,t,a):r.prefix===!0;return{term:e,fuzzy:n,prefix:i}}},tu={idField:"id",extractField:function(r,e){return r[e]},tokenize:function(r){return r.split(GS)},processTerm:function(r){return r.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(r,e){typeof console?.[r]=="function"&&console[r](e)},autoVacuum:!0},Um={combineWith:ou,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:MS},BS={combineWith:Ym,prefix:function(r,e,t){return e===t.length-1}},au={batchSize:1e3,batchWait:10},iu={minDirtFactor:.1,minDirtCount:20},ru=Le(Le({},au),iu),FS=function(r,e){r.includes(e)||r.push(e)},Hm=function(r,e){var t,a;try{for(var n=he(e),i=n.next();!i.done;i=n.next()){var s=i.value;r.includes(s)||r.push(s)}}catch(o){t={error:o}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(t)throw t.error}}},Vm=function(r,e){var t=r.score,a=e.score;return a-t},jm=function(){return new Map},co=function(r){var e,t,a=new Map;try{for(var n=he(Object.keys(r)),i=n.next();!i.done;i=n.next()){var s=i.value;a.set(parseInt(s,10),r[s])}}catch(o){e={error:o}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return a},GS=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var Zm=[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(r,e)=>{let t=await e.knowledgeBase.search(r.query),a=e;a._lastKBsearch=r.query,a._nextRequestUseKBitems=t,e.submitAnalyticsEvent({type:"kb-search",query:r.query,results:t});let n=t.filter(s=>s.type!="action").map(s=>"id="+s.id).join(", ")||"(none)",i=t.filter(s=>s.type=="action").map(s=>"name="+s._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${n}. New tools available: ${i}.`}}];var h={};mc(h,{BRAND:()=>dE,DIRTY:()=>In,EMPTY_PATH:()=>VS,INVALID:()=>ne,NEVER:()=>XE,OK:()=>ft,ParseStatus:()=>pt,Schema:()=>me,ZodAny:()=>sn,ZodArray:()=>Ur,ZodBigInt:()=>Pn,ZodBoolean:()=>Dn,ZodBranded:()=>Bi,ZodCatch:()=>Vn,ZodDate:()=>Nn,ZodDefault:()=>Hn,ZodDiscriminatedUnion:()=>ho,ZodEffects:()=>er,ZodEnum:()=>zn,ZodError:()=>At,ZodFirstPartyTypeKind:()=>ie,ZodFunction:()=>fo,ZodIntersection:()=>Bn,ZodIssueCode:()=>H,ZodLazy:()=>Fn,ZodLiteral:()=>Gn,ZodMap:()=>Va,ZodNaN:()=>Wa,ZodNativeEnum:()=>Un,ZodNever:()=>lr,ZodNull:()=>On,ZodNullable:()=>_r,ZodNumber:()=>Rn,ZodObject:()=>It,ZodOptional:()=>Zt,ZodParsedType:()=>q,ZodPipeline:()=>Fi,ZodPromise:()=>on,ZodReadonly:()=>jn,ZodRecord:()=>go,ZodSchema:()=>me,ZodSet:()=>ja,ZodString:()=>an,ZodSymbol:()=>Ua,ZodTransformer:()=>er,ZodTuple:()=>vr,ZodType:()=>me,ZodUndefined:()=>Mn,ZodUnion:()=>Ln,ZodUnknown:()=>zr,ZodVoid:()=>Ha,addIssueToContext:()=>W,any:()=>_E,array:()=>kE,bigint:()=>gE,boolean:()=>ch,coerce:()=>KE,custom:()=>sh,date:()=>fE,datetimeRegex:()=>ah,defaultErrorMap:()=>Fr,discriminatedUnion:()=>AE,effect:()=>zE,enum:()=>BE,function:()=>ME,getErrorMap:()=>Fa,getParsedType:()=>br,instanceof:()=>mE,intersection:()=>IE,isAborted:()=>po,isAsync:()=>Ga,isDirty:()=>mo,isValid:()=>nn,late:()=>pE,lazy:()=>OE,literal:()=>LE,makeIssue:()=>Li,map:()=>DE,nan:()=>hE,nativeEnum:()=>FE,never:()=>EE,null:()=>vE,nullable:()=>HE,number:()=>lh,object:()=>CE,objectUtil:()=>lu,oboolean:()=>$E,onumber:()=>qE,optional:()=>UE,ostring:()=>WE,pipeline:()=>jE,preprocess:()=>VE,promise:()=>GE,quotelessJson:()=>zS,record:()=>PE,set:()=>NE,setErrorMap:()=>HS,strictObject:()=>xE,string:()=>oh,symbol:()=>yE,transformer:()=>zE,tuple:()=>RE,undefined:()=>bE,union:()=>TE,unknown:()=>SE,util:()=>fe,void:()=>wE});var fe;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let i={};for(let s of n)i[s]=s;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),s={};for(let o of i)s[o]=n[o];return r.objectValues(s)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(s);return i},r.find=(n,i)=>{for(let s of n)if(i(s))return s},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function a(n,i=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}r.joinValues=a,r.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(fe||(fe={}));var lu;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(lu||(lu={}));var q=fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),br=r=>{switch(typeof r){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(r)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(r)?q.array:r===null?q.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?q.promise:typeof Map<"u"&&r instanceof Map?q.map:typeof Set<"u"&&r instanceof Set?q.set:typeof Date<"u"&&r instanceof Date?q.date:q.object;default:return q.unknown}};var H=fe.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"]),zS=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),At=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},a={_errors:[]},n=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)a._errors.push(t(s));else{let o=a,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(s))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return n(this),a}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},a=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};At.create=r=>new At(r);var US=(r,e)=>{let t;switch(r.code){case H.invalid_type:r.received===q.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case H.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,fe.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:t=`Unrecognized key(s) in object: ${fe.joinValues(r.keys,", ")}`;break;case H.invalid_union:t="Invalid input";break;case H.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${fe.joinValues(r.options)}`;break;case H.invalid_enum_value:t=`Invalid enum value. Expected ${fe.joinValues(r.options)}, received '${r.received}'`;break;case H.invalid_arguments:t="Invalid function arguments";break;case H.invalid_return_type:t="Invalid function return type";break;case H.invalid_date:t="Invalid date";break;case H.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:fe.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case H.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case H.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case H.custom:t="Invalid input";break;case H.invalid_intersection_types:t="Intersection results could not be merged";break;case H.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case H.not_finite:t="Number must be finite";break;default:t=e.defaultError,fe.assertNever(r)}return{message:t}},Fr=US;var Qm=Fr;function HS(r){Qm=r}function Fa(){return Qm}var Li=r=>{let{data:e,path:t,errorMaps:a,issueData:n}=r,i=[...t,...n.path||[]],s={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let o="",l=a.filter(c=>!!c).slice().reverse();for(let c of l)o=c(s,{data:e,defaultError:o}).message;return{...n,path:i,message:o}},VS=[];function W(r,e){let t=Fa(),a=Li({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Fr?void 0:Fr].filter(n=>!!n)});r.common.issues.push(a)}var pt=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let a=[];for(let n of t){if(n.status==="aborted")return ne;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){let a=[];for(let n of t){let i=await n.key,s=await n.value;a.push({key:i,value:s})}return r.mergeObjectSync(e,a)}static mergeObjectSync(e,t){let a={};for(let n of t){let{key:i,value:s}=n;if(i.status==="aborted"||s.status==="aborted")return ne;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(a[i.value]=s.value)}return{status:e.value,value:a}}},ne=Object.freeze({status:"aborted"}),In=r=>({status:"dirty",value:r}),ft=r=>({status:"valid",value:r}),po=r=>r.status==="aborted",mo=r=>r.status==="dirty",nn=r=>r.status==="valid",Ga=r=>typeof Promise<"u"&&r instanceof Promise;var J;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(J||(J={}));var Qt=class{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}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}},eh=(r,e)=>{if(nn(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new At(r.common.issues);return this._error=t,this._error}}};function ue(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:a,description:n}=r;if(e&&(t||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(s,o)=>{let{message:l}=r;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??a??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:n}}var me=class{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 pt,ctx:{common:e.parent.common,data:e.data,parsedType:br(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ga(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){let a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:br(e)},n=this._parseSync({data:e,path:a.path,parent:a});return eh(a,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:br(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:t});return nn(a)?{value:a.value}:{issues:t.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>nn(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){let a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){let a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:br(e)},n=this._parse({data:e,path:a.path,parent:a}),i=await(Ga(n)?n:Promise.resolve(n));return eh(a,i)}refine(e,t){let a=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,i)=>{let s=e(n),o=()=>i.addIssue({code:H.custom,...a(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,t){return this._refinement((a,n)=>e(a)?!0:(n.addIssue(typeof t=="function"?t(a,n):t),!1))}_refinement(e){return new er({schema:this,typeName:ie.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:t=>this["~validate"](t)}}optional(){return Zt.create(this,this._def)}nullable(){return _r.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ur.create(this)}promise(){return on.create(this,this._def)}or(e){return Ln.create([this,e],this._def)}and(e){return Bn.create(this,e,this._def)}transform(e){return new er({...ue(this._def),schema:this,typeName:ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Hn({...ue(this._def),innerType:this,defaultValue:t,typeName:ie.ZodDefault})}brand(){return new Bi({typeName:ie.ZodBranded,type:this,...ue(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Vn({...ue(this._def),innerType:this,catchValue:t,typeName:ie.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Fi.create(this,e)}readonly(){return jn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},jS=/^c[^\s-]{8,}$/i,WS=/^[0-9a-z]+$/,qS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$S=/^[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,KS=/^[a-z0-9_-]{21}$/i,XS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,YS=/^[-+]?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)?)??$/,JS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ZS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",cu,QS=/^(?:(?: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])$/,eE=/^(?:(?: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])$/,tE=/^(([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]))$/,rE=/^(([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])$/,nE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,aE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,rh="((\\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])))",iE=new RegExp(`^${rh}$`);function nh(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function sE(r){return new RegExp(`^${nh(r)}$`)}function ah(r){let e=`${rh}T${nh(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function oE(r,e){return!!((e==="v4"||!e)&&QS.test(r)||(e==="v6"||!e)&&tE.test(r))}function lE(r,e){if(!XS.test(r))return!1;try{let[t]=r.split("."),a=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function cE(r,e){return!!((e==="v4"||!e)&&eE.test(r)||(e==="v6"||!e)&&rE.test(r))}var an=class r extends me{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let i=this._getOrReturnCtx(e);return W(i,{code:H.invalid_type,expected:q.string,received:i.parsedType}),ne}let a=new pt,n;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:H.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="max")e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:H.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(n=this._getOrReturnCtx(e,n),s?W(n,{code:H.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&W(n,{code:H.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),a.dirty())}else if(i.kind==="email")JS.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"email",code:H.invalid_string,message:i.message}),a.dirty());else if(i.kind==="emoji")cu||(cu=new RegExp(ZS,"u")),cu.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"emoji",code:H.invalid_string,message:i.message}),a.dirty());else if(i.kind==="uuid")$S.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"uuid",code:H.invalid_string,message:i.message}),a.dirty());else if(i.kind==="nanoid")KS.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"nanoid",code:H.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid")jS.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cuid",code:H.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid2")WS.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cuid2",code:H.invalid_string,message:i.message}),a.dirty());else if(i.kind==="ulid")qS.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"ulid",code:H.invalid_string,message:i.message}),a.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),W(n,{validation:"url",code:H.invalid_string,message:i.message}),a.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"regex",code:H.invalid_string,message:i.message}),a.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),W(n,{code:H.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),a.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:H.invalid_string,validation:{startsWith:i.value},message:i.message}),a.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:H.invalid_string,validation:{endsWith:i.value},message:i.message}),a.dirty()):i.kind==="datetime"?ah(i).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:H.invalid_string,validation:"datetime",message:i.message}),a.dirty()):i.kind==="date"?iE.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:H.invalid_string,validation:"date",message:i.message}),a.dirty()):i.kind==="time"?sE(i).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:H.invalid_string,validation:"time",message:i.message}),a.dirty()):i.kind==="duration"?YS.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"duration",code:H.invalid_string,message:i.message}),a.dirty()):i.kind==="ip"?oE(e.data,i.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"ip",code:H.invalid_string,message:i.message}),a.dirty()):i.kind==="jwt"?lE(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"jwt",code:H.invalid_string,message:i.message}),a.dirty()):i.kind==="cidr"?cE(e.data,i.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"cidr",code:H.invalid_string,message:i.message}),a.dirty()):i.kind==="base64"?nE.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"base64",code:H.invalid_string,message:i.message}),a.dirty()):i.kind==="base64url"?aE.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:"base64url",code:H.invalid_string,message:i.message}),a.dirty()):fe.assertNever(i);return{status:a.value,value:e.data}}_regex(e,t,a){return this.refinement(n=>e.test(n),{validation:t,code:H.invalid_string,...J.errToObj(a)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...J.errToObj(e)})}url(e){return this._addCheck({kind:"url",...J.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...J.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...J.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...J.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...J.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...J.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...J.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...J.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...J.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...J.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...J.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...J.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...J.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...J.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...J.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...J.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...J.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...J.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...J.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...J.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...J.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...J.errToObj(t)})}nonempty(e){return this.min(1,J.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};an.create=r=>new an({checks:[],typeName:ie.ZodString,coerce:r?.coerce??!1,...ue(r)});function uE(r,e){let t=(r.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=t>a?t:a,i=Number.parseInt(r.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return i%s/10**n}var Rn=class r extends me{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)!==q.number){let i=this._getOrReturnCtx(e);return W(i,{code:H.invalid_type,expected:q.number,received:i.parsedType}),ne}let a,n=new pt;for(let i of this._def.checks)i.kind==="int"?fe.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),W(a,{code:H.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:H.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:H.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?uE(e.data,i.value)!==0&&(a=this._getOrReturnCtx(e,a),W(a,{code:H.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),W(a,{code:H.not_finite,message:i.message}),n.dirty()):fe.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:J.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:J.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:J.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&fe.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(t===null||a.value>t)&&(t=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Rn.create=r=>new Rn({checks:[],typeName:ie.ZodNumber,coerce:r?.coerce||!1,...ue(r)});var Pn=class r extends me{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)!==q.bigint)return this._getInvalidInput(e);let a,n=new pt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:H.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(a=this._getOrReturnCtx(e,a),W(a,{code:H.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),W(a,{code:H.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):fe.assertNever(i);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return W(t,{code:H.invalid_type,expected:q.bigint,received:t.parsedType}),ne}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,a,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:J.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Pn.create=r=>new Pn({checks:[],typeName:ie.ZodBigInt,coerce:r?.coerce??!1,...ue(r)});var Dn=class extends me{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let a=this._getOrReturnCtx(e);return W(a,{code:H.invalid_type,expected:q.boolean,received:a.parsedType}),ne}return ft(e.data)}};Dn.create=r=>new Dn({typeName:ie.ZodBoolean,coerce:r?.coerce||!1,...ue(r)});var Nn=class r extends me{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let i=this._getOrReturnCtx(e);return W(i,{code:H.invalid_type,expected:q.date,received:i.parsedType}),ne}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return W(i,{code:H.invalid_date}),ne}let a=new pt,n;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:H.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:H.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):fe.assertNever(i);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:J.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:J.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Nn.create=r=>new Nn({checks:[],coerce:r?.coerce||!1,typeName:ie.ZodDate,...ue(r)});var Ua=class extends me{_parse(e){if(this._getType(e)!==q.symbol){let a=this._getOrReturnCtx(e);return W(a,{code:H.invalid_type,expected:q.symbol,received:a.parsedType}),ne}return ft(e.data)}};Ua.create=r=>new Ua({typeName:ie.ZodSymbol,...ue(r)});var Mn=class extends me{_parse(e){if(this._getType(e)!==q.undefined){let a=this._getOrReturnCtx(e);return W(a,{code:H.invalid_type,expected:q.undefined,received:a.parsedType}),ne}return ft(e.data)}};Mn.create=r=>new Mn({typeName:ie.ZodUndefined,...ue(r)});var On=class extends me{_parse(e){if(this._getType(e)!==q.null){let a=this._getOrReturnCtx(e);return W(a,{code:H.invalid_type,expected:q.null,received:a.parsedType}),ne}return ft(e.data)}};On.create=r=>new On({typeName:ie.ZodNull,...ue(r)});var sn=class extends me{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}};sn.create=r=>new sn({typeName:ie.ZodAny,...ue(r)});var zr=class extends me{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}};zr.create=r=>new zr({typeName:ie.ZodUnknown,...ue(r)});var lr=class extends me{_parse(e){let t=this._getOrReturnCtx(e);return W(t,{code:H.invalid_type,expected:q.never,received:t.parsedType}),ne}};lr.create=r=>new lr({typeName:ie.ZodNever,...ue(r)});var Ha=class extends me{_parse(e){if(this._getType(e)!==q.undefined){let a=this._getOrReturnCtx(e);return W(a,{code:H.invalid_type,expected:q.void,received:a.parsedType}),ne}return ft(e.data)}};Ha.create=r=>new Ha({typeName:ie.ZodVoid,...ue(r)});var Ur=class r extends me{_parse(e){let{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==q.array)return W(t,{code:H.invalid_type,expected:q.array,received:t.parsedType}),ne;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(s||o)&&(W(t,{code:s?H.too_big:H.too_small,minimum:o?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(W(t,{code:H.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(W(t,{code:H.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((s,o)=>n.type._parseAsync(new Qt(t,s,t.path,o)))).then(s=>pt.mergeArray(a,s));let i=[...t.data].map((s,o)=>n.type._parseSync(new Qt(t,s,t.path,o)));return pt.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:J.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:J.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:J.toString(t)}})}nonempty(e){return this.min(1,e)}};Ur.create=(r,e)=>new Ur({type:r,minLength:null,maxLength:null,exactLength:null,typeName:ie.ZodArray,...ue(e)});function za(r){if(r instanceof It){let e={};for(let t in r.shape){let a=r.shape[t];e[t]=Zt.create(za(a))}return new It({...r._def,shape:()=>e})}else return r instanceof Ur?new Ur({...r._def,type:za(r.element)}):r instanceof Zt?Zt.create(za(r.unwrap())):r instanceof _r?_r.create(za(r.unwrap())):r instanceof vr?vr.create(r.items.map(e=>za(e))):r}var It=class r extends me{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=fe.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==q.object){let c=this._getOrReturnCtx(e);return W(c,{code:H.invalid_type,expected:q.object,received:c.parsedType}),ne}let{status:a,ctx:n}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof lr&&this._def.unknownKeys==="strip"))for(let c in n.data)s.includes(c)||o.push(c);let l=[];for(let c of s){let u=i[c],p=n.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Qt(n,p,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof lr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")o.length>0&&(W(n,{code:H.unrecognized_keys,keys:o}),a.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of o){let p=n.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Qt(n,p,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let p=await u.key,m=await u.value;c.push({key:p,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>pt.mergeObjectSync(a,c)):pt.mergeObjectSync(a,l)}get shape(){return this._def.shape()}strict(e){return J.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,a)=>{let n=this._def.errorMap?.(t,a).message??a.defaultError;return t.code==="unrecognized_keys"?{message:J.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ie.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let a of fe.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let a of fe.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new r({...this._def,shape:()=>t})}deepPartial(){return za(this)}partial(e){let t={};for(let a of fe.objectKeys(this.shape)){let n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let a of fe.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let i=this.shape[a];for(;i instanceof Zt;)i=i._def.innerType;t[a]=i}return new r({...this._def,shape:()=>t})}keyof(){return ih(fe.objectKeys(this.shape))}};It.create=(r,e)=>new It({shape:()=>r,unknownKeys:"strip",catchall:lr.create(),typeName:ie.ZodObject,...ue(e)});It.strictCreate=(r,e)=>new It({shape:()=>r,unknownKeys:"strict",catchall:lr.create(),typeName:ie.ZodObject,...ue(e)});It.lazycreate=(r,e)=>new It({shape:r,unknownKeys:"strip",catchall:lr.create(),typeName:ie.ZodObject,...ue(e)});var Ln=class extends me{_parse(e){let{ctx:t}=this._processInputParams(e),a=this._def.options;function n(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let s=i.map(o=>new At(o.ctx.common.issues));return W(t,{code:H.invalid_union,unionErrors:s}),ne}if(t.common.async)return Promise.all(a.map(async i=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let i,s=[];for(let l of a){let c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map(l=>new At(l));return W(t,{code:H.invalid_union,unionErrors:o}),ne}}get options(){return this._def.options}};Ln.create=(r,e)=>new Ln({options:r,typeName:ie.ZodUnion,...ue(e)});var Gr=r=>r instanceof Fn?Gr(r.schema):r instanceof er?Gr(r.innerType()):r instanceof Gn?[r.value]:r instanceof zn?r.options:r instanceof Un?fe.objectValues(r.enum):r instanceof Hn?Gr(r._def.innerType):r instanceof Mn?[void 0]:r instanceof On?[null]:r instanceof Zt?[void 0,...Gr(r.unwrap())]:r instanceof _r?[null,...Gr(r.unwrap())]:r instanceof Bi||r instanceof jn?Gr(r.unwrap()):r instanceof Vn?Gr(r._def.innerType):[],ho=class r extends me{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.object)return W(t,{code:H.invalid_type,expected:q.object,received:t.parsedType}),ne;let a=this.discriminator,n=t.data[a],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(W(t,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){let n=new Map;for(let i of t){let s=Gr(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of s){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,i)}}return new r({typeName:ie.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...ue(a)})}};function uu(r,e){let t=br(r),a=br(e);if(r===e)return{valid:!0,data:r};if(t===q.object&&a===q.object){let n=fe.objectKeys(e),i=fe.objectKeys(r).filter(o=>n.indexOf(o)!==-1),s={...r,...e};for(let o of i){let l=uu(r[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(t===q.array&&a===q.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<r.length;i++){let s=r[i],o=e[i],l=uu(s,o);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===q.date&&a===q.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Bn=class extends me{_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=(i,s)=>{if(po(i)||po(s))return ne;let o=uu(i.value,s.value);return o.valid?((mo(i)||mo(s))&&t.dirty(),{status:t.value,value:o.data}):(W(a,{code:H.invalid_intersection_types}),ne)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([i,s])=>n(i,s)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Bn.create=(r,e,t)=>new Bn({left:r,right:e,typeName:ie.ZodIntersection,...ue(t)});var vr=class r extends me{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==q.array)return W(a,{code:H.invalid_type,expected:q.array,received:a.parsedType}),ne;if(a.data.length<this._def.items.length)return W(a,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&a.data.length>this._def.items.length&&(W(a,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...a.data].map((s,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new Qt(a,s,a.path,o)):null}).filter(s=>!!s);return a.common.async?Promise.all(i).then(s=>pt.mergeArray(t,s)):pt.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};vr.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vr({items:r,typeName:ie.ZodTuple,rest:null,...ue(e)})};var go=class r extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==q.object)return W(a,{code:H.invalid_type,expected:q.object,received:a.parsedType}),ne;let n=[],i=this._def.keyType,s=this._def.valueType;for(let o in a.data)n.push({key:i._parse(new Qt(a,o,a.path,o)),value:s._parse(new Qt(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?pt.mergeObjectAsync(t,n):pt.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return t instanceof me?new r({keyType:e,valueType:t,typeName:ie.ZodRecord,...ue(a)}):new r({keyType:an.create(),valueType:e,typeName:ie.ZodRecord,...ue(t)})}},Va=class extends me{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==q.map)return W(a,{code:H.invalid_type,expected:q.map,received:a.parsedType}),ne;let n=this._def.keyType,i=this._def.valueType,s=[...a.data.entries()].map(([o,l],c)=>({key:n._parse(new Qt(a,o,a.path,[c,"key"])),value:i._parse(new Qt(a,l,a.path,[c,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(c.value,u.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let l of s){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ne;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),o.set(c.value,u.value)}return{status:t.value,value:o}}}};Va.create=(r,e,t)=>new Va({valueType:e,keyType:r,typeName:ie.ZodMap,...ue(t)});var ja=class r extends me{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==q.set)return W(a,{code:H.invalid_type,expected:q.set,received:a.parsedType}),ne;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(W(a,{code:H.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(W(a,{code:H.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let i=this._def.valueType;function s(l){let c=new Set;for(let u of l){if(u.status==="aborted")return ne;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}let o=[...a.data.values()].map((l,c)=>i._parse(new Qt(a,l,a.path,c)));return a.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:J.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:J.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ja.create=(r,e)=>new ja({valueType:r,minSize:null,maxSize:null,typeName:ie.ZodSet,...ue(e)});var fo=class r extends me{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.function)return W(t,{code:H.invalid_type,expected:q.function,received:t.parsedType}),ne;function a(o,l){return Li({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Fa(),Fr].filter(c=>!!c),issueData:{code:H.invalid_arguments,argumentsError:l}})}function n(o,l){return Li({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Fa(),Fr].filter(c=>!!c),issueData:{code:H.invalid_return_type,returnTypeError:l}})}let i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof on){let o=this;return ft(async function(...l){let c=new At([]),u=await o._def.args.parseAsync(l,i).catch(d=>{throw c.addIssue(a(l,d)),c}),p=await Reflect.apply(s,this,u);return await o._def.returns._def.type.parseAsync(p,i).catch(d=>{throw c.addIssue(n(p,d)),c})})}else{let o=this;return ft(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new At([a(l,c.error)]);let u=Reflect.apply(s,this,c.data),p=o._def.returns.safeParse(u,i);if(!p.success)throw new At([n(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:vr.create(e).rest(zr.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new r({args:e||vr.create([]).rest(zr.create()),returns:t||zr.create(),typeName:ie.ZodFunction,...ue(a)})}},Fn=class extends me{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Fn.create=(r,e)=>new Fn({getter:r,typeName:ie.ZodLazy,...ue(e)});var Gn=class extends me{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return W(t,{received:t.data,code:H.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:e.data}}get value(){return this._def.value}};Gn.create=(r,e)=>new Gn({value:r,typeName:ie.ZodLiteral,...ue(e)});function ih(r,e){return new zn({values:r,typeName:ie.ZodEnum,...ue(e)})}var zn=class r extends me{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),a=this._def.values;return W(t,{expected:fe.joinValues(a),received:t.parsedType,code:H.invalid_type}),ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),a=this._def.values;return W(t,{received:t.data,code:H.invalid_enum_value,options:a}),ne}return ft(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(a=>!e.includes(a)),{...this._def,...t})}};zn.create=ih;var Un=class extends me{_parse(e){let t=fe.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==q.string&&a.parsedType!==q.number){let n=fe.objectValues(t);return W(a,{expected:fe.joinValues(n),received:a.parsedType,code:H.invalid_type}),ne}if(this._cache||(this._cache=new Set(fe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=fe.objectValues(t);return W(a,{received:a.data,code:H.invalid_enum_value,options:n}),ne}return ft(e.data)}get enum(){return this._def.values}};Un.create=(r,e)=>new Un({values:r,typeName:ie.ZodNativeEnum,...ue(e)});var on=class extends me{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==q.promise&&t.common.async===!1)return W(t,{code:H.invalid_type,expected:q.promise,received:t.parsedType}),ne;let a=t.parsedType===q.promise?t.data:Promise.resolve(t.data);return ft(a.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};on.create=(r,e)=>new on({type:r,typeName:ie.ZodPromise,...ue(e)});var er=class extends me{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ie.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:s=>{W(a,s),s.fatal?t.abort():t.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let s=n.transform(a.data,i);if(a.common.async)return Promise.resolve(s).then(async o=>{if(t.value==="aborted")return ne;let l=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return l.status==="aborted"?ne:l.status==="dirty"?In(l.value):t.value==="dirty"?In(l.value):l});{if(t.value==="aborted")return ne;let o=this._def.schema._parseSync({data:s,path:a.path,parent:a});return o.status==="aborted"?ne:o.status==="dirty"?In(o.value):t.value==="dirty"?In(o.value):o}}if(n.type==="refinement"){let s=o=>{let l=n.refinement(o,i);if(a.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?ne:(o.status==="dirty"&&t.dirty(),s(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?ne:(o.status==="dirty"&&t.dirty(),s(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!nn(s))return ne;let o=n.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>nn(s)?Promise.resolve(n.transform(s.value,i)).then(o=>({status:t.value,value:o})):ne);fe.assertNever(n)}};er.create=(r,e,t)=>new er({schema:r,typeName:ie.ZodEffects,effect:e,...ue(t)});er.createWithPreprocess=(r,e,t)=>new er({schema:e,effect:{type:"preprocess",transform:r},typeName:ie.ZodEffects,...ue(t)});var Zt=class extends me{_parse(e){return this._getType(e)===q.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Zt.create=(r,e)=>new Zt({innerType:r,typeName:ie.ZodOptional,...ue(e)});var _r=class extends me{_parse(e){return this._getType(e)===q.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_r.create=(r,e)=>new _r({innerType:r,typeName:ie.ZodNullable,...ue(e)});var Hn=class extends me{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return t.parsedType===q.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Hn.create=(r,e)=>new Hn({innerType:r,typeName:ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ue(e)});var Vn=class extends me{_parse(e){let{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Ga(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new At(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new At(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Vn.create=(r,e)=>new Vn({innerType:r,typeName:ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ue(e)});var Wa=class extends me{_parse(e){if(this._getType(e)!==q.nan){let a=this._getOrReturnCtx(e);return W(a,{code:H.invalid_type,expected:q.nan,received:a.parsedType}),ne}return{status:"valid",value:e.data}}};Wa.create=r=>new Wa({typeName:ie.ZodNaN,...ue(r)});var dE=Symbol("zod_brand"),Bi=class extends me{_parse(e){let{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},Fi=class r extends me{_parse(e){let{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ne:i.status==="dirty"?(t.dirty(),In(i.value)):this._def.out._parseAsync({data:i.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?ne:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,t){return new r({in:e,out:t,typeName:ie.ZodPipeline})}},jn=class extends me{_parse(e){let t=this._def.innerType._parse(e),a=n=>(nn(n)&&(n.value=Object.freeze(n.value)),n);return Ga(t)?t.then(n=>a(n)):a(t)}unwrap(){return this._def.innerType}};jn.create=(r,e)=>new jn({innerType:r,typeName:ie.ZodReadonly,...ue(e)});function th(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function sh(r,e={},t){return r?sn.create().superRefine((a,n)=>{let i=r(a);if(i instanceof Promise)return i.then(s=>{if(!s){let o=th(e,a),l=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:l})}});if(!i){let s=th(e,a),o=s.fatal??t??!0;n.addIssue({code:"custom",...s,fatal:o})}}):sn.create()}var pE={object:It.lazycreate},ie;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(ie||(ie={}));var mE=(r,e={message:`Input not instance of ${r.name}`})=>sh(t=>t instanceof r,e),oh=an.create,lh=Rn.create,hE=Wa.create,gE=Pn.create,ch=Dn.create,fE=Nn.create,yE=Ua.create,bE=Mn.create,vE=On.create,_E=sn.create,SE=zr.create,EE=lr.create,wE=Ha.create,kE=Ur.create,CE=It.create,xE=It.strictCreate,TE=Ln.create,AE=ho.create,IE=Bn.create,RE=vr.create,PE=go.create,DE=Va.create,NE=ja.create,ME=fo.create,OE=Fn.create,LE=Gn.create,BE=zn.create,FE=Un.create,GE=on.create,zE=er.create,UE=Zt.create,HE=_r.create,VE=er.createWithPreprocess,jE=Fi.create,WE=()=>oh().optional(),qE=()=>lh().optional(),$E=()=>ch().optional(),KE={string:r=>an.create({...r,coerce:!0}),number:r=>Rn.create({...r,coerce:!0}),boolean:r=>Dn.create({...r,coerce:!0}),bigint:r=>Pn.create({...r,coerce:!0}),date:r=>Nn.create({...r,coerce:!0})};var XE=ne;var qa="2025-03-26",uh=[qa,"2024-11-05","2024-10-07"],yo="2.0",dh=h.union([h.string(),h.number().int()]),ph=h.string(),YE=h.object({progressToken:h.optional(dh)}).passthrough(),cr=h.object({_meta:h.optional(YE)}).passthrough(),Ft=h.object({method:h.string(),params:h.optional(cr)}),Gi=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),Sr=h.object({method:h.string(),params:h.optional(Gi)}),ur=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),bo=h.union([h.string(),h.number().int()]),mh=h.object({jsonrpc:h.literal(yo),id:bo}).merge(Ft).strict(),vo=r=>mh.safeParse(r).success,hh=h.object({jsonrpc:h.literal(yo)}).merge(Sr).strict(),gh=r=>hh.safeParse(r).success,fh=h.object({jsonrpc:h.literal(yo),id:bo,result:ur}).strict(),zi=r=>fh.safeParse(r).success,tr;(function(r){r[r.ConnectionClosed=-32e3]="ConnectionClosed",r[r.RequestTimeout=-32001]="RequestTimeout",r[r.ParseError=-32700]="ParseError",r[r.InvalidRequest=-32600]="InvalidRequest",r[r.MethodNotFound=-32601]="MethodNotFound",r[r.InvalidParams=-32602]="InvalidParams",r[r.InternalError=-32603]="InternalError"})(tr||(tr={}));var yh=h.object({jsonrpc:h.literal(yo),id:bo,error:h.object({code:h.number().int(),message:h.string(),data:h.optional(h.unknown())})}).strict(),bh=r=>yh.safeParse(r).success,$a=h.union([mh,hh,fh,yh]),Wn=ur.strict(),_o=Sr.extend({method:h.literal("notifications/cancelled"),params:Gi.extend({requestId:bo,reason:h.string().optional()})}),vh=h.object({name:h.string(),version:h.string()}).passthrough(),JE=h.object({experimental:h.optional(h.object({}).passthrough()),sampling:h.optional(h.object({}).passthrough()),roots:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),ZE=Ft.extend({method:h.literal("initialize"),params:cr.extend({protocolVersion:h.string(),capabilities:JE,clientInfo:vh})});var QE=h.object({experimental:h.optional(h.object({}).passthrough()),logging:h.optional(h.object({}).passthrough()),completions:h.optional(h.object({}).passthrough()),prompts:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough()),resources:h.optional(h.object({subscribe:h.optional(h.boolean()),listChanged:h.optional(h.boolean())}).passthrough()),tools:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),du=ur.extend({protocolVersion:h.string(),capabilities:QE,serverInfo:vh,instructions:h.optional(h.string())}),_h=Sr.extend({method:h.literal("notifications/initialized")}),Sh=r=>_h.safeParse(r).success,So=Ft.extend({method:h.literal("ping")}),ew=h.object({progress:h.number(),total:h.optional(h.number()),message:h.optional(h.string())}).passthrough(),Eo=Sr.extend({method:h.literal("notifications/progress"),params:Gi.merge(ew).extend({progressToken:dh})}),wo=Ft.extend({params:cr.extend({cursor:h.optional(ph)}).optional()}),ko=ur.extend({nextCursor:h.optional(ph)}),Eh=h.object({uri:h.string(),mimeType:h.optional(h.string())}).passthrough(),wh=Eh.extend({text:h.string()}),kh=Eh.extend({blob:h.string().base64()}),tw=h.object({uri:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),rw=h.object({uriTemplate:h.string(),name:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string())}).passthrough(),nw=wo.extend({method:h.literal("resources/list")}),pu=ko.extend({resources:h.array(tw)}),aw=wo.extend({method:h.literal("resources/templates/list")}),mu=ko.extend({resourceTemplates:h.array(rw)}),iw=Ft.extend({method:h.literal("resources/read"),params:cr.extend({uri:h.string()})}),hu=ur.extend({contents:h.array(h.union([wh,kh]))}),sw=Sr.extend({method:h.literal("notifications/resources/list_changed")}),ow=Ft.extend({method:h.literal("resources/subscribe"),params:cr.extend({uri:h.string()})}),lw=Ft.extend({method:h.literal("resources/unsubscribe"),params:cr.extend({uri:h.string()})}),cw=Sr.extend({method:h.literal("notifications/resources/updated"),params:Gi.extend({uri:h.string()})}),uw=h.object({name:h.string(),description:h.optional(h.string()),required:h.optional(h.boolean())}).passthrough(),dw=h.object({name:h.string(),description:h.optional(h.string()),arguments:h.optional(h.array(uw))}).passthrough(),pw=wo.extend({method:h.literal("prompts/list")}),gu=ko.extend({prompts:h.array(dw)}),mw=Ft.extend({method:h.literal("prompts/get"),params:cr.extend({name:h.string(),arguments:h.optional(h.record(h.string()))})}),Co=h.object({type:h.literal("text"),text:h.string()}).passthrough(),xo=h.object({type:h.literal("image"),data:h.string().base64(),mimeType:h.string()}).passthrough(),To=h.object({type:h.literal("audio"),data:h.string().base64(),mimeType:h.string()}).passthrough(),Ch=h.object({type:h.literal("resource"),resource:h.union([wh,kh])}).passthrough(),hw=h.object({role:h.enum(["user","assistant"]),content:h.union([Co,xo,To,Ch])}).passthrough(),fu=ur.extend({description:h.optional(h.string()),messages:h.array(hw)}),gw=Sr.extend({method:h.literal("notifications/prompts/list_changed")}),fw=h.object({title:h.optional(h.string()),readOnlyHint:h.optional(h.boolean()),destructiveHint:h.optional(h.boolean()),idempotentHint:h.optional(h.boolean()),openWorldHint:h.optional(h.boolean())}).passthrough(),yw=h.object({name:h.string(),description:h.optional(h.string()),inputSchema:h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough(),outputSchema:h.optional(h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough()),annotations:h.optional(fw)}).passthrough(),bw=wo.extend({method:h.literal("tools/list")}),yu=ko.extend({tools:h.array(yw)}),Ao=ur.extend({content:h.array(h.union([Co,xo,To,Ch])).default([]),structuredContent:h.object({}).passthrough().optional(),isError:h.optional(h.boolean())}),BD=Ao.or(ur.extend({toolResult:h.unknown()})),vw=Ft.extend({method:h.literal("tools/call"),params:cr.extend({name:h.string(),arguments:h.optional(h.record(h.unknown()))})}),bu=Sr.extend({method:h.literal("notifications/tools/list_changed")}),xh=h.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),_w=Ft.extend({method:h.literal("logging/setLevel"),params:cr.extend({level:xh})}),vu=Sr.extend({method:h.literal("notifications/message"),params:Gi.extend({level:xh,logger:h.optional(h.string()),data:h.unknown()})}),Sw=h.object({name:h.string().optional()}).passthrough(),Ew=h.object({hints:h.optional(h.array(Sw)),costPriority:h.optional(h.number().min(0).max(1)),speedPriority:h.optional(h.number().min(0).max(1)),intelligencePriority:h.optional(h.number().min(0).max(1))}).passthrough(),ww=h.object({role:h.enum(["user","assistant"]),content:h.union([Co,xo,To])}).passthrough(),kw=Ft.extend({method:h.literal("sampling/createMessage"),params:cr.extend({messages:h.array(ww),systemPrompt:h.optional(h.string()),includeContext:h.optional(h.enum(["none","thisServer","allServers"])),temperature:h.optional(h.number()),maxTokens:h.number().int(),stopSequences:h.optional(h.array(h.string())),metadata:h.optional(h.object({}).passthrough()),modelPreferences:h.optional(Ew)})}),Cw=ur.extend({model:h.string(),stopReason:h.optional(h.enum(["endTurn","stopSequence","maxTokens"]).or(h.string())),role:h.enum(["user","assistant"]),content:h.discriminatedUnion("type",[Co,xo,To])}),xw=h.object({type:h.literal("ref/resource"),uri:h.string()}).passthrough(),Tw=h.object({type:h.literal("ref/prompt"),name:h.string()}).passthrough(),Aw=Ft.extend({method:h.literal("completion/complete"),params:cr.extend({ref:h.union([Tw,xw]),argument:h.object({name:h.string(),value:h.string()}).passthrough()})}),_u=ur.extend({completion:h.object({values:h.array(h.string()).max(100),total:h.optional(h.number().int()),hasMore:h.optional(h.boolean())}).passthrough()}),Iw=h.object({uri:h.string().startsWith("file://"),name:h.optional(h.string())}).passthrough(),Rw=Ft.extend({method:h.literal("roots/list")}),Pw=ur.extend({roots:h.array(Iw)}),Dw=Sr.extend({method:h.literal("notifications/roots/list_changed")}),FD=h.union([So,ZE,Aw,_w,mw,pw,nw,aw,iw,ow,lw,vw,bw]),GD=h.union([_o,Eo,_h,Dw]),zD=h.union([Wn,Cw,Pw]),UD=h.union([So,kw,Rw]),HD=h.union([_o,Eo,vu,cw,sw,bu,gw]),VD=h.union([Wn,du,_u,fu,gu,pu,mu,hu,Ao,yu]),rr=class extends Error{constructor(e,t,a){super(`MCP error ${e}: ${t}`),this.code=e,this.data=a,this.name="McpError"}};var Nw=6e4,Io=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(_o,t=>{let a=this._requestHandlerAbortControllers.get(t.params.requestId);a?.abort(t.params.reason)}),this.setNotificationHandler(Eo,t=>{this._onprogress(t)}),this.setRequestHandler(So,t=>({}))}_setupTimeout(e,t,a,n,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:i,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new rr(tr.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=t=>{this._onerror(t)},this._transport.onmessage=(t,a)=>{zi(t)||bh(t)?this._onresponse(t):vo(t)?this._onrequest(t,a):gh(t)?this._onnotification(t):this._onerror(new Error(`Unknown message type: ${JSON.stringify(t)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let a=new rr(tr.ConnectionClosed,"Connection closed");for(let n of t.values())n(a)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let a=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;a!==void 0&&Promise.resolve().then(()=>a(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,t){var a,n,i,s;let o=(a=this._requestHandlers.get(e.method))!==null&&a!==void 0?a:this.fallbackRequestHandler;if(o===void 0){(n=this._transport)===null||n===void 0||n.send({jsonrpc:"2.0",id:e.id,error:{code:tr.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let c={signal:l.signal,sessionId:(i=this._transport)===null||i===void 0?void 0:i.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,p,m)=>this.request(u,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id};Promise.resolve().then(()=>o(e,c)).then(u=>{var p;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var p,m;if(!l.signal.aborted)return(p=this._transport)===null||p===void 0?void 0:p.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:tr.InternalError,message:(m=u.message)!==null&&m!==void 0?m:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...a}=e.params,n=Number(t),i=this._progressHandlers.get(n);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),o=this._timeoutInfo.get(n);if(o&&s&&o.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(l){s(l);return}i(a)}_onresponse(e){let t=Number(e.id),a=this._responseHandlers.get(t);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),zi(e))a(e);else{let n=new rr(e.error.code,e.error.message,e.error.data);a(n)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,a){let{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s}=a??{};return new Promise((o,l)=>{var c,u,p,m,d,g;if(!this._transport){l(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(u=a?.signal)===null||u===void 0||u.throwIfAborted();let f=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:f};a?.onprogress&&(this._progressHandlers.set(f,a.onprogress),y.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:f}});let b=A=>{var R;this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),(R=this._transport)===null||R===void 0||R.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(A)}},{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`))),l(A)};this._responseHandlers.set(f,A=>{var R;if(!(!((R=a?.signal)===null||R===void 0)&&R.aborted)){if(A instanceof Error)return l(A);try{let k=t.parse(A.result);o(k)}catch(k){l(k)}}}),(m=a?.signal)===null||m===void 0||m.addEventListener("abort",()=>{var A;b((A=a?.signal)===null||A===void 0?void 0:A.reason)});let x=(d=a?.timeout)!==null&&d!==void 0?d:Nw,S=()=>b(new rr(tr.RequestTimeout,"Request timed out",{timeout:x}));this._setupTimeout(f,x,a?.maxTotalTimeout,S,(g=a?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(y,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s}).catch(A=>{this._cleanupTimeout(f),l(A)})})}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let a={...e,jsonrpc:"2.0"};await this._transport.send(a,t)}setRequestHandler(e,t){let a=e.shape.method.value;this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,(n,i)=>Promise.resolve(t(e.parse(n),i)))}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,a=>Promise.resolve(t(e.parse(a))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Th(r,e){return Object.entries(e).reduce((t,[a,n])=>(n&&typeof n=="object"?t[a]=t[a]?{...t[a],...n}:n:t[a]=n,t),{...r})}var Rf=hc(If(),1),Hi=class extends Io{constructor(e,t){var a;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(a=t?.capabilities)!==null&&a!==void 0?a:{},this._ajv=new Rf.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Th(this._capabilities,e)}assertCapability(e,t){var a;if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let a=await this.request({method:"initialize",params:{protocolVersion:qa,capabilities:this._capabilities,clientInfo:this._clientInfo}},du,t);if(a===void 0)throw new Error(`Server sent invalid initialize result: ${a}`);if(!uh.includes(a.protocolVersion))throw new Error(`Server's protocol version is not supported: ${a.protocolVersion}`);this._serverCapabilities=a.capabilities,this._serverVersion=a.serverInfo,this._instructions=a.instructions,await this.notification({method:"notifications/initialized"})}catch(a){throw this.close(),a}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,a,n,i,s;switch(e){case"logging/setLevel":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var t;switch(e){case"notifications/roots/list_changed":if(!(!((t=this._capabilities.roots)===null||t===void 0)&&t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},Wn,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},_u,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},Wn,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},fu,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},gu,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},pu,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},mu,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},hu,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},Wn,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},Wn,t)}async callTool(e,t=Ao,a){let n=await this.request({method:"tools/call",params:e},t,a),i=this.getToolOutputValidator(e.name);if(i){if(!n.structuredContent&&!n.isError)throw new rr(tr.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{if(!i(n.structuredContent))throw new rr(tr.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(i.errors)}`)}catch(s){throw s instanceof rr?s:new rr(tr.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return n}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let a=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,a)}catch(a){console.warn(`Failed to compile output schema for tool ${t.name}: ${a}`)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let a=await this.request({method:"tools/list",params:e},yu,t);return this.cacheToolOutputSchemas(a.tools),a}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Wu;Wu=globalThis.crypto;async function pC(r){return(await Wu).getRandomValues(new Uint8Array(r))}async function mC(r){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",a=await pC(r);for(let n=0;n<r;n++){let i=a[n]%e.length;t+=e[i]}return t}async function hC(r){return await mC(r)}async function gC(r){let e=await(await Wu).subtle.digest("SHA-256",new TextEncoder().encode(r));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function qu(r){if(r||(r=43),r<43||r>128)throw`Expected a length between 43 and 128. Received ${r}.`;let e=await hC(r),t=await gC(e);return{code_verifier:e,code_challenge:t}}var Pf=h.object({resource:h.string().url(),authorization_servers:h.array(h.string().url()).optional(),jwks_uri:h.string().url().optional(),scopes_supported:h.array(h.string()).optional(),bearer_methods_supported:h.array(h.string()).optional(),resource_signing_alg_values_supported:h.array(h.string()).optional(),resource_name:h.string().optional(),resource_documentation:h.string().optional(),resource_policy_uri:h.string().url().optional(),resource_tos_uri:h.string().url().optional(),tls_client_certificate_bound_access_tokens:h.boolean().optional(),authorization_details_types_supported:h.array(h.string()).optional(),dpop_signing_alg_values_supported:h.array(h.string()).optional(),dpop_bound_access_tokens_required:h.boolean().optional()}).passthrough(),Df=h.object({issuer:h.string(),authorization_endpoint:h.string(),token_endpoint:h.string(),registration_endpoint:h.string().optional(),scopes_supported:h.array(h.string()).optional(),response_types_supported:h.array(h.string()),response_modes_supported:h.array(h.string()).optional(),grant_types_supported:h.array(h.string()).optional(),token_endpoint_auth_methods_supported:h.array(h.string()).optional(),token_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),service_documentation:h.string().optional(),revocation_endpoint:h.string().optional(),revocation_endpoint_auth_methods_supported:h.array(h.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),introspection_endpoint:h.string().optional(),introspection_endpoint_auth_methods_supported:h.array(h.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:h.array(h.string()).optional(),code_challenge_methods_supported:h.array(h.string()).optional()}).passthrough(),$u=h.object({access_token:h.string(),token_type:h.string(),expires_in:h.number().optional(),scope:h.string().optional(),refresh_token:h.string().optional()}).strip(),VN=h.object({error:h.string(),error_description:h.string().optional(),error_uri:h.string().optional()}),fC=h.object({redirect_uris:h.array(h.string()).refine(r=>r.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:h.string().optional(),grant_types:h.array(h.string()).optional(),response_types:h.array(h.string()).optional(),client_name:h.string().optional(),client_uri:h.string().optional(),logo_uri:h.string().optional(),scope:h.string().optional(),contacts:h.array(h.string()).optional(),tos_uri:h.string().optional(),policy_uri:h.string().optional(),jwks_uri:h.string().optional(),jwks:h.any().optional(),software_id:h.string().optional(),software_version:h.string().optional()}).strip(),yC=h.object({client_id:h.string(),client_secret:h.string().optional(),client_id_issued_at:h.number().optional(),client_secret_expires_at:h.number().optional()}).strip(),Nf=fC.merge(yC),jN=h.object({error:h.string(),error_description:h.string().optional()}).strip(),WN=h.object({token:h.string(),token_type_hint:h.string().optional()}).strip();var Rt=class extends Error{constructor(e){super(e??"Unauthorized")}};async function dn(r,{serverUrl:e,authorizationCode:t,scope:a,resourceMetadataUrl:n}){let i=e;try{let m=await bC(n||e);m.authorization_servers&&m.authorization_servers.length>0&&(i=m.authorization_servers[0])}catch(m){console.warn("Could not load OAuth Protected Resource metadata, falling back to /.well-known/oauth-authorization-server",m)}let s=await vC(i),o=await Promise.resolve(r.clientInformation());if(!o){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!r.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await wC(i,{metadata:s,clientMetadata:r.clientMetadata});await r.saveClientInformation(m),o=m}if(t!==void 0){let m=await r.codeVerifier(),d=await SC(i,{metadata:s,clientInformation:o,authorizationCode:t,codeVerifier:m,redirectUri:r.redirectUrl});return await r.saveTokens(d),"AUTHORIZED"}let l=await r.tokens();if(l?.refresh_token)try{let m=await EC(i,{metadata:s,clientInformation:o,refreshToken:l.refresh_token});return await r.saveTokens(m),"AUTHORIZED"}catch(m){console.error("Could not refresh OAuth tokens:",m)}let c=r.state?await r.state():void 0,{authorizationUrl:u,codeVerifier:p}=await _C(i,{metadata:s,clientInformation:o,state:c,redirectUrl:r.redirectUrl,scope:a||r.clientMetadata.scope});return await r.saveCodeVerifier(p),await r.redirectToAuthorization(u),"REDIRECT"}function Ko(r){let e=r.headers.get("WWW-Authenticate");if(!e)return;let[t,a]=e.split(" ");if(t.toLowerCase()!=="bearer"||!a){console.log("Invalid WWW-Authenticate header format, expected 'Bearer'");return}let i=/resource_metadata="([^"]*)"/.exec(e);if(i)try{return new URL(i[1])}catch{console.log("Invalid resource metadata url: ",i[1]);return}}async function bC(r,e){var t;let a;e?.resourceMetadataUrl?a=new URL(e?.resourceMetadataUrl):a=new URL("/.well-known/oauth-protected-resource",r);let n;try{n=await fetch(a,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:qa}})}catch(i){if(i instanceof TypeError)n=await fetch(a);else throw i}if(n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Pf.parse(await n.json())}async function vC(r,e){var t;let a=new URL("/.well-known/oauth-authorization-server",r),n;try{n=await fetch(a,{headers:{"MCP-Protocol-Version":(t=e?.protocolVersion)!==null&&t!==void 0?t:qa}})}catch(i){if(i instanceof TypeError)n=await fetch(a);else throw i}if(n.status!==404){if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth metadata`);return Df.parse(await n.json())}}async function _C(r,{metadata:e,clientInformation:t,redirectUrl:a,scope:n,state:i}){let s="code",o="S256",l;if(e){if(l=new URL(e.authorization_endpoint),!e.response_types_supported.includes(s))throw new Error(`Incompatible auth server: does not support response type ${s}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(o))throw new Error(`Incompatible auth server: does not support code challenge method ${o}`)}else l=new URL("/authorize",r);let c=await qu(),u=c.code_verifier,p=c.code_challenge;return l.searchParams.set("response_type",s),l.searchParams.set("client_id",t.client_id),l.searchParams.set("code_challenge",p),l.searchParams.set("code_challenge_method",o),l.searchParams.set("redirect_uri",String(a)),i&&l.searchParams.set("state",i),n&&l.searchParams.set("scope",n),{authorizationUrl:l,codeVerifier:u}}async function SC(r,{metadata:e,clientInformation:t,authorizationCode:a,codeVerifier:n,redirectUri:i}){let s="authorization_code",o;if(e){if(o=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(s))throw new Error(`Incompatible auth server: does not support grant type ${s}`)}else o=new URL("/token",r);let l=new URLSearchParams({grant_type:s,client_id:t.client_id,code:a,code_verifier:n,redirect_uri:String(i)});t.client_secret&&l.set("client_secret",t.client_secret);let c=await fetch(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:l});if(!c.ok)throw new Error(`Token exchange failed: HTTP ${c.status}`);return $u.parse(await c.json())}async function EC(r,{metadata:e,clientInformation:t,refreshToken:a}){let n="refresh_token",i;if(e){if(i=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(n))throw new Error(`Incompatible auth server: does not support grant type ${n}`)}else i=new URL("/token",r);let s=new URLSearchParams({grant_type:n,client_id:t.client_id,refresh_token:a});t.client_secret&&s.set("client_secret",t.client_secret);let o=await fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s});if(!o.ok)throw new Error(`Token refresh failed: HTTP ${o.status}`);return $u.parse({refresh_token:a,...await o.json()})}async function wC(r,{metadata:e,clientMetadata:t}){let a;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");a=new URL(e.registration_endpoint)}else a=new URL("/register",r);let n=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`Dynamic client registration failed: HTTP ${n.status}`);return Nf.parse(await n.json())}var Xo=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Ku(r){}function Yo(r){if(typeof r=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Ku,onError:t=Ku,onRetry:a=Ku,onComment:n}=r,i="",s=!0,o,l="",c="";function u(f){let y=s?f.replace(/^\xEF\xBB\xBF/,""):f,[b,x]=kC(`${i}${y}`);for(let S of b)p(S);i=x,s=!1}function p(f){if(f===""){d();return}if(f.startsWith(":")){n&&n(f.slice(f.startsWith(": ")?2:1));return}let y=f.indexOf(":");if(y!==-1){let b=f.slice(0,y),x=f[y+1]===" "?2:1,S=f.slice(y+x);m(b,S,f);return}m(f,"",f)}function m(f,y,b){switch(f){case"event":c=y;break;case"data":l=`${l}${y}
|
|
3278
|
+
`;break;case"id":o=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?a(parseInt(y,10)):t(new Xo(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:b}));break;default:t(new Xo(`Unknown field "${f.length>20?`${f.slice(0,20)}\u2026`:f}"`,{type:"unknown-field",field:f,value:y,line:b}));break}}function d(){l.length>0&&e({id:o,event:c||void 0,data:l.endsWith(`
|
|
3279
|
+
`)?l.slice(0,-1):l}),o=void 0,l="",c=""}function g(f={}){i&&f.consume&&p(i),s=!0,o=void 0,l="",c="",i=""}return{feed:u,reset:g}}function kC(r){let e=[],t="",a=0;for(;a<r.length;){let n=r.indexOf("\r",a),i=r.indexOf(`
|
|
3280
|
+
`,a),s=-1;if(n!==-1&&i!==-1?s=Math.min(n,i):n!==-1?s=n:i!==-1&&(s=i),s===-1){t=r.slice(a);break}else{let o=r.slice(a,s);e.push(o),a=s+1,r[a-1]==="\r"&&r[a]===`
|
|
3281
|
+
`&&a++}}return[e,t]}var Jo=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:a}={}){let n;super({start(i){n=Yo({onEvent:s=>{i.enqueue(s)},onError(s){e==="terminate"?i.error(s):typeof e=="function"&&e(s)},onRetry:t,onComment:a})},transform(i){n.feed(i)}})}};var CC={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Vi=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},Zo=class{constructor(e,t){var a;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._sessionId=t?.sessionId,this._reconnectionOptions=(a=t?.reconnectionOptions)!==null&&a!==void 0?a:CC}async _authThenStart(){var e;if(!this._authProvider)throw new Rt("No auth provider");let t;try{t=await dn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(a){throw(e=this.onerror)===null||e===void 0||e.call(this,a),a}if(t!=="AUTHORIZED")throw new Rt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}return this._sessionId&&(t["mcp-session-id"]=this._sessionId),new Headers({...t,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}async _startOrAuthSse(e){var t,a;let{resumptionToken:n}=e;try{let i=await this._commonHeaders();i.set("Accept","text/event-stream"),n&&i.set("last-event-id",n);let s=await fetch(this._url,{method:"GET",headers:i,signal:(t=this._abortController)===null||t===void 0?void 0:t.signal});if(!s.ok){if(s.status===401&&this._authProvider)return await this._authThenStart();if(s.status===405)return;throw new Vi(s.status,`Failed to open SSE stream: ${s.statusText}`)}this._handleSseStream(s.body,e)}catch(i){throw(a=this.onerror)===null||a===void 0||a.call(this,i),i}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,a=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(a,e),n)}_scheduleReconnection(e,t=0){var a;let n=this._reconnectionOptions.maxRetries;if(n>0&&t>=n){(a=this.onerror)===null||a===void 0||a.call(this,new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let i=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,t+1)})},i)}_handleSseStream(e,t){if(!e)return;let{onresumptiontoken:a,replayMessageId:n}=t,i;(async()=>{var o,l,c,u;try{let p=e.pipeThrough(new TextDecoderStream).pipeThrough(new Jo).getReader();for(;;){let{value:m,done:d}=await p.read();if(d)break;if(m.id&&(i=m.id,a?.(m.id)),!m.event||m.event==="message")try{let g=$a.parse(JSON.parse(m.data));n!==void 0&&zi(g)&&(g.id=n),(o=this.onmessage)===null||o===void 0||o.call(this,g)}catch(g){(l=this.onerror)===null||l===void 0||l.call(this,g)}}}catch(p){if((c=this.onerror)===null||c===void 0||c.call(this,new Error(`SSE stream disconnected: ${p}`)),this._abortController&&!this._abortController.signal.aborted&&i!==void 0)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n},0)}catch(m){(u=this.onerror)===null||u===void 0||u.call(this,new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Rt("No auth provider");if(await dn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new Rt("Failed to authorize")}async close(){var e,t;(e=this._abortController)===null||e===void 0||e.abort(),(t=this.onclose)===null||t===void 0||t.call(this)}async send(e,t){var a,n,i;try{let{resumptionToken:s,onresumptiontoken:o}=t||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:vo(e)?e.id:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let l=await this._commonHeaders();l.set("content-type","application/json"),l.set("accept","application/json, text/event-stream");let c={...this._requestInit,method:"POST",headers:l,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},u=await fetch(this._url,c),p=u.headers.get("mcp-session-id");if(p&&(this._sessionId=p),!u.ok){if(u.status===401&&this._authProvider){if(this._resourceMetadataUrl=Ko(u),await dn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new Rt;return this.send(e)}let f=await u.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${u.status}): ${f}`)}if(u.status===202){Sh(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>{var y;return(y=this.onerror)===null||y===void 0?void 0:y.call(this,f)});return}let d=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,g=u.headers.get("content-type");if(d)if(g?.includes("text/event-stream"))this._handleSseStream(u.body,{onresumptiontoken:o});else if(g?.includes("application/json")){let f=await u.json(),y=Array.isArray(f)?f.map(b=>$a.parse(b)):[$a.parse(f)];for(let b of y)(n=this.onmessage)===null||n===void 0||n.call(this,b)}else throw new Vi(-1,`Unexpected content type: ${g}`)}catch(s){throw(i=this.onerror)===null||i===void 0||i.call(this,s),s}}get sessionId(){return this._sessionId}async terminateSession(){var e,t;if(this._sessionId)try{let a=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:a,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},i=await fetch(this._url,n);if(!i.ok&&i.status!==405)throw new Vi(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(a){throw(t=this.onerror)===null||t===void 0||t.call(this,a),a}}};var el=class extends Event{constructor(e,t){var a,n;super(e),this.code=(a=t?.code)!=null?a:void 0,this.message=(n=t?.message)!=null?n:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,a){return a(Mf(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Mf(this),t)}};function xC(r){let e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function Xu(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(Xu).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${Xu(r.cause)}`:r.message:`${r}`}function Mf(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var Lf=r=>{throw TypeError(r)},nd=(r,e,t)=>e.has(r)||Lf("Cannot "+t),ye=(r,e,t)=>(nd(r,e,"read from private field"),t?t.call(r):e.get(r)),tt=(r,e,t)=>e.has(r)?Lf("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Ge=(r,e,t,a)=>(nd(r,e,"write to private field"),e.set(r,t),t),Hr=(r,e,t)=>(nd(r,e,"access private method"),t),Pt,Kn,Ka,Qo,tl,qi,Ja,$i,pn,Xa,Za,Ya,ji,dr,Yu,Ju,Zu,Of,Qu,ed,Wi,td,rd,Xn=class extends EventTarget{constructor(e,t){var a,n;super(),tt(this,dr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,tt(this,Pt),tt(this,Kn),tt(this,Ka),tt(this,Qo),tt(this,tl),tt(this,qi),tt(this,Ja),tt(this,$i,null),tt(this,pn),tt(this,Xa),tt(this,Za,null),tt(this,Ya,null),tt(this,ji,null),tt(this,Ju,async i=>{var s;ye(this,Xa).reset();let{body:o,redirected:l,status:c,headers:u}=i;if(c===204){Hr(this,dr,Wi).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Ge(this,Ka,new URL(i.url)):Ge(this,Ka,void 0),c!==200){Hr(this,dr,Wi).call(this,`Non-200 status code (${c})`,c);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){Hr(this,dr,Wi).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(ye(this,Pt)===this.CLOSED)return;Ge(this,Pt,this.OPEN);let p=new Event("open");if((s=ye(this,ji))==null||s.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){Hr(this,dr,Wi).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}let m=new TextDecoder,d=o.getReader(),g=!0;do{let{done:f,value:y}=await d.read();y&&ye(this,Xa).feed(m.decode(y,{stream:!f})),f&&(g=!1,ye(this,Xa).reset(),Hr(this,dr,td).call(this))}while(g)}),tt(this,Zu,i=>{Ge(this,pn,void 0),!(i.name==="AbortError"||i.type==="aborted")&&Hr(this,dr,td).call(this,Xu(i))}),tt(this,Qu,i=>{typeof i.id=="string"&&Ge(this,$i,i.id);let s=new MessageEvent(i.event||"message",{data:i.data,origin:ye(this,Ka)?ye(this,Ka).origin:ye(this,Kn).origin,lastEventId:i.id||""});ye(this,Ya)&&(!i.event||i.event==="message")&&ye(this,Ya).call(this,s),this.dispatchEvent(s)}),tt(this,ed,i=>{Ge(this,qi,i)}),tt(this,rd,()=>{Ge(this,Ja,void 0),ye(this,Pt)===this.CONNECTING&&Hr(this,dr,Yu).call(this)});try{if(e instanceof URL)Ge(this,Kn,e);else if(typeof e=="string")Ge(this,Kn,new URL(e,TC()));else throw new Error("Invalid URL")}catch{throw xC("An invalid or illegal string was specified")}Ge(this,Xa,Yo({onEvent:ye(this,Qu),onRetry:ye(this,ed)})),Ge(this,Pt,this.CONNECTING),Ge(this,qi,3e3),Ge(this,tl,(a=t?.fetch)!=null?a:globalThis.fetch),Ge(this,Qo,(n=t?.withCredentials)!=null?n:!1),Hr(this,dr,Yu).call(this)}get readyState(){return ye(this,Pt)}get url(){return ye(this,Kn).href}get withCredentials(){return ye(this,Qo)}get onerror(){return ye(this,Za)}set onerror(e){Ge(this,Za,e)}get onmessage(){return ye(this,Ya)}set onmessage(e){Ge(this,Ya,e)}get onopen(){return ye(this,ji)}set onopen(e){Ge(this,ji,e)}addEventListener(e,t,a){let n=t;super.addEventListener(e,n,a)}removeEventListener(e,t,a){let n=t;super.removeEventListener(e,n,a)}close(){ye(this,Ja)&&clearTimeout(ye(this,Ja)),ye(this,Pt)!==this.CLOSED&&(ye(this,pn)&&ye(this,pn).abort(),Ge(this,Pt,this.CLOSED),Ge(this,pn,void 0))}};Pt=new WeakMap,Kn=new WeakMap,Ka=new WeakMap,Qo=new WeakMap,tl=new WeakMap,qi=new WeakMap,Ja=new WeakMap,$i=new WeakMap,pn=new WeakMap,Xa=new WeakMap,Za=new WeakMap,Ya=new WeakMap,ji=new WeakMap,dr=new WeakSet,Yu=function(){Ge(this,Pt,this.CONNECTING),Ge(this,pn,new AbortController),ye(this,tl)(ye(this,Kn),Hr(this,dr,Of).call(this)).then(ye(this,Ju)).catch(ye(this,Zu))},Ju=new WeakMap,Zu=new WeakMap,Of=function(){var r;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ye(this,$i)?{"Last-Event-ID":ye(this,$i)}:void 0},cache:"no-store",signal:(r=ye(this,pn))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Qu=new WeakMap,ed=new WeakMap,Wi=function(r,e){var t;ye(this,Pt)!==this.CLOSED&&Ge(this,Pt,this.CLOSED);let a=new el("error",{code:e,message:r});(t=ye(this,Za))==null||t.call(this,a),this.dispatchEvent(a)},td=function(r,e){var t;if(ye(this,Pt)===this.CLOSED)return;Ge(this,Pt,this.CONNECTING);let a=new el("error",{code:e,message:r});(t=ye(this,Za))==null||t.call(this,a),this.dispatchEvent(a),Ge(this,Ja,setTimeout(ye(this,rd),ye(this,qi)))},rd=new WeakMap,Xn.CONNECTING=0,Xn.OPEN=1,Xn.CLOSED=2;function TC(){let r="document"in globalThis?globalThis.document:void 0;return r&&typeof r=="object"&&"baseURI"in r&&typeof r.baseURI=="string"?r.baseURI:void 0}var ad=class extends Error{constructor(e,t,a){super(`SSE error: ${t}`),this.code=e,this.event=a}},rl=class{constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider}async _authThenStart(){var e;if(!this._authProvider)throw new Rt("No auth provider");let t;try{t=await dn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})}catch(a){throw(e=this.onerror)===null||e===void 0||e.call(this,a),a}if(t!=="AUTHORIZED")throw new Rt;return await this._startOrAuth()}async _commonHeaders(){var e;let t={...(e=this._requestInit)===null||e===void 0?void 0:e.headers};if(this._authProvider){let a=await this._authProvider.tokens();a&&(t.Authorization=`Bearer ${a.access_token}`)}return t}_startOrAuth(){return new Promise((e,t)=>{var a;this._eventSource=new Xn(this._url.href,(a=this._eventSourceInit)!==null&&a!==void 0?a:{fetch:(n,i)=>this._commonHeaders().then(s=>fetch(n,{...i,headers:{...s,Accept:"text/event-stream"}}))}),this._abortController=new AbortController,this._eventSource.onerror=n=>{var i;if(n.code===401&&this._authProvider){this._authThenStart().then(e,t);return}let s=new ad(n.code,n.message,n);t(s),(i=this.onerror)===null||i===void 0||i.call(this,s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",n=>{var i;let s=n;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(o){t(o),(i=this.onerror)===null||i===void 0||i.call(this,o),this.close();return}e()}),this._eventSource.onmessage=n=>{var i,s;let o=n,l;try{l=$a.parse(JSON.parse(o.data))}catch(c){(i=this.onerror)===null||i===void 0||i.call(this,c);return}(s=this.onmessage)===null||s===void 0||s.call(this,l)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Rt("No auth provider");if(await dn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new Rt("Failed to authorize")}async close(){var e,t,a;(e=this._abortController)===null||e===void 0||e.abort(),(t=this._eventSource)===null||t===void 0||t.close(),(a=this.onclose)===null||a===void 0||a.call(this)}async send(e){var t,a,n;if(!this._endpoint)throw new Error("Not connected");try{let i=await this._commonHeaders(),s=new Headers({...i,...(t=this._requestInit)===null||t===void 0?void 0:t.headers});s.set("content-type","application/json");let o={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:(a=this._abortController)===null||a===void 0?void 0:a.signal},l=await fetch(this._endpoint,o);if(!l.ok){if(l.status===401&&this._authProvider){if(this._resourceMetadataUrl=Ko(l),await dn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl})!=="AUTHORIZED")throw new Rt;return this.send(e)}let c=await l.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${l.status}): ${c}`)}}catch(i){throw(n=this.onerror)===null||n===void 0||n.call(this,i),i}}};var Vr={name:"@intelliweave/embedded",version:"1.9.65-beta.0",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && tsx --test","test:local":"IW_API_URL=http://localhost:3000/api npm run test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"@anthropic-ai/sdk":"^0.60.0","@modelcontextprotocol/sdk":"^1.12.1","@types/json-schema":"^7.0.15","gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var rt=new ge("MCPKnowledgeClient"),nl=class{constructor(e){this.tools=[];this.iwActions=[];this.stats={toolsCalled:0};this.lastSearchQuery="";this.lastSearchResults=[];this.config=e}async connect(){return this.client?this.client:this.connectionPromise?await this.connectionPromise:(this.connectionPromise=this.connectInternal(),this.connectionPromise.finally(()=>{this.connectionPromise=void 0}),await this.connectionPromise)}async connectInternal(){rt.debug("Connecting to MCP client");let e=this.config.connect?await this.config.connect():await Promise.resolve().then(async()=>{let t=new Hi({name:Vr.name,version:Vr.version}),a=new Zo(new URL(this.config.baseURL));return await t.connect(a),rt.debug("Connected with HTTP streaming mode"),t}).catch(async t=>{let a=new Hi({name:Vr.name,version:Vr.version}),n=new rl(new URL(this.config.baseURL));return await a.connect(n),rt.debug("Connected with SSE mode"),a});return await this.disconnect(),this.client=e,e.onerror=t=>{rt.error(`MCP client error: ${t.message}`)},e.onclose=()=>{rt.debug("MCP client connection closed"),this.client=void 0},e.setNotificationHandler(vu,t=>{t.params.level=="critical"?rt.error(`[Server] ${t.params.data}`):t.params.level=="emergency"?rt.error(`[Server] ${t.params.data}`):t.params.level=="error"?rt.error(`[Server] ${t.params.data}`):t.params.level=="warning"?rt.warn(`[Server] ${t.params.data}`):t.params.level=="info"?rt.info(`[Server] ${t.params.data}`):t.params.level=="debug"?rt.debug(`[Server] ${t.params.data}`):rt.log(`[Server] ${t.params.data}`)}),e.setNotificationHandler(bu,t=>{rt.debug("Tool list changed",t),this.fetchTools()}),rt.debug("Fetching tools from MCP server..."),await this.fetchTools(),e}async disconnect(){await this.client?.close(),this.client=void 0,this.tools=[],this.iwActions=[]}async fetchTools(){let e=[],t;for(;;){let n=await this.client.listTools({cursor:t});t=n.nextCursor;for(let i of n.tools||[])e.push(i);if(!n?.tools?.length||!t)break}let a=[];for(let n of e){let i=!!(this.config.searchToolName&&n.name==this.config.searchToolName&&!this.config.searchToolVisible);a.push({id:n.name,name:n.name,content:n.description||"",type:"action",isContext:!0,parameters:n.inputSchema,action:s=>this.performToolCall(n.name,s),disabled:i})}rt.debug(`Fetched ${e.length} tools from MCP server.`),this.tools=e,this.iwActions=a}async search(e){if(e==this.lastSearchQuery)return this.lastSearchResults;await this.connect();let t=this.iwActions.slice(),a=await this.performSearchCall(e);return t=t.concat(a),this.lastSearchQuery=e,this.lastSearchResults=t,rt.debug(`Search completed, found ${t.length} items.`),t}async performSearchCall(e){let t=[];if(!this.config.searchToolName)return t;let a=this.tools.find(i=>i.name==this.config.searchToolName);if(!a)return rt.warn(`Search function ${this.config.searchToolName} not found on the MCP server.`),t;let n;if(a.inputSchema.required?.length==1){let i=a.inputSchema.required[0];n=await this.performToolCall(this.config.searchToolName,{[i]:e})}else if(a.inputSchema.properties&&Object.keys(a.inputSchema.properties).length==1){let i=Object.keys(a.inputSchema.properties)[0];n=await this.performToolCall(this.config.searchToolName,{[i]:e})}else n=await this.performToolCall(this.config.searchToolName,{});if(Array.isArray(n))for(let i=0;i<n.length;i++){let s=n[i];t.push({id:this.config.id+":"+this.config.searchToolName+":"+i,name:`Search result ${i+1} in ${this.config.searchToolName}`,type:"info",content:typeof s=="string"?s:JSON.stringify(s)})}else t.push({id:this.config.id+":"+this.config.searchToolName+":result",name:`Search result in ${this.config.searchToolName}`,type:"info",content:typeof n=="string"?n:JSON.stringify(n)});return t}async performToolCall(e,t){await this.connect(),rt.debug(`Performing tool call for ${e} with params:`,t),this.stats.toolsCalled+=1;let a=await this.client.callTool({name:e,arguments:t});if(a.isError){let n=a.content?.[0]?.text||"Unknown error";throw rt.error(`Error calling tool ${e}: ${n}`),new Error(`Error calling tool ${e}: ${n}`)}if(Array.isArray(a.content)&&a.content.length==1&&a.content[0].type=="text")try{return JSON.parse(a.content[0].text)}catch{}return a.content||[]}};var IC=new ge("Statistics"),Ki=[];async function Et(r,e){let t={...e,event_id:$t(),event_date:new Date().toISOString(),sdk_version:Vr.version,conversation_id:r?.conversationID||"",api_key:r?.apiKey||"",user_id:r?.userID||""};if(Ki.push(t),!r||(await new Promise(n=>setTimeout(n,5e3)),Ki.length===0))return;let a=Ki.slice();Ki.length=0;try{let n=await fetch(r.hubAPI+"/analytics/stats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({events:a})});if(!n.ok)throw new Error(`Analytics submission failed: ${n.status} ${n.statusText}`)}catch(n){IC.warn("Failed to submit analytics event:",n),Ki.push(...a);return}}var Yn=new ge("KnowledgeBase"),id=1,al=class r{constructor(e){this._sources=[{id:"core.internal",query:async()=>Zm}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=e}registerSource(e,t){let a=e;return typeof e=="function"&&(t=e,a=`source.${id++}`),this._sources.push({id:a,query:t}),a}removeSource(e){this._sources=this.sources.filter(t=>t.id!==e&&t.query!==e)}addEntry(e){this.manualEntries.push(e)}removeEntry(e){this.manualEntries=this.manualEntries.filter(t=>t.id!==e)}get sources(){let e=this._sources;return Be().knowledgeBaseSources&&(e=e.concat(Be().knowledgeBaseSources)),e=e.concat(this._windowSources),e=e.filter(t=>!t.disabled),e}async search(e){let t=Date.now();Yn.debug(`Searching knowledge base for: ${e}`);let a=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});a.query=e,a.entries=[],a.sources=[],typeof document<"u"&&document.dispatchEvent(a),this._windowSources=a.sources;let i=(await Promise.all(this.sources.map(async c=>{try{let u=Date.now(),p=await c.query(e);return Yn.debug(`Source '${c.id}' took ${Date.now()-u}ms`),p||[]}catch(u){return Yn.warn(`Knowledge source '${c.id}' failed:`,u),[]}}))).flat();i=i.concat(a.entries),i=i.concat(this.manualEntries),Be().knowledgeBase&&(i=i.concat(Be().knowledgeBase)),i=i.filter(c=>c&&!c.disabled);for(let c=0;c<i.length;c++){let u=i[c];u.id=u.id||`temp.${c}`,u._functionID=u.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!u.action&&u.type=="tour"&&(u.action=p=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!u.action&&u.type=="info"&&(u.action=p=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")})}let s=new Jm({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});s.addAll(i);let l=s.search(e).map(c=>i.find(u=>u.id==c.id));for(let c of i)c.isContext&&(l.find(u=>u.id===c.id)||l.push(c));return this.lastResults=l,Et(this.ai,{event_type:"kb_search",value:l.length,value_str:"",event_properties:{search_time_ms:Date.now()-t,sources_searched:this.sources.length}}),Yn.debug("Found results:",l),l}getCachedEntry(e){return this.lastResults.find(t=>t.id==e||t._functionID==e)}registerSourceFromURL(e,t){t||(t=`external.${id++}`),Yn.debug(`Registering remote knowledge base source: ${e}`);let a=[],n=[],i=!0,s=async(l,c)=>{Yn.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,extra:this.ai.extra,actionID:l.id,parameters:c},p=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!p.ok)throw new Error(`HTTP Error ${p.status} ${p.statusText}`);let m=await p.json();return o(m.updateItems||[]),m.response},o=l=>{for(let c of l){if(!c.id){Yn.warn("KB item skipped since it has no ID.",c);continue}let u=a.find(p=>p.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}a.push({...c,action:p=>s(c,p)})}};this.registerSource(t,async l=>{if(i&&n.includes(l))return a;let c={type:"search",userID:this.ai?.userID||"",extra:this.ai?.extra||{},query:l},u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let p=await u.json();return i=!p.noCache,n.includes(l)||n.push(l),o(p.items),a})}clone(){let e=new r(this.ai);return e._sources=this._sources,e._windowSources=this._windowSources,e.manualEntries=this.manualEntries,e}registerMCPSource(e){e.id||(e.id=`external.${id++}`);let t=new nl(e);return this.registerSource(e.id,a=>t.search(a)),t}};var il=class{constructor(e){this.ai=e}async boolean(e){let t=await this.instruct({...e,instruction:`${e.instruction}
|
|
3259
3282
|
|
|
3260
3283
|
Return only the text "true" or "false" to indicate the answer to the question. Do not include any additional text or explanations.`});if(t.toLowerCase().includes("true"))return!0;if(t.toLowerCase().includes("false"))return!1;throw new Error("The AI did not give a boolean answer: "+t)}async choose(e){let t=await this.instruct({...e,instruction:`${e.instruction}
|
|
3261
3284
|
|
|
@@ -3272,8 +3295,8 @@ Objects should have the following keys:
|
|
|
3272
3295
|
${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No description provided."}`).join(`
|
|
3273
3296
|
`)}
|
|
3274
3297
|
`,a=await this.instruct({...e,instruction:t});if(a=a.replace(/```jsonl/g,"").replace(/```json/g,"").replace(/```/g,""),e.allowMultiple){let n=a.split(`
|
|
3275
|
-
`).map(
|
|
3276
|
-
`});else if(i.type=="action"){let o={name:i._functionID,description:xs(typeof i.content=="function"?i.content():i.content),params:hu(i.parameters||[{name:"value",type:"string",description:"Input"}]),removeFromMessageHistory:!!i.removeFromMessageHistory,callback:s=>this.toolRunKBAction(i,s),kb:i};this.currentModel.toolGroup.add({id:i._functionID,customData:o,cannotRemove:i.isContext,sortOrder:101,disabled:i.disabled,content:JSON.stringify(o)})}else continue;let n=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=n&&(this._lastSystemMsg=n,this.submitAnalyticsEvent({type:"system-msg",txt:n}))}processIncomingMessage(t,a){if(!a){let i=this.currentModel?.stats?.tokensUsed||0,o=i-(this._lastTrackedTokens||0);this._lastTrackedTokens=i,pt(this,{event_type:"message_receive",value:o,value_str:"",event_properties:{response_time_ms:Date.now()-(this._messageStartTime||Date.now()),is_streaming:!1,is_chunk:!1,total_tokens:i}})}let n="";this._lastOutput===void 0?(n=t,this._lastOutput=t):t.startsWith(this._lastOutput)?(n=t.substring(this._lastOutput.length),this._lastOutput=t):(Yt.warn("Message was changed during chunking. This should not happen.",t,this._lastOutput),n=t,this._lastOutput=t),a||(this._lastOutput=void 0),this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:a,message:t,messageChunk:n}})),this.onAIMessage?.(t,!!a)}async sendMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return Yt.warn("Cannot send message while another message is being processed."),null;this.isProcessing=!0;try{return this._messageStartTime=Date.now(),zm.has(this.conversationID)||(zm.add(this.conversationID),pt(this,{event_type:"session_start"})),this._lastTrackedTokens=this.currentModel?.stats?.tokensUsed||0,pt(this,{event_type:"message_send",value_str:"",event_properties:{message_length:t.length,is_voice_input:!!this.audio?.speechRecognition?.isRunning}}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:t}})),await this.currentModel.sendMessage(t)}finally{this.isProcessing=!1}}async toolRunKBAction(t,a){let n=Date.now();try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:t,input:a,ai:this}}));let i=await t.action(a,this),o=Date.now()-n;return pt(this,{event_type:"tool_call",value_str:t.id||"",event_properties:{tool_args:a,execution_time_ms:o,success:!0}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:a,ai:this,result:i}})),i}catch(i){let o=Date.now()-n;throw pt(this,{event_type:"tool_call",value_str:t.id||"",event_properties:{tool_args:a,execution_time_ms:o,success:!1,error_message:i.message}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:a,ai:this,error:i}})),i}}submitAnalyticsEvent(t){Ne().analytics===!1||this.config?.analytics===!1||fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(a=>{Yt.debug("Failed to submit analytics event:",a)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=Tt(),this._lastSystemMsg="")}insertAssistantMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");let a={role:"assistant",content:t};this.currentModel.messageGroup.add({id:Tt(),content:JSON.stringify(a),customData:a})}exportState(){return{type:"intelliweave/state/v1",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll().map(t=>t.customData)}}importState(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(t?.type!="intelliweave/state/v1")throw new Error(`Invalid state type: ${t.type}`);this.conversationID=t.conversationID;for(let a of t.messages)this.currentModel.messageGroup.add({id:Tt(),content:JSON.stringify(a),customData:a})}clone(){let t=new fo;return t.apiKey=this.apiKey,t.config=this.config,t.models=this.models,this.config?.id&&t.setModel(this.config.id),t.audio=this.audio,t.vadModel=this.vadModel,t.userID=this.userID,t.extra=this.extra,t.knowledgeBase=this.knowledgeBase.clone(),t}};fo.version=_r.version;var ra=fo;var At=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(t={},a=""){this.register();let n=document.createElement(this.tagName);for(let i in t)n.setAttribute(i,t[i]);return n.onBeforeCreate(),n.innerHTML=a,n}static add(t={},a=""){return this.register(),`<${this.tagName} ${Object.keys(t).map(n=>`${n}="${(t[n]+"").replaceAll('"',""")}"`).join(" ")}>${a}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(t,a,n){this._shadow&&this.onUpdate()}get attr(){if(this._attrProxy)return this._attrProxy;let t=a=>(yo=yo||document.createElement("div"),yo.innerText=a||"",yo.innerHTML);return this._attrProxy=new Proxy({},{get:(a,n)=>t(this.getAttribute(n.toString())||""),set:(a,n,i)=>(this.getAttribute(n.toString())===i||(i?this.setAttribute(n.toString(),i):this.removeAttribute(n.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(t,a)=>this._state[a],set:(t,a,n)=>(this._state[a]=n,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(t){return!!this.root?.getElementById(t)}child(t){let a=this.root?.getElementById(t);if(!a)throw new Error(`Child with ID ${t} not found`);return a}};At.observedAttributes=[],At.tagName="",At._isRegistered=!1;var yo;var Um='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var Hm='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Vm='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Na=class extends At{constructor(){super(...arguments);this.html=()=>`
|
|
3298
|
+
`).map(s=>s.trim()).filter(s=>!!s.trim()),i=[];for(let s of n)try{i.push(JSON.parse(s))}catch(o){console.error("Failed to parse line as JSON:",s,o.message)}return i}else return[JSON.parse(a.trim())]}async generateMarkdown(e){return this.instruct({...e,instruction:"Generate a Markdown document based on the input text. Always include a header on every response. Give long detailed answers with many paragraphs, and explain concepts step by step."})}async instruct(e){let t=this.ai.clone();return t.resetConversation(),t.getContextPrefix=async()=>e.instruction,e.callback&&t.addEventListener("output",a=>{e.callback(a.detail.message)}),e.allowKB||(t.knowledgeBase._sources=[]),await t.sendMessage(typeof e.data=="string"?e.data:JSON.stringify(e.data))||""}};var Er=new ge("Main"),Bf=new Set,sl=class sl extends EventTarget{constructor(){super(...arguments);this.conversationID=$t();this.knowledgeBase=new al(this);this._lastKBsearch="";this.models=[];this.audio=null;this.apiKey="";this.logic=new il(this);this.userID=Ap();this.extra=Be().extra||{};this.hubAPI="https://intelliweave.ai/api";this._lastSystemMsg="";this.isProcessing=!1;this._lastTrackedTokens=0}get loaded(){return!!(this.config&&this.currentModel)}async load(t){if(this.apiKey=t,!t)throw new Error("API key is required to load the AI.");try{await Promise.all([(async()=>{Er.debug("Loading configuration...");let a=await fetch(this.hubAPI+"/config/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t})});if(!a.ok)throw new Error(`Failed to load configuration: ${a.status} ${a.statusText}`);try{this.config=await a.json(),Er.debug("Config loaded successfully:",this.config),this.config&&Er.debug("UI Properties - logo:",this.config.logo,"background:",this.config.background,"textColor:",this.config.textColor)}catch(n){Er.error("Failed to parse JSON response:",n);try{let i=await a.clone().text();Er.error("Raw response that failed parsing:",i)}catch{Er.error("Could not get raw response text either")}throw new Error(`Failed to parse configuration: ${n}`)}})(),(async()=>{try{let a=await fetch("https://cdn.intelliweave.ai/models/silero_vad_3.onnx");if(!a.ok)throw new Error(`Failed to load VAD model: ${a.status} ${a.statusText}`);this.vadModel=await a.blob()}catch(a){Er.warn(`Failed to load VAD model, some features will be unavailable. ${a.message}`)}})()]),this.models=[{id:this.config.id,config:this.config.model}],this.setModel(this.config.id);for(let a of this.config.knowledge||[])a.url&&a.backendType=="mcp"?this.knowledgeBase.registerMCPSource({id:a.id,searchToolName:a.mcpSearchToolName,baseURL:a.url}):a.url&&this.knowledgeBase.registerSourceFromURL(a.url);for(let a of this.config.knowledge||[])a.entries?.length&&this.knowledgeBase.registerSource(a.id,()=>a.entries||[]);if(this.config.mcpServers)for(let a of this.config.mcpServers)this.knowledgeBase.registerMCPSource(a);return this.resetConversation(),this.dispatchEvent(new CustomEvent("load",{detail:{ai:this}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_loaded",{detail:{ai:this}})),this.config}catch(a){throw Er.warn("Failed to load:",a),this.error=a,this.dispatchEvent(new CustomEvent("error",{detail:{ai:this,error:a}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_error",{detail:{ai:this,error:a}})),a}}setModel(t){let a=this.models.find(i=>i.id==t);if(!a)throw new Error(`Model with ID "${t}" not found.`);let n={...a.config,stream:!0,systemMessage:"",onBeforeMessageProcessing:this.onBeforeMessageProcessing.bind(this),onAIMessage:this.processIncomingMessage.bind(this),onAIToolStart:(i,s)=>{let o=this.knowledgeBase.getCachedEntry(i);this.onAIToolStart?.(o?.id||i,s)}};a.config.providerID==="anthropic"?this.currentModel=new lo(n):this.currentModel=new Ms(n),this.currentModel.id=a.id,this.currentModel.metadata=a}async getContextPrefix(){let t=Be().pageSummary||`You are ${this.config?.name||"IntelliWeave"}. ${this.config?.instructions||"Speak in short sentences."}`;return typeof t=="function"&&(t=await t()),t}async onBeforeMessageProcessing(){this._lastKBsearch||(this._lastKBsearch="__intelliweaveblanksearchforcontextitems__");let t=await this.getContextPrefix();this.currentModel.contextGroup.add({id:"_iw_main",sortOrder:1,cannotRemove:!0,content:t}),this.currentModel.contextGroup.add({id:"_iw_kb_description",sortOrder:100,cannotRemove:!0,content:'You have access to a database of knowledge base items. These include "info" type items which provide information and "tour" type items which contain instructions you should follow (only do one item at a time). Current info and tour items:'});let a=this._nextRequestUseKBitems||await this.knowledgeBase.search(this._lastKBsearch);this._nextRequestUseKBitems=void 0;for(let i of a)if(i.type=="info"||i.type=="tour"||i.type=="input-event")this.currentModel.contextGroup.add({id:i.id,customData:i,cannotRemove:i.isContext,sortOrder:101,disabled:i.disabled,content:JSON.stringify({id:i.id,type:i.type,name:i.name,content:yc(typeof i.content=="function"?i.content():i.content)})+`
|
|
3299
|
+
`});else if(i.type=="action"){let s={name:i._functionID,description:yc(typeof i.content=="function"?i.content():i.content),params:Ip(i.parameters||[{name:"value",type:"string",description:"Input"}]),removeFromMessageHistory:!!i.removeFromMessageHistory,callback:o=>this.toolRunKBAction(i,o),kb:i};this.currentModel.registerTool(s)}else continue;let n=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=n&&(this._lastSystemMsg=n,this.submitAnalyticsEvent({type:"system-msg",txt:n}))}processIncomingMessage(t,a){if(!a){let n=this.currentModel?.stats?.tokensUsed||0,i=n-(this._lastTrackedTokens||0);this._lastTrackedTokens=n,Et(this,{event_type:"message_receive",value:i,value_str:"",event_properties:{response_time_ms:Date.now()-(this._messageStartTime||Date.now()),is_streaming:!1,is_chunk:!1,total_tokens:n}})}this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:a,message:t}})),this.onAIMessage?.(t,!!a)}async sendMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return Er.warn("Cannot send message while another message is being processed."),null;this.isProcessing=!0;try{this._messageStartTime=Date.now(),Bf.has(this.conversationID)||(Bf.add(this.conversationID),Et(this,{event_type:"session_start"})),this._lastTrackedTokens=this.currentModel?.stats?.tokensUsed||0,Et(this,{event_type:"message_send",value_str:"",event_properties:{message_length:t.length,is_voice_input:!!this.audio?.speechRecognition?.isRunning}}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:t}})),this.submitAnalyticsEvent({type:"message",role:"user",message:t,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()});let a=await this.currentModel.sendMessage(t);return a&&typeof a=="string"&&a.trim().length>0&&this.submitAnalyticsEvent({type:"message",role:"assistant",message:a,conversationID:this.conversationID,apiKey:this.apiKey,personaID:this.config?.id,date:Date.now()}),a}finally{this.isProcessing=!1}}async toolRunKBAction(t,a){let n=Date.now();try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:t,input:a,ai:this}}));let i=await t.action(a,this),s=Date.now()-n;return Et(this,{event_type:"tool_call",value_str:t.id||"",event_properties:{tool_args:a,execution_time_ms:s,success:!0}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:a,ai:this,result:i}})),i}catch(i){let s=Date.now()-n;throw Et(this,{event_type:"tool_call",value_str:t.id||"",event_properties:{tool_args:a,execution_time_ms:s,success:!1,error_message:i.message}}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:a,ai:this,error:i}})),i}}submitAnalyticsEvent(t){Be().analytics===!1||this.config?.analytics===!1||fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(a=>{Er.debug("Failed to submit analytics event:",a)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this._lastKBsearch="",this._nextRequestUseKBitems=void 0,this.conversationID=$t(),this._lastSystemMsg="")}insertAssistantMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");this.currentModel.addAssistantMessage(t)}exportState(){return{type:"intelliweave/state/v1",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll().map(t=>t.customData)}}importState(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(t?.type!="intelliweave/state/v1")throw new Error(`Invalid state type: ${t.type}`);this.conversationID=t.conversationID;for(let a of t.messages)this.currentModel.messageGroup.add({id:$t(),content:JSON.stringify(a),customData:a})}clone(){let t=new sl;return t.apiKey=this.apiKey,t.config=this.config,t.models=this.models,this.config?.id&&t.setModel(this.config.id),t.audio=this.audio,t.vadModel=this.vadModel,t.userID=this.userID,t.extra=this.extra,t.knowledgeBase=this.knowledgeBase.clone(),t}};sl.version=Vr.version;var Qa=sl;var Gt=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(t={},a=""){this.register();let n=document.createElement(this.tagName);for(let i in t)n.setAttribute(i,t[i]);return n.onBeforeCreate(),n.innerHTML=a,n}static add(t={},a=""){return this.register(),`<${this.tagName} ${Object.keys(t).map(n=>`${n}="${(t[n]+"").replaceAll('"',""")}"`).join(" ")}>${a}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(t,a,n){this._shadow&&this.onUpdate()}get attr(){if(this._attrProxy)return this._attrProxy;let t=a=>(ol=ol||document.createElement("div"),ol.innerText=a||"",ol.innerHTML);return this._attrProxy=new Proxy({},{get:(a,n)=>t(this.getAttribute(n.toString())||""),set:(a,n,i)=>(this.getAttribute(n.toString())===i||(i?this.setAttribute(n.toString(),i):this.removeAttribute(n.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(t,a)=>this._state[a],set:(t,a,n)=>(this._state[a]=n,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(t){return!!this.root?.getElementById(t)}child(t){let a=this.root?.getElementById(t);if(!a)throw new Error(`Child with ID ${t} not found`);return a}};Gt.observedAttributes=[],Gt.tagName="",Gt._isRegistered=!1;var ol;var Ff='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var Gf='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var zf='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Xi=class extends Gt{constructor(){super(...arguments);this.html=()=>`
|
|
3277
3300
|
|
|
3278
3301
|
<!-- Styling -->
|
|
3279
3302
|
<style>
|
|
@@ -3313,7 +3336,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3313
3336
|
}
|
|
3314
3337
|
|
|
3315
3338
|
:host #loader {
|
|
3316
|
-
background-image: url('${
|
|
3339
|
+
background-image: url('${Ff}');
|
|
3317
3340
|
background-size: 64px 64px;
|
|
3318
3341
|
background-position: center;
|
|
3319
3342
|
background-repeat: no-repeat;
|
|
@@ -3336,7 +3359,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3336
3359
|
}
|
|
3337
3360
|
|
|
3338
3361
|
:host #microphone-button {
|
|
3339
|
-
background-image: url('${
|
|
3362
|
+
background-image: url('${Gf}');
|
|
3340
3363
|
z-index: 2;
|
|
3341
3364
|
margin-right: -10px;
|
|
3342
3365
|
}
|
|
@@ -3360,7 +3383,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3360
3383
|
}
|
|
3361
3384
|
|
|
3362
3385
|
:host #cancel-speech-button {
|
|
3363
|
-
background-image: url('${
|
|
3386
|
+
background-image: url('${zf}');
|
|
3364
3387
|
z-index: 2;
|
|
3365
3388
|
}
|
|
3366
3389
|
|
|
@@ -3384,7 +3407,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3384
3407
|
<!-- Loader bar -->
|
|
3385
3408
|
<div id='loader'></div>
|
|
3386
3409
|
|
|
3387
|
-
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",t=>this.onInputKeyPress(t),{capture:!0}),this.child("input-field").addEventListener("keydown",t=>t.stopPropagation(),{capture:!0}),this.child("llm-button").addEventListener("click",t=>this.onLLMButtonClick(t)),this.child("microphone-button").addEventListener("click",t=>this.onMicButtonClick(t)),this.child("cancel-speech-button").addEventListener("click",t=>this.onCancelSpeechButtonClick(t))}connectAI(t){this.ai=t,this.ai.audio?.speechRecognition.addEventListener("speech",a=>this.onSpeechEvent(a)),this.ai.audio?.speechRecognition.addEventListener("start",a=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",a=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",a=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",a=>this.onUpdate()),this.onUpdate()}onUpdate(){this.attr.textColor&&document.documentElement.style.setProperty("--intelliweave-text-color",this.attr.textColor),this.child("input-field").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("llm-button").style.display=this.attr.loading||!this.attr.llmButtonVisible||this.state.micActiv?"none":"",this.child("llm-button").innerText=this.attr.llmName||"LLM",this.child("loader").style.display=this.attr.loading?"block":"",this.child("microphone-button").style.display=!this.ai?.audio?.speechRecognition?.isSupported||this.attr.loading&&!this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("cancel-speech-button").style.display="none",this.ai?.audio?.speechRecognition.isRunning&&this.ai?.audio?.speechOutput.isSpeaking&&(this.child("microphone-button").style.display="none",this.child("cancel-speech-button").style.display=""),!this.attr.loading&&this._wasLoading&&this.child("input-field").focus(),this._wasLoading=this.attr.loading,this.child("microphone-button-bg").classList.toggle("active",!!this.ai?.audio?.speechRecognition.isRunning);let t=this.ai?.audio?.speechRecognition.isRunning&&!this.attr.loading;t&&!this.micStateAnimationTimer?this.micStateAnimationTimer=setInterval(()=>this.onMicAnimation(),1e3/60):!t&&this.micStateAnimationTimer&&(this.voiceAnimationPieces.forEach(a=>a.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(t){if(t.stopPropagation(),t.key!="Enter")return;let a=this.child("input-field"),n=a.value?.trim();a.value="",n&&this.dispatchEvent(new CustomEvent("input-message",{detail:n}))}onLLMButtonClick(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("llm-button-click"))}onMicButtonClick(t){t.preventDefault(),this.ai.audio?.speechRecognition.isRunning?this.ai.audio?.speechRecognition.stop():this.ai.audio?.speechRecognition.start()}onMicAnimation(){if(!this.attr.loading){if(this._micAnimFrameCounter++,this._micAnimFrameCounter%5==0){let t="rgba(140, 170, 200, 0.5)";this.ai?.audio?.speechRecognition.voiceDetection?.isModelLoaded||(t="rgba(255, 0, 0, 0.5)"),this.ai?.audio?.speechRecognition.voiceDetection?.isTranscribing&&(t="rgba(96, 66, 245, 0.9)"),this.ai?.audio?.speechRecognition.wordsCurrentlyBeingSpoken&&(t="rgba(0, 128, 255, 0.9)"),this.ai?.audio?.speechRecognition.voiceDetection?.isVoicePossiblyEnding&&(t="rgba(0, 128, 255, 0.5)"),this.ai?.isProcessing&&(t="rgba(255, 255, 0, 0.5)"),this.ai?.audio?.speechOutput.isSpeaking&&(t="rgba(0, 255, 0, 0.5)");let a=this.ai?.audio?.speechRecognition.volumeLevel||0,n=30,i=6,
|
|
3410
|
+
`;this._wasLoading=!1;this.voiceAnimationPieces=[];this._micAnimFrameCounter=0}onCreate(){this.child("input-field").addEventListener("keypress",t=>this.onInputKeyPress(t),{capture:!0}),this.child("input-field").addEventListener("keydown",t=>t.stopPropagation(),{capture:!0}),this.child("llm-button").addEventListener("click",t=>this.onLLMButtonClick(t)),this.child("microphone-button").addEventListener("click",t=>this.onMicButtonClick(t)),this.child("cancel-speech-button").addEventListener("click",t=>this.onCancelSpeechButtonClick(t))}connectAI(t){this.ai=t,this.ai.audio?.speechRecognition.addEventListener("speech",a=>this.onSpeechEvent(a)),this.ai.audio?.speechRecognition.addEventListener("start",a=>this.onUpdate()),this.ai.audio?.speechRecognition.addEventListener("end",a=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechstart",a=>this.onUpdate()),this.ai.audio?.speechOutput.addEventListener("speechend",a=>this.onUpdate()),this.onUpdate()}onUpdate(){this.attr.textColor&&document.documentElement.style.setProperty("--intelliweave-text-color",this.attr.textColor),this.child("input-field").style.display=this.attr.loading||this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("llm-button").style.display=this.attr.loading||!this.attr.llmButtonVisible||this.state.micActiv?"none":"",this.child("llm-button").innerText=this.attr.llmName||"LLM",this.child("loader").style.display=this.attr.loading?"block":"",this.child("microphone-button").style.display=!this.ai?.audio?.speechRecognition?.isSupported||this.attr.loading&&!this.ai?.audio?.speechRecognition.isRunning?"none":"",this.child("cancel-speech-button").style.display="none",this.ai?.audio?.speechRecognition.isRunning&&this.ai?.audio?.speechOutput.isSpeaking&&(this.child("microphone-button").style.display="none",this.child("cancel-speech-button").style.display=""),!this.attr.loading&&this._wasLoading&&this.child("input-field").focus(),this._wasLoading=this.attr.loading,this.child("microphone-button-bg").classList.toggle("active",!!this.ai?.audio?.speechRecognition.isRunning);let t=this.ai?.audio?.speechRecognition.isRunning&&!this.attr.loading;t&&!this.micStateAnimationTimer?this.micStateAnimationTimer=setInterval(()=>this.onMicAnimation(),1e3/60):!t&&this.micStateAnimationTimer&&(this.voiceAnimationPieces.forEach(a=>a.remove()),this.voiceAnimationPieces=[],clearInterval(this.micStateAnimationTimer),this.micStateAnimationTimer=void 0)}onInputKeyPress(t){if(t.stopPropagation(),t.key!="Enter")return;let a=this.child("input-field"),n=a.value?.trim();a.value="",n&&this.dispatchEvent(new CustomEvent("input-message",{detail:n}))}onLLMButtonClick(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("llm-button-click"))}onMicButtonClick(t){t.preventDefault(),this.ai.audio?.speechRecognition.isRunning?this.ai.audio?.speechRecognition.stop():this.ai.audio?.speechRecognition.start()}onMicAnimation(){if(!this.attr.loading){if(this._micAnimFrameCounter++,this._micAnimFrameCounter%5==0){let t="rgba(140, 170, 200, 0.5)";this.ai?.audio?.speechRecognition.voiceDetection?.isModelLoaded||(t="rgba(255, 0, 0, 0.5)"),this.ai?.audio?.speechRecognition.voiceDetection?.isTranscribing&&(t="rgba(96, 66, 245, 0.9)"),this.ai?.audio?.speechRecognition.wordsCurrentlyBeingSpoken&&(t="rgba(0, 128, 255, 0.9)"),this.ai?.audio?.speechRecognition.voiceDetection?.isVoicePossiblyEnding&&(t="rgba(0, 128, 255, 0.5)"),this.ai?.isProcessing&&(t="rgba(255, 255, 0, 0.5)"),this.ai?.audio?.speechOutput.isSpeaking&&(t="rgba(0, 255, 0, 0.5)");let a=this.ai?.audio?.speechRecognition.volumeLevel||0,n=30,i=6,s=Math.round(a*(n-i)+i),o=document.createElement("div");o.posX=50,o.style.cssText=`position: absolute; top: calc(50% - ${s}px/2); left: 0px; width: 6px; height: ${s}px; background-color: ${t}; border-radius: 3px; pointer-events: none; `,this.root?.appendChild(o),this.voiceAnimationPieces.push(o)}for(let t=0;t<this.voiceAnimationPieces.length;t++){let a=this.voiceAnimationPieces[t];a.posX+=2,a.style.transform=`translate(${a.posX}px, 0px)`,!(a.posX<400)&&(this.voiceAnimationPieces.splice(t--,1),a.remove())}}}onSpeechEvent(t){this.attr.loading||t.detail.isFinal&&this.dispatchEvent(new CustomEvent("input-message",{detail:t.detail.transcript}))}onCancelSpeechButtonClick(t){this.ai.audio?.speechOutput.interrupt(),this.onUpdate()}};Xi.observedAttributes=["loading","llmName","llmButtonVisible","textColor"];var sd='data:image/svg+xml,<svg id="eLjt8NmVnoY1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 300 300" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" project-id="defaf4a7213e40159eb368f9622a2af1" export-id="e0405e7e1d4a45c0a08fbbedb06a02a8" cached="false"><defs><radialGradient id="eLjt8NmVnoY6-fill" cx="0" cy="0" r="1" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-58.520001 292.985 -172.197 -34.394001 203.907 57.158)"><stop id="eLjt8NmVnoY6-fill-0" offset="0%" stop-color="%232b3d43"/><stop id="eLjt8NmVnoY6-fill-1" offset="33%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-2" offset="58%" stop-color="%23328897"/><stop id="eLjt8NmVnoY6-fill-3" offset="100%" stop-color="%237ebf96"/></radialGradient><radialGradient id="eLjt8NmVnoY7-fill" cx="0" cy="0" r="1.112049" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(182.129 -94.016999 94.016999 182.129 43.4553 184.626)"><stop id="eLjt8NmVnoY7-fill-0" offset="0%" stop-color="%233f2d2d"/><stop id="eLjt8NmVnoY7-fill-1" offset="28%" stop-color="%23c83b35"/><stop id="eLjt8NmVnoY7-fill-2" offset="81%" stop-color="%23f69153"/><stop id="eLjt8NmVnoY7-fill-3" offset="100%" stop-color="%23ffe388"/></radialGradient><radialGradient id="eLjt8NmVnoY9-fill" cx="0" cy="0" r="593.59" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.196117 0.98058 -0.578542 -0.115709 406.499077 117.274778)"><stop id="eLjt8NmVnoY9-fill-0" offset="0%" stop-color="%23252d3a"/><stop id="eLjt8NmVnoY9-fill-1" offset="60%" stop-color="%23c50"/><stop id="eLjt8NmVnoY9-fill-2" offset="100%" stop-color="%23fddc85"/></radialGradient><radialGradient id="eLjt8NmVnoY10-fill" cx="0" cy="0" r="454.77" spreadMethod="pad" gradientUnits="userSpaceOnUse" gradientTransform="translate(87.33 340.7)"><stop id="eLjt8NmVnoY10-fill-0" offset="0%" stop-color="%23002936"/><stop id="eLjt8NmVnoY10-fill-1" offset="44%" stop-color="%23007aa1"/><stop id="eLjt8NmVnoY10-fill-2" offset="67%" stop-color="%2326ab7f"/><stop id="eLjt8NmVnoY10-fill-3" offset="100%" stop-color="%2395e0c8"/></radialGradient></defs><g transform="matrix(.339855 0 0 0.339855 65.056641 64.89012)"><path d="M337.93,111.85c17.31-4.12,30.6-2.15,38.55,5.96c12.9,13.16,10.13,41.58-7.64,77.95-34.66,70.98-116.01,153.37-181.35,183.6-4.15,1.92-8.16,3.6-12.02,5.03l.05.18C83.95,418.36,13.7,365.53,1.49,278.27C15.34,403.24,121.28,500.43,249.94,500.43c138.07,0,250-111.93,250-250c0-9.8-.58-19.46-1.68-28.96-12-82.27-75.81-133.5-160.33-109.62Z" fill="url(%23eLjt8NmVnoY9-fill)"/><path d="M249.94,0.43c-138.07,0-250,111.93-250,250c0,9.41.54,18.69,1.55,27.84C13.7,365.54,83.95,418.36,175.52,384.58l-.05-.18c-11.22,4.17-21.17,6.24-29.61,6.24-9.59,0-17.18-2.67-22.44-8.03-12.9-13.19-10.13-41.61,7.64-77.98c18.26-37.41,49.51-77.98,84.51-112.41c31.45-32.33,62.2-54.66,91.14-68.47.16-.08.34-.16.49-.23c1.74-.85,3.47-1.68,5.18-2.49c9.22-4.27,17.77-7.33,25.54-9.17c84.52-23.88,148.33,27.35,160.33,109.62C483.91,97.04,378.22,0.43,249.94,0.43Z" fill="url(%23eLjt8NmVnoY10-fill)"/><path d="M337.93,111.85c-7.77,1.84-16.32,4.9-25.54,9.17-1.71.8-3.45,1.63-5.18,2.49-.16.08-.34.16-.49.23-28.94,13.81-59.69,36.14-91.14,68.47-35,34.43-66.24,75-84.51,112.41-17.77,36.37-20.54,64.79-7.64,77.98c5.26,5.36,12.85,8.03,22.44,8.03c8.45,0,18.39-2.07,29.61-6.24c3.86-1.42,7.88-3.11,12.02-5.03c65.34-30.23,146.68-112.62,181.35-183.6c17.77-36.37,20.54-64.79,7.64-77.95-7.95-8.11-21.24-10.08-38.55-5.96h-.01Z" fill="%23252d3a"/></g></svg>%0D%0A';var Yi=class extends Gt{constructor(){super(...arguments);this.html=()=>`
|
|
3388
3411
|
|
|
3389
3412
|
<!-- Styling -->
|
|
3390
3413
|
<style>
|
|
@@ -3427,14 +3450,14 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3427
3450
|
</style>
|
|
3428
3451
|
|
|
3429
3452
|
<!-- Logo -->
|
|
3430
|
-
<img id='root' src='${this.attr.logo||
|
|
3453
|
+
<img id='root' src='${this.attr.logo||sd}' />
|
|
3431
3454
|
|
|
3432
|
-
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),250)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let t=this.child("root");if(!t)return;let a=this.attr.logo||jl;this._lastLogoSrc!=a&&(this._lastLogoSrc=a,t.src=a);let n=window.visualViewport?.offsetTop||0,i=window.visualViewport?.offsetLeft||0,o=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(o){let s=o.getBoundingClientRect();if(!s)return;t.style.position="fixed",t.style.width="128px",t.style.height="128px",t.style.left=Math.round(s.x+s.width/2-128/2+i)+"px",t.style.top=Math.round(s.y+s.height/2-128/2+n)+"px"}else{let s=this.getBoundingClientRect();if(!s)return;t.style.width=s.width+"px",t.style.height=s.height+"px",t.style.left=Math.round(s.x+i)+"px",t.style.top=Math.round(s.y+n)+"px"}}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};Oa.observedAttributes=["logo","focusID"];var Wm=typeof self=="object"?self:globalThis,iE=(r,e)=>{let t=(n,i)=>(r.set(i,n),n),a=n=>{if(r.has(n))return r.get(n);let[i,o]=e[n];switch(i){case 0:case-1:return t(o,n);case 1:{let s=t([],n);for(let l of o)s.push(a(l));return s}case 2:{let s=t({},n);for(let[l,c]of o)s[a(l)]=a(c);return s}case 3:return t(new Date(o),n);case 4:{let{source:s,flags:l}=o;return t(new RegExp(s,l),n)}case 5:{let s=t(new Map,n);for(let[l,c]of o)s.set(a(l),a(c));return s}case 6:{let s=t(new Set,n);for(let l of o)s.add(a(l));return s}case 7:{let{name:s,message:l}=o;return t(new Wm[s](l),n)}case 8:return t(BigInt(o),n);case"BigInt":return t(Object(BigInt(o)),n)}return t(new Wm[i](o),n)};return a},Xl=r=>iE(new Map,r)(0);var na="",{toString:oE}={},{keys:sE}=Object,Ba=r=>{let e=typeof r;if(e!=="object"||!r)return[0,e];let t=oE.call(r).slice(8,-1);switch(t){case"Array":return[1,na];case"Object":return[2,na];case"Date":return[3,na];case"RegExp":return[4,na];case"Map":return[5,na];case"Set":return[6,na]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},Eo=([r,e])=>r===0&&(e==="function"||e==="symbol"),lE=(r,e,t,a)=>{let n=(o,s)=>{let l=a.push(o)-1;return t.set(s,l),l},i=o=>{if(t.has(o))return t.get(o);let[s,l]=Ba(o);switch(s){case 0:{let u=o;switch(l){case"bigint":s=8,u=o.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return n([-1],o)}return n([s,u],o)}case 1:{if(l)return n([l,[...o]],o);let u=[],p=n([s,u],o);for(let m of o)u.push(i(m));return p}case 2:{if(l)switch(l){case"BigInt":return n([l,o.toString()],o);case"Boolean":case"Number":case"String":return n([l,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());let u=[],p=n([s,u],o);for(let m of sE(o))(r||!Eo(Ba(o[m])))&&u.push([i(m),i(o[m])]);return p}case 3:return n([s,o.toISOString()],o);case 4:{let{source:u,flags:p}=o;return n([s,{source:u,flags:p}],o)}case 5:{let u=[],p=n([s,u],o);for(let[m,d]of o)(r||!(Eo(Ba(m))||Eo(Ba(d))))&&u.push([i(m),i(d)]);return p}case 6:{let u=[],p=n([s,u],o);for(let m of o)(r||!Eo(Ba(m)))&&u.push(i(m));return p}}let{message:c}=o;return n([s,{name:l,message:c}],o)};return i},Yl=(r,{json:e,lossy:t}={})=>{let a=[];return lE(!(e||t),!!e,new Map,a)(r),a};var ir=typeof structuredClone=="function"?(r,e)=>e&&("json"in e||"lossy"in e)?Xl(Yl(r,e)):structuredClone(r):(r,e)=>Xl(Yl(r,e));var or=function(r,e,t,a,n){let i=sr(e);if(t!=null&&(typeof t!="number"||t<0||t===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(a!=null&&(!a.type||!a.children))throw new Error("Expected valid `parent`");if(t==null!=(a==null))throw new Error("Expected both `index` and `parent`");return jm(r)?i.call(n,r,t,a):!1},sr=function(r){if(r==null)return dE;if(typeof r=="string")return uE(r);if(typeof r=="object")return cE(r);if(typeof r=="function")return Zl(r);throw new Error("Expected function, string, or array as `test`")};function cE(r){let e=[],t=-1;for(;++t<r.length;)e[t]=sr(r[t]);return Zl(a);function a(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function uE(r){return Zl(e);function e(t){return t.tagName===r}}function Zl(r){return e;function e(t,a,n){return!!(jm(t)&&r.call(this,t,typeof a=="number"?a:void 0,n||void 0))}}function dE(r){return!!(r&&typeof r=="object"&&"type"in r&&r.type==="element"&&"tagName"in r&&typeof r.tagName=="string")}function jm(r){return r!==null&&typeof r=="object"&&"type"in r&&"tagName"in r}var pE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,mE=/^[a-zA-Z]:\\/;function Jl(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return mE.test(r)?!1:pE.test(r)}function qm(r){let e=String(r||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function Km(r){return r.join(" ").trim()}var aa=function(r){if(r==null)return yE;if(typeof r=="function")return wo(r);if(typeof r=="object")return Array.isArray(r)?hE(r):gE(r);if(typeof r=="string")return fE(r);throw new Error("Expected function, string, or object as test")};function hE(r){let e=[],t=-1;for(;++t<r.length;)e[t]=aa(r[t]);return wo(a);function a(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function gE(r){let e=r;return wo(t);function t(a){let n=a,i;for(i in r)if(n[i]!==e[i])return!1;return!0}}function fE(r){return wo(e);function e(t){return t&&t.type===r}}function wo(r){return e;function e(t,a,n){return!!(bE(t)&&r.call(this,t,typeof a=="number"?a:void 0,n||void 0))}}function yE(){return!0}function bE(r){return r!==null&&typeof r=="object"&&"type"in r}var $m=[],Ql=!0,Co=!1,Ga="skip";function za(r,e,t,a){let n;typeof e=="function"&&typeof t!="function"?(a=t,t=e):n=e;let i=aa(n),o=a?-1:1;s(r,void 0,[])();function s(l,c,u){let p=l&&typeof l=="object"?l:{};if(typeof p.type=="string"){let d=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return m;function m(){let d=$m,g,f,y;if((!e||i(l,c,u[u.length-1]||void 0))&&(d=vE(t(l,u)),d[0]===Co))return d;if("children"in l&&l.children){let v=l;if(v.children&&d[0]!==Ga)for(f=(a?v.children.length:-1)+o,y=u.concat(v);f>-1&&f<v.children.length;){let T=v.children[f];if(g=s(T,f,y)(),g[0]===Co)return g;f=typeof g[1]=="number"?g[1]:f+o}}return d}}}function vE(r){return Array.isArray(r)?r:typeof r=="number"?[Ql,r]:r==null?$m:[r]}function Ua(r,e,t,a){let n,i,o;typeof e=="function"&&typeof t!="function"?(i=void 0,o=e,n=t):(i=e,o=t,n=a),za(r,i,s,n);function s(l,c){let u=c[c.length-1],p=u?u.children.indexOf(l):void 0;return o(l,p,u)}}var _E=["http","https"],SE=["nofollow"],EE={};function ko(r){let e=r||EE,t=e.protocols||_E,a=sr(e.test);return function(n){Ua(n,"element",function(i,o,s){if(i.tagName==="a"&&typeof i.properties.href=="string"&&a(i,o,s)){let l=i.properties.href;if(Jl(l)?t.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=Ha(e.content,i),u=c&&!Array.isArray(c)?[c]:c,p=Ha(e.rel,i)||SE,m=typeof p=="string"?qm(p):p,d=Ha(e.target,i),g=Ha(e.properties,i);if(g&&Object.assign(i.properties,ir(g)),m.length>0&&(i.properties.rel=[...m]),d&&(i.properties.target=d),u){let f=Ha(e.contentProperties,i)||{};i.children.push({type:"element",tagName:"span",properties:ir(f),children:ir(u)})}}}})}}function Ha(r,e){return typeof r=="function"?r(e):r}var bn=sr(function(r){return r.tagName==="audio"||r.tagName==="canvas"||r.tagName==="embed"||r.tagName==="iframe"||r.tagName==="img"||r.tagName==="math"||r.tagName==="object"||r.tagName==="picture"||r.tagName==="svg"||r.tagName==="video"});var wE={}.hasOwnProperty;function ec(r,e){let t=r.type==="element"&&wE.call(r.properties,e)&&r.properties[e];return t!=null&&t!==!1}var CE=new Set(["pingback","prefetch","stylesheet"]);function tc(r){if(r.type!=="element"||r.tagName!=="link")return!1;if(r.properties.itemProp)return!0;let e=r.properties.rel,t=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++t<e.length;)if(!CE.has(String(e[t])))return!1;return!0}var kE=sr(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),TE=sr("meta");function rc(r){return!!(r.type==="text"||kE(r)||bn(r)||tc(r)||TE(r)&&ec(r,"itemProp"))}var xE=/[ \t\n\f\r]/g;function It(r){return typeof r=="object"?r.type==="text"?Xm(r.value):!1:Xm(r)}function Xm(r){return r.replace(xE,"")===""}var nc=["pre","script","style","textarea"];var Ym=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var Zm=["button","input","select","textarea"];var Jm=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var AE={},ac=aa(["doctype","comment"]);function To(r){let t=LE((r||AE).newlines?NE:OE);return function(a){eh(a,{collapse:t,whitespace:"normal"})}}function eh(r,e){if("children"in r){let t={...e};return(r.type==="root"||nh(r))&&(t.before=!0,t.after=!0),t.whitespace=ME(r,e),RE(r,t)}if(r.type==="text"){if(e.whitespace==="normal")return IE(r,e);e.whitespace==="nowrap"&&(r.value=e.collapse(r.value))}return{ignore:ac(r),stripAtStart:!1,remove:!1}}function IE(r,e){let t=e.collapse(r.value),a={ignore:!1,stripAtStart:!1,remove:!1},n=0,i=t.length;return e.before&&Qm(t.charAt(0))&&n++,n!==i&&Qm(t.charAt(i-1))&&(e.after?i--:a.stripAtStart=!0),n===i?a.remove=!0:r.value=t.slice(n,i),a}function RE(r,e){let t=e.before,a=e.after,n=r.children,i=n.length,o=-1;for(;++o<i;){let s=eh(n[o],{...e,after:th(n,o,a),before:t});s.remove?(n.splice(o,1),o--,i--):s.ignore||(t=s.stripAtStart),rh(n[o])&&(t=!1)}return{ignore:!1,stripAtStart:!!(t||a),remove:!1}}function th(r,e,t){for(;++e<r.length;){let a=r[e],n=PE(a);if(n===void 0&&"children"in a&&!DE(a)&&(n=th(a.children,-1)),typeof n=="boolean")return n}return t}function PE(r){if(r.type==="element"){if(rh(r))return!1;if(nh(r))return!0}else if(r.type==="text"){if(!It(r))return!1}else if(!ac(r))return!1}function rh(r){return bn(r)||or(r,Zm)}function nh(r){return or(r,Ym)}function DE(r){return!!(r.type==="element"&&r.properties.hidden)||ac(r)||or(r,Jm)}function Qm(r){return r===" "||r===`
|
|
3433
|
-
`}function
|
|
3434
|
-
`)&&(d=!0),y.value=y.value.replace(/ *\n/g,"$&"+String(t).repeat(m)))}let g=[],f;for(u=-1;++u<p.length;){let y=p[u];(
|
|
3455
|
+
`;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),250)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let t=this.child("root");if(!t)return;let a=this.attr.logo||sd;this._lastLogoSrc!=a&&(this._lastLogoSrc=a,t.src=a);let n=window.visualViewport?.offsetTop||0,i=window.visualViewport?.offsetLeft||0,s=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(s){let o=s.getBoundingClientRect();if(!o)return;t.style.position="fixed",t.style.width="128px",t.style.height="128px",t.style.left=Math.round(o.x+o.width/2-128/2+i)+"px",t.style.top=Math.round(o.y+o.height/2-128/2+n)+"px"}else{let o=this.getBoundingClientRect();if(!o)return;t.style.width=o.width+"px",t.style.height=o.height+"px",t.style.left=Math.round(o.x+i)+"px",t.style.top=Math.round(o.y+n)+"px"}}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};Yi.observedAttributes=["logo","focusID"];var Uf=typeof self=="object"?self:globalThis,MC=(r,e)=>{let t=(n,i)=>(r.set(i,n),n),a=n=>{if(r.has(n))return r.get(n);let[i,s]=e[n];switch(i){case 0:case-1:return t(s,n);case 1:{let o=t([],n);for(let l of s)o.push(a(l));return o}case 2:{let o=t({},n);for(let[l,c]of s)o[a(l)]=a(c);return o}case 3:return t(new Date(s),n);case 4:{let{source:o,flags:l}=s;return t(new RegExp(o,l),n)}case 5:{let o=t(new Map,n);for(let[l,c]of s)o.set(a(l),a(c));return o}case 6:{let o=t(new Set,n);for(let l of s)o.add(a(l));return o}case 7:{let{name:o,message:l}=s;return t(new Uf[o](l),n)}case 8:return t(BigInt(s),n);case"BigInt":return t(Object(BigInt(s)),n)}return t(new Uf[i](s),n)};return a},ud=r=>MC(new Map,r)(0);var ei="",{toString:OC}={},{keys:LC}=Object,es=r=>{let e=typeof r;if(e!=="object"||!r)return[0,e];let t=OC.call(r).slice(8,-1);switch(t){case"Array":return[1,ei];case"Object":return[2,ei];case"Date":return[3,ei];case"RegExp":return[4,ei];case"Map":return[5,ei];case"Set":return[6,ei]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},pl=([r,e])=>r===0&&(e==="function"||e==="symbol"),BC=(r,e,t,a)=>{let n=(s,o)=>{let l=a.push(s)-1;return t.set(o,l),l},i=s=>{if(t.has(s))return t.get(s);let[o,l]=es(s);switch(o){case 0:{let u=s;switch(l){case"bigint":o=8,u=s.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return n([-1],s)}return n([o,u],s)}case 1:{if(l)return n([l,[...s]],s);let u=[],p=n([o,u],s);for(let m of s)u.push(i(m));return p}case 2:{if(l)switch(l){case"BigInt":return n([l,s.toString()],s);case"Boolean":case"Number":case"String":return n([l,s.valueOf()],s)}if(e&&"toJSON"in s)return i(s.toJSON());let u=[],p=n([o,u],s);for(let m of LC(s))(r||!pl(es(s[m])))&&u.push([i(m),i(s[m])]);return p}case 3:return n([o,s.toISOString()],s);case 4:{let{source:u,flags:p}=s;return n([o,{source:u,flags:p}],s)}case 5:{let u=[],p=n([o,u],s);for(let[m,d]of s)(r||!(pl(es(m))||pl(es(d))))&&u.push([i(m),i(d)]);return p}case 6:{let u=[],p=n([o,u],s);for(let m of s)(r||!pl(es(m)))&&u.push(i(m));return p}}let{message:c}=s;return n([o,{name:l,message:c}],s)};return i},dd=(r,{json:e,lossy:t}={})=>{let a=[];return BC(!(e||t),!!e,new Map,a)(r),a};var wr=typeof structuredClone=="function"?(r,e)=>e&&("json"in e||"lossy"in e)?ud(dd(r,e)):structuredClone(r):(r,e)=>ud(dd(r,e));var kr=function(r,e,t,a,n){let i=Cr(e);if(t!=null&&(typeof t!="number"||t<0||t===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(a!=null&&(!a.type||!a.children))throw new Error("Expected valid `parent`");if(t==null!=(a==null))throw new Error("Expected both `index` and `parent`");return Hf(r)?i.call(n,r,t,a):!1},Cr=function(r){if(r==null)return zC;if(typeof r=="string")return GC(r);if(typeof r=="object")return FC(r);if(typeof r=="function")return pd(r);throw new Error("Expected function, string, or array as `test`")};function FC(r){let e=[],t=-1;for(;++t<r.length;)e[t]=Cr(r[t]);return pd(a);function a(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function GC(r){return pd(e);function e(t){return t.tagName===r}}function pd(r){return e;function e(t,a,n){return!!(Hf(t)&&r.call(this,t,typeof a=="number"?a:void 0,n||void 0))}}function zC(r){return!!(r&&typeof r=="object"&&"type"in r&&r.type==="element"&&"tagName"in r&&typeof r.tagName=="string")}function Hf(r){return r!==null&&typeof r=="object"&&"type"in r&&"tagName"in r}var UC=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,HC=/^[a-zA-Z]:\\/;function md(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);return HC.test(r)?!1:UC.test(r)}function Vf(r){let e=String(r||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function jf(r){return r.join(" ").trim()}var ti=function(r){if(r==null)return qC;if(typeof r=="function")return ml(r);if(typeof r=="object")return Array.isArray(r)?VC(r):jC(r);if(typeof r=="string")return WC(r);throw new Error("Expected function, string, or object as test")};function VC(r){let e=[],t=-1;for(;++t<r.length;)e[t]=ti(r[t]);return ml(a);function a(...n){let i=-1;for(;++i<e.length;)if(e[i].apply(this,n))return!0;return!1}}function jC(r){let e=r;return ml(t);function t(a){let n=a,i;for(i in r)if(n[i]!==e[i])return!1;return!0}}function WC(r){return ml(e);function e(t){return t&&t.type===r}}function ml(r){return e;function e(t,a,n){return!!($C(t)&&r.call(this,t,typeof a=="number"?a:void 0,n||void 0))}}function qC(){return!0}function $C(r){return r!==null&&typeof r=="object"&&"type"in r}var Wf=[],hd=!0,hl=!1,ts="skip";function rs(r,e,t,a){let n;typeof e=="function"&&typeof t!="function"?(a=t,t=e):n=e;let i=ti(n),s=a?-1:1;o(r,void 0,[])();function o(l,c,u){let p=l&&typeof l=="object"?l:{};if(typeof p.type=="string"){let d=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(d?"<"+d+">":""))+")"})}return m;function m(){let d=Wf,g,f,y;if((!e||i(l,c,u[u.length-1]||void 0))&&(d=KC(t(l,u)),d[0]===hl))return d;if("children"in l&&l.children){let b=l;if(b.children&&d[0]!==ts)for(f=(a?b.children.length:-1)+s,y=u.concat(b);f>-1&&f<b.children.length;){let x=b.children[f];if(g=o(x,f,y)(),g[0]===hl)return g;f=typeof g[1]=="number"?g[1]:f+s}}return d}}}function KC(r){return Array.isArray(r)?r:typeof r=="number"?[hd,r]:r==null?Wf:[r]}function ns(r,e,t,a){let n,i,s;typeof e=="function"&&typeof t!="function"?(i=void 0,s=e,n=t):(i=e,s=t,n=a),rs(r,i,o,n);function o(l,c){let u=c[c.length-1],p=u?u.children.indexOf(l):void 0;return s(l,p,u)}}var XC=["http","https"],YC=["nofollow"],JC={};function gl(r){let e=r||JC,t=e.protocols||XC,a=Cr(e.test);return function(n){ns(n,"element",function(i,s,o){if(i.tagName==="a"&&typeof i.properties.href=="string"&&a(i,s,o)){let l=i.properties.href;if(md(l)?t.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=as(e.content,i),u=c&&!Array.isArray(c)?[c]:c,p=as(e.rel,i)||YC,m=typeof p=="string"?Vf(p):p,d=as(e.target,i),g=as(e.properties,i);if(g&&Object.assign(i.properties,wr(g)),m.length>0&&(i.properties.rel=[...m]),d&&(i.properties.target=d),u){let f=as(e.contentProperties,i)||{};i.children.push({type:"element",tagName:"span",properties:wr(f),children:wr(u)})}}}})}}function as(r,e){return typeof r=="function"?r(e):r}var Jn=Cr(function(r){return r.tagName==="audio"||r.tagName==="canvas"||r.tagName==="embed"||r.tagName==="iframe"||r.tagName==="img"||r.tagName==="math"||r.tagName==="object"||r.tagName==="picture"||r.tagName==="svg"||r.tagName==="video"});var ZC={}.hasOwnProperty;function gd(r,e){let t=r.type==="element"&&ZC.call(r.properties,e)&&r.properties[e];return t!=null&&t!==!1}var QC=new Set(["pingback","prefetch","stylesheet"]);function fd(r){if(r.type!=="element"||r.tagName!=="link")return!1;if(r.properties.itemProp)return!0;let e=r.properties.rel,t=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++t<e.length;)if(!QC.has(String(e[t])))return!1;return!0}var ex=Cr(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),tx=Cr("meta");function yd(r){return!!(r.type==="text"||ex(r)||Jn(r)||fd(r)||tx(r)&&gd(r,"itemProp"))}var rx=/[ \t\n\f\r]/g;function zt(r){return typeof r=="object"?r.type==="text"?qf(r.value):!1:qf(r)}function qf(r){return r.replace(rx,"")===""}var bd=["pre","script","style","textarea"];var $f=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var Kf=["button","input","select","textarea"];var Xf=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var nx={},vd=ti(["doctype","comment"]);function fl(r){let t=ux((r||nx).newlines?lx:cx);return function(a){Jf(a,{collapse:t,whitespace:"normal"})}}function Jf(r,e){if("children"in r){let t={...e};return(r.type==="root"||ey(r))&&(t.before=!0,t.after=!0),t.whitespace=dx(r,e),ix(r,t)}if(r.type==="text"){if(e.whitespace==="normal")return ax(r,e);e.whitespace==="nowrap"&&(r.value=e.collapse(r.value))}return{ignore:vd(r),stripAtStart:!1,remove:!1}}function ax(r,e){let t=e.collapse(r.value),a={ignore:!1,stripAtStart:!1,remove:!1},n=0,i=t.length;return e.before&&Yf(t.charAt(0))&&n++,n!==i&&Yf(t.charAt(i-1))&&(e.after?i--:a.stripAtStart=!0),n===i?a.remove=!0:r.value=t.slice(n,i),a}function ix(r,e){let t=e.before,a=e.after,n=r.children,i=n.length,s=-1;for(;++s<i;){let o=Jf(n[s],{...e,after:Zf(n,s,a),before:t});o.remove?(n.splice(s,1),s--,i--):o.ignore||(t=o.stripAtStart),Qf(n[s])&&(t=!1)}return{ignore:!1,stripAtStart:!!(t||a),remove:!1}}function Zf(r,e,t){for(;++e<r.length;){let a=r[e],n=sx(a);if(n===void 0&&"children"in a&&!ox(a)&&(n=Zf(a.children,-1)),typeof n=="boolean")return n}return t}function sx(r){if(r.type==="element"){if(Qf(r))return!1;if(ey(r))return!0}else if(r.type==="text"){if(!zt(r))return!1}else if(!vd(r))return!1}function Qf(r){return Jn(r)||kr(r,Kf)}function ey(r){return kr(r,$f)}function ox(r){return!!(r.type==="element"&&r.properties.hidden)||vd(r)||kr(r,Xf)}function Yf(r){return r===" "||r===`
|
|
3456
|
+
`}function lx(r){let e=/\r?\n|\r/.exec(r);return e?e[0]:" "}function cx(){return" "}function ux(r){return e;function e(t){return String(t).replace(/[\t\n\v\f\r ]+/g,r)}}function dx(r,e){if("tagName"in r&&r.properties)switch(r.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return r.properties.wrap?"pre-wrap":"pre";case"td":case"th":return r.properties.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap";default:}return e.whitespace}var px={},mx=fl({newlines:!0});function yl(r){let e=r||px,t=e.indent||2,a=e.indentInitial;return typeof t=="number"&&(t=" ".repeat(t)),a==null&&(a=!0),function(s){let o;mx(s),rs(s,function(l,c){let u=-1;if(!("children"in l))return;if(kr(l,"head")&&(o=!0),o&&kr(l,"body")&&(o=void 0),kr(l,bd))return ts;let p=l.children,m=c.length;if(p.length===0||!_d(l,o))return;a||m--;let d;for(;++u<p.length;){let y=p[u];(y.type==="text"||y.type==="comment")&&(y.value.includes(`
|
|
3457
|
+
`)&&(d=!0),y.value=y.value.replace(/ *\n/g,"$&"+String(t).repeat(m)))}let g=[],f;for(u=-1;++u<p.length;){let y=p[u];(_d(y,o)||d&&!u)&&(n(g,m,y),d=!0),f=y,g.push(y)}f&&(d||_d(f,o))&&(zt(f)&&(g.pop(),f=g[g.length-1]),n(g,m-1)),l.children=g})};function n(s,o,l){let c=s[s.length-1],u=c&&zt(c)?s[s.length-2]:c,p=(i(u)&&i(l)?`
|
|
3435
3458
|
|
|
3436
3459
|
`:`
|
|
3437
|
-
`)+String(t).repeat(Math.max(s,0));c&&c.type==="text"?c.value=It(c)?p:c.value+p:o.push({type:"text",value:p})}function i(o){return!!(o&&o.type==="element"&&e.blanks&&e.blanks.length>0&&e.blanks.includes(o.tagName))}}function ic(r,e){return r.type==="root"||(r.type==="element"?e||or(r,"script")||bn(r)||!rc(r):!1)}var ah=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Sr=class{constructor(e,t,a){this.property=e,this.normal=t,a&&(this.space=a)}};Sr.prototype.property={};Sr.prototype.normal={};Sr.prototype.space=null;function oc(r,e){let t={},a={},n=-1;for(;++n<r.length;)Object.assign(t,r[n].property),Object.assign(a,r[n].normal);return new Sr(t,a,e)}function Va(r){return r.toLowerCase()}var st=class{constructor(e,t){this.property=e,this.attribute=t}};st.prototype.space=null;st.prototype.boolean=!1;st.prototype.booleanish=!1;st.prototype.overloadedBoolean=!1;st.prototype.number=!1;st.prototype.commaSeparated=!1;st.prototype.spaceSeparated=!1;st.prototype.commaOrSpaceSeparated=!1;st.prototype.mustUseProperty=!1;st.prototype.defined=!1;var Wa={};ws(Wa,{boolean:()=>ae,booleanish:()=>ze,commaOrSpaceSeparated:()=>Et,commaSeparated:()=>Br,number:()=>H,overloadedBoolean:()=>sc,spaceSeparated:()=>ke});var GE=0,ae=vn(),ze=vn(),sc=vn(),H=vn(),ke=vn(),Br=vn(),Et=vn();function vn(){return 2**++GE}var lc=Object.keys(Wa),_n=class extends st{constructor(e,t,a,n){let i=-1;if(super(e,t),ih(this,"space",n),typeof a=="number")for(;++i<lc.length;){let o=lc[i];ih(this,lc[i],(a&Wa[o])===Wa[o])}}};_n.prototype.defined=!0;function ih(r,e,t){t&&(r[e]=t)}var zE={}.hasOwnProperty;function Ht(r){let e={},t={},a;for(a in r.properties)if(zE.call(r.properties,a)){let n=r.properties[a],i=new _n(a,r.transform(r.attributes||{},a),n,r.space);r.mustUseProperty&&r.mustUseProperty.includes(a)&&(i.mustUseProperty=!0),e[a]=i,t[Va(a)]=a,t[Va(i.attribute)]=a}return new Sr(e,t,r.space)}var cc=Ht({space:"xlink",transform(r,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var uc=Ht({space:"xml",transform(r,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Ao(r,e){return e in r?r[e]:e}function Io(r,e){return Ao(r,e.toLowerCase())}var dc=Ht({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:Io,properties:{xmlns:null,xmlnsXLink:null}});var pc=Ht({transform(r,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:ze,ariaAutoComplete:null,ariaBusy:ze,ariaChecked:ze,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:ke,ariaCurrent:null,ariaDescribedBy:ke,ariaDetails:null,ariaDisabled:ze,ariaDropEffect:ke,ariaErrorMessage:null,ariaExpanded:ze,ariaFlowTo:ke,ariaGrabbed:ze,ariaHasPopup:null,ariaHidden:ze,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ke,ariaLevel:H,ariaLive:null,ariaModal:ze,ariaMultiLine:ze,ariaMultiSelectable:ze,ariaOrientation:null,ariaOwns:ke,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:ze,ariaReadOnly:ze,ariaRelevant:null,ariaRequired:ze,ariaRoleDescription:ke,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:ze,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null}});var oh=Ht({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:Io,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Br,acceptCharset:ke,accessKey:ke,action:null,allow:null,allowFullScreen:ae,allowPaymentRequest:ae,allowUserMedia:ae,alt:null,as:null,async:ae,autoCapitalize:null,autoComplete:ke,autoFocus:ae,autoPlay:ae,blocking:ke,capture:null,charSet:null,checked:ae,cite:null,className:ke,cols:H,colSpan:null,content:null,contentEditable:ze,controls:ae,controlsList:ke,coords:H|Br,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ae,defer:ae,dir:null,dirName:null,disabled:ae,download:sc,draggable:ze,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ae,formTarget:null,headers:ke,height:H,hidden:ae,high:H,href:null,hrefLang:null,htmlFor:ke,httpEquiv:ke,id:null,imageSizes:null,imageSrcSet:null,inert:ae,inputMode:null,integrity:null,is:null,isMap:ae,itemId:null,itemProp:ke,itemRef:ke,itemScope:ae,itemType:ke,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ae,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:ae,muted:ae,name:null,nonce:null,noModule:ae,noValidate:ae,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ae,optimum:H,pattern:null,ping:ke,placeholder:null,playsInline:ae,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ae,referrerPolicy:null,rel:ke,required:ae,reversed:ae,rows:H,rowSpan:H,sandbox:ke,scope:null,scoped:ae,seamless:ae,selected:ae,shadowRootClonable:ae,shadowRootDelegatesFocus:ae,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:ze,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:ae,useMap:null,value:ze,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ke,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ae,declare:ae,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:ae,noHref:ae,noShade:ae,noWrap:ae,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:ze,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ae,disableRemotePlayback:ae,prefix:null,property:null,results:H,security:null,unselectable:null}});var sh=Ht({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:Ao,properties:{about:Et,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:ke,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:ae,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Br,g2:Br,glyphName:Br,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:Et,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ke,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Et,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Et,rev:Et,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Et,requiredFeatures:Et,requiredFonts:Et,requiredFormats:Et,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:Et,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Et,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Et,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var UE=/^data[-\w.:]+$/i,lh=/-[a-z]/g,HE=/[A-Z]/g;function mc(r,e){let t=Va(e),a=e,n=st;if(t in r.normal)return r.property[r.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&UE.test(e)){if(e.charAt(4)==="-"){let i=e.slice(5).replace(lh,WE);a="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=e.slice(4);if(!lh.test(i)){let o=i.replace(HE,VE);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}n=_n}return new n(a,e)}function VE(r){return"-"+r.toLowerCase()}function WE(r){return r.charAt(1).toUpperCase()}var ch=oc([uc,cc,dc,pc,oh],"html"),Ro=oc([uc,cc,dc,pc,sh],"svg");var uh={}.hasOwnProperty;function dh(r,e){let t=e||{};function a(n,...i){let o=a.invalid,s=a.handlers;if(n&&uh.call(n,r)){let l=String(n[r]);o=uh.call(s,l)?s[l]:a.unknown}if(o)return o.call(this,n,...i)}return a.handlers=t.handlers||{},a.invalid=t.invalid,a.unknown=t.unknown,a}var jE=/["&'<>`]/g,qE=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,KE=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,$E=/[|\\{}()[\]^$+*?.]/g,ph=new WeakMap;function mh(r,e){if(r=r.replace(e.subset?XE(e.subset):jE,a),e.subset||e.escapeOnly)return r;return r.replace(qE,t).replace(KE,a);function t(n,i,o){return e.format((n.charCodeAt(0)-55296)*1024+n.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function a(n,i,o){return e.format(n.charCodeAt(0),o.charCodeAt(i+1),e)}}function XE(r){let e=ph.get(r);return e||(e=YE(r),ph.set(r,e)),e}function YE(r){let e=[],t=-1;for(;++t<r.length;)e.push(r[t].replace($E,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var ZE=/[\dA-Fa-f]/;function hh(r,e,t){let a="&#x"+r.toString(16).toUpperCase();return t&&e&&!ZE.test(String.fromCharCode(e))?a:a+";"}var JE=/\d/;function gh(r,e,t){let a="&#"+String(r);return t&&e&&!JE.test(String.fromCharCode(e))?a:a+";"}var fh=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Po={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var yh=["cent","copy","divide","gt","lt","not","para","times"];var bh={}.hasOwnProperty,hc={},Do;for(Do in Po)bh.call(Po,Do)&&(hc[Po[Do]]=Do);var QE=/[^\dA-Za-z]/;function vh(r,e,t,a){let n=String.fromCharCode(r);if(bh.call(hc,n)){let i=hc[n],o="&"+i;return t&&fh.includes(i)&&!yh.includes(i)&&(!a||e&&e!==61&&QE.test(String.fromCharCode(e)))?o:o+";"}return""}function _h(r,e,t){let a=hh(r,e,t.omitOptionalSemicolons),n;if((t.useNamedReferences||t.useShortestReferences)&&(n=vh(r,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!n)&&t.useShortestReferences){let i=gh(r,e,t.omitOptionalSemicolons);i.length<a.length&&(a=i)}return n&&(!t.useShortestReferences||n.length<a.length)?n:a}function Er(r,e){return mh(r,Object.assign({format:_h},e))}var ew=/^>|^->|<!--|-->|--!>|<!-$/g,tw=[">"],rw=["<",">"];function Sh(r,e,t,a){return a.settings.bogusComments?"<?"+Er(r.value,Object.assign({},a.settings.characterReferences,{subset:tw}))+">":"<!--"+r.value.replace(ew,n)+"-->";function n(i){return Er(i,Object.assign({},a.settings.characterReferences,{subset:rw}))}}function Eh(r,e,t,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}function gc(r,e){let t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let a=0,n=t.indexOf(e);for(;n!==-1;)a++,n=t.indexOf(e,n+e.length);return a}function wh(r,e){let t=e||{};return(r[r.length-1]===""?[...r,""]:r).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var He=Ch(1),fc=Ch(-1),nw=[];function Ch(r){return e;function e(t,a,n){let i=t?t.children:nw,o=(a||0)+r,s=i[o];if(!n)for(;s&&It(s);)o+=r,s=i[o];return s}}var aw={}.hasOwnProperty;function No(r){return e;function e(t,a,n){return aw.call(r,t.tagName)&&r[t.tagName](t,a,n)}}var ja=No({body:ow,caption:yc,colgroup:yc,dd:uw,dt:cw,head:yc,html:iw,li:lw,optgroup:dw,option:pw,p:sw,rp:kh,rt:kh,tbody:hw,td:Th,tfoot:gw,th:Th,thead:mw,tr:fw});function yc(r,e,t){let a=He(t,e,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&It(a.value.charAt(0)))}function iw(r,e,t){let a=He(t,e);return!a||a.type!=="comment"}function ow(r,e,t){let a=He(t,e);return!a||a.type!=="comment"}function sw(r,e,t){let a=He(t,e);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function lw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&a.tagName==="li"}function cw(r,e,t){let a=He(t,e);return!!(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function uw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function kh(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function dw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&a.tagName==="optgroup"}function pw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function mw(r,e,t){let a=He(t,e);return!!(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function hw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function gw(r,e,t){return!He(t,e)}function fw(r,e,t){let a=He(t,e);return!a||a.type==="element"&&a.tagName==="tr"}function Th(r,e,t){let a=He(t,e);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}var xh=No({body:vw,colgroup:_w,head:bw,html:yw,tbody:Sw});function yw(r){let e=He(r,-1);return!e||e.type!=="comment"}function bw(r){let e=r.children,t=[],a=-1;for(;++a<e.length;){let n=e[a];if(n.type==="element"&&(n.tagName==="title"||n.tagName==="base")){if(t.includes(n.tagName))return!1;t.push(n.tagName)}}return e.length>0}function vw(r){let e=He(r,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&It(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function _w(r,e,t){let a=fc(t,e),n=He(r,-1,!0);return t&&a&&a.type==="element"&&a.tagName==="colgroup"&&ja(a,t.children.indexOf(a),t)?!1:!!(n&&n.type==="element"&&n.tagName==="col")}function Sw(r,e,t){let a=fc(t,e),n=He(r,-1);return t&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&ja(a,t.children.indexOf(a),t)?!1:!!(n&&n.type==="element"&&n.tagName==="tr")}var Oo={name:[[`
|
|
3460
|
+
`)+String(t).repeat(Math.max(o,0));c&&c.type==="text"?c.value=zt(c)?p:c.value+p:s.push({type:"text",value:p})}function i(s){return!!(s&&s.type==="element"&&e.blanks&&e.blanks.length>0&&e.blanks.includes(s.tagName))}}function _d(r,e){return r.type==="root"||(r.type==="element"?e||kr(r,"script")||Jn(r)||!yd(r):!1)}var ty=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var jr=class{constructor(e,t,a){this.property=e,this.normal=t,a&&(this.space=a)}};jr.prototype.property={};jr.prototype.normal={};jr.prototype.space=null;function Sd(r,e){let t={},a={},n=-1;for(;++n<r.length;)Object.assign(t,r[n].property),Object.assign(a,r[n].normal);return new jr(t,a,e)}function is(r){return r.toLowerCase()}var yt=class{constructor(e,t){this.property=e,this.attribute=t}};yt.prototype.space=null;yt.prototype.boolean=!1;yt.prototype.booleanish=!1;yt.prototype.overloadedBoolean=!1;yt.prototype.number=!1;yt.prototype.commaSeparated=!1;yt.prototype.spaceSeparated=!1;yt.prototype.commaOrSpaceSeparated=!1;yt.prototype.mustUseProperty=!1;yt.prototype.defined=!1;var ss={};mc(ss,{boolean:()=>oe,booleanish:()=>We,commaOrSpaceSeparated:()=>Dt,commaSeparated:()=>mn,number:()=>V,overloadedBoolean:()=>Ed,spaceSeparated:()=>Ie});var hx=0,oe=Zn(),We=Zn(),Ed=Zn(),V=Zn(),Ie=Zn(),mn=Zn(),Dt=Zn();function Zn(){return 2**++hx}var wd=Object.keys(ss),Qn=class extends yt{constructor(e,t,a,n){let i=-1;if(super(e,t),ry(this,"space",n),typeof a=="number")for(;++i<wd.length;){let s=wd[i];ry(this,wd[i],(a&ss[s])===ss[s])}}};Qn.prototype.defined=!0;function ry(r,e,t){t&&(r[e]=t)}var gx={}.hasOwnProperty;function nr(r){let e={},t={},a;for(a in r.properties)if(gx.call(r.properties,a)){let n=r.properties[a],i=new Qn(a,r.transform(r.attributes||{},a),n,r.space);r.mustUseProperty&&r.mustUseProperty.includes(a)&&(i.mustUseProperty=!0),e[a]=i,t[is(a)]=a,t[is(i.attribute)]=a}return new jr(e,t,r.space)}var kd=nr({space:"xlink",transform(r,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var Cd=nr({space:"xml",transform(r,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function bl(r,e){return e in r?r[e]:e}function vl(r,e){return bl(r,e.toLowerCase())}var xd=nr({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:vl,properties:{xmlns:null,xmlnsXLink:null}});var Td=nr({transform(r,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:We,ariaAutoComplete:null,ariaBusy:We,ariaChecked:We,ariaColCount:V,ariaColIndex:V,ariaColSpan:V,ariaControls:Ie,ariaCurrent:null,ariaDescribedBy:Ie,ariaDetails:null,ariaDisabled:We,ariaDropEffect:Ie,ariaErrorMessage:null,ariaExpanded:We,ariaFlowTo:Ie,ariaGrabbed:We,ariaHasPopup:null,ariaHidden:We,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ie,ariaLevel:V,ariaLive:null,ariaModal:We,ariaMultiLine:We,ariaMultiSelectable:We,ariaOrientation:null,ariaOwns:Ie,ariaPlaceholder:null,ariaPosInSet:V,ariaPressed:We,ariaReadOnly:We,ariaRelevant:null,ariaRequired:We,ariaRoleDescription:Ie,ariaRowCount:V,ariaRowIndex:V,ariaRowSpan:V,ariaSelected:We,ariaSetSize:V,ariaSort:null,ariaValueMax:V,ariaValueMin:V,ariaValueNow:V,ariaValueText:null,role:null}});var ny=nr({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:vl,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:mn,acceptCharset:Ie,accessKey:Ie,action:null,allow:null,allowFullScreen:oe,allowPaymentRequest:oe,allowUserMedia:oe,alt:null,as:null,async:oe,autoCapitalize:null,autoComplete:Ie,autoFocus:oe,autoPlay:oe,blocking:Ie,capture:null,charSet:null,checked:oe,cite:null,className:Ie,cols:V,colSpan:null,content:null,contentEditable:We,controls:oe,controlsList:Ie,coords:V|mn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:oe,defer:oe,dir:null,dirName:null,disabled:oe,download:Ed,draggable:We,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:oe,formTarget:null,headers:Ie,height:V,hidden:oe,high:V,href:null,hrefLang:null,htmlFor:Ie,httpEquiv:Ie,id:null,imageSizes:null,imageSrcSet:null,inert:oe,inputMode:null,integrity:null,is:null,isMap:oe,itemId:null,itemProp:Ie,itemRef:Ie,itemScope:oe,itemType:Ie,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:oe,low:V,manifest:null,max:null,maxLength:V,media:null,method:null,min:null,minLength:V,multiple:oe,muted:oe,name:null,nonce:null,noModule:oe,noValidate:oe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:oe,optimum:V,pattern:null,ping:Ie,placeholder:null,playsInline:oe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:oe,referrerPolicy:null,rel:Ie,required:oe,reversed:oe,rows:V,rowSpan:V,sandbox:Ie,scope:null,scoped:oe,seamless:oe,selected:oe,shadowRootClonable:oe,shadowRootDelegatesFocus:oe,shadowRootMode:null,shape:null,size:V,sizes:null,slot:null,span:V,spellCheck:We,src:null,srcDoc:null,srcLang:null,srcSet:null,start:V,step:null,style:null,tabIndex:V,target:null,title:null,translate:null,type:null,typeMustMatch:oe,useMap:null,value:We,width:V,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ie,axis:null,background:null,bgColor:null,border:V,borderColor:null,bottomMargin:V,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:oe,declare:oe,event:null,face:null,frame:null,frameBorder:null,hSpace:V,leftMargin:V,link:null,longDesc:null,lowSrc:null,marginHeight:V,marginWidth:V,noResize:oe,noHref:oe,noShade:oe,noWrap:oe,object:null,profile:null,prompt:null,rev:null,rightMargin:V,rules:null,scheme:null,scrolling:We,standby:null,summary:null,text:null,topMargin:V,valueType:null,version:null,vAlign:null,vLink:null,vSpace:V,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:oe,disableRemotePlayback:oe,prefix:null,property:null,results:V,security:null,unselectable:null}});var ay=nr({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:bl,properties:{about:Dt,accentHeight:V,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:V,amplitude:V,arabicForm:null,ascent:V,attributeName:null,attributeType:null,azimuth:V,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:V,by:null,calcMode:null,capHeight:V,className:Ie,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:V,diffuseConstant:V,direction:null,display:null,dur:null,divisor:V,dominantBaseline:null,download:oe,dx:null,dy:null,edgeMode:null,editable:null,elevation:V,enableBackground:null,end:null,event:null,exponent:V,externalResourcesRequired:null,fill:null,fillOpacity:V,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:mn,g2:mn,glyphName:mn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:V,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:V,horizOriginX:V,horizOriginY:V,id:null,ideographic:V,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:V,k:V,k1:V,k2:V,k3:V,k4:V,kernelMatrix:Dt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:V,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:V,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:V,overlineThickness:V,paintOrder:null,panose1:null,path:null,pathLength:V,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ie,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:V,pointsAtY:V,pointsAtZ:V,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Dt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Dt,rev:Dt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Dt,requiredFeatures:Dt,requiredFonts:Dt,requiredFormats:Dt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:V,specularExponent:V,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:V,strikethroughThickness:V,string:null,stroke:null,strokeDashArray:Dt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:V,strokeOpacity:V,strokeWidth:null,style:null,surfaceScale:V,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Dt,tabIndex:V,tableValues:null,target:null,targetX:V,targetY:V,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Dt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:V,underlineThickness:V,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:V,values:null,vAlphabetic:V,vMathematical:V,vectorEffect:null,vHanging:V,vIdeographic:V,version:null,vertAdvY:V,vertOriginX:V,vertOriginY:V,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:V,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var fx=/^data[-\w.:]+$/i,iy=/-[a-z]/g,yx=/[A-Z]/g;function Ad(r,e){let t=is(e),a=e,n=yt;if(t in r.normal)return r.property[r.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&fx.test(e)){if(e.charAt(4)==="-"){let i=e.slice(5).replace(iy,vx);a="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=e.slice(4);if(!iy.test(i)){let s=i.replace(yx,bx);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}n=Qn}return new n(a,e)}function bx(r){return"-"+r.toLowerCase()}function vx(r){return r.charAt(1).toUpperCase()}var sy=Sd([Cd,kd,xd,Td,ny],"html"),_l=Sd([Cd,kd,xd,Td,ay],"svg");var oy={}.hasOwnProperty;function ly(r,e){let t=e||{};function a(n,...i){let s=a.invalid,o=a.handlers;if(n&&oy.call(n,r)){let l=String(n[r]);s=oy.call(o,l)?o[l]:a.unknown}if(s)return s.call(this,n,...i)}return a.handlers=t.handlers||{},a.invalid=t.invalid,a.unknown=t.unknown,a}var _x=/["&'<>`]/g,Sx=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ex=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,wx=/[|\\{}()[\]^$+*?.]/g,cy=new WeakMap;function uy(r,e){if(r=r.replace(e.subset?kx(e.subset):_x,a),e.subset||e.escapeOnly)return r;return r.replace(Sx,t).replace(Ex,a);function t(n,i,s){return e.format((n.charCodeAt(0)-55296)*1024+n.charCodeAt(1)-56320+65536,s.charCodeAt(i+2),e)}function a(n,i,s){return e.format(n.charCodeAt(0),s.charCodeAt(i+1),e)}}function kx(r){let e=cy.get(r);return e||(e=Cx(r),cy.set(r,e)),e}function Cx(r){let e=[],t=-1;for(;++t<r.length;)e.push(r[t].replace(wx,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var xx=/[\dA-Fa-f]/;function dy(r,e,t){let a="&#x"+r.toString(16).toUpperCase();return t&&e&&!xx.test(String.fromCharCode(e))?a:a+";"}var Tx=/\d/;function py(r,e,t){let a="&#"+String(r);return t&&e&&!Tx.test(String.fromCharCode(e))?a:a+";"}var my=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Sl={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var hy=["cent","copy","divide","gt","lt","not","para","times"];var gy={}.hasOwnProperty,Id={},El;for(El in Sl)gy.call(Sl,El)&&(Id[Sl[El]]=El);var Ax=/[^\dA-Za-z]/;function fy(r,e,t,a){let n=String.fromCharCode(r);if(gy.call(Id,n)){let i=Id[n],s="&"+i;return t&&my.includes(i)&&!hy.includes(i)&&(!a||e&&e!==61&&Ax.test(String.fromCharCode(e)))?s:s+";"}return""}function yy(r,e,t){let a=dy(r,e,t.omitOptionalSemicolons),n;if((t.useNamedReferences||t.useShortestReferences)&&(n=fy(r,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!n)&&t.useShortestReferences){let i=py(r,e,t.omitOptionalSemicolons);i.length<a.length&&(a=i)}return n&&(!t.useShortestReferences||n.length<a.length)?n:a}function Wr(r,e){return uy(r,Object.assign({format:yy},e))}var Ix=/^>|^->|<!--|-->|--!>|<!-$/g,Rx=[">"],Px=["<",">"];function by(r,e,t,a){return a.settings.bogusComments?"<?"+Wr(r.value,Object.assign({},a.settings.characterReferences,{subset:Rx}))+">":"<!--"+r.value.replace(Ix,n)+"-->";function n(i){return Wr(i,Object.assign({},a.settings.characterReferences,{subset:Px}))}}function vy(r,e,t,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}function Rd(r,e){let t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let a=0,n=t.indexOf(e);for(;n!==-1;)a++,n=t.indexOf(e,n+e.length);return a}function _y(r,e){let t=e||{};return(r[r.length-1]===""?[...r,""]:r).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var $e=Sy(1),Pd=Sy(-1),Dx=[];function Sy(r){return e;function e(t,a,n){let i=t?t.children:Dx,s=(a||0)+r,o=i[s];if(!n)for(;o&&zt(o);)s+=r,o=i[s];return o}}var Nx={}.hasOwnProperty;function wl(r){return e;function e(t,a,n){return Nx.call(r,t.tagName)&&r[t.tagName](t,a,n)}}var os=wl({body:Ox,caption:Dd,colgroup:Dd,dd:Gx,dt:Fx,head:Dd,html:Mx,li:Bx,optgroup:zx,option:Ux,p:Lx,rp:Ey,rt:Ey,tbody:Vx,td:wy,tfoot:jx,th:wy,thead:Hx,tr:Wx});function Dd(r,e,t){let a=$e(t,e,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&zt(a.value.charAt(0)))}function Mx(r,e,t){let a=$e(t,e);return!a||a.type!=="comment"}function Ox(r,e,t){let a=$e(t,e);return!a||a.type!=="comment"}function Lx(r,e,t){let a=$e(t,e);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function Bx(r,e,t){let a=$e(t,e);return!a||a.type==="element"&&a.tagName==="li"}function Fx(r,e,t){let a=$e(t,e);return!!(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function Gx(r,e,t){let a=$e(t,e);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function Ey(r,e,t){let a=$e(t,e);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function zx(r,e,t){let a=$e(t,e);return!a||a.type==="element"&&a.tagName==="optgroup"}function Ux(r,e,t){let a=$e(t,e);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function Hx(r,e,t){let a=$e(t,e);return!!(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function Vx(r,e,t){let a=$e(t,e);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function jx(r,e,t){return!$e(t,e)}function Wx(r,e,t){let a=$e(t,e);return!a||a.type==="element"&&a.tagName==="tr"}function wy(r,e,t){let a=$e(t,e);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}var ky=wl({body:Kx,colgroup:Xx,head:$x,html:qx,tbody:Yx});function qx(r){let e=$e(r,-1);return!e||e.type!=="comment"}function $x(r){let e=r.children,t=[],a=-1;for(;++a<e.length;){let n=e[a];if(n.type==="element"&&(n.tagName==="title"||n.tagName==="base")){if(t.includes(n.tagName))return!1;t.push(n.tagName)}}return e.length>0}function Kx(r){let e=$e(r,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&zt(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Xx(r,e,t){let a=Pd(t,e),n=$e(r,-1,!0);return t&&a&&a.type==="element"&&a.tagName==="colgroup"&&os(a,t.children.indexOf(a),t)?!1:!!(n&&n.type==="element"&&n.tagName==="col")}function Yx(r,e,t){let a=Pd(t,e),n=$e(r,-1);return t&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&os(a,t.children.indexOf(a),t)?!1:!!(n&&n.type==="element"&&n.tagName==="tr")}var kl={name:[[`
|
|
3438
3461
|
\f\r &/=>`.split(""),`
|
|
3439
3462
|
\f\r "&'/=>\``.split("")],[`\0
|
|
3440
3463
|
\f\r "&'/<=>`.split(""),`\0
|
|
@@ -3442,19 +3465,19 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3442
3465
|
\f\r &>`.split(""),`\0
|
|
3443
3466
|
\f\r "&'<=>\``.split("")],[`\0
|
|
3444
3467
|
\f\r "&'<=>\``.split(""),`\0
|
|
3445
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Ah(r,e,t,a){let n=a.schema,i=n.space==="svg"?!1:a.settings.omitOptionalTags,o=n.space==="svg"?a.settings.closeEmptyElements:a.settings.voids.includes(r.tagName.toLowerCase()),s=[],l;n.space==="html"&&r.tagName==="svg"&&(a.schema=Ro);let c=Ew(a,r.properties),u=a.all(n.space==="html"&&r.tagName==="template"?r.content:r);return a.schema=n,u&&(o=!1),(c||!i||!xh(r,e,t))&&(s.push("<",r.tagName,c?" "+c:""),o&&(n.space==="svg"||a.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!a.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(u),!o&&(!i||!ja(r,e,t))&&s.push("</"+r.tagName+">"),s.join("")}function Ew(r,e){let t=[],a=-1,n;if(e){for(n in e)if(e[n]!==null&&e[n]!==void 0){let i=ww(r,n,e[n]);i&&t.push(i)}}for(;++a<t.length;){let i=r.settings.tightAttributes?t[a].charAt(t[a].length-1):void 0;a!==t.length-1&&i!=='"'&&i!=="'"&&(t[a]+=" ")}return t.join("")}function ww(r,e,t){let a=mc(r.schema,e),n=r.settings.allowParseErrors&&r.schema.space==="html"?0:1,i=r.settings.allowDangerousCharacters?0:1,o=r.quote,s;if(a.overloadedBoolean&&(t===a.attribute||t==="")?t=!0:(a.boolean||a.overloadedBoolean&&typeof t!="string")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";let l=Er(a.attribute,Object.assign({},r.settings.characterReferences,{subset:Oo.name[n][i]}));return t===!0||(t=Array.isArray(t)?(a.commaSeparated?wh:Km)(t,{padLeft:!r.settings.tightCommaSeparatedLists}):String(t),r.settings.collapseEmptyAttributes&&!t)?l:(r.settings.preferUnquoted&&(s=Er(t,Object.assign({},r.settings.characterReferences,{attribute:!0,subset:Oo.unquoted[n][i]}))),s!==t&&(r.settings.quoteSmart&&gc(t,o)>gc(t,r.alternative)&&(o=r.alternative),s=o+Er(t,Object.assign({},r.settings.characterReferences,{subset:(o==="'"?Oo.single:Oo.double)[n][i],attribute:!0}))+o),l+(s&&"="+s))}var Cw=["<","&"];function Lo(r,e,t,a){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?r.value:Er(r.value,Object.assign({},a.settings.characterReferences,{subset:Cw}))}function Ih(r,e,t,a){return a.settings.allowDangerousHtml?r.value:Lo(r,e,t,a)}function Rh(r,e,t,a){return a.all(r)}var Ph=dh("type",{invalid:kw,unknown:Tw,handlers:{comment:Sh,doctype:Eh,element:Ah,raw:Ih,root:Rh,text:Lo}});function kw(r){throw new Error("Expected node, not `"+r+"`")}function Tw(r){let e=r;throw new Error("Cannot compile unknown node `"+e.type+"`")}var xw={},Aw={},Iw=[];function bc(r,e){let t=e||xw,a=t.quote||'"',n=a==='"'?"'":'"';if(a!=='"'&&a!=="'")throw new Error("Invalid quote `"+a+"`, expected `'` or `\"`");return{one:Rw,all:Pw,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||ah,characterReferences:t.characterReferences||Aw,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?Ro:ch,quote:a,alternative:n}.one(Array.isArray(r)?{type:"root",children:r}:r,void 0,void 0)}function Rw(r,e,t){return Ph(r,e,t,this)}function Pw(r){let e=[],t=r&&r.children||Iw,a=-1;for(;++a<t.length;)e[a]=this.one(t[a],a,r);return e.join("")}function Mo(r){let e=this,t={...e.data("settings"),...r};e.compiler=a;function a(n){return bc(n,t)}}var Dw={};function vc(r,e){let t=e||Dw,a=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,n=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return Nh(r,a,n)}function Nh(r,e,t){if(Nw(r)){if("value"in r)return r.type==="html"&&!t?"":r.value;if(e&&"alt"in r&&r.alt)return r.alt;if("children"in r)return Dh(r.children,e,t)}return Array.isArray(r)?Dh(r,e,t):""}function Dh(r,e,t){let a=[],n=-1;for(;++n<r.length;)a[n]=Nh(r[n],e,t);return a.join("")}function Nw(r){return!!(r&&typeof r=="object")}var Oh=document.createElement("i");function ia(r){let e="&"+r+";";Oh.innerHTML=e;let t=Oh.textContent;return t.charCodeAt(t.length-1)===59&&r!=="semi"||t===e?!1:t}function lt(r,e,t,a){let n=r.length,i=0,o;if(e<0?e=-e>n?0:n+e:e=e>n?n:e,t=t>0?t:0,a.length<1e4)o=Array.from(a),o.unshift(e,t),r.splice(...o);else for(t&&r.splice(e,t);i<a.length;)o=a.slice(i,i+1e4),o.unshift(e,0),r.splice(...o),i+=1e4,e+=1e4}function mt(r,e){return r.length>0?(lt(r,r.length,0,e),r):e}var Lh={}.hasOwnProperty;function Mh(r){let e={},t=-1;for(;++t<r.length;)Ow(e,r[t]);return e}function Ow(r,e){let t;for(t in e){let n=(Lh.call(r,t)?r[t]:void 0)||(r[t]={}),i=e[t],o;if(i)for(o in i){Lh.call(n,o)||(n[o]=[]);let s=i[o];Lw(n[o],Array.isArray(s)?s:s?[s]:[])}}}function Lw(r,e){let t=-1,a=[];for(;++t<e.length;)(e[t].add==="after"?r:a).push(e[t]);lt(r,0,0,a)}function Fo(r,e){let t=Number.parseInt(r,e);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCodePoint(t)}function wr(r){return r.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Rt=Gr(/[A-Za-z]/),Ze=Gr(/[\dA-Za-z]/),Fh=Gr(/[#-'*+\--9=?A-Z^-~]/);function qa(r){return r!==null&&(r<32||r===127)}var Ka=Gr(/\d/),Bh=Gr(/[\dA-Fa-f]/),Gh=Gr(/[!-/:-@[-`{-~]/);function $(r){return r!==null&&r<-2}function Ve(r){return r!==null&&(r<0||r===32)}function ie(r){return r===-2||r===-1||r===32}var zh=Gr(/\p{P}|\p{S}/u),Uh=Gr(/\s/);function Gr(r){return e;function e(t){return t!==null&&t>-1&&r.test(String.fromCharCode(t))}}function Vt(r){let e=[],t=-1,a=0,n=0;for(;++t<r.length;){let i=r.charCodeAt(t),o="";if(i===37&&Ze(r.charCodeAt(t+1))&&Ze(r.charCodeAt(t+2)))n=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){let s=r.charCodeAt(t+1);i<56320&&s>56319&&s<57344?(o=String.fromCharCode(i,s),n=1):o="\uFFFD"}else o=String.fromCharCode(i);o&&(e.push(r.slice(a,t),encodeURIComponent(o)),a=t+n+1,o=""),n&&(t+=n,n=0)}return e.join("")+r.slice(a)}function oe(r,e,t,a){let n=a?a-1:Number.POSITIVE_INFINITY,i=0;return o;function o(l){return ie(l)?(r.enter(t),s(l)):e(l)}function s(l){return ie(l)&&i++<n?(r.consume(l),s):(r.exit(t),e(l))}}var Hh={tokenize:Mw};function Mw(r){let e=r.attempt(this.parser.constructs.contentInitial,a,n),t;return e;function a(s){if(s===null){r.consume(s);return}return r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),oe(r,e,"linePrefix")}function n(s){return r.enter("paragraph"),i(s)}function i(s){let l=r.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,o(s)}function o(s){if(s===null){r.exit("chunkText"),r.exit("paragraph"),r.consume(s);return}return $(s)?(r.consume(s),r.exit("chunkText"),i):(r.consume(s),o)}}var Wh={tokenize:Fw},Vh={tokenize:Bw};function Fw(r){let e=this,t=[],a=0,n,i,o;return s;function s(E){if(a<t.length){let I=t[a];return e.containerState=I[1],r.attempt(I[0].continuation,l,c)(E)}return c(E)}function l(E){if(a++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,n&&T();let I=e.events.length,D=I,C;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){C=e.events[D][1].end;break}v(a);let M=I;for(;M<e.events.length;)e.events[M][1].end=Object.assign({},C),M++;return lt(e.events,D+1,0,e.events.slice(I)),e.events.length=M,c(E)}return s(E)}function c(E){if(a===t.length){if(!n)return m(E);if(n.currentConstruct&&n.currentConstruct.concrete)return g(E);e.interrupt=!!(n.currentConstruct&&!n._gfmTableDynamicInterruptHack)}return e.containerState={},r.check(Vh,u,p)(E)}function u(E){return n&&T(),v(a),m(E)}function p(E){return e.parser.lazy[e.now().line]=a!==t.length,o=e.now().offset,g(E)}function m(E){return e.containerState={},r.attempt(Vh,d,g)(E)}function d(E){return a++,t.push([e.currentConstruct,e.containerState]),m(E)}function g(E){if(E===null){n&&T(),v(0),r.consume(E);return}return n=n||e.parser.flow(e.now()),r.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:n}),f(E)}function f(E){if(E===null){y(r.exit("chunkFlow"),!0),v(0),r.consume(E);return}return $(E)?(r.consume(E),y(r.exit("chunkFlow")),a=0,e.interrupt=void 0,s):(r.consume(E),f)}function y(E,I){let D=e.sliceStream(E);if(I&&D.push(null),E.previous=i,i&&(i.next=E),i=E,n.defineSkip(E.start),n.write(D),e.parser.lazy[E.start.line]){let C=n.events.length;for(;C--;)if(n.events[C][1].start.offset<o&&(!n.events[C][1].end||n.events[C][1].end.offset>o))return;let M=e.events.length,F=M,R,G;for(;F--;)if(e.events[F][0]==="exit"&&e.events[F][1].type==="chunkFlow"){if(R){G=e.events[F][1].end;break}R=!0}for(v(a),C=M;C<e.events.length;)e.events[C][1].end=Object.assign({},G),C++;lt(e.events,F+1,0,e.events.slice(M)),e.events.length=C}}function v(E){let I=t.length;for(;I-- >E;){let D=t[I];e.containerState=D[1],D[0].exit.call(e,r)}t.length=E}function T(){n.write([null]),i=void 0,n=void 0,e.containerState._closeFlow=void 0}}function Bw(r,e,t){return oe(r,r.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _c(r){if(r===null||Ve(r)||Uh(r))return 1;if(zh(r))return 2}function oa(r,e,t){let a=[],n=-1;for(;++n<r.length;){let i=r[n].resolveAll;i&&!a.includes(i)&&(e=i(e,t),a.push(i))}return e}var $a={name:"attention",tokenize:zw,resolveAll:Gw};function Gw(r,e){let t=-1,a,n,i,o,s,l,c,u;for(;++t<r.length;)if(r[t][0]==="enter"&&r[t][1].type==="attentionSequence"&&r[t][1]._close){for(a=t;a--;)if(r[a][0]==="exit"&&r[a][1].type==="attentionSequence"&&r[a][1]._open&&e.sliceSerialize(r[a][1]).charCodeAt(0)===e.sliceSerialize(r[t][1]).charCodeAt(0)){if((r[a][1]._close||r[t][1]._open)&&(r[t][1].end.offset-r[t][1].start.offset)%3&&!((r[a][1].end.offset-r[a][1].start.offset+r[t][1].end.offset-r[t][1].start.offset)%3))continue;l=r[a][1].end.offset-r[a][1].start.offset>1&&r[t][1].end.offset-r[t][1].start.offset>1?2:1;let p=Object.assign({},r[a][1].end),m=Object.assign({},r[t][1].start);jh(p,-l),jh(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:p,end:Object.assign({},r[a][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},r[t][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},r[a][1].end),end:Object.assign({},r[t][1].start)},n={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},r[a][1].end=Object.assign({},o.start),r[t][1].start=Object.assign({},s.end),c=[],r[a][1].end.offset-r[a][1].start.offset&&(c=mt(c,[["enter",r[a][1],e],["exit",r[a][1],e]])),c=mt(c,[["enter",n,e],["enter",o,e],["exit",o,e],["enter",i,e]]),c=mt(c,oa(e.parser.constructs.insideSpan.null,r.slice(a+1,t),e)),c=mt(c,[["exit",i,e],["enter",s,e],["exit",s,e],["exit",n,e]]),r[t][1].end.offset-r[t][1].start.offset?(u=2,c=mt(c,[["enter",r[t][1],e],["exit",r[t][1],e]])):u=0,lt(r,a-1,t-a+3,c),t=a+c.length-u-2;break}}for(t=-1;++t<r.length;)r[t][1].type==="attentionSequence"&&(r[t][1].type="data");return r}function zw(r,e){let t=this.parser.constructs.attentionMarkers.null,a=this.previous,n=_c(a),i;return o;function o(l){return i=l,r.enter("attentionSequence"),s(l)}function s(l){if(l===i)return r.consume(l),s;let c=r.exit("attentionSequence"),u=_c(l),p=!u||u===2&&n||t.includes(l),m=!n||n===2&&u||t.includes(a);return c._open=!!(i===42?p:p&&(n||!m)),c._close=!!(i===42?m:m&&(u||!p)),e(l)}}function jh(r,e){r.column+=e,r.offset+=e,r._bufferIndex+=e}var Sc={name:"autolink",tokenize:Uw};function Uw(r,e,t){let a=0;return n;function n(d){return r.enter("autolink"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.enter("autolinkProtocol"),i}function i(d){return Rt(d)?(r.consume(d),o):d===64?t(d):c(d)}function o(d){return d===43||d===45||d===46||Ze(d)?(a=1,s(d)):c(d)}function s(d){return d===58?(r.consume(d),a=0,l):(d===43||d===45||d===46||Ze(d))&&a++<32?(r.consume(d),s):(a=0,c(d))}function l(d){return d===62?(r.exit("autolinkProtocol"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):d===null||d===32||d===60||qa(d)?t(d):(r.consume(d),l)}function c(d){return d===64?(r.consume(d),u):Fh(d)?(r.consume(d),c):t(d)}function u(d){return Ze(d)?p(d):t(d)}function p(d){return d===46?(r.consume(d),a=0,u):d===62?(r.exit("autolinkProtocol").type="autolinkEmail",r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):m(d)}function m(d){if((d===45||Ze(d))&&a++<63){let g=d===45?m:p;return r.consume(d),g}return t(d)}}var zr={tokenize:Hw,partial:!0};function Hw(r,e,t){return a;function a(i){return ie(i)?oe(r,n,"linePrefix")(i):n(i)}function n(i){return i===null||$(i)?e(i):t(i)}}var Bo={name:"blockQuote",tokenize:Vw,continuation:{tokenize:Ww},exit:jw};function Vw(r,e,t){let a=this;return n;function n(o){if(o===62){let s=a.containerState;return s.open||(r.enter("blockQuote",{_container:!0}),s.open=!0),r.enter("blockQuotePrefix"),r.enter("blockQuoteMarker"),r.consume(o),r.exit("blockQuoteMarker"),i}return t(o)}function i(o){return ie(o)?(r.enter("blockQuotePrefixWhitespace"),r.consume(o),r.exit("blockQuotePrefixWhitespace"),r.exit("blockQuotePrefix"),e):(r.exit("blockQuotePrefix"),e(o))}}function Ww(r,e,t){let a=this;return n;function n(o){return ie(o)?oe(r,i,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return r.attempt(Bo,e,t)(o)}}function jw(r){r.exit("blockQuote")}var Go={name:"characterEscape",tokenize:qw};function qw(r,e,t){return a;function a(i){return r.enter("characterEscape"),r.enter("escapeMarker"),r.consume(i),r.exit("escapeMarker"),n}function n(i){return Gh(i)?(r.enter("characterEscapeValue"),r.consume(i),r.exit("characterEscapeValue"),r.exit("characterEscape"),e):t(i)}}var zo={name:"characterReference",tokenize:Kw};function Kw(r,e,t){let a=this,n=0,i,o;return s;function s(p){return r.enter("characterReference"),r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),l}function l(p){return p===35?(r.enter("characterReferenceMarkerNumeric"),r.consume(p),r.exit("characterReferenceMarkerNumeric"),c):(r.enter("characterReferenceValue"),i=31,o=Ze,u(p))}function c(p){return p===88||p===120?(r.enter("characterReferenceMarkerHexadecimal"),r.consume(p),r.exit("characterReferenceMarkerHexadecimal"),r.enter("characterReferenceValue"),i=6,o=Bh,u):(r.enter("characterReferenceValue"),i=7,o=Ka,u(p))}function u(p){if(p===59&&n){let m=r.exit("characterReferenceValue");return o===Ze&&!ia(a.sliceSerialize(m))?t(p):(r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),r.exit("characterReference"),e)}return o(p)&&n++<i?(r.consume(p),u):t(p)}}var qh={tokenize:Xw,partial:!0},Uo={name:"codeFenced",tokenize:$w,concrete:!0};function $w(r,e,t){let a=this,n={tokenize:D,partial:!0},i=0,o=0,s;return l;function l(C){return c(C)}function c(C){let M=a.events[a.events.length-1];return i=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,s=C,r.enter("codeFenced"),r.enter("codeFencedFence"),r.enter("codeFencedFenceSequence"),u(C)}function u(C){return C===s?(o++,r.consume(C),u):o<3?t(C):(r.exit("codeFencedFenceSequence"),ie(C)?oe(r,p,"whitespace")(C):p(C))}function p(C){return C===null||$(C)?(r.exit("codeFencedFence"),a.interrupt?e(C):r.check(qh,f,I)(C)):(r.enter("codeFencedFenceInfo"),r.enter("chunkString",{contentType:"string"}),m(C))}function m(C){return C===null||$(C)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),p(C)):ie(C)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),oe(r,d,"whitespace")(C)):C===96&&C===s?t(C):(r.consume(C),m)}function d(C){return C===null||$(C)?p(C):(r.enter("codeFencedFenceMeta"),r.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||$(C)?(r.exit("chunkString"),r.exit("codeFencedFenceMeta"),p(C)):C===96&&C===s?t(C):(r.consume(C),g)}function f(C){return r.attempt(n,I,y)(C)}function y(C){return r.enter("lineEnding"),r.consume(C),r.exit("lineEnding"),v}function v(C){return i>0&&ie(C)?oe(r,T,"linePrefix",i+1)(C):T(C)}function T(C){return C===null||$(C)?r.check(qh,f,I)(C):(r.enter("codeFlowValue"),E(C))}function E(C){return C===null||$(C)?(r.exit("codeFlowValue"),T(C)):(r.consume(C),E)}function I(C){return r.exit("codeFenced"),e(C)}function D(C,M,F){let R=0;return G;function G(B){return C.enter("lineEnding"),C.consume(B),C.exit("lineEnding"),z}function z(B){return C.enter("codeFencedFence"),ie(B)?oe(C,O,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):O(B)}function O(B){return B===s?(C.enter("codeFencedFenceSequence"),x(B)):F(B)}function x(B){return B===s?(R++,C.consume(B),x):R>=o?(C.exit("codeFencedFenceSequence"),ie(B)?oe(C,A,"whitespace")(B):A(B)):F(B)}function A(B){return B===null||$(B)?(C.exit("codeFencedFence"),M(B)):F(B)}}}function Xw(r,e,t){let a=this;return n;function n(o){return o===null?t(o):(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),i)}function i(o){return a.parser.lazy[a.now().line]?t(o):e(o)}}var Xa={name:"codeIndented",tokenize:Zw},Yw={tokenize:Jw,partial:!0};function Zw(r,e,t){let a=this;return n;function n(c){return r.enter("codeIndented"),oe(r,i,"linePrefix",5)(c)}function i(c){let u=a.events[a.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):t(c)}function o(c){return c===null?l(c):$(c)?r.attempt(Yw,o,l)(c):(r.enter("codeFlowValue"),s(c))}function s(c){return c===null||$(c)?(r.exit("codeFlowValue"),o(c)):(r.consume(c),s)}function l(c){return r.exit("codeIndented"),e(c)}}function Jw(r,e,t){let a=this;return n;function n(o){return a.parser.lazy[a.now().line]?t(o):$(o)?(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),n):oe(r,i,"linePrefix",5)(o)}function i(o){let s=a.events[a.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):$(o)?n(o):t(o)}}var Ec={name:"codeText",tokenize:tC,resolve:Qw,previous:eC};function Qw(r){let e=r.length-4,t=3,a,n;if((r[t][1].type==="lineEnding"||r[t][1].type==="space")&&(r[e][1].type==="lineEnding"||r[e][1].type==="space")){for(a=t;++a<e;)if(r[a][1].type==="codeTextData"){r[t][1].type="codeTextPadding",r[e][1].type="codeTextPadding",t+=2,e-=2;break}}for(a=t-1,e++;++a<=e;)n===void 0?a!==e&&r[a][1].type!=="lineEnding"&&(n=a):(a===e||r[a][1].type==="lineEnding")&&(r[n][1].type="codeTextData",a!==n+2&&(r[n][1].end=r[a-1][1].end,r.splice(n+2,a-n-2),e-=a-n-2,a=n+2),n=void 0);return r}function eC(r){return r!==96||this.events[this.events.length-1][1].type==="characterEscape"}function tC(r,e,t){let a=this,n=0,i,o;return s;function s(m){return r.enter("codeText"),r.enter("codeTextSequence"),l(m)}function l(m){return m===96?(r.consume(m),n++,l):(r.exit("codeTextSequence"),c(m))}function c(m){return m===null?t(m):m===32?(r.enter("space"),r.consume(m),r.exit("space"),c):m===96?(o=r.enter("codeTextSequence"),i=0,p(m)):$(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),c):(r.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||$(m)?(r.exit("codeTextData"),c(m)):(r.consume(m),u)}function p(m){return m===96?(r.consume(m),i++,p):i===n?(r.exit("codeTextSequence"),r.exit("codeText"),e(m)):(o.type="codeTextData",u(m))}}var Ho=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let a=t??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(e,a):e>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(e,t,a){let n=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return a&&Ya(this.left,a),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Ya(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Ya(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,Number.POSITIVE_INFINITY);Ya(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Ya(this.left,t.reverse())}}};function Ya(r,e){let t=0;if(e.length<1e4)r.push(...e);else for(;t<e.length;)r.push(...e.slice(t,t+1e4)),t+=1e4}function Vo(r){let e={},t=-1,a,n,i,o,s,l,c,u=new Ho(r);for(;++t<u.length;){for(;t in e;)t=e[t];if(a=u.get(t),t&&a[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(l=a[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(a[0]==="enter")a[1].contentType&&(Object.assign(e,rC(u,t)),t=e[t],c=!0);else if(a[1]._container){for(i=t,n=void 0;i--&&(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(n&&(u.get(n)[1].type="lineEndingBlank"),o[1].type="lineEnding",n=i);n&&(a[1].end=Object.assign({},u.get(n)[1].start),s=u.slice(n,t),s.unshift(a),u.splice(n,t-n+1,s))}}return lt(r,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function rC(r,e){let t=r.get(e)[1],a=r.get(e)[2],n=e-1,i=[],o=t._tokenizer||a.parser[t.contentType](t.start),s=o.events,l=[],c={},u,p,m=-1,d=t,g=0,f=0,y=[f];for(;d;){for(;r.get(++n)[1]!==d;);i.push(n),d._tokenizer||(u=a.sliceStream(d),d.next||u.push(null),p&&o.defineSkip(d.start),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=d,d=d.next}for(d=t;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(f=m+1,y.push(f),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(o.events=[],d?(d._tokenizer=void 0,d.previous=void 0):y.pop(),m=y.length;m--;){let v=s.slice(y[m],y[m+1]),T=i.pop();l.push([T,T+v.length-1]),r.splice(T,2,v)}for(l.reverse(),m=-1;++m<l.length;)c[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return c}var wc={tokenize:iC,resolve:aC},nC={tokenize:oC,partial:!0};function aC(r){return Vo(r),r}function iC(r,e){let t;return a;function a(s){return r.enter("content"),t=r.enter("chunkContent",{contentType:"content"}),n(s)}function n(s){return s===null?i(s):$(s)?r.check(nC,o,i)(s):(r.consume(s),n)}function i(s){return r.exit("chunkContent"),r.exit("content"),e(s)}function o(s){return r.consume(s),r.exit("chunkContent"),t.next=r.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,n}}function oC(r,e,t){let a=this;return n;function n(o){return r.exit("chunkContent"),r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),oe(r,i,"linePrefix")}function i(o){if(o===null||$(o))return t(o);let s=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(o):r.interrupt(a.parser.constructs.flow,t,e)(o)}}function Wo(r,e,t,a,n,i,o,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return p;function p(v){return v===60?(r.enter(a),r.enter(n),r.enter(i),r.consume(v),r.exit(i),m):v===null||v===32||v===41||qa(v)?t(v):(r.enter(a),r.enter(o),r.enter(s),r.enter("chunkString",{contentType:"string"}),f(v))}function m(v){return v===62?(r.enter(i),r.consume(v),r.exit(i),r.exit(n),r.exit(a),e):(r.enter(s),r.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===62?(r.exit("chunkString"),r.exit(s),m(v)):v===null||v===60||$(v)?t(v):(r.consume(v),v===92?g:d)}function g(v){return v===60||v===62||v===92?(r.consume(v),d):d(v)}function f(v){return!u&&(v===null||v===41||Ve(v))?(r.exit("chunkString"),r.exit(s),r.exit(o),r.exit(a),e(v)):u<c&&v===40?(r.consume(v),u++,f):v===41?(r.consume(v),u--,f):v===null||v===32||v===40||qa(v)?t(v):(r.consume(v),v===92?y:f)}function y(v){return v===40||v===41||v===92?(r.consume(v),f):f(v)}}function jo(r,e,t,a,n,i){let o=this,s=0,l;return c;function c(d){return r.enter(a),r.enter(n),r.consume(d),r.exit(n),r.enter(i),u}function u(d){return s>999||d===null||d===91||d===93&&!l||d===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?t(d):d===93?(r.exit(i),r.enter(n),r.consume(d),r.exit(n),r.exit(a),e):$(d)?(r.enter("lineEnding"),r.consume(d),r.exit("lineEnding"),u):(r.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===null||d===91||d===93||$(d)||s++>999?(r.exit("chunkString"),u(d)):(r.consume(d),l||(l=!ie(d)),d===92?m:p)}function m(d){return d===91||d===92||d===93?(r.consume(d),s++,p):p(d)}}function qo(r,e,t,a,n,i){let o;return s;function s(m){return m===34||m===39||m===40?(r.enter(a),r.enter(n),r.consume(m),r.exit(n),o=m===40?41:m,l):t(m)}function l(m){return m===o?(r.enter(n),r.consume(m),r.exit(n),r.exit(a),e):(r.enter(i),c(m))}function c(m){return m===o?(r.exit(i),l(o)):m===null?t(m):$(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),oe(r,c,"linePrefix")):(r.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||$(m)?(r.exit("chunkString"),c(m)):(r.consume(m),m===92?p:u)}function p(m){return m===o||m===92?(r.consume(m),u):u(m)}}function Sn(r,e){let t;return a;function a(n){return $(n)?(r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),t=!0,a):ie(n)?oe(r,a,t?"linePrefix":"lineSuffix")(n):e(n)}}var Cc={name:"definition",tokenize:lC},sC={tokenize:cC,partial:!0};function lC(r,e,t){let a=this,n;return i;function i(d){return r.enter("definition"),o(d)}function o(d){return jo.call(a,r,s,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function s(d){return n=wr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),d===58?(r.enter("definitionMarker"),r.consume(d),r.exit("definitionMarker"),l):t(d)}function l(d){return Ve(d)?Sn(r,c)(d):c(d)}function c(d){return Wo(r,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function u(d){return r.attempt(sC,p,p)(d)}function p(d){return ie(d)?oe(r,m,"whitespace")(d):m(d)}function m(d){return d===null||$(d)?(r.exit("definition"),a.parser.defined.push(n),e(d)):t(d)}}function cC(r,e,t){return a;function a(s){return Ve(s)?Sn(r,n)(s):t(s)}function n(s){return qo(r,i,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return ie(s)?oe(r,o,"whitespace")(s):o(s)}function o(s){return s===null||$(s)?e(s):t(s)}}var kc={name:"hardBreakEscape",tokenize:uC};function uC(r,e,t){return a;function a(i){return r.enter("hardBreakEscape"),r.consume(i),n}function n(i){return $(i)?(r.exit("hardBreakEscape"),e(i)):t(i)}}var Tc={name:"headingAtx",tokenize:pC,resolve:dC};function dC(r,e){let t=r.length-2,a=3,n,i;return r[a][1].type==="whitespace"&&(a+=2),t-2>a&&r[t][1].type==="whitespace"&&(t-=2),r[t][1].type==="atxHeadingSequence"&&(a===t-1||t-4>a&&r[t-2][1].type==="whitespace")&&(t-=a+1===t?2:4),t>a&&(n={type:"atxHeadingText",start:r[a][1].start,end:r[t][1].end},i={type:"chunkText",start:r[a][1].start,end:r[t][1].end,contentType:"text"},lt(r,a,t-a+1,[["enter",n,e],["enter",i,e],["exit",i,e],["exit",n,e]])),r}function pC(r,e,t){let a=0;return n;function n(u){return r.enter("atxHeading"),i(u)}function i(u){return r.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&a++<6?(r.consume(u),o):u===null||Ve(u)?(r.exit("atxHeadingSequence"),s(u)):t(u)}function s(u){return u===35?(r.enter("atxHeadingSequence"),l(u)):u===null||$(u)?(r.exit("atxHeading"),e(u)):ie(u)?oe(r,s,"whitespace")(u):(r.enter("atxHeadingText"),c(u))}function l(u){return u===35?(r.consume(u),l):(r.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||Ve(u)?(r.exit("atxHeadingText"),s(u)):(r.consume(u),c)}}var Kh=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xc=["pre","script","style","textarea"];var Ac={name:"htmlFlow",tokenize:fC,resolveTo:gC,concrete:!0},mC={tokenize:bC,partial:!0},hC={tokenize:yC,partial:!0};function gC(r){let e=r.length;for(;e--&&!(r[e][0]==="enter"&&r[e][1].type==="htmlFlow"););return e>1&&r[e-2][1].type==="linePrefix"&&(r[e][1].start=r[e-2][1].start,r[e+1][1].start=r[e-2][1].start,r.splice(e-2,2)),r}function fC(r,e,t){let a=this,n,i,o,s,l;return c;function c(S){return u(S)}function u(S){return r.enter("htmlFlow"),r.enter("htmlFlowData"),r.consume(S),p}function p(S){return S===33?(r.consume(S),m):S===47?(r.consume(S),i=!0,f):S===63?(r.consume(S),n=3,a.interrupt?e:_):Rt(S)?(r.consume(S),o=String.fromCharCode(S),y):t(S)}function m(S){return S===45?(r.consume(S),n=2,d):S===91?(r.consume(S),n=5,s=0,g):Rt(S)?(r.consume(S),n=4,a.interrupt?e:_):t(S)}function d(S){return S===45?(r.consume(S),a.interrupt?e:_):t(S)}function g(S){let ne="CDATA[";return S===ne.charCodeAt(s++)?(r.consume(S),s===ne.length?a.interrupt?e:O:g):t(S)}function f(S){return Rt(S)?(r.consume(S),o=String.fromCharCode(S),y):t(S)}function y(S){if(S===null||S===47||S===62||Ve(S)){let ne=S===47,Te=o.toLowerCase();return!ne&&!i&&xc.includes(Te)?(n=1,a.interrupt?e(S):O(S)):Kh.includes(o.toLowerCase())?(n=6,ne?(r.consume(S),v):a.interrupt?e(S):O(S)):(n=7,a.interrupt&&!a.parser.lazy[a.now().line]?t(S):i?T(S):E(S))}return S===45||Ze(S)?(r.consume(S),o+=String.fromCharCode(S),y):t(S)}function v(S){return S===62?(r.consume(S),a.interrupt?e:O):t(S)}function T(S){return ie(S)?(r.consume(S),T):G(S)}function E(S){return S===47?(r.consume(S),G):S===58||S===95||Rt(S)?(r.consume(S),I):ie(S)?(r.consume(S),E):G(S)}function I(S){return S===45||S===46||S===58||S===95||Ze(S)?(r.consume(S),I):D(S)}function D(S){return S===61?(r.consume(S),C):ie(S)?(r.consume(S),D):E(S)}function C(S){return S===null||S===60||S===61||S===62||S===96?t(S):S===34||S===39?(r.consume(S),l=S,M):ie(S)?(r.consume(S),C):F(S)}function M(S){return S===l?(r.consume(S),l=null,R):S===null||$(S)?t(S):(r.consume(S),M)}function F(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Ve(S)?D(S):(r.consume(S),F)}function R(S){return S===47||S===62||ie(S)?E(S):t(S)}function G(S){return S===62?(r.consume(S),z):t(S)}function z(S){return S===null||$(S)?O(S):ie(S)?(r.consume(S),z):t(S)}function O(S){return S===45&&n===2?(r.consume(S),X):S===60&&n===1?(r.consume(S),K):S===62&&n===4?(r.consume(S),fe):S===63&&n===3?(r.consume(S),_):S===93&&n===5?(r.consume(S),Z):$(S)&&(n===6||n===7)?(r.exit("htmlFlowData"),r.check(mC,Ie,x)(S)):S===null||$(S)?(r.exit("htmlFlowData"),x(S)):(r.consume(S),O)}function x(S){return r.check(hC,A,Ie)(S)}function A(S){return r.enter("lineEnding"),r.consume(S),r.exit("lineEnding"),B}function B(S){return S===null||$(S)?x(S):(r.enter("htmlFlowData"),O(S))}function X(S){return S===45?(r.consume(S),_):O(S)}function K(S){return S===47?(r.consume(S),o="",Q):O(S)}function Q(S){if(S===62){let ne=o.toLowerCase();return xc.includes(ne)?(r.consume(S),fe):O(S)}return Rt(S)&&o.length<8?(r.consume(S),o+=String.fromCharCode(S),Q):O(S)}function Z(S){return S===93?(r.consume(S),_):O(S)}function _(S){return S===62?(r.consume(S),fe):S===45&&n===2?(r.consume(S),_):O(S)}function fe(S){return S===null||$(S)?(r.exit("htmlFlowData"),Ie(S)):(r.consume(S),fe)}function Ie(S){return r.exit("htmlFlow"),e(S)}}function yC(r,e,t){let a=this;return n;function n(o){return $(o)?(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),i):t(o)}function i(o){return a.parser.lazy[a.now().line]?t(o):e(o)}}function bC(r,e,t){return a;function a(n){return r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),r.attempt(zr,e,t)}}var Ic={name:"htmlText",tokenize:vC};function vC(r,e,t){let a=this,n,i,o;return s;function s(_){return r.enter("htmlText"),r.enter("htmlTextData"),r.consume(_),l}function l(_){return _===33?(r.consume(_),c):_===47?(r.consume(_),D):_===63?(r.consume(_),E):Rt(_)?(r.consume(_),F):t(_)}function c(_){return _===45?(r.consume(_),u):_===91?(r.consume(_),i=0,g):Rt(_)?(r.consume(_),T):t(_)}function u(_){return _===45?(r.consume(_),d):t(_)}function p(_){return _===null?t(_):_===45?(r.consume(_),m):$(_)?(o=p,K(_)):(r.consume(_),p)}function m(_){return _===45?(r.consume(_),d):p(_)}function d(_){return _===62?X(_):_===45?m(_):p(_)}function g(_){let fe="CDATA[";return _===fe.charCodeAt(i++)?(r.consume(_),i===fe.length?f:g):t(_)}function f(_){return _===null?t(_):_===93?(r.consume(_),y):$(_)?(o=f,K(_)):(r.consume(_),f)}function y(_){return _===93?(r.consume(_),v):f(_)}function v(_){return _===62?X(_):_===93?(r.consume(_),v):f(_)}function T(_){return _===null||_===62?X(_):$(_)?(o=T,K(_)):(r.consume(_),T)}function E(_){return _===null?t(_):_===63?(r.consume(_),I):$(_)?(o=E,K(_)):(r.consume(_),E)}function I(_){return _===62?X(_):E(_)}function D(_){return Rt(_)?(r.consume(_),C):t(_)}function C(_){return _===45||Ze(_)?(r.consume(_),C):M(_)}function M(_){return $(_)?(o=M,K(_)):ie(_)?(r.consume(_),M):X(_)}function F(_){return _===45||Ze(_)?(r.consume(_),F):_===47||_===62||Ve(_)?R(_):t(_)}function R(_){return _===47?(r.consume(_),X):_===58||_===95||Rt(_)?(r.consume(_),G):$(_)?(o=R,K(_)):ie(_)?(r.consume(_),R):X(_)}function G(_){return _===45||_===46||_===58||_===95||Ze(_)?(r.consume(_),G):z(_)}function z(_){return _===61?(r.consume(_),O):$(_)?(o=z,K(_)):ie(_)?(r.consume(_),z):R(_)}function O(_){return _===null||_===60||_===61||_===62||_===96?t(_):_===34||_===39?(r.consume(_),n=_,x):$(_)?(o=O,K(_)):ie(_)?(r.consume(_),O):(r.consume(_),A)}function x(_){return _===n?(r.consume(_),n=void 0,B):_===null?t(_):$(_)?(o=x,K(_)):(r.consume(_),x)}function A(_){return _===null||_===34||_===39||_===60||_===61||_===96?t(_):_===47||_===62||Ve(_)?R(_):(r.consume(_),A)}function B(_){return _===47||_===62||Ve(_)?R(_):t(_)}function X(_){return _===62?(r.consume(_),r.exit("htmlTextData"),r.exit("htmlText"),e):t(_)}function K(_){return r.exit("htmlTextData"),r.enter("lineEnding"),r.consume(_),r.exit("lineEnding"),Q}function Q(_){return ie(_)?oe(r,Z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Z(_)}function Z(_){return r.enter("htmlTextData"),o(_)}}var En={name:"labelEnd",tokenize:kC,resolveTo:CC,resolveAll:wC},_C={tokenize:TC},SC={tokenize:xC},EC={tokenize:AC};function wC(r){let e=-1;for(;++e<r.length;){let t=r[e][1];(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(r.splice(e+1,t.type==="labelImage"?4:2),t.type="data",e++)}return r}function CC(r,e){let t=r.length,a=0,n,i,o,s;for(;t--;)if(n=r[t][1],i){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;r[t][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(o){if(r[t][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(i=t,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(o=t);let l={type:r[i][1].type==="labelLink"?"link":"image",start:Object.assign({},r[i][1].start),end:Object.assign({},r[r.length-1][1].end)},c={type:"label",start:Object.assign({},r[i][1].start),end:Object.assign({},r[o][1].end)},u={type:"labelText",start:Object.assign({},r[i+a+2][1].end),end:Object.assign({},r[o-2][1].start)};return s=[["enter",l,e],["enter",c,e]],s=mt(s,r.slice(i+1,i+a+3)),s=mt(s,[["enter",u,e]]),s=mt(s,oa(e.parser.constructs.insideSpan.null,r.slice(i+a+4,o-3),e)),s=mt(s,[["exit",u,e],r[o-2],r[o-1],["exit",c,e]]),s=mt(s,r.slice(o+1)),s=mt(s,[["exit",l,e]]),lt(r,i,r.length,s),r}function kC(r,e,t){let a=this,n=a.events.length,i,o;for(;n--;)if((a.events[n][1].type==="labelImage"||a.events[n][1].type==="labelLink")&&!a.events[n][1]._balanced){i=a.events[n][1];break}return s;function s(m){return i?i._inactive?p(m):(o=a.parser.defined.includes(wr(a.sliceSerialize({start:i.end,end:a.now()}))),r.enter("labelEnd"),r.enter("labelMarker"),r.consume(m),r.exit("labelMarker"),r.exit("labelEnd"),l):t(m)}function l(m){return m===40?r.attempt(_C,u,o?u:p)(m):m===91?r.attempt(SC,u,o?c:p)(m):o?u(m):p(m)}function c(m){return r.attempt(EC,u,p)(m)}function u(m){return e(m)}function p(m){return i._balanced=!0,t(m)}}function TC(r,e,t){return a;function a(p){return r.enter("resource"),r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),n}function n(p){return Ve(p)?Sn(r,i)(p):i(p)}function i(p){return p===41?u(p):Wo(r,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return Ve(p)?Sn(r,l)(p):u(p)}function s(p){return t(p)}function l(p){return p===34||p===39||p===40?qo(r,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function c(p){return Ve(p)?Sn(r,u)(p):u(p)}function u(p){return p===41?(r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),r.exit("resource"),e):t(p)}}function xC(r,e,t){let a=this;return n;function n(s){return jo.call(a,r,i,o,"reference","referenceMarker","referenceString")(s)}function i(s){return a.parser.defined.includes(wr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?e(s):t(s)}function o(s){return t(s)}}function AC(r,e,t){return a;function a(i){return r.enter("reference"),r.enter("referenceMarker"),r.consume(i),r.exit("referenceMarker"),n}function n(i){return i===93?(r.enter("referenceMarker"),r.consume(i),r.exit("referenceMarker"),r.exit("reference"),e):t(i)}}var Rc={name:"labelStartImage",tokenize:IC,resolveAll:En.resolveAll};function IC(r,e,t){let a=this;return n;function n(s){return r.enter("labelImage"),r.enter("labelImageMarker"),r.consume(s),r.exit("labelImageMarker"),i}function i(s){return s===91?(r.enter("labelMarker"),r.consume(s),r.exit("labelMarker"),r.exit("labelImage"),o):t(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in a.parser.constructs?t(s):e(s)}}var Pc={name:"labelStartLink",tokenize:RC,resolveAll:En.resolveAll};function RC(r,e,t){let a=this;return n;function n(o){return r.enter("labelLink"),r.enter("labelMarker"),r.consume(o),r.exit("labelMarker"),r.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in a.parser.constructs?t(o):e(o)}}var Za={name:"lineEnding",tokenize:PC};function PC(r,e){return t;function t(a){return r.enter("lineEnding"),r.consume(a),r.exit("lineEnding"),oe(r,e,"linePrefix")}}var wn={name:"thematicBreak",tokenize:DC};function DC(r,e,t){let a=0,n;return i;function i(c){return r.enter("thematicBreak"),o(c)}function o(c){return n=c,s(c)}function s(c){return c===n?(r.enter("thematicBreakSequence"),l(c)):a>=3&&(c===null||$(c))?(r.exit("thematicBreak"),e(c)):t(c)}function l(c){return c===n?(r.consume(c),a++,l):(r.exit("thematicBreakSequence"),ie(c)?oe(r,s,"whitespace")(c):s(c))}}var ct={name:"list",tokenize:LC,continuation:{tokenize:MC},exit:BC},NC={tokenize:GC,partial:!0},OC={tokenize:FC,partial:!0};function LC(r,e,t){let a=this,n=a.events[a.events.length-1],i=n&&n[1].type==="linePrefix"?n[2].sliceSerialize(n[1],!0).length:0,o=0;return s;function s(d){let g=a.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!a.containerState.marker||d===a.containerState.marker:Ka(d)){if(a.containerState.type||(a.containerState.type=g,r.enter(g,{_container:!0})),g==="listUnordered")return r.enter("listItemPrefix"),d===42||d===45?r.check(wn,t,c)(d):c(d);if(!a.interrupt||d===49)return r.enter("listItemPrefix"),r.enter("listItemValue"),l(d)}return t(d)}function l(d){return Ka(d)&&++o<10?(r.consume(d),l):(!a.interrupt||o<2)&&(a.containerState.marker?d===a.containerState.marker:d===41||d===46)?(r.exit("listItemValue"),c(d)):t(d)}function c(d){return r.enter("listItemMarker"),r.consume(d),r.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||d,r.check(zr,a.interrupt?t:u,r.attempt(NC,m,p))}function u(d){return a.containerState.initialBlankLine=!0,i++,m(d)}function p(d){return ie(d)?(r.enter("listItemPrefixWhitespace"),r.consume(d),r.exit("listItemPrefixWhitespace"),m):t(d)}function m(d){return a.containerState.size=i+a.sliceSerialize(r.exit("listItemPrefix"),!0).length,e(d)}}function MC(r,e,t){let a=this;return a.containerState._closeFlow=void 0,r.check(zr,n,i);function n(s){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,oe(r,e,"listItemIndent",a.containerState.size+1)(s)}function i(s){return a.containerState.furtherBlankLines||!ie(s)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,o(s)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,r.attempt(OC,e,o)(s))}function o(s){return a.containerState._closeFlow=!0,a.interrupt=void 0,oe(r,r.attempt(ct,e,t),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function FC(r,e,t){let a=this;return oe(r,n,"listItemIndent",a.containerState.size+1);function n(i){let o=a.events[a.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===a.containerState.size?e(i):t(i)}}function BC(r){r.exit(this.containerState.type)}function GC(r,e,t){let a=this;return oe(r,n,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function n(i){let o=a.events[a.events.length-1];return!ie(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):t(i)}}var Ko={name:"setextUnderline",tokenize:UC,resolveTo:zC};function zC(r,e){let t=r.length,a,n,i;for(;t--;)if(r[t][0]==="enter"){if(r[t][1].type==="content"){a=t;break}r[t][1].type==="paragraph"&&(n=t)}else r[t][1].type==="content"&&r.splice(t,1),!i&&r[t][1].type==="definition"&&(i=t);let o={type:"setextHeading",start:Object.assign({},r[n][1].start),end:Object.assign({},r[r.length-1][1].end)};return r[n][1].type="setextHeadingText",i?(r.splice(n,0,["enter",o,e]),r.splice(i+1,0,["exit",r[a][1],e]),r[a][1].end=Object.assign({},r[i][1].end)):r[a][1]=o,r.push(["exit",o,e]),r}function UC(r,e,t){let a=this,n;return i;function i(c){let u=a.events.length,p;for(;u--;)if(a.events[u][1].type!=="lineEnding"&&a.events[u][1].type!=="linePrefix"&&a.events[u][1].type!=="content"){p=a.events[u][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(r.enter("setextHeadingLine"),n=c,o(c)):t(c)}function o(c){return r.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===n?(r.consume(c),s):(r.exit("setextHeadingLineSequence"),ie(c)?oe(r,l,"lineSuffix")(c):l(c))}function l(c){return c===null||$(c)?(r.exit("setextHeadingLine"),e(c)):t(c)}}var $h={tokenize:HC};function HC(r){let e=this,t=r.attempt(zr,a,r.attempt(this.parser.constructs.flowInitial,n,oe(r,r.attempt(this.parser.constructs.flow,n,r.attempt(wc,n)),"linePrefix")));return t;function a(i){if(i===null){r.consume(i);return}return r.enter("lineEndingBlank"),r.consume(i),r.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function n(i){if(i===null){r.consume(i);return}return r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),e.currentConstruct=void 0,t}}var Xh={resolveAll:Qh()},Yh=Jh("string"),Zh=Jh("text");function Jh(r){return{tokenize:e,resolveAll:Qh(r==="text"?VC:void 0)};function e(t){let a=this,n=this.parser.constructs[r],i=t.attempt(n,o,s);return o;function o(u){return c(u)?i(u):s(u)}function s(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),l}function l(u){return c(u)?(t.exit("data"),i(u)):(t.consume(u),l)}function c(u){if(u===null)return!0;let p=n[u],m=-1;if(p)for(;++m<p.length;){let d=p[m];if(!d.previous||d.previous.call(a,a.previous))return!0}return!1}}}function Qh(r){return e;function e(t,a){let n=-1,i;for(;++n<=t.length;)i===void 0?t[n]&&t[n][1].type==="data"&&(i=n,n++):(!t[n]||t[n][1].type!=="data")&&(n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),n=i+2),i=void 0);return r?r(t,a):t}}function VC(r,e){let t=0;for(;++t<=r.length;)if((t===r.length||r[t][1].type==="lineEnding")&&r[t-1][1].type==="data"){let a=r[t-1][1],n=e.sliceStream(a),i=n.length,o=-1,s=0,l;for(;i--;){let c=n[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(c===-2)l=!0,s++;else if(c!==-1){i++;break}}if(s){let c={type:t===r.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:a.end.line,column:a.end.column-s,offset:a.end.offset-s,_index:a.start._index+i,_bufferIndex:i?o:a.start._bufferIndex+o},end:Object.assign({},a.end)};a.end=Object.assign({},c.start),a.start.offset===a.end.offset?Object.assign(a,c):(r.splice(t,0,["enter",c,e],["exit",c,e]),t+=2)}t++}return r}function eg(r,e,t){let a=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),n={},i=[],o=[],s=[],l=!0,c={consume:I,enter:D,exit:C,attempt:R(M),check:R(F),interrupt:R(F,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:r,sliceStream:f,sliceSerialize:g,now:y,defineSkip:v,write:d},p=e.tokenize.call(u,c),m;return e.resolveAll&&i.push(e),u;function d(x){return o=mt(o,x),T(),o[o.length-1]!==null?[]:(G(e,0),u.events=oa(i,u.events,u),u.events)}function g(x,A){return jC(f(x),A)}function f(x){return WC(o,x)}function y(){let{line:x,column:A,offset:B,_index:X,_bufferIndex:K}=a;return{line:x,column:A,offset:B,_index:X,_bufferIndex:K}}function v(x){n[x.line]=x.column,O()}function T(){let x;for(;a._index<o.length;){let A=o[a._index];if(typeof A=="string")for(x=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===x&&a._bufferIndex<A.length;)E(A.charCodeAt(a._bufferIndex));else E(A)}}function E(x){l=void 0,m=x,p=p(x)}function I(x){$(x)?(a.line++,a.column=1,a.offset+=x===-3?2:1,O()):x!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===o[a._index].length&&(a._bufferIndex=-1,a._index++)),u.previous=x,l=!0}function D(x,A){let B=A||{};return B.type=x,B.start=y(),u.events.push(["enter",B,u]),s.push(B),B}function C(x){let A=s.pop();return A.end=y(),u.events.push(["exit",A,u]),A}function M(x,A){G(x,A.from)}function F(x,A){A.restore()}function R(x,A){return B;function B(X,K,Q){let Z,_,fe,Ie;return Array.isArray(X)?ne(X):"tokenize"in X?ne([X]):S(X);function S(Re){return ut;function ut(Se){let Ce=Se!==null&&Re[Se],gt=Se!==null&&Re.null,je=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(gt)?gt:gt?[gt]:[]];return ne(je)(Se)}}function ne(Re){return Z=Re,_=0,Re.length===0?Q:Te(Re[_])}function Te(Re){return ut;function ut(Se){return Ie=z(),fe=Re,Re.partial||(u.currentConstruct=Re),Re.name&&u.parser.constructs.disable.null.includes(Re.name)?We(Se):Re.tokenize.call(A?Object.assign(Object.create(u),A):u,c,Be,We)(Se)}}function Be(Re){return l=!0,x(fe,Ie),K}function We(Re){return l=!0,Ie.restore(),++_<Z.length?Te(Z[_]):Q}}}function G(x,A){x.resolveAll&&!i.includes(x)&&i.push(x),x.resolve&<(u.events,A,u.events.length-A,x.resolve(u.events.slice(A),u)),x.resolveTo&&(u.events=x.resolveTo(u.events,u))}function z(){let x=y(),A=u.previous,B=u.currentConstruct,X=u.events.length,K=Array.from(s);return{restore:Q,from:X};function Q(){a=x,u.previous=A,u.currentConstruct=B,u.events.length=X,s=K,O()}}function O(){a.line in n&&a.column<2&&(a.column=n[a.line],a.offset+=n[a.line]-1)}}function WC(r,e){let t=e.start._index,a=e.start._bufferIndex,n=e.end._index,i=e.end._bufferIndex,o;if(t===n)o=[r[t].slice(a,i)];else{if(o=r.slice(t,n),a>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(a):o.shift()}i>0&&o.push(r[n].slice(0,i))}return o}function jC(r,e){let t=-1,a=[],n;for(;++t<r.length;){let i=r[t],o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
3446
|
-
`;break}case-3:{
|
|
3447
|
-
`;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&n)continue;o=" ";break}default:o=String.fromCharCode(i)}n=i===-2,a.push(o)}return a.join("")}var Dc={};ws(Dc,{attentionMarkers:()=>QC,contentInitial:()=>KC,disable:()=>ek,document:()=>qC,flow:()=>XC,flowInitial:()=>$C,insideSpan:()=>JC,string:()=>YC,text:()=>ZC});var qC={42:ct,43:ct,45:ct,48:ct,49:ct,50:ct,51:ct,52:ct,53:ct,54:ct,55:ct,56:ct,57:ct,62:Bo},KC={91:Cc},$C={[-2]:Xa,[-1]:Xa,32:Xa},XC={35:Tc,42:wn,45:[Ko,wn],60:Ac,61:Ko,95:wn,96:Uo,126:Uo},YC={38:zo,92:Go},ZC={[-5]:Za,[-4]:Za,[-3]:Za,33:Rc,38:zo,42:$a,60:[Sc,Ic],91:Pc,92:[kc,Go],93:En,95:$a,96:Ec},JC={null:[$a,Xh]},QC={null:[42,95]},ek={null:[]};function Nc(r){let t=Mh([Dc,...(r||{}).extensions||[]]),a={defined:[],lazy:{},constructs:t,content:n(Hh),document:n(Wh),flow:n($h),string:n(Yh),text:n(Zh)};return a;function n(i){return o;function o(s){return eg(a,i,s)}}}function Oc(r){for(;!Vo(r););return r}var tg=/[\0\t\n\r]/g;function Lc(){let r=1,e="",t=!0,a;return n;function n(i,o,s){let l=[],c,u,p,m,d;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),p=0,e="",t&&(i.charCodeAt(0)===65279&&p++,t=void 0);p<i.length;){if(tg.lastIndex=p,c=tg.exec(i),m=c&&c.index!==void 0?c.index:i.length,d=i.charCodeAt(m),!c){e=i.slice(p);break}if(d===10&&p===m&&a)l.push(-3),a=void 0;else switch(a&&(l.push(-5),a=void 0),p<m&&(l.push(i.slice(p,m)),r+=m-p),d){case 0:{l.push(65533),r++;break}case 9:{for(u=Math.ceil(r/4)*4,l.push(-2);r++<u;)l.push(-1);break}case 10:{l.push(-4),r=1;break}default:a=!0,r=1}p=m+1}return s&&(a&&l.push(-5),e&&l.push(e),l.push(null)),l}}var tk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rg(r){return r.replace(tk,rk)}function rk(r,e,t){if(e)return e;if(t.charCodeAt(0)===35){let n=t.charCodeAt(1),i=n===120||n===88;return Fo(t.slice(i?2:1),i?16:10)}return ia(t)||r}function Ur(r){return!r||typeof r!="object"?"":"position"in r||"type"in r?ng(r.position):"start"in r||"end"in r?ng(r):"line"in r||"column"in r?Mc(r):""}function Mc(r){return ag(r&&r.line)+":"+ag(r&&r.column)}function ng(r){return Mc(r&&r.start)+"-"+Mc(r&&r.end)}function ag(r){return r&&typeof r=="number"?r:1}var og={}.hasOwnProperty;function Fc(r,e,t){return typeof e!="string"&&(t=e,e=void 0),nk(t)(Oc(Nc(t).document().write(Lc()(r,e,!0))))}function nk(r){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Qt),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(ye),blockQuote:i(ut),characterEscape:R,characterReference:R,codeFenced:i(Se),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Se,o),codeText:i(Ce,o),codeTextData:R,data:R,codeFlowValue:R,definition:i(gt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(je),hardBreakEscape:i(Wt),hardBreakTrailing:i(Wt),htmlFlow:i(Pt,o),htmlFlowData:R,htmlText:i(Pt,o),htmlTextData:R,image:i(cr),label:o,link:i(Qt),listItem:i(ft),listItemValue:m,listOrdered:i(qe,p),listUnordered:i(qe),paragraph:i(at),reference:S,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ye),strong:i(Qe),thematicBreak:i(dt)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:Re,autolinkProtocol:We,blockQuote:l(),characterEscapeValue:G,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:Be,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:d,codeFencedFenceMeta:g,codeFlowValue:G,codeIndented:l(v),codeText:l(B),codeTextData:G,data:G,definition:l(),definitionDestinationString:I,definitionLabelString:T,definitionTitleString:E,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(x),htmlFlowData:G,htmlText:l(A),htmlTextData:G,image:l(K),label:Z,labelText:Q,lineEnding:z,link:l(X),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:_,resourceTitleString:fe,resource:Ie,setextHeading:l(F),setextHeadingLineSequence:M,setextHeadingText:C,strong:l(),thematicBreak:l()}};sg(e,(r||{}).mdastExtensions||[]);let t={};return a;function a(L){let V={type:"root",children:[]},J={stack:[V],tokenStack:[],config:e,enter:s,exit:c,buffer:o,resume:u,data:t},le=[],Ee=-1;for(;++Ee<L.length;)if(L[Ee][1].type==="listOrdered"||L[Ee][1].type==="listUnordered")if(L[Ee][0]==="enter")le.push(Ee);else{let yt=le.pop();Ee=n(L,yt,Ee)}for(Ee=-1;++Ee<L.length;){let yt=e[L[Ee][0]];og.call(yt,L[Ee][1].type)&&yt[L[Ee][1].type].call(Object.assign({sliceSerialize:L[Ee][2].sliceSerialize},J),L[Ee][1])}if(J.tokenStack.length>0){let yt=J.tokenStack[J.tokenStack.length-1];(yt[1]||ig).call(J,void 0,yt[0])}for(V.position={start:Hr(L.length>0?L[0][1].start:{line:1,column:1,offset:0}),end:Hr(L.length>0?L[L.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<e.transforms.length;)V=e.transforms[Ee](V)||V;return V}function n(L,V,J){let le=V-1,Ee=-1,yt=!1,wt,Nt,Vr,Wr;for(;++le<=J;){let it=L[le];switch(it[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{it[0]==="enter"?Ee++:Ee--,Wr=void 0;break}case"lineEndingBlank":{it[0]==="enter"&&(wt&&!Wr&&!Ee&&!Vr&&(Vr=le),Wr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wr=void 0}if(!Ee&&it[0]==="enter"&&it[1].type==="listItemPrefix"||Ee===-1&&it[0]==="exit"&&(it[1].type==="listUnordered"||it[1].type==="listOrdered")){if(wt){let et=le;for(Nt=void 0;et--;){let jt=L[et];if(jt[1].type==="lineEnding"||jt[1].type==="lineEndingBlank"){if(jt[0]==="exit")continue;Nt&&(L[Nt][1].type="lineEndingBlank",yt=!0),jt[1].type="lineEnding",Nt=et}else if(!(jt[1].type==="linePrefix"||jt[1].type==="blockQuotePrefix"||jt[1].type==="blockQuotePrefixWhitespace"||jt[1].type==="blockQuoteMarker"||jt[1].type==="listItemIndent"))break}Vr&&(!Nt||Vr<Nt)&&(wt._spread=!0),wt.end=Object.assign({},Nt?L[Nt][1].start:it[1].end),L.splice(Nt||le,0,["exit",wt,it[2]]),le++,J++}if(it[1].type==="listItemPrefix"){let et={type:"listItem",_spread:!1,start:Object.assign({},it[1].start),end:void 0};wt=et,L.splice(le,0,["enter",et,it[2]]),le++,J++,Vr=void 0,Wr=!0}}}return L[V][1]._spread=yt,J}function i(L,V){return J;function J(le){s.call(this,L(le),le),V&&V.call(this,le)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(L,V,J){this.stack[this.stack.length-1].children.push(L),this.stack.push(L),this.tokenStack.push([V,J]),L.position={start:Hr(V.start),end:void 0}}function l(L){return V;function V(J){L&&L.call(this,J),c.call(this,J)}}function c(L,V){let J=this.stack.pop(),le=this.tokenStack.pop();if(le)le[0].type!==L.type&&(V?V.call(this,L,le[0]):(le[1]||ig).call(this,L,le[0]));else throw new Error("Cannot close `"+L.type+"` ("+Ur({start:L.start,end:L.end})+"): it\u2019s not open");J.position.end=Hr(L.end)}function u(){return vc(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(L){if(this.data.expectingFirstListItemValue){let V=this.stack[this.stack.length-2];V.start=Number.parseInt(this.sliceSerialize(L),10),this.data.expectingFirstListItemValue=void 0}}function d(){let L=this.resume(),V=this.stack[this.stack.length-1];V.lang=L}function g(){let L=this.resume(),V=this.stack[this.stack.length-1];V.meta=L}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L.replace(/(\r?\n|\r)$/g,"")}function T(L){let V=this.resume(),J=this.stack[this.stack.length-1];J.label=V,J.identifier=wr(this.sliceSerialize(L)).toLowerCase()}function E(){let L=this.resume(),V=this.stack[this.stack.length-1];V.title=L}function I(){let L=this.resume(),V=this.stack[this.stack.length-1];V.url=L}function D(L){let V=this.stack[this.stack.length-1];if(!V.depth){let J=this.sliceSerialize(L).length;V.depth=J}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function M(L){let V=this.stack[this.stack.length-1];V.depth=this.sliceSerialize(L).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function R(L){let J=this.stack[this.stack.length-1].children,le=J[J.length-1];(!le||le.type!=="text")&&(le=Dt(),le.position={start:Hr(L.start),end:void 0},J.push(le)),this.stack.push(le)}function G(L){let V=this.stack.pop();V.value+=this.sliceSerialize(L),V.position.end=Hr(L.end)}function z(L){let V=this.stack[this.stack.length-1];if(this.data.atHardBreak){let J=V.children[V.children.length-1];J.position.end=Hr(L.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(V.type)&&(R.call(this,L),G.call(this,L))}function O(){this.data.atHardBreak=!0}function x(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L}function A(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L}function B(){let L=this.resume(),V=this.stack[this.stack.length-1];V.value=L}function X(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let V=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=V,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function K(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let V=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=V,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function Q(L){let V=this.sliceSerialize(L),J=this.stack[this.stack.length-2];J.label=rg(V),J.identifier=wr(V).toLowerCase()}function Z(){let L=this.stack[this.stack.length-1],V=this.resume(),J=this.stack[this.stack.length-1];if(this.data.inReference=!0,J.type==="link"){let le=L.children;J.children=le}else J.alt=V}function _(){let L=this.resume(),V=this.stack[this.stack.length-1];V.url=L}function fe(){let L=this.resume(),V=this.stack[this.stack.length-1];V.title=L}function Ie(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function ne(L){let V=this.resume(),J=this.stack[this.stack.length-1];J.label=V,J.identifier=wr(this.sliceSerialize(L)).toLowerCase(),this.data.referenceType="full"}function Te(L){this.data.characterReferenceType=L.type}function Be(L){let V=this.sliceSerialize(L),J=this.data.characterReferenceType,le;J?(le=Fo(V,J==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):le=ia(V);let Ee=this.stack.pop();Ee.value+=le,Ee.position.end=Hr(L.end)}function We(L){G.call(this,L);let V=this.stack[this.stack.length-1];V.url=this.sliceSerialize(L)}function Re(L){G.call(this,L);let V=this.stack[this.stack.length-1];V.url="mailto:"+this.sliceSerialize(L)}function ut(){return{type:"blockquote",children:[]}}function Se(){return{type:"code",lang:null,meta:null,value:""}}function Ce(){return{type:"inlineCode",value:""}}function gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function je(){return{type:"emphasis",children:[]}}function ye(){return{type:"heading",depth:0,children:[]}}function Wt(){return{type:"break"}}function Pt(){return{type:"html",value:""}}function cr(){return{type:"image",title:null,url:"",alt:null}}function Qt(){return{type:"link",title:null,url:"",children:[]}}function qe(L){return{type:"list",ordered:L.type==="listOrdered",start:null,spread:L._spread,children:[]}}function ft(L){return{type:"listItem",spread:L._spread,checked:null,children:[]}}function at(){return{type:"paragraph",children:[]}}function Qe(){return{type:"strong",children:[]}}function Dt(){return{type:"text",value:""}}function dt(){return{type:"thematicBreak"}}}function Hr(r){return{line:r.line,column:r.column,offset:r.offset}}function sg(r,e){let t=-1;for(;++t<e.length;){let a=e[t];Array.isArray(a)?sg(r,a):ak(r,a)}}function ak(r,e){let t;for(t in e)if(og.call(e,t))switch(t){case"canContainEols":{let a=e[t];a&&r[t].push(...a);break}case"transforms":{let a=e[t];a&&r[t].push(...a);break}case"enter":case"exit":{let a=e[t];a&&Object.assign(r[t],a);break}}}function ig(r,e){throw r?new Error("Cannot close `"+r.type+"` ("+Ur({start:r.start,end:r.end})+"): a different token (`"+e.type+"`, "+Ur({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Ur({start:e.start,end:e.end})+") is still open")}function $o(r){let e=this;e.parser=t;function t(a){return Fc(a,{...e.data("settings"),...r,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function lg(r,e){let t={type:"element",tagName:"blockquote",properties:{},children:r.wrap(r.all(e),!0)};return r.patch(e,t),r.applyData(e,t)}function cg(r,e){let t={type:"element",tagName:"br",properties:{},children:[]};return r.patch(e,t),[r.applyData(e,t),{type:"text",value:`
|
|
3448
|
-
`}]}function
|
|
3449
|
-
`:"",a={};e.lang&&(a.className=["language-"+e.lang]);let n={type:"element",tagName:"code",properties:a,children:[{type:"text",value:t}]};return e.meta&&(n.data={meta:e.meta}),r.patch(e,n),n=r.applyData(e,n),n={type:"element",tagName:"pre",properties:{},children:[n]},r.patch(e,n),n}function
|
|
3450
|
-
`}),u.type==="element"&&u.tagName==="p"&&!n?
|
|
3451
|
-
`});let c={type:"element",tagName:"li",properties:i,children:
|
|
3452
|
-
`},{type:"element",tagName:"ol",properties:{},children:r.wrap(
|
|
3453
|
-
`}]}}var
|
|
3468
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Cy(r,e,t,a){let n=a.schema,i=n.space==="svg"?!1:a.settings.omitOptionalTags,s=n.space==="svg"?a.settings.closeEmptyElements:a.settings.voids.includes(r.tagName.toLowerCase()),o=[],l;n.space==="html"&&r.tagName==="svg"&&(a.schema=_l);let c=Jx(a,r.properties),u=a.all(n.space==="html"&&r.tagName==="template"?r.content:r);return a.schema=n,u&&(s=!1),(c||!i||!ky(r,e,t))&&(o.push("<",r.tagName,c?" "+c:""),s&&(n.space==="svg"||a.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!a.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&o.push(" "),o.push("/")),o.push(">")),o.push(u),!s&&(!i||!os(r,e,t))&&o.push("</"+r.tagName+">"),o.join("")}function Jx(r,e){let t=[],a=-1,n;if(e){for(n in e)if(e[n]!==null&&e[n]!==void 0){let i=Zx(r,n,e[n]);i&&t.push(i)}}for(;++a<t.length;){let i=r.settings.tightAttributes?t[a].charAt(t[a].length-1):void 0;a!==t.length-1&&i!=='"'&&i!=="'"&&(t[a]+=" ")}return t.join("")}function Zx(r,e,t){let a=Ad(r.schema,e),n=r.settings.allowParseErrors&&r.schema.space==="html"?0:1,i=r.settings.allowDangerousCharacters?0:1,s=r.quote,o;if(a.overloadedBoolean&&(t===a.attribute||t==="")?t=!0:(a.boolean||a.overloadedBoolean&&typeof t!="string")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";let l=Wr(a.attribute,Object.assign({},r.settings.characterReferences,{subset:kl.name[n][i]}));return t===!0||(t=Array.isArray(t)?(a.commaSeparated?_y:jf)(t,{padLeft:!r.settings.tightCommaSeparatedLists}):String(t),r.settings.collapseEmptyAttributes&&!t)?l:(r.settings.preferUnquoted&&(o=Wr(t,Object.assign({},r.settings.characterReferences,{attribute:!0,subset:kl.unquoted[n][i]}))),o!==t&&(r.settings.quoteSmart&&Rd(t,s)>Rd(t,r.alternative)&&(s=r.alternative),o=s+Wr(t,Object.assign({},r.settings.characterReferences,{subset:(s==="'"?kl.single:kl.double)[n][i],attribute:!0}))+s),l+(o&&"="+o))}var Qx=["<","&"];function Cl(r,e,t,a){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?r.value:Wr(r.value,Object.assign({},a.settings.characterReferences,{subset:Qx}))}function xy(r,e,t,a){return a.settings.allowDangerousHtml?r.value:Cl(r,e,t,a)}function Ty(r,e,t,a){return a.all(r)}var Ay=ly("type",{invalid:eT,unknown:tT,handlers:{comment:by,doctype:vy,element:Cy,raw:xy,root:Ty,text:Cl}});function eT(r){throw new Error("Expected node, not `"+r+"`")}function tT(r){let e=r;throw new Error("Cannot compile unknown node `"+e.type+"`")}var rT={},nT={},aT=[];function Nd(r,e){let t=e||rT,a=t.quote||'"',n=a==='"'?"'":'"';if(a!=='"'&&a!=="'")throw new Error("Invalid quote `"+a+"`, expected `'` or `\"`");return{one:iT,all:sT,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||ty,characterReferences:t.characterReferences||nT,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?_l:sy,quote:a,alternative:n}.one(Array.isArray(r)?{type:"root",children:r}:r,void 0,void 0)}function iT(r,e,t){return Ay(r,e,t,this)}function sT(r){let e=[],t=r&&r.children||aT,a=-1;for(;++a<t.length;)e[a]=this.one(t[a],a,r);return e.join("")}function xl(r){let e=this,t={...e.data("settings"),...r};e.compiler=a;function a(n){return Nd(n,t)}}var oT={};function Md(r,e){let t=e||oT,a=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,n=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return Ry(r,a,n)}function Ry(r,e,t){if(lT(r)){if("value"in r)return r.type==="html"&&!t?"":r.value;if(e&&"alt"in r&&r.alt)return r.alt;if("children"in r)return Iy(r.children,e,t)}return Array.isArray(r)?Iy(r,e,t):""}function Iy(r,e,t){let a=[],n=-1;for(;++n<r.length;)a[n]=Ry(r[n],e,t);return a.join("")}function lT(r){return!!(r&&typeof r=="object")}var Py=document.createElement("i");function ri(r){let e="&"+r+";";Py.innerHTML=e;let t=Py.textContent;return t.charCodeAt(t.length-1)===59&&r!=="semi"||t===e?!1:t}function bt(r,e,t,a){let n=r.length,i=0,s;if(e<0?e=-e>n?0:n+e:e=e>n?n:e,t=t>0?t:0,a.length<1e4)s=Array.from(a),s.unshift(e,t),r.splice(...s);else for(t&&r.splice(e,t);i<a.length;)s=a.slice(i,i+1e4),s.unshift(e,0),r.splice(...s),i+=1e4,e+=1e4}function wt(r,e){return r.length>0?(bt(r,r.length,0,e),r):e}var Dy={}.hasOwnProperty;function Ny(r){let e={},t=-1;for(;++t<r.length;)cT(e,r[t]);return e}function cT(r,e){let t;for(t in e){let n=(Dy.call(r,t)?r[t]:void 0)||(r[t]={}),i=e[t],s;if(i)for(s in i){Dy.call(n,s)||(n[s]=[]);let o=i[s];uT(n[s],Array.isArray(o)?o:o?[o]:[])}}}function uT(r,e){let t=-1,a=[];for(;++t<e.length;)(e[t].add==="after"?r:a).push(e[t]);bt(r,0,0,a)}function Tl(r,e){let t=Number.parseInt(r,e);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCodePoint(t)}function qr(r){return r.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Ut=hn(/[A-Za-z]/),it=hn(/[\dA-Za-z]/),My=hn(/[#-'*+\--9=?A-Z^-~]/);function ls(r){return r!==null&&(r<32||r===127)}var cs=hn(/\d/),Oy=hn(/[\dA-Fa-f]/),Ly=hn(/[!-/:-@[-`{-~]/);function X(r){return r!==null&&r<-2}function Ke(r){return r!==null&&(r<0||r===32)}function le(r){return r===-2||r===-1||r===32}var By=hn(/\p{P}|\p{S}/u),Fy=hn(/\s/);function hn(r){return e;function e(t){return t!==null&&t>-1&&r.test(String.fromCharCode(t))}}function ar(r){let e=[],t=-1,a=0,n=0;for(;++t<r.length;){let i=r.charCodeAt(t),s="";if(i===37&&it(r.charCodeAt(t+1))&&it(r.charCodeAt(t+2)))n=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){let o=r.charCodeAt(t+1);i<56320&&o>56319&&o<57344?(s=String.fromCharCode(i,o),n=1):s="\uFFFD"}else s=String.fromCharCode(i);s&&(e.push(r.slice(a,t),encodeURIComponent(s)),a=t+n+1,s=""),n&&(t+=n,n=0)}return e.join("")+r.slice(a)}function ce(r,e,t,a){let n=a?a-1:Number.POSITIVE_INFINITY,i=0;return s;function s(l){return le(l)?(r.enter(t),o(l)):e(l)}function o(l){return le(l)&&i++<n?(r.consume(l),o):(r.exit(t),e(l))}}var Gy={tokenize:dT};function dT(r){let e=r.attempt(this.parser.constructs.contentInitial,a,n),t;return e;function a(o){if(o===null){r.consume(o);return}return r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),ce(r,e,"linePrefix")}function n(o){return r.enter("paragraph"),i(o)}function i(o){let l=r.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,s(o)}function s(o){if(o===null){r.exit("chunkText"),r.exit("paragraph"),r.consume(o);return}return X(o)?(r.consume(o),r.exit("chunkText"),i):(r.consume(o),s)}}var Uy={tokenize:pT},zy={tokenize:mT};function pT(r){let e=this,t=[],a=0,n,i,s;return o;function o(S){if(a<t.length){let A=t[a];return e.containerState=A[1],r.attempt(A[0].continuation,l,c)(S)}return c(S)}function l(S){if(a++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,n&&x();let A=e.events.length,R=A,k;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){k=e.events[R][1].end;break}b(a);let O=A;for(;O<e.events.length;)e.events[O][1].end=Object.assign({},k),O++;return bt(e.events,R+1,0,e.events.slice(A)),e.events.length=O,c(S)}return o(S)}function c(S){if(a===t.length){if(!n)return m(S);if(n.currentConstruct&&n.currentConstruct.concrete)return g(S);e.interrupt=!!(n.currentConstruct&&!n._gfmTableDynamicInterruptHack)}return e.containerState={},r.check(zy,u,p)(S)}function u(S){return n&&x(),b(a),m(S)}function p(S){return e.parser.lazy[e.now().line]=a!==t.length,s=e.now().offset,g(S)}function m(S){return e.containerState={},r.attempt(zy,d,g)(S)}function d(S){return a++,t.push([e.currentConstruct,e.containerState]),m(S)}function g(S){if(S===null){n&&x(),b(0),r.consume(S);return}return n=n||e.parser.flow(e.now()),r.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:n}),f(S)}function f(S){if(S===null){y(r.exit("chunkFlow"),!0),b(0),r.consume(S);return}return X(S)?(r.consume(S),y(r.exit("chunkFlow")),a=0,e.interrupt=void 0,o):(r.consume(S),f)}function y(S,A){let R=e.sliceStream(S);if(A&&R.push(null),S.previous=i,i&&(i.next=S),i=S,n.defineSkip(S.start),n.write(R),e.parser.lazy[S.start.line]){let k=n.events.length;for(;k--;)if(n.events[k][1].start.offset<s&&(!n.events[k][1].end||n.events[k][1].end.offset>s))return;let O=e.events.length,B=O,P,G;for(;B--;)if(e.events[B][0]==="exit"&&e.events[B][1].type==="chunkFlow"){if(P){G=e.events[B][1].end;break}P=!0}for(b(a),k=O;k<e.events.length;)e.events[k][1].end=Object.assign({},G),k++;bt(e.events,B+1,0,e.events.slice(O)),e.events.length=k}}function b(S){let A=t.length;for(;A-- >S;){let R=t[A];e.containerState=R[1],R[0].exit.call(e,r)}t.length=S}function x(){n.write([null]),i=void 0,n=void 0,e.containerState._closeFlow=void 0}}function mT(r,e,t){return ce(r,r.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Od(r){if(r===null||Ke(r)||Fy(r))return 1;if(By(r))return 2}function ni(r,e,t){let a=[],n=-1;for(;++n<r.length;){let i=r[n].resolveAll;i&&!a.includes(i)&&(e=i(e,t),a.push(i))}return e}var us={name:"attention",tokenize:gT,resolveAll:hT};function hT(r,e){let t=-1,a,n,i,s,o,l,c,u;for(;++t<r.length;)if(r[t][0]==="enter"&&r[t][1].type==="attentionSequence"&&r[t][1]._close){for(a=t;a--;)if(r[a][0]==="exit"&&r[a][1].type==="attentionSequence"&&r[a][1]._open&&e.sliceSerialize(r[a][1]).charCodeAt(0)===e.sliceSerialize(r[t][1]).charCodeAt(0)){if((r[a][1]._close||r[t][1]._open)&&(r[t][1].end.offset-r[t][1].start.offset)%3&&!((r[a][1].end.offset-r[a][1].start.offset+r[t][1].end.offset-r[t][1].start.offset)%3))continue;l=r[a][1].end.offset-r[a][1].start.offset>1&&r[t][1].end.offset-r[t][1].start.offset>1?2:1;let p=Object.assign({},r[a][1].end),m=Object.assign({},r[t][1].start);Hy(p,-l),Hy(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:p,end:Object.assign({},r[a][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},r[t][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},r[a][1].end),end:Object.assign({},r[t][1].start)},n={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},r[a][1].end=Object.assign({},s.start),r[t][1].start=Object.assign({},o.end),c=[],r[a][1].end.offset-r[a][1].start.offset&&(c=wt(c,[["enter",r[a][1],e],["exit",r[a][1],e]])),c=wt(c,[["enter",n,e],["enter",s,e],["exit",s,e],["enter",i,e]]),c=wt(c,ni(e.parser.constructs.insideSpan.null,r.slice(a+1,t),e)),c=wt(c,[["exit",i,e],["enter",o,e],["exit",o,e],["exit",n,e]]),r[t][1].end.offset-r[t][1].start.offset?(u=2,c=wt(c,[["enter",r[t][1],e],["exit",r[t][1],e]])):u=0,bt(r,a-1,t-a+3,c),t=a+c.length-u-2;break}}for(t=-1;++t<r.length;)r[t][1].type==="attentionSequence"&&(r[t][1].type="data");return r}function gT(r,e){let t=this.parser.constructs.attentionMarkers.null,a=this.previous,n=Od(a),i;return s;function s(l){return i=l,r.enter("attentionSequence"),o(l)}function o(l){if(l===i)return r.consume(l),o;let c=r.exit("attentionSequence"),u=Od(l),p=!u||u===2&&n||t.includes(l),m=!n||n===2&&u||t.includes(a);return c._open=!!(i===42?p:p&&(n||!m)),c._close=!!(i===42?m:m&&(u||!p)),e(l)}}function Hy(r,e){r.column+=e,r.offset+=e,r._bufferIndex+=e}var Ld={name:"autolink",tokenize:fT};function fT(r,e,t){let a=0;return n;function n(d){return r.enter("autolink"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.enter("autolinkProtocol"),i}function i(d){return Ut(d)?(r.consume(d),s):d===64?t(d):c(d)}function s(d){return d===43||d===45||d===46||it(d)?(a=1,o(d)):c(d)}function o(d){return d===58?(r.consume(d),a=0,l):(d===43||d===45||d===46||it(d))&&a++<32?(r.consume(d),o):(a=0,c(d))}function l(d){return d===62?(r.exit("autolinkProtocol"),r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):d===null||d===32||d===60||ls(d)?t(d):(r.consume(d),l)}function c(d){return d===64?(r.consume(d),u):My(d)?(r.consume(d),c):t(d)}function u(d){return it(d)?p(d):t(d)}function p(d){return d===46?(r.consume(d),a=0,u):d===62?(r.exit("autolinkProtocol").type="autolinkEmail",r.enter("autolinkMarker"),r.consume(d),r.exit("autolinkMarker"),r.exit("autolink"),e):m(d)}function m(d){if((d===45||it(d))&&a++<63){let g=d===45?m:p;return r.consume(d),g}return t(d)}}var gn={tokenize:yT,partial:!0};function yT(r,e,t){return a;function a(i){return le(i)?ce(r,n,"linePrefix")(i):n(i)}function n(i){return i===null||X(i)?e(i):t(i)}}var Al={name:"blockQuote",tokenize:bT,continuation:{tokenize:vT},exit:_T};function bT(r,e,t){let a=this;return n;function n(s){if(s===62){let o=a.containerState;return o.open||(r.enter("blockQuote",{_container:!0}),o.open=!0),r.enter("blockQuotePrefix"),r.enter("blockQuoteMarker"),r.consume(s),r.exit("blockQuoteMarker"),i}return t(s)}function i(s){return le(s)?(r.enter("blockQuotePrefixWhitespace"),r.consume(s),r.exit("blockQuotePrefixWhitespace"),r.exit("blockQuotePrefix"),e):(r.exit("blockQuotePrefix"),e(s))}}function vT(r,e,t){let a=this;return n;function n(s){return le(s)?ce(r,i,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return r.attempt(Al,e,t)(s)}}function _T(r){r.exit("blockQuote")}var Il={name:"characterEscape",tokenize:ST};function ST(r,e,t){return a;function a(i){return r.enter("characterEscape"),r.enter("escapeMarker"),r.consume(i),r.exit("escapeMarker"),n}function n(i){return Ly(i)?(r.enter("characterEscapeValue"),r.consume(i),r.exit("characterEscapeValue"),r.exit("characterEscape"),e):t(i)}}var Rl={name:"characterReference",tokenize:ET};function ET(r,e,t){let a=this,n=0,i,s;return o;function o(p){return r.enter("characterReference"),r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),l}function l(p){return p===35?(r.enter("characterReferenceMarkerNumeric"),r.consume(p),r.exit("characterReferenceMarkerNumeric"),c):(r.enter("characterReferenceValue"),i=31,s=it,u(p))}function c(p){return p===88||p===120?(r.enter("characterReferenceMarkerHexadecimal"),r.consume(p),r.exit("characterReferenceMarkerHexadecimal"),r.enter("characterReferenceValue"),i=6,s=Oy,u):(r.enter("characterReferenceValue"),i=7,s=cs,u(p))}function u(p){if(p===59&&n){let m=r.exit("characterReferenceValue");return s===it&&!ri(a.sliceSerialize(m))?t(p):(r.enter("characterReferenceMarker"),r.consume(p),r.exit("characterReferenceMarker"),r.exit("characterReference"),e)}return s(p)&&n++<i?(r.consume(p),u):t(p)}}var Vy={tokenize:kT,partial:!0},Pl={name:"codeFenced",tokenize:wT,concrete:!0};function wT(r,e,t){let a=this,n={tokenize:R,partial:!0},i=0,s=0,o;return l;function l(k){return c(k)}function c(k){let O=a.events[a.events.length-1];return i=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,o=k,r.enter("codeFenced"),r.enter("codeFencedFence"),r.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===o?(s++,r.consume(k),u):s<3?t(k):(r.exit("codeFencedFenceSequence"),le(k)?ce(r,p,"whitespace")(k):p(k))}function p(k){return k===null||X(k)?(r.exit("codeFencedFence"),a.interrupt?e(k):r.check(Vy,f,A)(k)):(r.enter("codeFencedFenceInfo"),r.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||X(k)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),p(k)):le(k)?(r.exit("chunkString"),r.exit("codeFencedFenceInfo"),ce(r,d,"whitespace")(k)):k===96&&k===o?t(k):(r.consume(k),m)}function d(k){return k===null||X(k)?p(k):(r.enter("codeFencedFenceMeta"),r.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||X(k)?(r.exit("chunkString"),r.exit("codeFencedFenceMeta"),p(k)):k===96&&k===o?t(k):(r.consume(k),g)}function f(k){return r.attempt(n,A,y)(k)}function y(k){return r.enter("lineEnding"),r.consume(k),r.exit("lineEnding"),b}function b(k){return i>0&&le(k)?ce(r,x,"linePrefix",i+1)(k):x(k)}function x(k){return k===null||X(k)?r.check(Vy,f,A)(k):(r.enter("codeFlowValue"),S(k))}function S(k){return k===null||X(k)?(r.exit("codeFlowValue"),x(k)):(r.consume(k),S)}function A(k){return r.exit("codeFenced"),e(k)}function R(k,O,B){let P=0;return G;function G(F){return k.enter("lineEnding"),k.consume(F),k.exit("lineEnding"),U}function U(F){return k.enter("codeFencedFence"),le(F)?ce(k,M,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):M(F)}function M(F){return F===o?(k.enter("codeFencedFenceSequence"),T(F)):B(F)}function T(F){return F===o?(P++,k.consume(F),T):P>=s?(k.exit("codeFencedFenceSequence"),le(F)?ce(k,I,"whitespace")(F):I(F)):B(F)}function I(F){return F===null||X(F)?(k.exit("codeFencedFence"),O(F)):B(F)}}}function kT(r,e,t){let a=this;return n;function n(s){return s===null?t(s):(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),i)}function i(s){return a.parser.lazy[a.now().line]?t(s):e(s)}}var ds={name:"codeIndented",tokenize:xT},CT={tokenize:TT,partial:!0};function xT(r,e,t){let a=this;return n;function n(c){return r.enter("codeIndented"),ce(r,i,"linePrefix",5)(c)}function i(c){let u=a.events[a.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):t(c)}function s(c){return c===null?l(c):X(c)?r.attempt(CT,s,l)(c):(r.enter("codeFlowValue"),o(c))}function o(c){return c===null||X(c)?(r.exit("codeFlowValue"),s(c)):(r.consume(c),o)}function l(c){return r.exit("codeIndented"),e(c)}}function TT(r,e,t){let a=this;return n;function n(s){return a.parser.lazy[a.now().line]?t(s):X(s)?(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),n):ce(r,i,"linePrefix",5)(s)}function i(s){let o=a.events[a.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(s):X(s)?n(s):t(s)}}var Bd={name:"codeText",tokenize:RT,resolve:AT,previous:IT};function AT(r){let e=r.length-4,t=3,a,n;if((r[t][1].type==="lineEnding"||r[t][1].type==="space")&&(r[e][1].type==="lineEnding"||r[e][1].type==="space")){for(a=t;++a<e;)if(r[a][1].type==="codeTextData"){r[t][1].type="codeTextPadding",r[e][1].type="codeTextPadding",t+=2,e-=2;break}}for(a=t-1,e++;++a<=e;)n===void 0?a!==e&&r[a][1].type!=="lineEnding"&&(n=a):(a===e||r[a][1].type==="lineEnding")&&(r[n][1].type="codeTextData",a!==n+2&&(r[n][1].end=r[a-1][1].end,r.splice(n+2,a-n-2),e-=a-n-2,a=n+2),n=void 0);return r}function IT(r){return r!==96||this.events[this.events.length-1][1].type==="characterEscape"}function RT(r,e,t){let a=this,n=0,i,s;return o;function o(m){return r.enter("codeText"),r.enter("codeTextSequence"),l(m)}function l(m){return m===96?(r.consume(m),n++,l):(r.exit("codeTextSequence"),c(m))}function c(m){return m===null?t(m):m===32?(r.enter("space"),r.consume(m),r.exit("space"),c):m===96?(s=r.enter("codeTextSequence"),i=0,p(m)):X(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),c):(r.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||X(m)?(r.exit("codeTextData"),c(m)):(r.consume(m),u)}function p(m){return m===96?(r.consume(m),i++,p):i===n?(r.exit("codeTextSequence"),r.exit("codeText"),e(m)):(s.type="codeTextData",u(m))}}var Dl=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let a=t??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(e,a):e>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(e,t,a){let n=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return a&&ps(this.left,a),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),ps(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ps(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,Number.POSITIVE_INFINITY);ps(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);ps(this.left,t.reverse())}}};function ps(r,e){let t=0;if(e.length<1e4)r.push(...e);else for(;t<e.length;)r.push(...e.slice(t,t+1e4)),t+=1e4}function Nl(r){let e={},t=-1,a,n,i,s,o,l,c,u=new Dl(r);for(;++t<u.length;){for(;t in e;)t=e[t];if(a=u.get(t),t&&a[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(l=a[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(a[0]==="enter")a[1].contentType&&(Object.assign(e,PT(u,t)),t=e[t],c=!0);else if(a[1]._container){for(i=t,n=void 0;i--&&(s=u.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(n&&(u.get(n)[1].type="lineEndingBlank"),s[1].type="lineEnding",n=i);n&&(a[1].end=Object.assign({},u.get(n)[1].start),o=u.slice(n,t),o.unshift(a),u.splice(n,t-n+1,o))}}return bt(r,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function PT(r,e){let t=r.get(e)[1],a=r.get(e)[2],n=e-1,i=[],s=t._tokenizer||a.parser[t.contentType](t.start),o=s.events,l=[],c={},u,p,m=-1,d=t,g=0,f=0,y=[f];for(;d;){for(;r.get(++n)[1]!==d;);i.push(n),d._tokenizer||(u=a.sliceStream(d),d.next||u.push(null),p&&s.defineSkip(d.start),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),p=d,d=d.next}for(d=t;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(f=m+1,y.push(f),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(s.events=[],d?(d._tokenizer=void 0,d.previous=void 0):y.pop(),m=y.length;m--;){let b=o.slice(y[m],y[m+1]),x=i.pop();l.push([x,x+b.length-1]),r.splice(x,2,b)}for(l.reverse(),m=-1;++m<l.length;)c[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return c}var Fd={tokenize:MT,resolve:NT},DT={tokenize:OT,partial:!0};function NT(r){return Nl(r),r}function MT(r,e){let t;return a;function a(o){return r.enter("content"),t=r.enter("chunkContent",{contentType:"content"}),n(o)}function n(o){return o===null?i(o):X(o)?r.check(DT,s,i)(o):(r.consume(o),n)}function i(o){return r.exit("chunkContent"),r.exit("content"),e(o)}function s(o){return r.consume(o),r.exit("chunkContent"),t.next=r.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,n}}function OT(r,e,t){let a=this;return n;function n(s){return r.exit("chunkContent"),r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),ce(r,i,"linePrefix")}function i(s){if(s===null||X(s))return t(s);let o=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(s):r.interrupt(a.parser.constructs.flow,t,e)(s)}}function Ml(r,e,t,a,n,i,s,o,l){let c=l||Number.POSITIVE_INFINITY,u=0;return p;function p(b){return b===60?(r.enter(a),r.enter(n),r.enter(i),r.consume(b),r.exit(i),m):b===null||b===32||b===41||ls(b)?t(b):(r.enter(a),r.enter(s),r.enter(o),r.enter("chunkString",{contentType:"string"}),f(b))}function m(b){return b===62?(r.enter(i),r.consume(b),r.exit(i),r.exit(n),r.exit(a),e):(r.enter(o),r.enter("chunkString",{contentType:"string"}),d(b))}function d(b){return b===62?(r.exit("chunkString"),r.exit(o),m(b)):b===null||b===60||X(b)?t(b):(r.consume(b),b===92?g:d)}function g(b){return b===60||b===62||b===92?(r.consume(b),d):d(b)}function f(b){return!u&&(b===null||b===41||Ke(b))?(r.exit("chunkString"),r.exit(o),r.exit(s),r.exit(a),e(b)):u<c&&b===40?(r.consume(b),u++,f):b===41?(r.consume(b),u--,f):b===null||b===32||b===40||ls(b)?t(b):(r.consume(b),b===92?y:f)}function y(b){return b===40||b===41||b===92?(r.consume(b),f):f(b)}}function Ol(r,e,t,a,n,i){let s=this,o=0,l;return c;function c(d){return r.enter(a),r.enter(n),r.consume(d),r.exit(n),r.enter(i),u}function u(d){return o>999||d===null||d===91||d===93&&!l||d===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?t(d):d===93?(r.exit(i),r.enter(n),r.consume(d),r.exit(n),r.exit(a),e):X(d)?(r.enter("lineEnding"),r.consume(d),r.exit("lineEnding"),u):(r.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===null||d===91||d===93||X(d)||o++>999?(r.exit("chunkString"),u(d)):(r.consume(d),l||(l=!le(d)),d===92?m:p)}function m(d){return d===91||d===92||d===93?(r.consume(d),o++,p):p(d)}}function Ll(r,e,t,a,n,i){let s;return o;function o(m){return m===34||m===39||m===40?(r.enter(a),r.enter(n),r.consume(m),r.exit(n),s=m===40?41:m,l):t(m)}function l(m){return m===s?(r.enter(n),r.consume(m),r.exit(n),r.exit(a),e):(r.enter(i),c(m))}function c(m){return m===s?(r.exit(i),l(s)):m===null?t(m):X(m)?(r.enter("lineEnding"),r.consume(m),r.exit("lineEnding"),ce(r,c,"linePrefix")):(r.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===s||m===null||X(m)?(r.exit("chunkString"),c(m)):(r.consume(m),m===92?p:u)}function p(m){return m===s||m===92?(r.consume(m),u):u(m)}}function ea(r,e){let t;return a;function a(n){return X(n)?(r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),t=!0,a):le(n)?ce(r,a,t?"linePrefix":"lineSuffix")(n):e(n)}}var Gd={name:"definition",tokenize:BT},LT={tokenize:FT,partial:!0};function BT(r,e,t){let a=this,n;return i;function i(d){return r.enter("definition"),s(d)}function s(d){return Ol.call(a,r,o,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function o(d){return n=qr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),d===58?(r.enter("definitionMarker"),r.consume(d),r.exit("definitionMarker"),l):t(d)}function l(d){return Ke(d)?ea(r,c)(d):c(d)}function c(d){return Ml(r,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function u(d){return r.attempt(LT,p,p)(d)}function p(d){return le(d)?ce(r,m,"whitespace")(d):m(d)}function m(d){return d===null||X(d)?(r.exit("definition"),a.parser.defined.push(n),e(d)):t(d)}}function FT(r,e,t){return a;function a(o){return Ke(o)?ea(r,n)(o):t(o)}function n(o){return Ll(r,i,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return le(o)?ce(r,s,"whitespace")(o):s(o)}function s(o){return o===null||X(o)?e(o):t(o)}}var zd={name:"hardBreakEscape",tokenize:GT};function GT(r,e,t){return a;function a(i){return r.enter("hardBreakEscape"),r.consume(i),n}function n(i){return X(i)?(r.exit("hardBreakEscape"),e(i)):t(i)}}var Ud={name:"headingAtx",tokenize:UT,resolve:zT};function zT(r,e){let t=r.length-2,a=3,n,i;return r[a][1].type==="whitespace"&&(a+=2),t-2>a&&r[t][1].type==="whitespace"&&(t-=2),r[t][1].type==="atxHeadingSequence"&&(a===t-1||t-4>a&&r[t-2][1].type==="whitespace")&&(t-=a+1===t?2:4),t>a&&(n={type:"atxHeadingText",start:r[a][1].start,end:r[t][1].end},i={type:"chunkText",start:r[a][1].start,end:r[t][1].end,contentType:"text"},bt(r,a,t-a+1,[["enter",n,e],["enter",i,e],["exit",i,e],["exit",n,e]])),r}function UT(r,e,t){let a=0;return n;function n(u){return r.enter("atxHeading"),i(u)}function i(u){return r.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&a++<6?(r.consume(u),s):u===null||Ke(u)?(r.exit("atxHeadingSequence"),o(u)):t(u)}function o(u){return u===35?(r.enter("atxHeadingSequence"),l(u)):u===null||X(u)?(r.exit("atxHeading"),e(u)):le(u)?ce(r,o,"whitespace")(u):(r.enter("atxHeadingText"),c(u))}function l(u){return u===35?(r.consume(u),l):(r.exit("atxHeadingSequence"),o(u))}function c(u){return u===null||u===35||Ke(u)?(r.exit("atxHeadingText"),o(u)):(r.consume(u),c)}}var jy=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Hd=["pre","script","style","textarea"];var Vd={name:"htmlFlow",tokenize:WT,resolveTo:jT,concrete:!0},HT={tokenize:$T,partial:!0},VT={tokenize:qT,partial:!0};function jT(r){let e=r.length;for(;e--&&!(r[e][0]==="enter"&&r[e][1].type==="htmlFlow"););return e>1&&r[e-2][1].type==="linePrefix"&&(r[e][1].start=r[e-2][1].start,r[e+1][1].start=r[e-2][1].start,r.splice(e-2,2)),r}function WT(r,e,t){let a=this,n,i,s,o,l;return c;function c(E){return u(E)}function u(E){return r.enter("htmlFlow"),r.enter("htmlFlowData"),r.consume(E),p}function p(E){return E===33?(r.consume(E),m):E===47?(r.consume(E),i=!0,f):E===63?(r.consume(E),n=3,a.interrupt?e:_):Ut(E)?(r.consume(E),s=String.fromCharCode(E),y):t(E)}function m(E){return E===45?(r.consume(E),n=2,d):E===91?(r.consume(E),n=5,o=0,g):Ut(E)?(r.consume(E),n=4,a.interrupt?e:_):t(E)}function d(E){return E===45?(r.consume(E),a.interrupt?e:_):t(E)}function g(E){let se="CDATA[";return E===se.charCodeAt(o++)?(r.consume(E),o===se.length?a.interrupt?e:M:g):t(E)}function f(E){return Ut(E)?(r.consume(E),s=String.fromCharCode(E),y):t(E)}function y(E){if(E===null||E===47||E===62||Ke(E)){let se=E===47,Re=s.toLowerCase();return!se&&!i&&Hd.includes(Re)?(n=1,a.interrupt?e(E):M(E)):jy.includes(s.toLowerCase())?(n=6,se?(r.consume(E),b):a.interrupt?e(E):M(E)):(n=7,a.interrupt&&!a.parser.lazy[a.now().line]?t(E):i?x(E):S(E))}return E===45||it(E)?(r.consume(E),s+=String.fromCharCode(E),y):t(E)}function b(E){return E===62?(r.consume(E),a.interrupt?e:M):t(E)}function x(E){return le(E)?(r.consume(E),x):G(E)}function S(E){return E===47?(r.consume(E),G):E===58||E===95||Ut(E)?(r.consume(E),A):le(E)?(r.consume(E),S):G(E)}function A(E){return E===45||E===46||E===58||E===95||it(E)?(r.consume(E),A):R(E)}function R(E){return E===61?(r.consume(E),k):le(E)?(r.consume(E),R):S(E)}function k(E){return E===null||E===60||E===61||E===62||E===96?t(E):E===34||E===39?(r.consume(E),l=E,O):le(E)?(r.consume(E),k):B(E)}function O(E){return E===l?(r.consume(E),l=null,P):E===null||X(E)?t(E):(r.consume(E),O)}function B(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||Ke(E)?R(E):(r.consume(E),B)}function P(E){return E===47||E===62||le(E)?S(E):t(E)}function G(E){return E===62?(r.consume(E),U):t(E)}function U(E){return E===null||X(E)?M(E):le(E)?(r.consume(E),U):t(E)}function M(E){return E===45&&n===2?(r.consume(E),Y):E===60&&n===1?(r.consume(E),K):E===62&&n===4?(r.consume(E),ve):E===63&&n===3?(r.consume(E),_):E===93&&n===5?(r.consume(E),Z):X(E)&&(n===6||n===7)?(r.exit("htmlFlowData"),r.check(HT,Ne,T)(E)):E===null||X(E)?(r.exit("htmlFlowData"),T(E)):(r.consume(E),M)}function T(E){return r.check(VT,I,Ne)(E)}function I(E){return r.enter("lineEnding"),r.consume(E),r.exit("lineEnding"),F}function F(E){return E===null||X(E)?T(E):(r.enter("htmlFlowData"),M(E))}function Y(E){return E===45?(r.consume(E),_):M(E)}function K(E){return E===47?(r.consume(E),s="",ee):M(E)}function ee(E){if(E===62){let se=s.toLowerCase();return Hd.includes(se)?(r.consume(E),ve):M(E)}return Ut(E)&&s.length<8?(r.consume(E),s+=String.fromCharCode(E),ee):M(E)}function Z(E){return E===93?(r.consume(E),_):M(E)}function _(E){return E===62?(r.consume(E),ve):E===45&&n===2?(r.consume(E),_):M(E)}function ve(E){return E===null||X(E)?(r.exit("htmlFlowData"),Ne(E)):(r.consume(E),ve)}function Ne(E){return r.exit("htmlFlow"),e(E)}}function qT(r,e,t){let a=this;return n;function n(s){return X(s)?(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),i):t(s)}function i(s){return a.parser.lazy[a.now().line]?t(s):e(s)}}function $T(r,e,t){return a;function a(n){return r.enter("lineEnding"),r.consume(n),r.exit("lineEnding"),r.attempt(gn,e,t)}}var jd={name:"htmlText",tokenize:KT};function KT(r,e,t){let a=this,n,i,s;return o;function o(_){return r.enter("htmlText"),r.enter("htmlTextData"),r.consume(_),l}function l(_){return _===33?(r.consume(_),c):_===47?(r.consume(_),R):_===63?(r.consume(_),S):Ut(_)?(r.consume(_),B):t(_)}function c(_){return _===45?(r.consume(_),u):_===91?(r.consume(_),i=0,g):Ut(_)?(r.consume(_),x):t(_)}function u(_){return _===45?(r.consume(_),d):t(_)}function p(_){return _===null?t(_):_===45?(r.consume(_),m):X(_)?(s=p,K(_)):(r.consume(_),p)}function m(_){return _===45?(r.consume(_),d):p(_)}function d(_){return _===62?Y(_):_===45?m(_):p(_)}function g(_){let ve="CDATA[";return _===ve.charCodeAt(i++)?(r.consume(_),i===ve.length?f:g):t(_)}function f(_){return _===null?t(_):_===93?(r.consume(_),y):X(_)?(s=f,K(_)):(r.consume(_),f)}function y(_){return _===93?(r.consume(_),b):f(_)}function b(_){return _===62?Y(_):_===93?(r.consume(_),b):f(_)}function x(_){return _===null||_===62?Y(_):X(_)?(s=x,K(_)):(r.consume(_),x)}function S(_){return _===null?t(_):_===63?(r.consume(_),A):X(_)?(s=S,K(_)):(r.consume(_),S)}function A(_){return _===62?Y(_):S(_)}function R(_){return Ut(_)?(r.consume(_),k):t(_)}function k(_){return _===45||it(_)?(r.consume(_),k):O(_)}function O(_){return X(_)?(s=O,K(_)):le(_)?(r.consume(_),O):Y(_)}function B(_){return _===45||it(_)?(r.consume(_),B):_===47||_===62||Ke(_)?P(_):t(_)}function P(_){return _===47?(r.consume(_),Y):_===58||_===95||Ut(_)?(r.consume(_),G):X(_)?(s=P,K(_)):le(_)?(r.consume(_),P):Y(_)}function G(_){return _===45||_===46||_===58||_===95||it(_)?(r.consume(_),G):U(_)}function U(_){return _===61?(r.consume(_),M):X(_)?(s=U,K(_)):le(_)?(r.consume(_),U):P(_)}function M(_){return _===null||_===60||_===61||_===62||_===96?t(_):_===34||_===39?(r.consume(_),n=_,T):X(_)?(s=M,K(_)):le(_)?(r.consume(_),M):(r.consume(_),I)}function T(_){return _===n?(r.consume(_),n=void 0,F):_===null?t(_):X(_)?(s=T,K(_)):(r.consume(_),T)}function I(_){return _===null||_===34||_===39||_===60||_===61||_===96?t(_):_===47||_===62||Ke(_)?P(_):(r.consume(_),I)}function F(_){return _===47||_===62||Ke(_)?P(_):t(_)}function Y(_){return _===62?(r.consume(_),r.exit("htmlTextData"),r.exit("htmlText"),e):t(_)}function K(_){return r.exit("htmlTextData"),r.enter("lineEnding"),r.consume(_),r.exit("lineEnding"),ee}function ee(_){return le(_)?ce(r,Z,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Z(_)}function Z(_){return r.enter("htmlTextData"),s(_)}}var ta={name:"labelEnd",tokenize:eA,resolveTo:QT,resolveAll:ZT},XT={tokenize:tA},YT={tokenize:rA},JT={tokenize:nA};function ZT(r){let e=-1;for(;++e<r.length;){let t=r[e][1];(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(r.splice(e+1,t.type==="labelImage"?4:2),t.type="data",e++)}return r}function QT(r,e){let t=r.length,a=0,n,i,s,o;for(;t--;)if(n=r[t][1],i){if(n.type==="link"||n.type==="labelLink"&&n._inactive)break;r[t][0]==="enter"&&n.type==="labelLink"&&(n._inactive=!0)}else if(s){if(r[t][0]==="enter"&&(n.type==="labelImage"||n.type==="labelLink")&&!n._balanced&&(i=t,n.type!=="labelLink")){a=2;break}}else n.type==="labelEnd"&&(s=t);let l={type:r[i][1].type==="labelLink"?"link":"image",start:Object.assign({},r[i][1].start),end:Object.assign({},r[r.length-1][1].end)},c={type:"label",start:Object.assign({},r[i][1].start),end:Object.assign({},r[s][1].end)},u={type:"labelText",start:Object.assign({},r[i+a+2][1].end),end:Object.assign({},r[s-2][1].start)};return o=[["enter",l,e],["enter",c,e]],o=wt(o,r.slice(i+1,i+a+3)),o=wt(o,[["enter",u,e]]),o=wt(o,ni(e.parser.constructs.insideSpan.null,r.slice(i+a+4,s-3),e)),o=wt(o,[["exit",u,e],r[s-2],r[s-1],["exit",c,e]]),o=wt(o,r.slice(s+1)),o=wt(o,[["exit",l,e]]),bt(r,i,r.length,o),r}function eA(r,e,t){let a=this,n=a.events.length,i,s;for(;n--;)if((a.events[n][1].type==="labelImage"||a.events[n][1].type==="labelLink")&&!a.events[n][1]._balanced){i=a.events[n][1];break}return o;function o(m){return i?i._inactive?p(m):(s=a.parser.defined.includes(qr(a.sliceSerialize({start:i.end,end:a.now()}))),r.enter("labelEnd"),r.enter("labelMarker"),r.consume(m),r.exit("labelMarker"),r.exit("labelEnd"),l):t(m)}function l(m){return m===40?r.attempt(XT,u,s?u:p)(m):m===91?r.attempt(YT,u,s?c:p)(m):s?u(m):p(m)}function c(m){return r.attempt(JT,u,p)(m)}function u(m){return e(m)}function p(m){return i._balanced=!0,t(m)}}function tA(r,e,t){return a;function a(p){return r.enter("resource"),r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),n}function n(p){return Ke(p)?ea(r,i)(p):i(p)}function i(p){return p===41?u(p):Ml(r,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function s(p){return Ke(p)?ea(r,l)(p):u(p)}function o(p){return t(p)}function l(p){return p===34||p===39||p===40?Ll(r,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function c(p){return Ke(p)?ea(r,u)(p):u(p)}function u(p){return p===41?(r.enter("resourceMarker"),r.consume(p),r.exit("resourceMarker"),r.exit("resource"),e):t(p)}}function rA(r,e,t){let a=this;return n;function n(o){return Ol.call(a,r,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return a.parser.defined.includes(qr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?e(o):t(o)}function s(o){return t(o)}}function nA(r,e,t){return a;function a(i){return r.enter("reference"),r.enter("referenceMarker"),r.consume(i),r.exit("referenceMarker"),n}function n(i){return i===93?(r.enter("referenceMarker"),r.consume(i),r.exit("referenceMarker"),r.exit("reference"),e):t(i)}}var Wd={name:"labelStartImage",tokenize:aA,resolveAll:ta.resolveAll};function aA(r,e,t){let a=this;return n;function n(o){return r.enter("labelImage"),r.enter("labelImageMarker"),r.consume(o),r.exit("labelImageMarker"),i}function i(o){return o===91?(r.enter("labelMarker"),r.consume(o),r.exit("labelMarker"),r.exit("labelImage"),s):t(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in a.parser.constructs?t(o):e(o)}}var qd={name:"labelStartLink",tokenize:iA,resolveAll:ta.resolveAll};function iA(r,e,t){let a=this;return n;function n(s){return r.enter("labelLink"),r.enter("labelMarker"),r.consume(s),r.exit("labelMarker"),r.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in a.parser.constructs?t(s):e(s)}}var ms={name:"lineEnding",tokenize:sA};function sA(r,e){return t;function t(a){return r.enter("lineEnding"),r.consume(a),r.exit("lineEnding"),ce(r,e,"linePrefix")}}var ra={name:"thematicBreak",tokenize:oA};function oA(r,e,t){let a=0,n;return i;function i(c){return r.enter("thematicBreak"),s(c)}function s(c){return n=c,o(c)}function o(c){return c===n?(r.enter("thematicBreakSequence"),l(c)):a>=3&&(c===null||X(c))?(r.exit("thematicBreak"),e(c)):t(c)}function l(c){return c===n?(r.consume(c),a++,l):(r.exit("thematicBreakSequence"),le(c)?ce(r,o,"whitespace")(c):o(c))}}var vt={name:"list",tokenize:uA,continuation:{tokenize:dA},exit:mA},lA={tokenize:hA,partial:!0},cA={tokenize:pA,partial:!0};function uA(r,e,t){let a=this,n=a.events[a.events.length-1],i=n&&n[1].type==="linePrefix"?n[2].sliceSerialize(n[1],!0).length:0,s=0;return o;function o(d){let g=a.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!a.containerState.marker||d===a.containerState.marker:cs(d)){if(a.containerState.type||(a.containerState.type=g,r.enter(g,{_container:!0})),g==="listUnordered")return r.enter("listItemPrefix"),d===42||d===45?r.check(ra,t,c)(d):c(d);if(!a.interrupt||d===49)return r.enter("listItemPrefix"),r.enter("listItemValue"),l(d)}return t(d)}function l(d){return cs(d)&&++s<10?(r.consume(d),l):(!a.interrupt||s<2)&&(a.containerState.marker?d===a.containerState.marker:d===41||d===46)?(r.exit("listItemValue"),c(d)):t(d)}function c(d){return r.enter("listItemMarker"),r.consume(d),r.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||d,r.check(gn,a.interrupt?t:u,r.attempt(lA,m,p))}function u(d){return a.containerState.initialBlankLine=!0,i++,m(d)}function p(d){return le(d)?(r.enter("listItemPrefixWhitespace"),r.consume(d),r.exit("listItemPrefixWhitespace"),m):t(d)}function m(d){return a.containerState.size=i+a.sliceSerialize(r.exit("listItemPrefix"),!0).length,e(d)}}function dA(r,e,t){let a=this;return a.containerState._closeFlow=void 0,r.check(gn,n,i);function n(o){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,ce(r,e,"listItemIndent",a.containerState.size+1)(o)}function i(o){return a.containerState.furtherBlankLines||!le(o)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,s(o)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,r.attempt(cA,e,s)(o))}function s(o){return a.containerState._closeFlow=!0,a.interrupt=void 0,ce(r,r.attempt(vt,e,t),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function pA(r,e,t){let a=this;return ce(r,n,"listItemIndent",a.containerState.size+1);function n(i){let s=a.events[a.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===a.containerState.size?e(i):t(i)}}function mA(r){r.exit(this.containerState.type)}function hA(r,e,t){let a=this;return ce(r,n,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function n(i){let s=a.events[a.events.length-1];return!le(i)&&s&&s[1].type==="listItemPrefixWhitespace"?e(i):t(i)}}var Bl={name:"setextUnderline",tokenize:fA,resolveTo:gA};function gA(r,e){let t=r.length,a,n,i;for(;t--;)if(r[t][0]==="enter"){if(r[t][1].type==="content"){a=t;break}r[t][1].type==="paragraph"&&(n=t)}else r[t][1].type==="content"&&r.splice(t,1),!i&&r[t][1].type==="definition"&&(i=t);let s={type:"setextHeading",start:Object.assign({},r[n][1].start),end:Object.assign({},r[r.length-1][1].end)};return r[n][1].type="setextHeadingText",i?(r.splice(n,0,["enter",s,e]),r.splice(i+1,0,["exit",r[a][1],e]),r[a][1].end=Object.assign({},r[i][1].end)):r[a][1]=s,r.push(["exit",s,e]),r}function fA(r,e,t){let a=this,n;return i;function i(c){let u=a.events.length,p;for(;u--;)if(a.events[u][1].type!=="lineEnding"&&a.events[u][1].type!=="linePrefix"&&a.events[u][1].type!=="content"){p=a.events[u][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(r.enter("setextHeadingLine"),n=c,s(c)):t(c)}function s(c){return r.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===n?(r.consume(c),o):(r.exit("setextHeadingLineSequence"),le(c)?ce(r,l,"lineSuffix")(c):l(c))}function l(c){return c===null||X(c)?(r.exit("setextHeadingLine"),e(c)):t(c)}}var Wy={tokenize:yA};function yA(r){let e=this,t=r.attempt(gn,a,r.attempt(this.parser.constructs.flowInitial,n,ce(r,r.attempt(this.parser.constructs.flow,n,r.attempt(Fd,n)),"linePrefix")));return t;function a(i){if(i===null){r.consume(i);return}return r.enter("lineEndingBlank"),r.consume(i),r.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function n(i){if(i===null){r.consume(i);return}return r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),e.currentConstruct=void 0,t}}var qy={resolveAll:Yy()},$y=Xy("string"),Ky=Xy("text");function Xy(r){return{tokenize:e,resolveAll:Yy(r==="text"?bA:void 0)};function e(t){let a=this,n=this.parser.constructs[r],i=t.attempt(n,s,o);return s;function s(u){return c(u)?i(u):o(u)}function o(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),l}function l(u){return c(u)?(t.exit("data"),i(u)):(t.consume(u),l)}function c(u){if(u===null)return!0;let p=n[u],m=-1;if(p)for(;++m<p.length;){let d=p[m];if(!d.previous||d.previous.call(a,a.previous))return!0}return!1}}}function Yy(r){return e;function e(t,a){let n=-1,i;for(;++n<=t.length;)i===void 0?t[n]&&t[n][1].type==="data"&&(i=n,n++):(!t[n]||t[n][1].type!=="data")&&(n!==i+2&&(t[i][1].end=t[n-1][1].end,t.splice(i+2,n-i-2),n=i+2),i=void 0);return r?r(t,a):t}}function bA(r,e){let t=0;for(;++t<=r.length;)if((t===r.length||r[t][1].type==="lineEnding")&&r[t-1][1].type==="data"){let a=r[t-1][1],n=e.sliceStream(a),i=n.length,s=-1,o=0,l;for(;i--;){let c=n[i];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(c===-2)l=!0,o++;else if(c!==-1){i++;break}}if(o){let c={type:t===r.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{line:a.end.line,column:a.end.column-o,offset:a.end.offset-o,_index:a.start._index+i,_bufferIndex:i?s:a.start._bufferIndex+s},end:Object.assign({},a.end)};a.end=Object.assign({},c.start),a.start.offset===a.end.offset?Object.assign(a,c):(r.splice(t,0,["enter",c,e],["exit",c,e]),t+=2)}t++}return r}function Jy(r,e,t){let a=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),n={},i=[],s=[],o=[],l=!0,c={consume:A,enter:R,exit:k,attempt:P(O),check:P(B),interrupt:P(B,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:r,sliceStream:f,sliceSerialize:g,now:y,defineSkip:b,write:d},p=e.tokenize.call(u,c),m;return e.resolveAll&&i.push(e),u;function d(T){return s=wt(s,T),x(),s[s.length-1]!==null?[]:(G(e,0),u.events=ni(i,u.events,u),u.events)}function g(T,I){return _A(f(T),I)}function f(T){return vA(s,T)}function y(){let{line:T,column:I,offset:F,_index:Y,_bufferIndex:K}=a;return{line:T,column:I,offset:F,_index:Y,_bufferIndex:K}}function b(T){n[T.line]=T.column,M()}function x(){let T;for(;a._index<s.length;){let I=s[a._index];if(typeof I=="string")for(T=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===T&&a._bufferIndex<I.length;)S(I.charCodeAt(a._bufferIndex));else S(I)}}function S(T){l=void 0,m=T,p=p(T)}function A(T){X(T)?(a.line++,a.column=1,a.offset+=T===-3?2:1,M()):T!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===s[a._index].length&&(a._bufferIndex=-1,a._index++)),u.previous=T,l=!0}function R(T,I){let F=I||{};return F.type=T,F.start=y(),u.events.push(["enter",F,u]),o.push(F),F}function k(T){let I=o.pop();return I.end=y(),u.events.push(["exit",I,u]),I}function O(T,I){G(T,I.from)}function B(T,I){I.restore()}function P(T,I){return F;function F(Y,K,ee){let Z,_,ve,Ne;return Array.isArray(Y)?se(Y):"tokenize"in Y?se([Y]):E(Y);function E(Me){return _t;function _t(Ce){let Ae=Ce!==null&&Me[Ce],Ct=Ce!==null&&Me.null,Ye=[...Array.isArray(Ae)?Ae:Ae?[Ae]:[],...Array.isArray(Ct)?Ct:Ct?[Ct]:[]];return se(Ye)(Ce)}}function se(Me){return Z=Me,_=0,Me.length===0?ee:Re(Me[_])}function Re(Me){return _t;function _t(Ce){return Ne=U(),ve=Me,Me.partial||(u.currentConstruct=Me),Me.name&&u.parser.constructs.disable.null.includes(Me.name)?Xe(Ce):Me.tokenize.call(I?Object.assign(Object.create(u),I):u,c,Ve,Xe)(Ce)}}function Ve(Me){return l=!0,T(ve,Ne),K}function Xe(Me){return l=!0,Ne.restore(),++_<Z.length?Re(Z[_]):ee}}}function G(T,I){T.resolveAll&&!i.includes(T)&&i.push(T),T.resolve&&bt(u.events,I,u.events.length-I,T.resolve(u.events.slice(I),u)),T.resolveTo&&(u.events=T.resolveTo(u.events,u))}function U(){let T=y(),I=u.previous,F=u.currentConstruct,Y=u.events.length,K=Array.from(o);return{restore:ee,from:Y};function ee(){a=T,u.previous=I,u.currentConstruct=F,u.events.length=Y,o=K,M()}}function M(){a.line in n&&a.column<2&&(a.column=n[a.line],a.offset+=n[a.line]-1)}}function vA(r,e){let t=e.start._index,a=e.start._bufferIndex,n=e.end._index,i=e.end._bufferIndex,s;if(t===n)s=[r[t].slice(a,i)];else{if(s=r.slice(t,n),a>-1){let o=s[0];typeof o=="string"?s[0]=o.slice(a):s.shift()}i>0&&s.push(r[n].slice(0,i))}return s}function _A(r,e){let t=-1,a=[],n;for(;++t<r.length;){let i=r[t],s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
3469
|
+
`;break}case-3:{s=`\r
|
|
3470
|
+
`;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&n)continue;s=" ";break}default:s=String.fromCharCode(i)}n=i===-2,a.push(s)}return a.join("")}var $d={};mc($d,{attentionMarkers:()=>AA,contentInitial:()=>EA,disable:()=>IA,document:()=>SA,flow:()=>kA,flowInitial:()=>wA,insideSpan:()=>TA,string:()=>CA,text:()=>xA});var SA={42:vt,43:vt,45:vt,48:vt,49:vt,50:vt,51:vt,52:vt,53:vt,54:vt,55:vt,56:vt,57:vt,62:Al},EA={91:Gd},wA={[-2]:ds,[-1]:ds,32:ds},kA={35:Ud,42:ra,45:[Bl,ra],60:Vd,61:Bl,95:ra,96:Pl,126:Pl},CA={38:Rl,92:Il},xA={[-5]:ms,[-4]:ms,[-3]:ms,33:Wd,38:Rl,42:us,60:[Ld,jd],91:qd,92:[zd,Il],93:ta,95:us,96:Bd},TA={null:[us,qy]},AA={null:[42,95]},IA={null:[]};function Kd(r){let t=Ny([$d,...(r||{}).extensions||[]]),a={defined:[],lazy:{},constructs:t,content:n(Gy),document:n(Uy),flow:n(Wy),string:n($y),text:n(Ky)};return a;function n(i){return s;function s(o){return Jy(a,i,o)}}}function Xd(r){for(;!Nl(r););return r}var Zy=/[\0\t\n\r]/g;function Yd(){let r=1,e="",t=!0,a;return n;function n(i,s,o){let l=[],c,u,p,m,d;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),p=0,e="",t&&(i.charCodeAt(0)===65279&&p++,t=void 0);p<i.length;){if(Zy.lastIndex=p,c=Zy.exec(i),m=c&&c.index!==void 0?c.index:i.length,d=i.charCodeAt(m),!c){e=i.slice(p);break}if(d===10&&p===m&&a)l.push(-3),a=void 0;else switch(a&&(l.push(-5),a=void 0),p<m&&(l.push(i.slice(p,m)),r+=m-p),d){case 0:{l.push(65533),r++;break}case 9:{for(u=Math.ceil(r/4)*4,l.push(-2);r++<u;)l.push(-1);break}case 10:{l.push(-4),r=1;break}default:a=!0,r=1}p=m+1}return o&&(a&&l.push(-5),e&&l.push(e),l.push(null)),l}}var RA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Qy(r){return r.replace(RA,PA)}function PA(r,e,t){if(e)return e;if(t.charCodeAt(0)===35){let n=t.charCodeAt(1),i=n===120||n===88;return Tl(t.slice(i?2:1),i?16:10)}return ri(t)||r}function fn(r){return!r||typeof r!="object"?"":"position"in r||"type"in r?eb(r.position):"start"in r||"end"in r?eb(r):"line"in r||"column"in r?Jd(r):""}function Jd(r){return tb(r&&r.line)+":"+tb(r&&r.column)}function eb(r){return Jd(r&&r.start)+"-"+Jd(r&&r.end)}function tb(r){return r&&typeof r=="number"?r:1}var nb={}.hasOwnProperty;function Zd(r,e,t){return typeof e!="string"&&(t=e,e=void 0),DA(t)(Xd(Kd(t).document().write(Yd()(r,e,!0))))}function DA(r){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(hr),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(_e),blockQuote:i(_t),characterEscape:P,characterReference:P,codeFenced:i(Ce),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Ce,s),codeText:i(Ae,s),codeTextData:P,data:P,codeFlowValue:P,definition:i(Ct),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(Ye),hardBreakEscape:i(ir),hardBreakTrailing:i(ir),htmlFlow:i(Ht,s),htmlFlowData:P,htmlText:i(Ht,s),htmlTextData:P,image:i(Tr),label:s,link:i(hr),listItem:i(xt),listItemValue:m,listOrdered:i(Je,p),listUnordered:i(Je),paragraph:i(mt),reference:E,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(_e),strong:i(ot),thematicBreak:i(St)},exit:{atxHeading:l(),atxHeadingSequence:R,autolink:l(),autolinkEmail:Me,autolinkProtocol:Xe,blockQuote:l(),characterEscapeValue:G,characterReferenceMarkerHexadecimal:Re,characterReferenceMarkerNumeric:Re,characterReferenceValue:Ve,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:d,codeFencedFenceMeta:g,codeFlowValue:G,codeIndented:l(b),codeText:l(F),codeTextData:G,data:G,definition:l(),definitionDestinationString:A,definitionLabelString:x,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l(T),htmlFlowData:G,htmlText:l(I),htmlTextData:G,image:l(K),label:Z,labelText:ee,lineEnding:U,link:l(Y),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:_,resourceTitleString:ve,resource:Ne,setextHeading:l(B),setextHeadingLineSequence:O,setextHeadingText:k,strong:l(),thematicBreak:l()}};ab(e,(r||{}).mdastExtensions||[]);let t={};return a;function a(L){let j={type:"root",children:[]},Q={stack:[j],tokenStack:[],config:e,enter:o,exit:c,buffer:s,resume:u,data:t},de=[],xe=-1;for(;++xe<L.length;)if(L[xe][1].type==="listOrdered"||L[xe][1].type==="listUnordered")if(L[xe][0]==="enter")de.push(xe);else{let Tt=de.pop();xe=n(L,Tt,xe)}for(xe=-1;++xe<L.length;){let Tt=e[L[xe][0]];nb.call(Tt,L[xe][1].type)&&Tt[L[xe][1].type].call(Object.assign({sliceSerialize:L[xe][2].sliceSerialize},Q),L[xe][1])}if(Q.tokenStack.length>0){let Tt=Q.tokenStack[Q.tokenStack.length-1];(Tt[1]||rb).call(Q,void 0,Tt[0])}for(j.position={start:yn(L.length>0?L[0][1].start:{line:1,column:1,offset:0}),end:yn(L.length>0?L[L.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<e.transforms.length;)j=e.transforms[xe](j)||j;return j}function n(L,j,Q){let de=j-1,xe=-1,Tt=!1,Nt,jt,bn,vn;for(;++de<=Q;){let ht=L[de];switch(ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ht[0]==="enter"?xe++:xe--,vn=void 0;break}case"lineEndingBlank":{ht[0]==="enter"&&(Nt&&!vn&&!xe&&!bn&&(bn=de),vn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:vn=void 0}if(!xe&&ht[0]==="enter"&&ht[1].type==="listItemPrefix"||xe===-1&&ht[0]==="exit"&&(ht[1].type==="listUnordered"||ht[1].type==="listOrdered")){if(Nt){let lt=de;for(jt=void 0;lt--;){let sr=L[lt];if(sr[1].type==="lineEnding"||sr[1].type==="lineEndingBlank"){if(sr[0]==="exit")continue;jt&&(L[jt][1].type="lineEndingBlank",Tt=!0),sr[1].type="lineEnding",jt=lt}else if(!(sr[1].type==="linePrefix"||sr[1].type==="blockQuotePrefix"||sr[1].type==="blockQuotePrefixWhitespace"||sr[1].type==="blockQuoteMarker"||sr[1].type==="listItemIndent"))break}bn&&(!jt||bn<jt)&&(Nt._spread=!0),Nt.end=Object.assign({},jt?L[jt][1].start:ht[1].end),L.splice(jt||de,0,["exit",Nt,ht[2]]),de++,Q++}if(ht[1].type==="listItemPrefix"){let lt={type:"listItem",_spread:!1,start:Object.assign({},ht[1].start),end:void 0};Nt=lt,L.splice(de,0,["enter",lt,ht[2]]),de++,Q++,bn=void 0,vn=!0}}}return L[j][1]._spread=Tt,Q}function i(L,j){return Q;function Q(de){o.call(this,L(de),de),j&&j.call(this,de)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(L,j,Q){this.stack[this.stack.length-1].children.push(L),this.stack.push(L),this.tokenStack.push([j,Q]),L.position={start:yn(j.start),end:void 0}}function l(L){return j;function j(Q){L&&L.call(this,Q),c.call(this,Q)}}function c(L,j){let Q=this.stack.pop(),de=this.tokenStack.pop();if(de)de[0].type!==L.type&&(j?j.call(this,L,de[0]):(de[1]||rb).call(this,L,de[0]));else throw new Error("Cannot close `"+L.type+"` ("+fn({start:L.start,end:L.end})+"): it\u2019s not open");Q.position.end=yn(L.end)}function u(){return Md(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function m(L){if(this.data.expectingFirstListItemValue){let j=this.stack[this.stack.length-2];j.start=Number.parseInt(this.sliceSerialize(L),10),this.data.expectingFirstListItemValue=void 0}}function d(){let L=this.resume(),j=this.stack[this.stack.length-1];j.lang=L}function g(){let L=this.resume(),j=this.stack[this.stack.length-1];j.meta=L}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){let L=this.resume(),j=this.stack[this.stack.length-1];j.value=L.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){let L=this.resume(),j=this.stack[this.stack.length-1];j.value=L.replace(/(\r?\n|\r)$/g,"")}function x(L){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.label=j,Q.identifier=qr(this.sliceSerialize(L)).toLowerCase()}function S(){let L=this.resume(),j=this.stack[this.stack.length-1];j.title=L}function A(){let L=this.resume(),j=this.stack[this.stack.length-1];j.url=L}function R(L){let j=this.stack[this.stack.length-1];if(!j.depth){let Q=this.sliceSerialize(L).length;j.depth=Q}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function O(L){let j=this.stack[this.stack.length-1];j.depth=this.sliceSerialize(L).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function P(L){let Q=this.stack[this.stack.length-1].children,de=Q[Q.length-1];(!de||de.type!=="text")&&(de=Vt(),de.position={start:yn(L.start),end:void 0},Q.push(de)),this.stack.push(de)}function G(L){let j=this.stack.pop();j.value+=this.sliceSerialize(L),j.position.end=yn(L.end)}function U(L){let j=this.stack[this.stack.length-1];if(this.data.atHardBreak){let Q=j.children[j.children.length-1];Q.position.end=yn(L.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(j.type)&&(P.call(this,L),G.call(this,L))}function M(){this.data.atHardBreak=!0}function T(){let L=this.resume(),j=this.stack[this.stack.length-1];j.value=L}function I(){let L=this.resume(),j=this.stack[this.stack.length-1];j.value=L}function F(){let L=this.resume(),j=this.stack[this.stack.length-1];j.value=L}function Y(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let j=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=j,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function K(){let L=this.stack[this.stack.length-1];if(this.data.inReference){let j=this.data.referenceType||"shortcut";L.type+="Reference",L.referenceType=j,delete L.url,delete L.title}else delete L.identifier,delete L.label;this.data.referenceType=void 0}function ee(L){let j=this.sliceSerialize(L),Q=this.stack[this.stack.length-2];Q.label=Qy(j),Q.identifier=qr(j).toLowerCase()}function Z(){let L=this.stack[this.stack.length-1],j=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){let de=L.children;Q.children=de}else Q.alt=j}function _(){let L=this.resume(),j=this.stack[this.stack.length-1];j.url=L}function ve(){let L=this.resume(),j=this.stack[this.stack.length-1];j.title=L}function Ne(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function se(L){let j=this.resume(),Q=this.stack[this.stack.length-1];Q.label=j,Q.identifier=qr(this.sliceSerialize(L)).toLowerCase(),this.data.referenceType="full"}function Re(L){this.data.characterReferenceType=L.type}function Ve(L){let j=this.sliceSerialize(L),Q=this.data.characterReferenceType,de;Q?(de=Tl(j,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):de=ri(j);let xe=this.stack.pop();xe.value+=de,xe.position.end=yn(L.end)}function Xe(L){G.call(this,L);let j=this.stack[this.stack.length-1];j.url=this.sliceSerialize(L)}function Me(L){G.call(this,L);let j=this.stack[this.stack.length-1];j.url="mailto:"+this.sliceSerialize(L)}function _t(){return{type:"blockquote",children:[]}}function Ce(){return{type:"code",lang:null,meta:null,value:""}}function Ae(){return{type:"inlineCode",value:""}}function Ct(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ye(){return{type:"emphasis",children:[]}}function _e(){return{type:"heading",depth:0,children:[]}}function ir(){return{type:"break"}}function Ht(){return{type:"html",value:""}}function Tr(){return{type:"image",title:null,url:"",alt:null}}function hr(){return{type:"link",title:null,url:"",children:[]}}function Je(L){return{type:"list",ordered:L.type==="listOrdered",start:null,spread:L._spread,children:[]}}function xt(L){return{type:"listItem",spread:L._spread,checked:null,children:[]}}function mt(){return{type:"paragraph",children:[]}}function ot(){return{type:"strong",children:[]}}function Vt(){return{type:"text",value:""}}function St(){return{type:"thematicBreak"}}}function yn(r){return{line:r.line,column:r.column,offset:r.offset}}function ab(r,e){let t=-1;for(;++t<e.length;){let a=e[t];Array.isArray(a)?ab(r,a):NA(r,a)}}function NA(r,e){let t;for(t in e)if(nb.call(e,t))switch(t){case"canContainEols":{let a=e[t];a&&r[t].push(...a);break}case"transforms":{let a=e[t];a&&r[t].push(...a);break}case"enter":case"exit":{let a=e[t];a&&Object.assign(r[t],a);break}}}function rb(r,e){throw r?new Error("Cannot close `"+r.type+"` ("+fn({start:r.start,end:r.end})+"): a different token (`"+e.type+"`, "+fn({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+fn({start:e.start,end:e.end})+") is still open")}function Fl(r){let e=this;e.parser=t;function t(a){return Zd(a,{...e.data("settings"),...r,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function ib(r,e){let t={type:"element",tagName:"blockquote",properties:{},children:r.wrap(r.all(e),!0)};return r.patch(e,t),r.applyData(e,t)}function sb(r,e){let t={type:"element",tagName:"br",properties:{},children:[]};return r.patch(e,t),[r.applyData(e,t),{type:"text",value:`
|
|
3471
|
+
`}]}function ob(r,e){let t=e.value?e.value+`
|
|
3472
|
+
`:"",a={};e.lang&&(a.className=["language-"+e.lang]);let n={type:"element",tagName:"code",properties:a,children:[{type:"text",value:t}]};return e.meta&&(n.data={meta:e.meta}),r.patch(e,n),n=r.applyData(e,n),n={type:"element",tagName:"pre",properties:{},children:[n]},r.patch(e,n),n}function lb(r,e){let t={type:"element",tagName:"del",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function cb(r,e){let t={type:"element",tagName:"em",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function ub(r,e){let t=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",a=String(e.identifier).toUpperCase(),n=ar(a.toLowerCase()),i=r.footnoteOrder.indexOf(a),s,o=r.footnoteCounts.get(a);o===void 0?(o=0,r.footnoteOrder.push(a),s=r.footnoteOrder.length):s=i+1,o+=1,r.footnoteCounts.set(a,o);let l={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+n,id:t+"fnref-"+n+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};r.patch(e,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return r.patch(e,c),r.applyData(e,c)}function db(r,e){let t={type:"element",tagName:"h"+e.depth,properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function pb(r,e){if(r.options.allowDangerousHtml){let t={type:"raw",value:e.value};return r.patch(e,t),r.applyData(e,t)}}function Gl(r,e){let t=e.referenceType,a="]";if(t==="collapsed"?a+="[]":t==="full"&&(a+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+a}];let n=r.all(e),i=n[0];i&&i.type==="text"?i.value="["+i.value:n.unshift({type:"text",value:"["});let s=n[n.length-1];return s&&s.type==="text"?s.value+=a:n.push({type:"text",value:a}),n}function mb(r,e){let t=String(e.identifier).toUpperCase(),a=r.definitionById.get(t);if(!a)return Gl(r,e);let n={src:ar(a.url||""),alt:e.alt};a.title!==null&&a.title!==void 0&&(n.title=a.title);let i={type:"element",tagName:"img",properties:n,children:[]};return r.patch(e,i),r.applyData(e,i)}function hb(r,e){let t={src:ar(e.url)};e.alt!==null&&e.alt!==void 0&&(t.alt=e.alt),e.title!==null&&e.title!==void 0&&(t.title=e.title);let a={type:"element",tagName:"img",properties:t,children:[]};return r.patch(e,a),r.applyData(e,a)}function gb(r,e){let t={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};r.patch(e,t);let a={type:"element",tagName:"code",properties:{},children:[t]};return r.patch(e,a),r.applyData(e,a)}function fb(r,e){let t=String(e.identifier).toUpperCase(),a=r.definitionById.get(t);if(!a)return Gl(r,e);let n={href:ar(a.url||"")};a.title!==null&&a.title!==void 0&&(n.title=a.title);let i={type:"element",tagName:"a",properties:n,children:r.all(e)};return r.patch(e,i),r.applyData(e,i)}function yb(r,e){let t={href:ar(e.url)};e.title!==null&&e.title!==void 0&&(t.title=e.title);let a={type:"element",tagName:"a",properties:t,children:r.all(e)};return r.patch(e,a),r.applyData(e,a)}function bb(r,e,t){let a=r.all(e),n=t?MA(t):vb(e),i={},s=[];if(typeof e.checked=="boolean"){let u=a[0],p;u&&u.type==="element"&&u.tagName==="p"?p=u:(p={type:"element",tagName:"p",properties:{},children:[]},a.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o<a.length;){let u=a[o];(n||o!==0||u.type!=="element"||u.tagName!=="p")&&s.push({type:"text",value:`
|
|
3473
|
+
`}),u.type==="element"&&u.tagName==="p"&&!n?s.push(...u.children):s.push(u)}let l=a[a.length-1];l&&(n||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
|
|
3474
|
+
`});let c={type:"element",tagName:"li",properties:i,children:s};return r.patch(e,c),r.applyData(e,c)}function MA(r){let e=!1;if(r.type==="list"){e=r.spread||!1;let t=r.children,a=-1;for(;!e&&++a<t.length;)e=vb(t[a])}return e}function vb(r){let e=r.spread;return e??r.children.length>1}function _b(r,e){let t={},a=r.all(e),n=-1;for(typeof e.start=="number"&&e.start!==1&&(t.start=e.start);++n<a.length;){let s=a[n];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){t.className=["contains-task-list"];break}}let i={type:"element",tagName:e.ordered?"ol":"ul",properties:t,children:r.wrap(a,!0)};return r.patch(e,i),r.applyData(e,i)}function Sb(r,e){let t={type:"element",tagName:"p",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function Eb(r,e){let t={type:"root",children:r.wrap(r.all(e))};return r.patch(e,t),r.applyData(e,t)}function wb(r,e){let t={type:"element",tagName:"strong",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}var zl=kb("end"),Ul=kb("start");function kb(r){return e;function e(t){let a=t&&t.position&&t.position[r]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function Qd(r){let e=Ul(r),t=zl(r);if(e&&t)return{start:e,end:t}}function Cb(r,e){let t=r.all(e),a=t.shift(),n=[];if(a){let s={type:"element",tagName:"thead",properties:{},children:r.wrap([a],!0)};r.patch(e.children[0],s),n.push(s)}if(t.length>0){let s={type:"element",tagName:"tbody",properties:{},children:r.wrap(t,!0)},o=Ul(e.children[1]),l=zl(e.children[e.children.length-1]);o&&l&&(s.position={start:o,end:l}),n.push(s)}let i={type:"element",tagName:"table",properties:{},children:r.wrap(n,!0)};return r.patch(e,i),r.applyData(e,i)}function xb(r,e,t){let a=t?t.children:void 0,i=(a?a.indexOf(e):1)===0?"th":"td",s=t&&t.type==="table"?t.align:void 0,o=s?s.length:e.children.length,l=-1,c=[];for(;++l<o;){let p=e.children[l],m={},d=s?s[l]:void 0;d&&(m.align=d);let g={type:"element",tagName:i,properties:m,children:[]};p&&(g.children=r.all(p),r.patch(p,g),g=r.applyData(p,g)),c.push(g)}let u={type:"element",tagName:"tr",properties:{},children:r.wrap(c,!0)};return r.patch(e,u),r.applyData(e,u)}function Tb(r,e){let t={type:"element",tagName:"td",properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function Ib(r){let e=String(r),t=/\r?\n|\r/g,a=t.exec(e),n=0,i=[];for(;a;)i.push(Ab(e.slice(n,a.index),n>0,!0),a[0]),n=a.index+a[0].length,a=t.exec(e);return i.push(Ab(e.slice(n),n>0,!1)),i.join("")}function Ab(r,e,t){let a=0,n=r.length;if(e){let i=r.codePointAt(a);for(;i===9||i===32;)a++,i=r.codePointAt(a)}if(t){let i=r.codePointAt(n-1);for(;i===9||i===32;)n--,i=r.codePointAt(n-1)}return n>a?r.slice(a,n):""}function Rb(r,e){let t={type:"text",value:Ib(String(e.value))};return r.patch(e,t),r.applyData(e,t)}function Pb(r,e){let t={type:"element",tagName:"hr",properties:{},children:[]};return r.patch(e,t),r.applyData(e,t)}var Db={blockquote:ib,break:sb,code:ob,delete:lb,emphasis:cb,footnoteReference:ub,heading:db,html:pb,imageReference:mb,image:hb,inlineCode:gb,linkReference:fb,link:yb,listItem:bb,list:_b,paragraph:Sb,root:Eb,strong:wb,table:Cb,tableCell:Tb,tableRow:xb,text:Rb,thematicBreak:Pb,toml:Hl,yaml:Hl,definition:Hl,footnoteDefinition:Hl};function Hl(){}function OA(r,e){let t=[{type:"text",value:"\u21A9"}];return e>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),t}function LA(r,e){return"Back to reference "+(r+1)+(e>1?"-"+e:"")}function Nb(r){let e=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",t=r.options.footnoteBackContent||OA,a=r.options.footnoteBackLabel||LA,n=r.options.footnoteLabel||"Footnotes",i=r.options.footnoteLabelTagName||"h2",s=r.options.footnoteLabelProperties||{className:["sr-only"]},o=[],l=-1;for(;++l<r.footnoteOrder.length;){let c=r.footnoteById.get(r.footnoteOrder[l]);if(!c)continue;let u=r.all(c),p=String(c.identifier).toUpperCase(),m=ar(p.toLowerCase()),d=0,g=[],f=r.footnoteCounts.get(p);for(;f!==void 0&&++d<=f;){g.length>0&&g.push({type:"text",value:" "});let x=typeof t=="string"?t:t(l,d);typeof x=="string"&&(x={type:"text",value:x}),g.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(l,d),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}let y=u[u.length-1];if(y&&y.type==="element"&&y.tagName==="p"){let x=y.children[y.children.length-1];x&&x.type==="text"?x.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...g)}else u.push(...g);let b={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:r.wrap(u,!0)};r.patch(c,b),o.push(b)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...wr(s),id:"footnote-label"},children:[{type:"text",value:n}]},{type:"text",value:`
|
|
3475
|
+
`},{type:"element",tagName:"ol",properties:{},children:r.wrap(o,!0)},{type:"text",value:`
|
|
3476
|
+
`}]}}var ep={}.hasOwnProperty,BA={};function Ob(r,e){let t=e||BA,a=new Map,n=new Map,i=new Map,s={...Db,...t.handlers},o={all:c,applyData:GA,definitionById:a,footnoteById:n,footnoteCounts:i,footnoteOrder:[],handlers:s,one:l,options:t,patch:FA,wrap:UA};return ns(r,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){let p=u.type==="definition"?a:n,m=String(u.identifier).toUpperCase();p.has(m)||p.set(m,u)}}),o;function l(u,p){let m=u.type,d=o.handlers[m];if(ep.call(o.handlers,m)&&d)return d(o,u,p);if(o.options.passThrough&&o.options.passThrough.includes(m)){if("children"in u){let{children:f,...y}=u,b=wr(y);return b.children=o.all(u),b}return wr(u)}return(o.options.unknownHandler||zA)(o,u,p)}function c(u){let p=[];if("children"in u){let m=u.children,d=-1;for(;++d<m.length;){let g=o.one(m[d],u);if(g){if(d&&m[d-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Mb(g.value)),!Array.isArray(g)&&g.type==="element")){let f=g.children[0];f&&f.type==="text"&&(f.value=Mb(f.value))}Array.isArray(g)?p.push(...g):p.push(g)}}}return p}}function FA(r,e){r.position&&(e.position=Qd(r))}function GA(r,e){let t=e;if(r&&r.data){let a=r.data.hName,n=r.data.hChildren,i=r.data.hProperties;if(typeof a=="string")if(t.type==="element")t.tagName=a;else{let s="children"in t?t.children:[t];t={type:"element",tagName:a,properties:{},children:s}}t.type==="element"&&i&&Object.assign(t.properties,wr(i)),"children"in t&&t.children&&n!==null&&n!==void 0&&(t.children=n)}return t}function zA(r,e){let t=e.data||{},a="value"in e&&!(ep.call(t,"hProperties")||ep.call(t,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:r.all(e)};return r.patch(e,a),r.applyData(e,a)}function UA(r,e){let t=[],a=-1;for(e&&t.push({type:"text",value:`
|
|
3454
3477
|
`});++a<r.length;)a&&t.push({type:"text",value:`
|
|
3455
3478
|
`}),t.push(r[a]);return e&&r.length>0&&t.push({type:"text",value:`
|
|
3456
|
-
`}),t}function
|
|
3457
|
-
`},n)),i}function es(r,e){return r&&"run"in r?async function(t,a){let n=Qo(t,{file:a,...e});await r.run(n,a)}:function(t,a){return Qo(t,{file:a,...e||r})}}function zc(r){if(r)throw r}var ns=Cs(Kg(),1);function Ja(r){if(typeof r!="object"||r===null)return!1;let e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function Uc(){let r=[],e={run:t,use:a};return e;function t(...n){let i=-1,o=n.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...n);function s(l,...c){let u=r[++i],p=-1;if(l){o(l);return}for(;++p<n.length;)(c[p]===null||c[p]===void 0)&&(c[p]=n[p]);n=c,u?$g(u,s)(...c):o(null,...c)}}function a(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return r.push(n),e}}function $g(r,e){let t;return a;function a(...o){let s=r.length>o.length,l;s&&o.push(n);try{l=r.apply(this,o)}catch(c){let u=c;if(s&&t)throw u;return n(u)}s||(l&&l.then&&typeof l.then=="function"?l.then(i,n):l instanceof Error?n(l):i(l))}function n(o,...s){t||(t=!0,e(o,...s))}function i(o){n(null,o)}}var Je=class extends Error{constructor(e,t,a){super(),typeof t=="string"&&(a=t,t=void 0);let n="",i={},o=!1;if(t&&("line"in t&&"column"in t?i={place:t}:"start"in t&&"end"in t?i={place:t}:"type"in t?i={ancestors:[t],place:t.position}:i={...t}),typeof e=="string"?n=e:!i.cause&&e&&(o=!0,n=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof a=="string"){let l=a.indexOf(":");l===-1?i.ruleId=a:(i.source=a.slice(0,l),i.ruleId=a.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){let l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}let s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=n,this.line=s?s.line:void 0,this.name=Ur(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}};Je.prototype.file="";Je.prototype.name="";Je.prototype.reason="";Je.prototype.message="";Je.prototype.stack="";Je.prototype.column=void 0;Je.prototype.line=void 0;Je.prototype.ancestors=void 0;Je.prototype.cause=void 0;Je.prototype.fatal=void 0;Je.prototype.place=void 0;Je.prototype.ruleId=void 0;Je.prototype.source=void 0;var Zt={basename:mk,dirname:hk,extname:gk,join:fk,sep:"/"};function mk(r,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Qa(r);let t=0,a=-1,n=r.length,i;if(e===void 0||e.length===0||e.length>r.length){for(;n--;)if(r.codePointAt(n)===47){if(i){t=n+1;break}}else a<0&&(i=!0,a=n+1);return a<0?"":r.slice(t,a)}if(e===r)return"";let o=-1,s=e.length-1;for(;n--;)if(r.codePointAt(n)===47){if(i){t=n+1;break}}else o<0&&(i=!0,o=n+1),s>-1&&(r.codePointAt(n)===e.codePointAt(s--)?s<0&&(a=n):(s=-1,a=o));return t===a?a=o:a<0&&(a=r.length),r.slice(t,a)}function hk(r){if(Qa(r),r.length===0)return".";let e=-1,t=r.length,a;for(;--t;)if(r.codePointAt(t)===47){if(a){e=t;break}}else a||(a=!0);return e<0?r.codePointAt(0)===47?"/":".":e===1&&r.codePointAt(0)===47?"//":r.slice(0,e)}function gk(r){Qa(r);let e=r.length,t=-1,a=0,n=-1,i=0,o;for(;e--;){let s=r.codePointAt(e);if(s===47){if(o){a=e+1;break}continue}t<0&&(o=!0,t=e+1),s===46?n<0?n=e:i!==1&&(i=1):n>-1&&(i=-1)}return n<0||t<0||i===0||i===1&&n===t-1&&n===a+1?"":r.slice(n,t)}function fk(...r){let e=-1,t;for(;++e<r.length;)Qa(r[e]),r[e]&&(t=t===void 0?r[e]:t+"/"+r[e]);return t===void 0?".":yk(t)}function yk(r){Qa(r);let e=r.codePointAt(0)===47,t=bk(r,!e);return t.length===0&&!e&&(t="."),t.length>0&&r.codePointAt(r.length-1)===47&&(t+="/"),e?"/"+t:t}function bk(r,e){let t="",a=0,n=-1,i=0,o=-1,s,l;for(;++o<=r.length;){if(o<r.length)s=r.codePointAt(o);else{if(s===47)break;s=47}if(s===47){if(!(n===o-1||i===1))if(n!==o-1&&i===2){if(t.length<2||a!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(l=t.lastIndexOf("/"),l!==t.length-1){l<0?(t="",a=0):(t=t.slice(0,l),a=t.length-1-t.lastIndexOf("/")),n=o,i=0;continue}}else if(t.length>0){t="",a=0,n=o,i=0;continue}}e&&(t=t.length>0?t+"/..":"..",a=2)}else t.length>0?t+="/"+r.slice(n+1,o):t=r.slice(n+1,o),a=o-n-1;n=o,i=0}else s===46&&i>-1?i++:i=-1}return t}function Qa(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}var Xg={cwd:vk};function vk(){return"/"}function sa(r){return!!(r!==null&&typeof r=="object"&&"href"in r&&r.href&&"protocol"in r&&r.protocol&&r.auth===void 0)}function Yg(r){if(typeof r=="string")r=new URL(r);else if(!sa(r)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+r+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(r.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return _k(r)}function _k(r){if(r.hostname!==""){let a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}let e=r.pathname,t=-1;for(;++t<e.length;)if(e.codePointAt(t)===37&&e.codePointAt(t+1)===50){let a=e.codePointAt(t+2);if(a===70||a===102){let n=new TypeError("File URL path must not include encoded / characters");throw n.code="ERR_INVALID_FILE_URL_PATH",n}}return decodeURIComponent(e)}var Hc=["history","path","basename","stem","extname","dirname"],ei=class{constructor(e){let t;e?sa(e)?t={path:e}:typeof e=="string"||Sk(e)?t={value:e}:t=e:t={},this.cwd=Xg.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Hc.length;){let i=Hc[a];i in t&&t[i]!==void 0&&t[i]!==null&&(this[i]=i==="history"?[...t[i]]:t[i])}let n;for(n in t)Hc.includes(n)||(this[n]=t[n])}get basename(){return typeof this.path=="string"?Zt.basename(this.path):void 0}set basename(e){Wc(e,"basename"),Vc(e,"basename"),this.path=Zt.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Zt.dirname(this.path):void 0}set dirname(e){Zg(this.basename,"dirname"),this.path=Zt.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Zt.extname(this.path):void 0}set extname(e){if(Vc(e,"extname"),Zg(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Zt.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){sa(e)&&(e=Yg(e)),Wc(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Zt.basename(this.path,this.extname):void 0}set stem(e){Wc(e,"stem"),Vc(e,"stem"),this.path=Zt.join(this.dirname||"",e+(this.extname||""))}fail(e,t,a){let n=this.message(e,t,a);throw n.fatal=!0,n}info(e,t,a){let n=this.message(e,t,a);return n.fatal=void 0,n}message(e,t,a){let n=new Je(e,t,a);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Vc(r,e){if(r&&r.includes(Zt.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Zt.sep+"`")}function Wc(r,e){if(!r)throw new Error("`"+e+"` cannot be empty")}function Zg(r,e){if(!r)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Sk(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var Jg=function(r){let a=this.constructor.prototype,n=a[r],i=function(){return n.apply(i,arguments)};Object.setPrototypeOf(i,a);let o=Object.getOwnPropertyNames(n);for(let s of o){let l=Object.getOwnPropertyDescriptor(n,s);l&&Object.defineProperty(i,s,l)}return i};var Ek={}.hasOwnProperty,$c=class r extends Jg{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Uc()}copy(){let e=new r,t=-1;for(;++t<this.attachers.length;){let a=this.attachers[t];e.use(...a)}return e.data((0,ns.default)(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(Kc("data",this.frozen),this.namespace[e]=t,this):Ek.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Kc("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);let n=t.call(e,...a);typeof n=="function"&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let t=rs(e),a=this.parser||this.Parser;return jc("parse",a),a(String(t),t)}process(e,t){let a=this;return this.freeze(),jc("process",this.parser||this.Parser),qc("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(i,o){let s=rs(e),l=a.parse(s);a.run(l,s,function(u,p,m){if(u||!p||!m)return c(u);let d=p,g=a.stringify(d,m);Ck(g)?m.value=g:m.result=g,c(u,m)});function c(u,p){u||!p?o(u):i?i(p):t(void 0,p)}}}processSync(e){let t=!1,a;return this.freeze(),jc("processSync",this.parser||this.Parser),qc("processSync",this.compiler||this.Compiler),this.process(e,n),ef("processSync","process",t),a;function n(i,o){t=!0,zc(i),a=o}}run(e,t,a){Qg(e),this.freeze();let n=this.transformers;return!a&&typeof t=="function"&&(a=t,t=void 0),a?i(void 0,a):new Promise(i);function i(o,s){let l=rs(t);n.run(e,l,c);function c(u,p,m){let d=p||e;u?s(u):o?o(d):a(void 0,d,m)}}}runSync(e,t){let a=!1,n;return this.run(e,t,i),ef("runSync","run",a),n;function i(o,s){zc(o),n=s,a=!0}}stringify(e,t){this.freeze();let a=rs(t),n=this.compiler||this.Compiler;return qc("stringify",n),Qg(e),n(e,a)}use(e,...t){let a=this.attachers,n=this.namespace;if(Kc("use",this.frozen),e!=null)if(typeof e=="function")l(e,t);else if(typeof e=="object")Array.isArray(e)?s(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...p]=c;l(u,p)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(c.plugins),c.settings&&(n.settings=(0,ns.default)(!0,n.settings,c.settings))}function s(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let p=c[u];i(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let p=-1,m=-1;for(;++p<a.length;)if(a[p][0]===c){m=p;break}if(m===-1)a.push([c,...u]);else if(u.length>0){let[d,...g]=u,f=a[m][1];Ja(f)&&Ja(d)&&(d=(0,ns.default)(!0,f,d)),a[m]=[c,d,...g]}}}},Xc=new $c().freeze();function jc(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `parser`")}function qc(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `compiler`")}function Kc(r,e){if(e)throw new Error("Cannot call `"+r+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Qg(r){if(!Ja(r)||typeof r.type!="string")throw new TypeError("Expected node, got `"+r+"`")}function ef(r,e,t){if(!t)throw new Error("`"+r+"` finished async. Use `"+e+"` instead")}function rs(r){return wk(r)?r:new ei(r)}function wk(r){return!!(r&&typeof r=="object"&&"message"in r&&"messages"in r)}function Ck(r){return typeof r=="string"||kk(r)}function kk(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var ti=class extends At{constructor(){super(...arguments);this.html=()=>`
|
|
3479
|
+
`}),t}function Mb(r){let e=0,t=r.charCodeAt(e);for(;t===9||t===32;)e++,t=r.charCodeAt(e);return r.slice(e)}function Vl(r,e){let t=Ob(r,e),a=t.one(r,void 0),n=Nb(t),i=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return n&&("children"in i,i.children.push({type:"text",value:`
|
|
3480
|
+
`},n)),i}function jl(r,e){return r&&"run"in r?async function(t,a){let n=Vl(t,{file:a,...e});await r.run(n,a)}:function(t,a){return Vl(t,{file:a,...e||r})}}function tp(r){if(r)throw r}var $l=hc(jb(),1);function hs(r){if(typeof r!="object"||r===null)return!1;let e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function rp(){let r=[],e={run:t,use:a};return e;function t(...n){let i=-1,s=n.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...n);function o(l,...c){let u=r[++i],p=-1;if(l){s(l);return}for(;++p<n.length;)(c[p]===null||c[p]===void 0)&&(c[p]=n[p]);n=c,u?Wb(u,o)(...c):s(null,...c)}}function a(n){if(typeof n!="function")throw new TypeError("Expected `middelware` to be a function, not "+n);return r.push(n),e}}function Wb(r,e){let t;return a;function a(...s){let o=r.length>s.length,l;o&&s.push(n);try{l=r.apply(this,s)}catch(c){let u=c;if(o&&t)throw u;return n(u)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,n):l instanceof Error?n(l):i(l))}function n(s,...o){t||(t=!0,e(s,...o))}function i(s){n(null,s)}}var st=class extends Error{constructor(e,t,a){super(),typeof t=="string"&&(a=t,t=void 0);let n="",i={},s=!1;if(t&&("line"in t&&"column"in t?i={place:t}:"start"in t&&"end"in t?i={place:t}:"type"in t?i={ancestors:[t],place:t.position}:i={...t}),typeof e=="string"?n=e:!i.cause&&e&&(s=!0,n=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof a=="string"){let l=a.indexOf(":");l===-1?i.ruleId=a:(i.source=a.slice(0,l),i.ruleId=a.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){let l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}let o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=n,this.line=o?o.line:void 0,this.name=fn(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}};st.prototype.file="";st.prototype.name="";st.prototype.reason="";st.prototype.message="";st.prototype.stack="";st.prototype.column=void 0;st.prototype.line=void 0;st.prototype.ancestors=void 0;st.prototype.cause=void 0;st.prototype.fatal=void 0;st.prototype.place=void 0;st.prototype.ruleId=void 0;st.prototype.source=void 0;var pr={basename:HA,dirname:VA,extname:jA,join:WA,sep:"/"};function HA(r,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');gs(r);let t=0,a=-1,n=r.length,i;if(e===void 0||e.length===0||e.length>r.length){for(;n--;)if(r.codePointAt(n)===47){if(i){t=n+1;break}}else a<0&&(i=!0,a=n+1);return a<0?"":r.slice(t,a)}if(e===r)return"";let s=-1,o=e.length-1;for(;n--;)if(r.codePointAt(n)===47){if(i){t=n+1;break}}else s<0&&(i=!0,s=n+1),o>-1&&(r.codePointAt(n)===e.codePointAt(o--)?o<0&&(a=n):(o=-1,a=s));return t===a?a=s:a<0&&(a=r.length),r.slice(t,a)}function VA(r){if(gs(r),r.length===0)return".";let e=-1,t=r.length,a;for(;--t;)if(r.codePointAt(t)===47){if(a){e=t;break}}else a||(a=!0);return e<0?r.codePointAt(0)===47?"/":".":e===1&&r.codePointAt(0)===47?"//":r.slice(0,e)}function jA(r){gs(r);let e=r.length,t=-1,a=0,n=-1,i=0,s;for(;e--;){let o=r.codePointAt(e);if(o===47){if(s){a=e+1;break}continue}t<0&&(s=!0,t=e+1),o===46?n<0?n=e:i!==1&&(i=1):n>-1&&(i=-1)}return n<0||t<0||i===0||i===1&&n===t-1&&n===a+1?"":r.slice(n,t)}function WA(...r){let e=-1,t;for(;++e<r.length;)gs(r[e]),r[e]&&(t=t===void 0?r[e]:t+"/"+r[e]);return t===void 0?".":qA(t)}function qA(r){gs(r);let e=r.codePointAt(0)===47,t=$A(r,!e);return t.length===0&&!e&&(t="."),t.length>0&&r.codePointAt(r.length-1)===47&&(t+="/"),e?"/"+t:t}function $A(r,e){let t="",a=0,n=-1,i=0,s=-1,o,l;for(;++s<=r.length;){if(s<r.length)o=r.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(n===s-1||i===1))if(n!==s-1&&i===2){if(t.length<2||a!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(l=t.lastIndexOf("/"),l!==t.length-1){l<0?(t="",a=0):(t=t.slice(0,l),a=t.length-1-t.lastIndexOf("/")),n=s,i=0;continue}}else if(t.length>0){t="",a=0,n=s,i=0;continue}}e&&(t=t.length>0?t+"/..":"..",a=2)}else t.length>0?t+="/"+r.slice(n+1,s):t=r.slice(n+1,s),a=s-n-1;n=s,i=0}else o===46&&i>-1?i++:i=-1}return t}function gs(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}var qb={cwd:KA};function KA(){return"/"}function ai(r){return!!(r!==null&&typeof r=="object"&&"href"in r&&r.href&&"protocol"in r&&r.protocol&&r.auth===void 0)}function $b(r){if(typeof r=="string")r=new URL(r);else if(!ai(r)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+r+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(r.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return XA(r)}function XA(r){if(r.hostname!==""){let a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}let e=r.pathname,t=-1;for(;++t<e.length;)if(e.codePointAt(t)===37&&e.codePointAt(t+1)===50){let a=e.codePointAt(t+2);if(a===70||a===102){let n=new TypeError("File URL path must not include encoded / characters");throw n.code="ERR_INVALID_FILE_URL_PATH",n}}return decodeURIComponent(e)}var np=["history","path","basename","stem","extname","dirname"],fs=class{constructor(e){let t;e?ai(e)?t={path:e}:typeof e=="string"||YA(e)?t={value:e}:t=e:t={},this.cwd=qb.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<np.length;){let i=np[a];i in t&&t[i]!==void 0&&t[i]!==null&&(this[i]=i==="history"?[...t[i]]:t[i])}let n;for(n in t)np.includes(n)||(this[n]=t[n])}get basename(){return typeof this.path=="string"?pr.basename(this.path):void 0}set basename(e){ip(e,"basename"),ap(e,"basename"),this.path=pr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?pr.dirname(this.path):void 0}set dirname(e){Kb(this.basename,"dirname"),this.path=pr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?pr.extname(this.path):void 0}set extname(e){if(ap(e,"extname"),Kb(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=pr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){ai(e)&&(e=$b(e)),ip(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?pr.basename(this.path,this.extname):void 0}set stem(e){ip(e,"stem"),ap(e,"stem"),this.path=pr.join(this.dirname||"",e+(this.extname||""))}fail(e,t,a){let n=this.message(e,t,a);throw n.fatal=!0,n}info(e,t,a){let n=this.message(e,t,a);return n.fatal=void 0,n}message(e,t,a){let n=new st(e,t,a);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function ap(r,e){if(r&&r.includes(pr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+pr.sep+"`")}function ip(r,e){if(!r)throw new Error("`"+e+"` cannot be empty")}function Kb(r,e){if(!r)throw new Error("Setting `"+e+"` requires `path` to be set too")}function YA(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var Xb=function(r){let a=this.constructor.prototype,n=a[r],i=function(){return n.apply(i,arguments)};Object.setPrototypeOf(i,a);let s=Object.getOwnPropertyNames(n);for(let o of s){let l=Object.getOwnPropertyDescriptor(n,o);l&&Object.defineProperty(i,o,l)}return i};var JA={}.hasOwnProperty,cp=class r extends Xb{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=rp()}copy(){let e=new r,t=-1;for(;++t<this.attachers.length;){let a=this.attachers[t];e.use(...a)}return e.data((0,$l.default)(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(lp("data",this.frozen),this.namespace[e]=t,this):JA.call(this.namespace,e)&&this.namespace[e]||void 0:e?(lp("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);let n=t.call(e,...a);typeof n=="function"&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let t=ql(e),a=this.parser||this.Parser;return sp("parse",a),a(String(t),t)}process(e,t){let a=this;return this.freeze(),sp("process",this.parser||this.Parser),op("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(i,s){let o=ql(e),l=a.parse(o);a.run(l,o,function(u,p,m){if(u||!p||!m)return c(u);let d=p,g=a.stringify(d,m);QA(g)?m.value=g:m.result=g,c(u,m)});function c(u,p){u||!p?s(u):i?i(p):t(void 0,p)}}}processSync(e){let t=!1,a;return this.freeze(),sp("processSync",this.parser||this.Parser),op("processSync",this.compiler||this.Compiler),this.process(e,n),Jb("processSync","process",t),a;function n(i,s){t=!0,tp(i),a=s}}run(e,t,a){Yb(e),this.freeze();let n=this.transformers;return!a&&typeof t=="function"&&(a=t,t=void 0),a?i(void 0,a):new Promise(i);function i(s,o){let l=ql(t);n.run(e,l,c);function c(u,p,m){let d=p||e;u?o(u):s?s(d):a(void 0,d,m)}}}runSync(e,t){let a=!1,n;return this.run(e,t,i),Jb("runSync","run",a),n;function i(s,o){tp(s),n=o,a=!0}}stringify(e,t){this.freeze();let a=ql(t),n=this.compiler||this.Compiler;return op("stringify",n),Yb(e),n(e,a)}use(e,...t){let a=this.attachers,n=this.namespace;if(lp("use",this.frozen),e!=null)if(typeof e=="function")l(e,t);else if(typeof e=="object")Array.isArray(e)?o(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...p]=c;l(u,p)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(c.plugins),c.settings&&(n.settings=(0,$l.default)(!0,n.settings,c.settings))}function o(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let p=c[u];i(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let p=-1,m=-1;for(;++p<a.length;)if(a[p][0]===c){m=p;break}if(m===-1)a.push([c,...u]);else if(u.length>0){let[d,...g]=u,f=a[m][1];hs(f)&&hs(d)&&(d=(0,$l.default)(!0,f,d)),a[m]=[c,d,...g]}}}},up=new cp().freeze();function sp(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `parser`")}function op(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `compiler`")}function lp(r,e){if(e)throw new Error("Cannot call `"+r+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Yb(r){if(!hs(r)||typeof r.type!="string")throw new TypeError("Expected node, got `"+r+"`")}function Jb(r,e,t){if(!t)throw new Error("`"+r+"` finished async. Use `"+e+"` instead")}function ql(r){return ZA(r)?r:new fs(r)}function ZA(r){return!!(r&&typeof r=="object"&&"message"in r&&"messages"in r)}function QA(r){return typeof r=="string"||eI(r)}function eI(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}var ys=class extends Gt{constructor(){super(...arguments);this.html=()=>`
|
|
3458
3481
|
|
|
3459
3482
|
<!-- Styling -->
|
|
3460
3483
|
<style>
|
|
@@ -3541,7 +3564,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3541
3564
|
<div class='llm-selector-item-icon' style="background-image: url('${a.icon}'); "></div>
|
|
3542
3565
|
<div class='llm-selector-item-name'>${a.name}</div>
|
|
3543
3566
|
<div class='llm-selector-item-provider'>${a.provider}</div>
|
|
3544
|
-
`,n.addEventListener("click",i=>{this.dispatchEvent(new CustomEvent("select",{detail:a.id}))}),t.appendChild(n)}}};ti.observedAttributes=["open"];var la=new ge("ONNXModel"),Jt=class r{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,la.debug(`Model input parameters: ${e.inputNames.join(", ")}`),la.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!r.lib}static async load(e){if(!r.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(la.debug("Loading ONNX runtime"),this.onnx=await r.lib()),la.debug(`Loading model: ${e}`);let t=await this.onnx.InferenceSession.create(e);return new r(t)}makeTensor(e,t,a=0){let n=1;for(let o of t)n*=o;let i;if(e=="float32")i=new r.onnx.Tensor(new Float32Array(n),t);else if(e=="int8")i=new r.onnx.Tensor(new Int8Array(n),t);else if(e=="int16")i=new r.onnx.Tensor(new Int16Array(n),t);else if(e=="int32")i=new r.onnx.Tensor(new Int32Array(n),t);else if(e=="int64")i=new r.onnx.Tensor(new BigInt64Array(n),t);else if(e=="uint8")i=new r.onnx.Tensor(new Uint8Array(n),t);else if(e=="uint16")i=new r.onnx.Tensor(new Uint16Array(n),t);else if(e=="uint32")i=new r.onnx.Tensor(new Uint32Array(n),t);else if(e=="uint64")i=new r.onnx.Tensor(new BigUint64Array(n),t);else throw new Error(`Invalid type: ${e}`);return a!==0&&(e=="int64"||e=="uint64")?i.data.fill(BigInt(a)):a!==0&&i.data.fill(a),i}registerConstant(e,t){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=t,t}makeConstant(e,t,a,n=0){return this.registerConstant(e,this.makeTensor(t,a,n))}registerState(e,t,a){if(t||(t=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(t))throw new Error(`Model does not have an output named: ${t}`);return this.stateTensors[e]={outputName:t,tensor:a},a}makeState(e,t,a,n,i=0){return this.registerState(e,t,this.makeTensor(a,n,i))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return la.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let t in this.stateTensors)e[t]=this.stateTensors[t].tensor;for(let t in this.constantTensors)e[t]=this.constantTensors[t];try{let t=await this.session.run(e);for(let a in this.stateTensors){let n=t[this.stateTensors[a].outputName];this.stateTensors[a].tensor=n}return t}finally{this._runActive=!1}}resetState(){la.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var tf="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var rf="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var Ak=new ge("PCMPlayerNode"),as=class extends AudioWorkletNode{constructor(t,a,n){super(t,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!a||a<=0)throw new Error(`Invalid sample rate: ${a}`);if(!n||n!="int16"&&n!="float32")throw new Error(`Invalid format: ${n}`);this.sampleRate=a,this.format=n,this.port.onmessage=i=>this.onWorkletMessage(i),this.port.postMessage({action:"start",inputSampleRate:a,outputSampleRate:t.sampleRate,format:n})}feed(t){this.port.postMessage({action:"data",buffer:t.buffer},[t.buffer])}async play(t){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(a=>this._playPromiseResolve=a),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:t}}));try{let a=t.getReader();for(;!this.isCancelled;){let{done:n,value:i}=await a.read();if(n||!i)break;this.feed(i)}}catch(a){Ak.warn("Stream error:",a),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:t,error:a}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(t){t.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var is=new ge("SpeechOutput"),nf=.5,Ik=.8,os=class extends EventTarget{constructor(t){super();this.maxVolumeHeard=0;this.ai=t,this.ai.addEventListener("output",a=>this.onTextOutputFromAI(a)),this.ai.audio?.speechRecognition.addEventListener("speechstart",a=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(t){t.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(t.detail.message)}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let a=Math.sqrt(t/this.analyserBuffer.length);return a>this.maxVolumeHeard&&(this.maxVolumeHeard=a),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,a/this.maxVolumeHeard))}async speak(t){if(!this.ai?.config?.voice?.providerID)return is.warn("No voice provider configured");let a=`speech-${Rk++}`;await this.ai.audio.beginAccess(a);try{await this._speakWithLock(t)}finally{this.ai.audio.endAccess(a)}}async _speakWithLock(t){this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Ik);let a=this.ai?._voiceTracker||is.timer(`${this.ai.config.voice.providerID} voice`);a(`Speak: ${t}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let n=new as(this.ai.audio.context,24e3,"int16");this.currentPlayer=n,n.connect(this.analyserNode),n.addEventListener("end",o=>{let s=o;a(`PCM stream ${s.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==n&&!s.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let i;if(this.ai.config.voice.providerID=="openai")i=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:t,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:t})});else{is.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(a(`Received response ${i.status} ${i.statusText}`),!i.ok){is.warn(`Failed to generate voice sample: ${i.status} ${i.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:t}})),a("Playing PCM stream"),await n.play(i.body),a("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let t=this.currentPlayerVolume,a=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=nf);let n=400;t.gain.linearRampToValueAtTime(0,n/1e3),await new Promise(i=>setTimeout(i,n+250)),t.disconnect(),a?.stop(),a?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=nf)}},Rk=1;function ss(r,e){let t=e.reduce((l,c)=>l+c.byteLength,0),a=new DataView(new ArrayBuffer(44));a.setUint8(0,82),a.setUint8(1,73),a.setUint8(2,70),a.setUint8(3,70),a.setUint32(4,44+t,!0),a.setUint8(8,87),a.setUint8(9,65),a.setUint8(10,86),a.setUint8(11,69);let n=1,i=32,o=n*i/8,s=r*o;return a.setUint8(12,102),a.setUint8(13,109),a.setUint8(14,116),a.setUint8(15,32),a.setUint32(16,16,!0),a.setUint16(20,3,!0),a.setUint16(22,n,!0),a.setUint32(24,r,!0),a.setUint32(28,s,!0),a.setUint16(32,o,!0),a.setUint16(34,i,!0),a.setUint8(36,100),a.setUint8(37,97),a.setUint8(38,116),a.setUint8(39,97),a.setUint32(40,t,!0),new File([a,...e],"audio.wav",{type:"audio/wav"})}var ls=class extends AudioWorkletNode{constructor(t,a,n,i){super(t,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=n;let o=["int16","int64","float32"];if(!a||a<=0)throw new Error(`Invalid sample rate: ${a}`);if(!o.includes(n))throw new Error(`Invalid format ${n}, must be one of: ${o.join(", ")}`);if(!i||i<=0)throw new Error(`Invalid buffer size: ${i}`);this.port.onmessage=s=>this.onWorkletMessage(s),this.port.postMessage({action:"start",inputSampleRate:t.sampleRate,outputSampleRate:a,format:n,bufferSize:i})}onWorkletMessage(t){if(t.data.action=="data"){let a=null;if(this.format=="int16"&&(a=new Int16Array(t.data.buffer)),this.format=="int64"&&(a=new BigInt64Array(t.data.buffer)),this.format=="float32"&&(a=new Float32Array(t.data.buffer)),!a)throw new Error(`Invalid format: ${this.format}`);this.onData(a),this.dispatchEvent(new CustomEvent("data",{detail:{data:a}}))}}onData(t){}};var Yc=16e3,cs=256,ca=8,ri=new ge("VoiceDetectionNode"),ni=class ni extends ls{constructor(t){super(t,Yc,"float32",cs*ca);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!ni.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return Yc}get numberOfSamples(){return cs}get numberOfSampleChunks(){return ca}get outputBufferSize(){return cs*ca}get isModelLoaded(){return!!this.vad}async loadModel(){ri.debug("Loading VAD model"),this.vad=await Jt.load(ni.vadModelURL),this.vad.ignoreIfBusy=!0,ri.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],Yc),this.vad.makeState("h","hn","float32",[2,ca,64]),this.vad.makeState("c","cn","float32",[2,ca,64])}async onData(t){if(this.vad)try{let a=await this.vad.run({input:new Jt.onnx.Tensor(t,[ca,cs])});if(!a)return;this.currentProbability=0;for(let o=0;o<a.output.data.length;o++)a.output.data[o]>this.currentProbability&&(this.currentProbability=a.output.data[o]);let n=this.isVoiceActive?this.sentivityEnd:this.sensitivity,i=this.currentProbability>n;if(!i&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=i,i&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),ri.debug("Started speaking")):i?this.lastVoiceActiveDate=Date.now():!i&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!i&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),ri.debug("Stopped speaking after timeout")),!i){let o=Date.now();o>this.nextVadReset&&(this.nextVadReset=o+5e3,this.vad.resetState())}}catch(a){ri.error("VAD failed:",a)}}onSpeechStart(){}onSpeechEnd(){}};ni.vadModelURL="";var ua=ni;var af=new ge("VoiceChunkOutputNode"),da=class extends ua{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((t,a)=>t+a.length,0)/8e3}async onData(t){if(await super.onData(t),this.isVoiceActive&&!this._voiceRecording){af.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let a of this.buffers)this.recordedBuffers.push(a),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:a,isFinal:!1}})),this.onVoiceChunk(a);this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!0}})),this.onVoiceChunk(t),this._voiceRecording=!1;let a=this.recordedBuffers.reduce((n,i)=>n+i.length,0);af.debug(`Voice complete, recorded ${(a/8e3).toFixed(2)} seconds of audio, ${a*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(t);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(t){}onVoiceEnd(t){}};var us=new ge("OpenAITranscriptionNode"),ds=class extends da{constructor(t,a){super(t);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=a}async onVoiceEnd(t){let a=us.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...t);let n=ss(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let i="";try{let o=new FormData;o.append("file",n),o.append("model","whisper-1"),o.append("response_format","text");let s=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o,signal:this.lastRequestAbortController.signal});if(!s.ok)throw new Error(`Failed to generate voice sample: ${s.status} ${s.statusText}`);a("Response received"),i=await s.text(),a("Content received: "+i),this.lastRequestAbortController=void 0}catch(o){us.error(`Failed to transcribe speech: ${o.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!i)return us.debug("Transcription complete, but no text was found");us.debug(`Transcription: ${i}`),this.onVoiceTranscription(i),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i}}))}onVoiceTranscription(t){}};var ps=class extends WebSocket{constructor(t){super(t);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(t){this.readyState==WebSocket.OPEN?super.send(t):this.pendingData.push(t)}_onOpen(){for(let t of this.pendingData)super.send(t);this.pendingData=[]}};var lr=new ge("IntelliWeaveTranscriptionNode"),Pk="wss://speech.intelliweave.ai/api/v1/transcribe",hs=class hs extends da{constructor(t,a){super(t);this.apiAddress=Pk;this.apiKey="";this.isTranscribing=!1;this.apiKey=a}async onVoiceChunk(t){this.isTranscribing=!0,this.ws?this.ws.send(t):(lr.debug("Opening WebSocket connection"),this.ws=new ps(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(t.buffer),this.ws.onopen=()=>{lr.debug("WebSocket connection opened")},this.ws.addEventListener("message",n=>{let i=JSON.parse(n.data);if(i.error)return lr.warn("Error: "+i.error);if(i.type!="transcription")return lr.warn("Invalid response type",i);if(i.streaming&&!i.final)return lr.debug("Partial transcription: "+i.partialText);if(this.isTranscribing=!1,!i.text.trim())return lr.warn(`Empty transcription (${i.processingTime}ms)`);lr.debug(`Transcription: ${i.text} (${i.processingTime}ms)`),this.onVoiceTranscription(i.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",n=>lr.warn("WebSocket error")));let a=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{lr.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},a)}async onVoiceEnd(t){if(this.ws?.send(JSON.stringify({type:"end"})),hs.debugExportWav){let a=ss(this.sampleRate,t),n=document.createElement("a");n.href=URL.createObjectURL(a),n.download="recording.wav",n.click()}}onVoiceTranscription(t){}onSocketClose(){lr.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};hs.debugExportWav=!1;var ms=hs;var Zc=new ge("SpeechRecognition"),gs=class extends EventTarget{constructor(t){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=t,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async a=>{a.enable?await this.start():this.stop()}}])}get isSupported(){if(!Jt.lib||!this.ai?.vadModel||!Cr().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let t=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,t.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),ua.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new ds(this.ai.audio.context,this.ai.config.transcription.apiKey),t.connect(this.voiceDetection)):(this.voiceDetection=new ms(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,t.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",a=>{this.ai._voiceTracker=Zc.timer("voice interaction","Speech started"),this.recordingStartTime=Date.now(),pt(this.ai,{event_type:"voice_start",event_properties:{audio_provider:this.ai.config?.transcription?.providerID||"intelliweave",sample_rate:16e3}}),this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}),this.voiceDetection.addEventListener("speechend",a=>{this.ai._voiceTracker?.("Speech ended");let n=this.recordingStartTime?Date.now()-this.recordingStartTime:0;pt(this.ai,{event_type:"voice_end",event_properties:{recording_duration_ms:n}}),this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}),this.voiceDetection.addEventListener("transcription",a=>{this.ai._voiceTracker?.(`Transcription: ${a.detail.text}`),pt(this.ai,{event_type:"voice_submit",value_str:"",event_properties:{transcription_provider:this.ai.config?.transcription?.providerID||"intelliweave",confidence_score:a.detail.confidence||void 0}}),this.onTranscription(a)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(t){Zc.error("Failed to start speech recognition:",t),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(t=>t.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let a=Math.sqrt(t/this.analyserBuffer.length);return a>this.maxVolumeHeard&&(this.maxVolumeHeard=a),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,a/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(t){let a=t.detail.text;Zc.debug("Heard:",a),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:a,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(t){throw this._skipEvents=!1,t}}}};var fs=new ge("AudioSystem"),pa=class{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new gs(this.ai),this.speechOutput=new os(this.ai)}static get isSupported(){return!(!Jt.lib||!Cr().AudioWorkletNode)}async beginAccess(e){fs.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(fs.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await Promise.all([this.context.audioWorklet.addModule(tf),this.context.audioWorklet.addModule(rf)]))}endAccess(e){fs.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(t=>t!=e),!this.locks.length&&(fs.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var DF=new ge("Stream");var Cn=Cs(vf(),1);var UF=new ge("React");var HF=(0,Cn.createContext)(void 0);var ii=new ge("Embed"),kn=class extends At{constructor(){super();this.config={};this.suggestions=[];this._previousOpenState=!1;this.html=()=>`
|
|
3567
|
+
`,n.addEventListener("click",i=>{this.dispatchEvent(new CustomEvent("select",{detail:a.id}))}),t.appendChild(n)}}};ys.observedAttributes=["open"];var ii=new ge("ONNXModel"),mr=class r{constructor(e){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=e,ii.debug(`Model input parameters: ${e.inputNames.join(", ")}`),ii.debug(`Model output parameters: ${e.outputNames.join(", ")}`)}static isSupported(){return!!r.lib}static async load(e){if(!r.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(ii.debug("Loading ONNX runtime"),this.onnx=await r.lib()),ii.debug(`Loading model: ${e}`);let t=await this.onnx.InferenceSession.create(e);return new r(t)}makeTensor(e,t,a=0){let n=1;for(let s of t)n*=s;let i;if(e=="float32")i=new r.onnx.Tensor(new Float32Array(n),t);else if(e=="int8")i=new r.onnx.Tensor(new Int8Array(n),t);else if(e=="int16")i=new r.onnx.Tensor(new Int16Array(n),t);else if(e=="int32")i=new r.onnx.Tensor(new Int32Array(n),t);else if(e=="int64")i=new r.onnx.Tensor(new BigInt64Array(n),t);else if(e=="uint8")i=new r.onnx.Tensor(new Uint8Array(n),t);else if(e=="uint16")i=new r.onnx.Tensor(new Uint16Array(n),t);else if(e=="uint32")i=new r.onnx.Tensor(new Uint32Array(n),t);else if(e=="uint64")i=new r.onnx.Tensor(new BigUint64Array(n),t);else throw new Error(`Invalid type: ${e}`);return a!==0&&(e=="int64"||e=="uint64")?i.data.fill(BigInt(a)):a!==0&&i.data.fill(a),i}registerConstant(e,t){if(!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);return this.constantTensors[e]=t,t}makeConstant(e,t,a,n=0){return this.registerConstant(e,this.makeTensor(t,a,n))}registerState(e,t,a){if(t||(t=e),!this.session.inputNames.includes(e))throw new Error(`Model does not have an input named: ${e}`);if(!this.session.outputNames.includes(t))throw new Error(`Model does not have an output named: ${t}`);return this.stateTensors[e]={outputName:t,tensor:a},a}makeState(e,t,a,n,i=0){return this.registerState(e,t,this.makeTensor(a,n,i))}async run(e={}){if(this._runActive&&this.ignoreIfBusy)return ii.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let t in this.stateTensors)e[t]=this.stateTensors[t].tensor;for(let t in this.constantTensors)e[t]=this.constantTensors[t];try{let t=await this.session.run(e);for(let a in this.stateTensors){let n=t[this.stateTensors[a].outputName];this.stateTensors[a].tensor=n}return t}finally{this._runActive=!1}}resetState(){ii.debug("Resetting state tensors");for(let e in this.stateTensors)this.stateTensors[e].tensor.data.fill(0)}};var Zb="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var Qb="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var nI=new ge("PCMPlayerNode"),Kl=class extends AudioWorkletNode{constructor(t,a,n){super(t,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!a||a<=0)throw new Error(`Invalid sample rate: ${a}`);if(!n||n!="int16"&&n!="float32")throw new Error(`Invalid format: ${n}`);this.sampleRate=a,this.format=n,this.port.onmessage=i=>this.onWorkletMessage(i),this.port.postMessage({action:"start",inputSampleRate:a,outputSampleRate:t.sampleRate,format:n})}feed(t){this.port.postMessage({action:"data",buffer:t.buffer},[t.buffer])}async play(t){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(a=>this._playPromiseResolve=a),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:t}}));try{let a=t.getReader();for(;!this.isCancelled;){let{done:n,value:i}=await a.read();if(n||!i)break;this.feed(i)}}catch(a){nI.warn("Stream error:",a),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:t,error:a}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(t){t.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var Xl=new ge("SpeechOutput"),ev=.5,aI=.8,Yl=class extends EventTarget{constructor(t){super();this.maxVolumeHeard=0;this.ai=t,this.ai.addEventListener("output",a=>this.onTextOutputFromAI(a)),this.ai.audio?.speechRecognition.addEventListener("speechstart",a=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(t){t.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(t.detail.message)}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let a=Math.sqrt(t/this.analyserBuffer.length);return a>this.maxVolumeHeard&&(this.maxVolumeHeard=a),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,a/this.maxVolumeHeard))}async speak(t){if(!this.ai?.config?.voice?.providerID)return Xl.warn("No voice provider configured");let a=`speech-${iI++}`;await this.ai.audio.beginAccess(a);try{await this._speakWithLock(t)}finally{this.ai.audio.endAccess(a)}}async _speakWithLock(t){this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=aI);let a=this.ai?._voiceTracker||Xl.timer(`${this.ai.config.voice.providerID} voice`);a(`Speak: ${t}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let n=new Kl(this.ai.audio.context,24e3,"int16");this.currentPlayer=n,n.connect(this.analyserNode),n.addEventListener("end",s=>{let o=s;a(`PCM stream ${o.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==n&&!o.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let i;if(this.ai.config.voice.providerID=="openai")i=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:t,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:t})});else{Xl.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(a(`Received response ${i.status} ${i.statusText}`),!i.ok){Xl.warn(`Failed to generate voice sample: ${i.status} ${i.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:t}})),a("Playing PCM stream"),await n.play(i.body),a("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let t=this.currentPlayerVolume,a=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=ev);let n=400;t.gain.linearRampToValueAtTime(0,n/1e3),await new Promise(i=>setTimeout(i,n+250)),t.disconnect(),a?.stop(),a?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=ev)}},iI=1;function Jl(r,e){let t=e.reduce((l,c)=>l+c.byteLength,0),a=new DataView(new ArrayBuffer(44));a.setUint8(0,82),a.setUint8(1,73),a.setUint8(2,70),a.setUint8(3,70),a.setUint32(4,44+t,!0),a.setUint8(8,87),a.setUint8(9,65),a.setUint8(10,86),a.setUint8(11,69);let n=1,i=32,s=n*i/8,o=r*s;return a.setUint8(12,102),a.setUint8(13,109),a.setUint8(14,116),a.setUint8(15,32),a.setUint32(16,16,!0),a.setUint16(20,3,!0),a.setUint16(22,n,!0),a.setUint32(24,r,!0),a.setUint32(28,o,!0),a.setUint16(32,s,!0),a.setUint16(34,i,!0),a.setUint8(36,100),a.setUint8(37,97),a.setUint8(38,116),a.setUint8(39,97),a.setUint32(40,t,!0),new File([a,...e],"audio.wav",{type:"audio/wav"})}var Zl=class extends AudioWorkletNode{constructor(t,a,n,i){super(t,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=n;let s=["int16","int64","float32"];if(!a||a<=0)throw new Error(`Invalid sample rate: ${a}`);if(!s.includes(n))throw new Error(`Invalid format ${n}, must be one of: ${s.join(", ")}`);if(!i||i<=0)throw new Error(`Invalid buffer size: ${i}`);this.port.onmessage=o=>this.onWorkletMessage(o),this.port.postMessage({action:"start",inputSampleRate:t.sampleRate,outputSampleRate:a,format:n,bufferSize:i})}onWorkletMessage(t){if(t.data.action=="data"){let a=null;if(this.format=="int16"&&(a=new Int16Array(t.data.buffer)),this.format=="int64"&&(a=new BigInt64Array(t.data.buffer)),this.format=="float32"&&(a=new Float32Array(t.data.buffer)),!a)throw new Error(`Invalid format: ${this.format}`);this.onData(a),this.dispatchEvent(new CustomEvent("data",{detail:{data:a}}))}}onData(t){}};var dp=16e3,Ql=256,si=8,bs=new ge("VoiceDetectionNode"),vs=class vs extends Zl{constructor(t){super(t,dp,"float32",Ql*si);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!vs.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return dp}get numberOfSamples(){return Ql}get numberOfSampleChunks(){return si}get outputBufferSize(){return Ql*si}get isModelLoaded(){return!!this.vad}async loadModel(){bs.debug("Loading VAD model"),this.vad=await mr.load(vs.vadModelURL),this.vad.ignoreIfBusy=!0,bs.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],dp),this.vad.makeState("h","hn","float32",[2,si,64]),this.vad.makeState("c","cn","float32",[2,si,64])}async onData(t){if(this.vad)try{let a=await this.vad.run({input:new mr.onnx.Tensor(t,[si,Ql])});if(!a)return;this.currentProbability=0;for(let s=0;s<a.output.data.length;s++)a.output.data[s]>this.currentProbability&&(this.currentProbability=a.output.data[s]);let n=this.isVoiceActive?this.sentivityEnd:this.sensitivity,i=this.currentProbability>n;if(!i&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=i,i&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),bs.debug("Started speaking")):i?this.lastVoiceActiveDate=Date.now():!i&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!i&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),bs.debug("Stopped speaking after timeout")),!i){let s=Date.now();s>this.nextVadReset&&(this.nextVadReset=s+5e3,this.vad.resetState())}}catch(a){bs.error("VAD failed:",a)}}onSpeechStart(){}onSpeechEnd(){}};vs.vadModelURL="";var oi=vs;var tv=new ge("VoiceChunkOutputNode"),li=class extends oi{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((t,a)=>t+a.length,0)/8e3}async onData(t){if(await super.onData(t),this.isVoiceActive&&!this._voiceRecording){tv.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let a of this.buffers)this.recordedBuffers.push(a),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:a,isFinal:!1}})),this.onVoiceChunk(a);this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!0}})),this.onVoiceChunk(t),this._voiceRecording=!1;let a=this.recordedBuffers.reduce((n,i)=>n+i.length,0);tv.debug(`Voice complete, recorded ${(a/8e3).toFixed(2)} seconds of audio, ${a*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(t);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(t){}onVoiceEnd(t){}};var ec=new ge("OpenAITranscriptionNode"),tc=class extends li{constructor(t,a){super(t);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=a}async onVoiceEnd(t){let a=ec.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...t);let n=Jl(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let i="";try{let s=new FormData;s.append("file",n),s.append("model","whisper-1"),s.append("response_format","text");let o=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:s,signal:this.lastRequestAbortController.signal});if(!o.ok)throw new Error(`Failed to generate voice sample: ${o.status} ${o.statusText}`);a("Response received"),i=await o.text(),a("Content received: "+i),this.lastRequestAbortController=void 0}catch(s){ec.error(`Failed to transcribe speech: ${s.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!i)return ec.debug("Transcription complete, but no text was found");ec.debug(`Transcription: ${i}`),this.onVoiceTranscription(i),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i}}))}onVoiceTranscription(t){}};var rc=class extends WebSocket{constructor(t){super(t);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(t){this.readyState==WebSocket.OPEN?super.send(t):this.pendingData.push(t)}_onOpen(){for(let t of this.pendingData)super.send(t);this.pendingData=[]}};var xr=new ge("IntelliWeaveTranscriptionNode"),sI="wss://speech.intelliweave.ai/api/v1/transcribe",ac=class ac extends li{constructor(t,a){super(t);this.apiAddress=sI;this.apiKey="";this.isTranscribing=!1;this.apiKey=a}async onVoiceChunk(t){this.isTranscribing=!0,this.ws?this.ws.send(t):(xr.debug("Opening WebSocket connection"),this.ws=new rc(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(t.buffer),this.ws.onopen=()=>{xr.debug("WebSocket connection opened")},this.ws.addEventListener("message",n=>{let i=JSON.parse(n.data);if(i.error)return xr.warn("Error: "+i.error);if(i.type!="transcription")return xr.warn("Invalid response type",i);if(i.streaming&&!i.final)return xr.debug("Partial transcription: "+i.partialText);if(this.isTranscribing=!1,!i.text.trim())return xr.warn(`Empty transcription (${i.processingTime}ms)`);xr.debug(`Transcription: ${i.text} (${i.processingTime}ms)`),this.onVoiceTranscription(i.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:i.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",n=>xr.warn("WebSocket error")));let a=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{xr.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},a)}async onVoiceEnd(t){if(this.ws?.send(JSON.stringify({type:"end"})),ac.debugExportWav){let a=Jl(this.sampleRate,t),n=document.createElement("a");n.href=URL.createObjectURL(a),n.download="recording.wav",n.click()}}onVoiceTranscription(t){}onSocketClose(){xr.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};ac.debugExportWav=!1;var nc=ac;var pp=new ge("SpeechRecognition"),ic=class extends EventTarget{constructor(t){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=t,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async a=>{a.enable?await this.start():this.stop()}}])}get isSupported(){if(!mr.lib||!this.ai?.vadModel||!$r().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let t=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,t.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),oi.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new tc(this.ai.audio.context,this.ai.config.transcription.apiKey),t.connect(this.voiceDetection)):(this.voiceDetection=new nc(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,t.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",a=>{this.ai._voiceTracker=pp.timer("voice interaction","Speech started"),this.recordingStartTime=Date.now(),Et(this.ai,{event_type:"voice_start",event_properties:{audio_provider:this.ai.config?.transcription?.providerID||"intelliweave",sample_rate:16e3}}),this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}),this.voiceDetection.addEventListener("speechend",a=>{this.ai._voiceTracker?.("Speech ended");let n=this.recordingStartTime?Date.now()-this.recordingStartTime:0;Et(this.ai,{event_type:"voice_end",event_properties:{recording_duration_ms:n}}),this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}),this.voiceDetection.addEventListener("transcription",a=>{this.ai._voiceTracker?.(`Transcription: ${a.detail.text}`),Et(this.ai,{event_type:"voice_submit",value_str:"",event_properties:{transcription_provider:this.ai.config?.transcription?.providerID||"intelliweave",confidence_score:a.detail.confidence||void 0}}),this.onTranscription(a)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(t){pp.error("Failed to start speech recognition:",t),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(t=>t.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let n of this.analyserBuffer)t+=n*n;let a=Math.sqrt(t/this.analyserBuffer.length);return a>this.maxVolumeHeard&&(this.maxVolumeHeard=a),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,a/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(t){let a=t.detail.text;pp.debug("Heard:",a),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:a,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(t){throw this._skipEvents=!1,t}}}};var sc=new ge("AudioSystem"),ci=class{constructor(e){this.locks=[];if(!e)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=e,this.ai.audio=this,this.speechRecognition=new ic(this.ai),this.speechOutput=new Yl(this.ai)}static get isSupported(){return!(!mr.lib||!$r().AudioWorkletNode)}async beginAccess(e){sc.debug(`Began access for: ${e}`),this.locks.includes(e)||this.locks.push(e),!this.context&&(sc.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await Promise.all([this.context.audioWorklet.addModule(Zb),this.context.audioWorklet.addModule(Qb)]))}endAccess(e){sc.debug(`Ended access for: ${e}`),this.locks=this.locks.filter(t=>t!=e),!this.locks.length&&(sc.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var YH=new ge("Stream");var na=hc(gv(),1);var iV=new ge("React");var sV=(0,na.createContext)(void 0);var Ss=new ge("Embed"),aa=class extends Gt{constructor(){super();this.config={};this.suggestions=[];this._previousOpenState=!1;this.html=()=>`
|
|
3545
3568
|
|
|
3546
3569
|
<!-- Styling -->
|
|
3547
3570
|
<style>
|
|
@@ -3706,7 +3729,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3706
3729
|
<div id='root' class='hidden'>
|
|
3707
3730
|
|
|
3708
3731
|
<!-- Logo -->
|
|
3709
|
-
${
|
|
3732
|
+
${Yi.add({id:"web-weaver-logo",logo:this.attr.logo})}
|
|
3710
3733
|
<div id='pulseanim' class="circle pulse"></div>
|
|
3711
3734
|
|
|
3712
3735
|
<!-- Inner container contains all the UI when the panel is open -->
|
|
@@ -3714,10 +3737,10 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3714
3737
|
</div>
|
|
3715
3738
|
|
|
3716
3739
|
<!-- LLM selector panel -->
|
|
3717
|
-
${
|
|
3740
|
+
${ys.add({id:"llm-selector-panel"})}
|
|
3718
3741
|
|
|
3719
3742
|
<!-- Interaction panel -->
|
|
3720
|
-
${
|
|
3743
|
+
${Xi.add({id:"interaction-bar"})}
|
|
3721
3744
|
|
|
3722
3745
|
|
|
3723
3746
|
<!-- Powered by IW banner -->
|
|
@@ -3727,7 +3750,7 @@ ${e.extractions.map(n=>`- ${n.name} (${n.type}): ${n.description||"No descriptio
|
|
|
3727
3750
|
|
|
3728
3751
|
</div>
|
|
3729
3752
|
|
|
3730
|
-
`;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._isProcessing=!1;this.ai=new
|
|
3753
|
+
`;this._lastLogo="";this._lastBackground="";this._lastTextColor="";this._isProcessing=!1;this.ai=new Qa,ci.isSupported&&(this.ai.audio=new ci(this.ai))}onCreate(){Be().embed&&Ss.warn("Only one <web-weaver-embed> element should be on the page."),Be().embed=this,this.child("root").addEventListener("click",n=>this.onContainerClick(n)),this.child("web-weaver-logo").addEventListener("click",n=>this.onLogoClick(n)),this.child("interaction-bar").addEventListener("input-message",n=>this.processInput(n.detail)),this.child("interaction-bar").addEventListener("llm-button-click",n=>this.state.llmPanelOpen=!this.state.llmPanelOpen),this.child("llm-selector-panel").addEventListener("select",n=>this.onLLMModelSelect(n)),this.child("interaction-bar").connectAI(this.ai),this.ai.onAIMessage=this.onAIMessage.bind(this),this.ai.onAIToolStart=this.onAIToolStart.bind(this),this.ai.knowledgeBase.addEntry({id:"ui.suggestResponse",type:"action",name:"Suggest a response",content:"Add a button with a suggested response for the user's next message. Supports multiple calls at once.",isContext:!0,parameters:[{name:"text",type:"string",description:"The suggested response for the user's next message."}],action:n=>(this.suggestions.push(n.text),this.ai.submitAnalyticsEvent({type:"suggest-response",text:n.text}),"Suggestion button added")});let a=this.attr.apiKey||Be().apiKey;if(!a)return Ss.warn("No API key specified, some features may be unavailable.");this.state.loading=!0,this.attr.hubAPI&&(this.ai.hubAPI=this.attr.hubAPI),this.ai.load(a).then(n=>{this.config=n,Be().introductionMessage=this.config.introductionMessage,Be().analytics=this.config.analytics!==void 0?!!this.config.analytics:Be().analytics,this.applyConfigStylesAndAttributes(),this.child("root").classList.remove("hidden"),this.state.loading=!1,this.resetConversation()}).catch(n=>{Ss.error("Failed to load AI configuration:",n),this.state.loading=!1;let i=this.child("web-weaver-embed-inner");i&&(i.innerHTML='<div class="output" style="color: red; padding: 20px;">Error loading configuration. Please try again later.</div>')})}applyConfigStylesAndAttributes(){let t=this.config,a=this.child("root");if(!a)return;let n=!1,s=this.getAttribute("logo")||t.logo;if(s&&s!==this._lastLogo){this._lastLogo=s,n=!0;let m=this.child("web-weaver-logo");m&&m.setAttribute("logo",s)}let l=this.getAttribute("background")||t.background;l!==this._lastBackground&&(this._lastBackground=l,n=!0,l?a.style.background=l:a.style.background="");let u=this.getAttribute("textColor")||t.textColor,p=this.child("interaction-bar");u!==this._lastTextColor&&(this._lastTextColor=u,n=!0,u?(a.style.color=u,p&&p.setAttribute("textColor",u)):(a.style.color="",p&&p.removeAttribute("textColor"))),n&&Ss.debug("[WebWeaverEmbed] Applied UI Styling:",{finalLogo:s,finalBackground:a.style.background,finalTextColor:a.style.color})}onUpdate(){if(this.applyConfigStylesAndAttributes(),this.child("web-weaver-embed-inner").style.display=this.attr.open?"":"none",this.child("interaction-bar").style.display=this.attr.open?"":"none",this.child("llm-selector-panel").attr.open=this.state.llmPanelOpen,this.child("pulseanim").style.display=this.attr.open?"none":"",this.child("poweredby").style.display=this.attr.open?"flex":"none",this.attr.open&&!this._previousOpenState)this._uiSessionStartTime=Date.now(),Et(this.ai,{event_type:"ui_open",event_properties:{trigger:"button_click"}});else if(!this.attr.open&&this._previousOpenState){let t=this._uiSessionStartTime?Date.now()-this._uiSessionStartTime:0;Et(this.ai,{event_type:"ui_close",event_properties:{trigger:"button_click",session_duration_ms:t}})}this._previousOpenState=this.attr.open,this.attr.open?this.child("root").classList.add("open"):this.child("root").classList.remove("open"),this.child("root").style.right=this.attr.offsetX?this.attr.offsetX+"px":"20px",this.child("root").style.bottom=this.attr.offsetY?this.attr.offsetY+"px":"20px",this.child("interaction-bar").attr.loading=this.state.loading,this.child("interaction-bar").attr.llmName=this.ai.currentModel?.metadata?.name||this.ai.currentModel?.id||"None",this.child("interaction-bar").attr.llmButtonVisible=this.ai.models.length>1,this.child("llm-selector-panel").state.items=this.ai.models.sort((t,a)=>(a.priority||0)-(t.priority||0)),this.child("llm-selector-panel").state.selectedID=this.ai.currentModel?.id}onDestroy(){Be().embed==this&&(Be().embed=void 0)}onContainerClick(t){this.attr.open||(t.preventDefault(),this.attr.open=!0)}onLogoClick(t){t.preventDefault(),t.stopPropagation(),this.attr.focusID?this.attr.focusID="":this.attr.open=!this.attr.open}open(){this.attr.open=!0}close(){this.attr.open=!1}resetConversation(){let t=this.child("web-weaver-embed-inner");for(this.state.llmPanelOpen=!1;t.children.length>0;)t.children[0].remove();this.ai.resetConversation(),this.suggestions=[];let a=document.createElement("div");a.className="introduction-message",a.innerHTML=Be().introductionMessage||`Welcome to <b>${document.title||"Web Weaver"}</b>. How can I help you?`,t.appendChild(a),this.ai.insertAssistantMessage(a.innerText);for(let n of Be().introductionSuggestions||[]){let i=document.createElement("div");i.className="suggestion-button",i.innerText=n,i.addEventListener("click",s=>this.onSuggestionClick(s,n)),t.appendChild(i)}}async processInput(t){if(this._isProcessing)return;this._isProcessing=!0,this.state.loading=!0,this.state.llmPanelOpen=!1;let a=this.child("web-weaver-embed-inner");this.suggestions=[];try{for(let i of Array.from(a.querySelectorAll(".suggestion-button")))i.remove();this.attr.focusID="";let n=document.createElement("div");n.className="input",n.innerText=t,a.appendChild(n),this.currentOutputElement=document.createElement("div"),this.currentOutputElement.className="output",this.currentOutputElement.style.display="none",this.currentOutputElement.innerHTML="",a.appendChild(this.currentOutputElement),a.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"}),await this.ai.sendMessage(t);for(let i of this.suggestions){let s=document.createElement("div");s.className="suggestion-button",s.innerText=i,s.addEventListener("click",o=>this.onSuggestionClick(o,i)),a.appendChild(s)}a.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}catch(n){Ss.error("Failed to process input:",n);let i=document.createElement("div");i.className="output",i.innerText="Sorry, there was a problem getting a response. "+n.message,a.appendChild(i);let s=document.createElement("div");s.className="suggestion-button",s.innerText="Reset conversation",s.addEventListener("click",o=>this.resetConversation()),a.appendChild(s)}this.state.loading=!1,this._isProcessing=!1}async onAIMessage(t){let a=await up().use(Fl).use(jl).use(gl,{target:"_blank",rel:["noopener","noreferrer"]}).use(yl).use(xl).processSync(t);this.currentOutputElement&&(this.currentOutputElement.style.display="",this.currentOutputElement.innerHTML=a.toString("utf-8"));let n=this.child("web-weaver-embed-inner");for(let i of Array.from(n.querySelectorAll(".tool")))i.remove();n.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onAIToolStart(t,a){let n=`Running: ${t}`;t=="search"&&(n=`Searching: ${a?.query}`),t=="ui.focusElement"&&(n=`Focusing: #${a?.elementID}`),t=="ui.suggestResponse"&&(n=`Suggested response: ${a?.text}`);let i=this.child("web-weaver-embed-inner"),s=document.createElement("div");s.className="tool",s.innerText=n,i.appendChild(s),i.lastElementChild?.scrollIntoView({behavior:"instant",block:"end"})}onSuggestionClick(t,a){this.processInput(a)}onLLMModelSelect(t){t.preventDefault(),this.ai.setModel(t.detail),this.state.llmPanelOpen=!1}};aa.tagName="intelliweave-embed",aa.observedAttributes=["logo","focusID","open","background","textColor"];mr.lib=()=>import("./ort.bundle.min-IUPKB45H.js");document.body.appendChild(aa.create());
|
|
3731
3754
|
/*! Bundled license information:
|
|
3732
3755
|
|
|
3733
3756
|
uri-js/dist/es5/uri.all.js:
|