@learncard/network-plugin 1.7.6 → 1.7.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 +8 -5
- package/dist/lcn-plugin.cjs.development.js.map +2 -2
- package/dist/lcn-plugin.cjs.production.min.js +1 -1
- package/dist/lcn-plugin.cjs.production.min.js.map +2 -2
- package/dist/lcn-plugin.esm.js +8 -5
- package/dist/lcn-plugin.esm.js.map +2 -2
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Pe=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Dt=Object.prototype.hasOwnProperty;var u=(r,e)=>Pe(r,"name",{value:e,configurable:!0});var Lt=(r,e)=>{for(var t in e)Pe(r,t,{get:e[t],enumerable:!0})},qt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of At(e))!Dt.call(r,s)&&s!==t&&Pe(r,s,{get:()=>e[s],enumerable:!(n=Ot(e,s))||n.enumerable});return r};var Mt=r=>qt(Pe({},"__esModule",{value:!0}),r);var Pn={};Lt(Pn,{getLearnCardNetworkPlugin:()=>Tn,getVerifyBoostPlugin:()=>En});module.exports=Mt(Pn);function Bt(r){return r}u(Bt,"identity");function $t(r){return r.length===0?Bt:r.length===1?r[0]:u(function(t){return r.reduce((n,s)=>s(n),t)},"piped")}u($t,"pipeFromArray");function $(r){let e={subscribe(t){let n=null,s=!1,c=!1,o=!1;function i(){if(n===null){o=!0;return}c||(c=!0,typeof n=="function"?n():n&&n.unsubscribe())}return u(i,"unsubscribe"),n=r({next(l){s||t.next?.(l)},error(l){s||(s=!0,t.error?.(l),i())},complete(){s||(s=!0,t.complete?.(),i())}}),o&&i(),{unsubscribe:i}},pipe(...t){return $t(t)(e)}};return e}u($,"observable");function st(r){return e=>{let t=0,n=null,s=[];function c(){n||(n=e.subscribe({next(i){for(let l of s)l.next?.(i)},error(i){for(let l of s)l.error?.(i)},complete(){for(let i of s)i.complete?.()}}))}u(c,"startIfNeeded");function o(){if(t===0&&n){let i=n;n=null,i.unsubscribe()}}return u(o,"resetIfNeeded"),{subscribe(i){return t++,s.push(i),c(),{unsubscribe(){t--,o();let l=s.findIndex(d=>d===i);l>-1&&s.splice(l,1)}}}}}}u(st,"share");var _e=class extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,_e.prototype)}};u(_e,"ObservableAbortError");function it(r){let e;return{promise:new Promise((n,s)=>{let c=!1;function o(){c||(c=!0,s(new _e("This operation was aborted.")),i.unsubscribe())}u(o,"onDone");let i=r.subscribe({next(l){c=!0,n(l),o()},error(l){c=!0,s(l),o()},complete(){c=!0,o()}});e=o}),abort:e}}u(it,"observableToPromise");var E=class extends Error{static from(e,t={}){return e instanceof Error?e.name==="TRPCClientError"?e:new E(e.message,{...t,cause:e,result:null}):new E(e.error.message??"",{...t,cause:void 0,result:e})}constructor(e,t){let n=t?.cause;super(e,{cause:n}),this.meta=t?.meta,this.cause=n,this.shape=t?.result?.error,this.data=t?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,E.prototype)}};u(E,"TRPCClientError");function zt(r,e){if("error"in r){let n=e.transformer.deserialize(r.error);return{ok:!1,error:{...r,error:n}}}let t={...r.result,...(!r.result.type||r.result.type==="data")&&{type:"data",data:e.transformer.deserialize(r.result.data)}};return{ok:!0,result:t}}u(zt,"transformResultInner");function ot(r){return!!r&&!Array.isArray(r)&&typeof r=="object"}u(ot,"isObject");function je(r,e){let t;try{t=zt(r,e)}catch{throw new E("Unable to transform response from server")}if(!t.ok&&(!ot(t.error.error)||typeof t.error.error.code!="number"))throw new E("Badly formatted response from server");if(t.ok&&!ot(t.result))throw new E("Badly formatted response from server");return t}u(je,"transformResult");function ct(r){return $(e=>{function t(s=0,c=r.op){let o=r.links[s];if(!o)throw new Error("No more links to execute - did you forget to add an ending link?");return o({op:c,next(l){return t(s+1,l)}})}return u(t,"execute"),t().subscribe(e)})}u(ct,"createChain");var lt=u(()=>{},"noop");function ut(r,e){return new Proxy(lt,{get(n,s){if(!(typeof s!="string"||s==="then"))return ut(r,[...e,s])},apply(n,s,c){return r({args:c,path:e})}})}u(ut,"createInnerProxy");var ze=u(r=>ut(r,[]),"createRecursiveProxy"),We=u(r=>new Proxy(lt,{get(e,t){if(!(typeof t!="string"||t==="then"))return r(t)}}),"createFlatProxy");var Ue=u(r=>typeof r=="function","isFunction");function dt(r,e){return Ue(r.bind)?r.bind(e):r}u(dt,"_bind");function pt(r){if(r)return r;if(typeof window<"u"&&Ue(window.fetch))return dt(window.fetch,window);if(typeof globalThis<"u"&&Ue(globalThis.fetch))return dt(globalThis.fetch,globalThis);throw new Error("No fetch implementation found")}u(pt,"getFetch");function Wt(r){return r||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}u(Wt,"getAbortController");function Ze(r){let e=r.headers||(()=>({}));return{url:r.url,fetch:pt(r.fetch),AbortController:Wt(r.AbortController),headers:typeof e=="function"?e:()=>e}}u(Ze,"resolveHTTPLinkOptions");function Ut(r){let e={};for(let t=0;t<r.length;t++){let n=r[t];e[t]=n}return e}u(Ut,"arrayToDict");var Zt={query:"GET",mutation:"POST"};function ft(r){return"input"in r?r.runtime.transformer.serialize(r.input):Ut(r.inputs.map(e=>r.runtime.transformer.serialize(e)))}u(ft,"getInput");function Fe(r){let e=r.url+"/"+r.path,t=[];if("inputs"in r&&t.push("batch=1"),r.type==="query"){let n=ft(r);n!==void 0&&t.push(`input=${encodeURIComponent(JSON.stringify(n))}`)}return t.length&&(e+="?"+t.join("&")),e}u(Fe,"getUrl");function Ft(r){if(r.type==="query")return;let e=ft(r);return e!==void 0?JSON.stringify(e):void 0}u(Ft,"getBody");function Je(r){let{type:e}=r,t=r.AbortController?new r.AbortController:null;return{promise:new Promise((c,o)=>{let i=Fe(r),l=Ft(r),d={};Promise.resolve(r.headers()).then(p=>{if(e==="subscription")throw new Error("Subscriptions should use wsLink");return r.fetch(i,{method:Zt[e],signal:t?.signal,body:l,headers:{"content-type":"application/json",...p}})}).then(p=>(d.response=p,p.json())).then(p=>{c({json:p,meta:d})}).catch(o)}),cancel:u(()=>{t?.abort()},"cancel")}}u(Je,"httpRequest");var He=u(()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")},"throwFatalError");function Ge(r){let e=null,t=null,n=u(()=>{clearTimeout(t),t=null,e=null},"destroyTimerAndPendingItems");function s(i){let l=[[]],d=0;for(;;){let p=i[d];if(!p)break;let b=l[l.length-1];if(p.aborted){p.reject(new Error("Aborted")),d++;continue}if(r.validate(b.concat(p).map(T=>T.key))){b.push(p),d++;continue}if(b.length===0){p.reject(new Error("Input is too big for a single dispatch")),d++;continue}l.push([])}return l}u(s,"groupItems");function c(){let i=s(e);n();for(let l of i){if(!l.length)continue;let d={items:l,cancel:He};for(let C of l)C.batch=d;let{promise:p,cancel:b}=r.fetch(d.items.map(C=>C.key));d.cancel=b,p.then(C=>{for(let T=0;T<C.length;T++){let S=C[T],q=d.items[T];q.resolve(S),q.batch=null}}).catch(C=>{for(let T of d.items)T.reject(C),T.batch=null})}}u(c,"dispatch");function o(i){let l={aborted:!1,key:i,batch:null,resolve:He,reject:He},d=new Promise((b,C)=>{l.reject=C,l.resolve=b,e||(e=[]),e.push(l)});return t||(t=setTimeout(c)),{promise:d,cancel:u(()=>{l.aborted=!0,l.batch?.items.every(b=>b.aborted)&&(l.batch.cancel(),l.batch=null)},"cancel")}}return u(o,"load"),{load:o}}u(Ge,"dataLoader");function Se(r){let e=Ze(r);return t=>{let n=r.maxURLLength||1/0,s=u(d=>({validate:u(C=>{if(n===1/0)return!0;let T=C.map(ue=>ue.path).join(","),S=C.map(ue=>ue.input);return Fe({...e,runtime:t,type:d,path:T,inputs:S}).length<=n},"validate"),fetch:u(C=>{let T=C.map(B=>B.path).join(","),S=C.map(B=>B.input),{promise:q,cancel:ue}=Je({...e,runtime:t,type:d,path:T,inputs:S});return{promise:q.then(B=>(Array.isArray(B.json)?B.json:C.map(()=>B.json)).map(It=>({meta:B.meta,json:It}))),cancel:ue}},"fetch")}),"batchLoader"),c=Ge(s("query")),o=Ge(s("mutation")),i=Ge(s("subscription")),l={query:c,subscription:i,mutation:o};return({op:d})=>$(p=>{let b=l[d.type],{promise:C,cancel:T}=b.load(d);return C.then(S=>{let q=je(S.json,t);if(!q.ok){p.error(E.from(q.error,{meta:S.meta}));return}p.next({context:S.meta,result:q.result}),p.complete()}).catch(S=>p.error(E.from(S))),()=>{T()}})}}u(Se,"httpBatchLink");var Ne=class{$request({type:e,input:t,path:n,context:s={}}){return ct({links:this.links,op:{id:++this.requestId,type:e,path:n,input:t,context:s}}).pipe(st())}requestAsPromise(e){let t=this.$request(e),{promise:n,abort:s}=it(t);return new Promise((o,i)=>{e.signal?.addEventListener("abort",s),n.then(l=>{o(l.result.data)}).catch(l=>{i(E.from(l))})})}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,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;function t(){let n=e.transformer;return n?"input"in n?{serialize:n.input.serialize,deserialize:n.output.deserialize}:n:{serialize:s=>s,deserialize:s=>s}}u(t,"getTransformer"),this.runtime={transformer:t()},this.links=e.links.map(n=>n(this.runtime))}};u(Ne,"TRPCUntypedClient");var Jt={query:"query",mutate:"mutation",subscribe:"subscription"};function Ht(r){return We(e=>r.hasOwnProperty(e)?r[e]:ze(({path:t,args:n})=>{let s=[e,...t],c=s.pop(),o=Jt[c],i=s.join(".");return r[o](i,...n)}))}u(Ht,"createTRPCClientProxy");function Qe(r){let e=new Ne(r);return Ht(e)}u(Qe,"createTRPCProxyClient");var Gt=Object.defineProperty,Ve=u((r,e)=>Gt(r,"name",{value:e,configurable:!0}),"__name"),Qt=Ve(r=>()=>({next:e,op:t})=>$(n=>{let s=null,c=0,o=!1,i=Ve(()=>{c+=1,s?.unsubscribe(),s=e(t).subscribe({error:async l=>{if(c>5||l.data?.httpStatus!==401)return n.error(l);await r(),i()},next:l=>n.next(l),complete:()=>{o&&n.complete()}})},"attempt");return i(),()=>{o=!0,s?.unsubscribe()}}),"callbackLink"),mt=Ve(async(r,e)=>{let t=[],n=Qe({links:[Se({url:r,headers:{Authorization:`Bearer ${await e()}`}})]}),s=Ve(async(o=95+Math.round((Math.random()-.5)*5))=>n.utilities.getChallenges.query({amount:o}),"getChallenges");return t=await s(),Qe({links:[Qt(async()=>{t=await s()}),Se({url:r,headers:async()=>(t.length===0&&t.push(...await s()),{Authorization:`Bearer ${await e(t.pop())}`})})]})},"getClient");var x;(function(r){r.assertEqual=s=>s;function e(s){}u(e,"assertIs"),r.assertIs=e;function t(s){throw new Error}u(t,"assertNever"),r.assertNever=t,r.arrayToEnum=s=>{let c={};for(let o of s)c[o]=o;return c},r.getValidEnumValues=s=>{let c=r.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),o={};for(let i of c)o[i]=s[i];return r.objectValues(o)},r.objectValues=s=>r.objectKeys(s).map(function(c){return s[c]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let c=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&c.push(o);return c},r.find=(s,c)=>{for(let o of s)if(c(o))return o},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,c=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(c)}u(n,"joinValues"),r.joinValues=n,r.jsonStringifyReplacer=(s,c)=>typeof c=="bigint"?c.toString():c})(x||(x={}));var m=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Q=u(r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(r)?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(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},"getParsedType"),f=x.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"]),Kt=u(r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),A=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 t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(c){return c.message},n={_errors:[]},s=u(c=>{for(let o of c.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let i=n,l=0;for(;l<o.path.length;){let d=o.path[l];l===o.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(t(o))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}},"processError");return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};u(A,"ZodError");A.create=r=>new A(r);var ke=u((r,e)=>{let t;switch(r.code){case f.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.invalid_string:typeof r.validation=="object"?"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case f.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(r.minimum)}`:t="Invalid input";break;case f.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(r.maximum)}`:t="Invalid input";break;case f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}},"errorMap"),vt=ke;function Yt(r){vt=r}u(Yt,"setErrorMap");function Ie(){return vt}u(Ie,"getErrorMap");var Oe=u(r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,c=[...t,...s.path||[]],o={...s,path:c},i="",l=n.filter(d=>!!d).slice().reverse();for(let d of l)i=d(o,{data:e,defaultError:i}).message;return{...s,path:c,message:s.message||i}},"makeIssue"),Xt=[];function h(r,e){let t=Oe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ie(),ke].filter(n=>!!n)});r.common.issues.push(t)}u(h,"addIssueToContext");var P=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return g;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t)n.push({key:await s.key,value:await s.value});return P.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:c,value:o}=s;if(c.status==="aborted"||o.status==="aborted")return g;c.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),(typeof o.value<"u"||s.alwaysSet)&&(n[c.value]=o.value)}return{status:e.value,value:n}}};u(P,"ParseStatus");var g=Object.freeze({status:"aborted"}),bt=u(r=>({status:"dirty",value:r}),"DIRTY"),j=u(r=>({status:"valid",value:r}),"OK"),Ke=u(r=>r.status==="aborted","isAborted"),Ye=u(r=>r.status==="dirty","isDirty"),Ae=u(r=>r.status==="valid","isValid"),De=u(r=>typeof Promise!==void 0&&r instanceof Promise,"isAsync"),w;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(w||(w={}));var R=class{constructor(e,t,n,s){this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._path.concat(this._key)}};u(R,"ParseInputLazyPath");var ht=u((r,e)=>{if(Ae(e))return{success:!0,data:e.value};{if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");let t=new A(r.common.issues);return{success:!1,error:t}}},"handleResult");function _(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:u((o,i)=>o.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},"customMap"),description:s}}u(_,"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 Q(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:Q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(De(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Q(e)},c=this._parseSync({data:e,path:s.path,parent:s});return ht(s,c)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Q(e)},s=this._parse({data:e,path:n.path,parent:n}),c=await(De(s)?s:Promise.resolve(s));return ht(n,c)}refine(e,t){let n=u(s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t,"getIssueProperties");return this._refinement((s,c)=>{let o=e(s),i=u(()=>c.addIssue({code:f.custom,...n(s)}),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new V({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return O.create(this)}nullable(){return Z.create(this)}nullish(){return this.optional().nullable()}array(){return N.create(this)}promise(){return G.create(this)}or(e){return te.create([this,e])}and(e){return re.create(this,e)}transform(e){return new V({schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ce({innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Ce({typeName:y.ZodBranded,type:this,..._(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new he({innerType:this,defaultValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return le.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u(v,"ZodType");var er=/^c[^\s-]{8,}$/i,tr=/^([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,rr=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,nr=u(r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.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$"):r.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"),D=class extends v{constructor(){super(...arguments),this._regex=(e,t,n)=>this.refinement(s=>e.test(s),{validation:t,code:f.invalid_string,...w.errToObj(n)}),this.nonempty=e=>this.min(1,w.errToObj(e)),this.trim=()=>new D({...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:f.invalid_type,expected:m.string,received:c.parsedType}),g}let n=new P,s;for(let c of this._def.checks)if(c.kind==="min")e.data.length<c.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.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&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="length"){let o=e.data.length>c.value,i=e.data.length<c.value;(o||i)&&(s=this._getOrReturnCtx(e,s),o?h(s,{code:f.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):i&&h(s,{code:f.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),n.dirty())}else if(c.kind==="email")rr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:f.invalid_string,message:c.message}),n.dirty());else if(c.kind==="uuid")tr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:f.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid")er.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:f.invalid_string,message:c.message}),n.dirty());else if(c.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),h(s,{validation:"url",code:f.invalid_string,message:c.message}),n.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"regex",code:f.invalid_string,message:c.message}),n.dirty())):c.kind==="trim"?e.data=e.data.trim():c.kind==="startsWith"?e.data.startsWith(c.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:{startsWith:c.value},message:c.message}),n.dirty()):c.kind==="endsWith"?e.data.endsWith(c.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:{endsWith:c.value},message:c.message}),n.dirty()):c.kind==="datetime"?nr(c).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:"datetime",message:c.message}),n.dirty()):x.assertNever(c);return{status:n.value,value:e.data}}_addCheck(e){return new D({...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 t;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:(t=e?.offset)!==null&&t!==void 0?t:!1,...w.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.errToObj(t)})}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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};u(D,"ZodString");D.create=r=>{var e;return new D({checks:[],typeName:y.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function ar(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,c=parseInt(r.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return c%o/Math.pow(10,s)}u(ar,"floatSafeRemainder");var M=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:f.invalid_type,expected:m.number,received:c.parsedType}),g}let n,s=new P;for(let c of this._def.checks)c.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.invalid_type,expected:"integer",received:"float",message:c.message}),s.dirty()):c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),s.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),s.dirty()):c.kind==="multipleOf"?ar(e.data,c.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_multiple_of,multipleOf:c.value,message:c.message}),s.dirty()):c.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_finite,message:c.message}),s.dirty()):x.assertNever(c);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,n,s){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:w.toString(s)}]})}_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,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};u(M,"ZodNumber");M.create=r=>new M({checks:[],typeName:y.ZodNumber,coerce:r?.coerce||!1,..._(r)});var K=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:f.invalid_type,expected:m.bigint,received:n.parsedType}),g}return j(e.data)}};u(K,"ZodBigInt");K.create=r=>{var e;return new K({typeName:y.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};var Y=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:f.invalid_type,expected:m.boolean,received:n.parsedType}),g}return j(e.data)}};u(Y,"ZodBoolean");Y.create=r=>new Y({typeName:y.ZodBoolean,coerce:r?.coerce||!1,..._(r)});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:f.invalid_type,expected:m.date,received:c.parsedType}),g}if(isNaN(e.data.getTime())){let c=this._getOrReturnCtx(e);return h(c,{code:f.invalid_date}),g}let n=new P,s;for(let c of this._def.checks)c.kind==="min"?e.data.getTime()<c.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),n.dirty()):c.kind==="max"?e.data.getTime()>c.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),n.dirty()):x.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,t){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};u(z,"ZodDate");z.create=r=>new z({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,..._(r)});var de=class extends v{_parse(e){if(this._getType(e)!==m.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.symbol,received:n.parsedType}),g}return j(e.data)}};u(de,"ZodSymbol");de.create=r=>new de({typeName:y.ZodSymbol,..._(r)});var X=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.undefined,received:n.parsedType}),g}return j(e.data)}};u(X,"ZodUndefined");X.create=r=>new X({typeName:y.ZodUndefined,..._(r)});var ee=class extends v{_parse(e){if(this._getType(e)!==m.null){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.null,received:n.parsedType}),g}return j(e.data)}};u(ee,"ZodNull");ee.create=r=>new ee({typeName:y.ZodNull,..._(r)});var J=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}};u(J,"ZodAny");J.create=r=>new J({typeName:y.ZodAny,..._(r)});var W=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}};u(W,"ZodUnknown");W.create=r=>new W({typeName:y.ZodUnknown,..._(r)});var L=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_type,expected:m.never,received:t.parsedType}),g}};u(L,"ZodNever");L.create=r=>new L({typeName:y.ZodNever,..._(r)});var pe=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.void,received:n.parsedType}),g}return j(e.data)}};u(pe,"ZodVoid");pe.create=r=>new pe({typeName:y.ZodVoid,..._(r)});var N=class extends v{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return h(t,{code:f.invalid_type,expected:m.array,received:t.parsedType}),g;if(s.exactLength!==null){let o=t.data.length>s.exactLength.value,i=t.data.length<s.exactLength.value;(o||i)&&(h(t,{code:o?f.too_big:f.too_small,minimum:i?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(h(t,{code:f.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(h(t,{code:f.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all(t.data.map((o,i)=>s.type._parseAsync(new R(t,o,t.path,i)))).then(o=>P.mergeArray(n,o));let c=t.data.map((o,i)=>s.type._parseSync(new R(t,o,t.path,i)));return P.mergeArray(n,c)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:w.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:w.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:w.toString(t)}})}nonempty(e){return this.min(1,e)}};u(N,"ZodArray");N.create=(r,e)=>new N({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});var Le;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Le||(Le={}));var yt=u(r=>e=>new k({...r,shape:()=>({...r.shape(),...e})}),"AugmentFactory");function we(r){if(r instanceof k){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=O.create(we(n))}return new k({...r._def,shape:()=>e})}else return r instanceof N?N.create(we(r.element)):r instanceof O?O.create(we(r.unwrap())):r instanceof Z?Z.create(we(r.unwrap())):r instanceof I?I.create(r.items.map(e=>we(e))):r}u(we,"deepPartialify");var k=class extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=yt(this._def),this.extend=yt(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){let d=this._getOrReturnCtx(e);return h(d,{code:f.invalid_type,expected:m.object,received:d.parsedType}),g}let{status:n,ctx:s}=this._processInputParams(e),{shape:c,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let d in s.data)o.includes(d)||i.push(d);let l=[];for(let d of o){let p=c[d],b=s.data[d];l.push({key:{status:"valid",value:d},value:p._parse(new R(s,b,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof L){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of i)l.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")i.length>0&&(h(s,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of i){let b=s.data[p];l.push({key:{status:"valid",value:p},value:d._parse(new R(s,b,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of l){let b=await p.key;d.push({key:b,value:await p.value,alwaysSet:p.alwaysSet})}return d}).then(d=>P.mergeObjectSync(n,d)):P.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,c,o,i;let l=(o=(c=(s=this._def).errorMap)===null||c===void 0?void 0:c.call(s,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(i=w.errToObj(e).message)!==null&&i!==void 0?i:l}:{message:l}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>Le.mergeShapes(this._def.shape(),e._def.shape()),typeName:y.ZodObject})}catchall(e){return new k({...this._def,catchall:e})}pick(e){let t={};return x.objectKeys(e).map(n=>{this.shape[n]&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}omit(e){let t={};return x.objectKeys(this.shape).map(n=>{x.objectKeys(e).indexOf(n)===-1&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}deepPartial(){return we(this)}partial(e){let t={};if(e)return x.objectKeys(this.shape).map(n=>{x.objectKeys(e).indexOf(n)===-1?t[n]=this.shape[n]:t[n]=this.shape[n].optional()}),new k({...this._def,shape:()=>t});for(let n in this.shape){let s=this.shape[n];t[n]=s.optional()}return new k({...this._def,shape:()=>t})}required(e){let t={};if(e)x.objectKeys(this.shape).map(n=>{if(x.objectKeys(e).indexOf(n)===-1)t[n]=this.shape[n];else{let c=this.shape[n];for(;c instanceof O;)c=c._def.innerType;t[n]=c}});else for(let n in this.shape){let c=this.shape[n];for(;c instanceof O;)c=c._def.innerType;t[n]=c}return new k({...this._def,shape:()=>t})}keyof(){return _t(x.objectKeys(this.shape))}};u(k,"ZodObject");k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:L.create(),typeName:y.ZodObject,..._(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});var te=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(c){for(let i of c)if(i.result.status==="valid")return i.result;for(let i of c)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=c.map(i=>new A(i.ctx.common.issues));return h(t,{code:f.invalid_union,unionErrors:o}),g}if(u(s,"handleResults"),t.common.async)return Promise.all(n.map(async c=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await c._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(s);{let c,o=[];for(let l of n){let d={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!c&&(c={result:p,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(c)return t.common.issues.push(...c.ctx.common.issues),c.result;let i=o.map(l=>new A(l));return h(t,{code:f.invalid_union,unionErrors:i}),g}}get options(){return this._def.options}};u(te,"ZodUnion");te.create=(r,e)=>new te({options:r,typeName:y.ZodUnion,..._(e)});var Re=u(r=>r instanceof ae?Re(r.schema):r instanceof V?Re(r.innerType()):r instanceof se?[r.value]:r instanceof ie?r.options:r instanceof oe?Object.keys(r.enum):r instanceof ce?Re(r._def.innerType):r instanceof X?[void 0]:r instanceof ee?[null]:null,"getDiscriminator"),fe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return h(t,{code:f.invalid_type,expected:m.object,received:t.parsedType}),g;let n=this.discriminator,s=t.data[n],c=this.optionsMap.get(s);return c?t.common.async?c._parseAsync({data:t.data,path:t.path,parent:t}):c._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let c of t){let o=Re(c.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(s.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,c)}}return new fe({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}};u(fe,"ZodDiscriminatedUnion");function Xe(r,e){let t=Q(r),n=Q(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){let s=x.objectKeys(e),c=x.objectKeys(r).filter(i=>s.indexOf(i)!==-1),o={...r,...e};for(let i of c){let l=Xe(r[i],e[i]);if(!l.valid)return{valid:!1};o[i]=l.data}return{valid:!0,data:o}}else if(t===m.array&&n===m.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let c=0;c<r.length;c++){let o=r[c],i=e[c],l=Xe(o,i);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}u(Xe,"mergeValues");var re=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=u((c,o)=>{if(Ke(c)||Ke(o))return g;let i=Xe(c.value,o.value);return i.valid?((Ye(c)||Ye(o))&&t.dirty(),{status:t.value,value:i.data}):(h(n,{code:f.invalid_intersection_types}),g)},"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,o])=>s(c,o)):s(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(re,"ZodIntersection");re.create=(r,e,t)=>new re({left:r,right:e,typeName:y.ZodIntersection,..._(t)});var I=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:f.invalid_type,expected:m.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return h(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let c=n.data.map((o,i)=>{let l=this._def.items[i]||this._def.rest;return l?l._parse(new R(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(c).then(o=>P.mergeArray(t,o)):P.mergeArray(t,c)}get items(){return this._def.items}rest(e){return new I({...this._def,rest:e})}};u(I,"ZodTuple");I.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({items:r,typeName:y.ZodTuple,rest:null,..._(e)})};var ne=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return h(n,{code:f.invalid_type,expected:m.object,received:n.parsedType}),g;let s=[],c=this._def.keyType,o=this._def.valueType;for(let i in n.data)s.push({key:c._parse(new R(n,i,n.path,i)),value:o._parse(new R(n,n.data[i],n.path,i))});return n.common.async?P.mergeObjectAsync(t,s):P.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof v?new ne({keyType:e,valueType:t,typeName:y.ZodRecord,..._(n)}):new ne({keyType:D.create(),valueType:e,typeName:y.ZodRecord,..._(t)})}};u(ne,"ZodRecord");var me=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:f.invalid_type,expected:m.map,received:n.parsedType}),g;let s=this._def.keyType,c=this._def.valueType,o=[...n.data.entries()].map(([i,l],d)=>({key:s._parse(new R(n,i,n.path,[d,"key"])),value:c._parse(new R(n,l,n.path,[d,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let l of o){let d=await l.key,p=await l.value;if(d.status==="aborted"||p.status==="aborted")return g;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(d.value,p.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let l of o){let d=l.key,p=l.value;if(d.status==="aborted"||p.status==="aborted")return g;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(d.value,p.value)}return{status:t.value,value:i}}}};u(me,"ZodMap");me.create=(r,e,t)=>new me({valueType:e,keyType:r,typeName:y.ZodMap,..._(t)});var U=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:f.invalid_type,expected:m.set,received:n.parsedType}),g;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(n,{code:f.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(h(n,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let c=this._def.valueType;function o(l){let d=new Set;for(let p of l){if(p.status==="aborted")return g;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}u(o,"finalizeSet");let i=[...n.data.values()].map((l,d)=>c._parse(new R(n,l,n.path,d)));return n.common.async?Promise.all(i).then(l=>o(l)):o(i)}min(e,t){return new U({...this._def,minSize:{value:e,message:w.toString(t)}})}max(e,t){return new U({...this._def,maxSize:{value:e,message:w.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};u(U,"ZodSet");U.create=(r,e)=>new U({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var H=class extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return h(t,{code:f.invalid_type,expected:m.function,received:t.parsedType}),g;function n(i,l){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ie(),ke].filter(d=>!!d),issueData:{code:f.invalid_arguments,argumentsError:l}})}u(n,"makeArgsIssue");function s(i,l){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ie(),ke].filter(d=>!!d),issueData:{code:f.invalid_return_type,returnTypeError:l}})}u(s,"makeReturnsIssue");let c={errorMap:t.common.contextualErrorMap},o=t.data;return this._def.returns instanceof G?j(async(...i)=>{let l=new A([]),d=await this._def.args.parseAsync(i,c).catch(C=>{throw l.addIssue(n(i,C)),l}),p=await o(...d);return await this._def.returns._def.type.parseAsync(p,c).catch(C=>{throw l.addIssue(s(p,C)),l})}):j((...i)=>{let l=this._def.args.safeParse(i,c);if(!l.success)throw new A([n(i,l.error)]);let d=o(...l.data),p=this._def.returns.safeParse(d,c);if(!p.success)throw new A([s(d,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new H({...this._def,args:I.create(e).rest(W.create())})}returns(e){return new H({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new H({args:e||I.create([]).rest(W.create()),returns:t||W.create(),typeName:y.ZodFunction,..._(n)})}};u(H,"ZodFunction");var ae=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};u(ae,"ZodLazy");ae.create=(r,e)=>new ae({getter:r,typeName:y.ZodLazy,..._(e)});var se=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}};u(se,"ZodLiteral");se.create=(r,e)=>new se({value:r,typeName:y.ZodLiteral,..._(e)});function _t(r,e){return new ie({values:r,typeName:y.ZodEnum,..._(e)})}u(_t,"createZodEnum");var ie=class extends v{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:x.joinValues(n),received:t.parsedType,code:f.invalid_type}),g}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:f.invalid_enum_value,options:n}),g}return j(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}};u(ie,"ZodEnum");ie.create=_t;var oe=class extends v{_parse(e){let t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){let s=x.objectValues(t);return h(n,{expected:x.joinValues(s),received:n.parsedType,code:f.invalid_type}),g}if(t.indexOf(e.data)===-1){let s=x.objectValues(t);return h(n,{received:n.data,code:f.invalid_enum_value,options:s}),g}return j(e.data)}get enum(){return this._def.values}};u(oe,"ZodNativeEnum");oe.create=(r,e)=>new oe({values:r,typeName:y.ZodNativeEnum,..._(e)});var G=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return h(t,{code:f.invalid_type,expected:m.promise,received:t.parsedType}),g;let n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return j(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};u(G,"ZodPromise");G.create=(r,e)=>new G({type:r,typeName:y.ZodPromise,..._(e)});var V=class extends v{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:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null;if(s.type==="preprocess"){let o=s.transform(n.data);return n.common.async?Promise.resolve(o).then(i=>this._def.schema._parseAsync({data:i,path:n.path,parent:n})):this._def.schema._parseSync({data:o,path:n.path,parent:n})}let c={addIssue:o=>{h(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(c.addIssue=c.addIssue.bind(c),s.type==="refinement"){let o=u(i=>{let l=s.refinement(i,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 i},"executeRefinement");if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?g:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?g:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ae(o))return o;let i=s.transform(o.value,c);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Ae(o)?Promise.resolve(s.transform(o.value,c)).then(i=>({status:t.value,value:i})):o);x.assertNever(s)}};u(V,"ZodEffects");V.create=(r,e,t)=>new V({schema:r,typeName:y.ZodEffects,effect:e,..._(t)});V.createWithPreprocess=(r,e,t)=>new V({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,..._(t)});var O=class extends v{_parse(e){return this._getType(e)===m.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(O,"ZodOptional");O.create=(r,e)=>new O({innerType:r,typeName:y.ZodOptional,..._(e)});var Z=class extends v{_parse(e){return this._getType(e)===m.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(Z,"ZodNullable");Z.create=(r,e)=>new Z({innerType:r,typeName:y.ZodNullable,..._(e)});var ce=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};u(ce,"ZodDefault");ce.create=(r,e)=>new ce({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var he=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return De(n)?n.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};u(he,"ZodCatch");he.create=(r,e)=>new he({innerType:r,typeName:y.ZodCatch,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ye=class extends v{_parse(e){if(this._getType(e)!==m.nan){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}};u(ye,"ZodNaN");ye.create=r=>new ye({typeName:y.ZodNaN,..._(r)});var sr=Symbol("zod_brand"),Ce=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};u(Ce,"ZodBranded");var le=class extends v{_parse(e){let{status:t,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"?g:c.status==="dirty"?(t.dirty(),bt(c.value)):this._def.out._parseAsync({data:c.value,path:n.path,parent:n})},"handleAsync")();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?g:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new le({in:e,out:t,typeName:y.ZodPipeline})}};u(le,"ZodPipeline");var wt=u((r,e={},t)=>r?J.create().superRefine((n,s)=>{if(!r(n)){let c=typeof e=="function"?e(n):e,o=typeof c=="string"?{message:c}:c;s.addIssue({code:"custom",...o,fatal:t})}}):J.create(),"custom"),ir={object:k.lazycreate},y;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline"})(y||(y={}));var or=u((r,e={message:`Input not instance of ${r.name}`})=>wt(t=>t instanceof r,e,!0),"instanceOfType"),xt=D.create,Ct=M.create,cr=ye.create,lr=K.create,kt=Y.create,ur=z.create,dr=de.create,pr=X.create,fr=ee.create,mr=J.create,hr=W.create,yr=L.create,gr=pe.create,vr=N.create,br=k.create,_r=k.strictCreate,wr=te.create,xr=fe.create,Cr=re.create,kr=I.create,Tr=ne.create,Er=me.create,Pr=U.create,jr=H.create,Sr=ae.create,Nr=se.create,Vr=ie.create,Rr=oe.create,Ir=G.create,gt=V.create,Or=O.create,Ar=Z.create,Dr=V.createWithPreprocess,Lr=le.create,qr=u(()=>xt().optional(),"ostring"),Mr=u(()=>Ct().optional(),"onumber"),Br=u(()=>kt().optional(),"oboolean"),$r={string:r=>D.create({...r,coerce:!0}),number:r=>M.create({...r,coerce:!0}),boolean:r=>Y.create({...r,coerce:!0}),bigint:r=>K.create({...r,coerce:!0}),date:r=>z.create({...r,coerce:!0})},zr=g,a=Object.freeze({__proto__:null,defaultErrorMap:ke,setErrorMap:Yt,getErrorMap:Ie,makeIssue:Oe,EMPTY_PATH:Xt,addIssueToContext:h,ParseStatus:P,INVALID:g,DIRTY:bt,OK:j,isAborted:Ke,isDirty:Ye,isValid:Ae,isAsync:De,get util(){return x},ZodParsedType:m,getParsedType:Q,ZodType:v,ZodString:D,ZodNumber:M,ZodBigInt:K,ZodBoolean:Y,ZodDate:z,ZodSymbol:de,ZodUndefined:X,ZodNull:ee,ZodAny:J,ZodUnknown:W,ZodNever:L,ZodVoid:pe,ZodArray:N,get objectUtil(){return Le},ZodObject:k,ZodUnion:te,ZodDiscriminatedUnion:fe,ZodIntersection:re,ZodTuple:I,ZodRecord:ne,ZodMap:me,ZodSet:U,ZodFunction:H,ZodLazy:ae,ZodLiteral:se,ZodEnum:ie,ZodNativeEnum:oe,ZodPromise:G,ZodEffects:V,ZodTransformer:V,ZodOptional:O,ZodNullable:Z,ZodDefault:ce,ZodCatch:he,ZodNaN:ye,BRAND:sr,ZodBranded:Ce,ZodPipeline:le,custom:wt,Schema:v,ZodSchema:v,late:ir,get ZodFirstPartyTypeKind(){return y},coerce:$r,any:mr,array:vr,bigint:lr,boolean:kt,date:ur,discriminatedUnion:xr,effect:gt,enum:Vr,function:jr,instanceof:or,intersection:Cr,lazy:Sr,literal:Nr,map:Er,nan:cr,nativeEnum:Rr,never:yr,null:fr,nullable:Ar,number:Ct,object:br,oboolean:Br,onumber:Mr,optional:Or,ostring:qr,pipeline:Lr,preprocess:Dr,promise:Ir,record:Tr,set:Pr,strictObject:_r,string:xt,symbol:dr,transformer:gt,tuple:kr,undefined:pr,union:wr,unknown:hr,void:gr,NEVER:zr,ZodIssueCode:f,quotelessJson:Kt,ZodError:A});var qe=a.array(a.string().or(a.record(a.any()))),ka=a.object({type:a.string().optional(),narrative:a.string().optional()}),Me=a.string().or(a.object({id:a.string(),type:a.string(),caption:a.string().optional()})),Wr=a.object({type:a.string().min(1).or(a.string().array().nonempty()),latitude:a.number(),longitude:a.number()}),Ur=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:Wr.optional()}),Zr=a.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(a.string()),Et=a.object({type:a.string().min(1).or(a.string().array().nonempty()),identifier:a.string(),identifierType:Zr}),Te=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:Me.optional(),email:a.string().email().optional(),address:Ur.optional(),otherIdentifier:Et.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())),et=a.object({id:a.string().optional()}).catchall(a.any()),Fr=a.object({type:a.string(),id:a.string()}).catchall(a.any()),Jr=a.object({id:a.string(),type:a.string()}).catchall(a.any()),Hr=a.object({id:a.string(),type:a.string()}).catchall(a.any()),ve=a.object({"@context":qe,id:a.string().optional(),type:a.string().array().nonempty(),issuer:Te,issuanceDate:a.string(),expirationDate:a.string().optional(),credentialSubject:et.or(et.array()),credentialStatus:Fr.optional(),credentialSchema:Jr.array().optional(),refreshService:Hr.optional()}).catchall(a.any()),F=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()),Ee=ve.extend({proof:F.or(F.array())}),Gr=a.object({"@context":qe,id:a.string().optional(),type:a.string().or(a.string().array().nonempty()),verifiableCredential:Ee.or(Ee.array()).optional(),holder:a.string().optional()}).catchall(a.any()),rt=Gr.extend({proof:F.or(F.array())}),Pt=a.object({kty:a.string(),crv:a.string(),x:a.string(),y:a.string().optional(),n:a.string().optional(),d:a.string()}),Qr=a.object({alg:a.string(),iv:a.string(),tag:a.string(),epk:Pt.partial().optional(),kid:a.string().optional(),apv:a.string().optional(),apu:a.string().optional()}),Kr=a.object({header:Qr,encrypted_key:a.string()}),nt=a.object({protected:a.string(),iv:a.string(),ciphertext:a.string(),tag:a.string(),aad:a.string().optional(),recipients:Kr.array().optional()}),ge=a.string().or(a.object({"@context":qe.optional(),id:a.string(),type:a.string(),controller:a.string(),publicKeyJwk:Pt.optional(),publicKeyBase58:a.string().optional(),blockChainAccountId:a.string().optional()}).catchall(a.any())),Yr=a.object({id:a.string(),type:a.string().or(a.string().array().nonempty()),serviceEndpoint:a.any().or(a.any().array().nonempty())}).catchall(a.any()),Pa=a.object({"@context":qe,id:a.string(),alsoKnownAs:a.string().optional(),controller:a.string().or(a.string().array().nonempty()).optional(),verificationMethod:ge.array().optional(),authentication:ge.array().optional(),assertionMethod:ge.array().optional(),keyAgreement:ge.array().optional(),capabilityInvocation:ge.array().optional(),capabilityDelegation:ge.array().optional(),publicKey:ge.array().optional(),service:Yr.array().optional(),proof:F.or(F.array()).optional()}).catchall(a.any()),Xr=a.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(a.string()),Be=a.object({type:a.string().array().nonempty(),targetCode:a.string().optional(),targetDescription:a.string().optional(),targetName:a.string(),targetFramework:a.string().optional(),targetType:Xr.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"]),tn=en.or(a.string()),rn=a.object({id:a.string().optional(),narrative:a.string().optional()}).catchall(a.any()),nn=a.object({id:a.string(),type:a.string().array().nonempty(),endorsementComment:a.string().optional()}),an=ve.extend({credentialSubject:nn,proof:F.or(F.array()).optional()}),sn=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()),cn=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:Be.array().optional(),description:a.string().optional(),level:a.string().optional(),name:a.string(),points:a.string().optional()}).catchall(a.any()),ln=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:Be.array().optional(),allowedValue:a.string().array().optional(),name:a.string(),requiredLevel:a.string().optional(),requiredValue:a.string().optional(),resultType:on,rubricCriterionLevel:cn.array().optional(),valueMax:a.string().optional(),valueMin:a.string().optional()}).catchall(a.any()),un=a.object({id:a.string().optional(),type:a.string().array().nonempty(),alignment:Be.array().optional(),achievementType:tn.optional(),creator:Te.optional(),creditsAvailable:a.number().optional(),criteria:rn,description:a.string(),endorsement:an.array().optional(),fieldOfStudy:a.string().optional(),humanCode:a.string().optional(),image:Me.optional(),"@language":a.string().optional(),name:a.string(),otherIdentifier:Et.array().optional(),related:sn.array().optional(),resultDescription:ln.array().optional(),specialization:a.string().optional(),tag:a.string().array().optional(),version:a.string().optional()}).catchall(a.any()),dn=a.object({type:a.string(),hashed:a.boolean(),identityHash:a.string(),identityType:a.string(),salt:a.string().optional()}),pn=a.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),fn=a.object({type:a.string().array().nonempty(),achievedLevel:a.string().optional(),alignment:Be.array().optional(),resultDescription:a.string().optional(),status:pn.optional(),value:a.string().optional()}).catchall(a.any()),Tt=a.object({id:a.string().optional(),type:a.string().array().nonempty(),activityEndDate:a.string().optional(),activityStartDate:a.string().optional(),creditsEarned:a.number().optional(),achievement:un.optional(),identifier:dn.array().optional(),image:Me.optional(),licenseNumber:a.string().optional(),narrative:a.string().optional(),result:fn.array().optional(),role:a.string().optional(),source:Te.optional(),term:a.string().optional()}).catchall(a.any()),mn=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()),hn=ve.extend({name:a.string().optional(),description:a.string().optional(),image:Me.optional(),credentialSubject:Tt.or(Tt.array()),endorsement:ve.array().optional(),evidence:mn.array().optional()}),Sa=hn.extend({proof:F.or(F.array())}),Va=a.object({checks:a.string().array(),warnings:a.string().array(),errors:a.string().array()}),jt=a.enum(["Success","Failed","Error"]),Ra=jt.enum,Ia=a.object({check:a.string(),status:jt,message:a.string().optional(),details:a.string().optional()}),Oa=a.object({title:a.string().optional(),createdAt:a.string().optional(),issuer:Te.optional(),issuee:Te.optional(),credentialSubject:et.optional()}),Aa=a.object({id:a.string(),uri:a.string()}).catchall(a.any()),qa=a.object({limit:a.number(),cursor:a.string().optional(),sort:a.string().optional()}),be=a.object({cursor:a.string().optional(),hasMore:a.boolean()}),St=a.object({encryptedRecord:nt,fields:a.string().array()}).catchall(a.any()),Ma=be.extend({records:St.array()}),yn=St.extend({id:a.string()}),Ba=be.extend({records:yn.array()}),xe=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("https://").optional()}),za=be.extend({records:xe.array()}),Wa=a.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Ua=a.object({uri:a.string(),to:a.string(),from:a.string(),sent:a.string().datetime(),received:a.string().datetime().optional()}),gn=a.enum(["DRAFT","LIVE"]),Za=a.object({uri:a.string(),name:a.string().optional(),type:a.string().optional(),category:a.string().optional(),status:gn.optional(),autoConnectRecipients:a.boolean().optional()}),Fa=a.object({to:xe,from:a.string(),received:a.string().optional()}),Ja=a.object({endpoint:a.string(),name:a.string(),did:a.string().optional()}),Ha=a.object({ttlSeconds:a.number().optional(),totalUses:a.number().optional()}),vn=a.object({endpoint:a.string()}),Ga=a.object({signingAuthority:vn,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()})}),bn=a.enum(["live","stale","withdrawn"]),at=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({})}),Nt=a.object({contract:at,owner:xe,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()}),Qa=be.extend({records:Nt.omit({owner:!0}).array()}),_n=a.object({credentials:a.object({categories:a.record(a.string().array()).default({})}),personal:a.record(a.string()).default({}),date:a.string()}),Ka=be.extend({records:_n.array()}),Vt=a.object({sharing:a.boolean().optional(),shared:a.string().array().optional(),shareAll:a.boolean().optional(),shareUntil:a.string().optional()}),$e=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(Vt).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({})}),Ya=be.extend({records:a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:$e,contract:Nt,uri:a.string(),consenter:xe,status:bn}).array()}),Xa=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()}),es=a.object({anonymize:a.boolean().optional(),credentials:a.object({categories:a.record(a.boolean()).optional()}).optional(),personal:a.record(a.boolean()).optional()}),wn=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(Vt.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()}),tt=a.enum(["consent","update","sync","withdraw"]),ts=a.object({terms:wn.optional(),action:tt.or(tt.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()}),Rt=a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:$e.optional(),id:a.string(),action:tt,date:a.string()}),rs=be.extend({records:Rt.array()}),xn=a.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),Cn=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:Rt.optional()}),ns=a.object({type:xn,to:xe.partial().and(a.object({did:a.string()})),from:xe.partial().and(a.object({did:a.string()})),message:Cn.optional(),data:kn.optional(),sent:a.string().datetime().optional()});var Tn=u(async(r,e)=>{let t=r.id.did();r?.debug?.("Adding LearnCardNetwork Plugin");let n=await mt(e,async o=>{let i=await r.invoke.getDidAuthVp({proofFormat:"jwt",challenge:o});if(typeof i!="string")throw new Error("Error getting DID-Auth-JWT!");return i}),s;try{s=await n.profile.getProfile.query()}catch(o){r.debug?.("No profile!",o)}let c=s?.did||t;return{name:"LearnCard Network",displayName:"LearnCard Network",description:"LearnCard Network Integration",id:{did:(o,i)=>!i||i==="web"?c:r.id.did(i),keypair:(o,i)=>r.id.keypair(i)},read:{get:async(o,i)=>{if(o.debug?.("learnCard.read['LearnCard Network'].get"),!i)return;let l=i.split(":");if(l.length!==5)return;let[d,p]=l;if(!(d!=="lc"||p!=="network"))try{let b=await n.storage.resolve.query({uri:i});return"ciphertext"in b&&(b=await o.invoke.getDIDObject().decryptDagJWE(b)),await Ee.or(rt).parseAsync(b)}catch(b){o.debug?.(b);return}}},store:{upload:async(o,i)=>(o.debug?.("learnCard.store['LearnCard Network'].upload"),n.storage.store.mutate({item:i})),uploadEncrypted:async(o,i,{recipients:l=[]}={recipients:[]})=>{o.debug?.("learnCard.store['LearnCard Network'].upload");let d=await o.invoke.getDIDObject().createDagJWE(i,[o.id.did(),...l]);return n.storage.store.mutate({item:d})}},methods:{createProfile:async(o,i)=>{if(s)throw new Error("Account already exists!");let l=await n.profile.createProfile.mutate(i);return s=await n.profile.getProfile.query(),c=l,l},createServiceProfile:async(o,i)=>{if(s)throw new Error("Account already exists!");let l=await n.profile.createServiceProfile.mutate(i);return s=await n.profile.getProfile.query(),c=l,l},createManagedServiceProfile:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return await n.profile.createManagedServiceProfile.mutate(i)},getManagedServiceProfiles:async(o,i={})=>{if(!s)throw new Error("Please make an account first!");return n.profile.getManagedServiceProfiles.query(i)},updateProfile:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return await n.profile.updateProfile.mutate(i)?(s=await n.profile.getProfile.query(),!0):!1},deleteProfile:async()=>{if(!s)throw new Error("Account does not exist!");return await n.profile.deleteProfile.mutate()?(s=void 0,!0):!1},getProfile:async(o,i)=>i?n.profile.getOtherProfile.query({profileId:i}):n.profile.getProfile.query(),searchProfiles:async(o,i="",{limit:l=25,includeSelf:d=!1,includeConnectionStatus:p=!1,includeServiceProfiles:b=!1}={})=>n.profile.searchProfiles.query({input:i,limit:l,includeSelf:d,includeConnectionStatus:p,includeServiceProfiles:b}),connectWith:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectWith.mutate({profileId:i})},cancelConnectionRequest:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.cancelConnectionRequest.mutate({profileId:i})},connectWithInvite:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectWithInvite.mutate({profileId:i,challenge:l})},disconnectWith:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.disconnectWith.mutate({profileId:i})},acceptConnectionRequest:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.acceptConnectionRequest.mutate({profileId:i})},getConnections:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.connections.query()},getPendingConnections:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.pendingConnections.query()},getConnectionRequests:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectionRequests.query()},generateInvite:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.generateInvite.mutate({challenge:i,expiration:l})},blockProfile:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.blockProfile.mutate({profileId:i})},unblockProfile:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.unblockProfile.mutate({profileId:i})},getBlockedProfiles:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.blocked.query()},sendCredential:async(o,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");if(!d)return n.credential.sendCredential.mutate({profileId:i,credential:l});let p=await o.invoke.getProfile(i);if(!p)throw new Error("Could not find target account");let b=await o.invoke.getDIDObject().createDagJWE(l,[s.did,p.did]);return n.credential.sendCredential.mutate({profileId:i,credential:b})},acceptCredential:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.acceptCredential.mutate({uri:i})},getReceivedCredentials:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.receivedCredentials.query({from:i})},getSentCredentials:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.sentCredentials.query({to:i})},getIncomingCredentials:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.incomingCredentials.query({from:i})},deleteCredential:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.deleteCredential.mutate({uri:i})},sendPresentation:async(o,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");if(!d)return n.presentation.sendPresentation.mutate({profileId:i,presentation:l});let p=await o.invoke.getProfile(i);if(!p)throw new Error("Could not find target account");let b=await o.invoke.getDIDObject().createDagJWE(l,[s.did,p.did]);return n.presentation.sendPresentation.mutate({profileId:i,presentation:b})},acceptPresentation:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.acceptPresentation.mutate({uri:i})},getReceivedPresentations:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.receivedPresentations.query({from:i})},getSentPresentations:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.sentPresentations.query({to:i})},getIncomingPresentations:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.incomingPresentations.query({from:i})},deletePresentation:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.deletePresentation.mutate({uri:i})},createBoost:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.createBoost.mutate({credential:i,...l})},getBoost:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoost.query({uri:i})},getBoosts:async()=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoosts.query()},getBoostRecipients:async(o,i,l=25,d=void 0,p=!0)=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoostRecipients.query({uri:i,limit:l,skip:d,includeUnacceptedBoosts:p})},updateBoost:async(o,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.boost.updateBoost.mutate({uri:i,updates:{credential:d,...l}})},getBoostAdmins:async(o,i,l={})=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoostAdmins.query({uri:i,...l})},addBoostAdmin:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.addBoostAdmin.mutate({uri:i,profileId:l})},removeBoostAdmin:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.removeBoostAdmin.mutate({uri:i,profileId:l})},deleteBoost:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.boost.deleteBoost.mutate({uri:i})},sendBoost:async(o,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");let p=await o.invoke.resolveFromLCN(l),b=await ve.spa(p);if(!b.success)throw new Error("Did not get a valid boost from URI");let C=await o.invoke.getProfile(i);if(!C)throw new Error("Target profile not found");let T=b.data;T.issuanceDate=new Date().toISOString(),T.issuer=o.id.did(),Array.isArray(T.credentialSubject)?T.credentialSubject=T.credentialSubject.map(B=>({...B,id:C.did})):T.credentialSubject.id=C.did,T?.type?.includes("BoostCredential")&&(T.boostId=l);let S=await o.invoke.issueCredential(T);if(!d)return n.boost.sendBoost.mutate({profileId:i,uri:l,credential:S});let q=await n.utilities.getDid.query(),ue=await o.invoke.getDIDObject().createDagJWE(S,[s.did,C.did,q]);return n.boost.sendBoost.mutate({profileId:i,uri:l,credential:ue})},registerSigningAuthority:async(o,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.profile.registerSigningAuthority.mutate({endpoint:i,name:l,did:d})},getRegisteredSigningAuthorities:async(o,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.profile.signingAuthorities.query()},getRegisteredSigningAuthority:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.signingAuthority.query({endpoint:i,name:l})},generateClaimLink:async(o,i,l,d,p)=>{if(!s)throw new Error("Please make an account first!");return n.boost.generateClaimLink.mutate({boostUri:i,claimLinkSA:l,options:d,challenge:p})},claimBoostWithLink:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.claimBoostWithLink.mutate({boostUri:i,challenge:l})},createContract:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.createConsentFlowContract.mutate(i)},getContract:async(o,i)=>n.contracts.getConsentFlowContract.query({uri:i}),getContracts:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentFlowContracts.query(i)},deleteContract:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.deleteConsentFlowContract.mutate({uri:i})},getConsentFlowData:async(o,i,l={})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedDataForContract.query({uri:i,...l})},getAllConsentFlowData:async(o,i={},l={})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedData.query({query:i,...l})},consentToContract:async(o,i,{terms:l,expiresAt:d,oneTime:p})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.consentToContract.mutate({contractUri:i,terms:l,expiresAt:d,oneTime:p})},getConsentedContracts:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedContracts.query(i)},updateContractTerms:async(o,i,{terms:l,expiresAt:d,oneTime:p})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.updateConsentedContractTerms.mutate({uri:i,terms:l,expiresAt:d,oneTime:p})},withdrawConsent:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.withdrawConsent.mutate({uri:i})},getConsentFlowTransactions:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getTermsTransactionHistory.query({uri:i,...l})},verifyConsent:async(o,i,l)=>n.contracts.verifyConsent.query({uri:i,profileId:l}),resolveFromLCN:async(o,i)=>{let l=await n.storage.resolve.query({uri:i});return ve.or(Ee).or(rt).or(nt).or(at).or($e).parseAsync(l)}}}},"getLearnCardNetworkPlugin"),En=u(async(r,e)=>{let t=[{id:"LearnCard Network",url:"https://network.learncard.com",did:"did:web:network.learncard.com"}],n;if(e){let o=await fetch(e);o.status===200?n=JSON.parse(await o.text()):n=t}else n=t;let s=u(o=>{if(!!o)return typeof o=="string"?o:"id"in o&&typeof o.id=="string"?o.id:void 0},"getIssuerDID"),c=u(o=>{let i=s(o);if(!!i)return n.find(l=>l.did===i)},"getTrustedBoostVerifier");return{name:"VerifyBoost",displayName:"Verify Boost Extension",description:"Adds a check for validating Boost Credentials.",methods:{verifyCredential:async(o,i,l)=>{let d=await r.invoke.verifyCredential(i,l),p=i?.boostCredential;try{if(p){let b=await r.invoke.verifyCredential(p);if(!p?.boostId&&!i?.boostId&&d.warnings.push("Boost Authenticity could not be verified: Boost ID metadata is missing."),b.errors?.length>0)d.errors=[...b.errors||[],...d.errors||[],"Boost Credential could not be verified."];else if(p?.boostId!==i?.boostId)d.errors.push("Boost Authenticity could not be verified: Boost ID metadata is mismatched.");else{let C=c(i?.issuer);C?d.checks.push(`Boost is Authentic. Verified by ${C.id}.`):d.warnings.push(`Boost Authenticity could not be verified. Issuer is outside of trust network: ${s(i?.issuer)}`)}}}catch{d.errors.push("Boost authenticity could not be verified.")}return d}}}},"getVerifyBoostPlugin");
|
|
1
|
+
var je=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Dt=Object.prototype.hasOwnProperty;var u=(r,e)=>je(r,"name",{value:e,configurable:!0});var Lt=(r,e)=>{for(var t in e)je(r,t,{get:e[t],enumerable:!0})},qt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of At(e))!Dt.call(r,s)&&s!==t&&je(r,s,{get:()=>e[s],enumerable:!(n=Ot(e,s))||n.enumerable});return r};var Mt=r=>qt(je({},"__esModule",{value:!0}),r);var jn={};Lt(jn,{getLearnCardNetworkPlugin:()=>Tn,getVerifyBoostPlugin:()=>En});module.exports=Mt(jn);function Bt(r){return r}u(Bt,"identity");function $t(r){return r.length===0?Bt:r.length===1?r[0]:u(function(t){return r.reduce((n,s)=>s(n),t)},"piped")}u($t,"pipeFromArray");function $(r){let e={subscribe(t){let n=null,s=!1,c=!1,o=!1;function i(){if(n===null){o=!0;return}c||(c=!0,typeof n=="function"?n():n&&n.unsubscribe())}return u(i,"unsubscribe"),n=r({next(l){s||t.next?.(l)},error(l){s||(s=!0,t.error?.(l),i())},complete(){s||(s=!0,t.complete?.(),i())}}),o&&i(),{unsubscribe:i}},pipe(...t){return $t(t)(e)}};return e}u($,"observable");function st(r){return e=>{let t=0,n=null,s=[];function c(){n||(n=e.subscribe({next(i){for(let l of s)l.next?.(i)},error(i){for(let l of s)l.error?.(i)},complete(){for(let i of s)i.complete?.()}}))}u(c,"startIfNeeded");function o(){if(t===0&&n){let i=n;n=null,i.unsubscribe()}}return u(o,"resetIfNeeded"),{subscribe(i){return t++,s.push(i),c(),{unsubscribe(){t--,o();let l=s.findIndex(d=>d===i);l>-1&&s.splice(l,1)}}}}}}u(st,"share");var _e=class extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,_e.prototype)}};u(_e,"ObservableAbortError");function it(r){let e;return{promise:new Promise((n,s)=>{let c=!1;function o(){c||(c=!0,s(new _e("This operation was aborted.")),i.unsubscribe())}u(o,"onDone");let i=r.subscribe({next(l){c=!0,n(l),o()},error(l){c=!0,s(l),o()},complete(){c=!0,o()}});e=o}),abort:e}}u(it,"observableToPromise");var E=class extends Error{static from(e,t={}){return e instanceof Error?e.name==="TRPCClientError"?e:new E(e.message,{...t,cause:e,result:null}):new E(e.error.message??"",{...t,cause:void 0,result:e})}constructor(e,t){let n=t?.cause;super(e,{cause:n}),this.meta=t?.meta,this.cause=n,this.shape=t?.result?.error,this.data=t?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,E.prototype)}};u(E,"TRPCClientError");function zt(r,e){if("error"in r){let n=e.transformer.deserialize(r.error);return{ok:!1,error:{...r,error:n}}}let t={...r.result,...(!r.result.type||r.result.type==="data")&&{type:"data",data:e.transformer.deserialize(r.result.data)}};return{ok:!0,result:t}}u(zt,"transformResultInner");function ot(r){return!!r&&!Array.isArray(r)&&typeof r=="object"}u(ot,"isObject");function Pe(r,e){let t;try{t=zt(r,e)}catch{throw new E("Unable to transform response from server")}if(!t.ok&&(!ot(t.error.error)||typeof t.error.error.code!="number"))throw new E("Badly formatted response from server");if(t.ok&&!ot(t.result))throw new E("Badly formatted response from server");return t}u(Pe,"transformResult");function ct(r){return $(e=>{function t(s=0,c=r.op){let o=r.links[s];if(!o)throw new Error("No more links to execute - did you forget to add an ending link?");return o({op:c,next(l){return t(s+1,l)}})}return u(t,"execute"),t().subscribe(e)})}u(ct,"createChain");var lt=u(()=>{},"noop");function ut(r,e){return new Proxy(lt,{get(n,s){if(!(typeof s!="string"||s==="then"))return ut(r,[...e,s])},apply(n,s,c){return r({args:c,path:e})}})}u(ut,"createInnerProxy");var ze=u(r=>ut(r,[]),"createRecursiveProxy"),We=u(r=>new Proxy(lt,{get(e,t){if(!(typeof t!="string"||t==="then"))return r(t)}}),"createFlatProxy");var Ue=u(r=>typeof r=="function","isFunction");function dt(r,e){return Ue(r.bind)?r.bind(e):r}u(dt,"_bind");function pt(r){if(r)return r;if(typeof window<"u"&&Ue(window.fetch))return dt(window.fetch,window);if(typeof globalThis<"u"&&Ue(globalThis.fetch))return dt(globalThis.fetch,globalThis);throw new Error("No fetch implementation found")}u(pt,"getFetch");function Wt(r){return r||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}u(Wt,"getAbortController");function Ze(r){let e=r.headers||(()=>({}));return{url:r.url,fetch:pt(r.fetch),AbortController:Wt(r.AbortController),headers:typeof e=="function"?e:()=>e}}u(Ze,"resolveHTTPLinkOptions");function Ut(r){let e={};for(let t=0;t<r.length;t++){let n=r[t];e[t]=n}return e}u(Ut,"arrayToDict");var Zt={query:"GET",mutation:"POST"};function ft(r){return"input"in r?r.runtime.transformer.serialize(r.input):Ut(r.inputs.map(e=>r.runtime.transformer.serialize(e)))}u(ft,"getInput");function Fe(r){let e=r.url+"/"+r.path,t=[];if("inputs"in r&&t.push("batch=1"),r.type==="query"){let n=ft(r);n!==void 0&&t.push(`input=${encodeURIComponent(JSON.stringify(n))}`)}return t.length&&(e+="?"+t.join("&")),e}u(Fe,"getUrl");function Ft(r){if(r.type==="query")return;let e=ft(r);return e!==void 0?JSON.stringify(e):void 0}u(Ft,"getBody");function Je(r){let{type:e}=r,t=r.AbortController?new r.AbortController:null;return{promise:new Promise((c,o)=>{let i=Fe(r),l=Ft(r),d={};Promise.resolve(r.headers()).then(p=>{if(e==="subscription")throw new Error("Subscriptions should use wsLink");return r.fetch(i,{method:Zt[e],signal:t?.signal,body:l,headers:{"content-type":"application/json",...p}})}).then(p=>(d.response=p,p.json())).then(p=>{c({json:p,meta:d})}).catch(o)}),cancel:u(()=>{t?.abort()},"cancel")}}u(Je,"httpRequest");var He=u(()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")},"throwFatalError");function Ge(r){let e=null,t=null,n=u(()=>{clearTimeout(t),t=null,e=null},"destroyTimerAndPendingItems");function s(i){let l=[[]],d=0;for(;;){let p=i[d];if(!p)break;let b=l[l.length-1];if(p.aborted){p.reject(new Error("Aborted")),d++;continue}if(r.validate(b.concat(p).map(k=>k.key))){b.push(p),d++;continue}if(b.length===0){p.reject(new Error("Input is too big for a single dispatch")),d++;continue}l.push([])}return l}u(s,"groupItems");function c(){let i=s(e);n();for(let l of i){if(!l.length)continue;let d={items:l,cancel:He};for(let C of l)C.batch=d;let{promise:p,cancel:b}=r.fetch(d.items.map(C=>C.key));d.cancel=b,p.then(C=>{for(let k=0;k<C.length;k++){let S=C[k],q=d.items[k];q.resolve(S),q.batch=null}}).catch(C=>{for(let k of d.items)k.reject(C),k.batch=null})}}u(c,"dispatch");function o(i){let l={aborted:!1,key:i,batch:null,resolve:He,reject:He},d=new Promise((b,C)=>{l.reject=C,l.resolve=b,e||(e=[]),e.push(l)});return t||(t=setTimeout(c)),{promise:d,cancel:u(()=>{l.aborted=!0,l.batch?.items.every(b=>b.aborted)&&(l.batch.cancel(),l.batch=null)},"cancel")}}return u(o,"load"),{load:o}}u(Ge,"dataLoader");function Se(r){let e=Ze(r);return t=>{let n=r.maxURLLength||1/0,s=u(d=>({validate:u(C=>{if(n===1/0)return!0;let k=C.map(ue=>ue.path).join(","),S=C.map(ue=>ue.input);return Fe({...e,runtime:t,type:d,path:k,inputs:S}).length<=n},"validate"),fetch:u(C=>{let k=C.map(B=>B.path).join(","),S=C.map(B=>B.input),{promise:q,cancel:ue}=Je({...e,runtime:t,type:d,path:k,inputs:S});return{promise:q.then(B=>(Array.isArray(B.json)?B.json:C.map(()=>B.json)).map(It=>({meta:B.meta,json:It}))),cancel:ue}},"fetch")}),"batchLoader"),c=Ge(s("query")),o=Ge(s("mutation")),i=Ge(s("subscription")),l={query:c,subscription:i,mutation:o};return({op:d})=>$(p=>{let b=l[d.type],{promise:C,cancel:k}=b.load(d);return C.then(S=>{let q=Pe(S.json,t);if(!q.ok){p.error(E.from(q.error,{meta:S.meta}));return}p.next({context:S.meta,result:q.result}),p.complete()}).catch(S=>p.error(E.from(S))),()=>{k()}})}}u(Se,"httpBatchLink");var Ne=class{$request({type:e,input:t,path:n,context:s={}}){return ct({links:this.links,op:{id:++this.requestId,type:e,path:n,input:t,context:s}}).pipe(st())}requestAsPromise(e){let t=this.$request(e),{promise:n,abort:s}=it(t);return new Promise((o,i)=>{e.signal?.addEventListener("abort",s),n.then(l=>{o(l.result.data)}).catch(l=>{i(E.from(l))})})}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,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;function t(){let n=e.transformer;return n?"input"in n?{serialize:n.input.serialize,deserialize:n.output.deserialize}:n:{serialize:s=>s,deserialize:s=>s}}u(t,"getTransformer"),this.runtime={transformer:t()},this.links=e.links.map(n=>n(this.runtime))}};u(Ne,"TRPCUntypedClient");var Jt={query:"query",mutate:"mutation",subscribe:"subscription"};function Ht(r){return We(e=>r.hasOwnProperty(e)?r[e]:ze(({path:t,args:n})=>{let s=[e,...t],c=s.pop(),o=Jt[c],i=s.join(".");return r[o](i,...n)}))}u(Ht,"createTRPCClientProxy");function Qe(r){let e=new Ne(r);return Ht(e)}u(Qe,"createTRPCProxyClient");var Gt=Object.defineProperty,Ve=u((r,e)=>Gt(r,"name",{value:e,configurable:!0}),"__name"),Qt=Ve(r=>()=>({next:e,op:t})=>$(n=>{let s=null,c=0,o=!1,i=Ve(()=>{c+=1,s?.unsubscribe(),s=e(t).subscribe({error:async l=>{if(c>5||l.data?.httpStatus!==401)return n.error(l);await r(),i()},next:l=>n.next(l),complete:()=>{o&&n.complete()}})},"attempt");return i(),()=>{o=!0,s?.unsubscribe()}}),"callbackLink"),mt=Ve(async(r,e)=>{let t=[],n=Qe({links:[Se({url:r,headers:{Authorization:`Bearer ${await e()}`}})]}),s=Ve(async(o=95+Math.round((Math.random()-.5)*5))=>n.utilities.getChallenges.query({amount:o}),"getChallenges");return t=await s(),Qe({links:[Qt(async()=>{t=await s()}),Se({url:r,headers:async()=>(t.length===0&&t.push(...await s()),{Authorization:`Bearer ${await e(t.pop())}`})})]})},"getClient");var x;(function(r){r.assertEqual=s=>s;function e(s){}u(e,"assertIs"),r.assertIs=e;function t(s){throw new Error}u(t,"assertNever"),r.assertNever=t,r.arrayToEnum=s=>{let c={};for(let o of s)c[o]=o;return c},r.getValidEnumValues=s=>{let c=r.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),o={};for(let i of c)o[i]=s[i];return r.objectValues(o)},r.objectValues=s=>r.objectKeys(s).map(function(c){return s[c]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let c=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&c.push(o);return c},r.find=(s,c)=>{for(let o of s)if(c(o))return o},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,c=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(c)}u(n,"joinValues"),r.joinValues=n,r.jsonStringifyReplacer=(s,c)=>typeof c=="bigint"?c.toString():c})(x||(x={}));var m=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Q=u(r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(r)?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(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},"getParsedType"),f=x.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"]),Kt=u(r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),A=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 t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(c){return c.message},n={_errors:[]},s=u(c=>{for(let o of c.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let i=n,l=0;for(;l<o.path.length;){let d=o.path[l];l===o.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(t(o))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}},"processError");return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};u(A,"ZodError");A.create=r=>new A(r);var ke=u((r,e)=>{let t;switch(r.code){case f.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.invalid_string:typeof r.validation=="object"?"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case f.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(r.minimum)}`:t="Invalid input";break;case f.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(r.maximum)}`:t="Invalid input";break;case f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}},"errorMap"),vt=ke;function Yt(r){vt=r}u(Yt,"setErrorMap");function Ie(){return vt}u(Ie,"getErrorMap");var Oe=u(r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,c=[...t,...s.path||[]],o={...s,path:c},i="",l=n.filter(d=>!!d).slice().reverse();for(let d of l)i=d(o,{data:e,defaultError:i}).message;return{...s,path:c,message:s.message||i}},"makeIssue"),Xt=[];function h(r,e){let t=Oe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ie(),ke].filter(n=>!!n)});r.common.issues.push(t)}u(h,"addIssueToContext");var j=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return g;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t)n.push({key:await s.key,value:await s.value});return j.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:c,value:o}=s;if(c.status==="aborted"||o.status==="aborted")return g;c.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),(typeof o.value<"u"||s.alwaysSet)&&(n[c.value]=o.value)}return{status:e.value,value:n}}};u(j,"ParseStatus");var g=Object.freeze({status:"aborted"}),bt=u(r=>({status:"dirty",value:r}),"DIRTY"),P=u(r=>({status:"valid",value:r}),"OK"),Ke=u(r=>r.status==="aborted","isAborted"),Ye=u(r=>r.status==="dirty","isDirty"),Ae=u(r=>r.status==="valid","isValid"),De=u(r=>typeof Promise!==void 0&&r instanceof Promise,"isAsync"),w;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(w||(w={}));var R=class{constructor(e,t,n,s){this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._path.concat(this._key)}};u(R,"ParseInputLazyPath");var ht=u((r,e)=>{if(Ae(e))return{success:!0,data:e.value};{if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");let t=new A(r.common.issues);return{success:!1,error:t}}},"handleResult");function _(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:u((o,i)=>o.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},"customMap"),description:s}}u(_,"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 Q(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new j,ctx:{common:e.parent.common,data:e.data,parsedType:Q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(De(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Q(e)},c=this._parseSync({data:e,path:s.path,parent:s});return ht(s,c)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Q(e)},s=this._parse({data:e,path:n.path,parent:n}),c=await(De(s)?s:Promise.resolve(s));return ht(n,c)}refine(e,t){let n=u(s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t,"getIssueProperties");return this._refinement((s,c)=>{let o=e(s),i=u(()=>c.addIssue({code:f.custom,...n(s)}),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new V({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return O.create(this)}nullable(){return Z.create(this)}nullish(){return this.optional().nullable()}array(){return N.create(this)}promise(){return G.create(this)}or(e){return te.create([this,e])}and(e){return re.create(this,e)}transform(e){return new V({schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ce({innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Ce({typeName:y.ZodBranded,type:this,..._(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new he({innerType:this,defaultValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return le.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u(v,"ZodType");var er=/^c[^\s-]{8,}$/i,tr=/^([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,rr=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,nr=u(r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.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$"):r.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"),D=class extends v{constructor(){super(...arguments),this._regex=(e,t,n)=>this.refinement(s=>e.test(s),{validation:t,code:f.invalid_string,...w.errToObj(n)}),this.nonempty=e=>this.min(1,w.errToObj(e)),this.trim=()=>new D({...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:f.invalid_type,expected:m.string,received:c.parsedType}),g}let n=new j,s;for(let c of this._def.checks)if(c.kind==="min")e.data.length<c.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.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&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="length"){let o=e.data.length>c.value,i=e.data.length<c.value;(o||i)&&(s=this._getOrReturnCtx(e,s),o?h(s,{code:f.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):i&&h(s,{code:f.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),n.dirty())}else if(c.kind==="email")rr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:f.invalid_string,message:c.message}),n.dirty());else if(c.kind==="uuid")tr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:f.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid")er.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:f.invalid_string,message:c.message}),n.dirty());else if(c.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),h(s,{validation:"url",code:f.invalid_string,message:c.message}),n.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"regex",code:f.invalid_string,message:c.message}),n.dirty())):c.kind==="trim"?e.data=e.data.trim():c.kind==="startsWith"?e.data.startsWith(c.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:{startsWith:c.value},message:c.message}),n.dirty()):c.kind==="endsWith"?e.data.endsWith(c.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:{endsWith:c.value},message:c.message}),n.dirty()):c.kind==="datetime"?nr(c).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:"datetime",message:c.message}),n.dirty()):x.assertNever(c);return{status:n.value,value:e.data}}_addCheck(e){return new D({...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 t;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:(t=e?.offset)!==null&&t!==void 0?t:!1,...w.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.errToObj(t)})}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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};u(D,"ZodString");D.create=r=>{var e;return new D({checks:[],typeName:y.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function ar(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,c=parseInt(r.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return c%o/Math.pow(10,s)}u(ar,"floatSafeRemainder");var M=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:f.invalid_type,expected:m.number,received:c.parsedType}),g}let n,s=new j;for(let c of this._def.checks)c.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.invalid_type,expected:"integer",received:"float",message:c.message}),s.dirty()):c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),s.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),s.dirty()):c.kind==="multipleOf"?ar(e.data,c.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_multiple_of,multipleOf:c.value,message:c.message}),s.dirty()):c.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_finite,message:c.message}),s.dirty()):x.assertNever(c);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,n,s){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:w.toString(s)}]})}_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,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};u(M,"ZodNumber");M.create=r=>new M({checks:[],typeName:y.ZodNumber,coerce:r?.coerce||!1,..._(r)});var K=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:f.invalid_type,expected:m.bigint,received:n.parsedType}),g}return P(e.data)}};u(K,"ZodBigInt");K.create=r=>{var e;return new K({typeName:y.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};var Y=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:f.invalid_type,expected:m.boolean,received:n.parsedType}),g}return P(e.data)}};u(Y,"ZodBoolean");Y.create=r=>new Y({typeName:y.ZodBoolean,coerce:r?.coerce||!1,..._(r)});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:f.invalid_type,expected:m.date,received:c.parsedType}),g}if(isNaN(e.data.getTime())){let c=this._getOrReturnCtx(e);return h(c,{code:f.invalid_date}),g}let n=new j,s;for(let c of this._def.checks)c.kind==="min"?e.data.getTime()<c.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),n.dirty()):c.kind==="max"?e.data.getTime()>c.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),n.dirty()):x.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,t){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};u(z,"ZodDate");z.create=r=>new z({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,..._(r)});var de=class extends v{_parse(e){if(this._getType(e)!==m.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.symbol,received:n.parsedType}),g}return P(e.data)}};u(de,"ZodSymbol");de.create=r=>new de({typeName:y.ZodSymbol,..._(r)});var X=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.undefined,received:n.parsedType}),g}return P(e.data)}};u(X,"ZodUndefined");X.create=r=>new X({typeName:y.ZodUndefined,..._(r)});var ee=class extends v{_parse(e){if(this._getType(e)!==m.null){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.null,received:n.parsedType}),g}return P(e.data)}};u(ee,"ZodNull");ee.create=r=>new ee({typeName:y.ZodNull,..._(r)});var J=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return P(e.data)}};u(J,"ZodAny");J.create=r=>new J({typeName:y.ZodAny,..._(r)});var W=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return P(e.data)}};u(W,"ZodUnknown");W.create=r=>new W({typeName:y.ZodUnknown,..._(r)});var L=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_type,expected:m.never,received:t.parsedType}),g}};u(L,"ZodNever");L.create=r=>new L({typeName:y.ZodNever,..._(r)});var pe=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.void,received:n.parsedType}),g}return P(e.data)}};u(pe,"ZodVoid");pe.create=r=>new pe({typeName:y.ZodVoid,..._(r)});var N=class extends v{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return h(t,{code:f.invalid_type,expected:m.array,received:t.parsedType}),g;if(s.exactLength!==null){let o=t.data.length>s.exactLength.value,i=t.data.length<s.exactLength.value;(o||i)&&(h(t,{code:o?f.too_big:f.too_small,minimum:i?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(h(t,{code:f.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(h(t,{code:f.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all(t.data.map((o,i)=>s.type._parseAsync(new R(t,o,t.path,i)))).then(o=>j.mergeArray(n,o));let c=t.data.map((o,i)=>s.type._parseSync(new R(t,o,t.path,i)));return j.mergeArray(n,c)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:w.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:w.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:w.toString(t)}})}nonempty(e){return this.min(1,e)}};u(N,"ZodArray");N.create=(r,e)=>new N({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});var Le;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Le||(Le={}));var yt=u(r=>e=>new T({...r,shape:()=>({...r.shape(),...e})}),"AugmentFactory");function we(r){if(r instanceof T){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=O.create(we(n))}return new T({...r._def,shape:()=>e})}else return r instanceof N?N.create(we(r.element)):r instanceof O?O.create(we(r.unwrap())):r instanceof Z?Z.create(we(r.unwrap())):r instanceof I?I.create(r.items.map(e=>we(e))):r}u(we,"deepPartialify");var T=class extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=yt(this._def),this.extend=yt(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){let d=this._getOrReturnCtx(e);return h(d,{code:f.invalid_type,expected:m.object,received:d.parsedType}),g}let{status:n,ctx:s}=this._processInputParams(e),{shape:c,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let d in s.data)o.includes(d)||i.push(d);let l=[];for(let d of o){let p=c[d],b=s.data[d];l.push({key:{status:"valid",value:d},value:p._parse(new R(s,b,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof L){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of i)l.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")i.length>0&&(h(s,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of i){let b=s.data[p];l.push({key:{status:"valid",value:p},value:d._parse(new R(s,b,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of l){let b=await p.key;d.push({key:b,value:await p.value,alwaysSet:p.alwaysSet})}return d}).then(d=>j.mergeObjectSync(n,d)):j.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new T({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,c,o,i;let l=(o=(c=(s=this._def).errorMap)===null||c===void 0?void 0:c.call(s,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(i=w.errToObj(e).message)!==null&&i!==void 0?i:l}:{message:l}}}:{}})}strip(){return new T({...this._def,unknownKeys:"strip"})}passthrough(){return new T({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new T({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>Le.mergeShapes(this._def.shape(),e._def.shape()),typeName:y.ZodObject})}catchall(e){return new T({...this._def,catchall:e})}pick(e){let t={};return x.objectKeys(e).map(n=>{this.shape[n]&&(t[n]=this.shape[n])}),new T({...this._def,shape:()=>t})}omit(e){let t={};return x.objectKeys(this.shape).map(n=>{x.objectKeys(e).indexOf(n)===-1&&(t[n]=this.shape[n])}),new T({...this._def,shape:()=>t})}deepPartial(){return we(this)}partial(e){let t={};if(e)return x.objectKeys(this.shape).map(n=>{x.objectKeys(e).indexOf(n)===-1?t[n]=this.shape[n]:t[n]=this.shape[n].optional()}),new T({...this._def,shape:()=>t});for(let n in this.shape){let s=this.shape[n];t[n]=s.optional()}return new T({...this._def,shape:()=>t})}required(e){let t={};if(e)x.objectKeys(this.shape).map(n=>{if(x.objectKeys(e).indexOf(n)===-1)t[n]=this.shape[n];else{let c=this.shape[n];for(;c instanceof O;)c=c._def.innerType;t[n]=c}});else for(let n in this.shape){let c=this.shape[n];for(;c instanceof O;)c=c._def.innerType;t[n]=c}return new T({...this._def,shape:()=>t})}keyof(){return _t(x.objectKeys(this.shape))}};u(T,"ZodObject");T.create=(r,e)=>new T({shape:()=>r,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});T.strictCreate=(r,e)=>new T({shape:()=>r,unknownKeys:"strict",catchall:L.create(),typeName:y.ZodObject,..._(e)});T.lazycreate=(r,e)=>new T({shape:r,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});var te=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(c){for(let i of c)if(i.result.status==="valid")return i.result;for(let i of c)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=c.map(i=>new A(i.ctx.common.issues));return h(t,{code:f.invalid_union,unionErrors:o}),g}if(u(s,"handleResults"),t.common.async)return Promise.all(n.map(async c=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await c._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(s);{let c,o=[];for(let l of n){let d={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!c&&(c={result:p,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(c)return t.common.issues.push(...c.ctx.common.issues),c.result;let i=o.map(l=>new A(l));return h(t,{code:f.invalid_union,unionErrors:i}),g}}get options(){return this._def.options}};u(te,"ZodUnion");te.create=(r,e)=>new te({options:r,typeName:y.ZodUnion,..._(e)});var Re=u(r=>r instanceof ae?Re(r.schema):r instanceof V?Re(r.innerType()):r instanceof se?[r.value]:r instanceof ie?r.options:r instanceof oe?Object.keys(r.enum):r instanceof ce?Re(r._def.innerType):r instanceof X?[void 0]:r instanceof ee?[null]:null,"getDiscriminator"),fe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return h(t,{code:f.invalid_type,expected:m.object,received:t.parsedType}),g;let n=this.discriminator,s=t.data[n],c=this.optionsMap.get(s);return c?t.common.async?c._parseAsync({data:t.data,path:t.path,parent:t}):c._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let c of t){let o=Re(c.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(s.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,c)}}return new fe({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}};u(fe,"ZodDiscriminatedUnion");function Xe(r,e){let t=Q(r),n=Q(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){let s=x.objectKeys(e),c=x.objectKeys(r).filter(i=>s.indexOf(i)!==-1),o={...r,...e};for(let i of c){let l=Xe(r[i],e[i]);if(!l.valid)return{valid:!1};o[i]=l.data}return{valid:!0,data:o}}else if(t===m.array&&n===m.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let c=0;c<r.length;c++){let o=r[c],i=e[c],l=Xe(o,i);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}u(Xe,"mergeValues");var re=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=u((c,o)=>{if(Ke(c)||Ke(o))return g;let i=Xe(c.value,o.value);return i.valid?((Ye(c)||Ye(o))&&t.dirty(),{status:t.value,value:i.data}):(h(n,{code:f.invalid_intersection_types}),g)},"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,o])=>s(c,o)):s(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(re,"ZodIntersection");re.create=(r,e,t)=>new re({left:r,right:e,typeName:y.ZodIntersection,..._(t)});var I=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:f.invalid_type,expected:m.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return h(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let c=n.data.map((o,i)=>{let l=this._def.items[i]||this._def.rest;return l?l._parse(new R(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(c).then(o=>j.mergeArray(t,o)):j.mergeArray(t,c)}get items(){return this._def.items}rest(e){return new I({...this._def,rest:e})}};u(I,"ZodTuple");I.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({items:r,typeName:y.ZodTuple,rest:null,..._(e)})};var ne=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return h(n,{code:f.invalid_type,expected:m.object,received:n.parsedType}),g;let s=[],c=this._def.keyType,o=this._def.valueType;for(let i in n.data)s.push({key:c._parse(new R(n,i,n.path,i)),value:o._parse(new R(n,n.data[i],n.path,i))});return n.common.async?j.mergeObjectAsync(t,s):j.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof v?new ne({keyType:e,valueType:t,typeName:y.ZodRecord,..._(n)}):new ne({keyType:D.create(),valueType:e,typeName:y.ZodRecord,..._(t)})}};u(ne,"ZodRecord");var me=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:f.invalid_type,expected:m.map,received:n.parsedType}),g;let s=this._def.keyType,c=this._def.valueType,o=[...n.data.entries()].map(([i,l],d)=>({key:s._parse(new R(n,i,n.path,[d,"key"])),value:c._parse(new R(n,l,n.path,[d,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let l of o){let d=await l.key,p=await l.value;if(d.status==="aborted"||p.status==="aborted")return g;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(d.value,p.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let l of o){let d=l.key,p=l.value;if(d.status==="aborted"||p.status==="aborted")return g;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(d.value,p.value)}return{status:t.value,value:i}}}};u(me,"ZodMap");me.create=(r,e,t)=>new me({valueType:e,keyType:r,typeName:y.ZodMap,..._(t)});var U=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:f.invalid_type,expected:m.set,received:n.parsedType}),g;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(n,{code:f.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(h(n,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let c=this._def.valueType;function o(l){let d=new Set;for(let p of l){if(p.status==="aborted")return g;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}u(o,"finalizeSet");let i=[...n.data.values()].map((l,d)=>c._parse(new R(n,l,n.path,d)));return n.common.async?Promise.all(i).then(l=>o(l)):o(i)}min(e,t){return new U({...this._def,minSize:{value:e,message:w.toString(t)}})}max(e,t){return new U({...this._def,maxSize:{value:e,message:w.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};u(U,"ZodSet");U.create=(r,e)=>new U({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var H=class extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return h(t,{code:f.invalid_type,expected:m.function,received:t.parsedType}),g;function n(i,l){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ie(),ke].filter(d=>!!d),issueData:{code:f.invalid_arguments,argumentsError:l}})}u(n,"makeArgsIssue");function s(i,l){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ie(),ke].filter(d=>!!d),issueData:{code:f.invalid_return_type,returnTypeError:l}})}u(s,"makeReturnsIssue");let c={errorMap:t.common.contextualErrorMap},o=t.data;return this._def.returns instanceof G?P(async(...i)=>{let l=new A([]),d=await this._def.args.parseAsync(i,c).catch(C=>{throw l.addIssue(n(i,C)),l}),p=await o(...d);return await this._def.returns._def.type.parseAsync(p,c).catch(C=>{throw l.addIssue(s(p,C)),l})}):P((...i)=>{let l=this._def.args.safeParse(i,c);if(!l.success)throw new A([n(i,l.error)]);let d=o(...l.data),p=this._def.returns.safeParse(d,c);if(!p.success)throw new A([s(d,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new H({...this._def,args:I.create(e).rest(W.create())})}returns(e){return new H({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new H({args:e||I.create([]).rest(W.create()),returns:t||W.create(),typeName:y.ZodFunction,..._(n)})}};u(H,"ZodFunction");var ae=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};u(ae,"ZodLazy");ae.create=(r,e)=>new ae({getter:r,typeName:y.ZodLazy,..._(e)});var se=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}};u(se,"ZodLiteral");se.create=(r,e)=>new se({value:r,typeName:y.ZodLiteral,..._(e)});function _t(r,e){return new ie({values:r,typeName:y.ZodEnum,..._(e)})}u(_t,"createZodEnum");var ie=class extends v{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:x.joinValues(n),received:t.parsedType,code:f.invalid_type}),g}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:f.invalid_enum_value,options:n}),g}return P(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}};u(ie,"ZodEnum");ie.create=_t;var oe=class extends v{_parse(e){let t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){let s=x.objectValues(t);return h(n,{expected:x.joinValues(s),received:n.parsedType,code:f.invalid_type}),g}if(t.indexOf(e.data)===-1){let s=x.objectValues(t);return h(n,{received:n.data,code:f.invalid_enum_value,options:s}),g}return P(e.data)}get enum(){return this._def.values}};u(oe,"ZodNativeEnum");oe.create=(r,e)=>new oe({values:r,typeName:y.ZodNativeEnum,..._(e)});var G=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return h(t,{code:f.invalid_type,expected:m.promise,received:t.parsedType}),g;let n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return P(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};u(G,"ZodPromise");G.create=(r,e)=>new G({type:r,typeName:y.ZodPromise,..._(e)});var V=class extends v{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:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null;if(s.type==="preprocess"){let o=s.transform(n.data);return n.common.async?Promise.resolve(o).then(i=>this._def.schema._parseAsync({data:i,path:n.path,parent:n})):this._def.schema._parseSync({data:o,path:n.path,parent:n})}let c={addIssue:o=>{h(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(c.addIssue=c.addIssue.bind(c),s.type==="refinement"){let o=u(i=>{let l=s.refinement(i,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 i},"executeRefinement");if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?g:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?g:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ae(o))return o;let i=s.transform(o.value,c);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Ae(o)?Promise.resolve(s.transform(o.value,c)).then(i=>({status:t.value,value:i})):o);x.assertNever(s)}};u(V,"ZodEffects");V.create=(r,e,t)=>new V({schema:r,typeName:y.ZodEffects,effect:e,..._(t)});V.createWithPreprocess=(r,e,t)=>new V({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,..._(t)});var O=class extends v{_parse(e){return this._getType(e)===m.undefined?P(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(O,"ZodOptional");O.create=(r,e)=>new O({innerType:r,typeName:y.ZodOptional,..._(e)});var Z=class extends v{_parse(e){return this._getType(e)===m.null?P(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(Z,"ZodNullable");Z.create=(r,e)=>new Z({innerType:r,typeName:y.ZodNullable,..._(e)});var ce=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};u(ce,"ZodDefault");ce.create=(r,e)=>new ce({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var he=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return De(n)?n.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};u(he,"ZodCatch");he.create=(r,e)=>new he({innerType:r,typeName:y.ZodCatch,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ye=class extends v{_parse(e){if(this._getType(e)!==m.nan){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}};u(ye,"ZodNaN");ye.create=r=>new ye({typeName:y.ZodNaN,..._(r)});var sr=Symbol("zod_brand"),Ce=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};u(Ce,"ZodBranded");var le=class extends v{_parse(e){let{status:t,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"?g:c.status==="dirty"?(t.dirty(),bt(c.value)):this._def.out._parseAsync({data:c.value,path:n.path,parent:n})},"handleAsync")();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?g:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new le({in:e,out:t,typeName:y.ZodPipeline})}};u(le,"ZodPipeline");var wt=u((r,e={},t)=>r?J.create().superRefine((n,s)=>{if(!r(n)){let c=typeof e=="function"?e(n):e,o=typeof c=="string"?{message:c}:c;s.addIssue({code:"custom",...o,fatal:t})}}):J.create(),"custom"),ir={object:T.lazycreate},y;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline"})(y||(y={}));var or=u((r,e={message:`Input not instance of ${r.name}`})=>wt(t=>t instanceof r,e,!0),"instanceOfType"),xt=D.create,Ct=M.create,cr=ye.create,lr=K.create,kt=Y.create,ur=z.create,dr=de.create,pr=X.create,fr=ee.create,mr=J.create,hr=W.create,yr=L.create,gr=pe.create,vr=N.create,br=T.create,_r=T.strictCreate,wr=te.create,xr=fe.create,Cr=re.create,kr=I.create,Tr=ne.create,Er=me.create,jr=U.create,Pr=H.create,Sr=ae.create,Nr=se.create,Vr=ie.create,Rr=oe.create,Ir=G.create,gt=V.create,Or=O.create,Ar=Z.create,Dr=V.createWithPreprocess,Lr=le.create,qr=u(()=>xt().optional(),"ostring"),Mr=u(()=>Ct().optional(),"onumber"),Br=u(()=>kt().optional(),"oboolean"),$r={string:r=>D.create({...r,coerce:!0}),number:r=>M.create({...r,coerce:!0}),boolean:r=>Y.create({...r,coerce:!0}),bigint:r=>K.create({...r,coerce:!0}),date:r=>z.create({...r,coerce:!0})},zr=g,a=Object.freeze({__proto__:null,defaultErrorMap:ke,setErrorMap:Yt,getErrorMap:Ie,makeIssue:Oe,EMPTY_PATH:Xt,addIssueToContext:h,ParseStatus:j,INVALID:g,DIRTY:bt,OK:P,isAborted:Ke,isDirty:Ye,isValid:Ae,isAsync:De,get util(){return x},ZodParsedType:m,getParsedType:Q,ZodType:v,ZodString:D,ZodNumber:M,ZodBigInt:K,ZodBoolean:Y,ZodDate:z,ZodSymbol:de,ZodUndefined:X,ZodNull:ee,ZodAny:J,ZodUnknown:W,ZodNever:L,ZodVoid:pe,ZodArray:N,get objectUtil(){return Le},ZodObject:T,ZodUnion:te,ZodDiscriminatedUnion:fe,ZodIntersection:re,ZodTuple:I,ZodRecord:ne,ZodMap:me,ZodSet:U,ZodFunction:H,ZodLazy:ae,ZodLiteral:se,ZodEnum:ie,ZodNativeEnum:oe,ZodPromise:G,ZodEffects:V,ZodTransformer:V,ZodOptional:O,ZodNullable:Z,ZodDefault:ce,ZodCatch:he,ZodNaN:ye,BRAND:sr,ZodBranded:Ce,ZodPipeline:le,custom:wt,Schema:v,ZodSchema:v,late:ir,get ZodFirstPartyTypeKind(){return y},coerce:$r,any:mr,array:vr,bigint:lr,boolean:kt,date:ur,discriminatedUnion:xr,effect:gt,enum:Vr,function:Pr,instanceof:or,intersection:Cr,lazy:Sr,literal:Nr,map:Er,nan:cr,nativeEnum:Rr,never:yr,null:fr,nullable:Ar,number:Ct,object:br,oboolean:Br,onumber:Mr,optional:Or,ostring:qr,pipeline:Lr,preprocess:Dr,promise:Ir,record:Tr,set:jr,strictObject:_r,string:xt,symbol:dr,transformer:gt,tuple:kr,undefined:pr,union:wr,unknown:hr,void:gr,NEVER:zr,ZodIssueCode:f,quotelessJson:Kt,ZodError:A});var qe=a.array(a.string().or(a.record(a.any()))),ka=a.object({type:a.string().optional(),narrative:a.string().optional()}),Me=a.string().or(a.object({id:a.string(),type:a.string(),caption:a.string().optional()})),Wr=a.object({type:a.string().min(1).or(a.string().array().nonempty()),latitude:a.number(),longitude:a.number()}),Ur=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:Wr.optional()}),Zr=a.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(a.string()),Et=a.object({type:a.string().min(1).or(a.string().array().nonempty()),identifier:a.string(),identifierType:Zr}),Te=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:Me.optional(),email:a.string().email().optional(),address:Ur.optional(),otherIdentifier:Et.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())),et=a.object({id:a.string().optional()}).catchall(a.any()),Fr=a.object({type:a.string(),id:a.string()}).catchall(a.any()),Jr=a.object({id:a.string(),type:a.string()}).catchall(a.any()),Hr=a.object({id:a.string(),type:a.string()}).catchall(a.any()),ve=a.object({"@context":qe,id:a.string().optional(),type:a.string().array().nonempty(),issuer:Te,issuanceDate:a.string(),expirationDate:a.string().optional(),credentialSubject:et.or(et.array()),credentialStatus:Fr.optional(),credentialSchema:Jr.array().optional(),refreshService:Hr.optional()}).catchall(a.any()),F=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()),Ee=ve.extend({proof:F.or(F.array())}),Gr=a.object({"@context":qe,id:a.string().optional(),type:a.string().or(a.string().array().nonempty()),verifiableCredential:Ee.or(Ee.array()).optional(),holder:a.string().optional()}).catchall(a.any()),rt=Gr.extend({proof:F.or(F.array())}),jt=a.object({kty:a.string(),crv:a.string(),x:a.string(),y:a.string().optional(),n:a.string().optional(),d:a.string()}),Qr=a.object({alg:a.string(),iv:a.string(),tag:a.string(),epk:jt.partial().optional(),kid:a.string().optional(),apv:a.string().optional(),apu:a.string().optional()}),Kr=a.object({header:Qr,encrypted_key:a.string()}),nt=a.object({protected:a.string(),iv:a.string(),ciphertext:a.string(),tag:a.string(),aad:a.string().optional(),recipients:Kr.array().optional()}),ge=a.string().or(a.object({"@context":qe.optional(),id:a.string(),type:a.string(),controller:a.string(),publicKeyJwk:jt.optional(),publicKeyBase58:a.string().optional(),blockChainAccountId:a.string().optional()}).catchall(a.any())),Yr=a.object({id:a.string(),type:a.string().or(a.string().array().nonempty()),serviceEndpoint:a.any().or(a.any().array().nonempty())}).catchall(a.any()),ja=a.object({"@context":qe,id:a.string(),alsoKnownAs:a.string().optional(),controller:a.string().or(a.string().array().nonempty()).optional(),verificationMethod:ge.array().optional(),authentication:ge.array().optional(),assertionMethod:ge.array().optional(),keyAgreement:ge.array().optional(),capabilityInvocation:ge.array().optional(),capabilityDelegation:ge.array().optional(),publicKey:ge.array().optional(),service:Yr.array().optional(),proof:F.or(F.array()).optional()}).catchall(a.any()),Xr=a.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(a.string()),Be=a.object({type:a.string().array().nonempty(),targetCode:a.string().optional(),targetDescription:a.string().optional(),targetName:a.string(),targetFramework:a.string().optional(),targetType:Xr.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"]),tn=en.or(a.string()),rn=a.object({id:a.string().optional(),narrative:a.string().optional()}).catchall(a.any()),nn=a.object({id:a.string(),type:a.string().array().nonempty(),endorsementComment:a.string().optional()}),an=ve.extend({credentialSubject:nn,proof:F.or(F.array()).optional()}),sn=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()),cn=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:Be.array().optional(),description:a.string().optional(),level:a.string().optional(),name:a.string(),points:a.string().optional()}).catchall(a.any()),ln=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:Be.array().optional(),allowedValue:a.string().array().optional(),name:a.string(),requiredLevel:a.string().optional(),requiredValue:a.string().optional(),resultType:on,rubricCriterionLevel:cn.array().optional(),valueMax:a.string().optional(),valueMin:a.string().optional()}).catchall(a.any()),un=a.object({id:a.string().optional(),type:a.string().array().nonempty(),alignment:Be.array().optional(),achievementType:tn.optional(),creator:Te.optional(),creditsAvailable:a.number().optional(),criteria:rn,description:a.string(),endorsement:an.array().optional(),fieldOfStudy:a.string().optional(),humanCode:a.string().optional(),image:Me.optional(),"@language":a.string().optional(),name:a.string(),otherIdentifier:Et.array().optional(),related:sn.array().optional(),resultDescription:ln.array().optional(),specialization:a.string().optional(),tag:a.string().array().optional(),version:a.string().optional()}).catchall(a.any()),dn=a.object({type:a.string(),hashed:a.boolean(),identityHash:a.string(),identityType:a.string(),salt:a.string().optional()}),pn=a.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),fn=a.object({type:a.string().array().nonempty(),achievedLevel:a.string().optional(),alignment:Be.array().optional(),resultDescription:a.string().optional(),status:pn.optional(),value:a.string().optional()}).catchall(a.any()),Tt=a.object({id:a.string().optional(),type:a.string().array().nonempty(),activityEndDate:a.string().optional(),activityStartDate:a.string().optional(),creditsEarned:a.number().optional(),achievement:un.optional(),identifier:dn.array().optional(),image:Me.optional(),licenseNumber:a.string().optional(),narrative:a.string().optional(),result:fn.array().optional(),role:a.string().optional(),source:Te.optional(),term:a.string().optional()}).catchall(a.any()),mn=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()),hn=ve.extend({name:a.string().optional(),description:a.string().optional(),image:Me.optional(),credentialSubject:Tt.or(Tt.array()),endorsement:ve.array().optional(),evidence:mn.array().optional()}),Sa=hn.extend({proof:F.or(F.array())}),Va=a.object({checks:a.string().array(),warnings:a.string().array(),errors:a.string().array()}),Pt=a.enum(["Success","Failed","Error"]),Ra=Pt.enum,Ia=a.object({check:a.string(),status:Pt,message:a.string().optional(),details:a.string().optional()}),Oa=a.object({title:a.string().optional(),createdAt:a.string().optional(),issuer:Te.optional(),issuee:Te.optional(),credentialSubject:et.optional()}),Aa=a.object({id:a.string(),uri:a.string()}).catchall(a.any()),qa=a.object({limit:a.number(),cursor:a.string().optional(),sort:a.string().optional()}),be=a.object({cursor:a.string().optional(),hasMore:a.boolean()}),St=a.object({encryptedRecord:nt,fields:a.string().array()}).catchall(a.any()),Ma=be.extend({records:St.array()}),yn=St.extend({id:a.string()}),Ba=be.extend({records:yn.array()}),xe=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("https://").optional()}),za=be.extend({records:xe.array()}),Wa=a.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Ua=a.object({uri:a.string(),to:a.string(),from:a.string(),sent:a.string().datetime(),received:a.string().datetime().optional()}),gn=a.enum(["DRAFT","LIVE"]),Za=a.object({uri:a.string(),name:a.string().optional(),type:a.string().optional(),category:a.string().optional(),status:gn.optional(),autoConnectRecipients:a.boolean().optional()}),Fa=a.object({to:xe,from:a.string(),received:a.string().optional()}),Ja=a.object({endpoint:a.string(),name:a.string(),did:a.string().optional()}),Ha=a.object({ttlSeconds:a.number().optional(),totalUses:a.number().optional()}),vn=a.object({endpoint:a.string()}),Ga=a.object({signingAuthority:vn,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()})}),bn=a.enum(["live","stale","withdrawn"]),at=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({})}),Nt=a.object({contract:at,owner:xe,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()}),Qa=be.extend({records:Nt.omit({owner:!0}).array()}),_n=a.object({credentials:a.object({categories:a.record(a.string().array()).default({})}),personal:a.record(a.string()).default({}),date:a.string()}),Ka=be.extend({records:_n.array()}),Vt=a.object({sharing:a.boolean().optional(),shared:a.string().array().optional(),shareAll:a.boolean().optional(),shareUntil:a.string().optional()}),$e=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(Vt).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({})}),Ya=be.extend({records:a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:$e,contract:Nt,uri:a.string(),consenter:xe,status:bn}).array()}),Xa=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()}),es=a.object({anonymize:a.boolean().optional(),credentials:a.object({categories:a.record(a.boolean()).optional()}).optional(),personal:a.record(a.boolean()).optional()}),wn=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(Vt.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()}),tt=a.enum(["consent","update","sync","withdraw"]),ts=a.object({terms:wn.optional(),action:tt.or(tt.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()}),Rt=a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:$e.optional(),id:a.string(),action:tt,date:a.string()}),rs=be.extend({records:Rt.array()}),xn=a.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),Cn=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:Rt.optional()}),ns=a.object({type:xn,to:xe.partial().and(a.object({did:a.string()})),from:xe.partial().and(a.object({did:a.string()})),message:Cn.optional(),data:kn.optional(),sent:a.string().datetime().optional()});var Tn=u(async(r,e)=>{let t=r.id.did();r?.debug?.("Adding LearnCardNetwork Plugin");let n=await mt(e,async o=>{let i=await r.invoke.getDidAuthVp({proofFormat:"jwt",challenge:o});if(typeof i!="string")throw new Error("Error getting DID-Auth-JWT!");return i}),s;try{s=await n.profile.getProfile.query()}catch(o){r.debug?.("No profile!",o)}let c=s?.did||t;return{name:"LearnCard Network",displayName:"LearnCard Network",description:"LearnCard Network Integration",id:{did:(o,i)=>!i||i==="web"?c:r.id.did(i),keypair:(o,i)=>r.id.keypair(i)},read:{get:async(o,i)=>{if(o.debug?.("learnCard.read['LearnCard Network'].get"),!i)return;let l=i.split(":");if(l.length!==5)return;let[d,p]=l;if(!(d!=="lc"||p!=="network"))try{let b=await n.storage.resolve.query({uri:i});return"ciphertext"in b&&(b=await o.invoke.getDIDObject().decryptDagJWE(b)),await Ee.or(rt).parseAsync(b)}catch(b){o.debug?.(b);return}}},store:{upload:async(o,i)=>(o.debug?.("learnCard.store['LearnCard Network'].upload"),n.storage.store.mutate({item:i})),uploadEncrypted:async(o,i,{recipients:l=[]}={recipients:[]})=>{o.debug?.("learnCard.store['LearnCard Network'].upload");let d=await o.invoke.getDIDObject().createDagJWE(i,[o.id.did(),...l]);return n.storage.store.mutate({item:d})}},methods:{createProfile:async(o,i)=>{if(s)throw new Error("Account already exists!");let l=await n.profile.createProfile.mutate(i);return s=await n.profile.getProfile.query(),c=l,l},createServiceProfile:async(o,i)=>{if(s)throw new Error("Account already exists!");let l=await n.profile.createServiceProfile.mutate(i);return s=await n.profile.getProfile.query(),c=l,l},createManagedServiceProfile:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return await n.profile.createManagedServiceProfile.mutate(i)},getManagedServiceProfiles:async(o,i={})=>{if(!s)throw new Error("Please make an account first!");return n.profile.getManagedServiceProfiles.query(i)},updateProfile:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return await n.profile.updateProfile.mutate(i)?(s=await n.profile.getProfile.query(),!0):!1},deleteProfile:async()=>{if(!s)throw new Error("Account does not exist!");return await n.profile.deleteProfile.mutate()?(s=void 0,!0):!1},getProfile:async(o,i)=>i?n.profile.getOtherProfile.query({profileId:i}):n.profile.getProfile.query(),searchProfiles:async(o,i="",{limit:l=25,includeSelf:d=!1,includeConnectionStatus:p=!1,includeServiceProfiles:b=!1}={})=>n.profile.searchProfiles.query({input:i,limit:l,includeSelf:d,includeConnectionStatus:p,includeServiceProfiles:b}),connectWith:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectWith.mutate({profileId:i})},cancelConnectionRequest:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.cancelConnectionRequest.mutate({profileId:i})},connectWithInvite:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectWithInvite.mutate({profileId:i,challenge:l})},disconnectWith:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.disconnectWith.mutate({profileId:i})},acceptConnectionRequest:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.acceptConnectionRequest.mutate({profileId:i})},getConnections:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.connections.query()},getPendingConnections:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.pendingConnections.query()},getConnectionRequests:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectionRequests.query()},generateInvite:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.generateInvite.mutate({challenge:i,expiration:l})},blockProfile:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.blockProfile.mutate({profileId:i})},unblockProfile:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.unblockProfile.mutate({profileId:i})},getBlockedProfiles:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.blocked.query()},sendCredential:async(o,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");if(!d)return n.credential.sendCredential.mutate({profileId:i,credential:l});let p=await o.invoke.getProfile(i);if(!p)throw new Error("Could not find target account");let b=await o.invoke.getDIDObject().createDagJWE(l,[s.did,p.did]);return n.credential.sendCredential.mutate({profileId:i,credential:b})},acceptCredential:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.acceptCredential.mutate({uri:i})},getReceivedCredentials:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.receivedCredentials.query({from:i})},getSentCredentials:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.sentCredentials.query({to:i})},getIncomingCredentials:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.incomingCredentials.query({from:i})},deleteCredential:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.deleteCredential.mutate({uri:i})},sendPresentation:async(o,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");if(!d)return n.presentation.sendPresentation.mutate({profileId:i,presentation:l});let p=await o.invoke.getProfile(i);if(!p)throw new Error("Could not find target account");let b=await o.invoke.getDIDObject().createDagJWE(l,[s.did,p.did]);return n.presentation.sendPresentation.mutate({profileId:i,presentation:b})},acceptPresentation:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.acceptPresentation.mutate({uri:i})},getReceivedPresentations:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.receivedPresentations.query({from:i})},getSentPresentations:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.sentPresentations.query({to:i})},getIncomingPresentations:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.incomingPresentations.query({from:i})},deletePresentation:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.deletePresentation.mutate({uri:i})},createBoost:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.createBoost.mutate({credential:i,...l})},getBoost:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoost.query({uri:i})},getBoosts:async()=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoosts.query()},getBoostRecipients:async(o,i,l=25,d=void 0,p=!0)=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoostRecipients.query({uri:i,limit:l,skip:d,includeUnacceptedBoosts:p})},updateBoost:async(o,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.boost.updateBoost.mutate({uri:i,updates:{credential:d,...l}})},getBoostAdmins:async(o,i,l={})=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoostAdmins.query({uri:i,...l})},addBoostAdmin:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.addBoostAdmin.mutate({uri:i,profileId:l})},removeBoostAdmin:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.removeBoostAdmin.mutate({uri:i,profileId:l})},deleteBoost:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.boost.deleteBoost.mutate({uri:i})},sendBoost:async(o,i,l,d={encrypt:!0})=>{if(!s)throw new Error("Please make an account first!");let p=await o.invoke.resolveFromLCN(l),b=await ve.spa(p);if(!b.success)throw new Error("Did not get a valid boost from URI");let C=await o.invoke.getProfile(i);if(!C)throw new Error("Target profile not found");let k=b.data;k.issuanceDate=new Date().toISOString(),k.issuer=o.id.did(),Array.isArray(k.credentialSubject)?k.credentialSubject=k.credentialSubject.map(B=>({...B,id:C.did})):k.credentialSubject.id=C.did,k?.type?.includes("BoostCredential")&&(k.boostId=l),typeof d=="object"&&d.overideFn&&(k=d.overideFn(k));let S=await o.invoke.issueCredential(k);if(typeof d=="object"&&!d.encrypt||!d)return n.boost.sendBoost.mutate({profileId:i,uri:l,credential:S});let q=await n.utilities.getDid.query(),ue=await o.invoke.getDIDObject().createDagJWE(S,[s.did,C.did,q]);return n.boost.sendBoost.mutate({profileId:i,uri:l,credential:ue})},registerSigningAuthority:async(o,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.profile.registerSigningAuthority.mutate({endpoint:i,name:l,did:d})},getRegisteredSigningAuthorities:async(o,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.profile.signingAuthorities.query()},getRegisteredSigningAuthority:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.signingAuthority.query({endpoint:i,name:l})},generateClaimLink:async(o,i,l,d,p)=>{if(!s)throw new Error("Please make an account first!");return n.boost.generateClaimLink.mutate({boostUri:i,claimLinkSA:l,options:d,challenge:p})},claimBoostWithLink:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.claimBoostWithLink.mutate({boostUri:i,challenge:l})},createContract:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.createConsentFlowContract.mutate(i)},getContract:async(o,i)=>n.contracts.getConsentFlowContract.query({uri:i}),getContracts:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentFlowContracts.query(i)},deleteContract:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.deleteConsentFlowContract.mutate({uri:i})},getConsentFlowData:async(o,i,l={})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedDataForContract.query({uri:i,...l})},getAllConsentFlowData:async(o,i={},l={})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedData.query({query:i,...l})},consentToContract:async(o,i,{terms:l,expiresAt:d,oneTime:p})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.consentToContract.mutate({contractUri:i,terms:l,expiresAt:d,oneTime:p})},getConsentedContracts:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedContracts.query(i)},updateContractTerms:async(o,i,{terms:l,expiresAt:d,oneTime:p})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.updateConsentedContractTerms.mutate({uri:i,terms:l,expiresAt:d,oneTime:p})},withdrawConsent:async(o,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.withdrawConsent.mutate({uri:i})},getConsentFlowTransactions:async(o,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getTermsTransactionHistory.query({uri:i,...l})},verifyConsent:async(o,i,l)=>n.contracts.verifyConsent.query({uri:i,profileId:l}),resolveFromLCN:async(o,i)=>{let l=await n.storage.resolve.query({uri:i});return ve.or(Ee).or(rt).or(nt).or(at).or($e).parseAsync(l)},getLCNClient:()=>n}}},"getLearnCardNetworkPlugin"),En=u(async(r,e)=>{let t=[{id:"LearnCard Network",url:"https://network.learncard.com",did:"did:web:network.learncard.com"}],n;if(e){let o=await fetch(e);o.status===200?n=JSON.parse(await o.text()):n=t}else n=t;let s=u(o=>{if(!!o)return typeof o=="string"?o:"id"in o&&typeof o.id=="string"?o.id:void 0},"getIssuerDID"),c=u(o=>{let i=s(o);if(!!i)return n.find(l=>l.did===i)},"getTrustedBoostVerifier");return{name:"VerifyBoost",displayName:"Verify Boost Extension",description:"Adds a check for validating Boost Credentials.",methods:{verifyCredential:async(o,i,l)=>{let d=await r.invoke.verifyCredential(i,l),p=i?.boostCredential;try{if(p){let b=await r.invoke.verifyCredential(p);if(!p?.boostId&&!i?.boostId&&d.warnings.push("Boost Authenticity could not be verified: Boost ID metadata is missing."),b.errors?.length>0)d.errors=[...b.errors||[],...d.errors||[],"Boost Credential could not be verified."];else if(p?.boostId!==i?.boostId)d.errors.push("Boost Authenticity could not be verified: Boost ID metadata is mismatched.");else{let C=c(i?.issuer);C?d.checks.push(`Boost is Authentic. Verified by ${C.id}.`):d.warnings.push(`Boost Authenticity could not be verified. Issuer is outside of trust network: ${s(i?.issuer)}`)}}}catch{d.errors.push("Boost authenticity could not be verified.")}return d}}}},"getVerifyBoostPlugin");
|
|
2
2
|
/* istanbul ignore if -- @preserve */
|
|
3
3
|
/* istanbul ignore next -- @preserve */
|
|
4
4
|
//# sourceMappingURL=lcn-plugin.cjs.production.min.js.map
|