@kyro-cms/core 0.10.5 → 0.10.7
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/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/{bootstrap-OHGQGMRV.cjs → bootstrap-HIAV5ZFT.cjs} +1 -1
- package/dist/{bootstrap-IVQWSJXZ.js → bootstrap-P7QPQYQP.js} +1 -1
- package/dist/{chunk-VKXQUYYV.js → chunk-CDL7ARXT.js} +1 -1
- package/dist/{chunk-Y7K26TBA.cjs → chunk-CUTFS6N2.cjs} +1 -1
- package/dist/chunk-DGJUBN33.js +1 -0
- package/dist/{chunk-MSSRVZH6.js → chunk-EEWCANFX.js} +1 -1
- package/dist/chunk-F7P36SLX.cjs +74 -0
- package/dist/chunk-FS7GL2BR.js +73 -0
- package/dist/{chunk-6CLRVJPP.cjs → chunk-IFJJ44OQ.cjs} +1 -1
- package/dist/{chunk-F3Z67QWS.cjs → chunk-KIW36TG7.cjs} +4 -4
- package/dist/chunk-LRGAPGG3.js +74 -0
- package/dist/chunk-OQD3WG6Z.cjs +1 -0
- package/dist/chunk-R7DVVXXI.cjs +73 -0
- package/dist/chunk-URCLFIME.js +86 -0
- package/dist/cli/index.cjs +2 -2
- package/dist/cli/index.js +2 -2
- package/dist/client.cjs +1 -1
- package/dist/client.js +1 -1
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.js +1 -1
- package/dist/fields/index.cjs +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/graphql/index.cjs +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/integration.cjs +1 -1
- package/dist/integration.js +1 -1
- package/dist/{media-OUBQTIQP.cjs → media-NSSMOB7N.cjs} +1 -1
- package/dist/{media-L5XDD47D.js → media-RNMCZYPZ.js} +1 -1
- package/dist/{mongo-auth-adapter-YPONSOCY.cjs → mongo-auth-adapter-JYJ4GBZE.cjs} +1 -1
- package/dist/{mongo-auth-adapter-LG5O4LIH.js → mongo-auth-adapter-XI7EPURZ.js} +1 -1
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.js +1 -1
- package/dist/{postgres-auth-adapter-JKDYYULH.cjs → postgres-auth-adapter-E7OGMDD4.cjs} +1 -1
- package/dist/{postgres-auth-adapter-33QOIRXT.js → postgres-auth-adapter-F4KLOGAG.js} +1 -1
- package/dist/{redis-adapter-KECGVSVX.cjs → redis-adapter-AQJVABYT.cjs} +1 -1
- package/dist/{redis-adapter-VAXP43GR.js → redis-adapter-AUKOV74G.js} +1 -1
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/dist/{schema-KFYUM674.js → schema-5XNROI7I.js} +1 -1
- package/dist/{schema-HIUSHSUI.cjs → schema-6O4JTJRU.cjs} +1 -1
- package/dist/{sqlite-adapter-FP45QCYK.js → sqlite-adapter-5XFLNJDH.js} +1 -1
- package/dist/{sqlite-adapter-Z3IBBI4X.cjs → sqlite-adapter-W53Q32N5.cjs} +1 -1
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.cjs +1 -1
- package/dist/trpc/index.js +1 -1
- package/dist/ws/index.cjs +1 -1
- package/dist/ws/index.js +1 -1
- package/package.json +8 -26
- package/dist/chunk-5J6HXUF6.js +0 -1
- package/dist/chunk-AHSFSERC.cjs +0 -1
- package/dist/chunk-CIE3XMLH.cjs +0 -2
- package/dist/chunk-POWTSLKC.js +0 -21
- package/dist/chunk-PWGS2GPI.js +0 -86
- package/dist/chunk-R6UUTH3T.js +0 -2
- package/dist/chunk-TD6RULJU.cjs +0 -21
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-NZ35PV5R.js';import {a as a$2,i}from'./chunk-7N6NKCRT.js';import {q,o,m,c as c$1,p,n,I,b as b$4,a as a$5,E,C as C$1,B as B$1,e as e$3,G,w,d as d$4,x,j as j$1,f as f$4,z as z$1,i as i$1,y,t,u,v,D,A,s as s$1,r,l,h,k,g as g$2}from'./chunk-LRGAPGG3.js';import {f as f$1,s,a as a$4,b as b$3,c as c$4}from'./chunk-URCLFIME.js';import {n as n$1,e as e$1,f as f$2}from'./chunk-UVTS2IWM.js';import {d as d$1,e as e$2,f as f$3,g as g$1}from'./chunk-HLSB2MCK.js';import {b as b$1,d as d$2}from'./chunk-SL3LZQCF.js';import {c as c$2}from'./chunk-CDL7ARXT.js';import {g}from'./chunk-OG7CNQGU.js';import {a as a$3,c as c$3,b as b$2,d as d$3}from'./chunk-ZAQOSRP6.js';import {c,a,d,b,f,e}from'./chunk-DGJUBN33.js';import {z}from'zod';import {createRequire}from'module';import {randomBytes}from'crypto';var is=c((Ex,_a)=>{function Dh(){return Object.keys(globalThis).some(t=>t.startsWith("__NEXT"))}_a.exports=function(){return !!(globalThis.Deno||globalThis.Bun||Dh())};});var Va=c((Tx,Ha)=>{var Cr=Object.defineProperty,Lh=Object.getOwnPropertyDescriptor,Oh=Object.getOwnPropertyNames,Ih=Object.prototype.hasOwnProperty,k=(t,e)=>Cr(t,"name",{value:e,configurable:true}),Fh=(t,e)=>{for(var r in e)Cr(t,r,{get:e[r],enumerable:true});},jh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Oh(e))!Ih.call(t,s)&&s!==r&&Cr(t,s,{get:()=>e[s],enumerable:!(n=Lh(e,s))||n.enumerable});return t},Nh=t=>jh(Cr({},"__esModule",{value:true}),t),Sa={};Fh(Sa,{URLPattern:()=>za});Ha.exports=Nh(Sa);var yt=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,e,r,n,s,i){this.type=t,this.name=e,this.prefix=r,this.value=n,this.suffix=s,this.modifier=i;}hasCustomName(){return this.name!==""&&typeof this.name!="number"}};k(yt,"Part");var qh=/[$_\p{ID_Start}]/u,Uh=/[$_\u200C\u200D\p{ID_Continue}]/u,as=".*";function wa(t,e){return (e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}k(wa,"isASCII");function us(t,e=false){let r=[],n=0;for(;n<t.length;){let s=t[n],i=k(function(o){if(!e)throw new TypeError(o);r.push({type:"INVALID_CHAR",index:n,value:t[n++]});},"ErrorOrInvalid");if(s==="*"){r.push({type:"ASTERISK",index:n,value:t[n++]});continue}if(s==="+"||s==="?"){r.push({type:"OTHER_MODIFIER",index:n,value:t[n++]});continue}if(s==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});continue}if(s==="{"){r.push({type:"OPEN",index:n,value:t[n++]});continue}if(s==="}"){r.push({type:"CLOSE",index:n,value:t[n++]});continue}if(s===":"){let o="",a=n+1;for(;a<t.length;){let c=t.substr(a,1);if(a===n+1&&qh.test(c)||a!==n+1&&Uh.test(c)){o+=t[a++];continue}break}if(!o){i(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:o}),n=a;continue}if(s==="("){let o=1,a="",c=n+1,l=false;if(t[c]==="?"){i(`Pattern cannot start with "?" at ${c}`);continue}for(;c<t.length;){if(!wa(t[c],false)){i(`Invalid character '${t[c]}' at ${c}.`),l=true;break}if(t[c]==="\\"){a+=t[c++]+t[c++];continue}if(t[c]===")"){if(o--,o===0){c++;break}}else if(t[c]==="("&&(o++,t[c+1]!=="?")){i(`Capturing groups are not allowed at ${c}`),l=true;break}a+=t[c++];}if(l)continue;if(o){i(`Unbalanced pattern at ${n}`);continue}if(!a){i(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:a}),n=c;continue}r.push({type:"CHAR",index:n,value:t[n++]});}return r.push({type:"END",index:n,value:""}),r}k(us,"lexer");function fs(t,e={}){let r=us(t);e.delimiter??="/#?",e.prefixes??="./";let n=`[^${he(e.delimiter)}]+?`,s=[],i=0,o=0,c=new Set,l=k(E=>{if(o<r.length&&r[o].type===E)return r[o++].value},"tryConsume"),u=k(()=>l("OTHER_MODIFIER")??l("ASTERISK"),"tryConsumeModifier"),f=k(E=>{let T=l(E);if(T!==void 0)return T;let{type:S,index:w}=r[o];throw new TypeError(`Unexpected ${S} at ${w}, expected ${E}`)},"mustConsume"),d=k(()=>{let E="",T;for(;T=l("CHAR")??l("ESCAPED_CHAR");)E+=T;return E},"consumeText"),h=k(E=>E,"DefaultEncodePart"),m=e.encodePart||h,g="",A=k(E=>{g+=E;},"appendToPendingFixedValue"),x=k(()=>{g.length&&(s.push(new yt(3,"","",m(g),"",3)),g="");},"maybeAddPartFromPendingFixedValue"),L=k((E,T,S,w,R)=>{let p=3;switch(R){case "?":p=1;break;case "*":p=0;break;case "+":p=2;break}if(!T&&!S&&p===3){A(E);return}if(x(),!T&&!S){if(!E)return;s.push(new yt(3,"","",m(E),"",p));return}let b;S?S==="*"?b=as:b=S:b=n;let _=2;b===n?(_=1,b=""):b===as&&(_=0,b="");let P;if(T?P=T:S&&(P=i++),c.has(P))throw new TypeError(`Duplicate name '${P}'.`);c.add(P),s.push(new yt(_,P,m(E),b,m(w),p));},"addPart");for(;o<r.length;){let E=l("CHAR"),T=l("NAME"),S=l("REGEX");if(!T&&!S&&(S=l("ASTERISK")),T||S){let R=E??"";e.prefixes.indexOf(R)===-1&&(A(R),R=""),x();let p=u();L(R,T,S,"",p);continue}let w=E??l("ESCAPED_CHAR");if(w){A(w);continue}if(l("OPEN")){let R=d(),p=l("NAME"),b=l("REGEX");!p&&!b&&(b=l("ASTERISK"));let _=d();f("CLOSE");let P=u();L(R,p,b,_,P);continue}x(),f("END");}return s}k(fs,"parse");function he(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}k(he,"escapeString");function ls(t){return t&&t.ignoreCase?"ui":"u"}k(ls,"flags");function Ea(t,e,r){return hs(fs(t,r),e,r)}k(Ea,"stringToRegexp");function Ke(t){switch(t){case 0:return "*";case 1:return "?";case 2:return "+";case 3:return ""}}k(Ke,"modifierToString");function hs(t,e,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=false,r.strict??=false,r.end??=true,r.start??=true,r.endsWith="";let n=r.start?"^":"";for(let a of t){if(a.type===3){a.modifier===3?n+=he(a.value):n+=`(?:${he(a.value)})${Ke(a.modifier)}`;continue}e&&e.push(a.name);let c=`[^${he(r.delimiter)}]+?`,l=a.value;if(a.type===1?l=c:a.type===0&&(l=as),!a.prefix.length&&!a.suffix.length){a.modifier===3||a.modifier===1?n+=`(${l})${Ke(a.modifier)}`:n+=`((?:${l})${Ke(a.modifier)})`;continue}if(a.modifier===3||a.modifier===1){n+=`(?:${he(a.prefix)}(${l})${he(a.suffix)})`,n+=Ke(a.modifier);continue}n+=`(?:${he(a.prefix)}`,n+=`((?:${l})(?:`,n+=he(a.suffix),n+=he(a.prefix),n+=`(?:${l}))*)${he(a.suffix)})`,a.modifier===0&&(n+="?");}let s=`[${he(r.endsWith)}]|$`,i=`[${he(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${i}?`),r.endsWith.length?n+=`(?=${s})`:n+="$",new RegExp(n,ls(r));r.strict||(n+=`(?:${i}(?=${s}))?`);let o=false;if(t.length){let a=t[t.length-1];a.type===3&&a.modifier===3&&(o=r.delimiter.indexOf(a)>-1);}return o||(n+=`(?=${i}|${s})`),new RegExp(n,ls(r))}k(hs,"partsToRegexp");var $e={delimiter:"",prefixes:"",sensitive:true,strict:true},$h={delimiter:".",prefixes:"",sensitive:true,strict:true},Bh={delimiter:"/",prefixes:"/",sensitive:true,strict:true};function Ta(t,e){return t.length?t[0]==="/"?true:!e||t.length<2?false:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":false}k(Ta,"isAbsolutePathname");function ds(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}k(ds,"maybeStripPrefix");function Pa(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}k(Pa,"maybeStripSuffix");function ps(t){return !t||t.length<2?false:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}k(ps,"treatAsIPv6Hostname");var Ca=["ftp","file","http","https","ws","wss"];function ms(t){if(!t)return true;for(let e of Ca)if(t.test(e))return true;return false}k(ms,"isSpecialScheme");function Aa(t,e){if(t=ds(t,"#"),e||t==="")return t;let r=new URL("https://example.com");return r.hash=t,r.hash?r.hash.substring(1,r.hash.length):""}k(Aa,"canonicalizeHash");function Ra(t,e){if(t=ds(t,"?"),e||t==="")return t;let r=new URL("https://example.com");return r.search=t,r.search?r.search.substring(1,r.search.length):""}k(Ra,"canonicalizeSearch");function va(t,e){return e||t===""?t:ps(t)?gs(t):ys(t)}k(va,"canonicalizeHostname");function ka(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.password=t,r.password}k(ka,"canonicalizePassword");function Da(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.username=t,r.username}k(Da,"canonicalizeUsername");function La(t,e,r){if(r||t==="")return t;if(e&&!Ca.includes(e))return new URL(`${e}:${t}`).pathname;let n=t[0]=="/";return t=new URL(n?t:"/-"+t,"https://example.com").pathname,n||(t=t.substring(2,t.length)),t}k(La,"canonicalizePathname");function Oa(t,e,r){return bs(e)===t&&(t=""),r||t===""?t:xs(t)}k(Oa,"canonicalizePort");function Ia(t,e){return t=Pa(t,":"),e||t===""?t:Ar(t)}k(Ia,"canonicalizeProtocol");function bs(t){switch(t){case "ws":case "http":return "80";case "wws":case "https":return "443";case "ftp":return "21";default:return ""}}k(bs,"defaultPortForProtocol");function Ar(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}k(Ar,"protocolEncodeCallback");function Fa(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}k(Fa,"usernameEncodeCallback");function ja(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}k(ja,"passwordEncodeCallback");function ys(t){if(t==="")return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname}k(ys,"hostnameEncodeCallback");function gs(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}k(gs,"ipv6HostnameEncodeCallback");function xs(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}k(xs,"portEncodeCallback");function Na(t){if(t==="")return t;let e=new URL("https://example.com");return e.pathname=t[0]!=="/"?"/-"+t:t,t[0]!=="/"?e.pathname.substring(2,e.pathname.length):e.pathname}k(Na,"standardURLPathnameEncodeCallback");function qa(t){return t===""?t:new URL(`data:${t}`).pathname}k(qa,"pathURLPathnameEncodeCallback");function Ua(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}k(Ua,"searchEncodeCallback");function $a(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}k($a,"hashEncodeCallback");var Ba=class{#o;#r=[];#n={};#t=0;#p=1;#S=0;#s=0;#y=0;#l=0;#i=false;constructor(t){this.#o=t;}get result(){return this.#n}parse(){for(this.#r=us(this.#o,true);this.#t<this.#r.length;this.#t+=this.#p){if(this.#p=1,this.#r[this.#t].type==="END"){if(this.#s===0){this.#b(),this.#C()?this.#e(9,1):this.#d()?this.#e(8,1):this.#e(7,0);continue}else if(this.#s===2){this.#f(5);continue}this.#e(10,0);break}if(this.#y>0)if(this.#A())this.#y-=1;else continue;if(this.#D()){this.#y+=1;continue}switch(this.#s){case 0:this.#h()&&this.#f(1);break;case 1:if(this.#h()){this.#L();let t=7,e=1;this.#E()?(t=2,e=3):this.#i&&(t=2),this.#e(t,e);}break;case 2:this.#g()?this.#f(3):(this.#P()||this.#d()||this.#C())&&this.#f(5);break;case 3:this.#x()?this.#e(4,1):this.#g()&&this.#e(5,1);break;case 4:this.#g()&&this.#e(5,1);break;case 5:this.#O()?this.#l+=1:this.#_()&&(this.#l-=1),this.#T()&&!this.#l?this.#e(6,1):this.#P()?this.#e(7,0):this.#d()?this.#e(8,1):this.#C()&&this.#e(9,1);break;case 6:this.#P()?this.#e(7,0):this.#d()?this.#e(8,1):this.#C()&&this.#e(9,1);break;case 7:this.#d()?this.#e(8,1):this.#C()&&this.#e(9,1);break;case 8:this.#C()&&this.#e(9,1);break;}}this.#n.hostname!==void 0&&this.#n.port===void 0&&(this.#n.port="");}#e(t,e){switch(this.#s){case 0:break;case 1:this.#n.protocol=this.#w();break;case 2:break;case 3:this.#n.username=this.#w();break;case 4:this.#n.password=this.#w();break;case 5:this.#n.hostname=this.#w();break;case 6:this.#n.port=this.#w();break;case 7:this.#n.pathname=this.#w();break;case 8:this.#n.search=this.#w();break;case 9:this.#n.hash=this.#w();break;}this.#s!==0&&t!==10&&([1,2,3,4].includes(this.#s)&&[6,7,8,9].includes(t)&&(this.#n.hostname??=""),[1,2,3,4,5,6].includes(this.#s)&&[8,9].includes(t)&&(this.#n.pathname??=this.#i?"/":""),[1,2,3,4,5,6,7].includes(this.#s)&&t===9&&(this.#n.search??="")),this.#m(t,e);}#m(t,e){this.#s=t,this.#S=this.#t+e,this.#t+=e,this.#p=0;}#b(){this.#t=this.#S,this.#p=0;}#f(t){this.#b(),this.#s=t;}#u(t){return t<0&&(t=this.#r.length-t),t<this.#r.length?this.#r[t]:this.#r[this.#r.length-1]}#c(t,e){let r=this.#u(t);return r.value===e&&(r.type==="CHAR"||r.type==="ESCAPED_CHAR"||r.type==="INVALID_CHAR")}#h(){return this.#c(this.#t,":")}#E(){return this.#c(this.#t+1,"/")&&this.#c(this.#t+2,"/")}#g(){return this.#c(this.#t,"@")}#x(){return this.#c(this.#t,":")}#T(){return this.#c(this.#t,":")}#P(){return this.#c(this.#t,"/")}#d(){if(this.#c(this.#t,"?"))return true;if(this.#r[this.#t].value!=="?")return false;let t=this.#u(this.#t-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}#C(){return this.#c(this.#t,"#")}#D(){return this.#r[this.#t].type=="OPEN"}#A(){return this.#r[this.#t].type=="CLOSE"}#O(){return this.#c(this.#t,"[")}#_(){return this.#c(this.#t,"]")}#w(){let t=this.#r[this.#t],e=this.#u(this.#S).index;return this.#o.substring(e,t.index)}#L(){let t={};Object.assign(t,$e),t.encodePart=Ar;let e=Ea(this.#w(),void 0,t);this.#i=ms(e);}};k(Ba,"Parser");var os=["protocol","username","password","hostname","port","pathname","search","hash"],Ue="*";function cs(t,e){if(typeof t!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(t,e);return {protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==""?r.search.substring(1,r.search.length):void 0,hash:r.hash!==""?r.hash.substring(1,r.hash.length):void 0}}k(cs,"extractValues");function we(t,e){return e?bt(t):t}k(we,"processBaseURLString");function mt(t,e,r){let n;if(typeof e.baseURL=="string")try{n=new URL(e.baseURL),e.protocol===void 0&&(t.protocol=we(n.protocol.substring(0,n.protocol.length-1),r)),!r&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&(t.username=we(n.username,r)),!r&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&e.password===void 0&&(t.password=we(n.password,r)),e.protocol===void 0&&e.hostname===void 0&&(t.hostname=we(n.hostname,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&(t.port=we(n.port,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&(t.pathname=we(n.pathname,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&(t.search=we(n.search.substring(1,n.search.length),r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&e.hash===void 0&&(t.hash=we(n.hash.substring(1,n.hash.length),r));}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=Ia(e.protocol,r)),typeof e.username=="string"&&(t.username=Da(e.username,r)),typeof e.password=="string"&&(t.password=ka(e.password,r)),typeof e.hostname=="string"&&(t.hostname=va(e.hostname,r)),typeof e.port=="string"&&(t.port=Oa(e.port,t.protocol,r)),typeof e.pathname=="string"){if(t.pathname=e.pathname,n&&!Ta(t.pathname,r)){let s=n.pathname.lastIndexOf("/");s>=0&&(t.pathname=we(n.pathname.substring(0,s+1),r)+t.pathname);}t.pathname=La(t.pathname,t.protocol,r);}return typeof e.search=="string"&&(t.search=Ra(e.search,r)),typeof e.hash=="string"&&(t.hash=Aa(e.hash,r)),t}k(mt,"applyInit");function bt(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}k(bt,"escapePatternString");function Ma(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}k(Ma,"escapeRegexpString");function Ga(t,e){e.delimiter??="/#?",e.prefixes??="./",e.sensitive??=false,e.strict??=false,e.end??=true,e.start??=true,e.endsWith="";let r=".*",n=`[^${Ma(e.delimiter)}]+?`,s=/[$_\u200C\u200D\p{ID_Continue}]/u,i="";for(let o=0;o<t.length;++o){let a=t[o];if(a.type===3){if(a.modifier===3){i+=bt(a.value);continue}i+=`{${bt(a.value)}}${Ke(a.modifier)}`;continue}let c=a.hasCustomName(),l=!!a.suffix.length||!!a.prefix.length&&(a.prefix.length!==1||!e.prefixes.includes(a.prefix)),u=o>0?t[o-1]:null,f=o<t.length-1?t[o+1]:null;if(!l&&c&&a.type===1&&a.modifier===3&&f&&!f.prefix.length&&!f.suffix.length)if(f.type===3){let d=f.value.length>0?f.value[0]:"";l=s.test(d);}else l=!f.hasCustomName();if(!l&&!a.prefix.length&&u&&u.type===3){let d=u.value[u.value.length-1];l=e.prefixes.includes(d);}l&&(i+="{"),i+=bt(a.prefix),c&&(i+=`:${a.name}`),a.type===2?i+=`(${a.value})`:a.type===1?c||(i+=`(${n})`):a.type===0&&(!c&&(!u||u.type===3||u.modifier!==3||l||a.prefix!=="")?i+="*":i+=`(${r})`),a.type===1&&c&&a.suffix.length&&s.test(a.suffix[0])&&(i+="\\"),i+=bt(a.suffix),l&&(i+="}"),a.modifier!==3&&(i+=Ke(a.modifier));}return i}k(Ga,"partsToPattern");var za=class{#o;#r={};#n={};#t={};#p={};#S=false;constructor(t={},e,r){try{let n;if(typeof e=="string"?n=e:r=e,typeof t=="string"){let a=new Ba(t);if(a.parse(),t=a.result,n===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=n;}else {if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(n)throw new TypeError("parameter 1 is not of type 'string'.")}typeof r>"u"&&(r={ignoreCase:!1});let s={ignoreCase:r.ignoreCase===!0},i={pathname:Ue,protocol:Ue,username:Ue,password:Ue,hostname:Ue,port:Ue,search:Ue,hash:Ue};this.#o=mt(i,t,!0),bs(this.#o.protocol)===this.#o.port&&(this.#o.port="");let o;for(o of os){if(!(o in this.#o))continue;let a={},c=this.#o[o];switch(this.#n[o]=[],o){case "protocol":Object.assign(a,$e),a.encodePart=Ar;break;case "username":Object.assign(a,$e),a.encodePart=Fa;break;case "password":Object.assign(a,$e),a.encodePart=ja;break;case "hostname":Object.assign(a,$h),ps(c)?a.encodePart=gs:a.encodePart=ys;break;case "port":Object.assign(a,$e),a.encodePart=xs;break;case "pathname":ms(this.#r.protocol)?(Object.assign(a,Bh,s),a.encodePart=Na):(Object.assign(a,$e,s),a.encodePart=qa);break;case "search":Object.assign(a,$e,s),a.encodePart=Ua;break;case "hash":Object.assign(a,$e,s),a.encodePart=$a;break}try{this.#p[o]=fs(c,a),this.#r[o]=hs(this.#p[o],this.#n[o],a),this.#t[o]=Ga(this.#p[o],a),this.#S=this.#S||this.#p[o].some(l=>l.type===2);}catch{throw new TypeError(`invalid ${o} pattern '${this.#o[o]}'.`)}}}catch(n){throw new TypeError(`Failed to construct 'URLPattern': ${n.message}`)}}get[Symbol.toStringTag](){return "URLPattern"}test(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return false;try{typeof t=="object"?r=mt(r,t,!1):r=mt(r,cs(t,e),!1);}catch{return false}let n;for(n of os)if(!this.#r[n].exec(r[n]))return false;return true}exec(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?r=mt(r,t,!1):r=mt(r,cs(t,e),!1);}catch{return null}let n={};e?n.inputs=[t,e]:n.inputs=[t];let s;for(s of os){let i=this.#r[s].exec(r[s]);if(!i)return null;let o={};for(let[a,c]of this.#n[s].entries())if(typeof c=="string"||typeof c=="number"){let l=i[a+1];o[c]=l;}n[s]={input:r[s]??"",groups:o};}return n}static compareComponent(t,e,r){let n=k((a,c)=>{for(let l of ["type","modifier","prefix","value","suffix"]){if(a[l]<c[l])return -1;if(a[l]!==c[l])return 1}return 0},"comparePart"),s=new yt(3,"","","","",3),i=new yt(0,"","","","",3),o=k((a,c)=>{let l=0;for(;l<Math.min(a.length,c.length);++l){let u=n(a[l],c[l]);if(u)return u}return a.length===c.length?0:n(a[l]??s,c[l]??s)},"comparePartList");return !e.#t[t]&&!r.#t[t]?0:e.#t[t]&&!r.#t[t]?o(e.#p[t],[i]):!e.#t[t]&&r.#t[t]?o([i],r.#p[t]):o(e.#p[t],r.#p[t])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#S}};k(za,"URLPattern");});var Za=c((Rx,Qa)=>{var{URLPattern:Wa}=Va();Qa.exports={URLPattern:Wa};globalThis.URLPattern||(globalThis.URLPattern=Wa);});var Me=c(ue=>{Object.defineProperty(ue,"__esModule",{value:true});ue.isPromise=Rr;ue.isActualPromise=Ja;ue.handleMaybePromise=Be;ue.fakePromise=Ee;ue.createDeferredPromise=Mh;ue.iterateAsync=Xa;ue.iterateAsyncVoid=Xa;ue.fakeRejectPromise=Je;ue.mapMaybePromise=Gh;ue.mapAsyncIterator=zh;ue.promiseLikeFinally=Ya;ue.unfakePromise=el;var vr=Symbol.for("@whatwg-node/promise-helpers/FakePromise");function Rr(t){return t?.then!=null}function Ja(t){let e=t;return e&&e.then&&e.catch&&e.finally}function Be(t,e,r,n){let s=Ee().then(t).then(e,r);return n&&(s=s.finally(n)),el(s)}function Ee(t){return t&&Ja(t)?t:Rr(t)?{then:(e,r)=>Ee(t.then(e,r)),catch:e=>Ee(t.then(r=>r,e)),finally:e=>Ee(e?Ya(t,e):t),[Symbol.toStringTag]:"Promise"}:{then(e){if(e)try{return Ee(e(t))}catch(r){return Je(r)}return this},catch(){return this},finally(e){if(e)try{return Ee(e()).then(()=>t,()=>t)}catch(r){return Je(r)}return this},[Symbol.toStringTag]:"Promise",__fakePromiseValue:t,[vr]:"resolved"}}function Mh(){if(Promise.withResolvers)return Promise.withResolvers();let t,e;return {promise:new Promise(function(s,i){t=s,e=i;}),get resolve(){return t},get reject(){return e}}}function Xa(t,e,r){if(t?.length===0)return;let n=t[Symbol.iterator](),s=0;function i(){let{done:o,value:a}=n.next();if(o)return;let c=false;function l(){c=true;}return Be(function(){return e(a,l,s++)},function(f){if(f&&r?.push(f),!c)return i()})}return i()}function Je(t){return {then(e,r){if(r)try{return Ee(r(t))}catch(n){return Je(n)}return this},catch(e){if(e)try{return Ee(e(t))}catch(r){return Je(r)}return this},finally(e){if(e)try{e();}catch(r){return Je(r)}return this},__fakeRejectError:t,[Symbol.toStringTag]:"Promise",[vr]:"rejected"}}function Gh(t,e,r){return Be(()=>t,e,r)}function zh(t,e,r,n){Symbol.asyncIterator in t&&(t=t[Symbol.asyncIterator]());let s,i,o;if(n){let l;o=u=>(l||=Be(n,()=>u,()=>u),l);}typeof t.return=="function"&&(s=t.return,i=l=>{let u=()=>{throw l};return s.call(t).then(u,u)});function a(l){return l.done?o?o(l):l:Be(()=>l.value,u=>Be(()=>e(u),Ka,i))}let c;if(r){let l,u=r;c=f=>(l||=Be(()=>f,d=>Be(()=>u(d),Ka,i)),l);}return {next(){return t.next().then(a,c)},return(){let l=s?s.call(t).then(a,c):Ee({value:void 0,done:true});return o?l.then(o):l},throw(l){return typeof t.throw=="function"?t.throw(l).then(a,c):i?i(l):Je(l)},[Symbol.asyncIterator](){return this}}}function Ka(t){return {value:t,done:false}}function Hh(t){return t?.[vr]==="resolved"}function Vh(t){return t?.[vr]==="rejected"}function Ya(t,e){return "finally"in t?t.finally(e):t.then(r=>{let n=e();return Rr(n)?n.then(()=>r):r},r=>{let n=e();if(Rr(n))return n.then(()=>{throw r});throw r})}function el(t){if(Hh(t))return t.__fakePromiseValue;if(Vh(t))throw t.__fakeRejectError;return t}});var _s=c((kx,tl)=>{var{EventEmitter:Wh}=a("events"),{inherits:Qh}=a("util");function Xe(t){if(typeof t=="string"&&(t=Buffer.from(t)),!Buffer.isBuffer(t))throw new TypeError("The needle has to be a String or a Buffer.");let e=t.length,r=e-1;if(e===0)throw new Error("The needle cannot be an empty String/Buffer.");if(e>256)throw new Error("The needle cannot have a length bigger than 256.");this.maxMatches=1/0,this.matches=0,this._occ=new Uint8Array(256).fill(e),this._lookbehind_size=0,this._needle=t,this._bufpos=0,this._lookbehind=Buffer.alloc(r);for(var n=0;n<r;++n)this._occ[t[n]]=r-n;}Qh(Xe,Wh);Xe.prototype.reset=function(){this._lookbehind_size=0,this.matches=0,this._bufpos=0;};Xe.prototype.push=function(t,e){Buffer.isBuffer(t)||(t=Buffer.from(t,"binary"));let r=t.length;this._bufpos=e||0;let n;for(;n!==r&&this.matches<this.maxMatches;)n=this._sbmh_feed(t);return n};Xe.prototype._sbmh_feed=function(t){let e=t.length,r=this._needle,n=r.length,s=n-1,i=r[s],o=-this._lookbehind_size,a;if(o<0){for(;o<0&&o<=e-n;){if(a=t[o+s],a===i&&this._sbmh_memcmp(t,o,s))return this._lookbehind_size=0,++this.matches,this.emit("info",true),this._bufpos=o+n;o+=this._occ[a];}for(;o<0&&!this._sbmh_memcmp(t,o,e-o);)++o;if(o>=0)this.emit("info",false,this._lookbehind,0,this._lookbehind_size),this._lookbehind_size=0;else {let c=this._lookbehind_size+o;return c>0&&this.emit("info",false,this._lookbehind,0,c),this._lookbehind_size-=c,this._lookbehind.copy(this._lookbehind,0,c,this._lookbehind_size),t.copy(this._lookbehind,this._lookbehind_size),this._lookbehind_size+=e,this._bufpos=e,e}}if(o=t.indexOf(r,o+this._bufpos),o!==-1)return ++this.matches,o===0?this.emit("info",true):this.emit("info",true,t,this._bufpos,o),this._bufpos=o+n;for(o=e-s,o<0&&(o=0);o!==e&&(t[o]!==r[0]||Buffer.compare(t.subarray(o+1,e),r.subarray(1,e-o))!==0);)++o;return o!==e&&(t.copy(this._lookbehind,0,o,e),this._lookbehind_size=e-o),o!==0&&this.emit("info",false,t,this._bufpos,o),this._bufpos=e,e};Xe.prototype._sbmh_lookup_char=function(t,e){return e<0?this._lookbehind[this._lookbehind_size+e]:t[e]};Xe.prototype._sbmh_memcmp=function(t,e,r){for(var n=0;n<r;++n)if(this._sbmh_lookup_char(t,e+n)!==this._needle[n])return false;return true};tl.exports=Xe;});var sl=c((Dx,nl)=>{var Zh=a("util").inherits,rl=a("stream").Readable;function Ss(t){rl.call(this,t);}Zh(Ss,rl);Ss.prototype._read=function(t){};nl.exports=Ss;});var kr=c((Lx,il)=>{il.exports=function(e,r,n){if(!e||e[r]===void 0||e[r]===null)return n;if(typeof e[r]!="number"||isNaN(e[r]))throw new TypeError("Limit "+r+" is not a valid number");return e[r]};});var cl=c((Ox,ll)=>{var al=a("events").EventEmitter,Kh=a("util").inherits,ol=kr(),Jh=_s(),Xh=Buffer.from(`\r
|
|
2
|
+
\r
|
|
3
|
+
`),Yh=/\r\n/g,ed=/^([^:]+):[ \t]?([\x00-\xFF]+)?$/;function gt(t){al.call(this),t=t||{};let e=this;this.nread=0,this.maxed=false,this.npairs=0,this.maxHeaderPairs=ol(t,"maxHeaderPairs",2e3),this.maxHeaderSize=ol(t,"maxHeaderSize",80*1024),this.buffer="",this.header={},this.finished=false,this.ss=new Jh(Xh),this.ss.on("info",function(r,n,s,i){n&&!e.maxed&&(e.nread+i-s>=e.maxHeaderSize?(i=e.maxHeaderSize-e.nread+s,e.nread=e.maxHeaderSize,e.maxed=true):e.nread+=i-s,e.buffer+=n.toString("binary",s,i)),r&&e._finish();});}Kh(gt,al);gt.prototype.push=function(t){let e=this.ss.push(t);if(this.finished)return e};gt.prototype.reset=function(){this.finished=false,this.buffer="",this.header={},this.ss.reset();};gt.prototype._finish=function(){this.buffer&&this._parseHeader(),this.ss.matches=this.ss.maxMatches;let t=this.header;this.header={},this.buffer="",this.finished=true,this.nread=this.npairs=0,this.maxed=false,this.emit("header",t);};gt.prototype._parseHeader=function(){if(this.npairs===this.maxHeaderPairs)return;let t=this.buffer.split(Yh),e=t.length,r,n;for(var s=0;s<e;++s){if(t[s].length===0)continue;if((t[s][0]===" "||t[s][0]===" ")&&n){this.header[n][this.header[n].length-1]+=t[s];continue}let i=t[s].indexOf(":");if(i===-1||i===0)return;if(r=ed.exec(t[s]),n=r[1].toLowerCase(),this.header[n]=this.header[n]||[],this.header[n].push(r[2]||""),++this.npairs===this.maxHeaderPairs)break}};ll.exports=gt;});var Es=c((Ix,fl)=>{var ws=a("stream").Writable,td=a("util").inherits,rd=_s(),ul=sl(),nd=cl(),sd=45,id=Buffer.from("-"),od=Buffer.from(`\r
|
|
4
|
+
`),ad=function(){};function ye(t){if(!(this instanceof ye))return new ye(t);if(ws.call(this,t),!t||!t.headerFirst&&typeof t.boundary!="string")throw new TypeError("Boundary required");typeof t.boundary=="string"?this.setBoundary(t.boundary):this._bparser=void 0,this._headerFirst=t.headerFirst,this._dashes=0,this._parts=0,this._finished=false,this._realFinish=false,this._isPreamble=true,this._justMatched=false,this._firstWrite=true,this._inHeader=true,this._part=void 0,this._cb=void 0,this._ignoreData=false,this._partOpts={highWaterMark:t.partHwm},this._pause=false;let e=this;this._hparser=new nd(t),this._hparser.on("header",function(r){e._inHeader=false,e._part.emit("header",r);});}td(ye,ws);ye.prototype.emit=function(t){if(t==="finish"&&!this._realFinish){if(!this._finished){let e=this;process.nextTick(function(){if(e.emit("error",new Error("Unexpected end of multipart data")),e._part&&!e._ignoreData){let r=e._isPreamble?"Preamble":"Part";e._part.emit("error",new Error(r+" terminated early due to unexpected end of multipart data")),e._part.push(null),process.nextTick(function(){e._realFinish=true,e.emit("finish"),e._realFinish=false;});return}e._realFinish=true,e.emit("finish"),e._realFinish=false;});}}else ws.prototype.emit.apply(this,arguments);};ye.prototype._write=function(t,e,r){if(!this._hparser&&!this._bparser)return r();if(this._headerFirst&&this._isPreamble){this._part||(this._part=new ul(this._partOpts),this.listenerCount("preamble")!==0?this.emit("preamble",this._part):this._ignore());let n=this._hparser.push(t);if(!this._inHeader&&n!==void 0&&n<t.length)t=t.slice(n);else return r()}this._firstWrite&&(this._bparser.push(od),this._firstWrite=false),this._bparser.push(t),this._pause?this._cb=r:r();};ye.prototype.reset=function(){this._part=void 0,this._bparser=void 0,this._hparser=void 0;};ye.prototype.setBoundary=function(t){let e=this;this._bparser=new rd(`\r
|
|
5
|
+
--`+t),this._bparser.on("info",function(r,n,s,i){e._oninfo(r,n,s,i);});};ye.prototype._ignore=function(){this._part&&!this._ignoreData&&(this._ignoreData=true,this._part.on("error",ad),this._part.resume());};ye.prototype._oninfo=function(t,e,r,n){let s,i=this,o=0,a,c=true;if(!this._part&&this._justMatched&&e){for(;this._dashes<2&&r+o<n;)if(e[r+o]===sd)++o,++this._dashes;else {this._dashes&&(s=id),this._dashes=0;break}if(this._dashes===2&&(r+o<n&&this.listenerCount("trailer")!==0&&this.emit("trailer",e.slice(r+o,n)),this.reset(),this._finished=true,i._parts===0&&(i._realFinish=true,i.emit("finish"),i._realFinish=false)),this._dashes)return}this._justMatched&&(this._justMatched=false),this._part||(this._part=new ul(this._partOpts),this._part._read=function(l){i._unpause();},this._isPreamble&&this.listenerCount("preamble")!==0?this.emit("preamble",this._part):this._isPreamble!==true&&this.listenerCount("part")!==0?this.emit("part",this._part):this._ignore(),this._isPreamble||(this._inHeader=true)),e&&r<n&&!this._ignoreData&&(this._isPreamble||!this._inHeader?(s&&(c=this._part.push(s)),c=this._part.push(e.slice(r,n)),c||(this._pause=true)):!this._isPreamble&&this._inHeader&&(s&&this._hparser.push(s),a=this._hparser.push(e.slice(r,n)),!this._inHeader&&a!==void 0&&a<n&&this._oninfo(false,e,r+a,n))),t&&(this._hparser.reset(),this._isPreamble?this._isPreamble=false:r!==n&&(++this._parts,this._part.on("end",function(){--i._parts===0&&(i._finished?(i._realFinish=true,i.emit("finish"),i._realFinish=false):i._unpause());})),this._part.push(null),this._part=void 0,this._ignoreData=false,this._justMatched=true,this._dashes=0);};ye.prototype._unpause=function(){if(this._pause&&(this._pause=false,this._cb)){let t=this._cb;this._cb=void 0,t();}};fl.exports=ye;});var Dr=c((Ts,pl)=>{var hl=new TextDecoder("utf-8"),dl=new Map([["utf-8",hl],["utf8",hl]]);function ld(t){let e;for(;;)switch(t){case "utf-8":case "utf8":return Nt.utf8;case "latin1":case "ascii":case "us-ascii":case "iso-8859-1":case "iso8859-1":case "iso88591":case "iso_8859-1":case "windows-1252":case "iso_8859-1:1987":case "cp1252":case "x-cp1252":return Nt.latin1;case "utf16le":case "utf-16le":case "ucs2":case "ucs-2":return Nt.utf16le;case "base64":return Nt.base64;default:if(e===void 0){e=true,t=t.toLowerCase();continue}return Nt.other.bind(t)}}var Nt={utf8:(t,e)=>t.length===0?"":(typeof t=="string"&&(t=Buffer.from(t,e)),t.utf8Slice(0,t.length)),latin1:(t,e)=>t.length===0?"":typeof t=="string"?t:t.latin1Slice(0,t.length),utf16le:(t,e)=>t.length===0?"":(typeof t=="string"&&(t=Buffer.from(t,e)),t.ucs2Slice(0,t.length)),base64:(t,e)=>t.length===0?"":(typeof t=="string"&&(t=Buffer.from(t,e)),t.base64Slice(0,t.length)),other:(t,e)=>{if(t.length===0)return "";if(typeof t=="string"&&(t=Buffer.from(t,e)),dl.has(Ts.toString()))try{return dl.get(Ts).decode(t)}catch{}return typeof t=="string"?t:t.toString()}};function cd(t,e,r){return t&&ld(r)(t,e)}pl.exports=cd;});var Cs=c((Fx,xl)=>{var Lr=Dr(),ml=/%[a-fA-F0-9][a-fA-F0-9]/g,ud={"%00":"\0","%01":"","%02":"","%03":"","%04":"","%05":"","%06":"","%07":"\x07","%08":"\b","%09":" ","%0a":`
|
|
6
|
+
`,"%0A":`
|
|
7
|
+
`,"%0b":"\v","%0B":"\v","%0c":"\f","%0C":"\f","%0d":"\r","%0D":"\r","%0e":"","%0E":"","%0f":"","%0F":"","%10":"","%11":"","%12":"","%13":"","%14":"","%15":"","%16":"","%17":"","%18":"","%19":"","%1a":"","%1A":"","%1b":"\x1B","%1B":"\x1B","%1c":"","%1C":"","%1d":"","%1D":"","%1e":"","%1E":"","%1f":"","%1F":"","%20":" ","%21":"!","%22":'"',"%23":"#","%24":"$","%25":"%","%26":"&","%27":"'","%28":"(","%29":")","%2a":"*","%2A":"*","%2b":"+","%2B":"+","%2c":",","%2C":",","%2d":"-","%2D":"-","%2e":".","%2E":".","%2f":"/","%2F":"/","%30":"0","%31":"1","%32":"2","%33":"3","%34":"4","%35":"5","%36":"6","%37":"7","%38":"8","%39":"9","%3a":":","%3A":":","%3b":";","%3B":";","%3c":"<","%3C":"<","%3d":"=","%3D":"=","%3e":">","%3E":">","%3f":"?","%3F":"?","%40":"@","%41":"A","%42":"B","%43":"C","%44":"D","%45":"E","%46":"F","%47":"G","%48":"H","%49":"I","%4a":"J","%4A":"J","%4b":"K","%4B":"K","%4c":"L","%4C":"L","%4d":"M","%4D":"M","%4e":"N","%4E":"N","%4f":"O","%4F":"O","%50":"P","%51":"Q","%52":"R","%53":"S","%54":"T","%55":"U","%56":"V","%57":"W","%58":"X","%59":"Y","%5a":"Z","%5A":"Z","%5b":"[","%5B":"[","%5c":"\\","%5C":"\\","%5d":"]","%5D":"]","%5e":"^","%5E":"^","%5f":"_","%5F":"_","%60":"`","%61":"a","%62":"b","%63":"c","%64":"d","%65":"e","%66":"f","%67":"g","%68":"h","%69":"i","%6a":"j","%6A":"j","%6b":"k","%6B":"k","%6c":"l","%6C":"l","%6d":"m","%6D":"m","%6e":"n","%6E":"n","%6f":"o","%6F":"o","%70":"p","%71":"q","%72":"r","%73":"s","%74":"t","%75":"u","%76":"v","%77":"w","%78":"x","%79":"y","%7a":"z","%7A":"z","%7b":"{","%7B":"{","%7c":"|","%7C":"|","%7d":"}","%7D":"}","%7e":"~","%7E":"~","%7f":"\x7F","%7F":"\x7F","%80":"\x80","%81":"\x81","%82":"\x82","%83":"\x83","%84":"\x84","%85":"\x85","%86":"\x86","%87":"\x87","%88":"\x88","%89":"\x89","%8a":"\x8A","%8A":"\x8A","%8b":"\x8B","%8B":"\x8B","%8c":"\x8C","%8C":"\x8C","%8d":"\x8D","%8D":"\x8D","%8e":"\x8E","%8E":"\x8E","%8f":"\x8F","%8F":"\x8F","%90":"\x90","%91":"\x91","%92":"\x92","%93":"\x93","%94":"\x94","%95":"\x95","%96":"\x96","%97":"\x97","%98":"\x98","%99":"\x99","%9a":"\x9A","%9A":"\x9A","%9b":"\x9B","%9B":"\x9B","%9c":"\x9C","%9C":"\x9C","%9d":"\x9D","%9D":"\x9D","%9e":"\x9E","%9E":"\x9E","%9f":"\x9F","%9F":"\x9F","%a0":"\xA0","%A0":"\xA0","%a1":"\xA1","%A1":"\xA1","%a2":"\xA2","%A2":"\xA2","%a3":"\xA3","%A3":"\xA3","%a4":"\xA4","%A4":"\xA4","%a5":"\xA5","%A5":"\xA5","%a6":"\xA6","%A6":"\xA6","%a7":"\xA7","%A7":"\xA7","%a8":"\xA8","%A8":"\xA8","%a9":"\xA9","%A9":"\xA9","%aa":"\xAA","%Aa":"\xAA","%aA":"\xAA","%AA":"\xAA","%ab":"\xAB","%Ab":"\xAB","%aB":"\xAB","%AB":"\xAB","%ac":"\xAC","%Ac":"\xAC","%aC":"\xAC","%AC":"\xAC","%ad":"\xAD","%Ad":"\xAD","%aD":"\xAD","%AD":"\xAD","%ae":"\xAE","%Ae":"\xAE","%aE":"\xAE","%AE":"\xAE","%af":"\xAF","%Af":"\xAF","%aF":"\xAF","%AF":"\xAF","%b0":"\xB0","%B0":"\xB0","%b1":"\xB1","%B1":"\xB1","%b2":"\xB2","%B2":"\xB2","%b3":"\xB3","%B3":"\xB3","%b4":"\xB4","%B4":"\xB4","%b5":"\xB5","%B5":"\xB5","%b6":"\xB6","%B6":"\xB6","%b7":"\xB7","%B7":"\xB7","%b8":"\xB8","%B8":"\xB8","%b9":"\xB9","%B9":"\xB9","%ba":"\xBA","%Ba":"\xBA","%bA":"\xBA","%BA":"\xBA","%bb":"\xBB","%Bb":"\xBB","%bB":"\xBB","%BB":"\xBB","%bc":"\xBC","%Bc":"\xBC","%bC":"\xBC","%BC":"\xBC","%bd":"\xBD","%Bd":"\xBD","%bD":"\xBD","%BD":"\xBD","%be":"\xBE","%Be":"\xBE","%bE":"\xBE","%BE":"\xBE","%bf":"\xBF","%Bf":"\xBF","%bF":"\xBF","%BF":"\xBF","%c0":"\xC0","%C0":"\xC0","%c1":"\xC1","%C1":"\xC1","%c2":"\xC2","%C2":"\xC2","%c3":"\xC3","%C3":"\xC3","%c4":"\xC4","%C4":"\xC4","%c5":"\xC5","%C5":"\xC5","%c6":"\xC6","%C6":"\xC6","%c7":"\xC7","%C7":"\xC7","%c8":"\xC8","%C8":"\xC8","%c9":"\xC9","%C9":"\xC9","%ca":"\xCA","%Ca":"\xCA","%cA":"\xCA","%CA":"\xCA","%cb":"\xCB","%Cb":"\xCB","%cB":"\xCB","%CB":"\xCB","%cc":"\xCC","%Cc":"\xCC","%cC":"\xCC","%CC":"\xCC","%cd":"\xCD","%Cd":"\xCD","%cD":"\xCD","%CD":"\xCD","%ce":"\xCE","%Ce":"\xCE","%cE":"\xCE","%CE":"\xCE","%cf":"\xCF","%Cf":"\xCF","%cF":"\xCF","%CF":"\xCF","%d0":"\xD0","%D0":"\xD0","%d1":"\xD1","%D1":"\xD1","%d2":"\xD2","%D2":"\xD2","%d3":"\xD3","%D3":"\xD3","%d4":"\xD4","%D4":"\xD4","%d5":"\xD5","%D5":"\xD5","%d6":"\xD6","%D6":"\xD6","%d7":"\xD7","%D7":"\xD7","%d8":"\xD8","%D8":"\xD8","%d9":"\xD9","%D9":"\xD9","%da":"\xDA","%Da":"\xDA","%dA":"\xDA","%DA":"\xDA","%db":"\xDB","%Db":"\xDB","%dB":"\xDB","%DB":"\xDB","%dc":"\xDC","%Dc":"\xDC","%dC":"\xDC","%DC":"\xDC","%dd":"\xDD","%Dd":"\xDD","%dD":"\xDD","%DD":"\xDD","%de":"\xDE","%De":"\xDE","%dE":"\xDE","%DE":"\xDE","%df":"\xDF","%Df":"\xDF","%dF":"\xDF","%DF":"\xDF","%e0":"\xE0","%E0":"\xE0","%e1":"\xE1","%E1":"\xE1","%e2":"\xE2","%E2":"\xE2","%e3":"\xE3","%E3":"\xE3","%e4":"\xE4","%E4":"\xE4","%e5":"\xE5","%E5":"\xE5","%e6":"\xE6","%E6":"\xE6","%e7":"\xE7","%E7":"\xE7","%e8":"\xE8","%E8":"\xE8","%e9":"\xE9","%E9":"\xE9","%ea":"\xEA","%Ea":"\xEA","%eA":"\xEA","%EA":"\xEA","%eb":"\xEB","%Eb":"\xEB","%eB":"\xEB","%EB":"\xEB","%ec":"\xEC","%Ec":"\xEC","%eC":"\xEC","%EC":"\xEC","%ed":"\xED","%Ed":"\xED","%eD":"\xED","%ED":"\xED","%ee":"\xEE","%Ee":"\xEE","%eE":"\xEE","%EE":"\xEE","%ef":"\xEF","%Ef":"\xEF","%eF":"\xEF","%EF":"\xEF","%f0":"\xF0","%F0":"\xF0","%f1":"\xF1","%F1":"\xF1","%f2":"\xF2","%F2":"\xF2","%f3":"\xF3","%F3":"\xF3","%f4":"\xF4","%F4":"\xF4","%f5":"\xF5","%F5":"\xF5","%f6":"\xF6","%F6":"\xF6","%f7":"\xF7","%F7":"\xF7","%f8":"\xF8","%F8":"\xF8","%f9":"\xF9","%F9":"\xF9","%fa":"\xFA","%Fa":"\xFA","%fA":"\xFA","%FA":"\xFA","%fb":"\xFB","%Fb":"\xFB","%fB":"\xFB","%FB":"\xFB","%fc":"\xFC","%Fc":"\xFC","%fC":"\xFC","%FC":"\xFC","%fd":"\xFD","%Fd":"\xFD","%fD":"\xFD","%FD":"\xFD","%fe":"\xFE","%Fe":"\xFE","%fE":"\xFE","%FE":"\xFE","%ff":"\xFF","%Ff":"\xFF","%fF":"\xFF","%FF":"\xFF"};function bl(t){return ud[t]}var Or=0,yl=1,Ps=2,gl=3;function fd(t){let e=[],r=Or,n="",s=false,i=false,o=0,a="",c=t.length;for(var l=0;l<c;++l){let u=t[l];if(u==="\\"&&s)if(i)i=false;else {i=true;continue}else if(u==='"')if(i)i=false;else {if(s)for(s=false,r=Or;l+1<c&&t[l+1]!==";";)++l;else s=true;continue}else if(i&&s&&(a+="\\"),i=false,(r===Ps||r===gl)&&u==="'"){r===Ps?(r=gl,n=a.substring(1)):r=yl,a="";continue}else if(r===Or&&(u==="*"||u==="=")&&e.length){r=u==="*"?Ps:yl,e[o]=[a,void 0],a="";continue}else if(!s&&u===";"){r=Or,n?(a.length&&(a=Lr(a.replace(ml,bl),"binary",n)),n=""):a.length&&(a=Lr(a,"binary","utf8")),e[o]===void 0?e[o]=a:e[o][1]=a,a="",++o;continue}else if(!s&&(u===" "||u===" "))continue;a+=u;}return n&&a.length?a=Lr(a.replace(ml,bl),"binary",n):a&&(a=Lr(a,"binary","utf8")),e[o]===void 0?a&&(e[o]=a):e[o][1]=a,e}xl.exports=fd;});var Sl=c((jx,_l)=>{_l.exports=function(e){if(typeof e!="string")return "";for(var r=e.length-1;r>=0;--r)switch(e.charCodeAt(r)){case 47:case 92:return e=e.slice(r+1),e===".."||e==="."?"":e}return e===".."||e==="."?"":e};});var Pl=c((Nx,Tl)=>{var{Readable:El}=a("stream"),{inherits:hd}=a("util"),dd=Es(),wl=Cs(),pd=Dr(),md=Sl(),Ye=kr(),bd=/^boundary$/i,yd=/^form-data$/i,gd=/^charset$/i,xd=/^filename$/i,_d=/^name$/i;Ir.detect=/^multipart\/form-data/i;function Ir(t,e){let r,n,s=this,i,o=e.limits,a=e.isPartAFile||((P,v,O)=>v==="application/octet-stream"||O!==void 0),c=e.parsedConType||[],l=e.defCharset||"utf8",u=e.preservePath,f={highWaterMark:e.fileHwm};for(r=0,n=c.length;r<n;++r)if(Array.isArray(c[r])&&bd.test(c[r][0])){i=c[r][1];break}function d(){w===0&&b&&!t._done&&(b=false,s.end());}if(typeof i!="string")throw new Error("Multipart: Boundary not found");let h=Ye(o,"fieldSize",1*1024*1024),m=Ye(o,"fileSize",1/0),g=Ye(o,"files",1/0),A=Ye(o,"fields",1/0),x=Ye(o,"parts",1/0),L=Ye(o,"headerPairs",2e3),E=Ye(o,"headerSize",80*1024),T=0,S=0,w=0,R,p,b=false;this._needDrain=false,this._pause=false,this._cb=void 0,this._nparts=0,this._boy=t;let _={boundary:i,maxHeaderPairs:L,maxHeaderSize:E,partHwm:f.highWaterMark,highWaterMark:e.highWaterMark};this.parser=new dd(_),this.parser.on("drain",function(){if(s._needDrain=false,s._cb&&!s._pause){let P=s._cb;s._cb=void 0,P();}}).on("part",function P(v){if(++s._nparts>x)return s.parser.removeListener("part",P),s.parser.on("part",xt),t.hitPartsLimit=true,t.emit("partsLimit"),xt(v);if(p){let O=p;O.emit("end"),O.removeAllListeners("end");}v.on("header",function(O){let N,z,q,Q,re,ee,ge=0;if(O["content-type"]&&(q=wl(O["content-type"][0]),q[0])){for(N=q[0].toLowerCase(),r=0,n=q.length;r<n;++r)if(gd.test(q[r][0])){Q=q[r][1].toLowerCase();break}}if(N===void 0&&(N="text/plain"),Q===void 0&&(Q=l),O["content-disposition"]){if(q=wl(O["content-disposition"][0]),!yd.test(q[0]))return xt(v);for(r=0,n=q.length;r<n;++r)_d.test(q[r][0])?z=q[r][1]:xd.test(q[r][0])&&(ee=q[r][1],u||(ee=md(ee)));}else return xt(v);O["content-transfer-encoding"]?re=O["content-transfer-encoding"][0].toLowerCase():re="7bit";let _n,Sn;if(a(z,N,ee)){if(T===g)return t.hitFilesLimit||(t.hitFilesLimit=true,t.emit("filesLimit")),xt(v);if(++T,t.listenerCount("file")===0){s.parser._ignore();return}++w;let K=new As(f);R=K,K.on("end",function(){if(--w,s._pause=false,d(),s._cb&&!s._needDrain){let xe=s._cb;s._cb=void 0,xe();}}),K._read=function(xe){if(s._pause&&(s._pause=false,s._cb&&!s._needDrain)){let Ae=s._cb;s._cb=void 0,Ae();}},t.emit("file",z,K,ee,re,N),_n=function(xe){if((ge+=xe.length)>m){let Ae=m-ge+xe.length;Ae>0&&K.push(xe.slice(0,Ae)),K.truncated=true,K.bytesRead=m,v.removeAllListeners("data"),K.emit("limit");return}else K.push(xe)||(s._pause=true);K.bytesRead=ge;},Sn=function(){R=void 0,K.push(null);};}else {if(S===A)return t.hitFieldsLimit||(t.hitFieldsLimit=true,t.emit("fieldsLimit")),xt(v);++S,++w;let K="",xe=false;p=v,_n=function(Ae){if((ge+=Ae.length)>h){let lf=h-(ge-Ae.length);K+=Ae.toString("binary",0,lf),xe=true,v.removeAllListeners("data");}else K+=Ae.toString("binary");},Sn=function(){p=void 0,K.length&&(K=pd(K,"binary",Q)),t.emit("field",z,K,false,xe,re,N),--w,d();};}v._readableState.sync=false,v.on("data",_n),v.on("end",Sn);}).on("error",function(O){R&&R.emit("error",O);});}).on("error",function(P){t.emit("error",P);}).on("finish",function(){b=true,d();});}Ir.prototype.write=function(t,e){let r=this.parser.write(t);r&&!this._pause?e():(this._needDrain=!r,this._cb=e);};Ir.prototype.end=function(){let t=this;t.parser.writable?t.parser.end():t._boy._done||process.nextTick(function(){t._boy._done=true,t._boy.emit("finish");});};function xt(t){t.resume();}function As(t){El.call(this,t),this.bytesRead=0,this.truncated=false;}hd(As,El);As.prototype._read=function(t){};Tl.exports=Ir;});var Al=c((qx,Cl)=>{var Sd=/\+/g,wd=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function Rs(){this.buffer=void 0;}Rs.prototype.write=function(t){t=t.replace(Sd," ");let e="",r=0,n=0,s=t.length;for(;r<s;++r)this.buffer!==void 0?wd[t.charCodeAt(r)]?(this.buffer+=t[r],++n,this.buffer.length===2&&(e+=String.fromCharCode(parseInt(this.buffer,16)),this.buffer=void 0)):(e+="%"+this.buffer,this.buffer=void 0,--r):t[r]==="%"&&(r>n&&(e+=t.substring(n,r),n=r),this.buffer="",++n);return n<s&&this.buffer===void 0&&(e+=t.substring(n)),e};Rs.prototype.reset=function(){this.buffer=void 0;};Cl.exports=Rs;});var vl=c((Ux,Rl)=>{var Ed=Al(),_t=Dr(),vs=kr(),Td=/^charset$/i;Fr.detect=/^application\/x-www-form-urlencoded/i;function Fr(t,e){let r=e.limits,n=e.parsedConType;this.boy=t,this.fieldSizeLimit=vs(r,"fieldSize",1*1024*1024),this.fieldNameSizeLimit=vs(r,"fieldNameSize",100),this.fieldsLimit=vs(r,"fields",1/0);let s;for(var i=0,o=n.length;i<o;++i)if(Array.isArray(n[i])&&Td.test(n[i][0])){s=n[i][1].toLowerCase();break}s===void 0&&(s=e.defCharset||"utf8"),this.decoder=new Ed,this.charset=s,this._fields=0,this._state="key",this._checkingBytes=true,this._bytesKey=0,this._bytesVal=0,this._key="",this._val="",this._keyTrunc=false,this._valTrunc=false,this._hitLimit=false;}Fr.prototype.write=function(t,e){if(this._fields===this.fieldsLimit)return this.boy.hitFieldsLimit||(this.boy.hitFieldsLimit=true,this.boy.emit("fieldsLimit")),e();let r,n,s,i=0,o=t.length;for(;i<o;)if(this._state==="key"){for(r=n=void 0,s=i;s<o;++s){if(this._checkingBytes||++i,t[s]===61){r=s;break}else if(t[s]===38){n=s;break}if(this._checkingBytes&&this._bytesKey===this.fieldNameSizeLimit){this._hitLimit=true;break}else this._checkingBytes&&++this._bytesKey;}if(r!==void 0)r>i&&(this._key+=this.decoder.write(t.toString("binary",i,r))),this._state="val",this._hitLimit=false,this._checkingBytes=true,this._val="",this._bytesVal=0,this._valTrunc=false,this.decoder.reset(),i=r+1;else if(n!==void 0){++this._fields;let a,c=this._keyTrunc;if(n>i?a=this._key+=this.decoder.write(t.toString("binary",i,n)):a=this._key,this._hitLimit=false,this._checkingBytes=true,this._key="",this._bytesKey=0,this._keyTrunc=false,this.decoder.reset(),a.length&&this.boy.emit("field",_t(a,"binary",this.charset),"",c,false),i=n+1,this._fields===this.fieldsLimit)return e()}else this._hitLimit?(s>i&&(this._key+=this.decoder.write(t.toString("binary",i,s))),i=s,(this._bytesKey=this._key.length)===this.fieldNameSizeLimit&&(this._checkingBytes=false,this._keyTrunc=true)):(i<o&&(this._key+=this.decoder.write(t.toString("binary",i))),i=o);}else {for(n=void 0,s=i;s<o;++s){if(this._checkingBytes||++i,t[s]===38){n=s;break}if(this._checkingBytes&&this._bytesVal===this.fieldSizeLimit){this._hitLimit=true;break}else this._checkingBytes&&++this._bytesVal;}if(n!==void 0){if(++this._fields,n>i&&(this._val+=this.decoder.write(t.toString("binary",i,n))),this.boy.emit("field",_t(this._key,"binary",this.charset),_t(this._val,"binary",this.charset),this._keyTrunc,this._valTrunc),this._state="key",this._hitLimit=false,this._checkingBytes=true,this._key="",this._bytesKey=0,this._keyTrunc=false,this.decoder.reset(),i=n+1,this._fields===this.fieldsLimit)return e()}else this._hitLimit?(s>i&&(this._val+=this.decoder.write(t.toString("binary",i,s))),i=s,(this._val===""&&this.fieldSizeLimit===0||(this._bytesVal=this._val.length)===this.fieldSizeLimit)&&(this._checkingBytes=false,this._valTrunc=true)):(i<o&&(this._val+=this.decoder.write(t.toString("binary",i))),i=o);}e();};Fr.prototype.end=function(){this.boy._done||(this._state==="key"&&this._key.length>0?this.boy.emit("field",_t(this._key,"binary",this.charset),"",this._keyTrunc,false):this._state==="val"&&this.boy.emit("field",_t(this._key,"binary",this.charset),_t(this._val,"binary",this.charset),this._keyTrunc,this._valTrunc),this.boy._done=true,this.boy.emit("finish"));};Rl.exports=Fr;});var Ll=c(($x,qt)=>{var ks=a("stream").Writable,{inherits:Pd}=a("util"),Cd=Es(),kl=Pl(),Dl=vl(),Ad=Cs();function ve(t){if(!(this instanceof ve))return new ve(t);if(typeof t!="object")throw new TypeError("Busboy expected an options-Object.");if(typeof t.headers!="object")throw new TypeError("Busboy expected an options-Object with headers-attribute.");if(typeof t.headers["content-type"]!="string")throw new TypeError("Missing Content-Type-header.");let{headers:e,...r}=t;this.opts={autoDestroy:false,...r},ks.call(this,this.opts),this._done=false,this._parser=this.getParserByHeaders(e),this._finished=false;}Pd(ve,ks);ve.prototype.emit=function(t){if(t==="finish"){if(this._done){if(this._finished)return}else {this._parser?.end();return}this._finished=true;}ks.prototype.emit.apply(this,arguments);};ve.prototype.getParserByHeaders=function(t){let e=Ad(t["content-type"]),r={defCharset:this.opts.defCharset,fileHwm:this.opts.fileHwm,headers:t,highWaterMark:this.opts.highWaterMark,isPartAFile:this.opts.isPartAFile,limits:this.opts.limits,parsedConType:e,preservePath:this.opts.preservePath};if(kl.detect.test(e[0]))return new kl(this,r);if(Dl.detect.test(e[0]))return new Dl(this,r);throw new Error("Unsupported Content-Type.")};ve.prototype._write=function(t,e,r){this._parser.write(t,r);};qt.exports=ve;qt.exports.default=ve;qt.exports.Busboy=ve;qt.exports.Dicer=Cd;});var et={};d(et,{__addDisposableResource:()=>nc,__assign:()=>jr,__asyncDelegator:()=>Zl,__asyncGenerator:()=>Ql,__asyncValues:()=>Kl,__await:()=>St,__awaiter:()=>Ml,__classPrivateFieldGet:()=>ec,__classPrivateFieldIn:()=>rc,__classPrivateFieldSet:()=>tc,__createBinding:()=>qr,__decorate:()=>Fl,__disposeResources:()=>sc,__esDecorate:()=>Nl,__exportStar:()=>zl,__extends:()=>Ol,__generator:()=>Gl,__importDefault:()=>Yl,__importStar:()=>Xl,__makeTemplateObject:()=>Jl,__metadata:()=>Bl,__param:()=>jl,__propKey:()=>Ul,__read:()=>Os,__rest:()=>Il,__rewriteRelativeImportExtension:()=>ic,__runInitializers:()=>ql,__setFunctionName:()=>$l,__spread:()=>Hl,__spreadArray:()=>Wl,__spreadArrays:()=>Vl,__values:()=>Nr,default:()=>kd});function Ol(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ds(t,e);function r(){this.constructor=t;}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r);}function Il(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function Fl(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function jl(t,e){return function(r,n){e(r,n,t);}}function Nl(t,e,r,n,s,i){function o(x){if(x!==void 0&&typeof x!="function")throw new TypeError("Function expected");return x}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),f,d=false,h=r.length-1;h>=0;h--){var m={};for(var g in n)m[g]=g==="access"?{}:n[g];for(var g in n.access)m.access[g]=n.access[g];m.addInitializer=function(x){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(x||null));};var A=(0, r[h])(a==="accessor"?{get:u.get,set:u.set}:u[c],m);if(a==="accessor"){if(A===void 0)continue;if(A===null||typeof A!="object")throw new TypeError("Object expected");(f=o(A.get))&&(u.get=f),(f=o(A.set))&&(u.set=f),(f=o(A.init))&&s.unshift(f);}else (f=o(A))&&(a==="field"?s.unshift(f):u[c]=f);}l&&Object.defineProperty(l,n.name,u),d=true;}function ql(t,e,r){for(var n=arguments.length>2,s=0;s<e.length;s++)r=n?e[s].call(t,r):e[s].call(t);return n?r:void 0}function Ul(t){return typeof t=="symbol"?t:"".concat(t)}function $l(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:true,value:r?"".concat(r," ",e):e})}function Bl(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Ml(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i);})}return new(r||(r=Promise))(function(i,o){function a(u){try{l(n.next(u));}catch(f){o(f);}}function c(u){try{l(n.throw(u));}catch(f){o(f);}}function l(u){u.done?i(u.value):s(u.value).then(a,c);}l((n=n.apply(t,e||[])).next());})}function Gl(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(u){return c([l,u])}}function c(l){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(r=0)),r;)try{if(n=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,s=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r);}catch(u){l=[6,u],s=0;}finally{n=i=0;}if(l[0]&5)throw l[1];return {value:l[0]?l[1]:void 0,done:true}}}function zl(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qr(e,t,r);}function Nr(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return {next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Os(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value);}catch(a){o={error:a};}finally{try{s&&!s.done&&(r=n.return)&&r.call(n);}finally{if(o)throw o.error}}return i}function Hl(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Os(arguments[e]));return t}function Vl(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function Wl(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function St(t){return this instanceof St?(this.v=t,this):new St(t)}function Ql(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(h){return function(m){return Promise.resolve(m).then(h,f)}}function a(h,m){n[h]&&(s[h]=function(g){return new Promise(function(A,x){i.push([h,g,A,x])>1||c(h,g);})},m&&(s[h]=m(s[h])));}function c(h,m){try{l(n[h](m));}catch(g){d(i[0][3],g);}}function l(h){h.value instanceof St?Promise.resolve(h.value.v).then(u,f):d(i[0][2],h);}function u(h){c("next",h);}function f(h){c("throw",h);}function d(h,m){h(m),i.shift(),i.length&&c(i[0][0],i[0][1]);}}function Zl(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return (r=!r)?{value:St(t[s](o)),done:false}:i?i(o):o}:i;}}function Kl(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Nr=="function"?Nr(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,c){o=t[i](o),s(a,c,o.done,o.value);})};}function s(i,o,a,c){Promise.resolve(c).then(function(l){i({value:l,done:a});},o);}}function Jl(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Xl(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Ls(t),n=0;n<r.length;n++)r[n]!=="default"&&qr(e,t,r[n]);return Rd(e,t),e}function Yl(t){return t&&t.__esModule?t:{default:t}}function ec(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function tc(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r}function rc(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function nc(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose];}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(s=n);}if(typeof n!="function")throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this);}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r});}else r&&t.stack.push({async:true});return e}function sc(t){function e(i){t.error=t.hasError?new vd(i,t.error,"An error was suppressed during disposal."):i,t.hasError=true;}var r,n=0;function s(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,function(o){return e(o),s()})}else n|=1;}catch(o){e(o);}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}function ic(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,s,i,o){return n?e?".jsx":".js":s&&(!i||!o)?r:s+i+"."+o.toLowerCase()+"js"}):t}var Ds,jr,qr,Rd,Ls,vd,kd,tt=b(()=>{Ds=function(t,e){return Ds=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n;}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s]);},Ds(t,e)};jr=function(){return jr=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);}return e},jr.apply(this,arguments)};qr=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:true,get:function(){return e[r]}}),Object.defineProperty(t,n,s);}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r];});Rd=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:true,value:e});}):function(t,e){t.default=e;},Ls=function(t){return Ls=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Ls(t)};vd=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};kd={__extends:Ol,__assign:jr,__rest:Il,__decorate:Fl,__param:jl,__esDecorate:Nl,__runInitializers:ql,__propKey:Ul,__setFunctionName:$l,__metadata:Bl,__awaiter:Ml,__generator:Gl,__createBinding:qr,__exportStar:zl,__values:Nr,__read:Os,__spread:Hl,__spreadArrays:Vl,__spreadArray:Wl,__await:St,__asyncGenerator:Ql,__asyncDelegator:Zl,__asyncValues:Kl,__makeTemplateObject:Jl,__importStar:Xl,__importDefault:Yl,__classPrivateFieldGet:ec,__classPrivateFieldSet:tc,__classPrivateFieldIn:rc,__addDisposableResource:nc,__disposeResources:sc,__rewriteRelativeImportExtension:ic};});var de=c(ne=>{Object.defineProperty(ne,"__esModule",{value:true});ne.DEFAULT_ACCEPT_ENCODING=ne.fakePromise=void 0;ne.getHeadersObj=Id;ne.defaultHeadersSerializer=Fd;ne.isArrayBufferView=Nd;ne.isNodeReadable=qd;ne.isIterable=Ud;ne.shouldRedirect=$d;ne.pipeThrough=Bd;ne.endStream=Md;ne.safeWrite=Gd;ne.getSupportedFormats=ac;var Dd=(tt(),f(et)),Ld=a("events"),Od=Dd.__importDefault(a("zlib"));function oc(t){return t?.forEach!=null}function Id(t){return t==null||!oc(t)?t:t.headersInit&&!t._map&&!oc(t.headersInit)?t.headersInit:Object.fromEntries(t.entries())}function Fd(t,e){let r=[];return t.forEach((n,s)=>{e&&s==="content-length"&&e(n),r.push(`${s}: ${n}`);}),r}var jd=Me();Object.defineProperty(ne,"fakePromise",{enumerable:true,get:function(){return jd.fakePromise}});function Nd(t){return t!=null&&t.buffer!=null&&t.byteLength!=null&&t.byteOffset!=null}function qd(t){return t!=null&&t.pipe!=null}function Ud(t){return t?.[Symbol.iterator]!=null}function $d(t){return t===301||t===302||t===303||t===307||t===308}function Bd({src:t,dest:e,signal:r,onError:n}){if(n&&e.once("error",n),t.once("error",s=>{e.destroy(s);}),e.once("close",()=>{t.destroyed||t.destroy();}),r){let o=function(){i.deref()?.removeEventListener("abort",a),s.deref()?.removeListener("end",o),s.deref()?.removeListener("error",o),s.deref()?.removeListener("close",o);},a=function(){s.deref()?.destroy(new Is),o();},s=new WeakRef(t),i=new WeakRef(r);r.addEventListener("abort",a,{once:true}),t.once("end",o),t.once("error",o),t.once("close",o);}t.pipe(e,{end:true});}function Md(t){return t.end(null,null,null)}function Gd(t,e){if(!e.write(t))return (0, Ld.once)(e,"drain")}var Is=class extends Error{constructor(e="The operation was aborted",r=void 0){super(e,r),this.name="AbortError";}};ne.DEFAULT_ACCEPT_ENCODING=ac().join(", ");function ac(){let t=["gzip","deflate","br"];return globalThis.process?.versions?.node?.startsWith("2")||t.push("deflate-raw"),Od.default.createZstdCompress!=null&&t.push("zstd"),t}});var wt=c(Ur=>{Object.defineProperty(Ur,"__esModule",{value:true});Ur.PonyfillReadableStream=void 0;var lc=a("buffer"),Fs=a("events"),js=a("stream"),zd=a("stream/promises"),Ns=Me(),qs=de();function cc(t,e){let r=[],n=false,s=false;return {desiredSize:t,enqueue(i){let o=typeof i=="string"?lc.Buffer.from(i):i;s?e.push(o):r.push(o);},close(){r.length>0&&this._flush(),e.push(null),n=true;},error(i){r.length>0&&this._flush(),e.destroy(i);},get _closed(){return n},_flush(){if(s=true,r.length>0){let i=r.length>1?lc.Buffer.concat(r):r[0];e.push(i),r=[];}}}}function Hd(t){return t?.read!=null}function uc(t){return t?.getReader!=null}var Us=class t{readable;constructor(e){if(e instanceof t&&e.readable!=null)this.readable=e.readable;else if(Hd(e))this.readable=e;else if(uc(e))this.readable=js.Readable.fromWeb(e);else {let r=false,n=false,s=o=>{if(!r){let a=cc(o,this.readable);return r=true,(0, Ns.handleMaybePromise)(()=>e?.start?.(a),()=>(a._flush(),!a._closed))}return true},i=o=>(0, Ns.handleMaybePromise)(()=>s(o),a=>{if(!a)return;let c=cc(o,this.readable);return (0, Ns.handleMaybePromise)(()=>e?.pull?.(c),()=>{c._flush(),n=false;})});this.readable=new js.Readable({read(o){if(!n)return n=true,i(o)},destroy(o,a){if(e?.cancel)try{let c=e.cancel(o);if(c?.then)return c.then(()=>{a(null);},l=>{a(l);})}catch(c){a(c);return}a(null);}});}}cancel(e){return this.readable.destroy(e),(0, Fs.once)(this.readable,"close")}locked=false;getReader(e){let r=this.readable[Symbol.asyncIterator]();this.locked=true;let n=this.readable;return {read(){return r.next()},releaseLock:()=>{if(r.return){let s=r.return();if(s.then){s.then(()=>{this.locked=false;});return}}this.locked=false;},cancel:s=>{if(r.return){let i=r.return(s);if(i.then)return i.then(()=>{this.locked=false;})}return this.locked=false,(0, qs.fakePromise)()},get closed(){return Promise.race([(0, Fs.once)(n,"end"),(0, Fs.once)(n,"error").then(s=>Promise.reject(s))])}}}[Symbol.asyncIterator](e){let r=this.readable[Symbol.asyncIterator]();return {[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{await r.return?.(),this.readable.destroyed||this.readable.destroy();},next:()=>r.next(),return:()=>(this.readable.destroyed||this.readable.destroy(),r.return?.()||(0, qs.fakePromise)({done:true,value:void 0})),throw:s=>(this.readable.destroyed||this.readable.destroy(s),r.throw?.(s)||(0, qs.fakePromise)({done:true,value:void 0}))}}values(e){return this[Symbol.asyncIterator]()}tee(){throw new Error("Not implemented")}async pipeToWriter(e){try{for await(let r of this)await e.write(r);await e.close();}catch(r){await e.abort(r);}}pipeTo(e){if(Wd(e))return (0, zd.pipeline)(this.readable,e.writable,{end:true});{let r=e.getWriter();return this.pipeToWriter(r)}}pipeThrough({writable:e,readable:r}){return this.pipeTo(e).catch(n=>{this.readable.destroy(n);}),Vd(r)&&(r.readable.once("error",n=>this.readable.destroy(n)),r.readable.once("finish",()=>this.readable.push(null)),r.readable.once("close",()=>this.readable.push(null))),r}static[Symbol.hasInstance](e){return uc(e)}static from(e){return new t(js.Readable.from(e))}[Symbol.toStringTag]="ReadableStream"};Ur.PonyfillReadableStream=Us;function Vd(t){return t?.readable!=null}function Wd(t){return t?.writable!=null}});var $r=c(me=>{Object.defineProperty(me,"__esModule",{value:true});me.PonyfillBlob=void 0;me.hasBufferMethod=$t;me.hasArrayBufferMethod=Bt;me.hasBytesMethod=Mt;me.hasTextMethod=fc;me.hasSizeProperty=hc;me.hasStreamMethod=dc;me.hasBlobSignature=pc;me.isArrayBuffer=mc;var le=a("buffer"),$s=wt(),ae=de();function Ut(t){return typeof t=="string"?le.Buffer.from(t):le.Buffer.isBuffer(t)?t:(0, ae.isArrayBufferView)(t)?le.Buffer.from(t.buffer,t.byteOffset,t.byteLength):le.Buffer.from(t)}function $t(t){return t!=null&&t.buffer!=null&&typeof t.buffer=="function"}function Bt(t){return t!=null&&t.arrayBuffer!=null&&typeof t.arrayBuffer=="function"}function Mt(t){return t!=null&&t.bytes!=null&&typeof t.bytes=="function"}function fc(t){return t!=null&&t.text!=null&&typeof t.text=="function"}function hc(t){return t!=null&&typeof t.size=="number"}function dc(t){return t!=null&&t.stream!=null&&typeof t.stream=="function"}function pc(t){return t!=null&&t[Symbol.toStringTag]==="Blob"}function mc(t){return t!=null&&t.byteLength!=null&&t.slice!=null}var Bs=class{blobParts;type;encoding;_size=null;constructor(e=[],r){if(this.blobParts=e,this.type=r?.type||"application/octet-stream",this.encoding=r?.encoding||"utf8",this._size=r?.size||null,e.length===1&&pc(e[0]))return e[0]}_buffer=null;buffer(){if(this._buffer)return (0, ae.fakePromise)(this._buffer);if(this.blobParts.length===1){let n=this.blobParts[0];return $t(n)?n.buffer().then(s=>(this._buffer=s,this._buffer)):Mt(n)?n.bytes().then(s=>(this._buffer=le.Buffer.from(s),this._buffer)):Bt(n)?n.arrayBuffer().then(s=>(this._buffer=le.Buffer.from(s,void 0,n.size),this._buffer)):(this._buffer=Ut(n),(0, ae.fakePromise)(this._buffer))}let e=[],r=this.blobParts.map((n,s)=>{if($t(n)){e.push(n.buffer().then(i=>{r[s]=i;}));return}else if(Bt(n)){e.push(n.arrayBuffer().then(i=>{r[s]=le.Buffer.from(i,void 0,n.size);}));return}else if(Mt(n)){e.push(n.bytes().then(i=>{r[s]=le.Buffer.from(i);}));return}else return Ut(n)});return e.length>0?Promise.all(e).then(()=>le.Buffer.concat(r,this._size||void 0)):(0, ae.fakePromise)(le.Buffer.concat(r,this._size||void 0))}arrayBuffer(){if(this._buffer)return (0, ae.fakePromise)(this._buffer);if(this.blobParts.length===1){if(mc(this.blobParts[0]))return (0, ae.fakePromise)(this.blobParts[0]);if(Bt(this.blobParts[0]))return this.blobParts[0].arrayBuffer()}return this.buffer()}bytes(){if(this._buffer)return (0, ae.fakePromise)(this._buffer);if(this.blobParts.length===1){if(le.Buffer.isBuffer(this.blobParts[0]))return this._buffer=this.blobParts[0],(0, ae.fakePromise)(this._buffer);if(this.blobParts[0]instanceof Uint8Array)return this._buffer=le.Buffer.from(this.blobParts[0]),(0, ae.fakePromise)(this._buffer);if(Mt(this.blobParts[0]))return this.blobParts[0].bytes();if($t(this.blobParts[0]))return this.blobParts[0].buffer()}return this.buffer()}_text=null;text(){if(this._text)return (0, ae.fakePromise)(this._text);if(this.blobParts.length===1){let e=this.blobParts[0];if(typeof e=="string")return this._text=e,(0, ae.fakePromise)(this._text);if(fc(e))return e.text().then(n=>(this._text=n,this._text));let r=Ut(e);return this._text=r.toString(this.encoding),(0, ae.fakePromise)(this._text)}return this.buffer().then(e=>(this._text=e.toString(this.encoding),this._text))}_json=null;json(){return this._json?(0, ae.fakePromise)(this._json):this.text().then(e=>(this._json=JSON.parse(e),this._json))}_formData=null;formData(){if(this._formData)return (0, ae.fakePromise)(this._formData);throw new Error("Not implemented")}get size(){if(this._size==null){this._size=0;for(let e of this.blobParts)typeof e=="string"?this._size+=le.Buffer.byteLength(e):hc(e)?this._size+=e.size:(0, ae.isArrayBufferView)(e)&&(this._size+=e.byteLength);}return this._size}stream(){if(this.blobParts.length===1){let r=this.blobParts[0];if(dc(r))return r.stream();let n=Ut(r);return new $s.PonyfillReadableStream({start:s=>{s.enqueue(n),s.close();}})}if(this._buffer!=null)return new $s.PonyfillReadableStream({start:r=>{r.enqueue(this._buffer),r.close();}});let e;return new $s.PonyfillReadableStream({start:r=>{if(this.blobParts.length===0){r.close();return}e=this.blobParts[Symbol.iterator]();},pull:r=>{let{value:n,done:s}=e.next();if(s){r.close();return}if(n){if($t(n))return n.buffer().then(o=>{r.enqueue(o);});if(Mt(n))return n.bytes().then(o=>{let a=le.Buffer.from(o);r.enqueue(a);});if(Bt(n))return n.arrayBuffer().then(o=>{let a=le.Buffer.from(o,void 0,n.size);r.enqueue(a);});let i=Ut(n);r.enqueue(i);}}})}slice(){throw new Error("Not implemented")}};me.PonyfillBlob=Bs;});var Gs=c(Br=>{Object.defineProperty(Br,"__esModule",{value:true});Br.PonyfillFile=void 0;var Qd=$r(),Ms=class extends Qd.PonyfillBlob{name;lastModified;constructor(e,r,n){super(e,n),this.name=r,this.lastModified=n?.lastModified||Date.now();}webkitRelativePath=""};Br.PonyfillFile=Ms;});var Gr=c(Mr=>{Object.defineProperty(Mr,"__esModule",{value:true});Mr.PonyfillSuppressedError=void 0;var zs=class extends Error{error;suppressed;constructor(e,r,n){super(n),this.error=e,this.suppressed=r,this.name="SuppressedError",Error.captureStackTrace(this,this.constructor);}};Mr.PonyfillSuppressedError=zs;});var zt=c(Gt=>{Object.defineProperty(Gt,"__esModule",{value:true});Gt.DisposableSymbols=void 0;Gt.patchSymbols=Zd;Gt.DisposableSymbols={get dispose(){return Symbol.dispose||Symbol.for("dispose")},get asyncDispose(){return Symbol.asyncDispose||Symbol.for("asyncDispose")}};function Zd(){Symbol.dispose||=Symbol.for("dispose"),Symbol.asyncDispose||=Symbol.for("asyncDispose");}});var Hs=c(zr=>{Object.defineProperty(zr,"__esModule",{value:true});zr.isSyncDisposable=Kd;zr.isAsyncDisposable=Jd;var bc=zt();function Kd(t){return t?.[bc.DisposableSymbols.dispose]!=null}function Jd(t){return t?.[bc.DisposableSymbols.asyncDispose]!=null}});var gc=c(Vr=>{Object.defineProperty(Vr,"__esModule",{value:true});Vr.PonyfillAsyncDisposableStack=void 0;var Xd=Me(),Yd=Gr(),Hr=zt(),yc=Hs(),ep=globalThis.SuppressedError||Yd.PonyfillSuppressedError,Vs=class t{callbacks=[];get disposed(){return this.callbacks.length===0}use(e){return (0, yc.isAsyncDisposable)(e)?this.callbacks.push(()=>e[Hr.DisposableSymbols.asyncDispose]()):(0, yc.isSyncDisposable)(e)&&this.callbacks.push(()=>e[Hr.DisposableSymbols.dispose]()),e}adopt(e,r){return r&&this.callbacks.push(()=>r(e)),e}defer(e){e&&this.callbacks.push(e);}move(){let e=new t;return e.callbacks=this.callbacks,this.callbacks=[],e}disposeAsync(){return this[Hr.DisposableSymbols.asyncDispose]()}_error;_iterateCallbacks(){let e=this.callbacks.pop();if(e)return (0, Xd.handleMaybePromise)(e,()=>this._iterateCallbacks(),r=>(this._error=this._error?new ep(r,this._error):r,this._iterateCallbacks()))}[Hr.DisposableSymbols.asyncDispose](){let e=this._iterateCallbacks();if(e?.then)return e.then(()=>{if(this._error){let r=this._error;throw this._error=void 0,r}});if(this._error){let r=this._error;throw this._error=void 0,r}}[Symbol.toStringTag]="AsyncDisposableStack"};Vr.PonyfillAsyncDisposableStack=Vs;});var xc=c(Wr=>{Object.defineProperty(Wr,"__esModule",{value:true});Wr.PonyfillDisposableStack=void 0;var tp=Gr(),Ws=zt(),rp=Hs(),np=globalThis.SuppressedError||tp.PonyfillSuppressedError,Qs=class t{callbacks=[];get disposed(){return this.callbacks.length===0}use(e){return (0, rp.isSyncDisposable)(e)&&this.callbacks.push(()=>e[Ws.DisposableSymbols.dispose]()),e}adopt(e,r){return r&&this.callbacks.push(()=>r(e)),e}defer(e){e&&this.callbacks.push(e);}move(){let e=new t;return e.callbacks=this.callbacks,this.callbacks=[],e}dispose(){return this[Ws.DisposableSymbols.dispose]()}_error;_iterateCallbacks(){let e=this.callbacks.pop();if(e){try{e();}catch(r){this._error=this._error?new np(r,this._error):r;}return this._iterateCallbacks()}}[Ws.DisposableSymbols.dispose](){if(this._iterateCallbacks(),this._error){let e=this._error;throw this._error=void 0,e}}[Symbol.toStringTag]="DisposableStack"};Wr.PonyfillDisposableStack=Qs;});var _c=c(ke=>{Object.defineProperty(ke,"__esModule",{value:true});ke.SuppressedError=ke.AsyncDisposableStack=ke.DisposableStack=void 0;var sp=(tt(),f(et)),ip=gc(),op=xc(),ap=Gr();ke.DisposableStack=globalThis.DisposableStack||op.PonyfillDisposableStack;ke.AsyncDisposableStack=globalThis.AsyncDisposableStack||ip.PonyfillAsyncDisposableStack;ke.SuppressedError=globalThis.SuppressedError||ap.PonyfillSuppressedError;sp.__exportStar(zt(),ke);});var Zr=c(Qr=>{Object.defineProperty(Qr,"__esModule",{value:true});Qr.PonyfillIteratorObject=void 0;var Sc=a("util"),lp=_c(),cp=de(),Zs=class{iterableIterator;[Symbol.toStringTag]="IteratorObject";constructor(e,r){this.iterableIterator=e,this[Symbol.toStringTag]=r;}*map(e){let r=0;for(let n of this.iterableIterator)yield e(n,r++);}*filter(e){let r=0;for(let n of this.iterableIterator)e(n,r++)&&(yield n);}reduce(e,r){let n=0,s=r;for(let i of this.iterableIterator)s=e(s,i,n++);return s}forEach(e){let r=0;for(let n of this.iterableIterator)e(n,r++);}*take(e){let r=0;for(let n of this.iterableIterator){if(r>=e)break;yield n,r++;}}*drop(e){let r=0;for(let n of this.iterableIterator)r>=e&&(yield n),r++;}*flatMap(e){let r=0;for(let n of this.iterableIterator){let s=e(n,r++);if((0, cp.isIterable)(s))for(let i of s)yield i;else for(let i of {[Symbol.iterator]:()=>s})yield i;}}some(e){let r=0;for(let n of this.iterableIterator)if(e(n,r++))return true;return false}every(e){let r=0;for(let n of this.iterableIterator)if(!e(n,r++))return false;return true}find(e){let r=0;for(let n of this.iterableIterator)if(e(n,r++))return n}toArray(){return Array.from(this.iterableIterator)}[lp.DisposableSymbols.dispose](){this.iterableIterator.return?.();}next(...[e]){return this.iterableIterator.next(e)}[Symbol.iterator](){return this}[Symbol.for("nodejs.util.inspect.custom")](){let e={};return this.forEach((r,n)=>{let s=(0, Sc.inspect)(r);e[n]=s.includes(",")?s.split(",").map(i=>i.trim()):s;}),`${this[Symbol.toStringTag]} ${(0, Sc.inspect)(e)}`}};Qr.PonyfillIteratorObject=Zs;});var Xs=c(Ht=>{Object.defineProperty(Ht,"__esModule",{value:true});Ht.PonyfillFormData=void 0;Ht.getStreamFromFormData=fp;var rt=a("buffer"),Ks=Zr(),up=wt(),Js=class{map=new Map;append(e,r,n){let s=this.map.get(e);s||(s=[],this.map.set(e,s));let i=Ec(r)?wc(e,r,n):r;s.push(i);}delete(e){this.map.delete(e);}get(e){let r=this.map.get(e);return r?r[0]:null}getAll(e){return this.map.get(e)||[]}has(e){return this.map.has(e)}set(e,r,n){let s=Ec(r)?wc(e,r,n):r;this.map.set(e,[s]);}[Symbol.iterator](){return this._entries()}*_entries(){for(let[e,r]of this.map)for(let n of r)yield [e,n];}entries(){return new Ks.PonyfillIteratorObject(this._entries(),"FormDataIterator")}_keys(){return this.map.keys()}keys(){return new Ks.PonyfillIteratorObject(this._keys(),"FormDataIterator")}*_values(){for(let e of this.map.values())for(let r of e)yield r;}values(){return new Ks.PonyfillIteratorObject(this._values(),"FormDataIterator")}forEach(e){for(let[r,n]of this)e(n,r,this);}};Ht.PonyfillFormData=Js;function fp(t,e="---"){let r,n=false,s,i=false;function o(a){let{done:c,value:l}=r.next();if(c)return a.enqueue(rt.Buffer.from(`\r
|
|
8
|
+
--${e}--\r
|
|
9
|
+
`)),a.close();if(i&&a.enqueue(rt.Buffer.from(`\r
|
|
10
|
+
--${e}\r
|
|
11
|
+
`)),l){let[u,f]=l;if(typeof f=="string")a.enqueue(rt.Buffer.from(`Content-Disposition: form-data; name="${u}"\r
|
|
12
|
+
\r
|
|
13
|
+
`)),a.enqueue(rt.Buffer.from(f));else {let d="";f.name&&(d=`; filename="${f.name}"`),a.enqueue(rt.Buffer.from(`Content-Disposition: form-data; name="${u}"${d}\r
|
|
14
|
+
`)),a.enqueue(rt.Buffer.from(`Content-Type: ${f.type||"application/octet-stream"}\r
|
|
15
|
+
\r
|
|
16
|
+
`)),s=f.stream()[Symbol.asyncIterator]();}i=true;}}return new up.PonyfillReadableStream({start:()=>{r=t.entries();},pull:a=>n?s?s.next().then(({done:c,value:l})=>(c&&(s=void 0),l?a.enqueue(l):o(a))):o(a):(n=true,a.enqueue(rt.Buffer.from(`--${e}\r
|
|
17
|
+
`))),cancel:a=>{r?.return?.(a),s?.return?.(a);}})}function wc(t,e,r){return Object.defineProperty(e,"name",{configurable:true,enumerable:true,value:r||e.name||t}),e}function Ec(t){return t?.arrayBuffer!=null}});var Xr=c(Jr=>{Object.defineProperty(Jr,"__esModule",{value:true});Jr.PonyfillBody=void 0;var Te=a("buffer"),Le=a("stream"),hp=Ll(),Kr=Me(),Et=$r(),dp=Gs(),Tc=Xs(),De=wt(),te=de(),Z;(function(t){t.ReadableStream="ReadableStream",t.Blob="Blob",t.FormData="FormData",t.String="String",t.Readable="Readable",t.Buffer="Buffer",t.AsyncIterable="AsyncIterable";})(Z||(Z={}));var Ys=class{bodyInit;options;bodyUsed=false;contentType=null;contentLength=null;constructor(e,r={}){this.bodyInit=e,this.options=r;let{bodyFactory:n,contentType:s,contentLength:i,bodyType:o,buffer:a}=pp(e);this._bodyFactory=n,this.contentType=s,this.contentLength=i,this.bodyType=o,this._buffer=a,this._signal=r.signal;}bodyType;_bodyFactory=()=>null;_generatedBody=null;_buffer;_signal;generateBody(){if(this._generatedBody?.readable?.destroyed&&this._buffer&&(this._generatedBody.readable=Le.Readable.from(this._buffer)),this._generatedBody)return this._generatedBody;let e=this._bodyFactory();return this._generatedBody=e,e}handleContentLengthHeader(e=false){let r=this.headers.get("content-type");r?this.contentType=r:this.contentType&&this.headers.set("content-type",this.contentType);let n=this.headers.get("content-length");e&&this.bodyInit==null&&!n&&(this.contentLength=0,this.headers.set("content-length","0")),n?this.contentLength=parseInt(n,10):this.contentLength&&this.headers.set("content-length",this.contentLength.toString());}get body(){let e=this.generateBody();if(e!=null){let r=e,n=e.readable;return new Proxy(e.readable,{get(s,i){if(i in r){let o=r[i];return typeof o=="function"?o.bind(r):o}if(i in n){let o=n[i];return typeof o=="function"?o.bind(n):o}}})}return null}_chunks=null;_doCollectChunksFromReadableJob(){if(this.bodyType===Z.AsyncIterable){if(Array.fromAsync)return (0, Kr.handleMaybePromise)(()=>Array.fromAsync(this.bodyInit),o=>(this._chunks=o,this._chunks));let n=this.bodyInit[Symbol.asyncIterator](),s=[],i=()=>(0, Kr.handleMaybePromise)(()=>n.next(),({value:o,done:a})=>(o&&s.push(o),a?(this._chunks=s,this._chunks):i()));return i()}let e=this.generateBody();if(!e)return this._chunks=[],(0, te.fakePromise)(this._chunks);if(e.readable.destroyed)return (0, te.fakePromise)(this._chunks=[]);let r=[];return new Promise((n,s)=>{e.readable.on("data",i=>{r.push(i);}),e.readable.once("error",s),e.readable.once("end",()=>{n(this._chunks=r);});})}_collectChunksFromReadable(){return this._chunks?(0, te.fakePromise)(this._chunks):(this._chunks||=this._doCollectChunksFromReadableJob(),this._chunks)}_blob=null;blob(){return this._blob?(0, te.fakePromise)(this._blob):(this.bodyType===Z.String&&(this._text=this.bodyInit,this._blob=new Et.PonyfillBlob([this._text],{type:this.contentType||"text/plain;charset=UTF-8",size:this.contentLength})),this.bodyType===Z.Blob?(this._blob=this.bodyInit,(0, te.fakePromise)(this._blob)):this._buffer?(this._blob=new Et.PonyfillBlob([this._buffer],{type:this.contentType||"",size:this.contentLength}),(0, te.fakePromise)(this._blob)):(0, te.fakePromise)((0, Kr.handleMaybePromise)(()=>this._collectChunksFromReadable(),e=>(this._blob=new Et.PonyfillBlob(e,{type:this.contentType||"",size:this.contentLength}),this._blob))))}_formData=null;formData(e){if(this._formData)return (0, te.fakePromise)(this._formData);if(this.bodyType===Z.FormData)return this._formData=this.bodyInit,(0, te.fakePromise)(this._formData);if(this._formData=new Tc.PonyfillFormData,this.generateBody()==null)return (0, te.fakePromise)(this._formData);let n={...this.options.formDataLimits,...e?.formDataLimits};return new Promise((s,i)=>{let o=this.body?.readable;if(!o)return i(new Error("No stream available"));let a=null,c=new hp.Busboy({headers:{"content-length":typeof this.contentLength=="number"?this.contentLength.toString():this.contentLength||"","content-type":this.contentType||""},limits:n,defCharset:"utf-8"});this._signal&&(0, Le.addAbortSignal)(this._signal,c);let l=false,u=f=>{l||(l=true,o.unpipe(c),c.destroy(),a&&(a.destroy(),a=null),f?i(f):s(this._formData));};o.on("error",u),c.on("field",(f,d,h,m)=>{if(h)return u(new Error(`Field name size exceeded: ${n?.fieldNameSize} bytes`));if(m)return u(new Error(`Field value size exceeded: ${n?.fieldSize} bytes`));this._formData.set(f,d);}),c.on("file",(f,d,h,m,g)=>{a=d;let A=[];d.on("data",x=>{A.push(x);}),d.on("error",u),d.on("limit",()=>{u(new Error(`File size limit exceeded: ${n?.fileSize} bytes`));}),d.on("close",()=>{d.truncated&&u(new Error(`File size limit exceeded: ${n?.fileSize} bytes`)),a=null;let x=new dp.PonyfillFile(A,h,{type:g});this._formData.set(f,x);});}),c.on("fieldsLimit",()=>{u(new Error(`Fields limit exceeded: ${n?.fields}`));}),c.on("filesLimit",()=>{u(new Error(`Files limit exceeded: ${n?.files}`));}),c.on("partsLimit",()=>{u(new Error(`Parts limit exceeded: ${n?.parts}`));}),c.on("end",u),c.on("finish",u),c.on("close",u),c.on("error",u),o.pipe(c);})}buffer(){if(this._buffer)return (0, te.fakePromise)(this._buffer);if(this._text)return this._buffer=Te.Buffer.from(this._text,"utf-8"),(0, te.fakePromise)(this._buffer);if(this.bodyType===Z.String)return this.text().then(e=>(this._text=e,this._buffer=Te.Buffer.from(e,"utf-8"),this._buffer));if(this.bodyType===Z.Blob){if((0, Et.hasBufferMethod)(this.bodyInit))return this.bodyInit.buffer().then(e=>(this._buffer=e,this._buffer));if((0, Et.hasBytesMethod)(this.bodyInit))return this.bodyInit.bytes().then(e=>(this._buffer=Te.Buffer.from(e),this._buffer));if((0, Et.hasArrayBufferMethod)(this.bodyInit))return this.bodyInit.arrayBuffer().then(e=>(this._buffer=Te.Buffer.from(e,void 0,e.byteLength),this._buffer))}return (0, te.fakePromise)((0, Kr.handleMaybePromise)(()=>this._collectChunksFromReadable(),e=>e.length===1?(this._buffer=e[0],this._buffer):(this._buffer=Te.Buffer.concat(e),this._buffer)))}bytes(){return this.buffer()}arrayBuffer(){return this.buffer()}_json=null;json(){return this._json?(0, te.fakePromise)(this._json):this.text().then(e=>{try{this._json=JSON.parse(e);}catch(r){throw r instanceof SyntaxError&&(r.message+=`, "${e}" is not valid JSON`),r}return this._json})}_text=null;text(){return this._text?(0, te.fakePromise)(this._text):this.bodyType===Z.String?(this._text=this.bodyInit,(0, te.fakePromise)(this._text)):this.buffer().then(e=>(this._text=e.toString("utf-8"),this._text))}};Jr.PonyfillBody=Ys;function pp(t){if(t==null)return {bodyFactory:()=>null,contentType:null,contentLength:null};if(typeof t=="string"){let e=Te.Buffer.byteLength(t);return {bodyType:Z.String,contentType:"text/plain;charset=UTF-8",contentLength:e,bodyFactory(){let r=Le.Readable.from(Te.Buffer.from(t,"utf-8"));return new De.PonyfillReadableStream(r)}}}if(Te.Buffer.isBuffer(t)){let e=t;return {bodyType:Z.Buffer,contentType:null,contentLength:t.length,buffer:t,bodyFactory(){let r=Le.Readable.from(e);return new De.PonyfillReadableStream(r)}}}if((0, te.isArrayBufferView)(t)){let e=Te.Buffer.from(t.buffer,t.byteOffset,t.byteLength);return {bodyType:Z.Buffer,contentLength:t.byteLength,contentType:null,buffer:e,bodyFactory(){let r=Le.Readable.from(e);return new De.PonyfillReadableStream(r)}}}if(t instanceof De.PonyfillReadableStream&&t.readable!=null){let e=t;return {bodyType:Z.ReadableStream,bodyFactory:()=>e,contentType:null,contentLength:null}}if(bp(t)){let e=t;return {bodyType:Z.Blob,contentType:t.type,contentLength:t.size,bodyFactory(){return e.stream()}}}if(t instanceof ArrayBuffer){let e=t.byteLength,r=Te.Buffer.from(t,void 0,t.byteLength);return {bodyType:Z.Buffer,contentType:null,contentLength:e,buffer:r,bodyFactory(){let n=Le.Readable.from(r);return new De.PonyfillReadableStream(n)}}}if(t instanceof Le.Readable)return {bodyType:Z.Readable,contentType:null,contentLength:null,bodyFactory(){return new De.PonyfillReadableStream(t)}};if(yp(t))return {bodyType:Z.String,contentType:"application/x-www-form-urlencoded;charset=UTF-8",contentLength:null,bodyFactory(){return new De.PonyfillReadableStream(Le.Readable.from(t.toString()))}};if(mp(t)){let e=Math.random().toString(36).substr(2),r=`multipart/form-data; boundary=${e}`;return {bodyType:Z.FormData,contentType:r,contentLength:null,bodyFactory(){return (0, Tc.getStreamFromFormData)(t,e)}}}if(gp(t))return {contentType:null,contentLength:null,bodyFactory(){return new De.PonyfillReadableStream(t)}};if(t[Symbol.iterator]||t[Symbol.asyncIterator])return {contentType:null,contentLength:null,bodyType:Z.AsyncIterable,bodyFactory(){let e=Le.Readable.from(t);return new De.PonyfillReadableStream(e)}};throw new Error("Unknown body type")}function mp(t){return t?.forEach!=null}function bp(t){return t?.stream!=null&&typeof t.stream=="function"}function yp(t){return t?.sort!=null}function gp(t){return t?.getReader!=null}});var Yr=c(Vt=>{Object.defineProperty(Vt,"__esModule",{value:true});Vt.PonyfillHeaders=void 0;Vt.isHeadersLike=Ge;var xp=a("util"),ei=Zr();function Ge(t){return t?.get&&t?.forEach}var ti=class{headersInit;_map;objectNormalizedKeysOfHeadersInit=[];objectOriginalKeysOfHeadersInit=[];_setCookies;constructor(e){this.headersInit=e;}_get(e){let r=e.toLowerCase();if(r==="set-cookie"&&this._setCookies?.length)return this._setCookies.join(", ");if(this._map)return this._map.get(r)||null;if(this.headersInit==null)return null;if(Array.isArray(this.headersInit)){let n=this.headersInit.filter(([s])=>s.toLowerCase()===r);return n.length===0?null:n.length===1?n[0][1]:n.map(([,s])=>s).join(", ")}else {if(Ge(this.headersInit))return this.headersInit.get(r);{let n=this.headersInit[e]||this.headersInit[r];if(n!=null)return n;this.objectNormalizedKeysOfHeadersInit.length||Object.keys(this.headersInit).forEach(o=>{this.objectOriginalKeysOfHeadersInit.push(o),this.objectNormalizedKeysOfHeadersInit.push(o.toLowerCase());});let s=this.objectNormalizedKeysOfHeadersInit.indexOf(r);if(s===-1)return null;let i=this.objectOriginalKeysOfHeadersInit[s];return this.headersInit[i]}}}getMap(){if(!this._map)if(this._setCookies||=[],this.headersInit!=null)if(Array.isArray(this.headersInit)){this._map=new Map;for(let[e,r]of this.headersInit){let n=e.toLowerCase();if(n==="set-cookie"){Array.isArray(r)?this._setCookies.push(...r):r!=null&&this._setCookies.push(r);continue}this._map.set(n,r);}}else if(Ge(this.headersInit))this._map=new Map,this.headersInit.forEach((e,r)=>{if(r==="set-cookie"){this._setCookies||=[],Array.isArray(e)?this._setCookies.push(...e):e!=null&&this._setCookies.push(e);return}this._map.set(r,e);});else {this._map=new Map;for(let e in this.headersInit){let r=this.headersInit[e];if(r!=null){let n=e.toLowerCase();if(n==="set-cookie"){if(this._setCookies||=[],Array.isArray(r)){this._setCookies.push(...r);continue}this._setCookies.push(r);continue}this._map.set(n,r);}}}else this._map=new Map;return this._map}append(e,r){let n=e.toLowerCase();if(n==="set-cookie"){this._setCookies||=[],this._setCookies.push(r);return}let s=this.getMap().get(n),i=s?`${s}, ${r}`:r;this.getMap().set(n,i);}get(e){let r=this._get(e);return r==null?null:r.toString()}has(e){return e.toLowerCase()==="set-cookie"?!!this._setCookies?.length:!!this._get(e)}set(e,r){let n=e.toLowerCase();if(n==="set-cookie"){this._setCookies=[r];return}if(!this._map&&this.headersInit!=null)if(Array.isArray(this.headersInit)){let s=this.headersInit.find(([i])=>i.toLowerCase()===n);s?s[1]=r:this.headersInit.push([n,r]);return}else if(Ge(this.headersInit)){this.headersInit.set(n,r);return}else {this.headersInit[n]=r;return}this.getMap().set(n,r);}delete(e){let r=e.toLowerCase();if(r==="set-cookie"){this._setCookies=[];return}this.getMap().delete(r);}forEach(e){if(this._setCookies?.forEach(r=>{e(r,"set-cookie",this);}),!this._map){if(this.headersInit){if(Array.isArray(this.headersInit)){this.headersInit.forEach(([r,n])=>{e(n,r,this);});return}if(Ge(this.headersInit)){this.headersInit.forEach(e);return}Object.entries(this.headersInit).forEach(([r,n])=>{n!=null&&e(n,r,this);});}return}this.getMap().forEach((r,n)=>{e(r,n,this);});}*_keys(){if(this._setCookies?.length&&(yield "set-cookie"),!this._map&&this.headersInit){if(Array.isArray(this.headersInit)){yield*this.headersInit.map(([e])=>e)[Symbol.iterator]();return}if(Ge(this.headersInit)){yield*this.headersInit.keys();return}yield*Object.keys(this.headersInit)[Symbol.iterator]();return}yield*this.getMap().keys();}keys(){return new ei.PonyfillIteratorObject(this._keys(),"HeadersIterator")}*_values(){if(this._setCookies?.length&&(yield*this._setCookies),!this._map&&this.headersInit){if(Array.isArray(this.headersInit)){yield*this.headersInit.map(([,e])=>e)[Symbol.iterator]();return}if(Ge(this.headersInit)){yield*this.headersInit.values();return}yield*Object.values(this.headersInit)[Symbol.iterator]();return}yield*this.getMap().values();}values(){return new ei.PonyfillIteratorObject(this._values(),"HeadersIterator")}*_entries(){if(this._setCookies?.length&&(yield*this._setCookies.map(e=>["set-cookie",e])),!this._map&&this.headersInit){if(Array.isArray(this.headersInit)){yield*this.headersInit;return}if(Ge(this.headersInit)){yield*this.headersInit.entries();return}yield*Object.entries(this.headersInit);return}yield*this.getMap().entries();}entries(){return new ei.PonyfillIteratorObject(this._entries(),"HeadersIterator")}getSetCookie(){return this._setCookies||this.getMap(),this._setCookies}[Symbol.iterator](){return this.entries()}[Symbol.for("nodejs.util.inspect.custom")](){let e={};return this.forEach((r,n)=>{n==="set-cookie"?e["set-cookie"]=this._setCookies||[]:e[n]=r?.includes(",")?r.split(",").map(s=>s.trim()):r;}),`Headers ${(0, xp.inspect)(e)}`}};Vt.PonyfillHeaders=ti;});var Qt=c(en=>{Object.defineProperty(en,"__esModule",{value:true});en.PonyfillResponse=void 0;var _p=a("http"),Sp=Xr(),ri=Yr(),Wt="application/json; charset=utf-8",ni=class t extends Sp.PonyfillBody{headers;constructor(e,r){super(e||null,r),this.headers=r?.headers&&(0, ri.isHeadersLike)(r.headers)?r.headers:new ri.PonyfillHeaders(r?.headers),this.status=r?.status||200,this.statusText=r?.statusText||_p.STATUS_CODES[this.status]||"OK",this.url=r?.url||"",this.redirected=r?.redirected||false,this.type=r?.type||"default",this.handleContentLengthHeader();}get ok(){return this.status>=200&&this.status<300}status;statusText;url;redirected;type;clone(){return this}static error(){return new t(null,{status:500,statusText:"Internal Server Error"})}static redirect(e,r=302){if(r<300||r>399)throw new RangeError("Invalid status code");return new t(null,{headers:{location:e},status:r})}static json(e,r){let n=JSON.stringify(e);if(!r)r={headers:{"content-type":Wt,"content-length":Buffer.byteLength(n).toString()}};else if(!r.headers)r.headers={"content-type":Wt,"content-length":Buffer.byteLength(n).toString()};else if((0, ri.isHeadersLike)(r.headers))r.headers.has("content-type")||r.headers.set("content-type",Wt),r.headers.has("content-length")||r.headers.set("content-length",Buffer.byteLength(n).toString());else if(Array.isArray(r.headers)){let s=false,i=false;for(let[o]of r.headers){if(i&&s)break;!s&&o.toLowerCase()==="content-type"?s=true:!i&&o.toLowerCase()==="content-length"&&(i=true);}s||r.headers.push(["content-type",Wt]),i||r.headers.push(["content-length",Buffer.byteLength(n).toString()]);}else typeof r.headers=="object"&&(r.headers?.["content-type"]==null&&(r.headers["content-type"]=Wt),r.headers?.["content-length"]==null&&(r.headers["content-length"]=Buffer.byteLength(n).toString()));return new t(n,r)}[Symbol.toStringTag]="Response"};en.PonyfillResponse=ni;});var Cc=c(ii=>{Object.defineProperty(ii,"__esModule",{value:true});ii.fetchCurl=Pp;var Pc=a("stream"),wp=a("tls"),Ep=Me(),Tp=Qt(),si=de();function Pp(t){let{Curl:e,CurlFeature:r,CurlPause:n,CurlProgressFunc:s}=globalThis.libcurl,i=new e;i.enable(r.NoDataParsing),i.setOpt("URL",t.url),process.env.NODE_TLS_REJECT_UNAUTHORIZED==="0"&&i.setOpt("SSL_VERIFYPEER",false),process.env.NODE_EXTRA_CA_CERTS?i.setOpt("CAINFO",process.env.NODE_EXTRA_CA_CERTS):i.setOpt("CAINFO_BLOB",wp.rootCertificates.join(`
|
|
18
|
+
`)),i.enable(r.StreamResponse);let o;if(t._signal===null?o=void 0:t._signal&&(o=t._signal),i.setStreamProgressCallback(function(){return o?.aborted?process.env.DEBUG?s.Continue:1:0}),t.bodyType==="String")i.setOpt("POSTFIELDS",t.bodyInit);else {let h=t.body!=null?(0, si.isNodeReadable)(t.body)?t.body:Pc.Readable.from(t.body):null;h&&(i.setOpt("UPLOAD",true),i.setUploadStream(h));}process.env.DEBUG&&i.setOpt("VERBOSE",true),i.setOpt("TRANSFER_ENCODING",false),i.setOpt("HTTP_TRANSFER_DECODING",true),i.setOpt("FOLLOWLOCATION",t.redirect==="follow"),i.setOpt("MAXREDIRS",20),i.setOpt("ACCEPT_ENCODING",""),i.setOpt("CUSTOMREQUEST",t.method);let a=t.headersSerializer||si.defaultHeadersSerializer,c,l=a(t.headers,h=>{c=Number(h);});c!=null&&i.setOpt("INFILESIZE",c),i.setOpt("HTTPHEADER",l),i.enable(r.NoHeaderParsing);let u=(0, Ep.createDeferredPromise)(),f;function d(){if(i.isOpen)try{i.pause(n.Recv);}catch(h){u.reject(h);}}return o?.addEventListener("abort",d,{once:true}),i.once("end",function(){try{i.close();}catch(m){u.reject(m);}o?.removeEventListener("abort",d);}),i.once("error",function(m){f&&!f.closed&&!f.destroyed?f.destroy(m):(m.message==="Operation was aborted by an application callback"&&(m.message="The operation was aborted."),u.reject(m));try{i.close();}catch(g){u.reject(g);}}),i.once("stream",function(m,g,A){let x=m.pipe(new Pc.PassThrough,{end:true}),E=A.toString("utf8").split(/\r?\n|\r/g).filter(S=>S&&!S.startsWith("HTTP/")?(t.redirect==="error"&&S.toLowerCase().includes("location")&&(0, si.shouldRedirect)(g)&&(m.destroyed||m.resume(),x.destroy(),u.reject(new Error("redirect is not allowed"))),true):false).map(S=>S.split(/:\s(.+)/).slice(0,2)),T=new Tp.PonyfillResponse(x,{status:g,headers:E,url:i.getInfo(e.info.REDIRECT_URL)?.toString()||t.url,redirected:Number(i.getInfo(e.info.REDIRECT_COUNT))>0});u.resolve(T),f=x;}),setImmediate(()=>{i.perform();}),u.promise}});var Zt=c(tn=>{Object.defineProperty(tn,"__esModule",{value:true});tn.PonyfillURL=void 0;var Cp=(tt(),f(et)),Ap=Cp.__importDefault(a("buffer")),Rp=a("crypto"),Ac=globalThis.URL,oi=class extends Ac{static blobRegistry=new Map;static createObjectURL(e){let r=`blob:whatwgnode:${(0, Rp.randomUUID)()}`;return this.blobRegistry.set(r,e),r}static revokeObjectURL(e){this.blobRegistry.has(e)?this.blobRegistry.delete(e):Ac.revokeObjectURL(e);}static getBlobFromURL(e){return this.blobRegistry.get(e)||Ap.default?.resolveObjectURL?.(e)}};tn.PonyfillURL=oi;});var nn=c(rn=>{Object.defineProperty(rn,"__esModule",{value:true});rn.PonyfillRequest=void 0;var vp=a("http"),kp=a("https"),Dp=Xr(),Rc=Yr(),Lp=Zt();function Op(t){return t[Symbol.toStringTag]==="Request"}function Ip(t){return t?.href!=null}var ai=class extends Dp.PonyfillBody{constructor(e,r){let n,s,i=null,o;if(typeof e=="string"?n=e:Ip(e)?s=e:Op(e)&&(e._parsedUrl?s=e._parsedUrl:e._url?n=e._url:n=e.url,i=e.body,o=e),r!=null&&(i=r.body||null,o=r),super(i,o),this._url=n,this._parsedUrl=s,this.cache=o?.cache||"default",this.credentials=o?.credentials||"same-origin",this.headers=o?.headers&&(0, Rc.isHeadersLike)(o.headers)?o.headers:new Rc.PonyfillHeaders(o?.headers),this.integrity=o?.integrity||"",this.keepalive=o?.keepalive!=null?o?.keepalive:false,this.method=o?.method?.toUpperCase()||"GET",this.mode=o?.mode||"cors",this.redirect=o?.redirect||"follow",this.referrer=o?.referrer||"about:client",this.referrerPolicy=o?.referrerPolicy||"no-referrer",this.headersSerializer=o?.headersSerializer,this.duplex=o?.duplex||"half",this.destination="document",this.priority="auto",this.method!=="GET"&&this.method!=="HEAD"&&this.handleContentLengthHeader(true),o?.agent!=null){let a=s?.protocol||n||this.url;o.agent===false?this.agent=false:a.startsWith("http:")&&o.agent instanceof vp.Agent?this.agent=o.agent:a.startsWith("https:")&&o.agent instanceof kp.Agent&&(this.agent=o.agent);}}headersSerializer;cache;credentials;destination;headers;integrity;keepalive;method;mode;priority;redirect;referrer;referrerPolicy;_url;get signal(){return this._signal||=new AbortController().signal,this._signal}get url(){if(this._url==null)if(this._parsedUrl)this._url=this._parsedUrl.toString();else throw new TypeError("Invalid URL");return this._url}_parsedUrl;get parsedUrl(){if(this._parsedUrl==null)if(this._url!=null)this._parsedUrl=new Lp.PonyfillURL(this._url,"http://localhost");else throw new TypeError("Invalid URL");return this._parsedUrl}duplex;agent;clone(){return this}[Symbol.toStringTag]="Request"};rn.PonyfillRequest=ai;});var Oc=c(li=>{Object.defineProperty(li,"__esModule",{value:true});li.fetchNodeHttp=Lc;var Fp=(tt(),f(et)),Dc=a("http"),jp=a("https"),vc=a("stream"),Tt=Fp.__importDefault(a("zlib")),kc=Me(),Np=nn(),qp=Qt(),Up=Zt(),Pe=de();function $p(t){if(t.startsWith("http:"))return Dc.request;if(t.startsWith("https:"))return jp.request;throw new Error(`Unsupported protocol: ${t.split(":")[0]||t}`)}function Lc(t){return new Promise((e,r)=>{try{let n=$p(t.parsedUrl?.protocol||t.url),i=(t.headersSerializer||Pe.getHeadersObj)(t.headers);i["accept-encoding"]||=Pe.DEFAULT_ACCEPT_ENCODING,i["user-agent"]==null&&i["User-Agent"]==null&&(i["user-agent"]="node");let o;t._signal==null?o=void 0:t._signal&&(o=t._signal);let a;if(t.parsedUrl?a=n(t.parsedUrl,{method:t.method,headers:i,signal:o,agent:t.agent}):a=n(t.url,{method:t.method,headers:i,signal:o,agent:t.agent}),a.once("error",r),a.once("response",c=>{let l;switch(c.headers["content-encoding"]){case "x-gzip":case "gzip":l=Tt.default.createGunzip();break;case "x-deflate":case "deflate":l=Tt.default.createInflate();break;case "x-deflate-raw":case "deflate-raw":l=Tt.default.createInflateRaw();break;case "br":l=Tt.default.createBrotliDecompress();break;case "zstd":Tt.default.createZstdDecompress!=null&&(l=Tt.default.createZstdDecompress());break}if(c.headers.location&&(0,Pe.shouldRedirect)(c.statusCode)){if(t.redirect==="error"){let m=new Error("Redirects are not allowed");r(m),c.resume();return}if(t.redirect==="follow"){let m=new Up.PonyfillURL(c.headers.location,t.parsedUrl||t.url),g=Lc(new Np.PonyfillRequest(m,t));e(g.then(A=>(A.redirected=!0,A))),c.resume();return}}l||=new vc.PassThrough,(0,Pe.pipeThrough)({src:c,dest:l,signal:o,onError:m=>{c.destroyed||c.destroy(m),l.destroyed||l.destroy(m),r(m);}});let f=c.statusCode||200,d=c.statusMessage||Dc.STATUS_CODES[f];d==null&&(d="");let h=new qp.PonyfillResponse(l||c,{status:f,statusText:d,headers:c.headers,url:t.url,signal:o});e(h);}),t._buffer!=null)(0,kc.handleMaybePromise)(()=>(0,Pe.safeWrite)(t._buffer,a),()=>(0,Pe.endStream)(a),r);else if(t.bodyType==="String")(0,kc.handleMaybePromise)(()=>(0,Pe.safeWrite)(t.bodyInit,a),()=>(0,Pe.endStream)(a),r);else {let c=t.body!=null?(0,Pe.isNodeReadable)(t.body)?t.body:vc.Readable.from(t.body):null;c?c.pipe(a):(0,Pe.endStream)(a);}}catch(n){r(n);}})}});var Nc=c(ci=>{Object.defineProperty(ci,"__esModule",{value:true});ci.fetchPonyfill=jc;var Bp=a("buffer"),sn=a("fs"),Mp=a("url"),Gp=Cc(),zp=Oc(),Hp=nn(),Pt=Qt(),Vp=Zt(),Ic=de(),Fc=";base64";async function Wp(t){let e=(0, Mp.fileURLToPath)(t);try{await sn.promises.access(e,sn.promises.constants.R_OK);let r=await sn.promises.stat(e,{bigint:!0}),n=(0,sn.createReadStream)(e);return new Pt.PonyfillResponse(n,{status:200,statusText:"OK",headers:{"content-type":"application/octet-stream","last-modified":r.mtime.toUTCString()}})}catch(r){if(r.code==="ENOENT")return new Pt.PonyfillResponse(null,{status:404,statusText:"Not Found"});if(r.code==="EACCES")return new Pt.PonyfillResponse(null,{status:403,statusText:"Forbidden"});throw r}}function Qp(t){let[e="text/plain",...r]=t.substring(5).split(","),n=decodeURIComponent(r.join(","));if(e.endsWith(Fc)){let s=Bp.Buffer.from(n,"base64url"),i=e.slice(0,-Fc.length);return new Pt.PonyfillResponse(s,{status:200,statusText:"OK",headers:{"content-type":i}})}return new Pt.PonyfillResponse(n,{status:200,statusText:"OK",headers:{"content-type":e}})}function Zp(t){let e=Vp.PonyfillURL.getBlobFromURL(t);if(!e)throw new TypeError("Invalid Blob URL");return new Pt.PonyfillResponse(e,{status:200,headers:{"content-type":e.type,"content-length":e.size.toString()}})}function Kp(t){return t!=null&&t.href!=null}function jc(t,e){if(typeof t=="string"||Kp(t)){let n=new Hp.PonyfillRequest(t,e);return jc(n)}let r=t;if(r.url.startsWith("data:")){let n=Qp(r.url);return (0, Ic.fakePromise)(n)}if(r.url.startsWith("file:"))return Wp(r.url);if(r.url.startsWith("blob:")){let n=Zp(r.url);return (0, Ic.fakePromise)(n)}return globalThis.libcurl&&!r.agent?(0, Gp.fetchCurl)(r):(0, zp.fetchNodeHttp)(r)}});var hi=c(nt=>{Object.defineProperty(nt,"__esModule",{value:true});nt.PonyfillTextDecoder=nt.PonyfillTextEncoder=void 0;nt.PonyfillBtoa=Xp;var Kt=a("buffer"),Jp=de(),ui=class{encoding;constructor(e="utf-8"){this.encoding=e;}encode(e){return Kt.Buffer.from(e,this.encoding)}encodeInto(e,r){let s=this.encode(e).copy(r);return {read:s,written:s}}};nt.PonyfillTextEncoder=ui;var fi=class{encoding;fatal=false;ignoreBOM=false;constructor(e="utf-8",r){this.encoding=e,r&&(this.fatal=r.fatal||false,this.ignoreBOM=r.ignoreBOM||false);}decode(e){return Kt.Buffer.isBuffer(e)?e.toString(this.encoding):(0, Jp.isArrayBufferView)(e)?Kt.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(this.encoding):Kt.Buffer.from(e).toString(this.encoding)}};nt.PonyfillTextDecoder=fi;function Xp(t){return Kt.Buffer.from(t,"binary").toString("base64")}});var qc=c(on=>{Object.defineProperty(on,"__esModule",{value:true});on.PonyfillURLSearchParams=void 0;on.PonyfillURLSearchParams=globalThis.URLSearchParams;});var mi=c(ln=>{Object.defineProperty(ln,"__esModule",{value:true});ln.PonyfillWritableStream=void 0;var an=a("events"),di=a("stream"),Uc=Me(),ze=de(),pi=class{writable;constructor(e){if(e instanceof di.Writable)this.writable=e;else if(e){let r=new di.Writable({write(i,o,a){try{let c=e.write?.(i,s);c instanceof Promise?c.then(()=>{a();},l=>{a(l);}):a();}catch(c){a(c);}},final(i){let o=e.close?.();o instanceof Promise?o.then(()=>{i();},a=>{i(a);}):i();}});this.writable=r;let n=new AbortController,s={signal:n.signal,error(i){r.destroy(i);}};r.once("error",i=>n.abort(i)),r.once("close",()=>n.abort());}else this.writable=new di.Writable;}getWriter(){let e=this.writable;return {get closed(){return (0, an.once)(e,"close")},get desiredSize(){return e.writableLength},get ready(){return (0, an.once)(e,"drain")},releaseLock(){},write(r){let n=(0, ze.fakePromise)();return r==null?n:n.then(()=>(0, ze.safeWrite)(r,e))},close(){return !e.errored&&e.closed?(0, ze.fakePromise)():e.errored?(0, Uc.fakeRejectPromise)(e.errored):(0, ze.fakePromise)().then(()=>(0, ze.endStream)(e))},abort(r){return e.destroy(r),(0, an.once)(e,"close")}}}close(){return !this.writable.errored&&this.writable.closed?(0, ze.fakePromise)():this.writable.errored?(0, Uc.fakeRejectPromise)(this.writable.errored):(0, ze.fakePromise)().then(()=>(0, ze.endStream)(this.writable))}abort(e){return this.writable.destroy(e),(0, an.once)(this.writable,"close")}locked=false};ln.PonyfillWritableStream=pi;});var Jt=c(cn=>{Object.defineProperty(cn,"__esModule",{value:true});cn.PonyfillTransformStream=void 0;var bi=a("stream"),Yp=wt(),em=de(),tm=mi(),yi=class{transform;writable;readable;constructor(e){if(e instanceof bi.Transform)this.transform=e;else if(e){let r={enqueue(s){n.push(s);},error(s){n.destroy(s);},terminate(){(0, em.endStream)(n);},get desiredSize(){return n.writableLength}},n=new bi.Transform({read(){},write(s,i,o){try{let a=e.transform?.(s,r);a instanceof Promise?a.then(()=>{o();},c=>{o(c);}):o();}catch(a){o(a);}},final(s){try{let i=e.flush?.(r);i instanceof Promise?i.then(()=>{s();},o=>{s(o);}):s();}catch(i){s(i);}}});this.transform=n;}else this.transform=new bi.Transform;this.writable=new tm.PonyfillWritableStream(this.transform),this.readable=new Yp.PonyfillReadableStream(this.transform);}};cn.PonyfillTransformStream=yi;});var $c=c(un=>{Object.defineProperty(un,"__esModule",{value:true});un.PonyfillCompressionStream=void 0;var rm=(tt(),f(et)),Xt=rm.__importDefault(a("zlib")),nm=Jt(),sm=de(),gi=class extends nm.PonyfillTransformStream{static supportedFormats=(0, sm.getSupportedFormats)();constructor(e){switch(e){case "x-gzip":case "gzip":super(Xt.default.createGzip());break;case "x-deflate":case "deflate":super(Xt.default.createDeflate());break;case "deflate-raw":super(Xt.default.createDeflateRaw());break;case "br":super(Xt.default.createBrotliCompress());break;case "zstd":super(Xt.default.createZstdCompress());break;default:throw new Error(`Unsupported compression format: ${e}`)}}};un.PonyfillCompressionStream=gi;});var Bc=c(fn=>{Object.defineProperty(fn,"__esModule",{value:true});fn.PonyfillDecompressionStream=void 0;var im=(tt(),f(et)),Yt=im.__importDefault(a("zlib")),om=Jt(),am=de(),xi=class extends om.PonyfillTransformStream{static supportedFormats=(0, am.getSupportedFormats)();constructor(e){switch(e){case "x-gzip":case "gzip":super(Yt.default.createGunzip());break;case "x-deflate":case "deflate":super(Yt.default.createInflate());break;case "deflate-raw":super(Yt.default.createInflateRaw());break;case "br":super(Yt.default.createBrotliDecompress());break;case "zstd":super(Yt.default.createZstdDecompress());break;default:throw new TypeError(`Unsupported compression format: '${e}'`)}}};fn.PonyfillDecompressionStream=xi;});var zc=c(Ct=>{Object.defineProperty(Ct,"__esModule",{value:true});Ct.PonyfillTextEncoderStream=Ct.PonyfillTextDecoderStream=void 0;var Mc=hi(),Gc=Jt(),_i=class extends Gc.PonyfillTransformStream{textDecoder;constructor(e,r){super({transform:(n,s)=>s.enqueue(this.textDecoder.decode(n,{stream:true}))}),this.textDecoder=new Mc.PonyfillTextDecoder(e,r);}get encoding(){return this.textDecoder.encoding}get fatal(){return this.textDecoder.fatal}get ignoreBOM(){return this.textDecoder.ignoreBOM}};Ct.PonyfillTextDecoderStream=_i;var Si=class extends Gc.PonyfillTransformStream{textEncoder;constructor(e){super({transform:(r,n)=>n.enqueue(this.textEncoder.encode(r))}),this.textEncoder=new Mc.PonyfillTextEncoder(e);}get encoding(){return this.textEncoder.encoding}encode(e){return this.textEncoder.encode(e)}};Ct.PonyfillTextEncoderStream=Si;});var Vc=c(F=>{Object.defineProperty(F,"__esModule",{value:true});F.TextEncoderStream=F.TextDecoderStream=F.IteratorObject=F.DecompressionStream=F.CompressionStream=F.TransformStream=F.WritableStream=F.URLSearchParams=F.URL=F.btoa=F.TextDecoder=F.TextEncoder=F.Blob=F.FormData=F.File=F.ReadableStream=F.Response=F.Request=F.Body=F.Headers=F.fetch=void 0;var lm=Nc();Object.defineProperty(F,"fetch",{enumerable:true,get:function(){return lm.fetchPonyfill}});var cm=Yr();Object.defineProperty(F,"Headers",{enumerable:true,get:function(){return cm.PonyfillHeaders}});var um=Xr();Object.defineProperty(F,"Body",{enumerable:true,get:function(){return um.PonyfillBody}});var fm=nn();Object.defineProperty(F,"Request",{enumerable:true,get:function(){return fm.PonyfillRequest}});var hm=Qt();Object.defineProperty(F,"Response",{enumerable:true,get:function(){return hm.PonyfillResponse}});var dm=wt();Object.defineProperty(F,"ReadableStream",{enumerable:true,get:function(){return dm.PonyfillReadableStream}});var pm=Gs();Object.defineProperty(F,"File",{enumerable:true,get:function(){return pm.PonyfillFile}});var mm=Xs();Object.defineProperty(F,"FormData",{enumerable:true,get:function(){return mm.PonyfillFormData}});var bm=$r();Object.defineProperty(F,"Blob",{enumerable:true,get:function(){return bm.PonyfillBlob}});var wi=hi();Object.defineProperty(F,"TextEncoder",{enumerable:true,get:function(){return wi.PonyfillTextEncoder}});Object.defineProperty(F,"TextDecoder",{enumerable:true,get:function(){return wi.PonyfillTextDecoder}});Object.defineProperty(F,"btoa",{enumerable:true,get:function(){return wi.PonyfillBtoa}});var ym=Zt();Object.defineProperty(F,"URL",{enumerable:true,get:function(){return ym.PonyfillURL}});var gm=qc();Object.defineProperty(F,"URLSearchParams",{enumerable:true,get:function(){return gm.PonyfillURLSearchParams}});var xm=mi();Object.defineProperty(F,"WritableStream",{enumerable:true,get:function(){return xm.PonyfillWritableStream}});var _m=Jt();Object.defineProperty(F,"TransformStream",{enumerable:true,get:function(){return _m.PonyfillTransformStream}});var Sm=$c();Object.defineProperty(F,"CompressionStream",{enumerable:true,get:function(){return Sm.PonyfillCompressionStream}});var wm=Bc();Object.defineProperty(F,"DecompressionStream",{enumerable:true,get:function(){return wm.PonyfillDecompressionStream}});var Em=Zr();Object.defineProperty(F,"IteratorObject",{enumerable:true,get:function(){return Em.PonyfillIteratorObject}});var Hc=zc();Object.defineProperty(F,"TextDecoderStream",{enumerable:true,get:function(){return Hc.PonyfillTextDecoderStream}});Object.defineProperty(F,"TextEncoderStream",{enumerable:true,get:function(){return Hc.PonyfillTextEncoderStream}});});var Qc=c((g_,Wc)=>{var Tm=is(),G;Wc.exports=function(e={}){let r={};if(r.URLPattern=globalThis.URLPattern,!r.URLPattern){let n=Za();r.URLPattern=n.URLPattern;}if(e.skipPonyfill||Tm())return {fetch:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response,FormData:globalThis.FormData,ReadableStream:globalThis.ReadableStream,WritableStream:globalThis.WritableStream,TransformStream:globalThis.TransformStream,CompressionStream:globalThis.CompressionStream,DecompressionStream:globalThis.DecompressionStream,TextDecoderStream:globalThis.TextDecoderStream,TextEncoderStream:globalThis.TextEncoderStream,Blob:globalThis.Blob,File:globalThis.File,crypto:globalThis.crypto,btoa:globalThis.btoa,TextEncoder:globalThis.TextEncoder,TextDecoder:globalThis.TextDecoder,URLPattern:r.URLPattern,URL:globalThis.URL,URLSearchParams:globalThis.URLSearchParams};if(G||=Vc(),r.fetch=G.fetch,r.Request=G.Request,r.Response=G.Response,r.Headers=G.Headers,r.FormData=G.FormData,r.ReadableStream=G.ReadableStream,r.URL=G.URL,r.URLSearchParams=G.URLSearchParams,r.WritableStream=G.WritableStream,r.TransformStream=G.TransformStream,r.CompressionStream=G.CompressionStream,r.DecompressionStream=G.DecompressionStream,r.TextDecoderStream=G.TextDecoderStream,r.TextEncoderStream=G.TextEncoderStream,r.Blob=G.Blob,r.File=G.File,r.crypto=globalThis.crypto,r.btoa=G.btoa,r.TextEncoder=G.TextEncoder,r.TextDecoder=G.TextDecoder,e.formDataLimits&&(r.Body=class extends G.Body{constructor(s,i){super(s,{formDataLimits:e.formDataLimits,...i});}},r.Request=class extends G.Request{constructor(s,i){super(s,{formDataLimits:e.formDataLimits,...i});}},r.Response=class extends G.Response{constructor(s,i){super(s,{formDataLimits:e.formDataLimits,...i});}}),!r.crypto){let n=a("crypto");r.crypto=n.webcrypto;}return r};});var er=c((Kc,H)=>{var Zc=Qc(),Pm=is(),W=Zc();if(!Pm())try{let t="node-libcurl";globalThis.libcurl=globalThis.libcurl||a(t);}catch{}H.exports.fetch=W.fetch;H.exports.Headers=W.Headers;H.exports.Request=W.Request;H.exports.Response=W.Response;H.exports.FormData=W.FormData;H.exports.ReadableStream=W.ReadableStream;H.exports.WritableStream=W.WritableStream;H.exports.TransformStream=W.TransformStream;H.exports.CompressionStream=W.CompressionStream;H.exports.DecompressionStream=W.DecompressionStream;H.exports.TextDecoderStream=W.TextDecoderStream;H.exports.TextEncoderStream=W.TextEncoderStream;H.exports.Blob=W.Blob;H.exports.File=W.File;H.exports.crypto=W.crypto;H.exports.btoa=W.btoa;H.exports.TextEncoder=W.TextEncoder;H.exports.TextDecoder=W.TextDecoder;H.exports.URLPattern=W.URLPattern;H.exports.URL=W.URL;H.exports.URLSearchParams=W.URLSearchParams;Kc.createFetch=Zc;});function hr(t,e){for(let r of t){if(r.name===e)return true;if("tabs"in r&&r.tabs){for(let n of r.tabs)if(hr(n.fields,e))return true}if("fields"in r&&r.fields&&hr(r.fields,e))return true}return false}var Un=class extends Error{errors;constructor(e){super(`Configuration validation failed:
|
|
19
|
+
${e.join(`
|
|
20
|
+
`)}`),this.name="ConfigValidationError",this.errors=e;}};function $n(t){let e=[];if(t.slug?/^[a-z][a-z0-9_-]*$/.test(t.slug)||e.push(`Collection slug "${t.slug}" must be lowercase alphanumeric with dashes`):e.push('Collection is missing a "slug" property'),!t.fields||t.fields.length===0)e.push(`Collection "${t.slug}" has no fields defined`);else {let r=Ve(t.fields,t.slug);e.push(...r);}if(t.access)for(let[r,n]of Object.entries(t.access))typeof n!="boolean"&&typeof n!="function"&&e.push(`Collection "${t.slug}" has invalid access.${r} (must be boolean or function)`);if(t.admin?.useAsTitle&&(hr(t.fields,t.admin.useAsTitle)||e.push(`Collection "${t.slug}" admin.useAsTitle references unknown field "${t.admin.useAsTitle}"`)),t.admin?.defaultColumns)for(let r of t.admin.defaultColumns)hr(t.fields,r)||e.push(`Collection "${t.slug}" admin.defaultColumns references unknown field "${r}"`);if(t.upload&&t.upload.fileSize&&t.upload.fileSize<=0&&e.push(`Collection "${t.slug}" upload.fileSize must be positive`),t.versions&&t.versions.maxPerDoc&&t.versions.maxPerDoc<=0&&e.push(`Collection "${t.slug}" versions.maxPerDoc must be positive`),t.auth){let r=t.fields.some(s=>s.name==="email"),n=t.fields.some(s=>s.name==="password");r||e.push(`Collection "${t.slug}" with auth enabled requires an "email" field`),n||e.push(`Collection "${t.slug}" with auth enabled requires a "password" field`);}return e}function Bn(t){let e=[];if(t.slug?/^[a-z][a-z0-9_-]*$/.test(t.slug)||e.push(`Global slug "${t.slug}" must be lowercase alphanumeric with dashes`):e.push('Global is missing a "slug" property'),!t.fields||t.fields.length===0)e.push(`Global "${t.slug}" has no fields defined`);else {let r=Ve(t.fields,`global:${t.slug}`);e.push(...r);}return e}function Ve(t,e){let r=[],n=new Set;for(let s=0;s<t.length;s++){let i=t[s];if(i.type==="row"||i.type==="collapsible"||i.type==="tabs"){if("fields"in i&&i.fields){let a=Ve(i.fields,e);r.push(...a);}else if("tabs"in i)for(let a of i.tabs){let c=Ve(a.fields,e);r.push(...c);}continue}let o=i.name;if(!o){r.push(`${e}: Field at index ${s} is missing a "name" property`);continue}if(n.has(o)&&r.push(`${e}: Duplicate field name "${o}"`),n.add(o),/^[a-zA-Z][a-zA-Z0-9_]*$/.test(o)||r.push(`${e}: Field name "${o}" must be alphanumeric with underscores`),!i.type){r.push(`${e}: Field "${o}" is missing a "type" property`);continue}switch(i.type){case "relationship":i.relationTo||r.push(`${e}: Relationship field "${o}" is missing "relationTo"`);break;case "array":if(!i.fields||i.fields.length===0)r.push(`${e}: Array field "${o}" has no fields defined`);else {let a=Ve(i.fields,`${e}.${o}`);r.push(...a);}break;case "group":if(!i.fields||i.fields.length===0)r.push(`${e}: Group field "${o}" has no fields defined`);else {let a=Ve(i.fields,`${e}.${o}`);r.push(...a);}break;case "blocks":if(!i.blocks||i.blocks.length===0)r.push(`${e}: Blocks field "${o}" has no blocks defined`);else {let a=ff(i.blocks,`${e}.${o}`);r.push(...a);}break;case "select":case "radio":if((!i.options||i.options.length===0)&&!i.dynamicOptions)r.push(`${e}: ${i.type} field "${o}" has no options defined`);else if(i.options){let a=i.options.map(l=>l.value),c=new Set(a);a.length!==c.size&&r.push(`${e}: ${i.type} field "${o}" has duplicate option values`);}break;case "upload":i.relationTo||r.push(`${e}: Upload field "${o}" is missing "relationTo"`);break}"min"in i&&"max"in i&&i.min>i.max&&r.push(`${e}: Field "${o}" has min greater than max`),"minLength"in i&&"maxLength"in i&&i.minLength>i.maxLength&&r.push(`${e}: Field "${o}" has minLength greater than maxLength`),"minRows"in i&&"maxRows"in i&&i.minRows>i.maxRows&&r.push(`${e}: Field "${o}" has minRows greater than maxRows`);}return r}function ff(t,e){let r=[],n=new Set;for(let s of t){if(!s.slug){r.push(`${e}: Block is missing a "slug" property`);continue}if(n.has(s.slug)&&r.push(`${e}: Duplicate block slug "${s.slug}"`),n.add(s.slug),s.label||r.push(`${e}: Block "${s.slug}" is missing a "label" property`),!s.fields||s.fields.length===0)r.push(`${e}: Block "${s.slug}" has no fields defined`);else {let i=Ve(s.fields,`${e}.${s.slug}`);r.push(...i);}}return r}function fo(t,e=[]){let r=[],n=new Set;for(let s of t)n.has(s.slug)&&r.push(`Duplicate collection slug "${s.slug}"`),n.add(s.slug);for(let s of e)n.has(s.slug)&&r.push(`Duplicate global slug "${s.slug}"`),n.add(s.slug);for(let s of t){let i=$n(s);r.push(...i);}for(let s of e){let i=Bn(s);r.push(...i);}for(let s of t){let i=fr(s.fields,t);r.push(...i);}if(r.length>0)throw new Un(r)}function fr(t,e){let r=[],n=new Set(e.map(s=>s.slug));for(let s of t){if(s.type==="relationship"){let i=Array.isArray(s.relationTo)?s.relationTo:[s.relationTo];for(let o of i)n.has(o)||console.warn(`[Kyro Config Warning]: Relationship field "${s.name}" references unknown collection "${o}". Select options will not be available until this collection is registered.`);}if(s.type==="upload"){let i=Array.isArray(s.relationTo)?s.relationTo:[s.relationTo];for(let o of i)n.has(o)||r.push(`Upload field "${s.name}" references unknown collection "${o}"`);}if("fields"in s&&s.fields){let i=fr(s.fields,e);r.push(...i);}if("tabs"in s)for(let i of s.tabs){let o=fr(i.fields,e);r.push(...o);}if("blocks"in s)for(let i of s.blocks){let o=fr(i.fields,e);r.push(...o);}}return r}function se(t){switch(t.type){case "text":return hf(t);case "number":return df(t);case "checkbox":return pf(t);case "date":return mf(t);case "email":return bf(t);case "password":return yf(t);case "textarea":return gf(t);case "select":return xf(t);case "radio":return _f(t);case "color":return Sf(t);case "richtext":return wf(t);case "json":return Ef(t);case "code":return Tf(t);case "upload":return ho(t);case "image":return ho(t);case "markdown":return Pf(t);case "relationship":return po(t);case "relationship-block":return po(t);case "array":return Cf(t);case "list":return Af(t);case "group":return Rf(t);case "blocks":return vf(t);case "row":return kf(t);case "collapsible":return Df(t);case "tabs":return Lf(t);default:return z.any()}}function hf(t){let e=z.string();return t.minLength&&(e=e.min(t.minLength)),t.maxLength&&(e=e.max(t.maxLength)),t.pattern&&(e=e.regex(new RegExp(t.pattern))),t.variant==="email"&&(e=e.email()),t.variant==="url"&&(e=e.url()),t.hasMany&&(e=z.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function df(t){let e=t.integer?z.coerce.number().int():z.coerce.number();return t.min!==void 0&&(e=e.min(t.min)),t.max!==void 0&&(e=e.max(t.max)),t.step&&(e=e.refine(r=>Number.isInteger(r/t.step),`Value must be divisible by ${t.step}`)),t.hasMany&&(e=z.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function pf(t){let e=z.boolean();return t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function mf(t){let e=z.string().refine(r=>!isNaN(Date.parse(r)),"Invalid date format");return t.minDate&&(e=e.refine(r=>new Date(r)>=new Date(t.minDate),`Date must be after ${t.minDate}`)),t.maxDate&&(e=e.refine(r=>new Date(r)<=new Date(t.maxDate),`Date must be before ${t.maxDate}`)),t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function bf(t){let e=z.string().email("Invalid email");return t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function yf(t){let e=z.string().min(6,"Password must be at least 6 characters");return t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function gf(t){let e=z.string();return t.minLength&&(e=e.min(t.minLength)),t.maxLength&&(e=e.max(t.maxLength)),t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function xf(t){let e;if(t.options&&t.options.length>0){let r=t.options.map(n=>n.value);t.hasMany?e=z.array(z.enum(r)):e=z.enum(r);}else e=t.hasMany?z.array(z.string()):z.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function _f(t){let e=t.options.map(n=>n.value),r=z.enum(e);return t.required||(r=r.optional().nullable()),t.validate&&(r=J(r,t.validate)),r}function Sf(t){let e=z.string();return t.format==="hex"&&(e=e.regex(/^#[0-9A-Fa-f]{6}$/)),t.format==="rgb"&&(e=e.regex(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/)),t.format==="hsl"&&(e=e.regex(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/)),t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function wf(t){let e=z.array(z.record(z.any()));return t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function Ef(t){let e=z.union([z.record(z.any()),z.array(z.any())]);return t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function Tf(t){let e=z.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function ho(t){let e;if(t.relationTo){let r=z.object({id:z.string(),url:z.string().optional(),filename:z.string().optional(),mimeType:z.string().optional()});e=z.union([z.string(),r]);}else e=z.string();return t.hasMany&&(e=z.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function Pf(t){let e=z.string();return t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function po(t){let e;return Array.isArray(t.relationTo)?e=z.object({relationTo:z.enum(t.relationTo),value:z.string()}):e=z.union([z.string(),z.object({relationTo:z.string(),value:z.string()})]),t.hasMany&&(e=z.array(e)),t.required||(e=e.optional().nullable()),t.validate&&(e=J(e,t.validate)),e}function Cf(t){let e=z.object(Object.fromEntries(t.fields.filter(n=>n.name).map(n=>[n.name,se(n)]))),r=z.array(e);return t.minRows&&(r=r.min(t.minRows)),t.maxRows&&(r=r.max(t.maxRows)),t.required||(r=r.optional().nullable()),t.validate&&(r=J(r,t.validate)),r}function Af(t){let e=z.array(z.string());return t.required||(e=e.optional().nullable()),e}function Rf(t){let e=z.object(Object.fromEntries(t.fields.filter(r=>r.name).map(r=>[r.name,se(r)])));return t.required?e:e.optional().nullable()}function vf(t){let e=t.blocks||[];e.map(i=>z.object({blockType:z.literal(i.slug),...Object.fromEntries(i.fields.filter(o=>o.name).map(o=>[o.name,se(o)]))}));let n=e.map(i=>i.slug),s;if(n.length>0){let i=z.object({blockType:z.enum(n)}).catchall(z.any()),o=z.object({blockType:z.string()}).catchall(z.any());s=z.array(z.union([i,o,z.record(z.any())]));}else s=z.array(z.union([z.object({blockType:z.string()}).catchall(z.any()),z.record(z.any())]));return t.minRows&&(s=s.min(t.minRows)),t.maxRows&&(s=s.max(t.maxRows)),t.required||(s=s.optional().nullable()),t.validate&&(s=J(s,t.validate)),s}function kf(t){return z.object(Object.fromEntries(t.fields.filter(r=>r.name).map(r=>[r.name,se(r)])))}function Df(t){return z.object(Object.fromEntries(t.fields.filter(r=>r.name).map(r=>[r.name,se(r)])))}function Lf(t){let e={};for(let r of t.tabs)for(let n of r.fields)n.name&&(e[n.name]=se(n));return z.object(e).passthrough().optional()}function J(t,e){return t.refine(async r=>await e(r,{required:false})===true,{message:"Custom validation failed"})}function ut(t){let e={};for(let r of t)if(r.name)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs){let i=ut(s.fields);Object.assign(n,i);}e[r.name]=z.object(n).passthrough().optional();}else if(r.type==="row"&&"fields"in r){let n=ut(r.fields);Object.assign(e,n);}else r.type==="collapsible"&&"fields"in r?e[r.name]=z.object(ut(r.fields)).passthrough().optional():e[r.name]=se(r);return e}function Ie(t){let e={};for(let r of t)if(r.name)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs){let i=Ie(s.fields);Object.assign(n,i);}e[r.name]=z.object(n).passthrough().optional().nullable();}else if(r.type==="row"&&"fields"in r){let n=Ie(r.fields);Object.assign(e,n);}else r.type==="collapsible"&&"fields"in r?e[r.name]=z.object(Ie(r.fields)).passthrough().optional().nullable():r.type==="group"&&"fields"in r?e[r.name]=z.object(Ie(r.fields)).passthrough().optional().nullable():e[r.name]=se(r).optional().nullable();return e}function mo(t){let e=ut(t.fields);return t.timestamps&&(e.createdAt=z.string().optional(),e.updatedAt=z.string().optional()),t.tenantScoped&&(e.tenantID=z.string().optional()),e.id=z.string().optional(),z.object(e).passthrough()}function bo(t){let e=ut(t.fields);return z.object(e).passthrough()}function yo(t){let e={};for(let r of t.fields)if(r.name)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs)for(let i of s.fields)i.name&&(n[i.name]=se(i).optional().nullable());e[r.name]=z.object(n).optional().nullable();}else if(r.type==="row"&&"fields"in r){let n={};for(let s of r.fields)s.name&&(n[s.name]=se(s).optional().nullable());Object.assign(e,n);}else r.type==="collapsible"&&"fields"in r?e[r.name]=z.object(Ie(r.fields)).optional().nullable():r.type==="group"&&"fields"in r?e[r.name]=z.object(Ie(r.fields)).optional().nullable():e[r.name]=se(r).optional().nullable();return z.object(e).passthrough()}function go(t){let e={};for(let r of t.fields)r.name&&(e[r.name]=z.object({equals:z.any().optional(),not_equals:z.any().optional(),in:z.array(z.any()).optional(),not_in:z.array(z.any()).optional(),greater_than:z.number().optional(),greater_than_equal:z.number().optional(),less_than:z.number().optional(),less_than_equal:z.number().optional(),like:z.string().optional(),not_like:z.string().optional(),contains:z.string().optional(),exists:z.boolean().optional()}).optional());return e.AND=z.array(z.lazy(()=>z.object(e))).optional(),e.OR=z.array(z.lazy(()=>z.object(e))).optional(),z.object(e).optional()}function xo(t){let e=ut(t.fields);return e.id=z.string().optional(),z.object(e).passthrough()}function _o(t){let e={};for(let r of t.fields)if(r.name)if(r.type==="tabs"&&"tabs"in r){let n={};for(let s of r.tabs)for(let i of s.fields)i.name&&(n[i.name]=se(i).optional().nullable());e[r.name]=z.object(n).optional().nullable();}else r.type==="collapsible"&&"fields"in r?e[r.name]=z.object(Ie(r.fields)).optional().nullable():r.type==="group"&&"fields"in r?e[r.name]=z.object(Ie(r.fields)).optional().nullable():e[r.name]=se(r).optional().nullable();return z.object(e).passthrough()}var Ot=class{storageProviders=f$1();collections=new Map;globals=new Map;plugins=[];schemaCache=new Map;initialized=false;addCollection(e){if(this.initialized)throw new Error("Cannot add collections after Registry has been initialized");if(this.collections.has(e.slug)){console.warn(`[Registry] Duplicate collection slug "${e.slug}" \u2014 skipping`);return}let r={...e};for(let s of this.plugins)s.extendCollection&&(r=s.extendCollection(r.slug,r));r.fields=this.applyFieldDefaults(r);let n=$n(r);if(n.length>0)throw new Error(`Invalid collection config: ${n.join(", ")}`);this.collections.set(r.slug,r),this.clearSchemaCache(r.slug);}addCollections(e){for(let r of e)this.addCollection(r);}getCollection(e){return this.collections.get(e)}getCollections(){return Array.from(this.collections.values())}getCollectionSlugs(){return Array.from(this.collections.keys())}hasCollection(e){return this.collections.has(e)}removeCollection(e){if(this.initialized)throw new Error("Cannot remove collections after Registry has been initialized");return this.clearSchemaCache(e),this.collections.delete(e)}addGlobal(e){if(this.initialized)throw new Error("Cannot add globals after Registry has been initialized");this._addGlobalUnsafe(e);}addGlobalPostInit(e){this.globals.has(e.slug)&&this.globals.delete(e.slug),this._addGlobalUnsafe(e);}_addGlobalUnsafe(e){if(this.globals.has(e.slug)){console.warn(`[Registry] Duplicate global slug "${e.slug}" \u2014 skipping`);return}let r=Bn(e);if(r.length>0)throw new Error(`Invalid global config: ${r.join(", ")}`);let n={...e};for(let s of this.plugins)s.extendGlobal&&(n=s.extendGlobal(n.slug,n));this.globals.set(n.slug,n),this.clearSchemaCache(`global:${n.slug}`);}addGlobals(e){for(let r of e)this.addGlobal(r);}getGlobal(e){return this.globals.get(e)}getGlobals(){return Array.from(this.globals.values())}getGlobalSlugs(){return Array.from(this.globals.keys())}hasGlobal(e){return this.globals.has(e)}removeGlobal(e){if(this.initialized)throw new Error("Cannot remove globals after Registry has been initialized");return this.clearSchemaCache(`global:${e}`),this.globals.delete(e)}addPlugin(e){if(this.initialized)throw new Error("Cannot add plugins after Registry has been initialized");this.plugins.push(e);}getPlugins(){return [...this.plugins]}getZodSchema(e){let r=this.schemaCache.get(e);if(r)return r;let n=this.collections.get(e);if(n){let i=mo(n);return this.schemaCache.set(e,i),i}let s=this.globals.get(e);if(s){let i=xo(s);return this.schemaCache.set(`global:${e}`,i),i}throw new Error(`No collection or global found with slug "${e}"`)}getCreateZodSchema(e){let r=`${e}:create`,n=this.schemaCache.get(r);if(n)return n;let s=this.collections.get(e);if(s){let i=bo(s);return this.schemaCache.set(r,i),i}throw new Error(`No collection found with slug "${e}"`)}getUpdateZodSchema(e){let r=`${e}:update`,n=this.schemaCache.get(r);if(n)return n;let s=this.collections.get(e);if(s){let o=yo(s);return this.schemaCache.set(r,o),o}let i=this.globals.get(e);if(i){let o=_o(i);return this.schemaCache.set(`global:${e}:update`,o),o}throw new Error(`No collection or global found with slug "${e}"`)}getWhereZodSchema(e){let r=`${e}:where`,n=this.schemaCache.get(r);if(n)return n;let s=this.collections.get(e);if(s){let i=go(s);return this.schemaCache.set(r,i),i}throw new Error(`No collection found with slug "${e}"`)}getFieldZodSchema(e){return se(e)}clearSchemaCache(e){this.schemaCache.delete(e),this.schemaCache.delete(`${e}:create`),this.schemaCache.delete(`${e}:update`),this.schemaCache.delete(`${e}:where`);}applyFieldDefaults(e){let r=[...e.fields];return r.some(n=>n.name==="id")||r.unshift({name:"id",type:"text",admin:{readOnly:true,hidden:true}}),e.tenantScoped&&!r.some(n=>n.name==="tenantID")&&r.push({name:"tenantID",type:"text",required:true,admin:{readOnly:true,hidden:true}}),e.timestamps&&!r.some(n=>n.name==="createdAt")&&(r.push({name:"createdAt",type:"date",admin:{readOnly:true,hidden:true}}),r.push({name:"updatedAt",type:"date",admin:{readOnly:true,hidden:true}})),e.versions?.drafts&&!r.some(n=>n.name==="status")&&r.push({name:"status",type:"select",options:[{value:"draft",label:"Draft"},{value:"published",label:"Published"}],admin:{readOnly:true,hidden:true}}),e.auth&&!r.some(n=>n.name==="password")&&r.push({name:"password",type:"password",required:true,admin:{hidden:true}}),r}getFields(e){let r=this.collections.get(e);if(r)return r.fields;let n=this.globals.get(e);if(n)return n.fields;throw new Error(`No collection or global found with slug "${e}"`)}getFieldMap(e){let r=this.getFields(e),n=new Map,s=i=>{for(let o of i){if(o.name&&n.set(o.name,o),"fields"in o&&o.fields&&s(o.fields),"tabs"in o)for(let a of o.tabs)s(a.fields);if("blocks"in o)for(let a of o.blocks)s(a.fields);}};return s(r),n}getVisibleFields(e){return this.getFields(e).filter(n=>!n.admin?.hidden)}validate(){let e=this.getCollections(),r=this.getGlobals();fo(e,r);}async init(e){this.validate();for(let r of this.plugins)r.init&&await r.init(e||this);this.initialized=true;}isInitialized(){return this.initialized}getPaginationDefaults(e){let r=this.collections.get(e);return {defaultLimit:r?.admin?.pagination?.defaultLimit||10,limits:r?.admin?.pagination?.limits||[10,25,50,100]}}getDefaultSort(e){let n=this.collections.get(e)?.admin?.useAsTitle;return n||"createdAt"}getDefaultColumns(e){let r=this.collections.get(e);return r?.admin?.defaultColumns?r.admin.defaultColumns:this.getVisibleFields(e).slice(0,4).map(s=>s.name)}getAdminTitle(e){let r=this.collections.get(e);return r?.label||r?.admin?.description||e}getAdminLabel(e){let r=this.collections.get(e);return r?.singularLabel||r?.label||e}getAdminGroup(e){return this.collections.get(e)?.admin?.group}getStats(){let e=0;for(let r of this.collections.values())e+=r.fields.length;for(let r of this.globals.values())e+=r.fields.length;return {collections:this.collections.size,globals:this.globals.size,plugins:this.plugins.length,fields:e}}toJSON(){return {collections:this.getCollections(),globals:this.getGlobals()}}},ft=null;function Of(){return ft||(ft=new Ot),ft}function If(){ft=null;}function Mn(){return ft=new Ot,ft}var Fe={red:"\x1B[31m",yellow:"\x1B[33m",magenta:"\x1B[35m",cyan:"\x1B[36m",reset:"\x1B[0m"},So=Fe.yellow+"WARN"+Fe.reset,wo=Fe.cyan+"INFO"+Fe.reset,Eo=Fe.red+"ERR"+Fe.reset,To=Fe.magenta+"DEBUG"+Fe.reset,It={debug:0,info:1,warn:2,error:3,silent:4},dr=()=>{},pr=t=>(...e)=>console.log(t,...e),Ff=console.debug?(...t)=>console.debug(To,...t):pr(To),jf=console.info?(...t)=>console.info(wo,...t):pr(wo),Nf=console.warn?(...t)=>console.warn(So,...t):pr(So),qf=console.error?(...t)=>console.error(Eo,...t):pr(Eo),mr=(t=globalThis.process?.env.DEBUG==="1"?"debug":"info")=>{let e=It[t];return {debug:e>It.debug?dr:Ff,info:e>It.info?dr:jf,warn:e>It.warn?dr:Nf,error:e>It.error?dr:qf}};var br=Symbol.for("@whatwg-node/promise-helpers/FakePromise");function $(t){return t?.then!=null}function Uf(t){let e=t;return e&&e.then&&e.catch&&e.finally}function C(t,e,r,n){let s=U().then(t).then(e,r);return jt(s)}function U(t){return t&&Uf(t)?t:$(t)?{then:(e,r)=>U(t.then(e,r)),catch:e=>U(t.then(r=>r,e)),finally:e=>U(e?Mf(t,e):t),[Symbol.toStringTag]:"Promise"}:{then(e){if(e)try{return U(e(t))}catch(r){return ht(r)}return this},catch(){return this},finally(e){if(e)try{return U(e()).then(()=>t,()=>t)}catch(r){return ht(r)}return this},[Symbol.toStringTag]:"Promise",__fakePromiseValue:t,[br]:"resolved"}}function Ft(){if(Promise.withResolvers)return Promise.withResolvers();let t,e;return {promise:new Promise(function(s,i){t=s,e=i;}),get resolve(){return t},get reject(){return e}}}function V(t,e,r){if(t?.length===0)return;let n=t[Symbol.iterator](),s=0;function i(){let{done:o,value:a}=n.next();if(o)return;let c=false;function l(){c=true;}return C(function(){return e(a,l,s++)},function(f){if(f&&r?.push(f),!c)return i()})}return i()}function ht(t){return {then(e,r){if(r)try{return U(r(t))}catch(n){return ht(n)}return this},catch(e){if(e)try{return U(e(t))}catch(r){return ht(r)}return this},finally(e){if(e)try{e();}catch(r){return ht(r)}return this},__fakeRejectError:t,[Symbol.toStringTag]:"Promise",[br]:"rejected"}}function Re(t,e,r,n){Symbol.asyncIterator in t&&(t=t[Symbol.asyncIterator]());let s,i,o;typeof t.return=="function"&&(s=t.return,i=l=>{let u=()=>{throw l};return s.call(t).then(u,u)});function a(l){return l.done?l:C(()=>l.value,u=>C(()=>e(u),Po,i))}let c;if(r){let l,u=r;c=f=>(l||=C(()=>f,d=>C(()=>u(d),Po,i)),l);}return {next(){return t.next().then(a,c)},return(){let l=s?s.call(t).then(a,c):U({value:void 0,done:true});return o?l.then(o):l},throw(l){return typeof t.throw=="function"?t.throw(l).then(a,c):i?i(l):ht(l)},[Symbol.asyncIterator](){return this}}}function Po(t){return {value:t,done:false}}function $f(t){return t?.[br]==="resolved"}function Bf(t){return t?.[br]==="rejected"}function Mf(t,e){return "finally"in t?t.finally(e):t.then(r=>{let n=e();return $(n)?n.then(()=>r):r},r=>{let n=e();if($(n))return n.then(()=>{throw r});throw r})}function jt(t){if($f(t))return t.__fakePromiseValue;if(Bf(t))throw t.__fakeRejectError;return t}var Co='<!doctype html><html lang=en><head><meta charset=utf-8><title>__TITLE__</title><link rel=icon href=https://raw.githubusercontent.com/graphql-hive/graphql-yoga/refs/heads/main/website/src/app/favicon.ico><link crossorigin rel=stylesheet href=https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/graphiql.css></head><body id=body class=no-focus-outline><noscript>You need to enable JavaScript to run this app.</noscript><div id=root>Loading __TITLE__...</div><script>function prepareBlob(r){const o=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(o)}const workers={},workerUrls={editorWorkerService:"https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/monacoeditorwork/editor.worker.bundle.js",json:"https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/monacoeditorwork/json.worker.bundle.js",graphql:"https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/monacoeditorwork/graphql.worker..bundle.js"};function prepareWorkers(){return Promise.all(Object.entries(workerUrls).map(async([r,o])=>{const e=await fetch(o),t=await e.text();workers[r]=prepareBlob(t)}))}self.MonacoEnvironment={globalAPI:!1,getWorkerUrl:function(r,o){return workers[o]}}</script><script src=https://unpkg.com/@graphql-yoga/graphiql@4.4.4/dist/yoga-graphiql.umd.js></script><script>prepareWorkers().finally(()=>{YogaGraphiQL.renderYogaGraphiQL(root,__OPTS__)})</script></body></html>';function Gf({headers:t,method:e}){return e==="GET"&&!!t?.get("accept")?.includes("text/html")}var zf=t=>Co.replace("__TITLE__",t?.title||"Yoga GraphiQL").replace("__OPTS__",JSON.stringify(t??{}));function Ao(t){let e=t.logger??console,r;typeof t?.options=="function"?r=t?.options:typeof t?.options=="object"?r=()=>t?.options:t?.options===false?r=()=>false:r=()=>({});let n=t?.render??zf;return {onRequest({request:s,serverContext:i,fetchAPI:o,endResponse:a,url:c}){let l=t.getGraphQLEndpoint();if(Gf(s)&&(s.url.endsWith(l)||s.url.endsWith(`${l}/`)||c.pathname===l||c.pathname===`${l}/`||t.getGraphQLEndpointURLPattern().test(c)))return e.debug("Rendering GraphiQL"),C(()=>r(s,i),u=>{if(u)return C(()=>n({...u===true?{}:u}),f=>{let d=new o.Response(f,{headers:{"Content-Type":"text/html"},status:200});a(d);})})}}}function Gn(t){return t?.[Symbol.toStringTag]==="GraphQLSchema"}var Ro=t=>{if(t==null)return {};if(Gn(t))return {onPluginInit({setSchema:e}){e(t);}};if("then"in t){let e;return {onRequestParse(){return {onRequestParseDone(){if(!e)return C(()=>t,r=>{e=r;})}}},onEnveloped({setSchema:r}){if(e==null)throw new Error("You provide a promise of a schema but it hasn't been resolved yet. Make sure you use this plugin with GraphQL Yoga.");if(!Gn(e))throw new Error("The resolved schema is not a valid GraphQLSchema instance.");r(e);}}}if(typeof t=="function"){let e=new WeakMap;return {onRequestParse({request:r,serverContext:n}){return {onRequestParseDone(){return C(()=>t({...n,request:r}),s=>{if(!Gn(s))throw new Error("The factory function did not return a valid GraphQLSchema.");e.set(r,s);})}}},onEnveloped({setSchema:r,context:n}){if(n?.request==null)throw new Error("Request object is not available in the context. Make sure you use this plugin with GraphQL Yoga.");let s=e.get(n.request);if(s==null)throw new Error("No schema found for this request. Make sure you use this plugin with GraphQL Yoga.");r(s);}}}throw new Error("Invalid schema definition provided, expected a schema, promise or function.")};function X(t){return yr(t,[])}function yr(t,e){switch(typeof t){case "string":return JSON.stringify(t);case "function":return t.name?`[function ${t.name}]`:"[function]";case "object":return Hf(t,e);default:return String(t)}}function vo(t){return (t.name="GraphQLError")?t.toString():`${t.name}: ${t.message};
|
|
21
|
+
${t.stack}`}function Hf(t,e){if(t===null)return "null";if(t instanceof Error)return t.name==="AggregateError"?vo(t)+`
|
|
22
|
+
`+ko(t.errors,e):vo(t);if(e.includes(t))return "[Circular]";let r=[...e,t];if(Vf(t)){let n=t.toJSON();if(n!==t)return typeof n=="string"?n:yr(n,r)}else if(Array.isArray(t))return ko(t,r);return Wf(t,r)}function Vf(t){return typeof t.toJSON=="function"}function Wf(t,e){let r=Object.entries(t);return r.length===0?"{}":e.length>3?"["+Qf(t)+"]":"{ "+r.map(([s,i])=>s+": "+yr(i,e)).join(", ")+" }"}function ko(t,e){if(t.length===0)return "[]";if(e.length>3)return "[Array]";let r=t.length,n=[];for(let s=0;s<r;++s)n.push(yr(t[s],e));return "["+n.join(", ")+"]"}function Qf(t){let e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){let r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}var Zf=["message","locations","path","nodes","source","positions","originalError","name","stack","extensions","coordinate"];function Kf(t){return t!=null&&typeof t=="object"&&Object.keys(t).every(e=>Zf.includes(e))}function B(t,e){e?.originalError&&!(e.originalError instanceof Error)&&Kf(e.originalError)&&(e.originalError=B(e.originalError.message,e.originalError));let r=b$4,n=a$5.major>=16?new r(t,e):new r(t,e?.nodes,e?.source,e?.positions,e?.path,e?.originalError,e?.extensions);return e?.coordinate&&n.coordinate==null&&Object.defineProperties(n,{coordinate:{value:e.coordinate,enumerable:true,configurable:true}}),n}function ie(t,e,r,n){let s=D(t,e,r);if(!s.coordinate&&n&&s.coordinate==null){let i=`${n.parentType.name}.${n.fieldName}`;Object.defineProperties(s,{coordinate:{value:i,enumerable:true,configurable:true}});}return s}function Do(t){return t!=null&&typeof t=="object"&&Symbol.iterator in t}function zn(t){return typeof t=="object"&&t!==null}function Lo(t,e,r){let n=r;for(let s of t)n=C(()=>n,i=>e(i,s));return n}function gr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Hn(t,e,r={}){let n={},i=(e.arguments??[]).reduce((o,a)=>({...o,[a.name.value]:a}),{});for(let{name:o,type:a,defaultValue:c}of t.args){let l=i[o];if(!l){if(c!==void 0)n[o]=c;else if(i$1(a))throw B(`Argument "${o}" of required type "${X(a)}" was not provided.`,{nodes:[e]});continue}let u=l.value,f=u.kind===d$4.NULL;if(u.kind===d$4.VARIABLE){let h=u.name.value;if(r==null||!gr(r,h)){if(c!==void 0)n[o]=c;else if(i$1(a))throw B(`Argument "${o}" of required type "${X(a)}" was provided the variable "$${h}" which was not provided a runtime value.`,{nodes:[u]});continue}f=r[h]==null;}if(f&&i$1(a))throw B(`Argument "${o}" of non-null type "${X(a)}" must not be null.`,{nodes:[u]});let d=z$1(u,a,r);if(d===void 0)throw B(`Argument "${o}" has invalid value ${f$4(u)}.`,{nodes:[u]});n[o]=d;}return n}function je(t){let e=new WeakMap;return function(n){let s=e.get(n);if(s===void 0){let i=t(n);return e.set(n,i),i}return s}}function Oo(t){let e=new WeakMap;return function(n,s,i){let o=e.get(n);if(!o){o=new WeakMap,e.set(n,o);let l=new WeakMap;o.set(s,l);let u=t(n,s,i);return l.set(i,u),u}let a=o.get(s);if(!a){a=new WeakMap,o.set(s,a);let l=t(n,s,i);return a.set(i,l),l}let c=a.get(i);if(c===void 0){let l=t(n,s,i);return a.set(i,l),l}return c}}function Io(t){let e=new WeakMap;return function(n,s,i,o,a){let c=e.get(n);if(!c){c=new WeakMap,e.set(n,c);let h=new WeakMap;c.set(s,h);let m=new WeakMap;h.set(i,m);let g=new WeakMap;m.set(o,g);let A=t(n,s,i,o,a);return g.set(a,A),A}let l=c.get(s);if(!l){l=new WeakMap,c.set(s,l);let h=new WeakMap;l.set(i,h);let m=new WeakMap;h.set(o,m);let g=t(n,s,i,o,a);return m.set(a,g),g}let u=l.get(i);if(!u){u=new WeakMap,l.set(i,u);let h=new WeakMap;u.set(o,h);let m=t(n,s,i,o,a);return h.set(a,m),m}let f=u.get(o);if(!f){f=new WeakMap,u.set(o,f);let h=t(n,s,i,o,a);return f.set(a,h),h}let d=f.get(a);if(d===void 0){let h=t(n,s,i,o,a);return f.set(a,h),h}return d}}function Fo(t,e,r){let s=jo(t).get(e);if(s==null)throw B(`Schema is not configured to execute ${e} operation.`,{nodes:r});return s}var jo=je(function(e){let r=new Map,n=e.getQueryType();n&&r.set("query",n);let s=e.getMutationType();s&&r.set("mutation",s);let i=e.getSubscriptionType();return i&&r.set("subscription",i),r});var We=class extends Map{get[Symbol.toStringTag](){return "AccumulatorMap"}add(e,r){let n=this.get(e);n===void 0?this.set(e,[r]):n.push(r);}};var No=new q({name:"defer",description:"Directs the executor to defer this fragment when the `if` argument is true or undefined.",locations:[c$1.FRAGMENT_SPREAD,c$1.INLINE_FRAGMENT],args:{if:{type:new m(p),description:"Deferred when true or undefined.",defaultValue:true},label:{type:o,description:"Unique name"}}}),qo=new q({name:"stream",description:"Directs the executor to stream plural fields when the `if` argument is true or undefined.",locations:[c$1.FIELD],args:{if:{type:new m(p),description:"Stream when true or undefined.",defaultValue:true},label:{type:o,description:"Unique name"},initialCount:{defaultValue:0,type:n,description:"Number of items to return immediately"}}});function dt(t,e,r,n,s,i,o,a){for(let c of s.selections)switch(c.kind){case d$4.FIELD:{if(!Vn(r,c))continue;i.add(Xf(c),c);break}case d$4.INLINE_FRAGMENT:{if(!Vn(r,c)||!Uo(t,c,n))continue;let l=$o(r,c);if(l){let u=new We;dt(t,e,r,n,c.selectionSet,u,o,a),o.push({label:l.label,fields:u});}else dt(t,e,r,n,c.selectionSet,i,o,a);break}case d$4.FRAGMENT_SPREAD:{let l=c.name.value;if(!Vn(r,c))continue;let u=$o(r,c);if(a.has(l)&&!u)continue;let f=e[l];if(!f||!Uo(t,f,n))continue;if(u||a.add(l),u){let d=new We;dt(t,e,r,n,f.selectionSet,d,o,a),o.push({label:u.label,fields:d});}else dt(t,e,r,n,f.selectionSet,i,o,a);break}}}function Wn(t,e,r,n,s){let i=new We,o=[];return dt(t,e,r,n,s,i,o,new Set),{fields:i,patches:o}}function Vn(t,e){return !(A(s$1,e,t)?.if===true||A(r,e,t)?.if===false)}function Uo(t,e,r){let n=e.typeCondition;if(!n)return true;let s=x(t,n);return s===r?true:l(s)?t.getPossibleTypes(s).includes(r):false}function Xf(t){return t.alias?t.alias.value:t.name.value}function $o(t,e){let r=A(No,e,t);if(r&&r.if!==false)return {label:typeof r.label=="string"?r.label:void 0}}var Bo=Io(function(e,r,n,s,i){let o=new We,a=new Set,c=[],l={fields:o,patches:c};for(let u of i)u.selectionSet&&dt(e,r,n,s,u.selectionSet,o,c,a);return l});function xr(t){return t?.[Symbol.asyncIterator]!=null}function Qe(t,e,r){return {prev:t,key:e,typename:r}}function Y(t){let e=[],r=t;for(;r;)e.push(r.key),r=r.prev;return e.reverse()}function Mo(t){return t.map(e=>typeof e=="number"?"["+e.toString()+"]":"."+e).join("")}function pt(t,e){let r={...e,...t};for(let n of Object.keys(r))n in t&&n in e&&(r[n]=(s,i)=>t[n](s,()=>e[n](s,i)));return r}var Ze=t=>({fn(e,r){return e?(...n)=>{let s;return e(t,()=>{s=r(...n);}),s}:r},asyncFn(e,r){return e?(...n)=>{let s;return C(()=>e(t,()=>(s=r(...n),$(s)?s.then(()=>{}):void 0)),()=>s)}:r}});var Go=new WeakMap;function Yf(t){return t.length===1?t[0]:{schema:t[0],document:t[1],rootValue:t[2],contextValue:t[3],variableValues:t[4],operationName:t[5],fieldResolver:t[6],subscribeFieldResolver:t[7]}}var Qn=t=>((...e)=>t(Yf(e)));function eh(t){return t.length===1?t[0]:{schema:t[0],document:t[1],rootValue:t[2],contextValue:t[3],variableValues:t[4],operationName:t[5],fieldResolver:t[6],typeResolver:t[7]}}var Zn=t=>((...e)=>t(eh(e)));function oe(t){return typeof t=="object"&&t!=null&&typeof t[Symbol.asyncIterator]=="function"}function Kn(t,e){if(oe(t.result))return {onNext:e};e({args:t.args,result:t.result,setResult:t.setResult});}function Jn(t,e){let r;function n(){return r||(r=t[Symbol.asyncIterator]()),r}let s=false;return {[Symbol.asyncIterator](){return this},next(){return n().next().then(i=>(i.done&&s===false&&(s=true,e()),i))},return(){let i=n().return?.();return s===false&&(s=true,e()),i||U({done:true,value:void 0})},throw(i){let o=n().throw?.();if(o)return o;throw i},[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")](){return U()}}}function zo(t,e){let r;function n(){return r||(r=t[Symbol.asyncIterator]()),r}return {[Symbol.asyncIterator](){return this},next(){return n().next().catch(s=>(e(s),{done:true,value:void 0}))},return(){return n().return?.()||U({done:true,value:void 0})},throw(s){let i=n().throw?.();if(i)return i;throw s},[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")](){return U()}}}function _r(t){throw Error(`No \`${t}\` function found! Register it using "useEngine" plugin.`)}function Ho({plugins:t}){let e=null,r=false,n=()=>_r("parse"),s=()=>_r("validate"),i=()=>_r("execute"),o=()=>_r("subscribe"),a,c=(E,T=-1)=>{if(e!==E&&(e=E,r))for(let[S,w]of t.entries())S!==T&&w.onSchemaChange&&w.onSchemaChange({schema:e,replaceSchema:R=>{c(R,S);}});},l=[];for(let E=0;E<t.length;E++){let T=t[E],S=[];T.onPluginInit?.({plugins:t,addPlugin:w=>{S.push(w);},setSchema:w=>c(w,E),registerContextErrorHandler:w=>l.push(w)}),S.length&&t.splice(E+1,0,...S);}let u={init:[],parse:[],validate:[],subscribe:[],execute:[],context:[]};for(let{onContextBuilding:E,onExecute:T,onParse:S,onSubscribe:w,onValidate:R,onEnveloped:p,instrumentation:b}of t)p&&u.init.push(p),E&&u.context.push(E),T&&u.execute.push(T),S&&u.parse.push(S),w&&u.subscribe.push(w),R&&u.validate.push(R),b&&(a=a?pt(a,b):b);let f=E=>{for(let[T,S]of u.init.entries())S({context:E,extendContext:w=>{E&&Object.assign(E,w);},setSchema:w=>c(w,T)});},d=u.parse.length?E=>(T,S)=>{let w=null,R=n,p=E,b=[];for(let _ of u.parse){let P=_({context:p,extendContext:v=>{Object.assign(p,v);},params:{source:T,options:S},parseFn:R,setParseFn:v=>{R=v;},setParsedDocument:v=>{w=v;}});P&&b.push(P);}if(w===null)try{w=R(T,S);}catch(_){w=_;}for(let _ of b)_({context:p,extendContext:P=>{Object.assign(p,P);},replaceParseResult:P=>{w=P;},result:w});if(w===null)throw new Error("Failed to parse document.");if(w instanceof Error)throw w;return Go.set(w,T.toString()),w}:()=>n,h=u.validate.length?E=>(T,S,w,R,p)=>{let b=w?[...w]:void 0,_=s,P=null,v=E,O=[];for(let z of u.validate){let q=z({context:v,extendContext:Q=>{Object.assign(v,Q);},params:{schema:T,documentAST:S,rules:b,typeInfo:R,options:p},validateFn:_,addValidationRule:Q=>{b||(b=[]),b.push(Q);},setValidationFn:Q=>{_=Q;},setResult:Q=>{P=Q;}});q&&O.push(q);}if(P||(P=_(T,S,b,R,p)),!P)return;let N=P.length===0;for(let z of O)z({valid:N,result:P,context:v,extendContext:q=>{Object.assign(v,q);},setResult:q=>{P=q;}});return P}:()=>s,m=u.context.length?E=>T=>{let S=[],w=E;T&&Object.assign(w,T);let R=false;return C(()=>V(u.context,(p,b)=>p({context:w,extendContext:_=>{Object.assign(w,_);},breakContextBuilding:()=>{R=true,b();}}),S),()=>R?w:C(()=>V(S,p=>p({context:w,extendContext(b){Object.assign(w,b);}})),()=>w),p=>{let b=p;for(let _ of l)_({context:w,error:b,setError:P=>{b=P;}});throw b})}:E=>T=>(T&&Object.assign(E,T),E),A=u.subscribe.length?Qn(E=>{let T=o,S=[],w=E.contextValue||{},R;return C(()=>V(u.subscribe,(p,b)=>p({subscribeFn:T,setSubscribeFn:_=>{T=_;},context:w,extendContext:_=>{Object.assign(w,_);},args:E,setResultAndStopExecution:_=>{R=_,b();}}),S),()=>{let p=[],b=[];for(let{onSubscribeResult:_,onSubscribeError:P}of S)_&&p.push(_),P&&b.push(P);return C(()=>R||T(E),_=>{let P=[],v=[];for(let O of p){let N=O({args:E,result:_,setResult:z=>{_=z;}});N&&(N.onNext&&P.push(N.onNext),N.onEnd&&v.push(N.onEnd));}return P.length&&oe(_)&&(_=Re(_,O=>C(()=>V(P,N=>N({args:E,result:O,setResult:z=>O=z})),()=>O))),v.length&&oe(_)&&(_=Jn(_,()=>{for(let O of v)O();})),b.length&&oe(_)&&(_=zo(_,O=>{let N=O;for(let z of b)z({error:N,setError:q=>{N=q;}});throw N})),_})})}):Qn(o),L=u.execute.length?Zn(E=>{let T=i,S,w=[],R=[],p=E.contextValue||{};return C(()=>V(u.execute,(b,_)=>b({executeFn:T,setExecuteFn:P=>{T=P;},setResultAndStopExecution:P=>{S=P,_();},context:p,extendContext:P=>{if(typeof P=="object")Object.assign(p,P);else throw new Error(`Invalid context extension provided! Expected "object", got: "${JSON.stringify(P)}" (${typeof P})`)},args:E}),w),()=>C(()=>S||T({...E,contextValue:p}),b=>C(()=>V(w,_=>_.onExecuteDone?.({args:E,result:b,setResult:P=>{b=P;}}),R),()=>{let _=[],P=[];for(let{onNext:v,onEnd:O}of R)v&&_.push(v),O&&P.push(O);return _.length&&oe(b)&&(b=Re(b,v=>C(()=>V(_,O=>O({args:E,result:v,setResult:N=>{v=N;}})),()=>v))),P.length&&oe(b)&&(b=Jn(b,()=>{for(let v of P)v();})),b})))}):Zn(i);if(r=true,e)for(let[E,T]of t.entries())T.onSchemaChange?.({schema:e,replaceSchema:S=>c(S,E)});return {getCurrentSchema(){return e},init:f,parse:d,validate:h,execute:L,subscribe:A,contextFactory:m,instrumentation:a}}function th(t){return t!=null}function Vo(t){let e=t.plugins.filter(th),r=Ho({plugins:e}),n=r.instrumentation,s=(i={})=>{let o=Ze({context:i}),a=r;return o.fn(n?.init,r.init)(i),{parse:o.fn(n?.parse,a.parse(i)),validate:o.fn(n?.validate,a.validate(i)),contextFactory:o.fn(n?.context,a.contextFactory(i)),execute:o.asyncFn(n?.execute,a.execute),subscribe:o.asyncFn(n?.subscribe,a.subscribe),schema:a.getCurrentSchema()}};return s._plugins=e,s}var rh="Unexpected error.";function nh(t){return t instanceof Error&&t.name==="GraphQLError"}function Wo(t){return nh(t)?t.originalError!=null?Wo(t.originalError):true:false}function sh(t,e,r){let n=new Error(t);if(n.name="GraphQLError",r){let s=e instanceof Error?{message:e.message,stack:e.stack}:{message:String(e)};Object.defineProperty(n,"extensions",{get(){return s}});}return Object.defineProperty(n,"toJSON",{value(){return {message:n.message,extensions:n.extensions}}}),n}var ih=t=>(e,r)=>Wo(e)?e:sh(r,e,t),oh=globalThis.process?.env?.NODE_ENV==="development",ah=ih(oh),lh=(t,e)=>({result:r,setResult:n})=>{r.errors!=null&&n({...r,errors:r.errors.map(s=>t(s,e))});};function Qo(t){let e=t?.maskError??ah,r=t?.errorMessage||rh,n=lh(e,r);return {onPluginInit(s){s.registerContextErrorHandler(({error:i,setError:o})=>{o(e(i,r));});},onExecute(){return {onExecuteDone(s){return Kn(s,n)}}},onSubscribe(){return {onSubscribeResult(s){return Kn(s,n)},onSubscribeError({error:s,setError:i}){i(e(s,r));}}}}}var Zo=t=>({onContextBuilding({context:e,extendContext:r}){return C(()=>t(e),n=>r(n))}});var Ko=t=>({onExecute:({setExecuteFn:e})=>{t.execute&&e(t.execute);},onParse:({setParseFn:e})=>{t.parse&&e(t.parse);},onValidate:({setValidationFn:e,addValidationRule:r})=>{t.validate&&e(t.validate),t.specifiedRules?.map(r);},onSubscribe:({setSubscribeFn:e})=>{t.subscribe&&e(t.subscribe);}});var Ne=class extends Error{error;suppressed;constructor(e,r,n){super(n),this.error=e,this.suppressed=r,this.name="SuppressedError",Error.captureStackTrace(this,this.constructor);}};var M={get dispose(){return Symbol.dispose||Symbol.for("dispose")},get asyncDispose(){return Symbol.asyncDispose||Symbol.for("asyncDispose")}};function Sr(t){return t?.[M.dispose]!=null}function Jo(t){return t?.[M.asyncDispose]!=null}var ch=globalThis.SuppressedError||Ne,wr=class t{callbacks=[];get disposed(){return this.callbacks.length===0}use(e){return Jo(e)?this.callbacks.push(()=>e[M.asyncDispose]()):Sr(e)&&this.callbacks.push(()=>e[M.dispose]()),e}adopt(e,r){return r&&this.callbacks.push(()=>r(e)),e}defer(e){e&&this.callbacks.push(e);}move(){let e=new t;return e.callbacks=this.callbacks,this.callbacks=[],e}disposeAsync(){return this[M.asyncDispose]()}_error;_iterateCallbacks(){let e=this.callbacks.pop();if(e)return C(e,()=>this._iterateCallbacks(),r=>(this._error=this._error?new ch(r,this._error):r,this._iterateCallbacks()))}[M.asyncDispose](){let e=this._iterateCallbacks();if(e?.then)return e.then(()=>{if(this._error){let r=this._error;throw this._error=void 0,r}});if(this._error){let r=this._error;throw this._error=void 0,r}}[Symbol.toStringTag]="AsyncDisposableStack"};var Xo=globalThis.AsyncDisposableStack||wr;function be(t){if(t instanceof Error)return t;if(typeof t=="object"&&t!=null&&"message"in t&&typeof t.message=="string"){let e;"cause"in t&&(e={cause:t.cause});let r=new Error(t.message,e);return "stack"in t&&typeof t.stack=="string"&&(r.stack=t.stack),"name"in t&&typeof t.name=="string"&&(r.name=t.name),r}return new Error(String(t))}function Yo(t){let e=t[Symbol.asyncIterator](),r,n,s=false;async function i(){if(s)return {value:void 0,done:true};try{if(!r){if(n)return await n,await i();let c;n=new Promise(u=>{c=u;});let l=await e.next();return l.done?(s=!0,await i()):(r=l.value[Symbol.asyncIterator](),n=void 0,c(),await i())}let o=r,a=await r.next();return a.done?(r===o&&(r=void 0),await i()):a}catch(o){throw s=true,o}}return {next:i,async return(){return s=true,await Promise.all([r?.return?.(),e.return?.()]),{value:void 0,done:true}},async throw(o){throw s=true,await Promise.all([r?.throw?.(o),e.throw?.(o)]),o},[Symbol.asyncIterator](){return this},async[M.asyncDispose](){s=true,await Promise.all([r?.[M.asyncDispose]?.(),e?.[M.asyncDispose]?.()]);}}}function Xn(t,e){if(!t)throw new Error(e??"Unexpected invariant triggered.")}function Yn(t,e,r){e?.throwIfAborted();let n=Object.create(null),s=[];for(let o in t){let a=C(()=>t[o],c=>{n[o]=c;});$(a)&&s.push(a);}if(!s.length)return n;let i=s.length===1?s[0]:Promise.all(s);return r?Promise.race([r,i]).then(()=>n):i.then(()=>n)}function ea(t,e,r,n){let s=[],i=n?.maxErrors;try{let o=fh(t,e,r,a=>{if(i!=null&&s.length>=i)throw B("Too many errors processing variables, error limit reached. Execution aborted.");s.push(a);});if(s.length===0)return {coerced:o}}catch(o){s.push(o);}return {errors:s}}function fh(t,e,r,n){let s={};for(let i of e){let o=i.variable.name.value,a=x(t,i.type);if(!j$1(a)){let l=f$4(i.type);n(B(`Variable "$${o}" expected value of type "${l}" which cannot be used as an input type.`,{nodes:i.type}));continue}if(!gr(r,o)){if(i.defaultValue)s[o]=z$1(i.defaultValue,a);else if(i$1(a)){let l=X(a);n(B(`Variable "$${o}" of required type "${l}" was not provided.`,{nodes:i}));}continue}let c=r[o];if(c===null&&i$1(a)){let l=X(a);n(B(`Variable "$${o}" of non-null type "${l}" must not be null.`,{nodes:i}));continue}s[o]=y(c,a,(l,u,f)=>{let d=`Variable "$${o}" got invalid value `+X(u);l.length>0&&(d+=` at "${o}${Mo(l)}"`),n(B(d+"; "+f.message,{nodes:i,originalError:f}));});}return s}var hh=Oo((t,e,r)=>Bo(t.schema,t.fragments,t.variableValues,e,r));function ca(t){let e=fa(t);return "schema"in e?ua(e):{errors:e.map(r=>(Object.defineProperty(r,"extensions",{value:{...r.extensions,http:{...r.extensions?.http||{},status:400}}}),r))}}function ua(t){return t.signal?.throwIfAborted(),C(()=>mh(t),e=>{let r=ta(e,t.errors);return t.subsequentPayloads.size>0?{initialResult:{...r,hasNext:true},subsequentResults:kh(t)}:r},e=>(t.signal?.throwIfAborted(),e.errors?t.errors.push(...e.errors):t.errors.push(e),ta(null,t.errors)))}function ta(t,e){return e.length===0?{data:t}:{errors:e,data:t}}var dh=je(function(e){let r=Object.create(null);for(let n of e.definitions)n.kind===d$4.FRAGMENT_DEFINITION&&(r[n.name.value]=n);return r});function fa(t){let{schema:e,document:r,rootValue:n,contextValue:s,variableValues:i,operationName:o,fieldResolver:a,typeResolver:c,subscribeFieldResolver:l,signal:u,schemaCoordinateInErrors:f}=t;u?.throwIfAborted(),w(e);let d=dh(r),h;for(let L of r.definitions)switch(L.kind){case d$4.OPERATION_DEFINITION:if(o==null){if(h!==void 0)return [B("Must provide operation name if query contains multiple operations.",{extensions:{code:"OPERATION_RESOLUTION_FAILURE"}})];h=L;}else L.name?.value===o&&(h=L);break;}if(h==null)return o!=null?[B(`Unknown operation named "${o}".`,{extensions:{code:"OPERATION_RESOLUTION_FAILURE"}})]:[B("Must provide an operation.",{extensions:{code:"OPERATION_RESOLUTION_FAILURE"}})];let m=h.variableDefinitions??[],g=ea(e,m,i??{},{maxErrors:50});if(g.errors)return g.errors;u?.throwIfAborted();let A,x;if(u){let L=new Set,E=Ft();x=E.promise;let T=()=>{E.reject(u.reason),u.removeEventListener("abort",T);};u.addEventListener("abort",T,{once:true}),x.catch(()=>{for(let S of L)S();L.clear();}),A=S=>{L.add(S);};}return {schema:e,fragments:d,rootValue:n,contextValue:s,operation:h,variableValues:g.coerced,fieldResolver:a??ia,typeResolver:c??wh,subscribeFieldResolver:l??ia,subsequentPayloads:new Set,errors:[],signal:u,onSignalAbort:A,signalPromise:x,schemaCoordinateInErrors:f}}function ph(t,e){return {...t,rootValue:e,subsequentPayloads:new Set,errors:[]}}function mh(t){let{operation:e,schema:r,fragments:n,variableValues:s,rootValue:i}=t,o=Fo(r,e.operation,[e]);o==null&&B(`Schema is not configured to execute ${e.operation} operation.`,{nodes:e});let{fields:a,patches:c}=Wn(r,n,s,o,e.selectionSet),l=void 0,u;e.operation==="mutation"?u=bh(t,o,i,l,a):u=rs(t,o,i,l,a);for(let f of c){let{label:d,fields:h}=f;ga(t,o,i,h,d,l);}return u}function bh(t,e,r,n,s){return Lo(s,(i,[o,a])=>{let c=Qe(n,o,e.name);return t.signal?.throwIfAborted(),C(()=>ha(t,e,r,a,c),l=>(l===void 0||(i[o]=l),i))},Object.create(null))}function rs(t,e,r,n,s,i){let o=Object.create(null),a=false;try{for(let[c,l]of s){t.signal?.throwIfAborted();let u=Qe(n,c,e.name),f=ha(t,e,r,l,u,i);f!==void 0&&(o[c]=f,$(f)&&(a=!0));}}catch(c){if(c!==t.signal?.reason&&a)return C(()=>Yn(o,t.signal),()=>{throw c},()=>{throw c});throw c}return a?Yn(o,t.signal,t.signalPromise):o}function ha(t,e,r,n,s,i){let o=i?.errors??t.errors,a=xa(t.schema,e,n[0]);if(!a)return;let c=a.type,l=a.resolve??t.fieldResolver,u=da(t,a,n,e,s);try{t.signal?.throwIfAborted();let f=Hn(a,n[0],t.variableValues),d=t.contextValue,h=l(r,f,d,u),m;return $(h)?m=h.then(g=>qe(t,c,n,u,s,g,i)):m=qe(t,c,n,u,s,h,i),$(m)?m.then(void 0,g=>{if(g instanceof AggregateError){let L;for(let E of g.errors){E=be(E);let T=ie(E,n,Y(s),t.schemaCoordinateInErrors&&u);L=pe(T,c,o),ce(t,s,i);}return L}g=be(g);let A=ie(g,n,Y(s),t.schemaCoordinateInErrors&&u),x=pe(A,c,o);return ce(t,s,i),x}):m}catch(f){if(f instanceof AggregateError){let g;for(let A of f.errors){A=be(A);let x=ie(A,n,Y(s),t.schemaCoordinateInErrors&&u);g=pe(x,c,o),ce(t,s,i);}return g}let d=be(f),h=ie(d,n,Y(s),t.schemaCoordinateInErrors&&u),m=pe(h,c,o);return ce(t,s,i),m}}function da(t,e,r,n,s){return {fieldName:e.name,fieldNodes:r,returnType:e.type,parentType:n,path:s,schema:t.schema,fragments:t.fragments,rootValue:t.rootValue,operation:t.operation,variableValues:t.variableValues,signal:t.signal}}var yh="CRITICAL_ERROR";function pe(t,e,r){if(i$1(e)||t.extensions?.[yh])throw t;return r.push(t),null}function qe(t,e,r,n,s,i,o){if(i instanceof Error)throw i;if(i$1(e)){let a=qe(t,e.ofType,r,n,s,i,o);if(a===null)throw new Error(`Cannot return null for non-nullable field ${n.parentType.name}.${n.fieldName}.`);return a}if(i==null)return null;if(h(e))return xh(t,e,r,n,s,i,o);if(k(e))return _h(e,i);if(l(e))return Sh(t,e,r,n,s,i,o);if(g$2(e))return es(t,e,r,n,s,i,o);console.assert(false,"Cannot complete value of unexpected output type: "+X(e));}function pa(t,e,r){if(typeof r.key=="number")return;let n=A(qo,e[0],t.variableValues);if(n&&n.if!==false)return Xn(typeof n.initialCount=="number","initialCount must be a number"),Xn(n.initialCount>=0,"initialCount must be a positive integer"),{initialCount:n.initialCount,label:typeof n.label=="string"?n.label:void 0}}async function gh(t,e,r,n,s,i,o){t.signal?.throwIfAborted(),i.return&&t.onSignalAbort?.(()=>{i.return?.();});let a=o?.errors??t.errors,c=pa(t,r,s),l=false,u=[],f=0;for(;;){if(c&&typeof c.initialCount=="number"&&f>=c.initialCount){Rh(f,i,t,r,n,e,s,c.label,o);break}let d=Qe(s,f,void 0),h;try{if(h=await i.next(),h.done)break}catch(m){let g=be(m),A=ie(g,r,Y(d),t.schemaCoordinateInErrors&&n);u.push(pe(A,e,a));break}ma(h.value,u,a,t,e,r,n,d,o)&&(l=true),f+=1;}return l?Promise.all(u):u}function xh(t,e,r,n,s,i,o){let a=e.ofType,c=o?.errors??t.errors;if(xr(i)){let m=i[Symbol.asyncIterator]();return gh(t,a,r,n,s,m,o)}if(!Do(i))throw B(`Expected Iterable, but did not find one for field "${n.parentType.name}.${n.fieldName}".`);let l=pa(t,r,s),u=false,f=o,d=[],h=0;for(let m of i){let g=Qe(s,h,void 0);if(l&&typeof l.initialCount=="number"&&h>=l.initialCount){f=Ch(s,g,m,t,r,n,a,l.label,f),h++;continue}ma(m,d,c,t,a,r,n,g,o)&&(u=true),h++;}return u?Promise.all(d):d}function ma(t,e,r,n,s,i,o,a,c){try{let l;if($(t)?l=t.then(u=>qe(n,s,i,o,a,u,c)):l=qe(n,s,i,o,a,t,c),$(l))return e.push(l.then(void 0,u=>{u=be(u);let f=ie(u,i,Y(a),n.schemaCoordinateInErrors&&o),d=pe(f,s,r);return ce(n,a,c),d})),!0;e.push(l);}catch(l){let u=be(l),f=ie(u,i,Y(a),n.schemaCoordinateInErrors&&o),d=pe(f,s,r);ce(n,a,c),e.push(d);}return false}function _h(t,e){let r;try{r=t.serialize(e);}catch(n){throw n instanceof b$4?new Error(n.message):n}if(r==null)throw new Error(`Expected \`${X(t)}.serialize(${X(e)})\` to return non-nullable value, returned: ${X(r)}`);return r}function Sh(t,e,r,n,s,i,o){let a=e.resolveType??t.typeResolver,c=t.contextValue,l=a(i,c,n,e);return $(l)?l.then(u=>es(t,ra(u,t,e,r,n,i),r,n,s,i,o)):es(t,ra(l,t,e,r,n,i),r,n,s,i,o)}function ra(t,e,r,n,s,i){if(t==null)throw B(`Abstract type "${r.name}" must resolve to an Object type at runtime for field "${s.parentType.name}.${s.fieldName}". Either the "${r.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,{nodes:n});if(g$2(t)){if(a$5.major>=16)throw B("Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.");t=t.name;}if(typeof t!="string")throw B(`Abstract type "${r.name}" must resolve to an Object type at runtime for field "${s.parentType.name}.${s.fieldName}" with value ${X(i)}, received "${X(t)}".`);let o=e.schema.getType(t);if(o==null)throw B(`Abstract type "${r.name}" was resolved to a type "${t}" that does not exist inside the schema.`,{nodes:n});if(!g$2(o))throw B(`Abstract type "${r.name}" was resolved to a non-object type "${t}".`,{nodes:n});if(!e.schema.isSubType(r,o))throw B(`Runtime Object type "${o.name}" is not a possible type for "${r.name}".`,{nodes:n});return o}function es(t,e,r,n,s,i,o){if(e.isTypeOf){let a=e.isTypeOf(i,t.contextValue,n);if($(a))return a.then(c=>{if(!c)throw na(e,i,r);return sa(t,e,r,s,i,o)});if(!a)throw na(e,i,r)}return sa(t,e,r,s,i,o)}function na(t,e,r){return B(`Expected value of type "${t.name}" but got: ${X(e)}.`,{nodes:r})}function sa(t,e,r,n,s,i){let{fields:o,patches:a}=hh(t,e,r),c=rs(t,e,s,n,o,i);for(let l of a){let{label:u,fields:f}=l;ga(t,e,s,f,u,n,i);}return c}var wh=function(t,e,r,n){if(zn(t)&&typeof t.__typename=="string")return t.__typename;let s=r.schema.getPossibleTypes(n),i=[];for(let o=0;o<s.length;o++){let a=s[o];if(a.isTypeOf){let c=a.isTypeOf(t,e,r);if($(c))i[o]=c;else if(c)return a.name}}if(i.length)return Promise.all(i).then(o=>{for(let a=0;a<o.length;a++)if(o[a])return s[a].name})},ia=function(t,e,r,n){if(zn(t)||typeof t=="function"){let s=t[n.fieldName];return typeof s=="function"?t[n.fieldName](e,r,n):s}};function ba(t){let e=fa(t);if(!("schema"in e)){for(let n of e){let s=n.extensions||={},i=s.http||={};i.status=400,n.extensions.code="BAD_USER_INPUT";}return {errors:e}}let r=Th(e);return $(r)?r.then(n=>oa(e,n)):oa(e,r)}function ya(t){return t?.initialResult}function ns(t){let e=t.subsequentResults,r=false,n=false;return {[Symbol.asyncIterator](){return this},next(){return n?U({value:void 0,done:n}):r?e.next():(r=true,U({value:t.initialResult,done:n}))},return(){return n=true,e.return()},throw(s){return n=true,e.throw(s)},[M.asyncDispose](){return n=true,e?.[M.asyncDispose]?.()}}}async function*Eh(t){"initialResult"in t?yield*ns(t):yield t;}function oa(t,e){return xr(e)?Yo(Re(e,r=>C(()=>ua(ph(t,r)),Eh),r=>{throw r instanceof AggregateError?new AggregateError(r.errors.map(n=>aa(n,t.operation)),r.message):aa(r,t.operation)})):e}function aa(t,e){return B(t.message,{originalError:t,nodes:[e]})}function Th(t){try{let e=Ph(t);return $(e)?e.then(void 0,r=>({errors:[r]})):e}catch(e){return {errors:[e]}}}function Ph(t){let{schema:e,fragments:r,operation:n,variableValues:s,rootValue:i}=t,o=e.getSubscriptionType();if(o==null)throw B("Schema is not configured to execute subscription operation.",{nodes:n});let{fields:a}=Wn(e,r,s,o,n.selectionSet),[c,l]=[...a.entries()][0],u=l[0].name.value,f=xa(e,o,l[0]);if(!f)throw B(`The subscription field "${u}" is not defined.`,{nodes:l});let d=Qe(void 0,c,o.name),h=da(t,f,l,o,d);try{let m=Hn(f,l[0],s),g=t.contextValue,x=(f.subscribe??t.subscribeFieldResolver)(i,m,g,h);return $(x)?x.then(L=>la(L,t.signal,t.onSignalAbort)).then(void 0,L=>{throw ie(L,l,Y(d),t.schemaCoordinateInErrors&&h)}):la(x,t.signal,t.onSignalAbort)}catch(m){throw ie(m,l,Y(d),t.schemaCoordinateInErrors&&h)}}function la(t,e,r){if(e?.throwIfAborted(),t instanceof Error)throw t;if(!xr(t))throw B(`Subscription field must return Async Iterable. Received: ${X(t)}.`);return r?{[Symbol.asyncIterator](){let n=t[Symbol.asyncIterator]();return n.return&&r?.(()=>{n.return?.();}),n}}:t}function ga(t,e,r,n,s,i,o){let a=new ts({label:s,path:i,parentContext:o,exeContext:t}),c;try{c=rs(t,e,r,i,n,a),$(c)&&(c=c.then(null,l=>(a.errors.push(l),null)));}catch(l){a.errors.push(l),c=null;}a.addData(c);}function Ch(t,e,r,n,s,i,o,a,c){let l=new Tr({label:a,path:e,parentContext:c,exeContext:n}),u;try{try{$(r)?u=r.then(d=>qe(n,o,s,i,e,d,l)):u=qe(n,o,s,i,e,r,l),$(u)&&(u=u.then(void 0,d=>{d=be(d);let h=ie(d,s,Y(e),n.schemaCoordinateInErrors&&i),m=pe(h,o,l.errors);return ce(n,e,l),m}));}catch(d){let h=be(d),m=ie(h,s,Y(e),n.schemaCoordinateInErrors&&i);u=pe(m,o,l.errors),ce(n,e,l);}}catch(d){return l.errors.push(d),ce(n,t,l),l.addItems(null),l}let f;return $(u)?f=u.then(d=>[d],d=>(l.errors.push(d),ce(n,t,l),null)):f=[u],l.addItems(f),l}async function Ah(t,e,r,n,s,i,o){let a;try{let{value:l,done:u}=await t.next();if(u)return i.setIsCompletedIterator(),{done:u,value:void 0};a=l;}catch(l){let u=be(l),f=ie(u,r,Y(o),e.schemaCoordinateInErrors&&n);return {done:true,value:pe(f,s,i.errors)}}let c;try{return c=qe(e,s,r,n,o,a,i),$(c)&&(c=c.then(void 0,l=>{let u=ie(l,r,Y(o),e.schemaCoordinateInErrors&&n),f=pe(u,s,i.errors);return ce(e,o,i),f})),{done:!1,value:c}}catch(l){let u=ie(l,r,Y(o),e.schemaCoordinateInErrors&&n),f=pe(u,s,i.errors);return ce(e,o,i),{done:false,value:f}}}async function Rh(t,e,r,n,s,i,o,a,c){let l=t,u=c??void 0;for(;;){let f=Qe(o,l,void 0),d=new Tr({label:a,path:f,parentContext:u,iterator:e,exeContext:r}),h;try{h=await Ah(e,r,n,s,i,d,f);}catch(x){d.errors.push(x),ce(r,o,d),d.addItems(null),e?.return&&e.return().catch(()=>{});return}let{done:m,value:g}=h,A;if($(g)?A=g.then(x=>[x],x=>(d.errors.push(x),ce(r,o,d),null)):A=[g],d.addItems(A),m)break;u=d,l++;}}function ce(t,e,r){let n=Y(e);t.subsequentPayloads.forEach(s=>{if(s!==r){for(let i=0;i<n.length;i++)if(s.path[i]!==n[i])return;ss(s)&&s.iterator?.return&&s.iterator.return().catch(()=>{}),t.subsequentPayloads.delete(s);}});}function vh(t){let e=[];for(let r of t.subsequentPayloads){let n={};if(r.isCompleted){if(t.subsequentPayloads.delete(r),ss(r)){let s=r.items;if(r.isCompletedIterator)continue;n.items=s;}else {let s=r.data;n.data=s??null;}n.path=r.path,r.label&&(n.label=r.label),r.errors.length>0&&(n.errors=r.errors),e.push(n);}}return e}function kh(t){let e=false;async function r(){if(e)return {value:void 0,done:true};let s=Array.from(t.subsequentPayloads).map(a=>a.promise);if(t.signalPromise?await Promise.race([t.signalPromise,...s]):await Promise.race(s),e)return {value:void 0,done:true};let i=vh(t),o=t.subsequentPayloads.size>0;return !i.length&&o?r():(o||(e=true),{value:i.length?{incremental:i,hasNext:o}:{hasNext:o},done:false})}function n(){let s=[];return t.subsequentPayloads.forEach(i=>{ss(i)&&i.iterator?.return&&s.push(i.iterator.return());}),Promise.all(s)}return {[Symbol.asyncIterator](){return this},next:r,async return(){return await n(),e=true,{value:void 0,done:true}},async throw(s){throw await n(),e=true,s},async[M.asyncDispose](){await n(),e=true;}}}var ts=class{type;errors;label;path;promise;data;parentContext;isCompleted;_exeContext;_resolve;constructor(e){this.type="defer",this.label=e.label,this.path=Y(e.path),this.parentContext=e.parentContext,this.errors=[],this._exeContext=e.exeContext,this._exeContext.subsequentPayloads.add(this),this.isCompleted=false,this.data=null,this.promise=new Promise(r=>{this._resolve=n=>{r(n);};}).then(r=>{this.data=r,this.isCompleted=true;});}addData(e){let r=this.parentContext?.promise;if(r){this._resolve?.(r.then(()=>e));return}this._resolve?.(e);}},Tr=class{type;errors;label;path;items;promise;parentContext;iterator;isCompletedIterator;isCompleted;_exeContext;_resolve;constructor(e){this.type="stream",this.items=null,this.label=e.label,this.path=Y(e.path),this.parentContext=e.parentContext,this.iterator=e.iterator,this.errors=[],this._exeContext=e.exeContext,this._exeContext.subsequentPayloads.add(this),this.isCompleted=false,this.items=null,this.promise=new Promise(r=>{this._resolve=n=>{r(n);};}).then(r=>{this.items=r,this.isCompleted=true;});}addItems(e){let r=this.parentContext?.promise;if(r){this._resolve?.(r.then(()=>e));return}this._resolve?.(e);}setIsCompletedIterator(){this.isCompletedIterator=true;}};function ss(t){return t.type==="stream"}function xa(t$1,e,r){let n=r.name.value;return n===t.name&&t$1.getQueryType()===e?t:n===u.name&&t$1.getQueryType()===e?u:n===v.name?v:e.getFields()[n]}function Pr(t){let e=E(t.document,t.operationName);if(e==null)throw new Error("Must provide an operation.");return e.operation==="subscription"?ba(t):C(()=>ca(t),r=>ya(r)?ns(r):r)}var ab=e(er(),1);var qm=e(er(),1);function Yc(t){return t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function"}function Cm(t){if(t.socket?.localPort)return t.socket?.localPort;let r=(t.headers?.[":authority"]||t.headers?.host)?.split(":")?.[1];return r||80}function Am(t){if(t.headers?.[":authority"])return t.headers?.[":authority"];if(t.headers?.host)return t.headers?.host;let e=Cm(t);if(t.hostname)return t.hostname+":"+e;let r=t.socket?.localAddress;return r&&!r?.includes("::")&&!r?.includes("ffff")?`${r}:${e}`:"localhost"}function Rm(t){let e=Am(t),r=t.protocol||(t.socket?.encrypted?"https":"http"),n=t.originalUrl||t.url||"/graphql";return `${r}://${e}${n}`}function vm(t){let e=t[Symbol.toStringTag];return !!(typeof t=="string"||e==="Uint8Array"||e==="Blob"||e==="FormData"||e==="URLSearchParams"||Yc(t))}function Ti(t,e,r,n){let s=t.raw||t.req||t,i=Rm(s);if(t.query){let l=new e.URL(i);for(let u in t.query)l.searchParams.set(u,t.query[u]);i=l.toString();}let o=t.headers;if(t.headers?.[":method"]){o={};for(let l in t.headers)l.startsWith(":")||(o[l]=t.headers[l]);}let a=n?vi():new AbortController;if(r?.once){let l=()=>{a.signal.aborted||(Object.defineProperty(s,"aborted",{value:true}),a.abort(r.errored??void 0));};r.once("error",l),r.once("close",l),r.once("finish",()=>{r.removeListener("close",l);});}if(t.method==="GET"||t.method==="HEAD")return new e.Request(i,{method:t.method,headers:o,signal:a.signal});let c=t.body;if(c!=null&&Object.keys(c).length>0){if(vm(c))return new e.Request(i,{method:t.method||"GET",headers:o,body:c,signal:a.signal});let l=new e.Request(i,{method:t.method||"GET",headers:o,signal:a.signal});return l.headers.get("content-type")?.includes("json")||l.headers.set("content-type","application/json; charset=utf-8"),new Proxy(l,{get(u,f,d){switch(f){case "json":return ()=>U(c);case "text":return ()=>U(JSON.stringify(c));default:{let h=Reflect.get(l,f,l);return typeof h=="function"?function(...g){return h.apply(this===d?l:this,g)}:h}}}})}return new e.Request(i,{method:t.method,headers:o,signal:a.signal,body:s,duplex:"half"})}function eu(t){return t.read!=null}function tu(t){return eu(t)}function Pi(t){return t!=null&&t.setHeader!=null&&t.end!=null&&t.once!=null&&t.write!=null}function km(t){return t!=null&&t.getReader!=null}function ru(t){return t!=null&&t.request!=null&&t.respondWith!=null}function Dm(t){t?.socket?.setTimeout?.(0),t?.socket?.setNoDelay?.(true),t?.socket?.setKeepAlive?.(true);}function tr(t){t.end(null,null,null);}function Lm(t,e){let r=false,n=()=>{r=true;};t.once("error",n),t.once("close",n),t.once("finish",()=>{t.removeListener("close",n),t.removeListener("error",n);});let s=e[Symbol.asyncIterator]();return nu(()=>s.next(),t,()=>r)}function Jc(t){t.end(null,null,null);}function nu(t,e,r){let n=()=>C(t,s=>r?.()||s.done?Jc(e):C(()=>hn(s.value,e),()=>r?.()?Jc(e):n()));return n()}function hn(t,e){if(!e.write(t))return new Promise(n=>e.once("drain",n))}var Om=globalThis.process?.versions?.node?.startsWith("1");function su(t,e,r,n){if(e.closed||e.destroyed||e.writableEnded)return;if(!t){e.statusCode=404,tr(e);return}if(n&&t.headers?.headersInit&&!Array.isArray(t.headers.headersInit)&&!t.headers.headersInit.get&&!t.headers._map&&!t.headers._setCookies?.length)e.writeHead(t.status,t.statusText,t.headers.headersInit);else {if(e.setHeaders&&!Om)e.setHeaders(t.headers);else {let o=false;t.headers.forEach((a,c)=>{if(c==="set-cookie"){if(o)return;o=true;let l=t.headers.getSetCookie?.();if(l){e.setHeader("set-cookie",l);return}}e.setHeader(c,a);});}e.writeHead(t.status,t.statusText);}if(t.bodyType==="String"){let o=t.bodyInit;return C(()=>hn(o,e),()=>tr(e))}let s=t._buffer;if(s)return C(()=>hn(s,e),()=>tr(e));let i=t.body;if(i==null){tr(e);return}if(i[Symbol.toStringTag]==="Uint8Array")return C(()=>hn(i,e),()=>tr(e));if(Dm(r),eu(i)){e.once("close",()=>{i.destroy();}),i.pipe(e,{end:true});return}if(km(i))return Im(r,e,i);if(Yc(i))return Lm(e,i)}function Im(t,e,r){let n=r.getReader();return t?.once?.("error",s=>{n.cancel(s);}),nu(()=>n.read(),e)}function iu(t){return t!=null&&typeof t=="object"&&("body"in t||"cache"in t||"credentials"in t||"headers"in t||"integrity"in t||"keepalive"in t||"method"in t||"mode"in t||"redirect"in t||"referrer"in t||"referrerPolicy"in t||"signal"in t||"window"in t)}function st(...t){let[e,...r]=t.filter(n=>n!=null&&typeof n=="object");return r.forEach(n=>{let s=Object.getOwnPropertyNames(n).reduce((i,o)=>(Object.getOwnPropertyDescriptor(n,o)&&(i[o]=Object.getOwnPropertyDescriptor(n,o)),i),{});Object.getOwnPropertySymbols(n).forEach(i=>{let o=Object.getOwnPropertyDescriptor(n,i);o?.enumerable&&(s[i]=o);}),Object.defineProperties(e,s);}),e}function Ci(t,e){return new e(t.stack||t.message||t.toString(),{status:t.status||500})}function Ai(t,e){return t==null?e==null?{}:{waitUntil:e}:st(Object.create(t),{waitUntil:e},t)}function Ri(t,e){if(e?.aborted)throw e.reason;if($(t)&&e){let s=function(){n.reject(e.reason);};let n=Ft();return e.addEventListener("abort",s,{once:true}),t.then(function(o){n.resolve(o);}).catch(function(o){n.reject(o);}).finally(()=>{e.removeEventListener("abort",s);}),n.promise}return t}var Fm=["SIGINT","exit","SIGTERM"],dn=new Set,Xc=false;function jm(){if(!Xc){Xc=true;for(let t of Fm)globalThis.process.once(t,function(){return Promise.allSettled([...dn].map(r=>!r.disposed&&r.disposeAsync()))});}}function ou(t){globalThis.process&&(jm(),dn.has(t)||(dn.add(t),t.defer(()=>{dn.delete(t);})));}var Ei=class extends EventTarget{aborted=false;_onabort=null;_reason;constructor(){super();let e=globalThis.process?.getBuiltinModule?.("node:events");e?.kMaxEventTargetListeners&&(this[e.kMaxEventTargetListeners]=0);}throwIfAborted(){if(this._nativeCtrl?.signal?.throwIfAborted)return this._nativeCtrl.signal.throwIfAborted();if(this.aborted)throw this._reason}_nativeCtrl;ensureNativeCtrl(){if(!this._nativeCtrl){let e=this.aborted;this._nativeCtrl=new AbortController,e&&this._nativeCtrl.abort(this._reason);}return this._nativeCtrl}abort(e){if(this._nativeCtrl?.abort)return this._nativeCtrl?.abort(e);this._reason=e||new DOMException("This operation was aborted","AbortError"),this.aborted=true,this.dispatchEvent(new Event("abort"));}get signal(){return this._nativeCtrl?.signal?this._nativeCtrl.signal:this}get reason(){return this._nativeCtrl?.signal?this._nativeCtrl.signal.reason:this._reason}get onabort(){return this._onabort?this._onabort:this._onabort}set onabort(e){if(this._nativeCtrl?.signal){this._nativeCtrl.signal.onabort=e;return}this._onabort&&this.removeEventListener("abort",this._onabort),this._onabort=e,e&&this.addEventListener("abort",e);}};function vi(){return globalThis.Bun||globalThis.Deno?new AbortController:new Proxy(new Ei,{get(t,e,r){if(e.toString().includes("kDependantSignals")){let n=t.ensureNativeCtrl();return Reflect.get(n.signal,e,n.signal)}return Reflect.get(t,e,r)},set(t,e,r,n){if(e.toString().includes("kDependantSignals")){let s=t.ensureNativeCtrl();return Reflect.set(s.signal,e,r,s.signal)}return Reflect.set(t,e,r,n)},getPrototypeOf(){return AbortSignal.prototype}})}function au(t){return !!t.onData}function lu({req:t,res:e,fetchAPI:r,controller:n}){let s=t.getMethod(),i,o=[],a=[S=>{o.push(S);}],c=S=>{for(let w of a)w(S);},l=false,u=[()=>{l=true;}],f=()=>{for(let S of u)S();};e.onData(function(S,w){c(Buffer.from(Buffer.from(S,0,S.byteLength))),w&&f();});let d;if(s!=="get"&&s!=="head"){i="half",n.signal.addEventListener("abort",()=>{f();},{once:true});let S;d=()=>(S||(S=new r.ReadableStream({start(w){for(let R of o)w.enqueue(R);if(l){w.close();return}a.push(R=>{w.enqueue(R);}),u.push(()=>{if(n.signal.reason){w.error(n.signal.reason);return}w.desiredSize&&w.close();});}})),S);}let h=new r.Headers;t.forEach((S,w)=>{h.append(S,w);});let m=`http://localhost${t.getUrl()}`,g=t.getQuery();g&&(m+=`?${g}`);let A;function x(){return d?l?E():d():null}let L=new r.Request(m,{method:s,headers:h,get body(){return x()},signal:n.signal,duplex:i});function E(){return A||(A=o.length===1?o[0]:Buffer.concat(o)),A}function T(){return l?U(E()):new Promise((S,w)=>{try{u.push(()=>{S(E());});}catch(R){w(R);}})}return Object.defineProperties(L,{body:{get(){return x()},configurable:true,enumerable:true},json:{value(){return T().then(S=>S.toString("utf8")).then(S=>JSON.parse(S))},configurable:true,enumerable:true},text:{value(){return T().then(S=>S.toString("utf8"))},configurable:true,enumerable:true},arrayBuffer:{value(){return T()},configurable:true,enumerable:true}}),L}function Nm(t,e){return new e.WritableStream({write(r){t.cork(()=>{t.write(r);});},close(){t.cork(()=>{t.end();});}})}function cu(t,e,r,n){if(!e){t.writeStatus("404 Not Found"),t.end();return}let s=e._buffer,i=e.bodyType==="String"?e.bodyInit:void 0;if(!r.signal.aborted&&(t.cork(()=>{t.writeStatus(`${e.status} ${e.statusText}`);let o=false;for(let[a,c]of e.headers)if(a!=="content-length"&&a!=="transfer-encoding"){if(a==="set-cookie"){if(o)continue;o=true;let l=e.headers.getSetCookie?.();if(l){for(let u of l)t.writeHeader(a,u);continue}}t.writeHeader(a,c);}i?t.end(i):s?t.end(s):e.body||t.end();}),!(i||s||!e.body)))return r.signal.addEventListener("abort",()=>{e.body?.locked||e.body?.cancel(r.signal.reason);},{once:true}),e.body.pipeTo(Nm(t,n),{signal:r.signal}).catch(o=>{if(!r.signal.aborted)throw o})}function Um(t){try{return !!t?.request}catch{return false}}var $m={};function uu(t,e){let r=e?.__useSingleWriteHead==null?true:e.__useSingleWriteHead,n={...qm,...e?.fetchAPI},s=e?.__useCustomAbortCtrl==null?n.Request!==globalThis.Request:e.__useCustomAbortCtrl,i=typeof t=="function"?t:t.handle,o=[],a=[],c,l=new Set,u;function f(){return u||(u=new Xo,e?.disposeOnProcessTerminate&&ou(u),u.defer(()=>{if(l.size>0)return Promise.allSettled(l).then(()=>{l.clear();},()=>{l.clear();})})),u}function d(p){$(p)&&(f(),l.add(p),p.then(()=>{l.delete(p);},b=>{console.error(`Unexpected error while waiting: ${b.message||b}`),l.delete(p);}));}if(e?.plugins!=null)for(let p of e.plugins){p.instrumentation&&(c=c?pt(c,p.instrumentation):p.instrumentation),p.onRequest&&o.push(p.onRequest),p.onResponse&&a.push(p.onResponse);let b=p[M.dispose];b&&f().defer(b);let _=p[M.asyncDispose];_&&f().defer(_),p.onDispose&&f().defer(p.onDispose);}let h=o.length>0||a.length>0?function(b,_){let P=i,v;if(o.length===0)return z();let O=b.parsedUrl||new Proxy($m,{get(q,Q,re){return O=new n.URL(b.url,"http://localhost"),Reflect.get(O,Q,O)}});function N(q){return a.length===0?q:C(()=>V(a,Q=>Q({request:b,response:q,serverContext:_,setResponse(re){q=re;},fetchAPI:n})),()=>q)}function z(){return v?N(v):C(()=>P(b,_),N)}return C(()=>V(o,(q,Q)=>q({request:b,setRequest(re){b=re;},serverContext:_,fetchAPI:n,url:O,requestHandler:P,setRequestHandler(re){P=re;},endResponse(re){v=re,re&&Q();}})),z)}:i;if(c?.request){let p=h;h=(b,_)=>Ze({request:b}).asyncFn(c.request,p)(b,_);}function m(p,...b){let _=b.length>1?st(...b):b[0]||{};_.waitUntil||(_.waitUntil=d);let P=Ti(p,n,void 0,s);return h(P,_)}function g(p,b,..._){let P=b.raw||b,v=_.length>1?st(..._):_[0]||{};v.waitUntil||(v.waitUntil=d);let O=Ti(p,n,P,s);return h(O,v)}function A(p,b,..._){let P={req:p,res:b,waitUntil:d};return jt(U().then(()=>g(p,b,P,..._)).catch(v=>Ci(v,n.Response)).then(v=>su(v,b,p,r)).catch(v=>console.error(`Unexpected error while handling request: ${v.message||v}`)))}function x(p,b,..._){let P={res:p,req:b,waitUntil:d},O=_.filter(ee=>ee!=null).length>0?st(P,..._):P,N=s?vi():new AbortController,z=p.end.bind(p),q=false;p.end=function(ee){return q=true,z(ee)},p.onAborted.bind(p)(function(){N.abort();}),p.onAborted=function(ee){N.signal.addEventListener("abort",ee,{once:true});};let re=lu({req:b,res:p,fetchAPI:n,controller:N});return C(()=>C(()=>h(re,O),ee=>ee,ee=>Ci(ee,n.Response)),ee=>{if(!N.signal.aborted&&!q)return C(()=>cu(p,ee,N,n),ge=>ge,ge=>{console.error(`Unexpected error while handling request: ${ge.message||ge}`);})})}function L(p,...b){if(!p.respondWith||!p.request)throw new TypeError(`Expected FetchEvent, got ${p}`);let _=b.filter(O=>O!=null),P=_.length>0?st({},p,..._):Ai(p),v=h(p.request,P);p.respondWith(v);}function E(p,...b){let _=b.filter(v=>v!=null),P=_.length>1?st({},..._):Ai(_[0],_[0]==null||_[0].waitUntil==null?d:void 0);return h(p,P)}let T=(p,...b)=>{if(typeof p=="string"||"href"in p){let[P,...v]=b;if(iu(P)){let N=new n.Request(p,P),z=E(N,...v),q=P.signal;return q?Ri(z,q):z}let O=new n.Request(p);return E(O,...b)}let _=E(p,...b);return Ri(_,p.signal)},S=(p,...b)=>{let[_,...P]=b;if(tu(p)){if(!Pi(_))throw new TypeError(`Expected ServerResponse, got ${_}`);return A(p,_,...P)}if(au(p))return x(p,_,...P);if(Pi(_))throw new TypeError("Got Node response without Node request");return Um(p)?ru(p)?L(p,...b):E(p.request,p,...b):T(p,...b)},w={handleRequest:E,fetch:T,handleNodeRequest:m,handleNodeRequestAndResponse:g,requestListener:A,handleEvent:L,handleUWS:x,handle:S,get disposableStack(){return f()},[M.asyncDispose](){return u&&!u.disposed?u.disposeAsync():U()},dispose(){return u&&!u.disposed?u.disposeAsync():U()},waitUntil:d},R=new Proxy(S,{has:(p,b)=>b in w||b in S||t&&b in t,get:(p,b)=>{if(globalThis.Deno||b===Symbol.asyncDispose||b===Symbol.dispose){let v=Reflect.get(w,b,w);if(v)return v}let _=w[b];if(_)return _.bind?_.bind(w):_;let P=S[b];if(P)return P.bind?P.bind(S):P;if(t){let v=t[b];if(v)return v.bind?function(...O){let N=t[b](...O);return N===t?R:N}:v}},apply(p,b,_){return S(..._)}});return R}function Bm(t,e){let r=t.headers.get("origin");if(e===false||r==null)return null;let n={};if(e.origin==null||e.origin.length===0||e.origin.includes("*")?(n["Access-Control-Allow-Origin"]=r,n.Vary="Origin"):typeof e.origin=="string"?n["Access-Control-Allow-Origin"]=e.origin:Array.isArray(e.origin)&&(e.origin.length===1?n["Access-Control-Allow-Origin"]=e.origin[0]:e.origin.includes(r)?(n["Access-Control-Allow-Origin"]=r,n.Vary="Origin"):n["Access-Control-Allow-Origin"]="null"),e.methods?.length)n["Access-Control-Allow-Methods"]=e.methods.join(", ");else {let s=t.headers.get("access-control-request-method");s&&(n["Access-Control-Allow-Methods"]=s);}if(e.allowedHeaders?.length)n["Access-Control-Allow-Headers"]=e.allowedHeaders.join(", ");else {let s=t.headers.get("access-control-request-headers");s&&(n["Access-Control-Allow-Headers"]=s,n.Vary?n.Vary+=", Access-Control-Request-Headers":n.Vary="Access-Control-Request-Headers");}return e.credentials!=null?e.credentials===true&&(n["Access-Control-Allow-Credentials"]="true"):n["Access-Control-Allow-Origin"]!=="*"&&(n["Access-Control-Allow-Credentials"]="true"),e.exposedHeaders&&(n["Access-Control-Expose-Headers"]=e.exposedHeaders.join(", ")),e.maxAge&&(n["Access-Control-Max-Age"]=e.maxAge.toString()),n}function Mm(t,e,r){return C(()=>e(t,r),n=>Bm(t,n))}function fu(t){let e=()=>({});if(t!=null)if(typeof t=="function")e=t;else if(typeof t=="object"){let r={...t};e=()=>r;}else t===false&&(e=()=>false);return {onRequest({request:r,fetchAPI:n,endResponse:s}){if(r.method.toUpperCase()==="OPTIONS"){let i=new n.Response(null,{status:204,headers:{"Content-Length":"0"}});s(i);}},onResponse({request:r,serverContext:n,response:s}){return C(()=>Mm(r,e,n),i=>{if(i!=null)for(let o in i)s.headers.set(o,i[o]);})}}}var Gm=["message","locations","path","nodes","source","positions","originalError","name","stack","extensions","coordinate"];function zm(t){return t!=null&&typeof t=="object"&&Object.keys(t).every(e=>Gm.includes(e))}function j(t,e){e?.originalError&&!(e.originalError instanceof Error)&&zm(e.originalError)&&(e.originalError=j(e.originalError.message,e.originalError));let r=b$4,n=a$5.major>=16?new r(t,e):new r(t,e?.nodes,e?.source,e?.positions,e?.path,e?.originalError,e?.extensions);return e?.coordinate&&n.coordinate==null&&Object.defineProperties(n,{coordinate:{value:e.coordinate,enumerable:true,configurable:true}}),n}function pn(t){return t.coordinate}function hu(t){return t?.[Symbol.asyncIterator]!=null}function Hm(t){return t!=null&&typeof t=="object"&&"errors"in t}function Vm(t){return t!=null&&typeof t.toString=="function"}function Ce(t){return t instanceof b$4}function mn(t){return t instanceof b$4?t.originalError!=null?mn(t.originalError):true:false}function ki(t){return typeof t=="object"&&t?.constructor?.name==="DOMException"&&(t.name==="AbortError"||t.name==="TimeoutError")}function At(t,e,r){let n=new Set;if(Hm(t))for(let s of t.errors){let i=At(s,e,r);for(let o of i)n.add(o);}else if(ki(t))r.debug("Request aborted");else if(e){let s=e.maskError(t,e.errorMessage,e.isDev);s!==t&&r.error(t),n.add(Ce(s)?s:j(s.message,{originalError:s}));}else Ce(t)?n.add(t):t instanceof Error?n.add(j(t.message,{originalError:t})):typeof t=="string"?n.add(j(t,{extensions:{code:"INTERNAL_SERVER_ERROR",unexpected:true}})):Vm(t)?n.add(j(t.toString(),{extensions:{code:"INTERNAL_SERVER_ERROR",unexpected:true}})):(r.error(t),n.add(j("Unexpected error.",{extensions:{unexpected:true}})));return Array.from(n)}function Rt(t,e={},r=false){let n,s=false;if("extensions"in t&&t.extensions?.http&&(t.extensions.http.headers&&Object.assign(e,t.extensions.http.headers),t.extensions.http.status&&(n=t.extensions.http.status)),"errors"in t&&t.errors?.length)for(let i of t.errors)if(i.extensions?.http){if(i.extensions.http.headers&&Object.assign(e,i.extensions.http.headers),r&&i.extensions.http.spec)continue;i.extensions.http.status&&(!n||i.extensions.http.status>n)&&(n=i.extensions.http.status);}else (!mn(i)||i.extensions?.unexpected)&&(s=true);else n||=200;return n||(s&&!("data"in t)?n=500:n=200),{status:n,headers:e}}function du(t){return Array.isArray(t)&&t.length>0&&t.some(Ce)}function pu(t){return {onResponse({response:e}){bu(e.headers,t);}}}function mu(t){return {onRequest({request:e}){bu(e.headers,t);}}}function bu(t,e){for(let r of t.keys())e.includes(r)||t.delete(r);}var xu=e(er(),1);var yu=e(er(),1);function Di(t){let e=t.get("operationName")||void 0,r=t.get("query")||void 0,n=t.get("variables")||void 0,s=t.get("extensions")||void 0;return {operationName:e,query:r,variables:n?JSON.parse(n):void 0,extensions:s?JSON.parse(s):void 0}}function gu(t){let e=new yu.URLSearchParams(t);return Di(e)}function Oe(t,e){let r=t.headers.get("content-type");return r=r?.split(",")[0]||null,r===e||!!r?.startsWith(`${e};`)}function _u(t){return t.method==="GET"}function Su(t){let e=t.url.substring(t.url.indexOf("?")+1),r=new xu.URLSearchParams(e);return Di(r)}function wu(t){return t.method==="POST"&&Oe(t,"application/x-www-form-urlencoded")}function Eu(t){return t.text().then(gu)}function Tu(t){return t.method==="POST"&&Oe(t,"application/graphql")}function Pu(t){return t.text().then(e=>({query:e}))}function Cu(t){return t.method==="POST"&&(Oe(t,"application/json")||Oe(t,"application/graphql+json"))}function Au(t){return C(()=>t.json(),e=>{if(e==null)throw j(`POST body is expected to be object but received ${e}`,{extensions:{http:{status:400},code:"BAD_REQUEST"}});let r=typeof e;if(r!=="object")throw j(`POST body is expected to be object but received ${r}`,{extensions:{http:{status:400},code:"BAD_REQUEST"}});return e},e=>{if(e instanceof b$4)throw e;let r={http:{spec:true,status:400},code:"BAD_REQUEST"};throw e instanceof Error&&(r.originalError={name:e.name,message:e.message}),j("POST body sent invalid JSON.",{extensions:r})})}function Ru(t){return t.method==="POST"&&Oe(t,"multipart/form-data")}function vu(t){return C(()=>t.formData(),e=>{let r=e.get("operations");if(!r)throw j('Missing multipart form field "operations"');if(typeof r!="string")throw j('Multipart form field "operations" must be a string');let n;try{n=JSON.parse(r);}catch{throw j('Multipart form field "operations" must be a valid JSON string')}let s=e.get("map");if(s!=null){if(typeof s!="string")throw j('Multipart form field "map" must be a string');let i;try{i=JSON.parse(s);}catch{throw j('Multipart form field "map" must be a valid JSON string')}for(let o in i){let a=e.get(o),c=i[o];for(let l of c)Wm(n,l,a);}}return n},e=>{throw e instanceof Error&&e.message.startsWith("File size limit exceeded: ")?j(e.message,{extensions:{http:{status:413}}}):e})}function Wm(t,e,r){let n=e.split("."),s=t;for(let i=0;i<n.length;i++){let o=n[i];if(o==="__proto__"||o==="constructor"||o==="prototype")return;i===n.length-1?s[o]=r:(o in s||(s[o]={}),s=s[o]);}}var Qm=new Set(["query","variables","operationName","extensions"]);function Zm(t,e){if(t==null||typeof t!="object")throw j('Invalid "params" in the request body',{extensions:{http:{spec:true,status:400},code:"BAD_REQUEST"}});for(let r in t)if(t[r]!=null&&!Qm.has(r)){if(e?.includes(r))continue;throw j(`Unexpected parameter "${r}" in the request body.`,{extensions:{http:{status:400},code:"BAD_REQUEST"}})}}function Km(t,e){if(!Jm(t))throw j(`Expected params to be an object but given ${rr(t)}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});if(Zm(t,e),t.query==null)throw j("Must provide query string.",{extensions:{http:{spec:true,status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});let r=rr(t.query);if(r!=="string")throw j(`Expected "query" param to be a string, but given ${r}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});let n=rr(t.variables);if(!["object","null","undefined"].includes(n))throw j(`Expected "variables" param to be empty or an object, but given ${n}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});let s=rr(t.extensions);if(!["object","null","undefined"].includes(s))throw j(`Expected "extensions" param to be empty or an object, but given ${s}.`,{extensions:{http:{status:400,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}});return t}function ku(t){return {onParams({params:e}){Km(e,t);}}}function rr(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function Jm(t){return rr(t)==="object"}function Xm(t){return t==="GET"||t==="POST"}function Du(){return {onRequestParse({request:t}){if(!Xm(t.method))throw j("GraphQL only supports GET and POST requests.",{extensions:{http:{status:405,headers:{Allow:"GET, POST"}},code:"BAD_REQUEST"}})}}}function Lu(){return {onValidate(){return ({valid:t,result:e})=>{if(!t)for(let r of e)r.extensions||={},r.extensions.code||="GRAPHQL_VALIDATION_FAILED",r.extensions.http||={},r.extensions.http.spec=r.extensions.http.spec==null?true:r.extensions.http.spec,r.extensions.http.status||=400;}}}}function Ou(t){return {onRequestParse(){return {onRequestParseDone({requestParserResult:e}){if(Array.isArray(e)){if(!t)throw j("Batching is not supported.",{extensions:{http:{status:400},code:"BAD_REQUEST"}});if(e.length>t)throw j(`Batching is limited to ${t} operations per request.`,{extensions:{http:{status:413},code:"BAD_REQUEST"}})}}}}}}function Ym(t,e,r){let n=e?E(e,r)??void 0:void 0;if(!n)throw j("Could not determine what operation to execute.",{extensions:{code:"OPERATION_RESOLUTION_FAILURE",http:{status:400}}});if(n.operation==="mutation"&&t==="GET")throw j("Can only perform a mutation operation from a POST request.",{extensions:{http:{status:405,headers:{Allow:"POST"}},code:"BAD_REQUEST"}})}function Iu(){return {onParse(){return ({result:t,context:{request:e,params:{operationName:r}={}}})=>{if(e)if(t instanceof Error){if(t instanceof b$4){let n=t.extensions||={};n.code||="GRAPHQL_PARSE_FAILED";let s=n.http||={};s.spec||=true,s.status||=400;}}else Ym(e.method,t,r);}}}}function Fu({id:t=Date.now().toString(),logger:e=console,endpoint:r="/health"}={}){return {onRequest({endResponse:n,fetchAPI:s,request:i}){if(i.url.endsWith(r)){e.debug("Responding Health Check");let o=new s.Response(null,{status:200,headers:{"x-yoga-id":t}});n(o);}}}}var vt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Nu=new Set,Li=typeof process=="object"&&process?process:{},qu=(t,e,r,n)=>{typeof Li.emitWarning=="function"?Li.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`);},bn=globalThis.AbortController,ju=globalThis.AbortSignal;if(typeof bn>"u"){ju=class{onabort;_onabort=[];reason;aborted=false;addEventListener(n,s){this._onabort.push(s);}},bn=class{constructor(){e();}signal=new ju;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=true;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n);}}};let t=Li.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=false,qu("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var eb=t=>!Nu.has(t);var He=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Uu=t=>He(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?kt:null:null,kt=class extends Array{constructor(e){super(e),this.fill(0);}},Oi=class t{heap;length;static#o=false;static create(e){let r=Uu(e);if(!r)return [];t.#o=true;let n=new t(e,r);return t.#o=false,n}constructor(e,r){if(!t.#o)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},yn=class t{#o;#r;#n;#t;#p;#S;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#y;#l;#i;#e;#m;#b;#f;#u;#c;#h;#E;#g;#x;#T;#P;#d;static unsafeExposeInternals(e){return {starts:e.#g,ttls:e.#x,sizes:e.#E,keyMap:e.#l,keyList:e.#i,valList:e.#e,next:e.#m,prev:e.#b,get head(){return e.#f},get tail(){return e.#u},free:e.#c,isBackgroundFetch:r=>e.#a(r),backgroundFetch:(r,n,s,i)=>e.#N(r,n,s,i),moveToTail:r=>e.#I(r),indexes:r=>e.#R(r),rindexes:r=>e.#v(r),isStale:r=>e.#_(r)}}get max(){return this.#o}get maxSize(){return this.#r}get calculatedSize(){return this.#y}get size(){return this.#s}get fetchMethod(){return this.#p}get memoMethod(){return this.#S}get dispose(){return this.#n}get disposeAfter(){return this.#t}constructor(e){let{max:r=0,ttl:n,ttlResolution:s=1,ttlAutopurge:i,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:l,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:h=0,maxEntrySize:m=0,sizeCalculation:g,fetchMethod:A,memoMethod:x,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:S,ignoreFetchAbort:w}=e;if(r!==0&&!He(r))throw new TypeError("max option must be a nonnegative integer");let R=r?Uu(r):Array;if(!R)throw new Error("invalid max value: "+r);if(this.#o=r,this.#r=h,this.maxEntrySize=m||this.#r,this.sizeCalculation=g,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#S=x,A!==void 0&&typeof A!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#p=A,this.#P=!!A,this.#l=new Map,this.#i=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#m=new R(r),this.#b=new R(r),this.#f=0,this.#u=0,this.#c=Oi.create(r),this.#s=0,this.#y=0,typeof l=="function"&&(this.#n=l),typeof u=="function"?(this.#t=u,this.#h=[]):(this.#t=void 0,this.#h=void 0),this.#T=!!this.#n,this.#d=!!this.#t,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!w,this.maxEntrySize!==0){if(this.#r!==0&&!He(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!He(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#w();}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=He(s)||s===0?s:1,this.ttlAutopurge=!!i,this.ttl=n||0,this.ttl){if(!He(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#C();}if(this.#o===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#o&&!this.#r){let p="LRU_CACHE_UNBOUNDED";eb(p)&&(Nu.add(p),qu("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",p,t));}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#C(){let e=new kt(this.#o),r=new kt(this.#o);this.#x=e,this.#g=r,this.#O=(i,o,a=vt.now())=>{if(r[i]=o!==0?a:0,e[i]=o,o!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#_(i)&&this.#k(this.#i[i],"expire");},o+1);c.unref&&c.unref();}},this.#D=i=>{r[i]=e[i]!==0?vt.now():0;},this.#A=(i,o)=>{if(e[o]){let a=e[o],c=r[o];if(!a||!c)return;i.ttl=a,i.start=c,i.now=n||s();let l=i.now-c;i.remainingTTL=a-l;}};let n=0,s=()=>{let i=vt.now();if(this.ttlResolution>0){n=i;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref();}return i};this.getRemainingTTL=i=>{let o=this.#l.get(i);if(o===void 0)return 0;let a=e[o],c=r[o];if(!a||!c)return 1/0;let l=(n||s())-c;return a-l},this.#_=i=>{let o=r[i],a=e[i];return !!a&&!!o&&(n||s())-o>a};}#D=()=>{};#A=()=>{};#O=()=>{};#_=()=>false;#w(){let e=new kt(this.#o);this.#y=0,this.#E=e,this.#L=r=>{this.#y-=e[r],e[r]=0;},this.#q=(r,n,s,i)=>{if(this.#a(n))return 0;if(!He(s))if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(s=i(n,r),!He(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#F=(r,n,s)=>{if(e[r]=n,this.#r){let i=this.#r-e[r];for(;this.#y>i;)this.#j(true);}this.#y+=e[r],s&&(s.entrySize=n,s.totalCalculatedSize=this.#y);};}#L=e=>{};#F=(e,r,n)=>{};#q=(e,r,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#R({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#u;!(!this.#U(r)||((e||!this.#_(r))&&(yield r),r===this.#f));)r=this.#b[r];}*#v({allowStale:e=this.allowStale}={}){if(this.#s)for(let r=this.#f;!(!this.#U(r)||((e||!this.#_(r))&&(yield r),r===this.#u));)r=this.#m[r];}#U(e){return e!==void 0&&this.#l.get(this.#i[e])===e}*entries(){for(let e of this.#R())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#a(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*rentries(){for(let e of this.#v())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#a(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*keys(){for(let e of this.#R()){let r=this.#i[e];r!==void 0&&!this.#a(this.#e[e])&&(yield r);}}*rkeys(){for(let e of this.#v()){let r=this.#i[e];r!==void 0&&!this.#a(this.#e[e])&&(yield r);}}*values(){for(let e of this.#R())this.#e[e]!==void 0&&!this.#a(this.#e[e])&&(yield this.#e[e]);}*rvalues(){for(let e of this.#v())this.#e[e]!==void 0&&!this.#a(this.#e[e])&&(yield this.#e[e]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#R()){let s=this.#e[n],i=this.#a(s)?s.__staleWhileFetching:s;if(i!==void 0&&e(i,this.#i[n],this))return this.get(this.#i[n],r)}}forEach(e,r=this){for(let n of this.#R()){let s=this.#e[n],i=this.#a(s)?s.__staleWhileFetching:s;i!==void 0&&e.call(r,i,this.#i[n],this);}}rforEach(e,r=this){for(let n of this.#v()){let s=this.#e[n],i=this.#a(s)?s.__staleWhileFetching:s;i!==void 0&&e.call(r,i,this.#i[n],this);}}purgeStale(){let e=false;for(let r of this.#v({allowStale:true}))this.#_(r)&&(this.#k(this.#i[r],"expire"),e=true);return e}info(e){let r=this.#l.get(e);if(r===void 0)return;let n=this.#e[r],s=this.#a(n)?n.__staleWhileFetching:n;if(s===void 0)return;let i={value:s};if(this.#x&&this.#g){let o=this.#x[r],a=this.#g[r];if(o&&a){let c=o-(vt.now()-a);i.ttl=c,i.start=Date.now();}}return this.#E&&(i.size=this.#E[r]),i}dump(){let e=[];for(let r of this.#R({allowStale:true})){let n=this.#i[r],s=this.#e[r],i=this.#a(s)?s.__staleWhileFetching:s;if(i===void 0||n===void 0)continue;let o={value:i};if(this.#x&&this.#g){o.ttl=this.#x[r];let a=vt.now()-this.#g[r];o.start=Math.floor(Date.now()-a);}this.#E&&(o.size=this.#E[r]),e.unshift([n,o]);}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let s=Date.now()-n.start;n.start=vt.now()-s;}this.set(r,n.value,n);}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,u=this.#q(e,r,n.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),this.#k(e,"set"),this;let f=this.#s===0?void 0:this.#l.get(e);if(f===void 0)f=this.#s===0?this.#u:this.#c.length!==0?this.#c.pop():this.#s===this.#o?this.#j(false):this.#s,this.#i[f]=e,this.#e[f]=r,this.#l.set(e,f),this.#m[this.#u]=f,this.#b[f]=this.#u,this.#u=f,this.#s++,this.#F(f,u,c),c&&(c.set="add"),l=false;else {this.#I(f);let d=this.#e[f];if(r!==d){if(this.#P&&this.#a(d)){d.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:h}=d;h!==void 0&&!o&&(this.#T&&this.#n?.(h,e,"set"),this.#d&&this.#h?.push([h,e,"set"]));}else o||(this.#T&&this.#n?.(d,e,"set"),this.#d&&this.#h?.push([d,e,"set"]));if(this.#L(f),this.#F(f,u,c),this.#e[f]=r,c){c.set="replace";let h=d&&this.#a(d)?d.__staleWhileFetching:d;h!==void 0&&(c.oldValue=h);}}else c&&(c.set="update");}if(s!==0&&!this.#x&&this.#C(),this.#x&&(l||this.#O(f,s,i),c&&this.#A(c,f)),!o&&this.#d&&this.#h){let d=this.#h,h;for(;h=d?.shift();)this.#t?.(...h);}return this}pop(){try{for(;this.#s;){let e=this.#e[this.#f];if(this.#j(!0),this.#a(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#d&&this.#h){let e=this.#h,r;for(;r=e?.shift();)this.#t?.(...r);}}}#j(e){let r=this.#f,n=this.#i[r],s=this.#e[r];return this.#P&&this.#a(s)?s.__abortController.abort(new Error("evicted")):(this.#T||this.#d)&&(this.#T&&this.#n?.(s,n,"evict"),this.#d&&this.#h?.push([s,n,"evict"])),this.#L(r),e&&(this.#i[r]=void 0,this.#e[r]=void 0,this.#c.push(r)),this.#s===1?(this.#f=this.#u=0,this.#c.length=0):this.#f=this.#m[r],this.#l.delete(n),this.#s--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=r,i=this.#l.get(e);if(i!==void 0){let o=this.#e[i];if(this.#a(o)&&o.__staleWhileFetching===void 0)return false;if(this.#_(i))s&&(s.has="stale",this.#A(s,i));else return n&&this.#D(i),s&&(s.has="hit",this.#A(s,i)),true}else s&&(s.has="miss");return false}peek(e,r={}){let{allowStale:n=this.allowStale}=r,s=this.#l.get(e);if(s===void 0||!n&&this.#_(s))return;let i=this.#e[s];return this.#a(i)?i.__staleWhileFetching:i}#N(e,r,n,s){let i=r===void 0?void 0:this.#e[r];if(this.#a(i))return i;let o=new bn,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:s},l=(g,A=false)=>{let{aborted:x}=o.signal,L=n.ignoreFetchAbort&&g!==void 0;if(n.status&&(x&&!A?(n.status.fetchAborted=true,n.status.fetchError=o.signal.reason,L&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),x&&!L&&!A)return f(o.signal.reason);let E=h;return this.#e[r]===h&&(g===void 0?E.__staleWhileFetching?this.#e[r]=E.__staleWhileFetching:this.#k(e,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(e,g,c.options))),g},u=g=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=g),f(g)),f=g=>{let{aborted:A}=o.signal,x=A&&n.allowStaleOnFetchAbort,L=x||n.allowStaleOnFetchRejection,E=L||n.noDeleteOnFetchRejection,T=h;if(this.#e[r]===h&&(!E||T.__staleWhileFetching===void 0?this.#k(e,"fetch"):x||(this.#e[r]=T.__staleWhileFetching)),L)return n.status&&T.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw g},d=(g,A)=>{let x=this.#p?.(e,i,c);x&&x instanceof Promise&&x.then(L=>g(L===void 0?void 0:L),A),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(g(void 0),n.allowStaleOnFetchAbort&&(g=L=>l(L,true)));});};n.status&&(n.status.fetchDispatched=true);let h=new Promise(d).then(l,u),m=Object.assign(h,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return r===void 0?(this.set(e,m,{...c.options,status:void 0}),r=this.#l.get(e)):this.#e[r]=m,m}#a(e){if(!this.#P)return false;let r=e;return !!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof bn}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:h=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:g,forceRefresh:A=false,status:x,signal:L}=r;if(!this.#P)return x&&(x.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:i,status:x});let E={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:m,ignoreFetchAbort:h,status:x,signal:L},T=this.#l.get(e);if(T===void 0){x&&(x.fetch="miss");let S=this.#N(e,T,E,g);return S.__returned=S}else {let S=this.#e[T];if(this.#a(S)){let _=n&&S.__staleWhileFetching!==void 0;return x&&(x.fetch="inflight",_&&(x.returnedStale=true)),_?S.__staleWhileFetching:S.__returned=S}let w=this.#_(T);if(!A&&!w)return x&&(x.fetch="hit"),this.#I(T),s&&this.#D(T),x&&this.#A(x,T),S;let R=this.#N(e,T,E,g),b=R.__staleWhileFetching!==void 0&&n;return x&&(x.fetch=w?"stale":"refresh",b&&w&&(x.returnedStale=true)),b?R.__staleWhileFetching:R.__returned=R}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#S;if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:i,...o}=r,a=this.get(e,o);if(!i&&a!==void 0)return a;let c=n(e,a,{options:o,context:s});return this.set(e,c,o),c}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=r,a=this.#l.get(e);if(a!==void 0){let c=this.#e[a],l=this.#a(c);return o&&this.#A(o,a),this.#_(a)?(o&&(o.get="stale"),l?(o&&n&&c.__staleWhileFetching!==void 0&&(o.returnedStale=true),n?c.__staleWhileFetching:void 0):(i||this.#k(e,"expire"),o&&n&&(o.returnedStale=true),n?c:void 0)):(o&&(o.get="hit"),l?c.__staleWhileFetching:(this.#I(a),s&&this.#D(a),c))}else o&&(o.get="miss");}#$(e,r){this.#b[r]=e,this.#m[e]=r;}#I(e){e!==this.#u&&(e===this.#f?this.#f=this.#m[e]:this.#$(this.#b[e],this.#m[e]),this.#$(this.#u,e),this.#u=e);}delete(e){return this.#k(e,"delete")}#k(e,r){let n=false;if(this.#s!==0){let s=this.#l.get(e);if(s!==void 0)if(n=true,this.#s===1)this.#B(r);else {this.#L(s);let i=this.#e[s];if(this.#a(i)?i.__abortController.abort(new Error("deleted")):(this.#T||this.#d)&&(this.#T&&this.#n?.(i,e,r),this.#d&&this.#h?.push([i,e,r])),this.#l.delete(e),this.#i[s]=void 0,this.#e[s]=void 0,s===this.#u)this.#u=this.#b[s];else if(s===this.#f)this.#f=this.#m[s];else {let o=this.#b[s];this.#m[o]=this.#m[s];let a=this.#m[s];this.#b[a]=this.#b[s];}this.#s--,this.#c.push(s);}}if(this.#d&&this.#h?.length){let s=this.#h,i;for(;i=s?.shift();)this.#t?.(...i);}return n}clear(){return this.#B("delete")}#B(e){for(let r of this.#v({allowStale:true})){let n=this.#e[r];if(this.#a(n))n.__abortController.abort(new Error("deleted"));else {let s=this.#i[r];this.#T&&this.#n?.(n,s,e),this.#d&&this.#h?.push([n,s,e]);}}if(this.#l.clear(),this.#e.fill(void 0),this.#i.fill(void 0),this.#x&&this.#g&&(this.#x.fill(0),this.#g.fill(0)),this.#E&&this.#E.fill(0),this.#f=0,this.#u=0,this.#c.length=0,this.#y=0,this.#s=0,this.#d&&this.#h){let r=this.#h,n;for(;n=r?.shift();)this.#t?.(...n);}}};var tb=1024,rb=36e5;function gn({max:t=tb,ttl:e=rb}={}){return new yn({max:t,ttl:e})}function $u({documentCache:t=gn(),errorCache:e=gn(),validationCache:r=true}){let n=gn();return {onParse({params:s,setParsedDocument:i}){let o=s.source.toString(),a=t.get(o);if(a){i(a);return}let c=e.get(o);if(c)throw c;return ({result:l})=>{l!=null&&(l instanceof Error?e.set(o,l):t.set(o,l));}},onValidate({params:{schema:s,documentAST:i,rules:o},setResult:a}){if(s!=null&&r!==false){let c=o?.map(d=>d.name).join(",")||"",l=n.get(c);l||(l=new WeakMap,n.set(c,l));let u=l.get(s);u||(u=new WeakMap,l.set(s,u));let f=u.get(i);if(f){a(f);return}return ({result:d})=>{d!=null&&u?.set(i,d);}}}}}var nb=()=>true;function Dt(t){let e=t.match||nb;return {onRequestParse({request:r,setRequestParser:n}){e(r)&&n(t.parse);}}}function Bu(t){let e=(t.headers.get("accept")||"*/*").replace(/\s/g,"").toLowerCase().split(","),r=[];for(let n of e){let[s,...i]=n.split(";");s===void 0||(i?.find(a=>a.includes("charset="))||"charset=utf-8")!=="charset=utf-8"||r.push(s);}return r.reverse()}function Mu(t,e){let[r,n]=t.split("/"),[s,i]=e.split("/");return (s==="*"||s===r)&&(i==="*"||i===n)}function Lt(t){if(Array.isArray(t))return `[${t.map(n=>{let s=Gu(n);return (n.stringify||JSON.stringify)(s)}).join(",")}]`;let e=Gu(t);return (t.stringify||JSON.stringify)(e)}function Gu(t){if(t.errors?.length||t.extensions?.http){let e={...t};if(e.errors&&=e.errors.map(zu),e.extensions){let{http:r,...n}=t.extensions;e.extensions=Object.keys(n).length?n:void 0;}return e}return t}function zu(t){if(Ce(t)){let e="toJSON"in t&&typeof t.toJSON=="function"?t.toJSON():Object(t),{http:r,unexpected:n,...s}=e.extensions||{};return j(t.message,{nodes:t.nodes,source:t.source,positions:t.positions,path:t.path,originalError:zu(t.originalError||void 0),extensions:Object.keys(s).length?s:void 0,coordinate:pn(t)})}return t}function Hu(t,e){let n=Rt(t,{Connection:"keep-alive","Content-Type":'multipart/mixed; boundary="-"',"Transfer-Encoding":"chunked"}),s,i=new e.TextEncoder,o=new e.ReadableStream({start(a){if(oe(t))s=t[Symbol.asyncIterator]();else {let c=false;s={next:()=>c?U({done:true,value:null}):(c=true,U({done:false,value:t}))};}a.enqueue(i.encode(`\r
|
|
23
|
+
`)),a.enqueue(i.encode("---"));},pull(a){return C(()=>s.next(),({done:c,value:l})=>{if(l!=null){a.enqueue(i.encode(`\r
|
|
24
|
+
`)),a.enqueue(i.encode("Content-Type: application/json; charset=utf-8")),a.enqueue(i.encode(`\r
|
|
25
|
+
`));let u=Lt(l),f=i.encode(u);a.enqueue(i.encode("Content-Length: "+f.byteLength)),a.enqueue(i.encode(`\r
|
|
26
|
+
`)),a.enqueue(i.encode(`\r
|
|
27
|
+
`)),a.enqueue(f),a.enqueue(i.encode(`\r
|
|
28
|
+
`)),a.enqueue(i.encode("---"));}c&&(a.enqueue(i.encode(`--\r
|
|
29
|
+
`)),a.close());},c=>{a.error(c);})},cancel(a){if(s.return)return C(()=>s.return?.(a),()=>{})}});return new e.Response(o,n)}function Vu(t,e,r){if(hu(t))return new e.Response(null,{status:406,statusText:"Not Acceptable",headers:{accept:"application/json; charset=utf-8, application/graphql-response+json; charset=utf-8"}});let n={"Content-Type":r+"; charset=utf-8"},s=Rt(t,n,r==="application/json"&&!Array.isArray(t)&&du(t.errors)&&t.errors.some(o=>!o.extensions?.originalError||Ce(o.extensions.originalError))),i=Lt(t);return new e.Response(i,s)}function Wu(){return function(e,r){let n=12e3;globalThis.process?.env?.NODE_ENV==="test"&&(n=300);let i=Rt(e,{"Content-Type":"text/event-stream",Connection:"keep-alive","Cache-Control":"no-cache","Content-Encoding":"none"},true),o,a,c=new r.TextEncoder,l=new r.ReadableStream({start(u){if(u.enqueue(c.encode(`:
|
|
30
|
+
|
|
31
|
+
`)),a=setInterval(()=>{if(!u.desiredSize){clearInterval(a);return}u.enqueue(c.encode(`:
|
|
32
|
+
|
|
33
|
+
`));},n),oe(e))o=e[Symbol.asyncIterator]();else {let f=false;o={next:()=>f?U({done:true,value:null}):(f=true,U({done:false,value:e}))};}},pull(u){return C(()=>o.next(),f=>{if(f.value!=null){u.enqueue(c.encode(`event: next
|
|
34
|
+
`));let d=Lt(f.value);u.enqueue(c.encode(`data: ${d}
|
|
35
|
+
|
|
36
|
+
`));}f.done&&(u.enqueue(c.encode(`event: complete
|
|
37
|
+
`)),u.enqueue(c.encode(`data:
|
|
38
|
+
|
|
39
|
+
`)),clearInterval(a),u.close());},f=>{u.error(f);})},cancel(u){if(clearInterval(a),o.return)return C(()=>o.return?.(u),()=>{})}});return new r.Response(l,i)}}var sb={mediaTypes:["multipart/mixed"],asyncIterables:true,processResult:Hu};function ib(){return {mediaTypes:["text/event-stream"],asyncIterables:true,processResult:Wu()}}var Qu={mediaTypes:["application/graphql-response+json","application/json"],asyncIterables:false,processResult:Vu};function Zu(){let t=new WeakMap,e=ib(),r=[e,sb,Qu],n=[e,Qu];return {onSubscribe({args:{contextValue:s}}){s.request&&t.set(s.request,true);},onResultProcess({request:s,result:i,acceptableMediaTypes:o,setResultProcessor:a}){let l=t.get(s)?n:r,u=Bu(s),f=oe(i);for(let d of l)for(let h of u)if(!(f&&!d.asyncIterables))for(let m of d.mediaTypes)o.push(m),Mu(m,h)&&a(d.processResult,m);}}}var Ku=`<!doctype html><html lang=en><head><meta charset=utf-8><title>Welcome to GraphQL Yoga</title><link rel=icon href=https://raw.githubusercontent.com/graphql-hive/graphql-yoga/refs/heads/main/website/src/app/favicon.ico><style>body,html{padding:0;margin:0;height:100%;font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans','Helvetica Neue',sans-serif;color:#fff;background-color:#000}main>section.hero{display:flex;height:90vh;justify-content:center;align-items:center;flex-direction:column}.logo{display:flex;align-items:center}.buttons{margin-top:24px}h1{font-size:80px}h2{color:#888;max-width:50%;margin-top:0;text-align:center}a{color:#fff;text-decoration:none;margin-left:10px;margin-right:10px;font-weight:700;transition:color .3s ease;padding:4px;overflow:visible}a.graphiql:hover{color:rgba(255,0,255,.7)}a.docs:hover{color:rgba(28,200,238,.7)}a.tutorial:hover{color:rgba(125,85,245,.7)}svg{margin-right:24px}.not-what-your-looking-for{margin-top:5vh}.not-what-your-looking-for>*{margin-left:auto;margin-right:auto}.not-what-your-looking-for>p{text-align:center}.not-what-your-looking-for>h2{color:#464646}.not-what-your-looking-for>p{max-width:600px;line-height:1.3em}.not-what-your-looking-for>pre{max-width:300px}</style></head><body id=body><main><section class=hero><div class=logo><div><svg xmlns=http://www.w3.org/2000/svg viewBox="-0.41 0.445 472.812 499.811" height=150><defs><linearGradient id=paint0_linear_1677_11483 x1=16 y1=14 x2=87.2132 y2=44.5982 gradientUnits=userSpaceOnUse gradientTransform="matrix(8.139854, 0, 0, 8.139854, -130.346407, -113.25101)"><stop stop-color=#7433FF /><stop offset=1 stop-color=#FFA3FD /></linearGradient><linearGradient id=paint1_linear_1677_11483 x1=16 y1=14 x2=87.2132 y2=44.5982 gradientUnits=userSpaceOnUse gradientTransform="matrix(8.139854, 0, 0, 8.139854, -130.346407, -113.25101)"><stop stop-color=#7433FF /><stop offset=1 stop-color=#FFA3FD /></linearGradient><linearGradient id=paint2_linear_1677_11483 x1=16 y1=14 x2=87.2132 y2=44.5982 gradientUnits=userSpaceOnUse gradientTransform="matrix(8.139854, 0, 0, 8.139854, -130.346407, -113.25101)"><stop stop-color=#7433FF /><stop offset=1 stop-color=#FFA3FD /></linearGradient><linearGradient id=paint3_linear_1677_11483 x1=16 y1=14 x2=87.2132 y2=44.5982 gradientUnits=userSpaceOnUse><stop stop-color=#7433FF /><stop offset=1 stop-color=#FFA3FD /></linearGradient><linearGradient id=paint4_linear_1677_11483 x1=16 y1=14 x2=87.2132 y2=44.5982 gradientUnits=userSpaceOnUse><stop stop-color=#7433FF /><stop offset=1 stop-color=#FFA3FD /></linearGradient><linearGradient id=paint5_linear_1677_11483 x1=16 y1=14 x2=87.2132 y2=44.5982 gradientUnits=userSpaceOnUse><stop stop-color=#7433FF /><stop offset=1 stop-color=#FFA3FD /></linearGradient><filter id=filter0_f_1677_11483 x=23 y=-25 width=100 height=100 filterUnits=userSpaceOnUse color-interpolation-filters=sRGB><feFlood flood-opacity=0 result=BackgroundImageFix /><feBlend mode=normal in=SourceGraphic in2=BackgroundImageFix result=shape /><feGaussianBlur stdDeviation=12 result=effect1_foregroundBlur_1677_11483 /></filter><filter id=filter1_f_1677_11483 x=-24 y=19 width=100 height=100 filterUnits=userSpaceOnUse color-interpolation-filters=sRGB><feFlood flood-opacity=0 result=BackgroundImageFix /><feBlend mode=normal in=SourceGraphic in2=BackgroundImageFix result=shape /><feGaussianBlur stdDeviation=12 result=effect1_foregroundBlur_1677_11483 /></filter><linearGradient id=paint6_linear_1677_11483 x1=30 y1=28 x2=66.1645 y2=44.4363 gradientUnits=userSpaceOnUse gradientTransform="matrix(8.139854, 0, 0, 8.139854, -130.346407, -113.25101)"><stop stop-color=#7433FF /><stop offset=1 stop-color=#FFA3FD /></linearGradient><filter id=filter2_f_1677_11483 x=-12 y=-44 width=100 height=100 filterUnits=userSpaceOnUse color-interpolation-filters=sRGB><feFlood flood-opacity=0 result=BackgroundImageFix /><feBlend mode=normal in=SourceGraphic in2=BackgroundImageFix result=shape /><feGaussianBlur stdDeviation=12 result=effect1_foregroundBlur_1677_11483 /></filter><filter id=filter3_f_1677_11483 x=13 y=19 width=100 height=100 filterUnits=userSpaceOnUse color-interpolation-filters=sRGB><feFlood flood-opacity=0 result=BackgroundImageFix /><feBlend mode=normal in=SourceGraphic in2=BackgroundImageFix result=shape /><feGaussianBlur stdDeviation=12 result=effect1_foregroundBlur_1677_11483 /></filter></defs><mask id=mask0_1677_11483 style=mask-type:alpha maskUnits=userSpaceOnUse x=16 y=14 width=58 height=62><path d="M21 25.3501C21.7279 25.3501 22.4195 25.5056 23.0433 25.7853L42.1439 14.8C43.0439 14.3 44.1439 14 45.1439 14C46.2439 14 47.2439 14.3 48.1439 14.8L64.5439 24.3C63.3439 25.1 62.4439 26.3 61.8439 27.7L45.9438 18.5C45.6439 18.3 45.344 18.3 45.0441 18.3C44.7441 18.3 44.4439 18.4 44.1439 18.5L25.8225 29.0251C25.9382 29.4471 26 29.8914 26 30.3501C26 33.1115 23.7614 35.3501 21 35.3501C18.2386 35.3501 16 33.1115 16 30.3501C16 27.5887 18.2386 25.3501 21 25.3501Z" fill=url(#paint3_linear_1677_11483) /><path d="M67.2438 35.0329C65.3487 34.3219 64 32.4934 64 30.35C64 27.5886 66.2386 25.35 69 25.35C71.7614 25.35 74 27.5886 74 30.35C74 32.1825 73.0142 33.7848 71.5439 34.6554V55.2C71.5439 57.4 70.3439 59.4 68.5439 60.5L52.1439 69.9C52.1439 68.4 51.6438 66.9 50.7438 65.8L66.3439 56.8C66.9439 56.5 67.2438 55.9 67.2438 55.2V35.0329Z" fill=url(#paint4_linear_1677_11483) /><path d="M49.8439 69.1055C49.9458 69.5034 50 69.9204 50 70.3501C50 73.1115 47.7614 75.3501 45 75.3501C42.5102 75.3501 40.4454 73.5302 40.0633 71.1481L21.8439 60.6C19.9439 59.5 18.8439 57.5 18.8439 55.3V36.8C19.5439 37 20.3439 37.2 21.0439 37.2C21.7439 37.2 22.4439 37.1 23.0439 36.9V55.3C23.0439 56 23.4438 56.6 23.9438 56.9L41.3263 66.9583C42.2398 65.9694 43.5476 65.3501 45 65.3501C47.3291 65.3501 49.2862 66.9426 49.8419 69.0981L49.8436 69.0997L49.8439 69.1055Z" fill=url(#paint5_linear_1677_11483) /></mask><mask id=mask1_1677_11483 style=mask-type:alpha maskUnits=userSpaceOnUse x=30 y=28 width=30 height=30><path fill-rule=evenodd clip-rule=evenodd d="M49.3945 32.3945C49.3945 34.7088 47.5796 38.5469 45 38.5469C42.4271 38.5469 40.6055 34.7112 40.6055 32.3945C40.6055 29.9714 42.5769 28 45 28C47.4231 28 49.3945 29.9714 49.3945 32.3945ZM35.332 49.0433V48.2148C35.332 42.8117 37.8535 41.0004 39.8796 39.545L39.8801 39.5447C40.3928 39.1767 40.8604 38.8404 41.2488 38.4742C42.3293 39.6642 43.626 40.3047 45 40.3047C46.3752 40.3047 47.6725 39.6642 48.7529 38.4754C49.1408 38.841 49.6078 39.1773 50.1199 39.5447L50.1204 39.545C52.1465 41.0004 54.668 42.8117 54.668 48.2148V49.0433L53.8406 49.092C49.9848 49.3185 46.8646 46.9002 45 43.5777C43.1159 46.935 39.9847 49.318 36.1594 49.092L35.332 49.0433ZM58.1463 51.0747L58.1463 51.0746C57.0179 50.891 50.0128 49.7507 45.0007 55.693C40.0116 49.7553 33.1965 50.8592 31.9095 51.0677L31.9095 51.0677C31.7906 51.087 31.7189 51.0986 31.7002 51.0963C31.7005 51.0969 31.7011 51.1045 31.7023 51.1187C31.726 51.4003 31.9682 54.2745 34.0566 56.2422L30 58H60L55.8956 56.2422C57.8537 54.4764 58.1396 52.2685 58.2508 51.4092V51.4091C58.2697 51.2628 58.2836 51.1556 58.2998 51.0963C58.2881 51.0977 58.2356 51.0892 58.1463 51.0747ZM40.4836 50.104C42.3956 49.3212 43.6746 48.1737 45 46.61C46.332 48.1841 47.6159 49.3259 49.5164 50.104C49.5356 50.1425 49.5557 50.1805 49.5756 50.2182C49.5793 50.2253 49.583 50.2323 49.5867 50.2393C48.0911 50.8127 46.4264 51.825 45.0047 53.1444C43.5906 51.8221 41.9673 50.8196 40.4256 50.2153C40.4455 50.1784 40.4648 50.1415 40.4836 50.104Z" fill=black /></mask><path d="M 40.59 93.095 C 46.517 93.095 52.14 94.365 57.22 96.635 L 212.7 7.22 C 220.025 3.149 228.978 0.706 237.12 0.706 C 246.073 0.706 254.213 3.149 261.54 7.22 L 395.032 84.547 C 385.264 91.059 377.939 100.827 373.055 112.224 L 243.631 37.338 C 241.19 35.71 238.747 35.71 236.305 35.71 C 233.863 35.71 231.42 36.523 228.978 37.338 L 79.84 123.009 C 80.786 126.443 81.29 130.058 81.29 133.793 C 81.29 156.269 63.065 174.493 40.59 174.493 C 18.116 174.493 -0.109 156.269 -0.109 133.793 C -0.109 111.32 18.116 93.095 40.59 93.095 Z" fill=url(#paint0_linear_1677_11483) /><path d="M 417.01 171.913 C 401.585 166.126 390.603 151.238 390.603 133.793 C 390.603 111.32 408.83 93.095 431.303 93.095 C 453.777 93.095 472.001 111.32 472.001 133.793 C 472.001 148.706 463.976 161.755 452.011 168.835 L 452.011 336.07 C 452.011 353.977 442.243 370.258 427.591 379.21 L 294.098 455.726 C 294.098 443.516 290.029 431.306 282.703 422.353 L 409.683 349.093 C 414.568 346.651 417.01 341.767 417.01 336.07 L 417.01 171.913 Z" fill=url(#paint1_linear_1677_11483) /><path d="M 275.376 449.253 C 276.206 452.495 276.646 455.889 276.646 459.389 C 276.646 481.863 258.422 500.087 235.947 500.087 C 215.679 500.087 198.87 485.272 195.761 465.883 L 47.46 380.025 C 31.995 371.071 23.041 354.792 23.041 336.884 L 23.041 186.296 C 28.738 187.923 35.25 189.553 40.948 189.553 C 46.646 189.553 52.345 188.738 57.228 187.111 L 57.228 336.884 C 57.228 342.582 60.485 347.465 64.554 349.908 L 206.042 431.777 C 213.481 423.728 224.127 418.689 235.947 418.689 C 254.905 418.689 270.833 431.656 275.36 449.196 L 275.376 449.214 L 275.376 449.253 Z" fill=url(#paint2_linear_1677_11483) /><g mask=url(#mask0_1677_11483) transform="matrix(8.139854, 0, 0, 8.139854, -130.346375, -113.251038)"><g filter=url(#filter0_f_1677_11483)><circle cx=73 cy=25 r=26 fill=#ED2E7E /></g><g filter=url(#filter1_f_1677_11483)><circle cx=26 cy=69 r=26 fill=#1CC8EE /></g></g><path fill-rule=evenodd clip-rule=evenodd d="M 271.713 150.431 C 271.713 169.275 256.948 200.517 235.947 200.517 C 215.003 200.517 200.172 169.292 200.172 150.431 C 200.172 130.708 216.225 114.666 235.947 114.666 C 255.67 114.666 271.713 130.708 271.713 150.431 Z M 157.251 285.952 L 157.251 279.212 C 157.251 235.233 177.771 220.485 194.27 208.641 C 198.447 205.644 202.247 202.901 205.414 199.923 C 214.204 209.608 224.763 214.826 235.947 214.826 C 247.138 214.826 257.697 209.608 266.496 199.931 C 269.653 202.911 273.456 205.644 277.622 208.641 C 294.114 220.485 314.642 235.233 314.642 279.212 L 314.642 285.952 L 307.912 286.351 C 276.525 288.191 251.128 268.509 235.947 241.468 C 220.611 268.795 195.126 288.191 163.981 286.351 L 157.251 285.952 Z M 342.953 302.492 C 333.771 300.994 276.751 291.715 235.955 340.082 C 195.345 291.749 139.865 300.734 129.389 302.436 C 128.428 302.59 127.841 302.688 127.687 302.665 C 127.687 302.673 127.695 302.729 127.702 302.85 C 127.897 305.138 129.867 328.532 146.872 344.55 L 113.849 358.862 L 358.044 358.862 L 324.639 344.55 C 340.576 330.177 342.905 312.202 343.807 305.212 C 343.962 304.022 344.077 303.153 344.206 302.665 C 344.108 302.68 343.686 302.606 342.953 302.492 Z M 199.188 294.59 C 214.751 288.215 225.161 278.879 235.947 266.15 C 246.788 278.96 257.241 288.255 272.707 294.59 C 272.869 294.898 273.031 295.207 273.196 295.518 C 273.219 295.574 273.252 295.631 273.285 295.688 C 261.107 300.361 247.555 308.598 235.989 319.334 C 224.477 308.573 211.258 300.417 198.715 295.493 C 198.87 295.191 199.033 294.891 199.188 294.59 Z" fill=url(#paint6_linear_1677_11483) /><g mask=url(#mask1_1677_11483) transform="matrix(8.139854, 0, 0, 8.139854, -130.346375, -113.251038)"><g filter=url(#filter2_f_1677_11483)><circle cx=38 cy=6 r=26 fill=#ED2E7E /></g><g filter=url(#filter3_f_1677_11483)><circle cx=63 cy=69 r=26 fill=#1CC8EE /></g></g></svg></div><h1>GraphQL Yoga</h1><p>Version: 5.21.2</p></div><h2>The batteries-included cross-platform GraphQL Server.</h2><div class=buttons><a href=https://www.the-guild.dev/graphql/yoga-server/docs class=docs>Read the Docs</a> <a href=https://www.the-guild.dev/graphql/yoga-server/tutorial/basic class=tutorial>Start the Tutorial </a><a href=__GRAPHIQL_LINK__ class=graphiql>Visit GraphiQL</a></div></section><section class=not-what-your-looking-for><h2>Not the page you are looking for? \u{1F440}</h2><p>This page is shown be default whenever a 404 is hit.<br>You can disable this by behavior via the <code>landingPage</code> option.</p><pre>
|
|
40
|
+
<code>
|
|
41
|
+
import { createYoga } from 'graphql-yoga';
|
|
42
|
+
|
|
43
|
+
const yoga = createYoga({
|
|
44
|
+
landingPage: false
|
|
45
|
+
})
|
|
46
|
+
</code>
|
|
47
|
+
</pre><p>If you expected this page to be the GraphQL route, you need to configure Yoga. Currently, the GraphQL route is configured to be on <code>__GRAPHIQL_LINK__</code>.</p><pre>
|
|
48
|
+
<code>
|
|
49
|
+
import { createYoga } from 'graphql-yoga';
|
|
50
|
+
|
|
51
|
+
const yoga = createYoga({
|
|
52
|
+
graphqlEndpoint: '__REQUEST_PATH__',
|
|
53
|
+
})
|
|
54
|
+
</code>
|
|
55
|
+
</pre></section></main></body></html>`;var ob=function(e){return new e.fetchAPI.Response(Ku.replace(/__GRAPHIQL_LINK__/g,e.graphqlEndpoint).replace(/__REQUEST_PATH__/g,e.url.pathname),{status:200,statusText:"OK",headers:{"Content-Type":"text/html"}})};function Ju(t){let e=t.landingPageRenderer||ob;return {onRequest({request:r,fetchAPI:n,endResponse:s,url:i}){let o=t.getGraphQLEndpoint();if(!r.url.endsWith(o)&&!r.url.endsWith(`${o}/`)&&i.pathname!==o&&i.pathname!==`${o}/`&&!t.getGraphQLEndpointURLPattern().test(i)){if(t.showLandingPage===true&&r.method==="GET"&&r.headers?.get("accept")?.includes("text/html")){let a=e({request:r,fetchAPI:n,url:i,graphqlEndpoint:o,get urlPattern(){return t.getGraphQLEndpointURLPattern()}});if($(a))return a.then(s);s(a);return}s(new n.Response("",{status:404,statusText:"Not Found"}));}}}}function xn({request:t,result:e,fetchAPI:r,onResultProcessHooks:n,serverContext:s}){let i,o=[],a="*/*";return C(()=>V(n,c=>c({request:t,acceptableMediaTypes:o,result:e,setResult(l){e=l;},resultProcessor:i,setResultProcessor(l,u){i=l,a=u;},serverContext:s})),()=>i?i(e,r,a):new r.Response(null,{status:406,statusText:"Not Acceptable",headers:{accept:o.join("; charset=utf-8, ")}}))}function Xu({params:t,enveloped:e}){let r=e.parse(t.query),n=e.validate(e.schema,r);return n.length>0?{errors:n}:C(()=>e.contextFactory(),s=>{let i={schema:e.schema,document:r,contextValue:s,variableValues:t.variables,operationName:t.operationName};return (E(r,t.operationName)?.operation==="subscription"?e.subscribe:e.execute)(i)})}function Yu(t){return t?.status&&t?.headers}function ef(t){return Ce(t)?t.toJSON():t instanceof Error?{message:t.message,stack:t.stack,cause:t.cause}:t}var tf=(t,e,r=globalThis.process?.env?.NODE_ENV==="development")=>{if(mn(t))return t;let n={code:"INTERNAL_SERVER_ERROR",unexpected:true},s={extensions:n};return Ce(t)?(s.nodes=t.nodes,s.source=t.source,s.positions=t.positions,s.path=t.path,s.coordinate=pn(t),r&&t.originalError&&(n.originalError=ef(t.originalError)),t.extensions?.http&&(n.http=t.extensions.http)):r&&(n.originalError=ef(t)),j(e,s)};var Ii=class{getEnveloped;logger;fetchAPI;plugins;instrumentation;onRequestParseHooks;onParamsHooks;onExecutionResultHooks;onResultProcessHooks;maskedErrorsOpts;id;_graphqlEndpoint;_graphqlEndpointURLPattern;version="5.21.2";constructor(e){if(this.id=e?.id??"yoga",this.fetchAPI={...ab},e?.fetchAPI)for(let a in e.fetchAPI)e.fetchAPI[a]&&(this.fetchAPI[a]=e.fetchAPI[a]);let r=e?.logging==null?true:e.logging;this.logger=typeof r=="boolean"?r===true?mr():mr("silent"):typeof r=="string"?mr(r):r;let n=typeof e?.maskedErrors=="object"&&e.maskedErrors.maskError||tf,s=new WeakSet;this.maskedErrorsOpts=e?.maskedErrors===false?null:{errorMessage:"Unexpected error.",...typeof e?.maskedErrors=="object"?e.maskedErrors:{},maskError:(a,c)=>{if(s.has(a))return a;let l=n(a,c,this.maskedErrorsOpts?.isDev);return l!==a&&this.logger.error(a),s.add(l),l}};let i=this.maskedErrorsOpts==null?null:this.maskedErrorsOpts,o=0;e?.batching&&(typeof e.batching=="boolean"?o=10:o=e.batching.limit??10),this.graphqlEndpoint=e?.graphqlEndpoint||"/graphql",this.plugins=[Ko({parse:e$3,validate:C$1,execute:Pr,subscribe:Pr,specifiedRules:B$1}),!!e?.schema&&Ro(e.schema),e?.allowedHeaders?.request!=null&&mu(e.allowedHeaders.request),e?.context!=null&&Zo(a=>e?.context?typeof e.context=="function"?e.context(a):e.context:{}),Fu({id:this.id,logger:this.logger,endpoint:e?.healthCheckEndpoint}),e?.cors!==false&&fu(e?.cors),e?.graphiql!==false&&Ao({getGraphQLEndpoint:()=>this._graphqlEndpoint,getGraphQLEndpointURLPattern:()=>this.getUrlPatternForGraphQLEndpoint(),options:e?.graphiql,render:e?.renderGraphiQL,logger:this.logger}),Dt({match:_u,parse:Su}),Dt({match:Cu,parse:Au}),e?.multipart!==false&&Dt({match:Ru,parse:vu}),Dt({match:Tu,parse:Pu}),Dt({match:wu,parse:Eu}),Zu(),...e?.plugins??[],e?.parserAndValidationCache!==false&&$u(!e?.parserAndValidationCache||e?.parserAndValidationCache===true?{}:e?.parserAndValidationCache),Ou(o),ku(e?.extraParamNames),Ju({getGraphQLEndpoint:()=>this.graphqlEndpoint,getGraphQLEndpointURLPattern:()=>this.getUrlPatternForGraphQLEndpoint(),showLandingPage:e?.landingPage!==false,landingPageRenderer:typeof e?.landingPage=="function"?e.landingPage:void 0}),Du(),Iu(),i!==null&&{onSubscribe(){return {onSubscribeError({error:a}){if(ki(a))throw a}}}},i!==null&&Qo(i),e?.allowedHeaders?.response!=null&&pu(e.allowedHeaders.response),Lu()],this.getEnveloped=Vo({plugins:this.plugins}),this.plugins=this.getEnveloped._plugins,this.onRequestParseHooks=[],this.onParamsHooks=[],this.onExecutionResultHooks=[],this.onResultProcessHooks=[];for(let a of this.plugins)a&&(a.onYogaInit&&a.onYogaInit({yoga:this}),a.onRequestParse&&this.onRequestParseHooks.push(a.onRequestParse),a.onParams&&this.onParamsHooks.push(a.onParams),a.onExecutionResult&&this.onExecutionResultHooks.push(a.onExecutionResult),a.onResultProcess&&this.onResultProcessHooks.push(a.onResultProcess),a.instrumentation&&(this.instrumentation=this.instrumentation?pt(this.instrumentation,a.instrumentation):a.instrumentation));}get graphqlEndpoint(){return this._graphqlEndpoint}set graphqlEndpoint(e){this._graphqlEndpoint=e,this._graphqlEndpointURLPattern=void 0;}getUrlPatternForGraphQLEndpoint(){return this._graphqlEndpointURLPattern??=new this.fetchAPI.URLPattern({pathname:this._graphqlEndpoint}),this._graphqlEndpointURLPattern}handleParams=({request:e,context:r,params:n})=>{let s=r.request===e?{params:n}:{request:e,params:n};Object.assign(r,s);let i=this.getEnveloped(r);return this.logger.debug("Processing GraphQL Parameters"),C(()=>C(()=>Xu({params:n,enveloped:i}),o=>(this.logger.debug("Processing GraphQL Parameters done."),o),o=>({errors:At(o,this.maskedErrorsOpts,this.logger)})),o=>(oe(o)&&(o=Re(o,a=>a,a=>{if(a.name==="AbortError")throw this.logger.debug("Request aborted"),a;return {errors:At(a,this.maskedErrorsOpts,this.logger)}})),o))};getResultForParams=({params:e,request:r},n)=>{let s,i=this.handleParams;return C(()=>V(this.onParamsHooks,o=>o({params:e,request:r,setParams(a){e=a;},paramsHandler:i,setParamsHandler(a){i=a;},setResult(a){s=a;},fetchAPI:this.fetchAPI,context:n})),()=>C(()=>s||i({request:r,params:e,context:n}),o=>C(()=>V(this.onExecutionResultHooks,a=>a({result:o,setResult(c){o=c;},request:r,context:n})),()=>o)))};parseRequest=(e,r)=>{let n=new Proxy({},{get:(a,c,l)=>(n=new this.fetchAPI.URL(e.url,"http://localhost"),Reflect.get(n,c,n))}),s,i,o=[];return C(()=>V(this.onRequestParseHooks,(a,c)=>C(()=>a({request:e,url:n,requestParser:s,serverContext:r,setRequestParser(l){s=l;},endResponse(l){i=l,c();},fetchAPI:this.fetchAPI}),l=>l?.onRequestParseDone),o),()=>i?{response:i}:(this.logger.debug("Parsing request to extract GraphQL parameters"),s?C(()=>s(e),a=>{if(Yu(a))return {response:a};let c=a;return C(()=>V(o,l=>l({requestParserResult:c,setRequestParserResult(u){c=u;}})),()=>({requestParserResult:c}))}):{response:new this.fetchAPI.Response(null,{status:415,statusText:"Unsupported Media Type"})}))};handle=(e,r)=>{let n=this.instrumentation&&Ze({request:e}),s=this.instrumentation?.requestParse?n.asyncFn(this.instrumentation?.requestParse,this.parseRequest):this.parseRequest;return jt(U().then(()=>s(e,r)).then(({response:i,requestParserResult:o})=>{if(i)return i;let a=this.instrumentation?.operation?(c,l)=>Ze({context:l,request:c.request}).asyncFn(this.instrumentation?.operation,this.getResultForParams)(c,l):this.getResultForParams;return C(()=>Array.isArray(o)?Promise.all(o.map(c=>U().then(()=>a({params:c,request:e},Object.create(r))).catch(l=>({errors:At(l,this.maskedErrorsOpts,this.logger)})))):a({params:o,request:e},r),c=>(this.instrumentation?.resultProcess?n.asyncFn(this.instrumentation.resultProcess,xn):xn)({request:e,result:c,fetchAPI:this.fetchAPI,onResultProcessHooks:this.onResultProcessHooks,serverContext:r}))}).catch(i=>{let a={errors:At(i,this.maskedErrorsOpts,this.logger)};return xn({request:e,result:a,fetchAPI:this.fetchAPI,onResultProcessHooks:this.onResultProcessHooks,serverContext:r})}))}};function rf(t){let e=new Ii(t);return uu(e,{fetchAPI:e.fetchAPI,plugins:e.plugins,disposeOnProcessTerminate:t.disposeOnProcessTerminate})}var lb={aws:{type:"aws",configKey:"s3",displayName:"S3 Compatible (AWS, Backblaze, Wasabi, etc.)",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"us-east-1",admin:{placeholder:"us-east-1"}},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"endpoint",type:"text",label:"Endpoint URL",admin:{placeholder:"https://s3.custom.com"}},{name:"cdnUrl",type:"text",label:"CDN URL",admin:{placeholder:"https://cdn.example.com"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads"}}]},r2:{type:"r2",configKey:"r2",displayName:"Cloudflare R2",configFields:[{name:"accountId",type:"text",label:"Account ID",required:true,admin:{placeholder:"Your Cloudflare Account ID"}},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"publicDevUrl",type:"text",label:"Public Dev URL ID",admin:{placeholder:"pub-xxxxxxxxxxxxxxxx",description:"Enter ONLY the ID (e.g., pub-b8d8c4cc8bcf4d868ddd95efc1b305aa). Do NOT include https:// or the full URL. Found in R2 Dashboard \u2192 Public Dev URL."}},{name:"cdnUrl",type:"text",label:"Custom CDN URL",admin:{placeholder:"https://assets.example.com (optional)"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads (optional)",description:"Optional prefix for all object keys. Do not use '/' as prefix."}}]},gcs:{type:"gcs",configKey:"gcs",displayName:"Google Cloud Storage",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"projectId",type:"text",label:"Project ID"},{name:"clientEmail",type:"text",label:"Client Email"},{name:"privateKey",type:"password",label:"Private Key"},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},digitalocean:{type:"digitalocean",configKey:"digitalocean",displayName:"DigitalOcean Spaces",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"nyc3"},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},backblaze:{type:"backblaze",configKey:"backblaze",displayName:"Backblaze B2",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"accountId",type:"text",label:"Account ID"},{name:"applicationKeyId",type:"text",label:"Application Key ID",required:true},{name:"applicationKey",type:"password",label:"Application Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},wasabi:{type:"wasabi",configKey:"wasabi",displayName:"Wasabi",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"us-east-1"},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]}};function cb(t,e){switch(t){case "r2":return e?.endpoint||`https://${e?.accountId||""}.r2.cloudflarestorage.com`;case "digitalocean":return e?.endpoint||`https://${e?.region||"nyc3"}.digitaloceanspaces.com`;case "backblaze":return e?.endpoint||"https://s3.backblazeb2.com";case "wasabi":return e?.endpoint||`https://s3.${e?.region||"us-east-1"}.wasabisys.com`;default:return e?.endpoint}}function nf(t,e){return {provider:t,bucket:e?.bucket||"",region:e?.region||"us-east-1",accessKeyId:e?.accessKeyId||e?.clientEmail||e?.applicationKeyId||"",secretAccessKey:e?.secretAccessKey||e?.privateKey||e?.applicationKey||"",endpoint:cb(t,e),cdnUrl:e?.cdnUrl,prefix:e?.prefix,accountId:e?.accountId,publicDevUrl:e?.publicDevUrl}}function ub(t,e,r){let n=r[e.configKey]||{};return nf(t,n)}function fb(t,e,r){let n=r?.[e.configKey]||r;return nf(t,n)}var sf={name:"@kyro-cms/storage-s3",version:"1.0.0",description:"S3-compatible storage (AWS R2 GCS DigitalOcean Backblaze Wasabi)",init:t=>{let e=t.registry?.storageProviders;if(!e)return;let r="@kyro-cms/storage-s3";for(let n of Object.values(lb))e.register({type:n.type,displayName:n.displayName,pluginName:r,configKey:n.configKey,configFields:n.configFields,extractConfig:s=>ub(n.type,n,s),extractRawConfig:s=>fb(n.type,n,s),factory:s=>a$4(s)});}};var of={name:"@kyro-cms/storage-cloudinary",version:"1.0.0",description:"Cloudinary image and video storage",init:t=>{let e=t.registry?.storageProviders;e&&e.register({type:"cloudinary",displayName:"Cloudinary",pluginName:"@kyro-cms/storage-cloudinary",configKey:"cloudinary",configFields:[{name:"cloudName",type:"text",label:"Cloud Name",required:true},{name:"apiKey",type:"text",label:"API Key",required:true},{name:"apiSecret",type:"password",label:"API Secret",required:true},{name:"folder",type:"text",label:"Folder",admin:{placeholder:"Optional folder path"}},{name:"uploadPreset",type:"text",label:"Upload Preset (optional)",admin:{placeholder:"Leave empty for signed uploads",description:"If not set, uploads will be signed with API Secret"}}],extractConfig:r=>({cloudName:r.cloudinary?.cloudName||"",apiKey:r.cloudinary?.apiKey||"",apiSecret:r.cloudinary?.apiSecret||"",folder:r.cloudinary?.folder,uploadPreset:r.cloudinary?.uploadPreset}),extractRawConfig:r=>{let n=r?.cloudinary||r;return {cloudName:n?.cloudName||"",apiKey:n?.apiKey||"",apiSecret:n?.apiSecret||"",folder:n?.folder,uploadPreset:n?.uploadPreset}},factory:r=>b$3(r)});}};var af={name:"@kyro-cms/storage-ftp",version:"1.0.0",description:"FTP/SFTP storage provider",init:t=>{let e=t.registry?.storageProviders;e&&e.register({type:"ftp",displayName:"FTP",pluginName:"@kyro-cms/storage-ftp",configKey:"ftp",configFields:[{name:"host",type:"text",label:"Host",required:true,admin:{placeholder:"ftp.example.com"}},{name:"port",type:"number",label:"Port",defaultValue:21,admin:{placeholder:"21 for FTP"}},{name:"user",type:"text",label:"Username",required:true},{name:"password",type:"password",label:"Password",required:true},{name:"secure",type:"checkbox",label:"Use TLS/SSL",defaultValue:false,admin:{description:"Enable TLS/SSL for secure connections (FTP only)"}},{name:"baseUrl",type:"text",label:"Base URL",required:true,admin:{placeholder:"https://files.example.com"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads"}}],extractConfig:r=>({host:r.ftp?.host||"",port:r.ftp?.port||21,user:r.ftp?.user||"",password:r.ftp?.password||"",secure:r.ftp?.secure||false,baseUrl:r.ftp?.baseUrl||"",prefix:r.ftp?.prefix,type:"ftp"}),extractRawConfig:r=>{let n=r?.ftp||r;return {host:n?.host||"",port:n?.port||21,user:n?.user||"",password:n?.password||"",secure:n?.secure||false,baseUrl:n?.baseUrl||"",prefix:n?.prefix,type:"ftp"}},factory:r=>c$4(r)});}};var hb=[sf,of,af];function Fi(t,e,r){let n=e.split(".");if(n.length===0)return false;let s=n[0],i=n.slice(1).join(".");for(let o of t)if(o.name===s)return i?o.fields&&Array.isArray(o.fields)||o.type==="array"&&o.fields&&Array.isArray(o.fields)?Fi(o.fields,i,r):false:(Object.assign(o,r),true);return false}function db(t,e){if(e)for(let r of t){let n=e[r.slug];if(n){let{fields:s,...i}=n;if(r.admin={...r.admin,...i},s&&r.fields&&Array.isArray(r.fields))for(let[o,a]of Object.entries(s))Fi(r.fields,o,a);}}}var ji=class{registry;db;pubsub;webhookService;settings;wsServer;config;constructor(e){this.config=e,this.registry=Mn(),this.db=e.adapter,this.pubsub=new b$1(this.registry),this.webhookService=n$1(this.db);for(let r of hb)this.registry.addPlugin(r);if(e.plugins)for(let r of e.plugins)this.registry.addPlugin(r);e.collections&&e.admin?.collectionOverrides&&db(e.collections,e.admin.collectionOverrides),e.collections&&this.registry.addCollections(e.collections),e.globals&&this.registry.addGlobals(e.globals);}async init(){await this.registry.init(this),this.registry.addGlobalPostInit(a$1);let e={slug:"plugin-settings",admin:{hidden:true},fields:[{name:"states",type:"json"}]};if(this.registry.addGlobalPostInit(e),!this.db)throw new Error("Database adapter is null \u2014 failed to load at startup. Check the server console for the exact error.");let r={slug:d$1,fields:[{name:"userId",type:"text",required:true},{name:"name",type:"text",required:true},{name:"key",type:"text",required:true},{name:"keyPrefix",type:"text",required:true},{name:"permissions",type:"json"},{name:"lastUsedAt",type:"date"},{name:"expiresAt",type:"date"}]},n={slug:e$1,fields:[{name:"name",type:"text",required:true},{name:"url",type:"text",required:true},{name:"events",type:"json",required:true},{name:"status",type:"text",required:true},{name:"secret",type:"text"},{name:"headers",type:"json"},{name:"lastTriggered",type:"date"},{name:"lastError",type:"text"}]},s={slug:f$2,fields:[{name:"webhookId",type:"text",required:true},{name:"event",type:"text",required:true},{name:"payload",type:"json",required:true},{name:"attempt",type:"number",required:true},{name:"status",type:"text",required:true},{name:"responseStatus",type:"number"},{name:"responseBody",type:"text"},{name:"error",type:"text"},{name:"duration",type:"number"},{name:"deliveredAt",type:"date"},{name:"nextRetryAt",type:"date"}]},i=this.registry.getGlobals();if(this.db instanceof c$2&&this.db.dialect==="postgres"){let o=this.db,a=d$1.replace(/-/g,"_");o.schema[a]||(o.schema[a]=g);}await this.db.init([...this.registry.getCollections(),r,n,s],i),await this.loadPluginState(),this.pubsub.autoRegisterHooks();}async loadSettings(){if(this.settings)return this.settings;try{let e=await this.db.findOne({collection:"_globals_access-settings",where:{},draft:!0});e&&(this.settings={access:e});}catch{}return this.settings||{}}async loadPluginState(){let e=this.registry.storageProviders,r=e.getAllPluginNames(),n={};try{let s=await this.db.findOne({collection:"_globals_plugin-settings",where:{},draft:!0});s&&s.states&&(n=s.states);}catch{}for(let s of r)n[s]!==void 0&&e.setPluginEnabled(s,n[s]);}getREST(e){let r=typeof this.config.auth=="object"?this.config.auth:null,n=r?.secret,s$1=r?.checkSession!==false;return s({registry:this.registry,db:this.db,authSecret:n,authAdapter:this.config.authAdapter,checkSession:s$1,...e,cors:this.config.cors,webhookService:this.webhookService,settings:this.settings})}getGraphQL(e){let r=I({registry:this.registry,db:this.db,settings:this.settings});return {fetch:rf({schema:r,context:async({request:s})=>{let i=f$3(s),o,a;if(i&&this.db){let l=await e$2(i,this.db);l.user&&(o=l.user,a=g$1(l));}let c=e?.tenantID;return {db:this.db,registry:this.registry,user:o,req:s,tenantID:c,apiKey:a,relationLoader:new G({db:this.db,tenantID:c,user:o})}},graphiql:false,plugins:[]}).fetch,schema:r}}getTRPC(e){return {fetch:async(r,n)=>{let i$1=new URL(r.url).pathname.replace(/^\/api\/trpc\//,""),[o,...a]=i$1.split("."),c=a.join(".");if(c=c.replace(/\.(query|mutate|subscribe)$/,""),!o||!c)return new Response(JSON.stringify({error:{message:"Invalid tRPC path",code:-32600,data:{code:"BAD_REQUEST",httpStatus:400}}}),{status:400,headers:{"Content-Type":"application/json"}});let l=await a$2({db:this.db,registry:this.registry,req:r,user:e?.user,tenantID:e?.tenantID,settings:this.settings}),f=i(l)[o];if(!f)return new Response(JSON.stringify({error:{message:`Collection '${o}' not found`,code:-32601,data:{code:"NOT_FOUND",httpStatus:404}}}),{status:404,headers:{"Content-Type":"application/json"}});let d=f[c];if(typeof d!="function")return new Response(JSON.stringify({error:{message:`Procedure '${c}' not found`,code:-32601,data:{code:"NOT_FOUND",httpStatus:404}}}),{status:404,headers:{"Content-Type":"application/json"}});try{let h={};if(r.method==="POST"||r.method==="PATCH")h=await r.json().catch(()=>({}));else {let A=new URL(r.url).searchParams.get("input");if(A)try{h=JSON.parse(decodeURIComponent(A));}catch{}}let m=h?.["0"]??h,g=await d({...m,collection:o});return new Response(JSON.stringify({result:{data:g}}),{status:200,headers:{"Content-Type":"application/json"}})}catch(h){let m=h.message||"Internal error",g=m.includes("not found")?404:m.includes("denied")||m.includes("authentication required")?403:m.includes("conflict")?409:500,A=g===404?-32601:g===403?-32001:g===409?-32002:-32603;return new Response(JSON.stringify({error:{message:m,code:A,data:{code:"INTERNAL_SERVER_ERROR",httpStatus:g}}}),{status:g,headers:{"Content-Type":"application/json"}})}},router:null}}getWS(){return this.wsServer}async startWebSocket(e){let r=this.settings?.access?.apiAccess;if(r?.wsEnabled===false)return null;let n=async s=>{let i=await e$2(s,this.db);if(!i.valid)throw new Error(i.error||"Invalid API key");if(!i.user)throw new Error("API key has no associated user");return i.user};return this.wsServer=d$2({pubsub:this.pubsub,port:e?.port||8080,requireAuth:e?.requireAuth??r?.requireAuth,verifyToken:e?.verifyToken||n}),this.wsServer}async shutdown(){this.wsServer&&await this.wsServer.close(),await this.db.disconnect();}};function cw(t){return new ji(t)}var mb=createRequire(import.meta.url),bb="node:sqlite",{DatabaseSync:yb}=mb(bb);function it(t){let e=[];for(let r of t)if(r.type==="tabs"&&"tabs"in r)for(let n of r.tabs)e.push(...it(n.fields));else r.type==="row"&&"fields"in r?e.push(...it(r.fields)):r.type==="collapsible"&&"fields"in r?e.push(...it(r.fields)):e.push(r);return e}function xb(t,e){let r=e,n=t[r.name];if(r.type==="json"||r.type==="richtext"||r.type==="array"||r.type==="group"||r.type==="blocks"||r.type==="list"||r.type==="relationship-block")try{n=n?JSON.parse(n):null;}catch{n=null;}if(r.type==="checkbox"&&(n=!!n),r.type==="date"&&n)try{let s=new Date(n);isNaN(s.getTime())?n=null:n=s.toISOString();}catch{n=null;}if((r.type==="upload"||r.type==="image")&&n)try{let s=JSON.parse(n);Array.isArray(s)?n=s.map(i=>typeof i=="object"&&i!==null?i:{id:i}):n=typeof s=="object"?s:{id:s};}catch{n={id:n};}if(r.type==="relationship"&&n)try{let s=JSON.parse(n);Array.isArray(s),n=s;}catch{n={relationTo:Array.isArray(r.relationTo)?r.relationTo[0]:r.relationTo,value:n};}if(r.type==="list"&&n)try{let s=JSON.parse(n);n=Array.isArray(s)?s:[];}catch{n=[];}if(r.type==="relationship-block"&&n)try{let s=JSON.parse(n);n=Array.isArray(s)?s:[];}catch{n=[];}return n}function Ni(t,e){try{return t.prepare(`PRAGMA table_info(${e})`).all().map(n=>n.name)}catch{return []}}var qi=class extends a$3{db;path;migrations=new Map;versionsTableName="kyro_versions";constructor(e){super(),this.path=e.path,e.db?this.db=e.db:this.db=null;}async connect(){if(this.db||(this.db=new yb(this.path||":memory:")),this.db&&typeof this.db.prepare=="function"&&!this.db.prepare.__wrapped){let e=this.db.prepare.bind(this.db),r=n=>{let s=e(n),i=o=>typeof o=="boolean"?o?1:0:o===void 0?null:o;return new Proxy(s,{get(o,a,c){if(a==="all")return (...u)=>o.all(...u.map(i));if(a==="get")return (...u)=>o.get(...u.map(i));if(a==="run")return (...u)=>o.run(...u.map(i));let l=Reflect.get(o,a,c);return typeof l=="function"?l.bind(o):l}})};r.__wrapped=true,this.db.prepare=r;}this.db.exec("PRAGMA journal_mode = WAL"),this.db.exec("PRAGMA foreign_keys = ON"),this.connected=true;}async disconnect(){this.db&&this.db.close(),this.connected=false;}ensureTable(e,r){let n=r||this.getTableNameFor(e.slug),s=["id TEXT PRIMARY KEY"];for(let o of it(e.fields)){if(!o.name||o.name==="id")continue;let a=this.fieldToSQL(o);a&&s.push(a);}s.push(`${this.col("createdAt")} TEXT DEFAULT (datetime('now'))`),s.push(`${this.col("updatedAt")} TEXT DEFAULT (datetime('now'))`),s.push("status TEXT DEFAULT 'draft'"),s.push("hasDraft INTEGER DEFAULT 0"),e.tenantScoped&&s.push("tenant_id TEXT NOT NULL");let i=Ni(this.db,n);if(i.length===0){let o=`CREATE TABLE IF NOT EXISTS ${n} (${s.join(", ")})`;this.db.exec(o),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${n}_status ON ${n}(status)`);for(let a of it(e.fields))a.name&&a.indexed&&this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${n}_${a.name} ON ${n}(${this.col(a.name)})`),a.name&&a.unique&&this.db.exec(`CREATE UNIQUE INDEX IF NOT EXISTS idx_${n}_${a.name}_unique ON ${n}(${this.col(a.name)})`);}else {let o=new Set(i);for(let a of s){let c=a.split(" ")[0].replace(/^"/,"").replace(/"$/,"");if(!o.has(c)&&c!=="id")try{c==="status"?this.db.exec(`ALTER TABLE ${n} ADD COLUMN ${this.col(c)} TEXT DEFAULT 'published'`):c==="hasDraft"?this.db.exec(`ALTER TABLE ${n} ADD COLUMN ${this.col(c)} INTEGER DEFAULT 0`):this.db.exec(`ALTER TABLE ${n} ADD COLUMN ${this.col(c)} TEXT`);}catch{}}}this.migrations.set(n,true);}ensureVersionsTable(){this.db.exec(`
|
|
56
|
+
CREATE TABLE IF NOT EXISTS ${this.versionsTableName} (
|
|
57
|
+
id TEXT PRIMARY KEY,
|
|
58
|
+
collection_slug TEXT NOT NULL,
|
|
59
|
+
document_id TEXT NOT NULL,
|
|
60
|
+
tenant_id TEXT,
|
|
61
|
+
version INTEGER NOT NULL,
|
|
62
|
+
status TEXT NOT NULL DEFAULT 'draft',
|
|
63
|
+
autosave INTEGER NOT NULL DEFAULT 0,
|
|
64
|
+
data TEXT NOT NULL,
|
|
65
|
+
created_by TEXT,
|
|
66
|
+
change_description TEXT,
|
|
67
|
+
published_at TEXT,
|
|
68
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
69
|
+
updated_at TEXT DEFAULT (datetime('now'))
|
|
70
|
+
)
|
|
71
|
+
`);try{this.db.exec(`ALTER TABLE ${this.versionsTableName} ADD COLUMN autosave INTEGER NOT NULL DEFAULT 0`);}catch{}this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${this.versionsTableName}_doc ON ${this.versionsTableName}(collection_slug, document_id)`),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${this.versionsTableName}_status ON ${this.versionsTableName}(status)`),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${this.versionsTableName}_autosave ON ${this.versionsTableName}(autosave)`);}col(e){return `"${e}"`}fieldToSQL(e){switch(e.type){case "text":case "email":case "password":case "textarea":case "color":case "code":case "markdown":case "url":return this.col(e.name)+" TEXT";case "number":return this.col(e.name)+" REAL";case "checkbox":return this.col(e.name)+" INTEGER DEFAULT 0";case "date":return this.col(e.name)+" TEXT";case "select":case "radio":return this.col(e.name)+" TEXT";case "relationship":case "upload":return this.col(e.name)+" TEXT";case "json":case "richtext":case "array":case "group":case "blocks":return this.col(e.name)+" TEXT";default:return null}}parseGlobalsSlug(e){if(e.startsWith("_globals_")){let r=e.replace("_globals_","");return {isGlobal:true,globalSlug:r,tableName:`global_${r.replace(/-/g,"_")}`}}return {isGlobal:false,globalSlug:"",tableName:this.getTableNameFor(e)}}async find(e){let{collection:r,where:n={},sort:s,limit:i=10,page:o=1,tenantID:a,draft:c=false}=e,l=this.parseGlobalsSlug(r),u=l.isGlobal?this.globals.get(l.globalSlug):this.getCollection(r);this.ensureTable(u,l.tableName);let d=`SELECT * FROM ${l.tableName}`,h=[],m=[],g={...n};this.tenantContext&&u.tenantScoped&&(g=c$3({where:g},r,this.tenantContext,b$2).where||{}),c||(m.push("status = ?"),h.push("published")),a&&u.tenantScoped&&(m.push("tenant_id = ?"),h.push(a));for(let[R,p]of Object.entries(g))R==="AND"||R==="OR"||(typeof p=="object"&&p!==null?(p.equals!==void 0&&(m.push(`${this.col(R)} = ?`),h.push(p.equals)),p.in!==void 0&&(m.push(`${this.col(R)} IN (${p.in.map(()=>"?").join(", ")})`),h.push(...p.in)),p.not_equals!==void 0&&(m.push(`${this.col(R)} != ?`),h.push(p.not_equals))):(m.push(`${this.col(R)} = ?`),h.push(p)));m.length>0&&(d+=` WHERE ${m.join(" AND ")}`);let A=this.col(s?.replace("-","")||"createdAt"),x=s?.startsWith("-")?"DESC":"ASC";d+=` ORDER BY ${A} ${x}`;let L=d.replace("SELECT *","SELECT COUNT(*) as count"),T=this.db.prepare(L).get(...h)?.count||0;d+=" LIMIT ? OFFSET ?",h.push(i,(o-1)*i);let w=this.db.prepare(d).all(...h).map(R=>this.rowToDoc(R,u));return this.tenantContext&&!this.tenantContext.isSuperAdmin&&(w=w.filter(R=>d$3(R,r,this.tenantContext,b$2))),c&&(w=await Promise.all(w.map(async R=>{let p=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND tenant_id IS NULL ORDER BY version DESC LIMIT 1`).get(r,R.id);if(p){let b=p.data?JSON.parse(p.data):{};return {...R,...b,status:R.status}}return R}))),{docs:w,totalDocs:T,limit:i,totalPages:Math.ceil(T/i),page:o,pagingCounter:(o-1)*i+1,hasPrevPage:o>1,hasNextPage:o<Math.ceil(T/i),prevPage:o>1?o-1:null,nextPage:o<Math.ceil(T/i)?o+1:null}}async findByID(e){let{collection:r,id:n,tenantID:s,draft:i=false}=e,o=this.parseGlobalsSlug(r),a=o.isGlobal?this.globals.get(o.globalSlug):this.getCollection(r);this.ensureTable(a,o.tableName);let l=`SELECT * FROM ${o.tableName} WHERE id = ?`,u=[n];if(this.tenantContext&&a.tenantScoped){let h={id:n,tenant_id:this.tenantContext.tenantId};if(!d$3(h,r,this.tenantContext,b$2))return null}i||(l+=" AND status = ?",u.push("published")),s&&a.tenantScoped&&(l+=" AND tenant_id = ?",u.push(s));let f=this.db.prepare(l).get(...u);if(!f)return null;let d=this.rowToDoc(f,a);if(i){let h=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND tenant_id IS NULL ORDER BY version DESC LIMIT 1`).get(r,d.id);if(h){let m=h.data?JSON.parse(h.data):{};d={...d,...m,status:d.status};}}return d}async create(e){let{collection:r,data:n,tenantID:s}=e,i=this.parseGlobalsSlug(r),o=i.isGlobal?this.globals.get(i.globalSlug):this.getCollection(r);this.ensureTable(o,i.tableName);let a=i.tableName,c=i.isGlobal?i.globalSlug:n.id||this.generateId(),l=this.prepareData(n,o);l.id=c,l.created_at=new Date().toISOString(),l.updated_at=new Date().toISOString(),s&&o.tenantScoped&&(l.tenant_id=s);let u=Object.keys(l),f=Ni(this.db,a),d={};for(let x of u)f.includes(x)&&(d[x]=l[x]);let h=Object.keys(d),m=h.map(x=>this.col(x)),g=h.map(()=>"?").join(", "),A=Object.values(d).map(x=>x!==null&&typeof x=="object"?JSON.stringify(x):x);return this.db.prepare(`INSERT OR REPLACE INTO ${a} (${m.join(", ")}) VALUES (${g})`).run(...A),this.ensureVersionsTable(),this.findByID({collection:r,id:c,tenantID:s,draft:true})}async update(e){let{collection:r,id:n,data:s,tenantID:i}=e,o=this.parseGlobalsSlug(r),a=o.isGlobal?this.globals.get(o.globalSlug):this.getCollection(r);this.ensureTable(a,o.tableName);let c=o.tableName,l=this.prepareData(s,a);l.updated_at=new Date().toISOString();let u=Ni(this.db,c),f={};for(let x of Object.keys(l))u.includes(x)&&(f[x]=l[x]);let h=Object.keys(f).map(x=>`${this.col(x)} = ?`).join(", "),m=Object.values(f).map(x=>x!==null&&typeof x=="object"?JSON.stringify(x):x),g=`UPDATE ${c} SET ${h} WHERE id = ?`,A=[...m,n];return i&&a.tenantScoped&&(g+=" AND tenant_id = ?",A.push(i)),this.db.prepare(g).run(...A),this.ensureVersionsTable(),this.findByID({collection:r,id:n,tenantID:i,draft:true})}async delete(e){let{collection:r,id:n,tenantID:s}=e,i=this.parseGlobalsSlug(r),o=i.isGlobal?this.globals.get(i.globalSlug):this.getCollection(r);this.ensureTable(o,i.tableName),this.ensureVersionsTable();let a=await this.findByID({collection:r,id:n,tenantID:s,draft:true});if(!a)throw new Error(`Document not found: ${r}/${n}`);let l=`DELETE FROM ${i.tableName} WHERE id = ?`,u=[n];return s&&o.tenantScoped&&(l+=" AND tenant_id = ?",u.push(s)),this.db.prepare(l).run(...u),a}async count(e){let{collection:r,tenantID:n}=e,s=this.parseGlobalsSlug(r),i=s.isGlobal?this.globals.get(s.globalSlug):this.getCollection(r);this.ensureTable(i,s.tableName);let a=`SELECT COUNT(*) as count FROM ${s.tableName}`,c=[];return n&&i.tenantScoped&&(a+=" WHERE tenant_id = ?",c.push(n)),this.db.prepare(a).get(...c)?.count||0}async findOne(e){let r=this.parseGlobalsSlug(e.collection);if(r.isGlobal){let s=this.globals.get(r.globalSlug);if(!s)throw new Error(`Global "${r.globalSlug}" not found in adapter`);this.ensureTable(s,r.tableName);let i=`SELECT * FROM ${r.tableName}`,o=[],a=[];!e.draft&&s.versions&&o.push("status = 'published'"),o.length>0&&(i+=` WHERE ${o.join(" AND ")}`),i+=" LIMIT 1";let c=this.db.prepare(i).get(...a);if(c){let l=this.rowToDoc(c,s);if(e.draft){let u=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND tenant_id IS NULL ORDER BY version DESC LIMIT 1`).get(e.collection,r.globalSlug);if(u){let f=u.data?JSON.parse(u.data):{};l={...l,...f,status:l.status};}}return l}return null}return (await this.find({...e,limit:1})).docs[0]||null}async findVersions(e){this.ensureVersionsTable();let{collection:r,documentId:n,tenantID:s,limit:i=20,page:o=1}=e,a=["collection_slug = ?","document_id = ?","autosave = 0"],c=[r,n];s?(a.push("tenant_id = ?"),c.push(s)):a.push("tenant_id IS NULL");let l=`WHERE ${a.join(" AND ")}`,f=this.db.prepare(`SELECT COUNT(*) as count FROM ${this.versionsTableName} ${l}`).get(...c)?.count||0,d=(o-1)*i;return {docs:this.db.prepare(`SELECT * FROM ${this.versionsTableName} ${l} ORDER BY version DESC LIMIT ? OFFSET ?`).all(...c,i,d).map(g=>this.rowToVersion(g)),totalDocs:f,limit:i,totalPages:Math.ceil(f/i),page:o,pagingCounter:(o-1)*i+1,hasPrevPage:o>1,hasNextPage:o<Math.ceil(f/i),prevPage:o>1?o-1:null,nextPage:o<Math.ceil(f/i)?o+1:null}}async findVersionByID(e){this.ensureVersionsTable();let r=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE id = ? AND collection_slug = ? LIMIT 1`).get(e.versionId,e.collection);return r?this.rowToVersion(r):null}async createVersion(e){this.ensureVersionsTable();let r=new Date().toISOString();if(e.autosave){let a=`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND autosave = 1`,c=[e.collection,e.documentId];e.tenantID?(a+=" AND tenant_id = ?",c.push(e.tenantID)):a+=" AND tenant_id IS NULL",a+=" LIMIT 1";let l=this.db.prepare(a).get(...c);if(l){this.db.prepare(`UPDATE ${this.versionsTableName} SET data = ?, status = ?, updated_at = ? WHERE id = ?`).run(JSON.stringify(e.data),e.status,r,l.id);let u=await this.findVersionByID({collection:e.collection,versionId:l.id});if(u)return u}}let n=this.generateId(),i=(this.db.prepare(`SELECT version FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND autosave = 0 ORDER BY version DESC LIMIT 1`).get(e.collection,e.documentId)?.version??0)+1;if(this.db.prepare(`INSERT INTO ${this.versionsTableName} (
|
|
72
|
+
id, collection_slug, document_id, tenant_id, version, status, autosave, data, created_by, change_description, published_at, created_at, updated_at
|
|
73
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(n,e.collection,e.documentId,e.tenantID??null,i,e.status,e.autosave?1:0,JSON.stringify(e.data),e.createdBy??null,e.changeDescription??null,e.status==="published"?r:null,r,r),!e.autosave){let c=this.collections.get(e.collection)?.versions?.maxPerDoc;c&&c>0&&await this.deleteVersions({collection:e.collection,documentId:e.documentId,keepLatest:c,tenantID:e.tenantID});}return await this.findVersionByID({collection:e.collection,versionId:n})}async updateLatestVersion(e){return this.createVersion({...e,autosave:true})}async deleteVersions(e){this.ensureVersionsTable();let{collection:r,documentId:n,keepLatest:s,tenantID:i}=e;if(s&&s>0){let o=this.db.prepare(`SELECT id, status, autosave FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? ORDER BY version DESC`).all(r,n),a=0,c=[];for(let l of o)l.status==="published"||l.autosave===1||(a++,a>s&&c.push(l.id));for(let l of c)this.db.prepare(`DELETE FROM ${this.versionsTableName} WHERE id = ?`).run(l);}else {let o=`DELETE FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ?`,a=[r,n];i&&(o+=" AND tenant_id = ?",a.push(i)),this.db.prepare(o).run(...a);}}rowToVersion(e){return {id:String(e.id),collection:e.collection_slug,documentId:e.document_id,version:e.version,status:e.status,data:e.data?JSON.parse(e.data):{},createdBy:e.created_by??void 0,changeDescription:e.change_description??void 0,publishedAt:e.published_at??null,createdAt:e.created_at,updatedAt:e.updated_at}}prepareData(e,r){let n={},s=it(r.fields),i=(o,a)=>{let c=o;if(c.type==="json"||c.type==="richtext"||c.type==="array"||c.type==="group"||c.type==="blocks"||c.type==="list"||c.type==="relationship-block")return a!=null?JSON.stringify(a):null;if(c.type==="checkbox")return a?1:0;if(c.type==="number")return a!==null&&a!==""?Number(a):null;if(c.type==="upload"||c.type==="image"){if(a==null)return null;if(Array.isArray(a)){let l=a.map(u=>typeof u=="string"?u:typeof u=="object"?u.id||u._id||u:String(u));return JSON.stringify(l)}return typeof a=="string"?a:typeof a=="object"?JSON.stringify(a):String(a)}else if(o.type==="relationship"){if(a==null)return null;if(Array.isArray(a)){let l=a.map(u=>typeof u=="string"?u:typeof u=="object"?JSON.stringify({relationTo:o.relationTo,value:u.id||u}):String(u));return JSON.stringify(l)}return typeof a=="string"?a:typeof a=="object"?JSON.stringify({relationTo:o.relationTo,value:a.id||a}):String(a)}return a};for(let o of s){if(!o.name||o.name==="id"||r.fields.some(l=>l.type==="tabs"&&"tabs"in l&&l.tabs.some(u=>u.fields.some(f=>f.name===o.name))))continue;let c=e[o.name];c!==void 0&&(n[o.name]=i(o,c));}for(let o of r.fields)if(o.type==="tabs"&&"tabs"in o&&o.name){let a=e[o.name];if(a&&typeof a=="object"){for(let c of o.tabs)for(let l of c.fields)if(l.name&&l.name!=="id"){let u=a[l.name];u!==void 0&&(n[l.name]=i(l,u));}}}return n}rowToDoc(e,r){let n={id:e.id};for(let s of it(r.fields)){if(!s.name||s.name==="id")continue;let i=s,o=e[i.name];if(i.type==="json"||i.type==="richtext"||i.type==="array"||i.type==="group"||i.type==="blocks"||i.type==="list"||i.type==="relationship-block")try{o=o?JSON.parse(o):null;}catch{o=null;}if(s.type==="checkbox"&&(o=!!o),s.type==="date"&&o)try{let a=new Date(o);isNaN(a.getTime())?(console.warn(`[LocalAdapter] Invalid date value for field "${s.name}":`,o),o=null):o=a.toISOString();}catch{o=null;}if((s.type==="upload"||s.type==="image")&&o)try{let a=JSON.parse(o);Array.isArray(a)?o=a.map(c=>typeof c=="object"&&c!==null?c:{id:c}):o=typeof a=="object"?a:{id:a};}catch{o={id:o};}if(s.type==="relationship"&&o)try{let a=JSON.parse(o);Array.isArray(a),o=a;}catch{o={relationTo:Array.isArray(s.relationTo)?s.relationTo[0]:s.relationTo,value:o};}n[s.name]=o;}for(let s of r.fields)if(!(!s.name||s.name==="id"||s.name==="row"||s.name==="collapsible")&&s.type==="tabs"&&"tabs"in s){let i={};for(let o of s.tabs)for(let a of o.fields)a.name&&a.name!=="id"&&(i[a.name]=xb(e,a));n[s.name]=i;}if(r.timestamps){let s=e.createdAt||e.created_at,i=e.updatedAt||e.updated_at;if(s)try{let o=new Date(s);isNaN(o.getTime())||(n.createdAt=o.toISOString());}catch{}if(i)try{let o=new Date(i);isNaN(o.getTime())||(n.updatedAt=o.toISOString());}catch{}}return r.tenantScoped&&(n.tenantID=e.tenant_id),n.status=e.status??"published",n.hasDraft=e.hasDraft?!!e.hasDraft:false,n}generateId(){let e=Date.now().toString(16).padStart(12,"0"),r=randomBytes(6).toString("hex");return e+r}getMediaById(e){try{let r=this.getTableNameFor("media"),n=this.db.prepare(`SELECT id, url, thumbnail_url FROM ${r} WHERE id = ?`).get(e);if(n)return {id:n.id,url:n.url,thumbnailUrl:n.thumbnail_url||n.url}}catch{}return null}getTableNameFor(e){return e.replace(/-/g,"_")}async migrate(){for(let e of this.collections.values())this.ensureTable(e);}async rollback(){}async transaction(e){return new Promise((r,n)=>{let s=this.db.transaction(async()=>e({db:this.db}));try{let i=s();r(i);}catch(i){n(i);}})}getDatabase(){return this.db}exec(e){this.db.exec(e);}prepare(e){return this.db.prepare(e)}};function Tw(t){return new qi(t||{})}export{Un as a,$n as b,Bn as c,Ve as d,fo as e,se as f,mo as g,bo as h,yo as i,go as j,xo as k,Ot as l,Of as m,If as n,Mn as o,ji as p,cw as q,qi as r,Tw as s};
|