@learncard/network-plugin 2.1.7 → 2.1.8
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/lcn-plugin.cjs.development.js +850 -5
- package/dist/lcn-plugin.cjs.development.js.map +4 -4
- package/dist/lcn-plugin.cjs.production.min.js +2 -2
- package/dist/lcn-plugin.cjs.production.min.js.map +4 -4
- package/dist/lcn-plugin.esm.js +850 -5
- package/dist/lcn-plugin.esm.js.map +4 -4
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var Ae=Object.defineProperty;var Wt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames;var Ht=Object.prototype.hasOwnProperty;var u=(t,e)=>Ae(t,"name",{value:e,configurable:!0});var Jt=(t,e)=>{for(var r in e)Ae(t,r,{get:e[r],enumerable:!0})},Yt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Zt(e))!Ht.call(t,o)&&o!==r&&Ae(t,o,{get:()=>e[o],enumerable:!(n=Wt(e,o))||n.enumerable});return t};var Qt=t=>Yt(Ae({},"__esModule",{value:!0}),t);var ea={};Jt(ea,{getLearnCardNetworkPlugin:()=>Gn,getVerifyBoostPlugin:()=>Xn});module.exports=Qt(ea);function Kt(t){return t}u(Kt,"identity");function Gt(t){return t.length===0?Kt:t.length===1?t[0]:u(function(r){return t.reduce((n,o)=>o(n),r)},"piped")}u(Gt,"pipeFromArray");function q(t){let e={subscribe(r){let n=null,o=!1,c=!1,i=!1;function s(){if(n===null){i=!0;return}c||(c=!0,typeof n=="function"?n():n&&n.unsubscribe())}return u(s,"unsubscribe"),n=t({next(l){o||r.next?.(l)},error(l){o||(o=!0,r.error?.(l),s())},complete(){o||(o=!0,r.complete?.(),s())}}),i&&s(),{unsubscribe:s}},pipe(...r){return Gt(r)(e)}};return e}u(q,"observable");function vt(t){return e=>{let r=0,n=null,o=[];function c(){n||(n=e.subscribe({next(s){for(let l of o)l.next?.(s)},error(s){for(let l of o)l.error?.(s)},complete(){for(let s of o)s.complete?.()}}))}u(c,"startIfNeeded");function i(){if(r===0&&n){let s=n;n=null,s.unsubscribe()}}return u(i,"resetIfNeeded"),{subscribe(s){return r++,o.push(s),c(),{unsubscribe(){r--,i();let l=o.findIndex(d=>d===s);l>-1&&o.splice(l,1)}}}}}}u(vt,"share");var we=class extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,we.prototype)}};u(we,"ObservableAbortError");function bt(t){let e;return{promise:new Promise((n,o)=>{let c=!1;function i(){c||(c=!0,o(new we("This operation was aborted.")),s.unsubscribe())}u(i,"onDone");let s=t.subscribe({next(l){c=!0,n(l),i()},error(l){c=!0,o(l),i()},complete(){c=!0,i()}});e=i}),abort:e}}u(bt,"observableToPromise");function _t(t){return q(e=>{function r(o=0,c=t.op){let i=t.links[o];if(!i)throw new Error("No more links to execute - did you forget to add an ending link?");return i({op:c,next(l){return r(o+1,l)}})}return u(r,"execute"),r().subscribe(e)})}u(_t,"createChain");function Ge(t){let e=Object.create(null);for(let r in t){let n=t[r];e[n]=r}return e}u(Ge,"invert");var Ie={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099},ca=Ge(Ie);var da=Ge(Ie);var wt=u(()=>{},"noop");function Ct(t,e){return new Proxy(wt,{get(n,o){if(!(typeof o!="string"||o==="then"))return Ct(t,[...e,o])},apply(n,o,c){let i=e[e.length-1]==="apply";return t({args:i?c.length>=2?c[1]:[]:c,path:i?e.slice(0,-1):e})}})}u(Ct,"createInnerProxy");var Xe=u(t=>Ct(t,[]),"createRecursiveProxy"),et=u(t=>new Proxy(wt,{get(e,r){if(!(typeof r!="string"||r==="then"))return t(r)}}),"createFlatProxy");function Xt(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}u(Xt,"isObject");var De=class extends Error{};u(De,"UnknownCauseError");function tt(t){if(t instanceof Error)return t;let e=typeof t;if(!(e==="undefined"||e==="function"||t===null)){if(e!=="object")return new Error(String(t));if(Xt(t)){let r=new De;for(let n in t)r[n]=t[n];return r}}}u(tt,"getCauseFromUnknown");function Te(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}u(Te,"isObject");function er(t,e){if("error"in t){let n=e.transformer.deserialize(t.error);return{ok:!1,error:{...t,error:n}}}let r={...t.result,...(!t.result.type||t.result.type==="data")&&{type:"data",data:e.transformer.deserialize(t.result.data)}};return{ok:!0,result:r}}u(er,"transformResultInner");var Ce=class extends Error{constructor(){super("Unable to transform response from server")}};u(Ce,"TransformResultError");function Ee(t,e){let r;try{r=er(t,e)}catch{throw new Ce}if(!r.ok&&(!Te(r.error.error)||typeof r.error.error.code!="number"))throw new Ce;if(r.ok&&!Te(r.result))throw new Ce;return r}u(Ee,"transformResult");function tr(t){return t instanceof E||t instanceof Error&&t.name==="TRPCClientError"}u(tr,"isTRPCClientError");function rr(t){return Te(t)&&Te(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}u(rr,"isTRPCErrorResponse");var E=class extends Error{static from(e,r={}){let n=e;return tr(n)?(r.meta&&(n.meta={...n.meta,...r.meta}),n):rr(n)?new E(n.error.message,{...r,result:n}):n instanceof Error?new E(n.message,{...r,cause:tt(n)}):new E("Unknown error",{...r,cause:n})}constructor(e,r){let n=r?.cause;super(e,{cause:n}),this.meta=r?.meta,this.cause=n,this.shape=r?.result?.error,this.data=r?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,E.prototype)}};u(E,"TRPCClientError");var xt=u(t=>typeof t=="function","isFunction");function kt(t){if(t)return t;if(typeof window<"u"&&xt(window.fetch))return window.fetch;if(typeof globalThis<"u"&&xt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}u(kt,"getFetch");function nr(t){return t||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}u(nr,"getAbortController");function Ve(t){return{url:t.url.toString().replace(/\/$/,""),fetch:t.fetch,AbortController:nr(t.AbortController)}}u(Ve,"resolveHTTPLinkOptions");function ar(t){let e={};for(let r=0;r<t.length;r++){let n=t[r];e[r]=n}return e}u(ar,"arrayToDict");var or={query:"GET",mutation:"POST"};function Tt(t){return"input"in t?t.runtime.transformer.serialize(t.input):ar(t.inputs.map(e=>t.runtime.transformer.serialize(e)))}u(Tt,"getInput");var Pe=u(t=>{let e=t.url+"/"+t.path,r=[];if("inputs"in t&&r.push("batch=1"),t.type==="query"){let n=Tt(t);n!==void 0&&r.push(`input=${encodeURIComponent(JSON.stringify(n))}`)}return r.length&&(e+="?"+r.join("&")),e},"getUrl"),rt=u(t=>{if(t.type==="query")return;let e=Tt(t);return e!==void 0?JSON.stringify(e):void 0},"getBody"),Le=u(t=>at({...t,contentTypeHeader:"application/json",getUrl:Pe,getBody:rt}),"jsonHttpRequester");async function nt(t,e){let r=t.getUrl(t),n=t.getBody(t),{type:o}=t,c=await t.headers();if(o==="subscription")throw new Error("Subscriptions should use wsLink");let i={...t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{},...t.batchModeHeader?{"trpc-batch-mode":t.batchModeHeader}:{},...c};return kt(t.fetch)(r,{method:or[o],signal:e?.signal,body:n,headers:i})}u(nt,"fetchHTTPResponse");function at(t){let e=t.AbortController?new t.AbortController:null,r={},n=!1;return{promise:new Promise((i,s)=>{nt(t,e).then(l=>(r.response=l,n=!0,l.json())).then(l=>{r.responseJSON=l,i({json:l,meta:r})}).catch(l=>{n=!0,s(E.from(l,{meta:r}))})}),cancel:u(()=>{n||e?.abort()},"cancel")}}u(at,"httpRequest");var ot=u(()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")},"throwFatalError");function st(t){let e=null,r=null,n=u(()=>{clearTimeout(r),r=null,e=null},"destroyTimerAndPendingItems");function o(s){let l=[[]],d=0;for(;;){let f=s[d];if(!f)break;let g=l[l.length-1];if(f.aborted){f.reject?.(new Error("Aborted")),d++;continue}if(t.validate(g.concat(f).map(x=>x.key))){g.push(f),d++;continue}if(g.length===0){f.reject?.(new Error("Input is too big for a single dispatch")),d++;continue}l.push([])}return l}u(o,"groupItems");function c(){let s=o(e);n();for(let l of s){if(!l.length)continue;let d={items:l,cancel:ot};for(let x of l)x.batch=d;let f=u((x,P)=>{let D=d.items[x];D.resolve?.(P),D.batch=null,D.reject=null,D.resolve=null},"unitResolver"),{promise:g,cancel:k}=t.fetch(d.items.map(x=>x.key),f);d.cancel=k,g.then(x=>{for(let P=0;P<x.length;P++){let D=x[P];f(P,D)}for(let P of d.items)P.reject?.(new Error("Missing result")),P.batch=null}).catch(x=>{for(let P of d.items)P.reject?.(x),P.batch=null})}}u(c,"dispatch");function i(s){let l={aborted:!1,key:s,batch:null,resolve:ot,reject:ot},d=new Promise((g,k)=>{l.reject=k,l.resolve=g,e||(e=[]),e.push(l)});return r||(r=setTimeout(c)),{promise:d,cancel:u(()=>{l.aborted=!0,l.batch?.items.every(g=>g.aborted)&&(l.batch.cancel(),l.batch=null)},"cancel")}}return u(i,"load"),{load:i}}u(st,"dataLoader");function it(t){return u(function(r){let n=Ve(r),o=r.maxURLLength??1/0;return c=>{let i=u(g=>{let k=u(P=>{if(o===1/0)return!0;let D=P.map(de=>de.path).join(","),_e=P.map(de=>de.input);return Pe({...n,runtime:c,type:g,path:D,inputs:_e}).length<=o},"validate"),x=t({...n,runtime:c,type:g,opts:r});return{validate:k,fetch:x}},"batchLoader"),s=st(i("query")),l=st(i("mutation")),d=st(i("subscription")),f={query:s,subscription:d,mutation:l};return({op:g})=>q(k=>{let x=f[g.type],{promise:P,cancel:D}=x.load(g),_e;return P.then(Z=>{_e=Z;let de=Ee(Z.json,c);if(!de.ok){k.error(E.from(de.error,{meta:Z.meta}));return}k.next({context:Z.meta,result:de.result}),k.complete()}).catch(Z=>{k.error(E.from(Z,{meta:_e?.meta}))}),()=>{D()}})}},"httpBatchLink")}u(it,"createHTTPBatchLink");var sr=u(t=>e=>{let r=e.map(i=>i.path).join(","),n=e.map(i=>i.input),{promise:o,cancel:c}=Le({...t,path:r,inputs:n,headers(){return t.opts.headers?typeof t.opts.headers=="function"?t.opts.headers({opList:e}):t.opts.headers:{}}});return{promise:o.then(i=>(Array.isArray(i.json)?i.json:e.map(()=>i.json)).map(d=>({meta:i.meta,json:d}))),cancel:c}},"batchRequester"),Be=it(sr);function qe(t){return e=>{let r=Ve(e);return n=>({op:o})=>q(c=>{let{path:i,input:s,type:l}=o,{promise:d,cancel:f}=t.requester({...r,runtime:n,type:l,path:i,input:s,headers(){return e.headers?typeof e.headers=="function"?e.headers({op:o}):e.headers:{}}}),g;return d.then(k=>{g=k.meta;let x=Ee(k.json,n);if(!x.ok){c.error(E.from(x.error,{meta:g}));return}c.next({context:k.meta,result:x.result}),c.complete()}).catch(k=>{c.error(E.from(k,{meta:g}))}),()=>{f()}})}}u(qe,"httpLinkFactory");var ir=qe({requester:Le});var Me=class{$request({type:e,input:r,path:n,context:o={}}){return _t({links:this.links,op:{id:++this.requestId,type:e,path:n,input:r,context:o}}).pipe(vt())}requestAsPromise(e){let r=this.$request(e),{promise:n,abort:o}=bt(r);return new Promise((i,s)=>{e.signal?.addEventListener("abort",o),n.then(l=>{i(l.result.data)}).catch(l=>{s(E.from(l))})})}query(e,r,n){return this.requestAsPromise({type:"query",path:e,input:r,context:n?.context,signal:n?.signal})}mutation(e,r,n){return this.requestAsPromise({type:"mutation",path:e,input:r,context:n?.context,signal:n?.signal})}subscription(e,r,n){return this.$request({type:"subscription",path:e,input:r,context:n?.context}).subscribe({next(c){c.result.type==="started"?n.onStarted?.():c.result.type==="stopped"?n.onStopped?.():n.onData?.(c.result.data)},error(c){n.onError?.(c)},complete(){n.onComplete?.()}})}constructor(e){this.requestId=0;let r=(()=>{let n=e.transformer;return n?"input"in n?e.transformer:{input:n,output:n}:{input:{serialize:o=>o,deserialize:o=>o},output:{serialize:o=>o,deserialize:o=>o}}})();this.runtime={transformer:{serialize:n=>r.input.serialize(n),deserialize:n=>r.output.deserialize(n)},combinedTransformer:r},this.links=e.links.map(n=>n(this.runtime))}};u(Me,"TRPCUntypedClient");var cr={query:"query",mutate:"mutation",subscribe:"subscription"},lr=u(t=>cr[t],"clientCallTypeToProcedureType");function ur(t){return et(e=>t.hasOwnProperty(e)?t[e]:e==="__untypedClient"?t:Xe(({path:r,args:n})=>{let o=[e,...r],c=lr(o.pop()),i=o.join(".");return t[c](i,...n)}))}u(ur,"createTRPCClientProxy");function ct(t){let e=new Me(t);return ur(e)}u(ct,"createTRPCProxyClient");function dr(t){if(t)return t;if(typeof window<"u"&&window.TextDecoder)return new window.TextDecoder;if(typeof globalThis<"u"&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw new Error("No TextDecoder implementation found")}u(dr,"getTextDecoder");async function fr(t){let e=t.parse??JSON.parse,r=u(n=>{if(t.signal?.aborted||!n||n==="}")return;let o=n.indexOf(":"),c=n.substring(2,o-1),i=n.substring(o+1);t.onSingle(Number(c),e(i))},"onLine");await pr(t.readableStream,r,t.textDecoder)}u(fr,"parseJSONStream");async function pr(t,e,r){let n="",o=u(c=>{let s=r.decode(c).split(`
|
|
2
|
-
`);if(s.length===1)n+=s[0];else if(s.length>1){e(n+s[0]);for(let l=1;l<s.length-1;l++)e(s[l]);n=s[s.length-1]}},"onChunk");"getReader"in t?await hr(t,o):await mr(t,o),e(n)}u(pr,"readLines");function mr(t,e){return new Promise(r=>{t.on("data",e),t.on("end",r)})}u(mr,"readNodeChunks");async function hr(t,e){let r=t.getReader(),n=await r.read();for(;!n.done;)e(n.value),n=await r.read()}u(hr,"readStandardChunks");var yr=u((t,e)=>{let r=t.AbortController?new t.AbortController:null,n=nt({...t,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:Pe,getBody:rt},r),o=u(()=>r?.abort(),"cancel"),c=n.then(async i=>{if(!i.body)throw new Error("Received response without body");let s={response:i};return fr({readableStream:i.body,onSingle:e,parse:l=>({json:JSON.parse(l),meta:s}),signal:r?.signal,textDecoder:t.textDecoder})});return{cancel:o,promise:c}},"streamingJsonHttpRequester"),gr=u(t=>{let e=dr(t.opts.textDecoder);return(r,n)=>{let o=r.map(l=>l.path).join(","),c=r.map(l=>l.input),{cancel:i,promise:s}=yr({...t,textDecoder:e,path:o,inputs:c,headers(){return t.opts.headers?typeof t.opts.headers=="function"?t.opts.headers({opList:r}):t.opts.headers:{}}},(l,d)=>{n(l,d)});return{promise:s.then(()=>[]),cancel:i}}},"streamRequester"),co=it(gr),vr=u(t=>{if("input"in t){if(!(t.input instanceof FormData))throw new Error("Input is not FormData");return t.input}},"getBody"),br=u(t=>{if(t.type!=="mutation")throw new Error("We only handle mutations with formdata");return at({...t,getUrl(){return`${t.url}/${t.path}`},getBody:vr})},"formDataRequester"),lo=qe({requester:br});var _r=Object.defineProperty,$e=u((t,e)=>_r(t,"name",{value:e,configurable:!0}),"__name"),wr=$e(t=>()=>({next:e,op:r})=>q(n=>{let o=null,c=0,i=!1,s=$e(()=>{c+=1,o?.unsubscribe(),o=e(r).subscribe({error:async l=>{if(c>5||l.data?.httpStatus!==401)return n.error(l);await t(),s()},next:l=>n.next(l),complete:()=>{i&&n.complete()}})},"attempt");return s(),()=>{i=!0,o?.unsubscribe()}}),"callbackLink"),Et=$e(async(t,e)=>{let r=[],n=ct({links:[Be({url:t,maxURLLength:2048,headers:{Authorization:`Bearer ${await e()}`}})]}),o=$e(async(i=95+Math.round((Math.random()-.5)*5))=>n.utilities.getChallenges.query({amount:i}),"getChallenges");return r=await o(),ct({links:[wr(async()=>{r=await o()}),Be({maxURLLength:2048,url:t,headers:async()=>(r.length===0&&r.push(...await o()),{Authorization:`Bearer ${await e(r.pop())}`})})]})},"getClient");var C;(function(t){t.assertEqual=o=>o;function e(o){}u(e,"assertIs"),t.assertIs=e;function r(o){throw new Error}u(r,"assertNever"),t.assertNever=r,t.arrayToEnum=o=>{let c={};for(let i of o)c[i]=i;return c},t.getValidEnumValues=o=>{let c=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),i={};for(let s of c)i[s]=o[s];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(c){return o[c]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let c=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&c.push(i);return c},t.find=(o,c)=>{for(let i of o)if(c(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,c=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(c)}u(n,"joinValues"),t.joinValues=n,t.jsonStringifyReplacer=(o,c)=>typeof c=="bigint"?c.toString():c})(C||(C={}));var m=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),K=u(t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},"getParsedType"),p=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Cr=u(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),V=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(c){return c.message},n={_errors:[]},o=u(c=>{for(let i of c.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let s=n,l=0;for(;l<i.path.length;){let d=i.path[l];l===i.path.length-1?(s[d]=s[d]||{_errors:[]},s[d]._errors.push(r(i))):s[d]=s[d]||{_errors:[]},s=s[d],l++}}},"processError");return o(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};u(V,"ZodError");V.create=t=>new V(t);var Se=u((t,e)=>{let r;switch(t.code){case p.invalid_type:t.received===m.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case p.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,C.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:r=`Unrecognized key(s) in object: ${C.joinValues(t.keys,", ")}`;break;case p.invalid_union:r="Invalid input";break;case p.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${C.joinValues(t.options)}`;break;case p.invalid_enum_value:r=`Invalid enum value. Expected ${C.joinValues(t.options)}, received '${t.received}'`;break;case p.invalid_arguments:r="Invalid function arguments";break;case p.invalid_return_type:r="Invalid function return type";break;case p.invalid_date:r="Invalid date";break;case p.invalid_string:typeof t.validation=="object"?"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:C.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case p.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(t.minimum)}`:r="Invalid input";break;case p.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(t.maximum)}`:r="Invalid input";break;case p.custom:r="Invalid input";break;case p.invalid_intersection_types:r="Intersection results could not be merged";break;case p.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case p.not_finite:r="Number must be finite";break;default:r=e.defaultError,C.assertNever(t)}return{message:r}},"errorMap"),jt=Se;function xr(t){jt=t}u(xr,"setErrorMap");function Ue(){return jt}u(Ue,"getErrorMap");var Fe=u(t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,c=[...r,...o.path||[]],i={...o,path:c},s="",l=n.filter(d=>!!d).slice().reverse();for(let d of l)s=d(i,{data:e,defaultError:s}).message;return{...o,path:c,message:o.message||s}},"makeIssue"),kr=[];function h(t,e){let r=Fe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),Se].filter(n=>!!n)});t.common.issues.push(r)}u(h,"addIssueToContext");var R=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return v;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r)n.push({key:await o.key,value:await o.value});return R.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:c,value:i}=o;if(c.status==="aborted"||i.status==="aborted")return v;c.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),(typeof i.value<"u"||o.alwaysSet)&&(n[c.value]=i.value)}return{status:e.value,value:n}}};u(R,"ParseStatus");var v=Object.freeze({status:"aborted"}),Nt=u(t=>({status:"dirty",value:t}),"DIRTY"),S=u(t=>({status:"valid",value:t}),"OK"),lt=u(t=>t.status==="aborted","isAborted"),ut=u(t=>t.status==="dirty","isDirty"),We=u(t=>t.status==="valid","isValid"),Ze=u(t=>typeof Promise!==void 0&&t instanceof Promise,"isAsync"),w;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(w||(w={}));var O=class{constructor(e,r,n,o){this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._path.concat(this._key)}};u(O,"ParseInputLazyPath");var Pt=u((t,e)=>{if(We(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new V(t.common.issues);return{success:!1,error:r}}},"handleResult");function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:u((i,s)=>i.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:n??s.defaultError}:{message:r??s.defaultError},"customMap"),description:o}}u(_,"processCreateParams");var b=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return K(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:K(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:K(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ze(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let o={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K(e)},c=this._parseSync({data:e,path:o.path,parent:o});return Pt(o,c)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K(e)},o=this._parse({data:e,path:n.path,parent:n}),c=await(Ze(o)?o:Promise.resolve(o));return Pt(n,c)}refine(e,r){let n=u(o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r,"getIssueProperties");return this._refinement((o,c)=>{let i=e(o),s=u(()=>c.addIssue({code:p.custom,...n(o)}),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new N({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return I.create(this)}nullable(){return F.create(this)}nullish(){return this.optional().nullable()}array(){return j.create(this)}promise(){return Y.create(this)}or(e){return re.create([this,e])}and(e){return ne.create(this,e)}transform(e){return new N({schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new le({innerType:this,defaultValue:r,typeName:y.ZodDefault})}brand(){return new Re({typeName:y.ZodBranded,type:this,..._(void 0)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ye({innerType:this,defaultValue:r,typeName:y.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ue.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u(b,"ZodType");var Tr=/^c[^\s-]{8,}$/i,Er=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Pr=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,Rr=u(t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),L=class extends b{constructor(){super(...arguments),this._regex=(e,r,n)=>this.refinement(o=>e.test(o),{validation:r,code:p.invalid_string,...w.errToObj(n)}),this.nonempty=e=>this.min(1,w.errToObj(e)),this.trim=()=>new L({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let c=this._getOrReturnCtx(e);return h(c,{code:p.invalid_type,expected:m.string,received:c.parsedType}),v}let n=new R,o;for(let c of this._def.checks)if(c.kind==="min")e.data.length<c.value&&(o=this._getOrReturnCtx(e,o),h(o,{code:p.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="max")e.data.length>c.value&&(o=this._getOrReturnCtx(e,o),h(o,{code:p.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="length"){let i=e.data.length>c.value,s=e.data.length<c.value;(i||s)&&(o=this._getOrReturnCtx(e,o),i?h(o,{code:p.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):s&&h(o,{code:p.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),n.dirty())}else if(c.kind==="email")Pr.test(e.data)||(o=this._getOrReturnCtx(e,o),h(o,{validation:"email",code:p.invalid_string,message:c.message}),n.dirty());else if(c.kind==="uuid")Er.test(e.data)||(o=this._getOrReturnCtx(e,o),h(o,{validation:"uuid",code:p.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid")Tr.test(e.data)||(o=this._getOrReturnCtx(e,o),h(o,{validation:"cuid",code:p.invalid_string,message:c.message}),n.dirty());else if(c.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),h(o,{validation:"url",code:p.invalid_string,message:c.message}),n.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),h(o,{validation:"regex",code:p.invalid_string,message:c.message}),n.dirty())):c.kind==="trim"?e.data=e.data.trim():c.kind==="startsWith"?e.data.startsWith(c.value)||(o=this._getOrReturnCtx(e,o),h(o,{code:p.invalid_string,validation:{startsWith:c.value},message:c.message}),n.dirty()):c.kind==="endsWith"?e.data.endsWith(c.value)||(o=this._getOrReturnCtx(e,o),h(o,{code:p.invalid_string,validation:{endsWith:c.value},message:c.message}),n.dirty()):c.kind==="datetime"?Rr(c).test(e.data)||(o=this._getOrReturnCtx(e,o),h(o,{code:p.invalid_string,validation:"datetime",message:c.message}),n.dirty()):C.assertNever(c);return{status:n.value,value:e.data}}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,...w.errToObj(e?.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...w.errToObj(r)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...w.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...w.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...w.errToObj(r)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};u(L,"ZodString");L.create=t=>{var e;return new L({checks:[],typeName:y.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,..._(t)})};function Sr(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,c=parseInt(t.toFixed(o).replace(".","")),i=parseInt(e.toFixed(o).replace(".",""));return c%i/Math.pow(10,o)}u(Sr,"floatSafeRemainder");var M=class extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){let c=this._getOrReturnCtx(e);return h(c,{code:p.invalid_type,expected:m.number,received:c.parsedType}),v}let n,o=new R;for(let c of this._def.checks)c.kind==="int"?C.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:p.invalid_type,expected:"integer",received:"float",message:c.message}),o.dirty()):c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:p.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:p.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="multipleOf"?Sr(e.data,c.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:p.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):c.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:p.not_finite,message:c.message}),o.dirty()):C.assertNever(c);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,w.toString(r))}gt(e,r){return this.setLimit("min",e,!1,w.toString(r))}lte(e,r){return this.setLimit("max",e,!0,w.toString(r))}lt(e,r){return this.setLimit("max",e,!1,w.toString(r))}setLimit(e,r,n,o){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:w.toString(o)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};u(M,"ZodNumber");M.create=t=>new M({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,..._(t)});var G=class extends b{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.bigint,received:n.parsedType}),v}return S(e.data)}};u(G,"ZodBigInt");G.create=t=>{var e;return new G({typeName:y.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,..._(t)})};var X=class extends b{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==m.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.boolean,received:n.parsedType}),v}return S(e.data)}};u(X,"ZodBoolean");X.create=t=>new X({typeName:y.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var $=class extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let c=this._getOrReturnCtx(e);return h(c,{code:p.invalid_type,expected:m.date,received:c.parsedType}),v}if(isNaN(e.data.getTime())){let c=this._getOrReturnCtx(e);return h(c,{code:p.invalid_date}),v}let n=new R,o;for(let c of this._def.checks)c.kind==="min"?e.data.getTime()<c.value&&(o=this._getOrReturnCtx(e,o),h(o,{code:p.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),n.dirty()):c.kind==="max"?e.data.getTime()>c.value&&(o=this._getOrReturnCtx(e,o),h(o,{code:p.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),n.dirty()):C.assertNever(c);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};u($,"ZodDate");$.create=t=>new $({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,..._(t)});var fe=class extends b{_parse(e){if(this._getType(e)!==m.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.symbol,received:n.parsedType}),v}return S(e.data)}};u(fe,"ZodSymbol");fe.create=t=>new fe({typeName:y.ZodSymbol,..._(t)});var ee=class extends b{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.undefined,received:n.parsedType}),v}return S(e.data)}};u(ee,"ZodUndefined");ee.create=t=>new ee({typeName:y.ZodUndefined,..._(t)});var te=class extends b{_parse(e){if(this._getType(e)!==m.null){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.null,received:n.parsedType}),v}return S(e.data)}};u(te,"ZodNull");te.create=t=>new te({typeName:y.ZodNull,..._(t)});var H=class extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}};u(H,"ZodAny");H.create=t=>new H({typeName:y.ZodAny,..._(t)});var z=class extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}};u(z,"ZodUnknown");z.create=t=>new z({typeName:y.ZodUnknown,..._(t)});var B=class extends b{_parse(e){let r=this._getOrReturnCtx(e);return h(r,{code:p.invalid_type,expected:m.never,received:r.parsedType}),v}};u(B,"ZodNever");B.create=t=>new B({typeName:y.ZodNever,..._(t)});var pe=class extends b{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.void,received:n.parsedType}),v}return S(e.data)}};u(pe,"ZodVoid");pe.create=t=>new pe({typeName:y.ZodVoid,..._(t)});var j=class extends b{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==m.array)return h(r,{code:p.invalid_type,expected:m.array,received:r.parsedType}),v;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(i||s)&&(h(r,{code:i?p.too_big:p.too_small,minimum:s?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(h(r,{code:p.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(h(r,{code:p.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((i,s)=>o.type._parseAsync(new O(r,i,r.path,s)))).then(i=>R.mergeArray(n,i));let c=r.data.map((i,s)=>o.type._parseSync(new O(r,i,r.path,s)));return R.mergeArray(n,c)}get element(){return this._def.type}min(e,r){return new j({...this._def,minLength:{value:e,message:w.toString(r)}})}max(e,r){return new j({...this._def,maxLength:{value:e,message:w.toString(r)}})}length(e,r){return new j({...this._def,exactLength:{value:e,message:w.toString(r)}})}nonempty(e){return this.min(1,e)}};u(j,"ZodArray");j.create=(t,e)=>new j({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});var He;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(He||(He={}));var Rt=u(t=>e=>new T({...t,shape:()=>({...t.shape(),...e})}),"AugmentFactory");function xe(t){if(t instanceof T){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=I.create(xe(n))}return new T({...t._def,shape:()=>e})}else return t instanceof j?j.create(xe(t.element)):t instanceof I?I.create(xe(t.unwrap())):t instanceof F?F.create(xe(t.unwrap())):t instanceof A?A.create(t.items.map(e=>xe(e))):t}u(xe,"deepPartialify");var T=class extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=Rt(this._def),this.extend=Rt(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=C.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==m.object){let d=this._getOrReturnCtx(e);return h(d,{code:p.invalid_type,expected:m.object,received:d.parsedType}),v}let{status:n,ctx:o}=this._processInputParams(e),{shape:c,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof B&&this._def.unknownKeys==="strip"))for(let d in o.data)i.includes(d)||s.push(d);let l=[];for(let d of i){let f=c[d],g=o.data[d];l.push({key:{status:"valid",value:d},value:f._parse(new O(o,g,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof B){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of s)l.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(d==="strict")s.length>0&&(h(o,{code:p.unrecognized_keys,keys:s}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of s){let g=o.data[f];l.push({key:{status:"valid",value:f},value:d._parse(new O(o,g,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of l){let g=await f.key;d.push({key:g,value:await f.value,alwaysSet:f.alwaysSet})}return d}).then(d=>R.mergeObjectSync(n,d)):R.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new T({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var o,c,i,s;let l=(i=(c=(o=this._def).errorMap)===null||c===void 0?void 0:c.call(o,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(s=w.errToObj(e).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new T({...this._def,unknownKeys:"strip"})}passthrough(){return new T({...this._def,unknownKeys:"passthrough"})}setKey(e,r){return this.augment({[e]:r})}merge(e){return new T({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>He.mergeShapes(this._def.shape(),e._def.shape()),typeName:y.ZodObject})}catchall(e){return new T({...this._def,catchall:e})}pick(e){let r={};return C.objectKeys(e).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new T({...this._def,shape:()=>r})}omit(e){let r={};return C.objectKeys(this.shape).map(n=>{C.objectKeys(e).indexOf(n)===-1&&(r[n]=this.shape[n])}),new T({...this._def,shape:()=>r})}deepPartial(){return xe(this)}partial(e){let r={};if(e)return C.objectKeys(this.shape).map(n=>{C.objectKeys(e).indexOf(n)===-1?r[n]=this.shape[n]:r[n]=this.shape[n].optional()}),new T({...this._def,shape:()=>r});for(let n in this.shape){let o=this.shape[n];r[n]=o.optional()}return new T({...this._def,shape:()=>r})}required(e){let r={};if(e)C.objectKeys(this.shape).map(n=>{if(C.objectKeys(e).indexOf(n)===-1)r[n]=this.shape[n];else{let c=this.shape[n];for(;c instanceof I;)c=c._def.innerType;r[n]=c}});else for(let n in this.shape){let c=this.shape[n];for(;c instanceof I;)c=c._def.innerType;r[n]=c}return new T({...this._def,shape:()=>r})}keyof(){return Ot(C.objectKeys(this.shape))}};u(T,"ZodObject");T.create=(t,e)=>new T({shape:()=>t,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,..._(e)});T.strictCreate=(t,e)=>new T({shape:()=>t,unknownKeys:"strict",catchall:B.create(),typeName:y.ZodObject,..._(e)});T.lazycreate=(t,e)=>new T({shape:t,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,..._(e)});var re=class extends b{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(c){for(let s of c)if(s.result.status==="valid")return s.result;for(let s of c)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let i=c.map(s=>new V(s.ctx.common.issues));return h(r,{code:p.invalid_union,unionErrors:i}),v}if(u(o,"handleResults"),r.common.async)return Promise.all(n.map(async c=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await c._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let c,i=[];for(let l of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=l._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!c&&(c={result:f,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(c)return r.common.issues.push(...c.ctx.common.issues),c.result;let s=i.map(l=>new V(l));return h(r,{code:p.invalid_union,unionErrors:s}),v}}get options(){return this._def.options}};u(re,"ZodUnion");re.create=(t,e)=>new re({options:t,typeName:y.ZodUnion,..._(e)});var ze=u(t=>t instanceof oe?ze(t.schema):t instanceof N?ze(t.innerType()):t instanceof se?[t.value]:t instanceof ie?t.options:t instanceof ce?Object.keys(t.enum):t instanceof le?ze(t._def.innerType):t instanceof ee?[void 0]:t instanceof te?[null]:null,"getDiscriminator"),me=class extends b{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.object)return h(r,{code:p.invalid_type,expected:m.object,received:r.parsedType}),v;let n=this.discriminator,o=r.data[n],c=this.optionsMap.get(o);return c?r.common.async?c._parseAsync({data:r.data,path:r.path,parent:r}):c._parseSync({data:r.data,path:r.path,parent:r}):(h(r,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let c of r){let i=ze(c.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of i){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,c)}}return new me({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,..._(n)})}};u(me,"ZodDiscriminatedUnion");function dt(t,e){let r=K(t),n=K(e);if(t===e)return{valid:!0,data:t};if(r===m.object&&n===m.object){let o=C.objectKeys(e),c=C.objectKeys(t).filter(s=>o.indexOf(s)!==-1),i={...t,...e};for(let s of c){let l=dt(t[s],e[s]);if(!l.valid)return{valid:!1};i[s]=l.data}return{valid:!0,data:i}}else if(r===m.array&&n===m.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let c=0;c<t.length;c++){let i=t[c],s=e[c],l=dt(i,s);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return r===m.date&&n===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}u(dt,"mergeValues");var ne=class extends b{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=u((c,i)=>{if(lt(c)||lt(i))return v;let s=dt(c.value,i.value);return s.valid?((ut(c)||ut(i))&&r.dirty(),{status:r.value,value:s.data}):(h(n,{code:p.invalid_intersection_types}),v)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([c,i])=>o(c,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};u(ne,"ZodIntersection");ne.create=(t,e,r)=>new ne({left:t,right:e,typeName:y.ZodIntersection,..._(r)});var A=class extends b{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:p.invalid_type,expected:m.array,received:n.parsedType}),v;if(n.data.length<this._def.items.length)return h(n,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let c=n.data.map((i,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new O(n,i,n.path,s)):null}).filter(i=>!!i);return n.common.async?Promise.all(c).then(i=>R.mergeArray(r,i)):R.mergeArray(r,c)}get items(){return this._def.items}rest(e){return new A({...this._def,rest:e})}};u(A,"ZodTuple");A.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new A({items:t,typeName:y.ZodTuple,rest:null,..._(e)})};var ae=class extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return h(n,{code:p.invalid_type,expected:m.object,received:n.parsedType}),v;let o=[],c=this._def.keyType,i=this._def.valueType;for(let s in n.data)o.push({key:c._parse(new O(n,s,n.path,s)),value:i._parse(new O(n,n.data[s],n.path,s))});return n.common.async?R.mergeObjectAsync(r,o):R.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof b?new ae({keyType:e,valueType:r,typeName:y.ZodRecord,..._(n)}):new ae({keyType:L.create(),valueType:e,typeName:y.ZodRecord,..._(r)})}};u(ae,"ZodRecord");var he=class extends b{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:p.invalid_type,expected:m.map,received:n.parsedType}),v;let o=this._def.keyType,c=this._def.valueType,i=[...n.data.entries()].map(([s,l],d)=>({key:o._parse(new O(n,s,n.path,[d,"key"])),value:c._parse(new O(n,l,n.path,[d,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of i){let d=await l.key,f=await l.value;if(d.status==="aborted"||f.status==="aborted")return v;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(d.value,f.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of i){let d=l.key,f=l.value;if(d.status==="aborted"||f.status==="aborted")return v;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(d.value,f.value)}return{status:r.value,value:s}}}};u(he,"ZodMap");he.create=(t,e,r)=>new he({valueType:e,keyType:t,typeName:y.ZodMap,..._(r)});var U=class extends b{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:p.invalid_type,expected:m.set,received:n.parsedType}),v;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(h(n,{code:p.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(h(n,{code:p.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let c=this._def.valueType;function i(l){let d=new Set;for(let f of l){if(f.status==="aborted")return v;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}u(i,"finalizeSet");let s=[...n.data.values()].map((l,d)=>c._parse(new O(n,l,n.path,d)));return n.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(e,r){return new U({...this._def,minSize:{value:e,message:w.toString(r)}})}max(e,r){return new U({...this._def,maxSize:{value:e,message:w.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};u(U,"ZodSet");U.create=(t,e)=>new U({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var J=class extends b{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.function)return h(r,{code:p.invalid_type,expected:m.function,received:r.parsedType}),v;function n(s,l){return Fe({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ue(),Se].filter(d=>!!d),issueData:{code:p.invalid_arguments,argumentsError:l}})}u(n,"makeArgsIssue");function o(s,l){return Fe({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ue(),Se].filter(d=>!!d),issueData:{code:p.invalid_return_type,returnTypeError:l}})}u(o,"makeReturnsIssue");let c={errorMap:r.common.contextualErrorMap},i=r.data;return this._def.returns instanceof Y?S(async(...s)=>{let l=new V([]),d=await this._def.args.parseAsync(s,c).catch(k=>{throw l.addIssue(n(s,k)),l}),f=await i(...d);return await this._def.returns._def.type.parseAsync(f,c).catch(k=>{throw l.addIssue(o(f,k)),l})}):S((...s)=>{let l=this._def.args.safeParse(s,c);if(!l.success)throw new V([n(s,l.error)]);let d=i(...l.data),f=this._def.returns.safeParse(d,c);if(!f.success)throw new V([o(d,f.error)]);return f.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new J({...this._def,args:A.create(e).rest(z.create())})}returns(e){return new J({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new J({args:e||A.create([]).rest(z.create()),returns:r||z.create(),typeName:y.ZodFunction,..._(n)})}};u(J,"ZodFunction");var oe=class extends b{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};u(oe,"ZodLazy");oe.create=(t,e)=>new oe({getter:t,typeName:y.ZodLazy,..._(e)});var se=class extends b{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return h(r,{code:p.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}};u(se,"ZodLiteral");se.create=(t,e)=>new se({value:t,typeName:y.ZodLiteral,..._(e)});function Ot(t,e){return new ie({values:t,typeName:y.ZodEnum,..._(e)})}u(Ot,"createZodEnum");var ie=class extends b{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return h(r,{expected:C.joinValues(n),received:r.parsedType,code:p.invalid_type}),v}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return h(r,{received:r.data,code:p.invalid_enum_value,options:n}),v}return S(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}};u(ie,"ZodEnum");ie.create=Ot;var ce=class extends b{_parse(e){let r=C.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){let o=C.objectValues(r);return h(n,{expected:C.joinValues(o),received:n.parsedType,code:p.invalid_type}),v}if(r.indexOf(e.data)===-1){let o=C.objectValues(r);return h(n,{received:n.data,code:p.invalid_enum_value,options:o}),v}return S(e.data)}get enum(){return this._def.values}};u(ce,"ZodNativeEnum");ce.create=(t,e)=>new ce({values:t,typeName:y.ZodNativeEnum,..._(e)});var Y=class extends b{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.promise&&r.common.async===!1)return h(r,{code:p.invalid_type,expected:m.promise,received:r.parsedType}),v;let n=r.parsedType===m.promise?r.data:Promise.resolve(r.data);return S(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};u(Y,"ZodPromise");Y.create=(t,e)=>new Y({type:t,typeName:y.ZodPromise,..._(e)});var N=class extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null;if(o.type==="preprocess"){let i=o.transform(n.data);return n.common.async?Promise.resolve(i).then(s=>this._def.schema._parseAsync({data:s,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}let c={addIssue:i=>{h(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(c.addIssue=c.addIssue.bind(c),o.type==="refinement"){let i=u(s=>{let l=o.refinement(s,c);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s},"executeRefinement");if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?v:(s.status==="dirty"&&r.dirty(),i(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?v:(s.status==="dirty"&&r.dirty(),i(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!We(i))return i;let s=o.transform(i.value,c);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>We(i)?Promise.resolve(o.transform(i.value,c)).then(s=>({status:r.value,value:s})):i);C.assertNever(o)}};u(N,"ZodEffects");N.create=(t,e,r)=>new N({schema:t,typeName:y.ZodEffects,effect:e,..._(r)});N.createWithPreprocess=(t,e,r)=>new N({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,..._(r)});var I=class extends b{_parse(e){return this._getType(e)===m.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(I,"ZodOptional");I.create=(t,e)=>new I({innerType:t,typeName:y.ZodOptional,..._(e)});var F=class extends b{_parse(e){return this._getType(e)===m.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(F,"ZodNullable");F.create=(t,e)=>new F({innerType:t,typeName:y.ZodNullable,..._(e)});var le=class extends b{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};u(le,"ZodDefault");le.create=(t,e)=>new le({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ye=class extends b{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.innerType._parse({data:r.data,path:r.path,parent:r});return Ze(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};u(ye,"ZodCatch");ye.create=(t,e)=>new ye({innerType:t,typeName:y.ZodCatch,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ge=class extends b{_parse(e){if(this._getType(e)!==m.nan){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.nan,received:n.parsedType}),v}return{status:"valid",value:e.data}}};u(ge,"ZodNaN");ge.create=t=>new ge({typeName:y.ZodNaN,..._(t)});var jr=Symbol("zod_brand"),Re=class extends b{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};u(Re,"ZodBranded");var ue=class extends b{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return u(async()=>{let c=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?v:c.status==="dirty"?(r.dirty(),Nt(c.value)):this._def.out._parseAsync({data:c.value,path:n.path,parent:n})},"handleAsync")();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?v:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new ue({in:e,out:r,typeName:y.ZodPipeline})}};u(ue,"ZodPipeline");var At=u((t,e={},r)=>t?H.create().superRefine((n,o)=>{if(!t(n)){let c=typeof e=="function"?e(n):e,i=typeof c=="string"?{message:c}:c;o.addIssue({code:"custom",...i,fatal:r})}}):H.create(),"custom"),Nr={object:T.lazycreate},y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(y||(y={}));var Or=u((t,e={message:`Input not instance of ${t.name}`})=>At(r=>r instanceof t,e,!0),"instanceOfType"),It=L.create,Dt=M.create,Ar=ge.create,Ir=G.create,Vt=X.create,Dr=$.create,Vr=fe.create,Lr=ee.create,Br=te.create,qr=H.create,Mr=z.create,$r=B.create,zr=pe.create,Ur=j.create,Fr=T.create,Wr=T.strictCreate,Zr=re.create,Hr=me.create,Jr=ne.create,Yr=A.create,Qr=ae.create,Kr=he.create,Gr=U.create,Xr=J.create,en=oe.create,tn=se.create,rn=ie.create,nn=ce.create,an=Y.create,St=N.create,on=I.create,sn=F.create,cn=N.createWithPreprocess,ln=ue.create,un=u(()=>It().optional(),"ostring"),dn=u(()=>Dt().optional(),"onumber"),fn=u(()=>Vt().optional(),"oboolean"),pn={string:t=>L.create({...t,coerce:!0}),number:t=>M.create({...t,coerce:!0}),boolean:t=>X.create({...t,coerce:!0}),bigint:t=>G.create({...t,coerce:!0}),date:t=>$.create({...t,coerce:!0})},mn=v,a=Object.freeze({__proto__:null,defaultErrorMap:Se,setErrorMap:xr,getErrorMap:Ue,makeIssue:Fe,EMPTY_PATH:kr,addIssueToContext:h,ParseStatus:R,INVALID:v,DIRTY:Nt,OK:S,isAborted:lt,isDirty:ut,isValid:We,isAsync:Ze,get util(){return C},ZodParsedType:m,getParsedType:K,ZodType:b,ZodString:L,ZodNumber:M,ZodBigInt:G,ZodBoolean:X,ZodDate:$,ZodSymbol:fe,ZodUndefined:ee,ZodNull:te,ZodAny:H,ZodUnknown:z,ZodNever:B,ZodVoid:pe,ZodArray:j,get objectUtil(){return He},ZodObject:T,ZodUnion:re,ZodDiscriminatedUnion:me,ZodIntersection:ne,ZodTuple:A,ZodRecord:ae,ZodMap:he,ZodSet:U,ZodFunction:J,ZodLazy:oe,ZodLiteral:se,ZodEnum:ie,ZodNativeEnum:ce,ZodPromise:Y,ZodEffects:N,ZodTransformer:N,ZodOptional:I,ZodNullable:F,ZodDefault:le,ZodCatch:ye,ZodNaN:ge,BRAND:jr,ZodBranded:Re,ZodPipeline:ue,custom:At,Schema:b,ZodSchema:b,late:Nr,get ZodFirstPartyTypeKind(){return y},coerce:pn,any:qr,array:Ur,bigint:Ir,boolean:Vt,date:Dr,discriminatedUnion:Hr,effect:St,enum:rn,function:Xr,instanceof:Or,intersection:Jr,lazy:en,literal:tn,map:Kr,nan:Ar,nativeEnum:nn,never:$r,null:Br,nullable:sn,number:Dt,object:Fr,oboolean:fn,onumber:dn,optional:on,ostring:un,pipeline:ln,preprocess:cn,promise:an,record:Qr,set:Gr,strictObject:Wr,string:It,symbol:Vr,transformer:St,tuple:Yr,undefined:Lr,union:Zr,unknown:Mr,void:zr,NEVER:mn,ZodIssueCode:p,quotelessJson:Cr,ZodError:V});var Je=a.array(a.string().or(a.record(a.any()))),ko=a.object({type:a.string().optional(),narrative:a.string().optional()}),Ye=a.string().or(a.object({id:a.string(),type:a.string(),caption:a.string().optional()})),hn=a.object({type:a.string().min(1).or(a.string().array().nonempty()),latitude:a.number(),longitude:a.number()}),yn=a.object({type:a.string().min(1).or(a.string().array().nonempty()),addressCountry:a.string().optional(),addressCountryCode:a.string().optional(),addressRegion:a.string().optional(),addressLocality:a.string().optional(),streetAddress:a.string().optional(),postOfficeBoxNumber:a.string().optional(),postalCode:a.string().optional(),geo:hn.optional()}),gn=a.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(a.string()),Bt=a.object({type:a.string().min(1).or(a.string().array().nonempty()),identifier:a.string(),identifierType:gn}),Ne=a.string().or(a.object({id:a.string().optional(),type:a.string().or(a.string().array().nonempty().optional()),name:a.string().optional(),url:a.string().optional(),phone:a.string().optional(),description:a.string().optional(),endorsement:a.any().array().optional(),image:Ye.optional(),email:a.string().email().optional(),address:yn.optional(),otherIdentifier:Bt.array().optional(),official:a.string().optional(),parentOrg:a.any().optional(),familyName:a.string().optional(),givenName:a.string().optional(),additionalName:a.string().optional(),patronymicName:a.string().optional(),honorificPrefix:a.string().optional(),honorificSuffix:a.string().optional(),familyNamePrefix:a.string().optional(),dateOfBirth:a.string().optional()}).catchall(a.any())),ft=a.object({id:a.string().optional()}).catchall(a.any()),vn=a.object({type:a.string(),id:a.string()}).catchall(a.any()),bn=a.object({id:a.string(),type:a.string()}).catchall(a.any()),_n=a.object({id:a.string(),type:a.string()}).catchall(a.any()),be=a.object({"@context":Je,id:a.string().optional(),type:a.string().array().nonempty(),issuer:Ne,issuanceDate:a.string(),expirationDate:a.string().optional(),credentialSubject:ft.or(ft.array()),credentialStatus:vn.optional(),credentialSchema:bn.array().optional(),refreshService:_n.optional()}).catchall(a.any()),W=a.object({type:a.string(),created:a.string(),challenge:a.string().optional(),domain:a.string().optional(),nonce:a.string().optional(),proofPurpose:a.string(),verificationMethod:a.string(),jws:a.string().optional()}).catchall(a.any()),Oe=be.extend({proof:W.or(W.array())}),wn=a.object({"@context":Je,id:a.string().optional(),type:a.string().or(a.string().array().nonempty()),verifiableCredential:Oe.or(Oe.array()).optional(),holder:a.string().optional()}).catchall(a.any()),ht=wn.extend({proof:W.or(W.array())}),qt=a.object({kty:a.string(),crv:a.string(),x:a.string(),y:a.string().optional(),n:a.string().optional(),d:a.string()}),Cn=a.object({alg:a.string(),iv:a.string(),tag:a.string(),epk:qt.partial().optional(),kid:a.string().optional(),apv:a.string().optional(),apu:a.string().optional()}),xn=a.object({header:Cn,encrypted_key:a.string()}),yt=a.object({protected:a.string(),iv:a.string(),ciphertext:a.string(),tag:a.string(),aad:a.string().optional(),recipients:xn.array().optional()}),ve=a.string().or(a.object({"@context":Je.optional(),id:a.string(),type:a.string(),controller:a.string(),publicKeyJwk:qt.optional(),publicKeyBase58:a.string().optional(),blockChainAccountId:a.string().optional()}).catchall(a.any())),kn=a.object({id:a.string(),type:a.string().or(a.string().array().nonempty()),serviceEndpoint:a.any().or(a.any().array().nonempty())}).catchall(a.any()),Po=a.object({"@context":Je,id:a.string(),alsoKnownAs:a.string().optional(),controller:a.string().or(a.string().array().nonempty()).optional(),verificationMethod:ve.array().optional(),authentication:ve.array().optional(),assertionMethod:ve.array().optional(),keyAgreement:ve.array().optional(),capabilityInvocation:ve.array().optional(),capabilityDelegation:ve.array().optional(),publicKey:ve.array().optional(),service:kn.array().optional(),proof:W.or(W.array()).optional()}).catchall(a.any()),Tn=a.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(a.string()),Qe=a.object({type:a.string().array().nonempty(),targetCode:a.string().optional(),targetDescription:a.string().optional(),targetName:a.string(),targetFramework:a.string().optional(),targetType:Tn.optional(),targetUrl:a.string()}),En=a.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),Pn=En.or(a.string()),Rn=a.object({id:a.string().optional(),narrative:a.string().optional()}).catchall(a.any()),Sn=a.object({id:a.string(),type:a.string().array().nonempty(),endorsementComment:a.string().optional()}),jn=be.extend({credentialSubject:Sn,proof:W.or(W.array()).optional()}),Nn=a.object({id:a.string(),"@language":a.string().optional(),version:a.string().optional()}),On=a.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(a.string()),An=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:Qe.array().optional(),description:a.string().optional(),level:a.string().optional(),name:a.string(),points:a.string().optional()}).catchall(a.any()),In=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:Qe.array().optional(),allowedValue:a.string().array().optional(),name:a.string(),requiredLevel:a.string().optional(),requiredValue:a.string().optional(),resultType:On,rubricCriterionLevel:An.array().optional(),valueMax:a.string().optional(),valueMin:a.string().optional()}).catchall(a.any()),Dn=a.object({id:a.string().optional(),type:a.string().array().nonempty(),alignment:Qe.array().optional(),achievementType:Pn.optional(),creator:Ne.optional(),creditsAvailable:a.number().optional(),criteria:Rn,description:a.string(),endorsement:jn.array().optional(),fieldOfStudy:a.string().optional(),humanCode:a.string().optional(),image:Ye.optional(),"@language":a.string().optional(),name:a.string(),otherIdentifier:Bt.array().optional(),related:Nn.array().optional(),resultDescription:In.array().optional(),specialization:a.string().optional(),tag:a.string().array().optional(),version:a.string().optional()}).catchall(a.any()),Vn=a.object({type:a.string(),hashed:a.boolean(),identityHash:a.string(),identityType:a.string(),salt:a.string().optional()}),Ln=a.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),Bn=a.object({type:a.string().array().nonempty(),achievedLevel:a.string().optional(),alignment:Qe.array().optional(),resultDescription:a.string().optional(),status:Ln.optional(),value:a.string().optional()}).catchall(a.any()),Lt=a.object({id:a.string().optional(),type:a.string().array().nonempty(),activityEndDate:a.string().optional(),activityStartDate:a.string().optional(),creditsEarned:a.number().optional(),achievement:Dn.optional(),identifier:Vn.array().optional(),image:Ye.optional(),licenseNumber:a.string().optional(),narrative:a.string().optional(),result:Bn.array().optional(),role:a.string().optional(),source:Ne.optional(),term:a.string().optional()}).catchall(a.any()),qn=a.object({id:a.string().optional(),type:a.string().array().nonempty(),narrative:a.string().optional(),name:a.string().optional(),description:a.string().optional(),genre:a.string().optional(),audience:a.string().optional()}).catchall(a.any()),Mn=be.extend({name:a.string().optional(),description:a.string().optional(),image:Ye.optional(),credentialSubject:Lt.or(Lt.array()),endorsement:be.array().optional(),evidence:qn.array().optional()}),So=Mn.extend({proof:W.or(W.array())}),No=a.object({checks:a.string().array(),warnings:a.string().array(),errors:a.string().array()}),Mt=a.enum(["Success","Failed","Error"]),Oo=Mt.enum,Ao=a.object({check:a.string(),status:Mt,message:a.string().optional(),details:a.string().optional()}),Io=a.object({title:a.string().optional(),createdAt:a.string().optional(),issuer:Ne.optional(),issuee:Ne.optional(),credentialSubject:ft.optional()}),Do=a.object({id:a.string(),uri:a.string()}).catchall(a.any()),Bo=a.object({limit:a.number(),cursor:a.string().optional(),sort:a.string().optional()}),Q=a.object({cursor:a.string().optional(),hasMore:a.boolean()}),$t=a.object({encryptedRecord:yt,fields:a.string().array()}).catchall(a.any()),qo=Q.extend({records:$t.array()}),$n=$t.extend({id:a.string()}),Mo=Q.extend({records:$n.array()}),ke=a.object({profileId:a.string().min(3).max(40),displayName:a.string().default(""),shortBio:a.string().default(""),bio:a.string().default(""),did:a.string(),email:a.string().optional(),image:a.string().optional(),heroImage:a.string().optional(),websiteLink:a.string().optional(),isServiceProfile:a.boolean().default(!1).optional(),type:a.string().optional(),notificationsWebhook:a.string().url().startsWith("http").optional()}),zo=Q.extend({records:ke.array()}),Uo=a.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Fo=a.object({uri:a.string(),to:a.string(),from:a.string(),sent:a.string().datetime(),received:a.string().datetime().optional()}),zn=a.object({role:a.string(),canEdit:a.boolean(),canIssue:a.boolean(),canRevoke:a.boolean(),canManagePermissions:a.boolean(),canIssueChildren:a.string(),canCreateChildren:a.string(),canEditChildren:a.string(),canRevokeChildren:a.string(),canManageChildrenPermissions:a.string(),canViewAnalytics:a.boolean()}),pt=a.enum(["DRAFT","LIVE"]),Un=a.object({uri:a.string(),name:a.string().optional(),type:a.string().optional(),category:a.string().optional(),status:pt.optional(),autoConnectRecipients:a.boolean().optional(),meta:a.record(a.any()).optional(),claimPermissions:zn.optional()}),je=a.string().or(a.object({$in:a.string().array()})).or(a.object({$regex:a.instanceof(RegExp)})),Wo=a.object({uri:je,name:je,type:je,category:je,meta:a.record(je),status:pt.or(a.object({$in:pt.array()})),autoConnectRecipients:a.boolean()}).partial(),Zo=Q.extend({records:Un.array()}),Fn=a.object({to:ke,from:a.string(),received:a.string().optional()}),Ho=Q.extend({records:Fn.array()}),Jo=a.object({endpoint:a.string(),name:a.string(),did:a.string().optional()}),Yo=a.object({ttlSeconds:a.number().optional(),totalUses:a.number().optional()}),Wn=a.object({endpoint:a.string()}),Qo=a.object({signingAuthority:Wn,relationship:a.object({name:a.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:a.string()})}),Zn=a.enum(["live","stale","withdrawn"]),gt=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({categories:a.record(a.object({required:a.boolean()})).default({})}).default({}),personal:a.record(a.object({required:a.boolean()})).default({})}).default({}),write:a.object({credentials:a.object({categories:a.record(a.object({required:a.boolean()})).default({})}).default({}),personal:a.record(a.object({required:a.boolean()})).default({})}).default({})}),zt=a.object({contract:gt,owner:ke,name:a.string(),subtitle:a.string().optional(),description:a.string().optional(),reasonForAccessing:a.string().optional(),image:a.string().optional(),uri:a.string(),createdAt:a.string(),updatedAt:a.string(),expiresAt:a.string().optional()}),Ko=Q.extend({records:zt.omit({owner:!0}).array()}),Hn=a.object({credentials:a.object({categories:a.record(a.string().array()).default({})}),personal:a.record(a.string()).default({}),date:a.string()}),Go=Q.extend({records:Hn.array()}),Ut=a.object({sharing:a.boolean().optional(),shared:a.string().array().optional(),shareAll:a.boolean().optional(),shareUntil:a.string().optional()}),Ke=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(Ut).default({})}).default({}),personal:a.record(a.string()).default({})}).default({}),write:a.object({credentials:a.object({categories:a.record(a.boolean()).default({})}).default({}),personal:a.record(a.boolean()).default({})}).default({})}),Xo=Q.extend({records:a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:Ke,contract:zt,uri:a.string(),consenter:ke,status:Zn}).array()}),es=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({categories:a.record(a.object({required:a.boolean().optional()})).optional()}).optional(),personal:a.record(a.object({required:a.boolean().optional()})).optional()}).optional(),write:a.object({credentials:a.object({categories:a.record(a.object({required:a.boolean().optional()})).optional()}).optional(),personal:a.record(a.object({required:a.boolean().optional()})).optional()}).optional()}),ts=a.object({anonymize:a.boolean().optional(),credentials:a.object({categories:a.record(a.boolean()).optional()}).optional(),personal:a.record(a.boolean()).optional()}),Jn=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(Ut.optional()).optional()}).optional(),personal:a.record(a.string()).optional()}).optional(),write:a.object({credentials:a.object({categories:a.record(a.boolean()).optional()}).optional(),personal:a.record(a.boolean()).optional()}).optional()}),mt=a.enum(["consent","update","sync","withdraw"]),rs=a.object({terms:Jn.optional(),action:mt.or(mt.array()).optional(),date:a.object({$gt:a.string()}).or(a.object({$lt:a.string()})).or(a.object({$eq:a.string()})).optional(),expiresAt:a.object({$gt:a.string()}).or(a.object({$lt:a.string()})).or(a.object({$eq:a.string()})).optional(),oneTime:a.boolean().optional()}),Ft=a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:Ke.optional(),id:a.string(),action:mt,date:a.string()}),ns=Q.extend({records:Ft.array()}),Yn=a.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),Qn=a.object({title:a.string().optional(),body:a.string().optional()}),Kn=a.object({vcUris:a.array(a.string()).optional(),vpUris:a.array(a.string()).optional(),transaction:Ft.optional()}),as=a.object({type:Yn,to:ke.partial().and(a.object({did:a.string()})),from:ke.partial().and(a.object({did:a.string()})),message:Qn.optional(),data:Kn.optional(),sent:a.string().datetime().optional()});var Gn=u(async(t,e)=>{let r=t.id.did();t?.debug?.("Adding LearnCardNetwork Plugin");let n=await Et(e,async i=>{let s=await t.invoke.getDidAuthVp({proofFormat:"jwt",challenge:i});if(typeof s!="string")throw new Error("Error getting DID-Auth-JWT!");return s}),o;try{o=await n.profile.getProfile.query()}catch(i){t.debug?.("No profile!",i)}let c=o?.did||r;return{name:"LearnCard Network",displayName:"LearnCard Network",description:"LearnCard Network Integration",id:{did:(i,s)=>!s||s==="web"?c:t.id.did(s),keypair:(i,s)=>t.id.keypair(s)},read:{get:async(i,s)=>{if(i.debug?.("learnCard.read['LearnCard Network'].get"),!s)return;let l=s.split(":");if(l.length!==5)return;let[d,f]=l;if(!(d!=="lc"||f!=="network"))try{let g=await n.storage.resolve.query({uri:s});return"ciphertext"in g&&(g=await i.invoke.getDIDObject().decryptDagJWE(g)),await Oe.or(ht).parseAsync(g)}catch(g){i.debug?.(g);return}}},store:{upload:async(i,s)=>(i.debug?.("learnCard.store['LearnCard Network'].upload"),n.storage.store.mutate({item:s})),uploadEncrypted:async(i,s,{recipients:l=[]}={recipients:[]})=>{i.debug?.("learnCard.store['LearnCard Network'].upload");let d=await i.invoke.getDIDObject().createDagJWE(s,[i.id.did(),...l]);return n.storage.store.mutate({item:d})}},methods:{createProfile:async(i,s)=>{if(o)throw new Error("Account already exists!");let l=await n.profile.createProfile.mutate(s);return o=await n.profile.getProfile.query(),c=l,l},createServiceProfile:async(i,s)=>{if(o)throw new Error("Account already exists!");let l=await n.profile.createServiceProfile.mutate(s);return o=await n.profile.getProfile.query(),c=l,l},createManagedServiceProfile:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return await n.profile.createManagedServiceProfile.mutate(s)},getManagedServiceProfiles:async(i,s={})=>{if(!o)throw new Error("Please make an account first!");return n.profile.getManagedServiceProfiles.query(s)},updateProfile:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return await n.profile.updateProfile.mutate(s)?(o=await n.profile.getProfile.query(),!0):!1},deleteProfile:async()=>{if(!o)throw new Error("Account does not exist!");return await n.profile.deleteProfile.mutate()?(o=void 0,!0):!1},getProfile:async(i,s)=>s?n.profile.getOtherProfile.query({profileId:s}):n.profile.getProfile.query(),searchProfiles:async(i,s="",{limit:l=25,includeSelf:d=!1,includeConnectionStatus:f=!1,includeServiceProfiles:g=!1}={})=>n.profile.searchProfiles.query({input:s,limit:l,includeSelf:d,includeConnectionStatus:f,includeServiceProfiles:g}),connectWith:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.profile.connectWith.mutate({profileId:s})},cancelConnectionRequest:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.profile.cancelConnectionRequest.mutate({profileId:s})},connectWithInvite:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.profile.connectWithInvite.mutate({profileId:s,challenge:l})},disconnectWith:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.profile.disconnectWith.mutate({profileId:s})},acceptConnectionRequest:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.profile.acceptConnectionRequest.mutate({profileId:s})},getConnections:async i=>{if(console.warn("The getConnections method is deprecated! Please use getPaginatedConnections instead!"),!o)throw new Error("Please make an account first!");return n.profile.connections.query()},getPaginatedConnections:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.profile.paginatedConnections.query(s)},getPendingConnections:async i=>{if(console.warn("The getPendingConnections method is deprecated! Please use getPaginatedPendingConnections instead!"),!o)throw new Error("Please make an account first!");return n.profile.pendingConnections.query()},getPaginatedPendingConnections:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.profile.paginatedPendingConnections.query(s)},getConnectionRequests:async i=>{if(console.warn("The getConnectionRequests method is deprecated! Please use getPaginatedConnectionRequests instead!"),!o)throw new Error("Please make an account first!");return n.profile.connectionRequests.query()},getPaginatedConnectionRequests:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.profile.paginatedConnectionRequests.query(s)},generateInvite:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.profile.generateInvite.mutate({challenge:s,expiration:l})},blockProfile:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.profile.blockProfile.mutate({profileId:s})},unblockProfile:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.profile.unblockProfile.mutate({profileId:s})},getBlockedProfiles:async()=>{if(!o)throw new Error("Please make an account first!");return n.profile.blocked.query()},sendCredential:async(i,s,l,d=!0)=>{if(!o)throw new Error("Please make an account first!");if(!d)return n.credential.sendCredential.mutate({profileId:s,credential:l});let f=await i.invoke.getProfile(s);if(!f)throw new Error("Could not find target account");let g=await i.invoke.getDIDObject().createDagJWE(l,[o.did,f.did]);return n.credential.sendCredential.mutate({profileId:s,credential:g})},acceptCredential:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.credential.acceptCredential.mutate({uri:s})},getReceivedCredentials:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.credential.receivedCredentials.query({from:s})},getSentCredentials:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.credential.sentCredentials.query({to:s})},getIncomingCredentials:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.credential.incomingCredentials.query({from:s})},deleteCredential:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.credential.deleteCredential.mutate({uri:s})},sendPresentation:async(i,s,l,d=!0)=>{if(!o)throw new Error("Please make an account first!");if(!d)return n.presentation.sendPresentation.mutate({profileId:s,presentation:l});let f=await i.invoke.getProfile(s);if(!f)throw new Error("Could not find target account");let g=await i.invoke.getDIDObject().createDagJWE(l,[o.did,f.did]);return n.presentation.sendPresentation.mutate({profileId:s,presentation:g})},acceptPresentation:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.presentation.acceptPresentation.mutate({uri:s})},getReceivedPresentations:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.presentation.receivedPresentations.query({from:s})},getSentPresentations:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.presentation.sentPresentations.query({to:s})},getIncomingPresentations:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.presentation.incomingPresentations.query({from:s})},deletePresentation:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.presentation.deletePresentation.mutate({uri:s})},createBoost:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.createBoost.mutate({credential:s,...l})},createChildBoost:async(i,s,l,d)=>{if(!o)throw new Error("Please make an account first!");return n.boost.createChildBoost.mutate({parentUri:s,boost:{credential:l,...d}})},getBoost:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.boost.getBoost.query({uri:s})},getBoosts:async(i,s)=>{if(console.warn("The getBoosts method is deprecated! Please use getPaginatedBoosts instead!"),!o)throw new Error("Please make an account first!");return n.boost.getBoosts.query({query:s})},countBoosts:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.boost.countBoosts.query({query:s})},getPaginatedBoosts:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.boost.getPaginatedBoosts.query(s)},getBoostChildren:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.getBoostChildren.query({uri:s,...l})},countBoostChildren:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.countBoostChildren.query({uri:s,...l})},getBoostSiblings:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.getBoostSiblings.query({uri:s,...l})},countBoostSiblings:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.countBoostSiblings.query({uri:s,...l})},getFamilialBoosts:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.getFamilialBoosts.query({uri:s,...l})},countFamilialBoosts:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.countFamilialBoosts.query({uri:s,...l})},getBoostParents:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.getBoostParents.query({uri:s,...l})},countBoostParents:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.countBoostParents.query({uri:s,...l})},makeBoostParent:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.boost.makeBoostParent.mutate(s)},removeBoostParent:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.boost.removeBoostParent.mutate(s)},getBoostRecipients:async(i,s,l=25,d=void 0,f=!0)=>{if(console.warn("The getBoostRecipients method is deprecated! Please use getPaginatedBoostRecipients instead!"),!o)throw new Error("Please make an account first!");return n.boost.getBoostRecipients.query({uri:s,limit:l,skip:d,includeUnacceptedBoosts:f})},getPaginatedBoostRecipients:async(i,s,l=25,d=void 0,f=!0)=>{if(!o)throw new Error("Please make an account first!");return n.boost.getPaginatedBoostRecipients.query({uri:s,limit:l,cursor:d,includeUnacceptedBoosts:f})},countBoostRecipients:async(i,s,l=!0)=>{if(!o)throw new Error("Please make an account first!");return n.boost.getBoostRecipientCount.query({uri:s,includeUnacceptedBoosts:l})},updateBoost:async(i,s,l,d)=>{if(!o)throw new Error("Please make an account first!");return n.boost.updateBoost.mutate({uri:s,updates:{credential:d,...l}})},getBoostAdmins:async(i,s,l={})=>{if(!o)throw new Error("Please make an account first!");return n.boost.getBoostAdmins.query({uri:s,...l})},getBoostPermissions:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return l?n.boost.getOtherBoostPermissions.query({uri:s,profileId:l}):n.boost.getBoostPermissions.query({uri:s})},updateBoostPermissions:async(i,s,l,d)=>{if(!o)throw new Error("Please make an account first!");return d?n.boost.updateOtherBoostPermissions.query({uri:s,profileId:d,updates:l}):n.boost.updateBoostPermissions.query({uri:s,updates:l})},addBoostAdmin:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.addBoostAdmin.mutate({uri:s,profileId:l})},removeBoostAdmin:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.removeBoostAdmin.mutate({uri:s,profileId:l})},deleteBoost:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.boost.deleteBoost.mutate({uri:s})},sendBoost:async(i,s,l,d={encrypt:!0})=>{if(!o)throw new Error("Please make an account first!");let f=await i.invoke.resolveFromLCN(l),g=await be.spa(f);if(!g.success)throw new Error("Did not get a valid boost from URI");let k=await i.invoke.getProfile(s);if(!k)throw new Error("Target profile not found");let x=g.data;x.issuanceDate=new Date().toISOString(),x.issuer=i.id.did(),Array.isArray(x.credentialSubject)?x.credentialSubject=x.credentialSubject.map(Z=>({...Z,id:k.did})):x.credentialSubject.id=k.did,x?.type?.includes("BoostCredential")&&(x.boostId=l),typeof d=="object"&&d.overideFn&&(x=d.overideFn(x));let P=await i.invoke.issueCredential(x);if(typeof d=="object"&&!d.encrypt||!d)return n.boost.sendBoost.mutate({profileId:s,uri:l,credential:P});let D=await n.utilities.getDid.query(),_e=await i.invoke.getDIDObject().createDagJWE(P,[o.did,k.did,D]);return n.boost.sendBoost.mutate({profileId:s,uri:l,credential:_e})},registerSigningAuthority:async(i,s,l,d)=>{if(!o)throw new Error("Please make an account first!");return n.profile.registerSigningAuthority.mutate({endpoint:s,name:l,did:d})},getRegisteredSigningAuthorities:async(i,s,l,d)=>{if(!o)throw new Error("Please make an account first!");return n.profile.signingAuthorities.query()},getRegisteredSigningAuthority:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.profile.signingAuthority.query({endpoint:s,name:l})},generateClaimLink:async(i,s,l,d,f)=>{if(!o)throw new Error("Please make an account first!");return n.boost.generateClaimLink.mutate({boostUri:s,claimLinkSA:l,options:d,challenge:f})},claimBoostWithLink:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.boost.claimBoostWithLink.mutate({boostUri:s,challenge:l})},createContract:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.contracts.createConsentFlowContract.mutate(s)},getContract:async(i,s)=>n.contracts.getConsentFlowContract.query({uri:s}),getContracts:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.contracts.getConsentFlowContracts.query(s)},deleteContract:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.contracts.deleteConsentFlowContract.mutate({uri:s})},getConsentFlowData:async(i,s,l={})=>{if(!o)throw new Error("Please make an account first!");return n.contracts.getConsentedDataForContract.query({uri:s,...l})},getAllConsentFlowData:async(i,s={},l={})=>{if(!o)throw new Error("Please make an account first!");return n.contracts.getConsentedData.query({query:s,...l})},consentToContract:async(i,s,{terms:l,expiresAt:d,oneTime:f})=>{if(!o)throw new Error("Please make an account first!");return n.contracts.consentToContract.mutate({contractUri:s,terms:l,expiresAt:d,oneTime:f})},getConsentedContracts:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.contracts.getConsentedContracts.query(s)},updateContractTerms:async(i,s,{terms:l,expiresAt:d,oneTime:f})=>{if(!o)throw new Error("Please make an account first!");return n.contracts.updateConsentedContractTerms.mutate({uri:s,terms:l,expiresAt:d,oneTime:f})},withdrawConsent:async(i,s)=>{if(!o)throw new Error("Please make an account first!");return n.contracts.withdrawConsent.mutate({uri:s})},getConsentFlowTransactions:async(i,s,l)=>{if(!o)throw new Error("Please make an account first!");return n.contracts.getTermsTransactionHistory.query({uri:s,...l})},verifyConsent:async(i,s,l)=>n.contracts.verifyConsent.query({uri:s,profileId:l}),resolveFromLCN:async(i,s)=>{let l=await n.storage.resolve.query({uri:s});return be.or(Oe).or(ht).or(yt).or(gt).or(Ke).parseAsync(l)},getLCNClient:()=>n}}},"getLearnCardNetworkPlugin"),Xn=u(async(t,e)=>{let r=[{id:"LearnCard Network",url:"https://network.learncard.com",did:"did:web:network.learncard.com"}],n;if(e){let i=await fetch(e);i.status===200?n=JSON.parse(await i.text()):n=r}else n=r;let o=u(i=>{if(!!i)return typeof i=="string"?i:"id"in i&&typeof i.id=="string"?i.id:void 0},"getIssuerDID"),c=u(i=>{let s=o(i);if(!!s)return n.find(l=>l.did===s)},"getTrustedBoostVerifier");return{name:"VerifyBoost",displayName:"Verify Boost Extension",description:"Adds a check for validating Boost Credentials.",methods:{verifyCredential:async(i,s,l)=>{let d=await t.invoke.verifyCredential(s,l),f=s?.boostCredential;try{if(f){let g=await t.invoke.verifyCredential(f);if(!f?.boostId&&!s?.boostId&&d.warnings.push("Boost Authenticity could not be verified: Boost ID metadata is missing."),g.errors?.length>0)d.errors=[...g.errors||[],...d.errors||[],"Boost Credential could not be verified."];else if(f?.boostId!==s?.boostId)d.errors.push("Boost Authenticity could not be verified: Boost ID metadata is mismatched.");else{let k=c(s?.issuer);k?d.checks.push(`Boost is Authentic. Verified by ${k.id}.`):d.warnings.push(`Boost Authenticity could not be verified. Issuer is outside of trust network: ${o(s?.issuer)}`)}}}catch{d.errors.push("Boost authenticity could not be verified.")}return d}}}},"getVerifyBoostPlugin");
|
|
1
|
+
"use strict";var He=Object.defineProperty;var Fr=Object.getOwnPropertyDescriptor;var Wr=Object.getOwnPropertyNames;var Zr=Object.prototype.hasOwnProperty;var l=(t,e)=>He(t,"name",{value:e,configurable:!0});var Hr=(t,e)=>{for(var r in e)He(t,r,{get:e[r],enumerable:!0})},Jr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Wr(e))!Zr.call(t,a)&&a!==r&&He(t,a,{get:()=>e[a],enumerable:!(n=Fr(e,a))||n.enumerable});return t};var Kr=t=>Jr(He({},"__esModule",{value:!0}),t);var ys={};Hr(ys,{getLearnCardNetworkPlugin:()=>ms,getVerifyBoostPlugin:()=>hs});module.exports=Kr(ys);var Be=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,r){this.keyToValue.set(e,r),this.valueToKey.set(r,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}};l(Be,"DoubleIndexedKV");var ve=class{constructor(e){this.generateIdentifier=e,this.kv=new Be}register(e,r){this.kv.getByValue(e)||(r||(r=this.generateIdentifier(e)),this.kv.set(r,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}};l(ve,"Registry");var Le=class extends ve{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(e,r.allowProps),super.register(e,r.identifier)):super.register(e,r)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};l(Le,"ClassRegistry");function Qr(t){if("values"in Object)return Object.values(t);let e=[];for(let r in t)t.hasOwnProperty(r)&&e.push(t[r]);return e}l(Qr,"valuesOfObj");function Jt(t,e){let r=Qr(t);if("find"in r)return r.find(e);let n=r;for(let a=0;a<n.length;a++){let c=n[a];if(e(c))return c}}l(Jt,"find");function we(t,e){Object.entries(t).forEach(([r,n])=>e(n,r))}l(we,"forEach");function Oe(t,e){return t.indexOf(e)!==-1}l(Oe,"includes");function bt(t,e){for(let r=0;r<t.length;r++){let n=t[r];if(e(n))return n}}l(bt,"findArr");var qe=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Jt(this.transfomers,r=>r.isApplicable(e))}findByName(e){return this.transfomers[e]}};l(qe,"CustomTransformerRegistry");var Yr=l(t=>Object.prototype.toString.call(t).slice(8,-1),"getType"),vt=l(t=>typeof t>"u","isUndefined"),Gr=l(t=>t===null,"isNull"),_e=l(t=>typeof t!="object"||t===null||t===Object.prototype?!1:Object.getPrototypeOf(t)===null?!0:Object.getPrototypeOf(t)===Object.prototype,"isPlainObject"),Je=l(t=>_e(t)&&Object.keys(t).length===0,"isEmptyObject"),$=l(t=>Array.isArray(t),"isArray"),Xr=l(t=>typeof t=="string","isString"),en=l(t=>typeof t=="number"&&!isNaN(t),"isNumber"),tn=l(t=>typeof t=="boolean","isBoolean"),Kt=l(t=>t instanceof RegExp,"isRegExp"),re=l(t=>t instanceof Map,"isMap"),ne=l(t=>t instanceof Set,"isSet"),wt=l(t=>Yr(t)==="Symbol","isSymbol"),Qt=l(t=>t instanceof Date&&!isNaN(t.valueOf()),"isDate"),Yt=l(t=>t instanceof Error,"isError"),_t=l(t=>typeof t=="number"&&isNaN(t),"isNaNValue"),Gt=l(t=>tn(t)||Gr(t)||vt(t)||en(t)||Xr(t)||wt(t),"isPrimitive"),Xt=l(t=>typeof t=="bigint","isBigint"),er=l(t=>t===1/0||t===-1/0,"isInfinite"),tr=l(t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),"isTypedArray"),rr=l(t=>t instanceof URL,"isURL");var xt=l(t=>t.replace(/\./g,"\\."),"escapeKey"),Ke=l(t=>t.map(String).map(xt).join("."),"stringifyPath"),Ne=l(t=>{let e=[],r="";for(let a=0;a<t.length;a++){let c=t.charAt(a);if(c==="\\"&&t.charAt(a+1)==="."){r+=".",a++;continue}if(c==="."){e.push(r),r="";continue}r+=c}let n=r;return e.push(n),e},"parsePath");function W(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}l(W,"simpleTransformation");var nr=[W(vt,"undefined",()=>null,()=>{}),W(Xt,"bigint",t=>t.toString(),t=>typeof BigInt<"u"?BigInt(t):(console.error("Please add a BigInt polyfill."),t)),W(Qt,"Date",t=>t.toISOString(),t=>new Date(t)),W(Yt,"Error",(t,e)=>{let r={name:t.name,message:t.message};return e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r},(t,e)=>{let r=new Error(t.message);return r.name=t.name,r.stack=t.stack,e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r}),W(Kt,"regexp",t=>""+t,t=>{let e=t.slice(1,t.lastIndexOf("/")),r=t.slice(t.lastIndexOf("/")+1);return new RegExp(e,r)}),W(ne,"set",t=>[...t.values()],t=>new Set(t)),W(re,"map",t=>[...t.entries()],t=>new Map(t)),W(t=>_t(t)||er(t),"number",t=>_t(t)?"NaN":t>0?"Infinity":"-Infinity",Number),W(t=>t===0&&1/t===-1/0,"number",()=>"-0",Number),W(rr,"URL",t=>t.toString(),t=>new URL(t))];function Qe(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}l(Qe,"compositeTransformation");var ar=Qe((t,e)=>wt(t)?!!e.symbolRegistry.getIdentifier(t):!1,(t,e)=>{let r=e.symbolRegistry.getIdentifier(t);return["symbol",r]},t=>t.description,(t,e,r)=>{let n=r.symbolRegistry.getValue(e[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),rn=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((t,e)=>(t[e.name]=e,t),{}),sr=Qe(tr,t=>["typed-array",t.constructor.name],t=>[...t],(t,e)=>{let r=rn[e[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(t)});function Ct(t,e){return t?.constructor?!!e.classRegistry.getIdentifier(t.constructor):!1}l(Ct,"isInstanceOfRegisteredClass");var or=Qe(Ct,(t,e)=>{let r=e.classRegistry.getIdentifier(t.constructor);return["class",r]},(t,e)=>{let r=e.classRegistry.getAllowedProps(t.constructor);if(!r)return{...t};let n={};return r.forEach(a=>{n[a]=t[a]}),n},(t,e,r)=>{let n=r.classRegistry.getValue(e[1]);if(!n)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(n.prototype),t)}),ir=Qe((t,e)=>!!e.customTransformerRegistry.findApplicable(t),(t,e)=>{let r=e.customTransformerRegistry.findApplicable(t);return["custom",r.name]},(t,e)=>e.customTransformerRegistry.findApplicable(t).serialize(t),(t,e,r)=>{let n=r.customTransformerRegistry.findByName(e[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(t)}),nn=[or,ar,ir,sr],kt=l((t,e)=>{let r=bt(nn,a=>a.isApplicable(t,e));if(r)return{value:r.transform(t,e),type:r.annotation(t,e)};let n=bt(nr,a=>a.isApplicable(t,e));if(n)return{value:n.transform(t,e),type:n.annotation}},"transformValue"),cr={};nr.forEach(t=>{cr[t.annotation]=t});var lr=l((t,e,r)=>{if($(e))switch(e[0]){case"symbol":return ar.untransform(t,e,r);case"class":return or.untransform(t,e,r);case"custom":return ir.untransform(t,e,r);case"typed-array":return sr.untransform(t,e,r);default:throw new Error("Unknown transformation: "+e)}else{let n=cr[e];if(!n)throw new Error("Unknown transformation: "+e);return n.untransform(t,r)}},"untransformValue");var je=l((t,e)=>{let r=t.keys();for(;e>0;)r.next(),e--;return r.next().value},"getNthKey");function ur(t){if(Oe(t,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Oe(t,"prototype"))throw new Error("prototype is not allowed as a property");if(Oe(t,"constructor"))throw new Error("constructor is not allowed as a property")}l(ur,"validatePath");var dr=l((t,e)=>{ur(e);for(let r=0;r<e.length;r++){let n=e[r];if(ne(t))t=je(t,+n);else if(re(t)){let a=+n,c=+e[++r]==0?"key":"value",i=je(t,a);switch(c){case"key":t=i;break;case"value":t=t.get(i);break}}else t=t[n]}return t},"getDeep"),Ye=l((t,e,r)=>{if(ur(e),e.length===0)return r(t);let n=t;for(let c=0;c<e.length-1;c++){let i=e[c];if($(n)){let o=+i;n=n[o]}else if(_e(n))n=n[i];else if(ne(n)){let o=+i;n=je(n,o)}else if(re(n)){if(c===e.length-2)break;let u=+i,d=+e[++c]==0?"key":"value",f=je(n,u);switch(d){case"key":n=f;break;case"value":n=n.get(f);break}}}let a=e[e.length-1];if($(n)?n[+a]=r(n[+a]):_e(n)&&(n[a]=r(n[a])),ne(n)){let c=je(n,+a),i=r(c);c!==i&&(n.delete(c),n.add(i))}if(re(n)){let c=+e[e.length-2],i=je(n,c);switch(+a==0?"key":"value"){case"key":{let u=r(i);n.set(u,n.get(i)),u!==i&&n.delete(i);break}case"value":{n.set(i,r(n.get(i)));break}}}return t},"setDeep");function Et(t,e,r=[]){if(!t)return;if(!$(t)){we(t,(c,i)=>Et(c,e,[...r,...Ne(i)]));return}let[n,a]=t;a&&we(a,(c,i)=>{Et(c,e,[...r,...Ne(i)])}),e(n,r)}l(Et,"traverse");function fr(t,e,r){return Et(e,(n,a)=>{t=Ye(t,a,c=>lr(c,n,r))}),t}l(fr,"applyValueAnnotations");function pr(t,e){function r(n,a){let c=dr(t,Ne(a));n.map(Ne).forEach(i=>{t=Ye(t,i,()=>c)})}if(l(r,"apply"),$(e)){let[n,a]=e;n.forEach(c=>{t=Ye(t,Ne(c),()=>t)}),a&&we(a,r)}else we(e,r);return t}l(pr,"applyReferentialEqualityAnnotations");var an=l((t,e)=>_e(t)||$(t)||re(t)||ne(t)||Ct(t,e),"isDeep");function sn(t,e,r){let n=r.get(t);n?n.push(e):r.set(t,[e])}l(sn,"addIdentity");function mr(t,e){let r={},n;return t.forEach(a=>{if(a.length<=1)return;e||(a=a.map(o=>o.map(String)).sort((o,u)=>o.length-u.length));let[c,...i]=a;c.length===0?n=i.map(Ke):r[Ke(c)]=i.map(Ke)}),n?Je(r)?[n]:[n,r]:Je(r)?void 0:r}l(mr,"generateReferentialEqualityAnnotations");var Tt=l((t,e,r,n,a=[],c=[],i=new Map)=>{let o=Gt(t);if(!o){sn(t,a,e);let w=i.get(t);if(w)return n?{transformedValue:null}:w}if(!an(t,r)){let w=kt(t,r),T=w?{transformedValue:w.value,annotations:[w.type]}:{transformedValue:t};return o||i.set(t,T),T}if(Oe(c,t))return{transformedValue:null};let u=kt(t,r),d=u?.value??t,f=$(d)?[]:{},y={};we(d,(w,T)=>{if(T==="__proto__"||T==="constructor"||T==="prototype")throw new Error(`Detected property ${T}. This is a prototype pollution risk, please remove it from your object.`);let S=Tt(w,e,r,n,[...a,T],[...c,t],i);f[T]=S.transformedValue,$(S.annotations)?y[T]=S.annotations:_e(S.annotations)&&we(S.annotations,(te,z)=>{y[xt(T)+"."+z]=te})});let E=Je(y)?{transformedValue:f,annotations:u?[u.type]:void 0}:{transformedValue:f,annotations:u?[u.type,y]:y};return o||i.set(t,E),E},"walker");function Ge(t){return Object.prototype.toString.call(t).slice(8,-1)}l(Ge,"getType");function Pt(t){return Ge(t)==="Array"}l(Pt,"isArray");function hr(t){if(Ge(t)!=="Object")return!1;let e=Object.getPrototypeOf(t);return!!e&&e.constructor===Object&&e===Object.prototype}l(hr,"isPlainObject");function on(t){return Ge(t)==="Null"}l(on,"isNull");function cn(t,e,r,n,a){return c=>t(c)||e(c)||!!r&&r(c)||!!n&&n(c)||!!a&&a(c)}l(cn,"isOneOf");function ln(t){return Ge(t)==="Undefined"}l(ln,"isUndefined");var zs=cn(on,ln);function un(t,e,r,n,a){let c={}.propertyIsEnumerable.call(n,e)?"enumerable":"nonenumerable";c==="enumerable"&&(t[e]=r),a&&c==="nonenumerable"&&Object.defineProperty(t,e,{value:r,enumerable:!1,writable:!0,configurable:!0})}l(un,"assignProp");function Xe(t,e={}){if(Pt(t))return t.map(a=>Xe(a,e));if(!hr(t))return t;let r=Object.getOwnPropertyNames(t),n=Object.getOwnPropertySymbols(t);return[...r,...n].reduce((a,c)=>{if(Pt(e.props)&&!e.props.includes(c))return a;let i=t[c],o=Xe(i,e);return un(a,c,o,t,e.nonenumerable),a},{})}l(Xe,"copy");var _=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Le,this.symbolRegistry=new ve(r=>r.description??""),this.customTransformerRegistry=new qe,this.allowedErrorProps=[],this.dedupe=e}serialize(e){let r=new Map,n=Tt(e,r,this,this.dedupe),a={json:n.transformedValue};n.annotations&&(a.meta={...a.meta,values:n.annotations});let c=mr(r,this.dedupe);return c&&(a.meta={...a.meta,referentialEqualities:c}),a}deserialize(e){let{json:r,meta:n}=e,a=Xe(r);return n?.values&&(a=fr(a,n.values,this)),n?.referentialEqualities&&(a=pr(a,n.referentialEqualities)),a}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,r){this.classRegistry.register(e,r)}registerSymbol(e,r){this.symbolRegistry.register(e,r)}registerCustom(e,r){this.customTransformerRegistry.register({name:r,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};l(_,"SuperJSON");_.defaultInstance=new _;_.serialize=_.defaultInstance.serialize.bind(_.defaultInstance);_.deserialize=_.defaultInstance.deserialize.bind(_.defaultInstance);_.stringify=_.defaultInstance.stringify.bind(_.defaultInstance);_.parse=_.defaultInstance.parse.bind(_.defaultInstance);_.registerClass=_.defaultInstance.registerClass.bind(_.defaultInstance);_.registerSymbol=_.defaultInstance.registerSymbol.bind(_.defaultInstance);_.registerCustom=_.defaultInstance.registerCustom.bind(_.defaultInstance);_.allowErrorProps=_.defaultInstance.allowErrorProps.bind(_.defaultInstance);var Qs=_.serialize,Ys=_.deserialize,Gs=_.stringify,Xs=_.parse,eo=_.registerClass,to=_.registerCustom,ro=_.registerSymbol,no=_.allowErrorProps;function dn(t){return t}l(dn,"identity");function fn(t){return t.length===0?dn:t.length===1?t[0]:l(function(r){return t.reduce((n,a)=>a(n),r)},"piped")}l(fn,"pipeFromArray");function U(t){let e={subscribe(r){let n=null,a=!1,c=!1,i=!1;function o(){if(n===null){i=!0;return}c||(c=!0,typeof n=="function"?n():n&&n.unsubscribe())}return l(o,"unsubscribe"),n=t({next(u){a||r.next?.(u)},error(u){a||(a=!0,r.error?.(u),o())},complete(){a||(a=!0,r.complete?.(),o())}}),i&&o(),{unsubscribe:o}},pipe(...r){return fn(r)(e)}};return e}l(U,"observable");function yr(t){return e=>{let r=0,n=null,a=[];function c(){n||(n=e.subscribe({next(o){for(let u of a)u.next?.(o)},error(o){for(let u of a)u.error?.(o)},complete(){for(let o of a)o.complete?.()}}))}l(c,"startIfNeeded");function i(){if(r===0&&n){let o=n;n=null,o.unsubscribe()}}return l(i,"resetIfNeeded"),{subscribe(o){return r++,a.push(o),c(),{unsubscribe(){r--,i();let u=a.findIndex(d=>d===o);u>-1&&a.splice(u,1)}}}}}}l(yr,"share");var Ae=class extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,Ae.prototype)}};l(Ae,"ObservableAbortError");function gr(t){let e;return{promise:new Promise((n,a)=>{let c=!1;function i(){c||(c=!0,a(new Ae("This operation was aborted.")),o.unsubscribe())}l(i,"onDone");let o=t.subscribe({next(u){c=!0,n(u),i()},error(u){c=!0,a(u),i()},complete(){c=!0,i()}});e=i}),abort:e}}l(gr,"observableToPromise");function br(t){return U(e=>{function r(a=0,c=t.op){let i=t.links[a];if(!i)throw new Error("No more links to execute - did you forget to add an ending link?");return i({op:c,next(u){return r(a+1,u)}})}return l(r,"execute"),r().subscribe(e)})}l(br,"createChain");function Rt(t){let e=Object.create(null);for(let r in t){let n=t[r];e[n]=r}return e}l(Rt,"invert");var et={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099},fo=Rt(et);var ho=Rt(et);var vr=l(()=>{},"noop");function wr(t,e){return new Proxy(vr,{get(n,a){if(!(typeof a!="string"||a==="then"))return wr(t,[...e,a])},apply(n,a,c){let i=e[e.length-1]==="apply";return t({args:i?c.length>=2?c[1]:[]:c,path:i?e.slice(0,-1):e})}})}l(wr,"createInnerProxy");var St=l(t=>wr(t,[]),"createRecursiveProxy"),Ot=l(t=>new Proxy(vr,{get(e,r){if(!(typeof r!="string"||r==="then"))return t(r)}}),"createFlatProxy");function pn(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}l(pn,"isObject");var tt=class extends Error{};l(tt,"UnknownCauseError");function Nt(t){if(t instanceof Error)return t;let e=typeof t;if(!(e==="undefined"||e==="function"||t===null)){if(e!=="object")return new Error(String(t));if(pn(t)){let r=new tt;for(let n in t)r[n]=t[n];return r}}}l(Nt,"getCauseFromUnknown");function Me(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}l(Me,"isObject");function mn(t,e){if("error"in t){let n=e.transformer.deserialize(t.error);return{ok:!1,error:{...t,error:n}}}let r={...t.result,...(!t.result.type||t.result.type==="data")&&{type:"data",data:e.transformer.deserialize(t.result.data)}};return{ok:!0,result:r}}l(mn,"transformResultInner");var Ie=class extends Error{constructor(){super("Unable to transform response from server")}};l(Ie,"TransformResultError");function ze(t,e){let r;try{r=mn(t,e)}catch{throw new Ie}if(!r.ok&&(!Me(r.error.error)||typeof r.error.error.code!="number"))throw new Ie;if(r.ok&&!Me(r.result))throw new Ie;return r}l(ze,"transformResult");function hn(t){return t instanceof R||t instanceof Error&&t.name==="TRPCClientError"}l(hn,"isTRPCClientError");function yn(t){return Me(t)&&Me(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}l(yn,"isTRPCErrorResponse");var R=class extends Error{static from(e,r={}){let n=e;return hn(n)?(r.meta&&(n.meta={...n.meta,...r.meta}),n):yn(n)?new R(n.error.message,{...r,result:n}):n instanceof Error?new R(n.message,{...r,cause:Nt(n)}):new R("Unknown error",{...r,cause:n})}constructor(e,r){let n=r?.cause;super(e,{cause:n}),this.meta=r?.meta,this.cause=n,this.shape=r?.result?.error,this.data=r?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,R.prototype)}};l(R,"TRPCClientError");var _r=l(t=>typeof t=="function","isFunction");function xr(t){if(t)return t;if(typeof window<"u"&&_r(window.fetch))return window.fetch;if(typeof globalThis<"u"&&_r(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}l(xr,"getFetch");function gn(t){return t||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}l(gn,"getAbortController");function rt(t){return{url:t.url.toString().replace(/\/$/,""),fetch:t.fetch,AbortController:gn(t.AbortController)}}l(rt,"resolveHTTPLinkOptions");function bn(t){let e={};for(let r=0;r<t.length;r++){let n=t[r];e[r]=n}return e}l(bn,"arrayToDict");var vn={query:"GET",mutation:"POST"};function Cr(t){return"input"in t?t.runtime.transformer.serialize(t.input):bn(t.inputs.map(e=>t.runtime.transformer.serialize(e)))}l(Cr,"getInput");var $e=l(t=>{let e=t.url+"/"+t.path,r=[];if("inputs"in t&&r.push("batch=1"),t.type==="query"){let n=Cr(t);n!==void 0&&r.push(`input=${encodeURIComponent(JSON.stringify(n))}`)}return r.length&&(e+="?"+r.join("&")),e},"getUrl"),jt=l(t=>{if(t.type==="query")return;let e=Cr(t);return e!==void 0?JSON.stringify(e):void 0},"getBody"),nt=l(t=>It({...t,contentTypeHeader:"application/json",getUrl:$e,getBody:jt}),"jsonHttpRequester");async function At(t,e){let r=t.getUrl(t),n=t.getBody(t),{type:a}=t,c=await t.headers();if(a==="subscription")throw new Error("Subscriptions should use wsLink");let i={...t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{},...t.batchModeHeader?{"trpc-batch-mode":t.batchModeHeader}:{},...c};return xr(t.fetch)(r,{method:vn[a],signal:e?.signal,body:n,headers:i})}l(At,"fetchHTTPResponse");function It(t){let e=t.AbortController?new t.AbortController:null,r={},n=!1;return{promise:new Promise((i,o)=>{At(t,e).then(u=>(r.response=u,n=!0,u.json())).then(u=>{r.responseJSON=u,i({json:u,meta:r})}).catch(u=>{n=!0,o(R.from(u,{meta:r}))})}),cancel:l(()=>{n||e?.abort()},"cancel")}}l(It,"httpRequest");var Vt=l(()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")},"throwFatalError");function Dt(t){let e=null,r=null,n=l(()=>{clearTimeout(r),r=null,e=null},"destroyTimerAndPendingItems");function a(o){let u=[[]],d=0;for(;;){let f=o[d];if(!f)break;let y=u[u.length-1];if(f.aborted){f.reject?.(new Error("Aborted")),d++;continue}if(t.validate(y.concat(f).map(w=>w.key))){y.push(f),d++;continue}if(y.length===0){f.reject?.(new Error("Input is too big for a single dispatch")),d++;continue}u.push([])}return u}l(a,"groupItems");function c(){let o=a(e);n();for(let u of o){if(!u.length)continue;let d={items:u,cancel:Vt};for(let w of u)w.batch=d;let f=l((w,T)=>{let S=d.items[w];S.resolve?.(T),S.batch=null,S.reject=null,S.resolve=null},"unitResolver"),{promise:y,cancel:E}=t.fetch(d.items.map(w=>w.key),f);d.cancel=E,y.then(w=>{for(let T=0;T<w.length;T++){let S=w[T];f(T,S)}for(let T of d.items)T.reject?.(new Error("Missing result")),T.batch=null}).catch(w=>{for(let T of d.items)T.reject?.(w),T.batch=null})}}l(c,"dispatch");function i(o){let u={aborted:!1,key:o,batch:null,resolve:Vt,reject:Vt},d=new Promise((y,E)=>{u.reject=E,u.resolve=y,e||(e=[]),e.push(u)});return r||(r=setTimeout(c)),{promise:d,cancel:l(()=>{u.aborted=!0,u.batch?.items.every(y=>y.aborted)&&(u.batch.cancel(),u.batch=null)},"cancel")}}return l(i,"load"),{load:i}}l(Dt,"dataLoader");function Bt(t){return l(function(r){let n=rt(r),a=r.maxURLLength??1/0;return c=>{let i=l(y=>{let E=l(T=>{if(a===1/0)return!0;let S=T.map(be=>be.path).join(","),te=T.map(be=>be.input);return $e({...n,runtime:c,type:y,path:S,inputs:te}).length<=a},"validate"),w=t({...n,runtime:c,type:y,opts:r});return{validate:E,fetch:w}},"batchLoader"),o=Dt(i("query")),u=Dt(i("mutation")),d=Dt(i("subscription")),f={query:o,subscription:d,mutation:u};return({op:y})=>U(E=>{let w=f[y.type],{promise:T,cancel:S}=w.load(y),te;return T.then(z=>{te=z;let be=ze(z.json,c);if(!be.ok){E.error(R.from(be.error,{meta:z.meta}));return}E.next({context:z.meta,result:be.result}),E.complete()}).catch(z=>{E.error(R.from(z,{meta:te?.meta}))}),()=>{S()}})}},"httpBatchLink")}l(Bt,"createHTTPBatchLink");var wn=l(t=>e=>{let r=e.map(i=>i.path).join(","),n=e.map(i=>i.input),{promise:a,cancel:c}=nt({...t,path:r,inputs:n,headers(){return t.opts.headers?typeof t.opts.headers=="function"?t.opts.headers({opList:e}):t.opts.headers:{}}});return{promise:a.then(i=>(Array.isArray(i.json)?i.json:e.map(()=>i.json)).map(d=>({meta:i.meta,json:d}))),cancel:c}},"batchRequester"),at=Bt(wn);function st(t){return e=>{let r=rt(e);return n=>({op:a})=>U(c=>{let{path:i,input:o,type:u}=a,{promise:d,cancel:f}=t.requester({...r,runtime:n,type:u,path:i,input:o,headers(){return e.headers?typeof e.headers=="function"?e.headers({op:a}):e.headers:{}}}),y;return d.then(E=>{y=E.meta;let w=ze(E.json,n);if(!w.ok){c.error(R.from(w.error,{meta:y}));return}c.next({context:E.meta,result:w.result}),c.complete()}).catch(E=>{c.error(R.from(E,{meta:y}))}),()=>{f()}})}}l(st,"httpLinkFactory");var _n=st({requester:nt});var ot=class{$request({type:e,input:r,path:n,context:a={}}){return br({links:this.links,op:{id:++this.requestId,type:e,path:n,input:r,context:a}}).pipe(yr())}requestAsPromise(e){let r=this.$request(e),{promise:n,abort:a}=gr(r);return new Promise((i,o)=>{e.signal?.addEventListener("abort",a),n.then(u=>{i(u.result.data)}).catch(u=>{o(R.from(u))})})}query(e,r,n){return this.requestAsPromise({type:"query",path:e,input:r,context:n?.context,signal:n?.signal})}mutation(e,r,n){return this.requestAsPromise({type:"mutation",path:e,input:r,context:n?.context,signal:n?.signal})}subscription(e,r,n){return this.$request({type:"subscription",path:e,input:r,context:n?.context}).subscribe({next(c){c.result.type==="started"?n.onStarted?.():c.result.type==="stopped"?n.onStopped?.():n.onData?.(c.result.data)},error(c){n.onError?.(c)},complete(){n.onComplete?.()}})}constructor(e){this.requestId=0;let r=(()=>{let n=e.transformer;return n?"input"in n?e.transformer:{input:n,output:n}:{input:{serialize:a=>a,deserialize:a=>a},output:{serialize:a=>a,deserialize:a=>a}}})();this.runtime={transformer:{serialize:n=>r.input.serialize(n),deserialize:n=>r.output.deserialize(n)},combinedTransformer:r},this.links=e.links.map(n=>n(this.runtime))}};l(ot,"TRPCUntypedClient");var xn={query:"query",mutate:"mutation",subscribe:"subscription"},Cn=l(t=>xn[t],"clientCallTypeToProcedureType");function kn(t){return Ot(e=>t.hasOwnProperty(e)?t[e]:e==="__untypedClient"?t:St(({path:r,args:n})=>{let a=[e,...r],c=Cn(a.pop()),i=a.join(".");return t[c](i,...n)}))}l(kn,"createTRPCClientProxy");function Lt(t){let e=new ot(t);return kn(e)}l(Lt,"createTRPCProxyClient");function En(t){if(t)return t;if(typeof window<"u"&&window.TextDecoder)return new window.TextDecoder;if(typeof globalThis<"u"&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw new Error("No TextDecoder implementation found")}l(En,"getTextDecoder");async function Tn(t){let e=t.parse??JSON.parse,r=l(n=>{if(t.signal?.aborted||!n||n==="}")return;let a=n.indexOf(":"),c=n.substring(2,a-1),i=n.substring(a+1);t.onSingle(Number(c),e(i))},"onLine");await Pn(t.readableStream,r,t.textDecoder)}l(Tn,"parseJSONStream");async function Pn(t,e,r){let n="",a=l(c=>{let o=r.decode(c).split(`
|
|
2
|
+
`);if(o.length===1)n+=o[0];else if(o.length>1){e(n+o[0]);for(let u=1;u<o.length-1;u++)e(o[u]);n=o[o.length-1]}},"onChunk");"getReader"in t?await Sn(t,a):await Rn(t,a),e(n)}l(Pn,"readLines");function Rn(t,e){return new Promise(r=>{t.on("data",e),t.on("end",r)})}l(Rn,"readNodeChunks");async function Sn(t,e){let r=t.getReader(),n=await r.read();for(;!n.done;)e(n.value),n=await r.read()}l(Sn,"readStandardChunks");var On=l((t,e)=>{let r=t.AbortController?new t.AbortController:null,n=At({...t,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:$e,getBody:jt},r),a=l(()=>r?.abort(),"cancel"),c=n.then(async i=>{if(!i.body)throw new Error("Received response without body");let o={response:i};return Tn({readableStream:i.body,onSingle:e,parse:u=>({json:JSON.parse(u),meta:o}),signal:r?.signal,textDecoder:t.textDecoder})});return{cancel:a,promise:c}},"streamingJsonHttpRequester"),Nn=l(t=>{let e=En(t.opts.textDecoder);return(r,n)=>{let a=r.map(u=>u.path).join(","),c=r.map(u=>u.input),{cancel:i,promise:o}=On({...t,textDecoder:e,path:a,inputs:c,headers(){return t.opts.headers?typeof t.opts.headers=="function"?t.opts.headers({opList:r}):t.opts.headers:{}}},(u,d)=>{n(u,d)});return{promise:o.then(()=>[]),cancel:i}}},"streamRequester"),fi=Bt(Nn),jn=l(t=>{if("input"in t){if(!(t.input instanceof FormData))throw new Error("Input is not FormData");return t.input}},"getBody"),An=l(t=>{if(t.type!=="mutation")throw new Error("We only handle mutations with formdata");return It({...t,getUrl(){return`${t.url}/${t.path}`},getBody:jn})},"formDataRequester"),pi=st({requester:An});var In=Object.defineProperty,it=l((t,e)=>In(t,"name",{value:e,configurable:!0}),"__name"),Vn=it(t=>()=>({next:e,op:r})=>U(n=>{let a=null,c=0,i=!1,o=it(()=>{c+=1,a?.unsubscribe(),a=e(r).subscribe({error:async u=>{if(c>5||u.data?.httpStatus!==401)return n.error(u);await t(),o()},next:u=>n.next(u),complete:()=>{i&&n.complete()}})},"attempt");return o(),()=>{i=!0,a?.unsubscribe()}}),"callbackLink"),kr=it(async(t,e)=>{let r=[],n=Lt({transformer:_,links:[at({url:t,maxURLLength:2048,headers:{Authorization:`Bearer ${await e()}`}})]}),a=it(async(i=95+Math.round((Math.random()-.5)*5))=>n.utilities.getChallenges.query({amount:i}),"getChallenges");return r=await a(),Lt({transformer:_,links:[Vn(async()=>{r=await a()}),at({maxURLLength:2048,url:t,headers:async()=>(r.length===0&&r.push(...await a()),{Authorization:`Bearer ${await e(r.pop())}`})})]})},"getClient");var k;(function(t){t.assertEqual=a=>a;function e(a){}l(e,"assertIs"),t.assertIs=e;function r(a){throw new Error}l(r,"assertNever"),t.assertNever=r,t.arrayToEnum=a=>{let c={};for(let i of a)c[i]=i;return c},t.getValidEnumValues=a=>{let c=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(let o of c)i[o]=a[o];return t.objectValues(i)},t.objectValues=a=>t.objectKeys(a).map(function(c){return a[c]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let c=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&c.push(i);return c},t.find=(a,c)=>{for(let i of a)if(c(i))return i},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,c=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(c)}l(n,"joinValues"),t.joinValues=n,t.jsonStringifyReplacer=(a,c)=>typeof c=="bigint"?c.toString():c})(k||(k={}));var m=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ae=l(t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},"getParsedType"),p=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Dn=l(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),B=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(c){return c.message},n={_errors:[]},a=l(c=>{for(let i of c.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,u=0;for(;u<i.path.length;){let d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}},"processError");return a(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};l(B,"ZodError");B.create=t=>new B(t);var Fe=l((t,e)=>{let r;switch(t.code){case p.invalid_type:t.received===m.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case p.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,k.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:r=`Unrecognized key(s) in object: ${k.joinValues(t.keys,", ")}`;break;case p.invalid_union:r="Invalid input";break;case p.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${k.joinValues(t.options)}`;break;case p.invalid_enum_value:r=`Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;break;case p.invalid_arguments:r="Invalid function arguments";break;case p.invalid_return_type:r="Invalid function return type";break;case p.invalid_date:r="Invalid date";break;case p.invalid_string:typeof t.validation=="object"?"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:k.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case p.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(t.minimum)}`:r="Invalid input";break;case p.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(t.maximum)}`:r="Invalid input";break;case p.custom:r="Invalid input";break;case p.invalid_intersection_types:r="Intersection results could not be merged";break;case p.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case p.not_finite:r="Number must be finite";break;default:r=e.defaultError,k.assertNever(t)}return{message:r}},"errorMap"),Rr=Fe;function Bn(t){Rr=t}l(Bn,"setErrorMap");function lt(){return Rr}l(lt,"getErrorMap");var ut=l(t=>{let{data:e,path:r,errorMaps:n,issueData:a}=t,c=[...r,...a.path||[]],i={...a,path:c},o="",u=n.filter(d=>!!d).slice().reverse();for(let d of u)o=d(i,{data:e,defaultError:o}).message;return{...a,path:c,message:a.message||o}},"makeIssue"),Ln=[];function h(t,e){let r=ut({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,lt(),Fe].filter(n=>!!n)});t.common.issues.push(r)}l(h,"addIssueToContext");var O=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let a of r){if(a.status==="aborted")return b;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let a of r)n.push({key:await a.key,value:await a.value});return O.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let a of r){let{key:c,value:i}=a;if(c.status==="aborted"||i.status==="aborted")return b;c.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),(typeof i.value<"u"||a.alwaysSet)&&(n[c.value]=i.value)}return{status:e.value,value:n}}};l(O,"ParseStatus");var b=Object.freeze({status:"aborted"}),Sr=l(t=>({status:"dirty",value:t}),"DIRTY"),N=l(t=>({status:"valid",value:t}),"OK"),qt=l(t=>t.status==="aborted","isAborted"),Mt=l(t=>t.status==="dirty","isDirty"),dt=l(t=>t.status==="valid","isValid"),ft=l(t=>typeof Promise!==void 0&&t instanceof Promise,"isAsync"),C;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(C||(C={}));var I=class{constructor(e,r,n,a){this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._path.concat(this._key)}};l(I,"ParseInputLazyPath");var Er=l((t,e)=>{if(dt(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new B(t.common.issues);return{success:!1,error:r}}},"handleResult");function x(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:l((i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:r??o.defaultError},"customMap"),description:a}}l(x,"processCreateParams");var v=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return ae(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new O,ctx:{common:e.parent.common,data:e.data,parsedType:ae(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ft(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let a={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ae(e)},c=this._parseSync({data:e,path:a.path,parent:a});return Er(a,c)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ae(e)},a=this._parse({data:e,path:n.path,parent:n}),c=await(ft(a)?a:Promise.resolve(a));return Er(n,c)}refine(e,r){let n=l(a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r,"getIssueProperties");return this._refinement((a,c)=>{let i=e(a),o=l(()=>c.addIssue({code:p.custom,...n(a)}),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new A({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return D.create(this)}nullable(){return K.create(this)}nullish(){return this.optional().nullable()}array(){return j.create(this)}promise(){return X.create(this)}or(e){return le.create([this,e])}and(e){return ue.create(this,e)}transform(e){return new A({schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ye({innerType:this,defaultValue:r,typeName:g.ZodDefault})}brand(){return new Ue({typeName:g.ZodBranded,type:this,...x(void 0)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Te({innerType:this,defaultValue:r,typeName:g.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ge.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};l(v,"ZodType");var qn=/^c[^\s-]{8,}$/i,Mn=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,zn=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,$n=l(t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),L=class extends v{constructor(){super(...arguments),this._regex=(e,r,n)=>this.refinement(a=>e.test(a),{validation:r,code:p.invalid_string,...C.errToObj(n)}),this.nonempty=e=>this.min(1,C.errToObj(e)),this.trim=()=>new L({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let c=this._getOrReturnCtx(e);return h(c,{code:p.invalid_type,expected:m.string,received:c.parsedType}),b}let n=new O,a;for(let c of this._def.checks)if(c.kind==="min")e.data.length<c.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:p.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="max")e.data.length>c.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:p.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="length"){let i=e.data.length>c.value,o=e.data.length<c.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?h(a,{code:p.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):o&&h(a,{code:p.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),n.dirty())}else if(c.kind==="email")zn.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"email",code:p.invalid_string,message:c.message}),n.dirty());else if(c.kind==="uuid")Mn.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"uuid",code:p.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid")qn.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cuid",code:p.invalid_string,message:c.message}),n.dirty());else if(c.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),h(a,{validation:"url",code:p.invalid_string,message:c.message}),n.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"regex",code:p.invalid_string,message:c.message}),n.dirty())):c.kind==="trim"?e.data=e.data.trim():c.kind==="startsWith"?e.data.startsWith(c.value)||(a=this._getOrReturnCtx(e,a),h(a,{code:p.invalid_string,validation:{startsWith:c.value},message:c.message}),n.dirty()):c.kind==="endsWith"?e.data.endsWith(c.value)||(a=this._getOrReturnCtx(e,a),h(a,{code:p.invalid_string,validation:{endsWith:c.value},message:c.message}),n.dirty()):c.kind==="datetime"?$n(c).test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:p.invalid_string,validation:"datetime",message:c.message}),n.dirty()):k.assertNever(c);return{status:n.value,value:e.data}}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...C.errToObj(e)})}url(e){return this._addCheck({kind:"url",...C.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...C.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...C.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,...C.errToObj(e?.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...C.errToObj(r)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...C.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...C.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...C.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...C.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...C.errToObj(r)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};l(L,"ZodString");L.create=t=>{var e;return new L({checks:[],typeName:g.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...x(t)})};function Un(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,c=parseInt(t.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return c%i/Math.pow(10,a)}l(Un,"floatSafeRemainder");var F=class extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){let c=this._getOrReturnCtx(e);return h(c,{code:p.invalid_type,expected:m.number,received:c.parsedType}),b}let n,a=new O;for(let c of this._def.checks)c.kind==="int"?k.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:p.invalid_type,expected:"integer",received:"float",message:c.message}),a.dirty()):c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:p.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),a.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:p.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),a.dirty()):c.kind==="multipleOf"?Un(e.data,c.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:p.not_multiple_of,multipleOf:c.value,message:c.message}),a.dirty()):c.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:p.not_finite,message:c.message}),a.dirty()):k.assertNever(c);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,C.toString(r))}gt(e,r){return this.setLimit("min",e,!1,C.toString(r))}lte(e,r){return this.setLimit("max",e,!0,C.toString(r))}lt(e,r){return this.setLimit("max",e,!1,C.toString(r))}setLimit(e,r,n,a){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:C.toString(a)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:C.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:C.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};l(F,"ZodNumber");F.create=t=>new F({checks:[],typeName:g.ZodNumber,coerce:t?.coerce||!1,...x(t)});var se=class extends v{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.bigint,received:n.parsedType}),b}return N(e.data)}};l(se,"ZodBigInt");se.create=t=>{var e;return new se({typeName:g.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...x(t)})};var oe=class extends v{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==m.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.boolean,received:n.parsedType}),b}return N(e.data)}};l(oe,"ZodBoolean");oe.create=t=>new oe({typeName:g.ZodBoolean,coerce:t?.coerce||!1,...x(t)});var Z=class extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let c=this._getOrReturnCtx(e);return h(c,{code:p.invalid_type,expected:m.date,received:c.parsedType}),b}if(isNaN(e.data.getTime())){let c=this._getOrReturnCtx(e);return h(c,{code:p.invalid_date}),b}let n=new O,a;for(let c of this._def.checks)c.kind==="min"?e.data.getTime()<c.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:p.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),n.dirty()):c.kind==="max"?e.data.getTime()>c.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:p.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),n.dirty()):k.assertNever(c);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Z({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:C.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:C.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};l(Z,"ZodDate");Z.create=t=>new Z({checks:[],coerce:t?.coerce||!1,typeName:g.ZodDate,...x(t)});var xe=class extends v{_parse(e){if(this._getType(e)!==m.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.symbol,received:n.parsedType}),b}return N(e.data)}};l(xe,"ZodSymbol");xe.create=t=>new xe({typeName:g.ZodSymbol,...x(t)});var ie=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.undefined,received:n.parsedType}),b}return N(e.data)}};l(ie,"ZodUndefined");ie.create=t=>new ie({typeName:g.ZodUndefined,...x(t)});var ce=class extends v{_parse(e){if(this._getType(e)!==m.null){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.null,received:n.parsedType}),b}return N(e.data)}};l(ce,"ZodNull");ce.create=t=>new ce({typeName:g.ZodNull,...x(t)});var Y=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return N(e.data)}};l(Y,"ZodAny");Y.create=t=>new Y({typeName:g.ZodAny,...x(t)});var H=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return N(e.data)}};l(H,"ZodUnknown");H.create=t=>new H({typeName:g.ZodUnknown,...x(t)});var q=class extends v{_parse(e){let r=this._getOrReturnCtx(e);return h(r,{code:p.invalid_type,expected:m.never,received:r.parsedType}),b}};l(q,"ZodNever");q.create=t=>new q({typeName:g.ZodNever,...x(t)});var Ce=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.void,received:n.parsedType}),b}return N(e.data)}};l(Ce,"ZodVoid");Ce.create=t=>new Ce({typeName:g.ZodVoid,...x(t)});var j=class extends v{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==m.array)return h(r,{code:p.invalid_type,expected:m.array,received:r.parsedType}),b;if(a.exactLength!==null){let i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(h(r,{code:i?p.too_big:p.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(h(r,{code:p.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(h(r,{code:p.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((i,o)=>a.type._parseAsync(new I(r,i,r.path,o)))).then(i=>O.mergeArray(n,i));let c=r.data.map((i,o)=>a.type._parseSync(new I(r,i,r.path,o)));return O.mergeArray(n,c)}get element(){return this._def.type}min(e,r){return new j({...this._def,minLength:{value:e,message:C.toString(r)}})}max(e,r){return new j({...this._def,maxLength:{value:e,message:C.toString(r)}})}length(e,r){return new j({...this._def,exactLength:{value:e,message:C.toString(r)}})}nonempty(e){return this.min(1,e)}};l(j,"ZodArray");j.create=(t,e)=>new j({type:t,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...x(e)});var pt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(pt||(pt={}));var Tr=l(t=>e=>new P({...t,shape:()=>({...t.shape(),...e})}),"AugmentFactory");function Ve(t){if(t instanceof P){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=D.create(Ve(n))}return new P({...t._def,shape:()=>e})}else return t instanceof j?j.create(Ve(t.element)):t instanceof D?D.create(Ve(t.unwrap())):t instanceof K?K.create(Ve(t.unwrap())):t instanceof V?V.create(t.items.map(e=>Ve(e))):t}l(Ve,"deepPartialify");var P=class extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=Tr(this._def),this.extend=Tr(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=k.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==m.object){let d=this._getOrReturnCtx(e);return h(d,{code:p.invalid_type,expected:m.object,received:d.parsedType}),b}let{status:n,ctx:a}=this._processInputParams(e),{shape:c,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof q&&this._def.unknownKeys==="strip"))for(let d in a.data)i.includes(d)||o.push(d);let u=[];for(let d of i){let f=c[d],y=a.data[d];u.push({key:{status:"valid",value:d},value:f._parse(new I(a,y,a.path,d)),alwaysSet:d in a.data})}if(this._def.catchall instanceof q){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of o)u.push({key:{status:"valid",value:f},value:{status:"valid",value:a.data[f]}});else if(d==="strict")o.length>0&&(h(a,{code:p.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of o){let y=a.data[f];u.push({key:{status:"valid",value:f},value:d._parse(new I(a,y,a.path,f)),alwaysSet:f in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of u){let y=await f.key;d.push({key:y,value:await f.value,alwaysSet:f.alwaysSet})}return d}).then(d=>O.mergeObjectSync(n,d)):O.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return C.errToObj,new P({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var a,c,i,o;let u=(i=(c=(a=this._def).errorMap)===null||c===void 0?void 0:c.call(a,r,n).message)!==null&&i!==void 0?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=C.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new P({...this._def,unknownKeys:"strip"})}passthrough(){return new P({...this._def,unknownKeys:"passthrough"})}setKey(e,r){return this.augment({[e]:r})}merge(e){return new P({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>pt.mergeShapes(this._def.shape(),e._def.shape()),typeName:g.ZodObject})}catchall(e){return new P({...this._def,catchall:e})}pick(e){let r={};return k.objectKeys(e).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new P({...this._def,shape:()=>r})}omit(e){let r={};return k.objectKeys(this.shape).map(n=>{k.objectKeys(e).indexOf(n)===-1&&(r[n]=this.shape[n])}),new P({...this._def,shape:()=>r})}deepPartial(){return Ve(this)}partial(e){let r={};if(e)return k.objectKeys(this.shape).map(n=>{k.objectKeys(e).indexOf(n)===-1?r[n]=this.shape[n]:r[n]=this.shape[n].optional()}),new P({...this._def,shape:()=>r});for(let n in this.shape){let a=this.shape[n];r[n]=a.optional()}return new P({...this._def,shape:()=>r})}required(e){let r={};if(e)k.objectKeys(this.shape).map(n=>{if(k.objectKeys(e).indexOf(n)===-1)r[n]=this.shape[n];else{let c=this.shape[n];for(;c instanceof D;)c=c._def.innerType;r[n]=c}});else for(let n in this.shape){let c=this.shape[n];for(;c instanceof D;)c=c._def.innerType;r[n]=c}return new P({...this._def,shape:()=>r})}keyof(){return Or(k.objectKeys(this.shape))}};l(P,"ZodObject");P.create=(t,e)=>new P({shape:()=>t,unknownKeys:"strip",catchall:q.create(),typeName:g.ZodObject,...x(e)});P.strictCreate=(t,e)=>new P({shape:()=>t,unknownKeys:"strict",catchall:q.create(),typeName:g.ZodObject,...x(e)});P.lazycreate=(t,e)=>new P({shape:t,unknownKeys:"strip",catchall:q.create(),typeName:g.ZodObject,...x(e)});var le=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function a(c){for(let o of c)if(o.result.status==="valid")return o.result;for(let o of c)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=c.map(o=>new B(o.ctx.common.issues));return h(r,{code:p.invalid_union,unionErrors:i}),b}if(l(a,"handleResults"),r.common.async)return Promise.all(n.map(async c=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await c._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let c,i=[];for(let u of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=u._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!c&&(c={result:f,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(c)return r.common.issues.push(...c.ctx.common.issues),c.result;let o=i.map(u=>new B(u));return h(r,{code:p.invalid_union,unionErrors:o}),b}}get options(){return this._def.options}};l(le,"ZodUnion");le.create=(t,e)=>new le({options:t,typeName:g.ZodUnion,...x(e)});var ct=l(t=>t instanceof fe?ct(t.schema):t instanceof A?ct(t.innerType()):t instanceof pe?[t.value]:t instanceof me?t.options:t instanceof he?Object.keys(t.enum):t instanceof ye?ct(t._def.innerType):t instanceof ie?[void 0]:t instanceof ce?[null]:null,"getDiscriminator"),ke=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.object)return h(r,{code:p.invalid_type,expected:m.object,received:r.parsedType}),b;let n=this.discriminator,a=r.data[n],c=this.optionsMap.get(a);return c?r.common.async?c._parseAsync({data:r.data,path:r.path,parent:r}):c._parseSync({data:r.data,path:r.path,parent:r}):(h(r,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),b)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let a=new Map;for(let c of r){let i=ct(c.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,c)}}return new ke({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...x(n)})}};l(ke,"ZodDiscriminatedUnion");function zt(t,e){let r=ae(t),n=ae(e);if(t===e)return{valid:!0,data:t};if(r===m.object&&n===m.object){let a=k.objectKeys(e),c=k.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i={...t,...e};for(let o of c){let u=zt(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(r===m.array&&n===m.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let c=0;c<t.length;c++){let i=t[c],o=e[c],u=zt(i,o);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return r===m.date&&n===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}l(zt,"mergeValues");var ue=class extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=l((c,i)=>{if(qt(c)||qt(i))return b;let o=zt(c.value,i.value);return o.valid?((Mt(c)||Mt(i))&&r.dirty(),{status:r.value,value:o.data}):(h(n,{code:p.invalid_intersection_types}),b)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([c,i])=>a(c,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};l(ue,"ZodIntersection");ue.create=(t,e,r)=>new ue({left:t,right:e,typeName:g.ZodIntersection,...x(r)});var V=class extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:p.invalid_type,expected:m.array,received:n.parsedType}),b;if(n.data.length<this._def.items.length)return h(n,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let c=n.data.map((i,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new I(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(c).then(i=>O.mergeArray(r,i)):O.mergeArray(r,c)}get items(){return this._def.items}rest(e){return new V({...this._def,rest:e})}};l(V,"ZodTuple");V.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new V({items:t,typeName:g.ZodTuple,rest:null,...x(e)})};var de=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return h(n,{code:p.invalid_type,expected:m.object,received:n.parsedType}),b;let a=[],c=this._def.keyType,i=this._def.valueType;for(let o in n.data)a.push({key:c._parse(new I(n,o,n.path,o)),value:i._parse(new I(n,n.data[o],n.path,o))});return n.common.async?O.mergeObjectAsync(r,a):O.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof v?new de({keyType:e,valueType:r,typeName:g.ZodRecord,...x(n)}):new de({keyType:L.create(),valueType:e,typeName:g.ZodRecord,...x(r)})}};l(de,"ZodRecord");var Ee=class extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:p.invalid_type,expected:m.map,received:n.parsedType}),b;let a=this._def.keyType,c=this._def.valueType,i=[...n.data.entries()].map(([o,u],d)=>({key:a._parse(new I(n,o,n.path,[d,"key"])),value:c._parse(new I(n,u,n.path,[d,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of i){let d=await u.key,f=await u.value;if(d.status==="aborted"||f.status==="aborted")return b;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(d.value,f.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of i){let d=u.key,f=u.value;if(d.status==="aborted"||f.status==="aborted")return b;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(d.value,f.value)}return{status:r.value,value:o}}}};l(Ee,"ZodMap");Ee.create=(t,e,r)=>new Ee({valueType:e,keyType:t,typeName:g.ZodMap,...x(r)});var J=class extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:p.invalid_type,expected:m.set,received:n.parsedType}),b;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(h(n,{code:p.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(h(n,{code:p.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let c=this._def.valueType;function i(u){let d=new Set;for(let f of u){if(f.status==="aborted")return b;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}l(i,"finalizeSet");let o=[...n.data.values()].map((u,d)=>c._parse(new I(n,u,n.path,d)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,r){return new J({...this._def,minSize:{value:e,message:C.toString(r)}})}max(e,r){return new J({...this._def,maxSize:{value:e,message:C.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};l(J,"ZodSet");J.create=(t,e)=>new J({valueType:t,minSize:null,maxSize:null,typeName:g.ZodSet,...x(e)});var G=class extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.function)return h(r,{code:p.invalid_type,expected:m.function,received:r.parsedType}),b;function n(o,u){return ut({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,lt(),Fe].filter(d=>!!d),issueData:{code:p.invalid_arguments,argumentsError:u}})}l(n,"makeArgsIssue");function a(o,u){return ut({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,lt(),Fe].filter(d=>!!d),issueData:{code:p.invalid_return_type,returnTypeError:u}})}l(a,"makeReturnsIssue");let c={errorMap:r.common.contextualErrorMap},i=r.data;return this._def.returns instanceof X?N(async(...o)=>{let u=new B([]),d=await this._def.args.parseAsync(o,c).catch(E=>{throw u.addIssue(n(o,E)),u}),f=await i(...d);return await this._def.returns._def.type.parseAsync(f,c).catch(E=>{throw u.addIssue(a(f,E)),u})}):N((...o)=>{let u=this._def.args.safeParse(o,c);if(!u.success)throw new B([n(o,u.error)]);let d=i(...u.data),f=this._def.returns.safeParse(d,c);if(!f.success)throw new B([a(d,f.error)]);return f.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new G({...this._def,args:V.create(e).rest(H.create())})}returns(e){return new G({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new G({args:e||V.create([]).rest(H.create()),returns:r||H.create(),typeName:g.ZodFunction,...x(n)})}};l(G,"ZodFunction");var fe=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};l(fe,"ZodLazy");fe.create=(t,e)=>new fe({getter:t,typeName:g.ZodLazy,...x(e)});var pe=class extends v{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return h(r,{code:p.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:e.data}}get value(){return this._def.value}};l(pe,"ZodLiteral");pe.create=(t,e)=>new pe({value:t,typeName:g.ZodLiteral,...x(e)});function Or(t,e){return new me({values:t,typeName:g.ZodEnum,...x(e)})}l(Or,"createZodEnum");var me=class extends v{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return h(r,{expected:k.joinValues(n),received:r.parsedType,code:p.invalid_type}),b}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return h(r,{received:r.data,code:p.invalid_enum_value,options:n}),b}return N(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}};l(me,"ZodEnum");me.create=Or;var he=class extends v{_parse(e){let r=k.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){let a=k.objectValues(r);return h(n,{expected:k.joinValues(a),received:n.parsedType,code:p.invalid_type}),b}if(r.indexOf(e.data)===-1){let a=k.objectValues(r);return h(n,{received:n.data,code:p.invalid_enum_value,options:a}),b}return N(e.data)}get enum(){return this._def.values}};l(he,"ZodNativeEnum");he.create=(t,e)=>new he({values:t,typeName:g.ZodNativeEnum,...x(e)});var X=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.promise&&r.common.async===!1)return h(r,{code:p.invalid_type,expected:m.promise,received:r.parsedType}),b;let n=r.parsedType===m.promise?r.data:Promise.resolve(r.data);return N(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}};l(X,"ZodPromise");X.create=(t,e)=>new X({type:t,typeName:g.ZodPromise,...x(e)});var A=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null;if(a.type==="preprocess"){let i=a.transform(n.data);return n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}let c={addIssue:i=>{h(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(c.addIssue=c.addIssue.bind(c),a.type==="refinement"){let i=l(o=>{let u=a.refinement(o,c);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o},"executeRefinement");if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?b:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?b:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!dt(i))return i;let o=a.transform(i.value,c);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>dt(i)?Promise.resolve(a.transform(i.value,c)).then(o=>({status:r.value,value:o})):i);k.assertNever(a)}};l(A,"ZodEffects");A.create=(t,e,r)=>new A({schema:t,typeName:g.ZodEffects,effect:e,...x(r)});A.createWithPreprocess=(t,e,r)=>new A({schema:e,effect:{type:"preprocess",transform:t},typeName:g.ZodEffects,...x(r)});var D=class extends v{_parse(e){return this._getType(e)===m.undefined?N(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};l(D,"ZodOptional");D.create=(t,e)=>new D({innerType:t,typeName:g.ZodOptional,...x(e)});var K=class extends v{_parse(e){return this._getType(e)===m.null?N(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};l(K,"ZodNullable");K.create=(t,e)=>new K({innerType:t,typeName:g.ZodNullable,...x(e)});var ye=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};l(ye,"ZodDefault");ye.create=(t,e)=>new ye({innerType:t,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});var Te=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.innerType._parse({data:r.data,path:r.path,parent:r});return ft(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};l(Te,"ZodCatch");Te.create=(t,e)=>new Te({innerType:t,typeName:g.ZodCatch,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});var Pe=class extends v{_parse(e){if(this._getType(e)!==m.nan){let n=this._getOrReturnCtx(e);return h(n,{code:p.invalid_type,expected:m.nan,received:n.parsedType}),b}return{status:"valid",value:e.data}}};l(Pe,"ZodNaN");Pe.create=t=>new Pe({typeName:g.ZodNaN,...x(t)});var Fn=Symbol("zod_brand"),Ue=class extends v{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};l(Ue,"ZodBranded");var ge=class extends v{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return l(async()=>{let c=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?b:c.status==="dirty"?(r.dirty(),Sr(c.value)):this._def.out._parseAsync({data:c.value,path:n.path,parent:n})},"handleAsync")();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?b:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new ge({in:e,out:r,typeName:g.ZodPipeline})}};l(ge,"ZodPipeline");var Nr=l((t,e={},r)=>t?Y.create().superRefine((n,a)=>{if(!t(n)){let c=typeof e=="function"?e(n):e,i=typeof c=="string"?{message:c}:c;a.addIssue({code:"custom",...i,fatal:r})}}):Y.create(),"custom"),Wn={object:P.lazycreate},g;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(g||(g={}));var Zn=l((t,e={message:`Input not instance of ${t.name}`})=>Nr(r=>r instanceof t,e,!0),"instanceOfType"),jr=L.create,Ar=F.create,Hn=Pe.create,Jn=se.create,Ir=oe.create,Kn=Z.create,Qn=xe.create,Yn=ie.create,Gn=ce.create,Xn=Y.create,ea=H.create,ta=q.create,ra=Ce.create,na=j.create,aa=P.create,sa=P.strictCreate,oa=le.create,ia=ke.create,ca=ue.create,la=V.create,ua=de.create,da=Ee.create,fa=J.create,pa=G.create,ma=fe.create,ha=pe.create,ya=me.create,ga=he.create,ba=X.create,Pr=A.create,va=D.create,wa=K.create,_a=A.createWithPreprocess,xa=ge.create,Ca=l(()=>jr().optional(),"ostring"),ka=l(()=>Ar().optional(),"onumber"),Ea=l(()=>Ir().optional(),"oboolean"),Ta={string:t=>L.create({...t,coerce:!0}),number:t=>F.create({...t,coerce:!0}),boolean:t=>oe.create({...t,coerce:!0}),bigint:t=>se.create({...t,coerce:!0}),date:t=>Z.create({...t,coerce:!0})},Pa=b,s=Object.freeze({__proto__:null,defaultErrorMap:Fe,setErrorMap:Bn,getErrorMap:lt,makeIssue:ut,EMPTY_PATH:Ln,addIssueToContext:h,ParseStatus:O,INVALID:b,DIRTY:Sr,OK:N,isAborted:qt,isDirty:Mt,isValid:dt,isAsync:ft,get util(){return k},ZodParsedType:m,getParsedType:ae,ZodType:v,ZodString:L,ZodNumber:F,ZodBigInt:se,ZodBoolean:oe,ZodDate:Z,ZodSymbol:xe,ZodUndefined:ie,ZodNull:ce,ZodAny:Y,ZodUnknown:H,ZodNever:q,ZodVoid:Ce,ZodArray:j,get objectUtil(){return pt},ZodObject:P,ZodUnion:le,ZodDiscriminatedUnion:ke,ZodIntersection:ue,ZodTuple:V,ZodRecord:de,ZodMap:Ee,ZodSet:J,ZodFunction:G,ZodLazy:fe,ZodLiteral:pe,ZodEnum:me,ZodNativeEnum:he,ZodPromise:X,ZodEffects:A,ZodTransformer:A,ZodOptional:D,ZodNullable:K,ZodDefault:ye,ZodCatch:Te,ZodNaN:Pe,BRAND:Fn,ZodBranded:Ue,ZodPipeline:ge,custom:Nr,Schema:v,ZodSchema:v,late:Wn,get ZodFirstPartyTypeKind(){return g},coerce:Ta,any:Xn,array:na,bigint:Jn,boolean:Ir,date:Kn,discriminatedUnion:ia,effect:Pr,enum:ya,function:pa,instanceof:Zn,intersection:ca,lazy:ma,literal:ha,map:da,nan:Hn,nativeEnum:ga,never:ta,null:Gn,nullable:wa,number:Ar,object:aa,oboolean:Ea,onumber:ka,optional:va,ostring:Ca,pipeline:xa,preprocess:_a,promise:ba,record:ua,set:fa,strictObject:sa,string:jr,symbol:Qn,transformer:Pr,tuple:la,undefined:Yn,union:oa,unknown:ea,void:ra,NEVER:Pa,ZodIssueCode:p,quotelessJson:Dn,ZodError:B});var Ra=Object.defineProperty,Sa=l((t,e)=>Ra(t,"name",{value:e,configurable:!0}),"__name"),mt=s.array(s.string().or(s.record(s.any()))),Ri=s.object({type:s.string().optional(),narrative:s.string().optional()}),ht=s.string().or(s.object({id:s.string(),type:s.string(),caption:s.string().optional()})),Oa=s.object({type:s.string().min(1).or(s.string().array().nonempty()),latitude:s.number(),longitude:s.number()}),Na=s.object({type:s.string().min(1).or(s.string().array().nonempty()),addressCountry:s.string().optional(),addressCountryCode:s.string().optional(),addressRegion:s.string().optional(),addressLocality:s.string().optional(),streetAddress:s.string().optional(),postOfficeBoxNumber:s.string().optional(),postalCode:s.string().optional(),geo:Oa.optional()}),ja=s.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(s.string()),Br=s.object({type:s.string().min(1).or(s.string().array().nonempty()),identifier:s.string(),identifierType:ja}),We=s.string().or(s.object({id:s.string().optional(),type:s.string().or(s.string().array().nonempty().optional()),name:s.string().optional(),url:s.string().optional(),phone:s.string().optional(),description:s.string().optional(),endorsement:s.any().array().optional(),image:ht.optional(),email:s.string().email().optional(),address:Na.optional(),otherIdentifier:Br.array().optional(),official:s.string().optional(),parentOrg:s.any().optional(),familyName:s.string().optional(),givenName:s.string().optional(),additionalName:s.string().optional(),patronymicName:s.string().optional(),honorificPrefix:s.string().optional(),honorificSuffix:s.string().optional(),familyNamePrefix:s.string().optional(),dateOfBirth:s.string().optional()}).catchall(s.any())),$t=s.object({id:s.string().optional()}).catchall(s.any()),Aa=s.object({type:s.string(),id:s.string()}).catchall(s.any()),Ia=s.object({id:s.string(),type:s.string()}).catchall(s.any()),Va=s.object({id:s.string(),type:s.string()}).catchall(s.any()),Se=s.object({"@context":mt,id:s.string().optional(),type:s.string().array().nonempty(),issuer:We,issuanceDate:s.string(),expirationDate:s.string().optional(),credentialSubject:$t.or($t.array()),credentialStatus:Aa.optional(),credentialSchema:Ia.array().optional(),refreshService:Va.optional()}).catchall(s.any()),Q=s.object({type:s.string(),created:s.string(),challenge:s.string().optional(),domain:s.string().optional(),nonce:s.string().optional(),proofPurpose:s.string(),verificationMethod:s.string(),jws:s.string().optional()}).catchall(s.any()),Ze=Se.extend({proof:Q.or(Q.array())}),Da=s.object({"@context":mt,id:s.string().optional(),type:s.string().or(s.string().array().nonempty()),verifiableCredential:Ze.or(Ze.array()).optional(),holder:s.string().optional()}).catchall(s.any()),Wt=Da.extend({proof:Q.or(Q.array())}),Lr=s.object({kty:s.string(),crv:s.string(),x:s.string(),y:s.string().optional(),n:s.string().optional(),d:s.string()}),Ba=s.object({alg:s.string(),iv:s.string(),tag:s.string(),epk:Lr.partial().optional(),kid:s.string().optional(),apv:s.string().optional(),apu:s.string().optional()}),La=s.object({header:Ba,encrypted_key:s.string()}),Zt=s.object({protected:s.string(),iv:s.string(),ciphertext:s.string(),tag:s.string(),aad:s.string().optional(),recipients:La.array().optional()}),Re=s.string().or(s.object({"@context":mt.optional(),id:s.string(),type:s.string(),controller:s.string(),publicKeyJwk:Lr.optional(),publicKeyBase58:s.string().optional(),blockChainAccountId:s.string().optional()}).catchall(s.any())),qa=s.object({id:s.string(),type:s.string().or(s.string().array().nonempty()),serviceEndpoint:s.any().or(s.any().array().nonempty())}).catchall(s.any()),Ni=s.object({"@context":mt,id:s.string(),alsoKnownAs:s.string().optional(),controller:s.string().or(s.string().array().nonempty()).optional(),verificationMethod:Re.array().optional(),authentication:Re.array().optional(),assertionMethod:Re.array().optional(),keyAgreement:Re.array().optional(),capabilityInvocation:Re.array().optional(),capabilityDelegation:Re.array().optional(),publicKey:Re.array().optional(),service:qa.array().optional(),proof:Q.or(Q.array()).optional()}).catchall(s.any()),Ma=s.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(s.string()),yt=s.object({type:s.string().array().nonempty(),targetCode:s.string().optional(),targetDescription:s.string().optional(),targetName:s.string(),targetFramework:s.string().optional(),targetType:Ma.optional(),targetUrl:s.string()}),za=s.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),$a=za.or(s.string()),Ua=s.object({id:s.string().optional(),narrative:s.string().optional()}).catchall(s.any()),Fa=s.object({id:s.string(),type:s.string().array().nonempty(),endorsementComment:s.string().optional()}),Wa=Se.extend({credentialSubject:Fa,proof:Q.or(Q.array()).optional()}),Za=s.object({id:s.string(),"@language":s.string().optional(),version:s.string().optional()}),Ha=s.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(s.string()),Ja=s.object({id:s.string(),type:s.string().array().nonempty(),alignment:yt.array().optional(),description:s.string().optional(),level:s.string().optional(),name:s.string(),points:s.string().optional()}).catchall(s.any()),Ka=s.object({id:s.string(),type:s.string().array().nonempty(),alignment:yt.array().optional(),allowedValue:s.string().array().optional(),name:s.string(),requiredLevel:s.string().optional(),requiredValue:s.string().optional(),resultType:Ha,rubricCriterionLevel:Ja.array().optional(),valueMax:s.string().optional(),valueMin:s.string().optional()}).catchall(s.any()),Qa=s.object({id:s.string().optional(),type:s.string().array().nonempty(),alignment:yt.array().optional(),achievementType:$a.optional(),creator:We.optional(),creditsAvailable:s.number().optional(),criteria:Ua,description:s.string(),endorsement:Wa.array().optional(),fieldOfStudy:s.string().optional(),humanCode:s.string().optional(),image:ht.optional(),"@language":s.string().optional(),name:s.string(),otherIdentifier:Br.array().optional(),related:Za.array().optional(),resultDescription:Ka.array().optional(),specialization:s.string().optional(),tag:s.string().array().optional(),version:s.string().optional()}).catchall(s.any()),Ya=s.object({type:s.string(),hashed:s.boolean(),identityHash:s.string(),identityType:s.string(),salt:s.string().optional()}),Ga=s.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),Xa=s.object({type:s.string().array().nonempty(),achievedLevel:s.string().optional(),alignment:yt.array().optional(),resultDescription:s.string().optional(),status:Ga.optional(),value:s.string().optional()}).catchall(s.any()),Vr=s.object({id:s.string().optional(),type:s.string().array().nonempty(),activityEndDate:s.string().optional(),activityStartDate:s.string().optional(),creditsEarned:s.number().optional(),achievement:Qa.optional(),identifier:Ya.array().optional(),image:ht.optional(),licenseNumber:s.string().optional(),narrative:s.string().optional(),result:Xa.array().optional(),role:s.string().optional(),source:We.optional(),term:s.string().optional()}).catchall(s.any()),es=s.object({id:s.string().optional(),type:s.string().array().nonempty(),narrative:s.string().optional(),name:s.string().optional(),description:s.string().optional(),genre:s.string().optional(),audience:s.string().optional()}).catchall(s.any()),ts=Se.extend({name:s.string().optional(),description:s.string().optional(),image:ht.optional(),credentialSubject:Vr.or(Vr.array()),endorsement:Se.array().optional(),evidence:es.array().optional()}),Ai=ts.extend({proof:Q.or(Q.array())}),Vi=s.object({checks:s.string().array(),warnings:s.string().array(),errors:s.string().array()}),qr=s.enum(["Success","Failed","Error"]),Di=qr.enum,Bi=s.object({check:s.string(),status:qr,message:s.string().optional(),details:s.string().optional()}),Li=s.object({title:s.string().optional(),createdAt:s.string().optional(),issuer:We.optional(),issuee:We.optional(),credentialSubject:$t.optional()}),qi=s.object({id:s.string(),uri:s.string()}).catchall(s.any()),$i=s.object({limit:s.number(),cursor:s.string().optional(),sort:s.string().optional()}),ee=s.object({cursor:s.string().optional(),hasMore:s.boolean()}),Mr=s.object({encryptedRecord:Zt,fields:s.string().array()}).catchall(s.any()),Ui=ee.extend({records:Mr.array()}),rs=Mr.extend({id:s.string()}),Fi=ee.extend({records:rs.array()}),Dr=Sa(t=>{let e=t.match(/^\/(.*)\/([gimsuy]*)$/);if(!e)throw new Error("Invalid RegExp string format");return{pattern:e[1],flags:e[2]}},"parseRegexString"),ns=s.instanceof(RegExp).or(s.string().refine(t=>{try{return Dr(t),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(t=>{let{pattern:e,flags:r}=Dr(t);try{return new RegExp(e,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),M=s.string().or(s.object({$in:s.string().array()})).or(s.object({$regex:ns})),De=s.object({profileId:s.string().min(3).max(40),displayName:s.string().default(""),shortBio:s.string().default(""),bio:s.string().default(""),did:s.string(),email:s.string().optional(),image:s.string().optional(),heroImage:s.string().optional(),websiteLink:s.string().optional(),isServiceProfile:s.boolean().default(!1).optional(),type:s.string().optional(),notificationsWebhook:s.string().url().startsWith("http").optional()}),Hi=s.object({profileId:M,displayName:M,shortBio:M,bio:M,email:M,websiteLink:M,isServiceProfile:s.boolean(),type:M}).partial(),Ji=ee.extend({records:De.array()}),Ki=s.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Qi=s.object({uri:s.string(),to:s.string(),from:s.string(),sent:s.string().datetime(),received:s.string().datetime().optional()}),as=s.object({role:s.string(),canEdit:s.boolean(),canIssue:s.boolean(),canRevoke:s.boolean(),canManagePermissions:s.boolean(),canIssueChildren:s.string(),canCreateChildren:s.string(),canEditChildren:s.string(),canRevokeChildren:s.string(),canManageChildrenPermissions:s.string(),canViewAnalytics:s.boolean()}),Ut=s.enum(["DRAFT","LIVE"]),ss=s.object({uri:s.string(),name:s.string().optional(),type:s.string().optional(),category:s.string().optional(),status:Ut.optional(),autoConnectRecipients:s.boolean().optional(),meta:s.record(s.any()).optional(),claimPermissions:as.optional()}),Yi=s.object({uri:M,name:M,type:M,category:M,meta:s.record(M),status:Ut.or(s.object({$in:Ut.array()})),autoConnectRecipients:s.boolean()}).partial(),Gi=ee.extend({records:ss.array()}),os=s.object({to:De,from:s.string(),received:s.string().optional()}),Xi=ee.extend({records:os.array()}),ec=s.object({endpoint:s.string(),name:s.string(),did:s.string().optional()}),tc=s.object({ttlSeconds:s.number().optional(),totalUses:s.number().optional()}),is=s.object({endpoint:s.string()}),rc=s.object({signingAuthority:is,relationship:s.object({name:s.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:s.string()})}),cs=s.enum(["live","stale","withdrawn"]),Ht=s.object({read:s.object({anonymize:s.boolean().optional(),credentials:s.object({categories:s.record(s.object({required:s.boolean()})).default({})}).default({}),personal:s.record(s.object({required:s.boolean()})).default({})}).default({}),write:s.object({credentials:s.object({categories:s.record(s.object({required:s.boolean()})).default({})}).default({}),personal:s.record(s.object({required:s.boolean()})).default({})}).default({})}),zr=s.object({contract:Ht,owner:De,name:s.string(),subtitle:s.string().optional(),description:s.string().optional(),reasonForAccessing:s.string().optional(),image:s.string().optional(),uri:s.string(),createdAt:s.string(),updatedAt:s.string(),expiresAt:s.string().optional()}),nc=ee.extend({records:zr.omit({owner:!0}).array()}),ls=s.object({credentials:s.object({categories:s.record(s.string().array()).default({})}),personal:s.record(s.string()).default({}),date:s.string()}),ac=ee.extend({records:ls.array()}),$r=s.object({sharing:s.boolean().optional(),shared:s.string().array().optional(),shareAll:s.boolean().optional(),shareUntil:s.string().optional()}),gt=s.object({read:s.object({anonymize:s.boolean().optional(),credentials:s.object({shareAll:s.boolean().optional(),sharing:s.boolean().optional(),categories:s.record($r).default({})}).default({}),personal:s.record(s.string()).default({})}).default({}),write:s.object({credentials:s.object({categories:s.record(s.boolean()).default({})}).default({}),personal:s.record(s.boolean()).default({})}).default({})}),sc=ee.extend({records:s.object({expiresAt:s.string().optional(),oneTime:s.boolean().optional(),terms:gt,contract:zr,uri:s.string(),consenter:De,status:cs}).array()}),oc=s.object({read:s.object({anonymize:s.boolean().optional(),credentials:s.object({categories:s.record(s.object({required:s.boolean().optional()})).optional()}).optional(),personal:s.record(s.object({required:s.boolean().optional()})).optional()}).optional(),write:s.object({credentials:s.object({categories:s.record(s.object({required:s.boolean().optional()})).optional()}).optional(),personal:s.record(s.object({required:s.boolean().optional()})).optional()}).optional()}),ic=s.object({anonymize:s.boolean().optional(),credentials:s.object({categories:s.record(s.boolean()).optional()}).optional(),personal:s.record(s.boolean()).optional()}),us=s.object({read:s.object({anonymize:s.boolean().optional(),credentials:s.object({shareAll:s.boolean().optional(),sharing:s.boolean().optional(),categories:s.record($r.optional()).optional()}).optional(),personal:s.record(s.string()).optional()}).optional(),write:s.object({credentials:s.object({categories:s.record(s.boolean()).optional()}).optional(),personal:s.record(s.boolean()).optional()}).optional()}),Ft=s.enum(["consent","update","sync","withdraw"]),cc=s.object({terms:us.optional(),action:Ft.or(Ft.array()).optional(),date:s.object({$gt:s.string()}).or(s.object({$lt:s.string()})).or(s.object({$eq:s.string()})).optional(),expiresAt:s.object({$gt:s.string()}).or(s.object({$lt:s.string()})).or(s.object({$eq:s.string()})).optional(),oneTime:s.boolean().optional()}),Ur=s.object({expiresAt:s.string().optional(),oneTime:s.boolean().optional(),terms:gt.optional(),id:s.string(),action:Ft,date:s.string()}),lc=ee.extend({records:Ur.array()}),ds=s.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),fs=s.object({title:s.string().optional(),body:s.string().optional()}),ps=s.object({vcUris:s.array(s.string()).optional(),vpUris:s.array(s.string()).optional(),transaction:Ur.optional()}),uc=s.object({type:ds,to:De.partial().and(s.object({did:s.string()})),from:De.partial().and(s.object({did:s.string()})),message:fs.optional(),data:ps.optional(),sent:s.string().datetime().optional()});var ms=l(async(t,e)=>{let r=t.id.did();t?.debug?.("Adding LearnCardNetwork Plugin");let n=await kr(e,async i=>{let o=await t.invoke.getDidAuthVp({proofFormat:"jwt",challenge:i});if(typeof o!="string")throw new Error("Error getting DID-Auth-JWT!");return o}),a;try{a=await n.profile.getProfile.query()}catch(i){t.debug?.("No profile!",i)}let c=a?.did||r;return{name:"LearnCard Network",displayName:"LearnCard Network",description:"LearnCard Network Integration",id:{did:(i,o)=>!o||o==="web"?c:t.id.did(o),keypair:(i,o)=>t.id.keypair(o)},read:{get:async(i,o)=>{if(i.debug?.("learnCard.read['LearnCard Network'].get"),!o)return;let u=o.split(":");if(u.length!==5)return;let[d,f]=u;if(!(d!=="lc"||f!=="network"))try{let y=await n.storage.resolve.query({uri:o});return"ciphertext"in y&&(y=await i.invoke.getDIDObject().decryptDagJWE(y)),await Ze.or(Wt).parseAsync(y)}catch(y){i.debug?.(y);return}}},store:{upload:async(i,o)=>(i.debug?.("learnCard.store['LearnCard Network'].upload"),n.storage.store.mutate({item:o})),uploadEncrypted:async(i,o,{recipients:u=[]}={recipients:[]})=>{i.debug?.("learnCard.store['LearnCard Network'].upload");let d=await i.invoke.getDIDObject().createDagJWE(o,[i.id.did(),...u]);return n.storage.store.mutate({item:d})}},methods:{createProfile:async(i,o)=>{if(a)throw new Error("Account already exists!");let u=await n.profile.createProfile.mutate(o);return a=await n.profile.getProfile.query(),c=u,u},createServiceProfile:async(i,o)=>{if(a)throw new Error("Account already exists!");let u=await n.profile.createServiceProfile.mutate(o);return a=await n.profile.getProfile.query(),c=u,u},createManagedServiceProfile:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return await n.profile.createManagedServiceProfile.mutate(o)},getManagedServiceProfiles:async(i,o={})=>{if(!a)throw new Error("Please make an account first!");return n.profile.getManagedServiceProfiles.query(o)},updateProfile:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return await n.profile.updateProfile.mutate(o)?(a=await n.profile.getProfile.query(),!0):!1},deleteProfile:async()=>{if(!a)throw new Error("Account does not exist!");return await n.profile.deleteProfile.mutate()?(a=void 0,!0):!1},getProfile:async(i,o)=>o?n.profile.getOtherProfile.query({profileId:o}):n.profile.getProfile.query(),searchProfiles:async(i,o="",{limit:u=25,includeSelf:d=!1,includeConnectionStatus:f=!1,includeServiceProfiles:y=!1}={})=>n.profile.searchProfiles.query({input:o,limit:u,includeSelf:d,includeConnectionStatus:f,includeServiceProfiles:y}),connectWith:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.profile.connectWith.mutate({profileId:o})},cancelConnectionRequest:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.profile.cancelConnectionRequest.mutate({profileId:o})},connectWithInvite:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.profile.connectWithInvite.mutate({profileId:o,challenge:u})},disconnectWith:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.profile.disconnectWith.mutate({profileId:o})},acceptConnectionRequest:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.profile.acceptConnectionRequest.mutate({profileId:o})},getConnections:async i=>{if(console.warn("The getConnections method is deprecated! Please use getPaginatedConnections instead!"),!a)throw new Error("Please make an account first!");return n.profile.connections.query()},getPaginatedConnections:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.profile.paginatedConnections.query(o)},getPendingConnections:async i=>{if(console.warn("The getPendingConnections method is deprecated! Please use getPaginatedPendingConnections instead!"),!a)throw new Error("Please make an account first!");return n.profile.pendingConnections.query()},getPaginatedPendingConnections:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.profile.paginatedPendingConnections.query(o)},getConnectionRequests:async i=>{if(console.warn("The getConnectionRequests method is deprecated! Please use getPaginatedConnectionRequests instead!"),!a)throw new Error("Please make an account first!");return n.profile.connectionRequests.query()},getPaginatedConnectionRequests:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.profile.paginatedConnectionRequests.query(o)},generateInvite:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.profile.generateInvite.mutate({challenge:o,expiration:u})},blockProfile:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.profile.blockProfile.mutate({profileId:o})},unblockProfile:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.profile.unblockProfile.mutate({profileId:o})},getBlockedProfiles:async()=>{if(!a)throw new Error("Please make an account first!");return n.profile.blocked.query()},sendCredential:async(i,o,u,d=!0)=>{if(!a)throw new Error("Please make an account first!");if(!d)return n.credential.sendCredential.mutate({profileId:o,credential:u});let f=await i.invoke.getProfile(o);if(!f)throw new Error("Could not find target account");let y=await i.invoke.getDIDObject().createDagJWE(u,[a.did,f.did]);return n.credential.sendCredential.mutate({profileId:o,credential:y})},acceptCredential:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.credential.acceptCredential.mutate({uri:o})},getReceivedCredentials:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.credential.receivedCredentials.query({from:o})},getSentCredentials:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.credential.sentCredentials.query({to:o})},getIncomingCredentials:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.credential.incomingCredentials.query({from:o})},deleteCredential:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.credential.deleteCredential.mutate({uri:o})},sendPresentation:async(i,o,u,d=!0)=>{if(!a)throw new Error("Please make an account first!");if(!d)return n.presentation.sendPresentation.mutate({profileId:o,presentation:u});let f=await i.invoke.getProfile(o);if(!f)throw new Error("Could not find target account");let y=await i.invoke.getDIDObject().createDagJWE(u,[a.did,f.did]);return n.presentation.sendPresentation.mutate({profileId:o,presentation:y})},acceptPresentation:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.presentation.acceptPresentation.mutate({uri:o})},getReceivedPresentations:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.presentation.receivedPresentations.query({from:o})},getSentPresentations:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.presentation.sentPresentations.query({to:o})},getIncomingPresentations:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.presentation.incomingPresentations.query({from:o})},deletePresentation:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.presentation.deletePresentation.mutate({uri:o})},createBoost:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.createBoost.mutate({credential:o,...u})},createChildBoost:async(i,o,u,d)=>{if(!a)throw new Error("Please make an account first!");return n.boost.createChildBoost.mutate({parentUri:o,boost:{credential:u,...d}})},getBoost:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.boost.getBoost.query({uri:o})},getBoosts:async(i,o)=>{if(console.warn("The getBoosts method is deprecated! Please use getPaginatedBoosts instead!"),!a)throw new Error("Please make an account first!");return n.boost.getBoosts.query({query:o})},countBoosts:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.boost.countBoosts.query({query:o})},getPaginatedBoosts:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.boost.getPaginatedBoosts.query(o)},getBoostChildren:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.getBoostChildren.query({uri:o,...u})},countBoostChildren:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.countBoostChildren.query({uri:o,...u})},getBoostSiblings:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.getBoostSiblings.query({uri:o,...u})},countBoostSiblings:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.countBoostSiblings.query({uri:o,...u})},getFamilialBoosts:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.getFamilialBoosts.query({uri:o,...u})},countFamilialBoosts:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.countFamilialBoosts.query({uri:o,...u})},getBoostParents:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.getBoostParents.query({uri:o,...u})},countBoostParents:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.countBoostParents.query({uri:o,...u})},makeBoostParent:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.boost.makeBoostParent.mutate(o)},removeBoostParent:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.boost.removeBoostParent.mutate(o)},getBoostRecipients:async(i,o,u=25,d=void 0,f=!0)=>{if(console.warn("The getBoostRecipients method is deprecated! Please use getPaginatedBoostRecipients instead!"),!a)throw new Error("Please make an account first!");return n.boost.getBoostRecipients.query({uri:o,limit:u,skip:d,includeUnacceptedBoosts:f})},getPaginatedBoostRecipients:async(i,o,u=25,d=void 0,f=!0,y)=>{if(!a)throw new Error("Please make an account first!");return n.boost.getPaginatedBoostRecipients.query({uri:o,limit:u,cursor:d,includeUnacceptedBoosts:f,query:y})},countBoostRecipients:async(i,o,u=!0)=>{if(!a)throw new Error("Please make an account first!");return n.boost.getBoostRecipientCount.query({uri:o,includeUnacceptedBoosts:u})},updateBoost:async(i,o,u,d)=>{if(!a)throw new Error("Please make an account first!");return n.boost.updateBoost.mutate({uri:o,updates:{credential:d,...u}})},getBoostAdmins:async(i,o,u={})=>{if(!a)throw new Error("Please make an account first!");return n.boost.getBoostAdmins.query({uri:o,...u})},getBoostPermissions:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return u?n.boost.getOtherBoostPermissions.query({uri:o,profileId:u}):n.boost.getBoostPermissions.query({uri:o})},updateBoostPermissions:async(i,o,u,d)=>{if(!a)throw new Error("Please make an account first!");return d?n.boost.updateOtherBoostPermissions.query({uri:o,profileId:d,updates:u}):n.boost.updateBoostPermissions.query({uri:o,updates:u})},addBoostAdmin:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.addBoostAdmin.mutate({uri:o,profileId:u})},removeBoostAdmin:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.removeBoostAdmin.mutate({uri:o,profileId:u})},deleteBoost:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.boost.deleteBoost.mutate({uri:o})},sendBoost:async(i,o,u,d={encrypt:!0})=>{if(!a)throw new Error("Please make an account first!");let f=await i.invoke.resolveFromLCN(u),y=await Se.spa(f);if(!y.success)throw new Error("Did not get a valid boost from URI");let E=await i.invoke.getProfile(o);if(!E)throw new Error("Target profile not found");let w=y.data;w.issuanceDate=new Date().toISOString(),w.issuer=i.id.did(),Array.isArray(w.credentialSubject)?w.credentialSubject=w.credentialSubject.map(z=>({...z,id:E.did})):w.credentialSubject.id=E.did,w?.type?.includes("BoostCredential")&&(w.boostId=u),typeof d=="object"&&d.overideFn&&(w=d.overideFn(w));let T=await i.invoke.issueCredential(w);if(typeof d=="object"&&!d.encrypt||!d)return n.boost.sendBoost.mutate({profileId:o,uri:u,credential:T});let S=await n.utilities.getDid.query(),te=await i.invoke.getDIDObject().createDagJWE(T,[a.did,E.did,S]);return n.boost.sendBoost.mutate({profileId:o,uri:u,credential:te})},registerSigningAuthority:async(i,o,u,d)=>{if(!a)throw new Error("Please make an account first!");return n.profile.registerSigningAuthority.mutate({endpoint:o,name:u,did:d})},getRegisteredSigningAuthorities:async(i,o,u,d)=>{if(!a)throw new Error("Please make an account first!");return n.profile.signingAuthorities.query()},getRegisteredSigningAuthority:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.profile.signingAuthority.query({endpoint:o,name:u})},generateClaimLink:async(i,o,u,d,f)=>{if(!a)throw new Error("Please make an account first!");return n.boost.generateClaimLink.mutate({boostUri:o,claimLinkSA:u,options:d,challenge:f})},claimBoostWithLink:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.boost.claimBoostWithLink.mutate({boostUri:o,challenge:u})},createContract:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.contracts.createConsentFlowContract.mutate(o)},getContract:async(i,o)=>n.contracts.getConsentFlowContract.query({uri:o}),getContracts:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.contracts.getConsentFlowContracts.query(o)},deleteContract:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.contracts.deleteConsentFlowContract.mutate({uri:o})},getConsentFlowData:async(i,o,u={})=>{if(!a)throw new Error("Please make an account first!");return n.contracts.getConsentedDataForContract.query({uri:o,...u})},getAllConsentFlowData:async(i,o={},u={})=>{if(!a)throw new Error("Please make an account first!");return n.contracts.getConsentedData.query({query:o,...u})},consentToContract:async(i,o,{terms:u,expiresAt:d,oneTime:f})=>{if(!a)throw new Error("Please make an account first!");return n.contracts.consentToContract.mutate({contractUri:o,terms:u,expiresAt:d,oneTime:f})},getConsentedContracts:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.contracts.getConsentedContracts.query(o)},updateContractTerms:async(i,o,{terms:u,expiresAt:d,oneTime:f})=>{if(!a)throw new Error("Please make an account first!");return n.contracts.updateConsentedContractTerms.mutate({uri:o,terms:u,expiresAt:d,oneTime:f})},withdrawConsent:async(i,o)=>{if(!a)throw new Error("Please make an account first!");return n.contracts.withdrawConsent.mutate({uri:o})},getConsentFlowTransactions:async(i,o,u)=>{if(!a)throw new Error("Please make an account first!");return n.contracts.getTermsTransactionHistory.query({uri:o,...u})},verifyConsent:async(i,o,u)=>n.contracts.verifyConsent.query({uri:o,profileId:u}),resolveFromLCN:async(i,o)=>{let u=await n.storage.resolve.query({uri:o});return Se.or(Ze).or(Wt).or(Zt).or(Ht).or(gt).parseAsync(u)},getLCNClient:()=>n}}},"getLearnCardNetworkPlugin"),hs=l(async(t,e)=>{let r=[{id:"LearnCard Network",url:"https://network.learncard.com",did:"did:web:network.learncard.com"}],n;if(e){let i=await fetch(e);i.status===200?n=JSON.parse(await i.text()):n=r}else n=r;let a=l(i=>{if(!!i)return typeof i=="string"?i:"id"in i&&typeof i.id=="string"?i.id:void 0},"getIssuerDID"),c=l(i=>{let o=a(i);if(!!o)return n.find(u=>u.did===o)},"getTrustedBoostVerifier");return{name:"VerifyBoost",displayName:"Verify Boost Extension",description:"Adds a check for validating Boost Credentials.",methods:{verifyCredential:async(i,o,u)=>{let d=await t.invoke.verifyCredential(o,u),f=o?.boostCredential;try{if(f){let y=await t.invoke.verifyCredential(f);if(!f?.boostId&&!o?.boostId&&d.warnings.push("Boost Authenticity could not be verified: Boost ID metadata is missing."),y.errors?.length>0)d.errors=[...y.errors||[],...d.errors||[],"Boost Credential could not be verified."];else if(f?.boostId!==o?.boostId)d.errors.push("Boost Authenticity could not be verified: Boost ID metadata is mismatched.");else{let E=c(o?.issuer);E?d.checks.push(`Boost is Authentic. Verified by ${E.id}.`):d.warnings.push(`Boost Authenticity could not be verified. Issuer is outside of trust network: ${a(o?.issuer)}`)}}}catch{d.errors.push("Boost authenticity could not be verified.")}return d}}}},"getVerifyBoostPlugin");
|
|
3
3
|
/* istanbul ignore if -- @preserve */
|
|
4
4
|
/* istanbul ignore next -- @preserve */
|
|
5
5
|
//# sourceMappingURL=lcn-plugin.cjs.production.min.js.map
|