@canton-network/wallet-gateway-remote 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/dapp-api/controller.d.ts.map +1 -1
- package/dist/dapp-api/controller.js +25 -6
- package/dist/dapp-api/server.d.ts +3 -1
- package/dist/dapp-api/server.d.ts.map +1 -1
- package/dist/dapp-api/server.js +5 -14
- package/dist/dapp-api/server.test.js +12 -5
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/init.d.ts +2 -8
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +17 -17
- package/dist/user-api/controller.js +3 -3
- package/dist/user-api/server.d.ts +3 -2
- package/dist/user-api/server.d.ts.map +1 -1
- package/dist/user-api/server.js +3 -10
- package/dist/user-api/server.test.js +8 -8
- package/dist/web/frontend/approve/index.html +3 -3
- package/dist/web/frontend/assets/{approve-DjrMmUo0.js → approve-BHHuvE3i.js} +1 -1
- package/dist/web/frontend/assets/{callback-QrXhW3mX.js → callback-D9y0DRns.js} +1 -1
- package/dist/web/frontend/assets/{handle-errors-BcwHAkCd.js → handle-errors-BM-xvD4v.js} +1 -1
- package/dist/web/frontend/assets/{login-kWEHTsIr.js → login-DJofeRCg.js} +1 -1
- package/dist/web/frontend/assets/{networks-CjofhwC9.js → networks-CZV8G3N2.js} +1 -1
- package/dist/web/frontend/assets/{rpc-client-CCUlY3sp.js → rpc-client-TGo-LOnR.js} +1 -1
- package/dist/web/frontend/assets/{wallets-BPtpBguD.js → wallets-DwPVJP85.js} +1 -1
- package/dist/web/frontend/callback/index.html +2 -2
- package/dist/web/frontend/login/index.html +2 -2
- package/dist/web/frontend/networks/index.html +3 -3
- package/dist/web/frontend/wallets/index.html +3 -3
- package/dist/web/server.d.ts +3 -1
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +38 -24
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as P,s as v,x as y,t as L}from"./state-manager-BNW0y5PZ.js";import{W as x,c as E}from"./rpc-client-
|
|
1
|
+
import{i as P,s as v,x as y,t as L}from"./state-manager-BNW0y5PZ.js";import{W as x,c as E}from"./rpc-client-TGo-LOnR.js";var I=Object.create,w=Object.defineProperty,U=Object.getOwnPropertyDescriptor,g=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),k=e=>{throw TypeError(e)},O=(e,t,o)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,T=(e,t)=>w(e,"name",{value:t,configurable:!0}),z=e=>[,,,I((e==null?void 0:e[g("metadata")])??null)],R=["class","method","getter","setter","accessor","field","value","get","set"],m=e=>e!==void 0&&typeof e!="function"?k("Function expected"):e,j=(e,t,o,n,a)=>({kind:R[e],name:t,metadata:n,addInitializer:c=>o._?k("Already initialized"):a.push(m(c||null))}),A=(e,t)=>O(t,g("metadata"),e[3]),D=(e,t,o,n)=>{for(var a=0,c=e[t>>1],i=c&&c.length;a<i;a++)c[a].call(o);return n},M=(e,t,o,n,a,c)=>{var i,s,d,r=t&7,l=!1,h=0,b=e[h]||(e[h]=[]),_=r&&(a=a.prototype,r<5&&(r>3||!l)&&U(a,o));T(a,o);for(var p=n.length-1;p>=0;p--)d=j(r,o,s={},e[3],b),i=(0,n[p])(a,d),s._=1,m(i)&&(a=i);return A(e,a),_&&w(a,o,_),l?r^4?c:_:a},C,f,S;C=[L("login-callback")];class u extends(S=P){connectedCallback(){super.connectedCallback(),this.handleRedirect()}async handleRedirect(){const t=new URL(window.location.href),o=t.searchParams.get("code"),n=t.searchParams.get("state");if(!o&&!n){console.error("missing state and code");return}if(o&&n){const a=JSON.parse(atob(n)),s=(await(await fetch(a.configUrl)).json()).token_endpoint,r=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:o,redirect_uri:window.location.origin+"/callback/",client_id:a.clientId,audience:a.audience})})).json();r.access_token&&(window.opener&&!window.opener.closed&&window.opener.postMessage({type:x.SPLICE_WALLET_IDP_AUTH_SUCCESS,token:r.access_token},"*"),v.accessToken.set(r.access_token),await E(r.access_token).request("addSession",{chainId:v.chainId.get()||""}),window.location.replace("/"))}}render(){return y`<h2>Logged in!</h2>`}}f=z(S);u=M(f,0,"LoginCallback",C,u);D(f,1,u);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as i}from"./rpc-client-
|
|
1
|
+
import{E as i}from"./rpc-client-TGo-LOnR.js";function m(r,e){const t=document.createElement("custom-toast");let s=-1,o="";if(i.safeParse(r).success){const n=i.parse(r);s=n.error.code,o=n.error.message}switch(s){case-32600:t.title="Invalid Request";break;case-32601:t.title="Method Not Found";break;case-32602:t.title="Invalid Parameters";break;case-32603:t.title="Internal Error";break;default:t.title=(e==null?void 0:e.title)||"Unexpected Error";break}t.message=o||(e==null?void 0:e.message)||"Something went wrong. Please try again.",t.type="error",t.buttonText=(e==null?void 0:e.buttonText)||"Dismiss",document.body.appendChild(t)}export{m as h};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as L,x as b,a as V,i as X,t as Y}from"./state-manager-BNW0y5PZ.js";import"./index-BPTkodPz.js";import{r as w}from"./state-DKGJ6EmM.js";import"./index-VtAAU1cN.js";import{c as Z}from"./rpc-client-
|
|
1
|
+
import{s as L,x as b,a as V,i as X,t as Y}from"./state-manager-BNW0y5PZ.js";import"./index-BPTkodPz.js";import{r as w}from"./state-DKGJ6EmM.js";import"./index-VtAAU1cN.js";import{c as Z}from"./rpc-client-TGo-LOnR.js";var j=Object.create,$=Object.defineProperty,ee=Object.getOwnPropertyDescriptor,R=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),m=e=>{throw TypeError(e)},te=(e,t,r)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,E=(e,t)=>$(e,"name",{value:t,configurable:!0}),re=e=>[,,,j((e==null?void 0:e[R("metadata")])??null)],q=["class","method","getter","setter","accessor","field","value","get","set"],v=e=>e!==void 0&&typeof e!="function"?m("Function expected"):e,oe=(e,t,r,n,i)=>({kind:q[e],name:t,metadata:n,addInitializer:s=>r._?m("Already initialized"):i.push(v(s||null))}),ie=(e,t)=>te(t,R("metadata"),e[3]),u=(e,t,r,n)=>{for(var i=0,s=e[t>>1],p=s&&s.length;i<p;i++)t&1?s[i].call(r):n=s[i].call(r,n);return n},f=(e,t,r,n,i,s)=>{var p,d,M,_,x,o=t&7,y=!!(t&8),h=!!(t&16),N=o>3?e.length+1:o?y?1:2:0,D=q[o+5],W=o>3&&(e[N-1]=[]),Q=e[N]||(e[N]=[]),l=o&&(!h&&!y&&(i=i.prototype),o<5&&(o>3||!h)&&ee(o<4?i:{get[r](){return A(this,s)},set[r](c){return F(this,s,c)}},r));o?h&&o<4&&E(s,(o>2?"set ":o>1?"get ":"")+r):E(i,r);for(var z=n.length-1;z>=0;z--)_=oe(o,r,M={},e[3],Q),o&&(_.static=y,_.private=h,x=_.access={has:h?c=>se(i,c):c=>r in c},o^3&&(x.get=h?c=>(o^1?A:ae)(c,i,o^4?s:l.get):c=>c[r]),o>2&&(x.set=h?(c,C)=>F(c,i,C,o^4?s:l.set):(c,C)=>c[r]=C)),d=(0,n[z])(o?o<4?h?s:l[D]:o>4?void 0:{get:l.get,set:l.set}:i,_),M._=1,o^4||d===void 0?v(d)&&(o>4?W.unshift(d):o?h?s=d:l[D]=d:i=d):typeof d!="object"||d===null?m("Object expected"):(v(p=d.get)&&(l.get=p),v(p=d.set)&&(l.set=p),v(p=d.init)&&W.unshift(p));return o||ie(e,i),l&&$(i,r,l),h?o^4?s:l:i},S=(e,t,r)=>t.has(e)||m("Cannot "+r),se=(e,t)=>Object(t)!==t?m('Cannot use the "in" operator on this value'):e.has(t),A=(e,t,r)=>(S(e,t,"read from private field"),r?r.call(e):t.get(e)),k=(e,t,r)=>t.has(e)?m("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),F=(e,t,r,n)=>(S(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ae=(e,t,r)=>(S(e,t,"access private method"),r),G,J,B,H,I,K,a,T,P,U,O;K=[Y("user-ui-login")];class g extends(I=X,H=[w()],B=[w()],J=[w()],G=[w()],I){constructor(){super(...arguments),k(this,T,u(a,8,this,[])),u(a,11,this),k(this,P,u(a,12,this,null)),u(a,15,this),k(this,U,u(a,16,this,null)),u(a,19,this),k(this,O,u(a,20,this,null)),u(a,23,this)}handleChange(t){const r=parseInt(t.target.value);this.selectedNetwork=this.idps[r]??null,this.message=null}async loadNetworks(){return(await Z(L.accessToken.get()).request("listNetworks")).networks}async connectedCallback(){super.connectedCallback(),this.idps=await this.loadNetworks()}async handleConnectToIDP(){if(this.message=null,!this.selectedNetwork){this.messageType="error",this.message="Please select a network before connecting.";return}L.chainId.set(this.selectedNetwork.chainId);const t=`${window.origin}/callback/`;if(this.selectedNetwork.auth.type==="implicit"){this.messageType="info",this.message=`Redirecting to ${this.selectedNetwork.name}...`;const r=this.selectedNetwork.auth,n=await fetch(r.configUrl).then(p=>p.json()),i={configUrl:r.configUrl,clientId:r.clientId,audience:r.audience},s=new URLSearchParams({response_type:"code",client_id:this.selectedNetwork.auth.clientId||"",redirect_uri:t||"",nonce:crypto.randomUUID(),scope:r.scope||"",audience:r.audience||"",state:btoa(JSON.stringify(i))});setTimeout(()=>{window.location.href=`${n.authorization_endpoint}?${s.toString()}`},400)}else this.messageType="error",this.message="This authentication type is not supported yet."}render(){return b`
|
|
2
2
|
<div class="card">
|
|
3
3
|
<h1>Sign in to Canton Network</h1>
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as g,x as S,a as j,i as tt,t as et}from"./state-manager-BNW0y5PZ.js";import"./index-VtAAU1cN.js";import{r as b}from"./state-DKGJ6EmM.js";import{c as v}from"./rpc-client-
|
|
1
|
+
import{s as g,x as S,a as j,i as tt,t as et}from"./state-manager-BNW0y5PZ.js";import"./index-VtAAU1cN.js";import{r as b}from"./state-DKGJ6EmM.js";import{c as v}from"./rpc-client-TGo-LOnR.js";import{h as T}from"./handle-errors-BM-xvD4v.js";var st=Object.create,A=Object.defineProperty,it=Object.getOwnPropertyDescriptor,H=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),m=e=>{throw TypeError(e)},rt=(e,t,s)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,B=(e,t)=>A(e,"name",{value:t,configurable:!0}),ot=e=>[,,,st((e==null?void 0:e[H("metadata")])??null)],J=["class","method","getter","setter","accessor","field","value","get","set"],y=e=>e!==void 0&&typeof e!="function"?m("Function expected"):e,at=(e,t,s,o,r)=>({kind:J[e],name:t,metadata:o,addInitializer:a=>s._?m("Already initialized"):r.push(y(a||null))}),nt=(e,t)=>rt(t,H("metadata"),e[3]),h=(e,t,s,o)=>{for(var r=0,a=e[t>>1],w=a&&a.length;r<w;r++)t&1?a[r].call(s):o=a[r].call(s,o);return o},k=(e,t,s,o,r,a)=>{var w,l,q,f,x,i=t&7,N=!!(t&8),p=!!(t&16),C=i>3?e.length+1:i?N?1:2:0,E=J[i+5],F=i>3&&(e[C-1]=[]),Z=e[C]||(e[C]=[]),c=i&&(!p&&!N&&(r=r.prototype),i<5&&(i>3||!p)&&it(i<4?r:{get[s](){return G(this,a)},set[s](d){return K(this,a,d)}},s));i?p&&i<4&&B(a,(i>2?"set ":i>1?"get ":"")+s):B(r,s);for(var M=o.length-1;M>=0;M--)f=at(i,s,q={},e[3],Z),i&&(f.static=N,f.private=p,x=f.access={has:p?d=>dt(r,d):d=>s in d},i^3&&(x.get=p?d=>(i^1?G:lt)(d,r,i^4?a:c.get):d=>d[s]),i>2&&(x.set=p?(d,$)=>K(d,r,$,i^4?a:c.set):(d,$)=>d[s]=$)),l=(0,o[M])(i?i<4?p?a:c[E]:i>4?void 0:{get:c.get,set:c.set}:r,f),q._=1,i^4||l===void 0?y(l)&&(i>4?F.unshift(l):i?p?a=l:c[E]=l:r=l):typeof l!="object"||l===null?m("Object expected"):(y(w=l.get)&&(c.get=w),y(w=l.set)&&(c.set=w),y(w=l.init)&&F.unshift(w));return i||nt(e,r),c&&A(r,s,c),p?i^4?a:c:r},O=(e,t,s)=>t.has(e)||m("Cannot "+s),dt=(e,t)=>Object(t)!==t?m('Cannot use the "in" operator on this value'):e.has(t),G=(e,t,s)=>(O(e,t,"read from private field"),s?s.call(e):t.get(e)),_=(e,t,s)=>t.has(e)?m("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),K=(e,t,s,o)=>(O(e,t,"write to private field"),o?o.call(e,s):t.set(e,s),s),lt=(e,t,s)=>(O(e,t,"access private method"),s),L,Q,R,V,X,z,Y,n,W,U,D,I,P;Y=[et("user-ui-networks")];class u extends(z=tt,X=[b()],V=[b()],R=[b()],Q=[b()],L=[b()],z){constructor(){var t,s;super(...arguments),_(this,W,h(n,8,this,[])),h(n,11,this),_(this,U,h(n,12,this,[])),h(n,15,this),_(this,D,h(n,16,this,!1)),h(n,19,this),_(this,I,h(n,20,this,null)),h(n,23,this),_(this,P,h(n,24,this,((s=(t=this.editingNetwork)==null?void 0:t.auth)==null?void 0:s.type)??"implicit")),h(n,27,this),this.openAddModal=()=>{this.isModalOpen=!0,this.editingNetwork=null},this.syncWallets=async()=>{try{const r=await v(g.accessToken.get()).request("syncWallets");alert(`Wallet sync completed. Added ${r.added.length} wallets.`)}catch(o){T(o)}},this.closeModal=()=>{this.isModalOpen=!1,this.listNetworks()},this.handleSubmit=async o=>{o.preventDefault();const r={...o.network,ledgerApi:o.network.ledgerApi.baseUrl};try{await v(g.accessToken.get()).request("addNetwork",{network:r}),await this.listNetworks()}catch(a){T(a)}finally{this.closeModal()}}}async listNetworks(){const s=await v(g.accessToken.get()).request("listNetworks");this.networks=s.networks}async listSessions(){const s=await v(g.accessToken.get()).request("listSessions");this.sessions=s.sessions}connectedCallback(){super.connectedCallback(),this.listNetworks(),this.listSessions()}async handleDelete(t){const s={...t.network,ledgerApi:t.network.ledgerApi.baseUrl};if(confirm(`Delete network "${s.name}"?`))try{const o={networkName:s.chainId};await v(g.accessToken.get()).request("removeNetwork",o),await this.listNetworks()}catch(o){T(o)}}onAuthTypeChange(t){const s=t.target;this.authType=s.value}render(){return S`
|
|
2
2
|
<div class="header"><h1>Sessions</h1></div>
|
|
3
3
|
<div class="table-container">
|
|
4
4
|
<table>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Ue=Object.defineProperty;var De=(r,e,t)=>e in r?Ue(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var X=(r,e,t)=>De(r,typeof e!="symbol"?e+"":e,t);var g;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(const i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(g||(g={}));var ve;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ve||(ve={}));const u=g.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z=r=>{switch(typeof r){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(r)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(r)?u.array:r===null?u.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?u.promise:typeof Map<"u"&&r instanceof Map?u.map:typeof Set<"u"&&r instanceof Set?u.set:typeof Date<"u"&&r instanceof Date?u.date:u.object;default:return u.unknown}},d=g.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class I extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,h=0;for(;h<i.path.length;){const f=i.path[h];h===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(i))):o[f]=o[f]||{_errors:[]},o=o[f],h++}}};return n(this),s}static assert(e){if(!(e instanceof I))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,g.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}I.create=r=>new I(r);const ue=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===u.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,g.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${g.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${g.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${g.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:g.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.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==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,g.assertNever(r)}return{message:t}};let ze=ue;function We(){return ze}const Be=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const h=s.filter(f=>!!f).slice().reverse();for(const f of h)o=f(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function c(r,e){const t=We(),s=Be({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===ue?void 0:ue].filter(n=>!!n)});r.common.issues.push(s)}class b{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return b.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const m=Object.freeze({status:"aborted"}),B=r=>({status:"dirty",value:r}),T=r=>({status:"valid",value:r}),xe=r=>r.status==="aborted",ke=r=>r.status==="dirty",D=r=>r.status==="valid",H=r=>typeof Promise<"u"&&r instanceof Promise;var l;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(l||(l={}));class C{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const be=(r,e)=>{if(D(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new I(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:h}=r;return i.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:h??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:h??t??o.defaultError}},description:n}}class y{get description(){return this._def.description}_getType(e){return Z(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(H(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parseSync({data:e,path:s.path,parent:s});return be(s,n)}"~validate"(e){var s,n;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return D(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(n=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>D(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(H(n)?n:Promise.resolve(n));return be(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:d.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(h=>h?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new V({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return N.create(this,this._def)}nullable(){return M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return S.create(this)}promise(){return se.create(this,this._def)}or(e){return K.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new V({..._(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ne({..._(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new Ie({typeName:p.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ae({..._(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ge.create(this,e)}readonly(){return ie.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Fe=/^c[^\s-]{8,}$/i,qe=/^[0-9a-z]+$/,Je=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,He=/^[a-z0-9_-]{21}$/i,Ye=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ge=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ke="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let de;const et=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,rt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,st=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,at=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Re="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",it=new RegExp(`^${Re}$`);function Oe(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ot(r){return new RegExp(`^${Oe(r)}$`)}function dt(r){let e=`${Re}T${Oe(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ct(r,e){return!!((e==="v4"||!e)&&et.test(r)||(e==="v6"||!e)&&rt.test(r))}function ut(r,e){if(!Ye.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function lt(r,e){return!!((e==="v4"||!e)&&tt.test(r)||(e==="v6"||!e)&&st.test(r))}class O extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.string,received:a.parsedType}),m}const s=new b;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?c(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&c(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Ge.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"email",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")de||(de=new RegExp(Ke,"u")),de.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"emoji",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Xe.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"uuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")He.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"nanoid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Fe.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"cuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")qe.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"cuid2",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Je.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"ulid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),c(n,{validation:"url",code:d.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"regex",code:d.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?dt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?it.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?ot(a).test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Qe.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"duration",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?ct(e.data,a.version)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"ip",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?ut(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"jwt",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?lt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"cidr",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?nt.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"base64",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?at.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"base64url",code:d.invalid_string,message:a.message}),s.dirty()):g.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:d.invalid_string,...l.errToObj(s)})}_addCheck(e){return new O({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...l.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...l.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...l.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new O({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new O({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new O({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}O.create=r=>new O({checks:[],typeName:p.ZodString,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});function ht(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class z extends y{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)!==u.number){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.number,received:a.parsedType}),m}let s;const n=new b;for(const a of this._def.checks)a.kind==="int"?g.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?ht(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:d.not_finite,message:a.message}),n.dirty()):g.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,n){return new z({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(n)}]})}_addCheck(e){return new z({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&g.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}z.create=r=>new z({checks:[],typeName:p.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class F extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.bigint)return this._getInvalidInput(e);let s;const n=new b;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):g.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,n){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(n)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}F.create=r=>new F({checks:[],typeName:p.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});class le extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.boolean,received:s.parsedType}),m}return T(e.data)}}le.create=r=>new le({typeName:p.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class Y extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_date}),m}const s=new b;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):g.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(t)})}get minDate(){let e=null;for(const 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(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Y.create=r=>new Y({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:p.ZodDate,..._(r)});class we extends y{_parse(e){if(this._getType(e)!==u.symbol){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.symbol,received:s.parsedType}),m}return T(e.data)}}we.create=r=>new we({typeName:p.ZodSymbol,..._(r)});class Q extends y{_parse(e){if(this._getType(e)!==u.undefined){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.undefined,received:s.parsedType}),m}return T(e.data)}}Q.create=r=>new Q({typeName:p.ZodUndefined,..._(r)});class G extends y{_parse(e){if(this._getType(e)!==u.null){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.null,received:s.parsedType}),m}return T(e.data)}}G.create=r=>new G({typeName:p.ZodNull,..._(r)});class Te extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}}Te.create=r=>new Te({typeName:p.ZodAny,..._(r)});class he extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}}he.create=r=>new he({typeName:p.ZodUnknown,..._(r)});class j extends y{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.never,received:t.parsedType}),m}}j.create=r=>new j({typeName:p.ZodNever,..._(r)});class Se extends y{_parse(e){if(this._getType(e)!==u.undefined){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.void,received:s.parsedType}),m}return T(e.data)}}Se.create=r=>new Se({typeName:p.ZodVoid,..._(r)});class S extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==u.array)return c(t,{code:d.invalid_type,expected:u.array,received:t.parsedType}),m;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(c(t,{code:i?d.too_big:d.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(c(t,{code:d.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(c(t,{code:d.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new C(t,i,t.path,o)))).then(i=>b.mergeArray(s,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new C(t,i,t.path,o)));return b.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new S({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new S({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new S({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}S.create=(r,e)=>new S({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,..._(e)});function U(r){if(r instanceof x){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=N.create(U(s))}return new x({...r._def,shape:()=>e})}else return r instanceof S?new S({...r._def,type:U(r.element)}):r instanceof N?N.create(U(r.unwrap())):r instanceof M?M.create(U(r.unwrap())):r instanceof P?P.create(r.items.map(e=>U(e))):r}class x extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=g.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const f=this._getOrReturnCtx(e);return c(f,{code:d.invalid_type,expected:u.object,received:f.parsedType}),m}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(const f in n.data)i.includes(f)||o.push(f);const h=[];for(const f of i){const v=a[f],W=n.data[f];h.push({key:{status:"valid",value:f},value:v._parse(new C(n,W,n.path,f)),alwaysSet:f in n.data})}if(this._def.catchall instanceof j){const f=this._def.unknownKeys;if(f==="passthrough")for(const v of o)h.push({key:{status:"valid",value:v},value:{status:"valid",value:n.data[v]}});else if(f==="strict")o.length>0&&(c(n,{code:d.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const v of o){const W=n.data[v];h.push({key:{status:"valid",value:v},value:f._parse(new C(n,W,n.path,v)),alwaysSet:v in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const f=[];for(const v of h){const W=await v.key,Me=await v.value;f.push({key:W,value:Me,alwaysSet:v.alwaysSet})}return f}).then(f=>b.mergeObjectSync(s,f)):b.mergeObjectSync(s,h)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var a,i;const n=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(e){return new x({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new x({...this._def,catchall:e})}pick(e){const t={};for(const s of g.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}omit(e){const t={};for(const s of g.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}deepPartial(){return U(this)}partial(e){const t={};for(const s of g.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new x({...this._def,shape:()=>t})}required(e){const t={};for(const s of g.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof N;)a=a._def.innerType;t[s]=a}return new x({...this._def,shape:()=>t})}keyof(){return Ne(g.objectKeys(this.shape))}}x.create=(r,e)=>new x({shape:()=>r,unknownKeys:"strip",catchall:j.create(),typeName:p.ZodObject,..._(e)});x.strictCreate=(r,e)=>new x({shape:()=>r,unknownKeys:"strict",catchall:j.create(),typeName:p.ZodObject,..._(e)});x.lazycreate=(r,e)=>new x({shape:r,unknownKeys:"strip",catchall:j.create(),typeName:p.ZodObject,..._(e)});class K extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new I(o.ctx.common.issues));return c(t,{code:d.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(s.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const h of s){const f={...t,common:{...t.common,issues:[]},parent:null},v=h._parseSync({data:t.data,path:t.path,parent:f});if(v.status==="valid")return v;v.status==="dirty"&&!a&&(a={result:v,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(h=>new I(h));return c(t,{code:d.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}}K.create=(r,e)=>new K({options:r,typeName:p.ZodUnion,..._(e)});const A=r=>r instanceof me?A(r.schema):r instanceof V?A(r.innerType()):r instanceof re?[r.value]:r instanceof $?r.options:r instanceof pe?g.objectValues(r.enum):r instanceof ne?A(r._def.innerType):r instanceof Q?[void 0]:r instanceof G?[null]:r instanceof N?[void 0,...A(r.unwrap())]:r instanceof M?[null,...A(r.unwrap())]:r instanceof Ie||r instanceof ie?A(r.unwrap()):r instanceof ae?A(r._def.innerType):[];class ye extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return c(t,{code:d.invalid_type,expected:u.object,received:t.parsedType}),m;const s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(c(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const a of t){const i=A(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new ye({typeName:p.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(s)})}}function fe(r,e){const t=Z(r),s=Z(e);if(r===e)return{valid:!0,data:r};if(t===u.object&&s===u.object){const n=g.objectKeys(e),a=g.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(const o of a){const h=fe(r[o],e[o]);if(!h.valid)return{valid:!1};i[o]=h.data}return{valid:!0,data:i}}else if(t===u.array&&s===u.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],h=fe(i,o);if(!h.valid)return{valid:!1};n.push(h.data)}return{valid:!0,data:n}}else return t===u.date&&s===u.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ee extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(xe(a)||xe(i))return m;const o=fe(a.value,i.value);return o.valid?((ke(a)||ke(i))&&t.dirty(),{status:t.value,value:o.data}):(c(s,{code:d.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ee.create=(r,e,t)=>new ee({left:r,right:e,typeName:p.ZodIntersection,..._(t)});class P extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.array)return c(s,{code:d.invalid_type,expected:u.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return c(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(c(s,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const h=this._def.items[o]||this._def.rest;return h?h._parse(new C(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>b.mergeArray(t,i)):b.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new P({...this._def,rest:e})}}P.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:r,typeName:p.ZodTuple,rest:null,..._(e)})};class te extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.object)return c(s,{code:d.invalid_type,expected:u.object,received:s.parsedType}),m;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new C(s,o,s.path,o)),value:i._parse(new C(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?b.mergeObjectAsync(t,n):b.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new te({keyType:e,valueType:t,typeName:p.ZodRecord,..._(s)}):new te({keyType:O.create(),valueType:e,typeName:p.ZodRecord,..._(t)})}}class Ce extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.map)return c(s,{code:d.invalid_type,expected:u.map,received:s.parsedType}),m;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,h],f)=>({key:n._parse(new C(s,o,s.path,[f,"key"])),value:a._parse(new C(s,h,s.path,[f,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const h of i){const f=await h.key,v=await h.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(f.value,v.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const h of i){const f=h.key,v=h.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(f.value,v.value)}return{status:t.value,value:o}}}}Ce.create=(r,e,t)=>new Ce({valueType:e,keyType:r,typeName:p.ZodMap,..._(t)});class q extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.set)return c(s,{code:d.invalid_type,expected:u.set,received:s.parsedType}),m;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(c(s,{code:d.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(c(s,{code:d.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(h){const f=new Set;for(const v of h){if(v.status==="aborted")return m;v.status==="dirty"&&t.dirty(),f.add(v.value)}return{status:t.value,value:f}}const o=[...s.data.values()].map((h,f)=>a._parse(new C(s,h,s.path,f)));return s.common.async?Promise.all(o).then(h=>i(h)):i(o)}min(e,t){return new q({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new q({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}q.create=(r,e)=>new q({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,..._(e)});class me extends y{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}me.create=(r,e)=>new me({getter:r,typeName:p.ZodLazy,..._(e)});class re extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}re.create=(r,e)=>new re({value:r,typeName:p.ZodLiteral,..._(e)});function Ne(r,e){return new $({values:r,typeName:p.ZodEnum,..._(e)})}class $ extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return c(t,{expected:g.joinValues(s),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return c(t,{received:t.data,code:d.invalid_enum_value,options:s}),m}return T(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return $.create(e,{...this._def,...t})}exclude(e,t=this._def){return $.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}$.create=Ne;class pe extends y{_parse(e){const t=g.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==u.string&&s.parsedType!==u.number){const n=g.objectValues(t);return c(s,{expected:g.joinValues(n),received:s.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(g.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=g.objectValues(t);return c(s,{received:s.data,code:d.invalid_enum_value,options:n}),m}return T(e.data)}get enum(){return this._def.values}}pe.create=(r,e)=>new pe({values:r,typeName:p.ZodNativeEnum,..._(e)});class se extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return c(t,{code:d.invalid_type,expected:u.promise,received:t.parsedType}),m;const s=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return T(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}se.create=(r,e)=>new se({type:r,typeName:p.ZodPromise,..._(e)});class V extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{c(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return m;const h=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return h.status==="aborted"?m:h.status==="dirty"||t.value==="dirty"?B(h.value):h});{if(t.value==="aborted")return m;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?m:o.status==="dirty"||t.value==="dirty"?B(o.value):o}}if(n.type==="refinement"){const i=o=>{const h=n.refinement(o,a);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!D(i))return m;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>D(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):m);g.assertNever(n)}}V.create=(r,e,t)=>new V({schema:r,typeName:p.ZodEffects,effect:e,..._(t)});V.createWithPreprocess=(r,e,t)=>new V({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,..._(t)});class N extends y{_parse(e){return this._getType(e)===u.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}N.create=(r,e)=>new N({innerType:r,typeName:p.ZodOptional,..._(e)});class M extends y{_parse(e){return this._getType(e)===u.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}M.create=(r,e)=>new M({innerType:r,typeName:p.ZodNullable,..._(e)});class ne extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===u.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ne.create=(r,e)=>new ne({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class ae extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return H(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new I(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ae.create=(r,e)=>new ae({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class Ee extends y{_parse(e){if(this._getType(e)!==u.nan){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}}Ee.create=r=>new Ee({typeName:p.ZodNaN,..._(r)});class Ie extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class ge extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),B(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new ge({in:e,out:t,typeName:p.ZodPipeline})}}class ie extends y{_parse(e){const t=this._def.innerType._parse(e),s=n=>(D(n)&&(n.value=Object.freeze(n.value)),n);return H(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}ie.create=(r,e)=>new ie({innerType:r,typeName:p.ZodReadonly,..._(e)});var p;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(p||(p={}));const E=O.create,_e=z.create,ft=le.create,mt=Q.create,Ze=G.create,oe=he.create,pt=j.create,_t=S.create,w=x.create,Le=K.create,je=ye.create,Pe=ee.create;P.create;const yt=te.create,R=re.create;$.create;se.create;const J=N.create;M.create;const k=[];for(let r=0;r<256;++r)k.push((r+256).toString(16).slice(1));function gt(r,e=0){return(k[r[e+0]]+k[r[e+1]]+k[r[e+2]]+k[r[e+3]]+"-"+k[r[e+4]]+k[r[e+5]]+"-"+k[r[e+6]]+k[r[e+7]]+"-"+k[r[e+8]]+k[r[e+9]]+"-"+k[r[e+10]]+k[r[e+11]]+k[r[e+12]]+k[r[e+13]]+k[r[e+14]]+k[r[e+15]]).toLowerCase()}let ce;const vt=new Uint8Array(16);function xt(){if(!ce){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ce=crypto.getRandomValues.bind(crypto)}return ce(vt)}const kt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ae={randomUUID:kt};function bt(r,e,t){var n;if(Ae.randomUUID&&!r)return Ae.randomUUID();r=r||{};const s=r.random??((n=r.rng)==null?void 0:n.call(r))??xt();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,gt(s)}E().regex(/^[a-zA-Z0-9:_-]*::[a-z0-9]*/,"Invalid party ID format");const wt=w({method:E(),params:J(Le([_t(oe()),yt(oe())]))}),Tt=w({result:J(oe())}),St=w({error:w({code:_e(),message:E(),data:J(E().or(_e()).or(ft()).or(Ze()).or(oe()))})}),$e=Le([Tt,St]),Ve=w({jsonrpc:R("2.0"),id:J(E().or(_e()).or(mt()).or(Ze()))}),Ct=Pe(Ve,wt),Et=Pe(Ve,$e);var L;(function(r){r.SPLICE_WALLET_REQUEST="SPLICE_WALLET_REQUEST",r.SPLICE_WALLET_RESPONSE="SPLICE_WALLET_RESPONSE",r.SPLICE_WALLET_EXT_READY="SPLICE_WALLET_EXT_READY",r.SPLICE_WALLET_EXT_ACK="SPLICE_WALLET_EXT_ACK",r.SPLICE_WALLET_EXT_OPEN="SPLICE_WALLET_EXT_OPEN",r.SPLICE_WALLET_IDP_AUTH_SUCCESS="SPLICE_WALLET_IDP_AUTH_SUCCESS"})(L||(L={}));je("type",[w({type:R(L.SPLICE_WALLET_REQUEST),request:Ct}),w({type:R(L.SPLICE_WALLET_RESPONSE),response:Et}),w({type:R(L.SPLICE_WALLET_EXT_READY)}),w({type:R(L.SPLICE_WALLET_EXT_ACK)}),w({type:R(L.SPLICE_WALLET_EXT_OPEN),url:E().url()}),w({type:R(L.SPLICE_WALLET_IDP_AUTH_SUCCESS),token:E()})]);je("walletType",[w({walletType:R("extension"),url:J(pt())}),w({walletType:R("remote"),url:E().url()})]);w({name:E(),rpcUrl:E()});class At{constructor(e,t){X(this,"url");X(this,"accessToken");this.url=e,this.accessToken=t}async submit(e){const t={jsonrpc:"2.0",method:e.method,params:e.params,id:bt()},s=this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:void 0,n=await fetch(this.url.href,{method:"POST",headers:{...s,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const a=await n.json();return $e.parse(a)}}class Rt{constructor(e){X(this,"transport");this.transport=e}async request(e,t){const s=await this.transport.submit({method:e,params:t});if("error"in s)throw new Error("RPC error: "+s.error.code+" - "+s.error.message);return s.result}}const Ot={userRpcUri:"http://localhost:3001/rpc"},It=r=>new Rt(new At(new URL(Ot.userRpcUri),r));export{St as E,L as W,It as c};
|
|
1
|
+
var Ue=Object.defineProperty;var De=(r,e,t)=>e in r?Ue(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var X=(r,e,t)=>De(r,typeof e!="symbol"?e+"":e,t);var g;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(const i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(g||(g={}));var ve;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(ve||(ve={}));const u=g.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z=r=>{switch(typeof r){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(r)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(r)?u.array:r===null?u.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?u.promise:typeof Map<"u"&&r instanceof Map?u.map:typeof Set<"u"&&r instanceof Set?u.set:typeof Date<"u"&&r instanceof Date?u.date:u.object;default:return u.unknown}},d=g.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class I extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,h=0;for(;h<i.path.length;){const f=i.path[h];h===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(i))):o[f]=o[f]||{_errors:[]},o=o[f],h++}}};return n(this),s}static assert(e){if(!(e instanceof I))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,g.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}I.create=r=>new I(r);const ue=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===u.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,g.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${g.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${g.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${g.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:g.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.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==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,g.assertNever(r)}return{message:t}};let ze=ue;function We(){return ze}const Be=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const h=s.filter(f=>!!f).slice().reverse();for(const f of h)o=f(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function c(r,e){const t=We(),s=Be({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===ue?void 0:ue].filter(n=>!!n)});r.common.issues.push(s)}class b{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return b.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const m=Object.freeze({status:"aborted"}),B=r=>({status:"dirty",value:r}),T=r=>({status:"valid",value:r}),xe=r=>r.status==="aborted",ke=r=>r.status==="dirty",D=r=>r.status==="valid",H=r=>typeof Promise<"u"&&r instanceof Promise;var l;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(l||(l={}));class C{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const be=(r,e)=>{if(D(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new I(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:h}=r;return i.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:h??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:h??t??o.defaultError}},description:n}}class y{get description(){return this._def.description}_getType(e){return Z(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(H(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parseSync({data:e,path:s.path,parent:s});return be(s,n)}"~validate"(e){var s,n;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return D(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(n=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>D(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(H(n)?n:Promise.resolve(n));return be(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:d.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(h=>h?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new V({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return N.create(this,this._def)}nullable(){return M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return S.create(this)}promise(){return se.create(this,this._def)}or(e){return K.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new V({..._(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ne({..._(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new Ie({typeName:p.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new ae({..._(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ge.create(this,e)}readonly(){return ie.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Fe=/^c[^\s-]{8,}$/i,qe=/^[0-9a-z]+$/,Je=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Xe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,He=/^[a-z0-9_-]{21}$/i,Ye=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ge=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ke="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let de;const et=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,rt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,st=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,at=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Oe="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",it=new RegExp(`^${Oe}$`);function Re(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ot(r){return new RegExp(`^${Re(r)}$`)}function dt(r){let e=`${Oe}T${Re(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ct(r,e){return!!((e==="v4"||!e)&&et.test(r)||(e==="v6"||!e)&&rt.test(r))}function ut(r,e){if(!Ye.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function lt(r,e){return!!((e==="v4"||!e)&&tt.test(r)||(e==="v6"||!e)&&st.test(r))}class R extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.string,received:a.parsedType}),m}const s=new b;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?c(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&c(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Ge.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"email",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")de||(de=new RegExp(Ke,"u")),de.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"emoji",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Xe.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"uuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")He.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"nanoid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Fe.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"cuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")qe.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"cuid2",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Je.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"ulid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),c(n,{validation:"url",code:d.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"regex",code:d.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?dt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?it.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?ot(a).test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{code:d.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Qe.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"duration",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?ct(e.data,a.version)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"ip",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?ut(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"jwt",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?lt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"cidr",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?nt.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"base64",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?at.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"base64url",code:d.invalid_string,message:a.message}),s.dirty()):g.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:d.invalid_string,...l.errToObj(s)})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...l.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...l.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...l.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new R({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}R.create=r=>new R({checks:[],typeName:p.ZodString,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});function ht(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class z extends y{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)!==u.number){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.number,received:a.parsedType}),m}let s;const n=new b;for(const a of this._def.checks)a.kind==="int"?g.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?ht(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:d.not_finite,message:a.message}),n.dirty()):g.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,n){return new z({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(n)}]})}_addCheck(e){return new z({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&g.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}z.create=r=>new z({checks:[],typeName:p.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class F extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==u.bigint)return this._getInvalidInput(e);let s;const n=new b;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),c(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):g.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,s,n){return new F({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:l.toString(n)}]})}_addCheck(e){return new F({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}F.create=r=>new F({checks:[],typeName:p.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});class le extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.boolean,received:s.parsedType}),m}return T(e.data)}}le.create=r=>new le({typeName:p.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class Y extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_type,expected:u.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return c(a,{code:d.invalid_date}),m}const s=new b;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):g.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(t)})}get minDate(){let e=null;for(const 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(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}Y.create=r=>new Y({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:p.ZodDate,..._(r)});class we extends y{_parse(e){if(this._getType(e)!==u.symbol){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.symbol,received:s.parsedType}),m}return T(e.data)}}we.create=r=>new we({typeName:p.ZodSymbol,..._(r)});class Q extends y{_parse(e){if(this._getType(e)!==u.undefined){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.undefined,received:s.parsedType}),m}return T(e.data)}}Q.create=r=>new Q({typeName:p.ZodUndefined,..._(r)});class G extends y{_parse(e){if(this._getType(e)!==u.null){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.null,received:s.parsedType}),m}return T(e.data)}}G.create=r=>new G({typeName:p.ZodNull,..._(r)});class Te extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}}Te.create=r=>new Te({typeName:p.ZodAny,..._(r)});class he extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}}he.create=r=>new he({typeName:p.ZodUnknown,..._(r)});class j extends y{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:d.invalid_type,expected:u.never,received:t.parsedType}),m}}j.create=r=>new j({typeName:p.ZodNever,..._(r)});class Se extends y{_parse(e){if(this._getType(e)!==u.undefined){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.void,received:s.parsedType}),m}return T(e.data)}}Se.create=r=>new Se({typeName:p.ZodVoid,..._(r)});class S extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==u.array)return c(t,{code:d.invalid_type,expected:u.array,received:t.parsedType}),m;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(c(t,{code:i?d.too_big:d.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(c(t,{code:d.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(c(t,{code:d.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new C(t,i,t.path,o)))).then(i=>b.mergeArray(s,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new C(t,i,t.path,o)));return b.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new S({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new S({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new S({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}S.create=(r,e)=>new S({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,..._(e)});function U(r){if(r instanceof x){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=N.create(U(s))}return new x({...r._def,shape:()=>e})}else return r instanceof S?new S({...r._def,type:U(r.element)}):r instanceof N?N.create(U(r.unwrap())):r instanceof M?M.create(U(r.unwrap())):r instanceof P?P.create(r.items.map(e=>U(e))):r}class x extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=g.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const f=this._getOrReturnCtx(e);return c(f,{code:d.invalid_type,expected:u.object,received:f.parsedType}),m}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(const f in n.data)i.includes(f)||o.push(f);const h=[];for(const f of i){const v=a[f],W=n.data[f];h.push({key:{status:"valid",value:f},value:v._parse(new C(n,W,n.path,f)),alwaysSet:f in n.data})}if(this._def.catchall instanceof j){const f=this._def.unknownKeys;if(f==="passthrough")for(const v of o)h.push({key:{status:"valid",value:v},value:{status:"valid",value:n.data[v]}});else if(f==="strict")o.length>0&&(c(n,{code:d.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const v of o){const W=n.data[v];h.push({key:{status:"valid",value:v},value:f._parse(new C(n,W,n.path,v)),alwaysSet:v in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const f=[];for(const v of h){const W=await v.key,Me=await v.value;f.push({key:W,value:Me,alwaysSet:v.alwaysSet})}return f}).then(f=>b.mergeObjectSync(s,f)):b.mergeObjectSync(s,h)}get shape(){return this._def.shape()}strict(e){return l.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var a,i;const n=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:l.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}extend(e){return new x({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new x({...this._def,catchall:e})}pick(e){const t={};for(const s of g.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}omit(e){const t={};for(const s of g.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new x({...this._def,shape:()=>t})}deepPartial(){return U(this)}partial(e){const t={};for(const s of g.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new x({...this._def,shape:()=>t})}required(e){const t={};for(const s of g.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof N;)a=a._def.innerType;t[s]=a}return new x({...this._def,shape:()=>t})}keyof(){return Ne(g.objectKeys(this.shape))}}x.create=(r,e)=>new x({shape:()=>r,unknownKeys:"strip",catchall:j.create(),typeName:p.ZodObject,..._(e)});x.strictCreate=(r,e)=>new x({shape:()=>r,unknownKeys:"strict",catchall:j.create(),typeName:p.ZodObject,..._(e)});x.lazycreate=(r,e)=>new x({shape:r,unknownKeys:"strip",catchall:j.create(),typeName:p.ZodObject,..._(e)});class K extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new I(o.ctx.common.issues));return c(t,{code:d.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(s.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const h of s){const f={...t,common:{...t.common,issues:[]},parent:null},v=h._parseSync({data:t.data,path:t.path,parent:f});if(v.status==="valid")return v;v.status==="dirty"&&!a&&(a={result:v,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(h=>new I(h));return c(t,{code:d.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}}K.create=(r,e)=>new K({options:r,typeName:p.ZodUnion,..._(e)});const A=r=>r instanceof me?A(r.schema):r instanceof V?A(r.innerType()):r instanceof re?[r.value]:r instanceof $?r.options:r instanceof pe?g.objectValues(r.enum):r instanceof ne?A(r._def.innerType):r instanceof Q?[void 0]:r instanceof G?[null]:r instanceof N?[void 0,...A(r.unwrap())]:r instanceof M?[null,...A(r.unwrap())]:r instanceof Ie||r instanceof ie?A(r.unwrap()):r instanceof ae?A(r._def.innerType):[];class ye extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return c(t,{code:d.invalid_type,expected:u.object,received:t.parsedType}),m;const s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(c(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const a of t){const i=A(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new ye({typeName:p.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(s)})}}function fe(r,e){const t=Z(r),s=Z(e);if(r===e)return{valid:!0,data:r};if(t===u.object&&s===u.object){const n=g.objectKeys(e),a=g.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(const o of a){const h=fe(r[o],e[o]);if(!h.valid)return{valid:!1};i[o]=h.data}return{valid:!0,data:i}}else if(t===u.array&&s===u.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],h=fe(i,o);if(!h.valid)return{valid:!1};n.push(h.data)}return{valid:!0,data:n}}else return t===u.date&&s===u.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ee extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(xe(a)||xe(i))return m;const o=fe(a.value,i.value);return o.valid?((ke(a)||ke(i))&&t.dirty(),{status:t.value,value:o.data}):(c(s,{code:d.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ee.create=(r,e,t)=>new ee({left:r,right:e,typeName:p.ZodIntersection,..._(t)});class P extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.array)return c(s,{code:d.invalid_type,expected:u.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return c(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(c(s,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const h=this._def.items[o]||this._def.rest;return h?h._parse(new C(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>b.mergeArray(t,i)):b.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new P({...this._def,rest:e})}}P.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new P({items:r,typeName:p.ZodTuple,rest:null,..._(e)})};class te extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.object)return c(s,{code:d.invalid_type,expected:u.object,received:s.parsedType}),m;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new C(s,o,s.path,o)),value:i._parse(new C(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?b.mergeObjectAsync(t,n):b.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new te({keyType:e,valueType:t,typeName:p.ZodRecord,..._(s)}):new te({keyType:R.create(),valueType:e,typeName:p.ZodRecord,..._(t)})}}class Ce extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.map)return c(s,{code:d.invalid_type,expected:u.map,received:s.parsedType}),m;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,h],f)=>({key:n._parse(new C(s,o,s.path,[f,"key"])),value:a._parse(new C(s,h,s.path,[f,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const h of i){const f=await h.key,v=await h.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(f.value,v.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const h of i){const f=h.key,v=h.value;if(f.status==="aborted"||v.status==="aborted")return m;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(f.value,v.value)}return{status:t.value,value:o}}}}Ce.create=(r,e,t)=>new Ce({valueType:e,keyType:r,typeName:p.ZodMap,..._(t)});class q extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.set)return c(s,{code:d.invalid_type,expected:u.set,received:s.parsedType}),m;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(c(s,{code:d.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(c(s,{code:d.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(h){const f=new Set;for(const v of h){if(v.status==="aborted")return m;v.status==="dirty"&&t.dirty(),f.add(v.value)}return{status:t.value,value:f}}const o=[...s.data.values()].map((h,f)=>a._parse(new C(s,h,s.path,f)));return s.common.async?Promise.all(o).then(h=>i(h)):i(o)}min(e,t){return new q({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new q({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}q.create=(r,e)=>new q({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,..._(e)});class me extends y{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}me.create=(r,e)=>new me({getter:r,typeName:p.ZodLazy,..._(e)});class re extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}re.create=(r,e)=>new re({value:r,typeName:p.ZodLiteral,..._(e)});function Ne(r,e){return new $({values:r,typeName:p.ZodEnum,..._(e)})}class $ extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return c(t,{expected:g.joinValues(s),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return c(t,{received:t.data,code:d.invalid_enum_value,options:s}),m}return T(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return $.create(e,{...this._def,...t})}exclude(e,t=this._def){return $.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}$.create=Ne;class pe extends y{_parse(e){const t=g.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==u.string&&s.parsedType!==u.number){const n=g.objectValues(t);return c(s,{expected:g.joinValues(n),received:s.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(g.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=g.objectValues(t);return c(s,{received:s.data,code:d.invalid_enum_value,options:n}),m}return T(e.data)}get enum(){return this._def.values}}pe.create=(r,e)=>new pe({values:r,typeName:p.ZodNativeEnum,..._(e)});class se extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return c(t,{code:d.invalid_type,expected:u.promise,received:t.parsedType}),m;const s=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return T(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}se.create=(r,e)=>new se({type:r,typeName:p.ZodPromise,..._(e)});class V extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{c(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return m;const h=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return h.status==="aborted"?m:h.status==="dirty"||t.value==="dirty"?B(h.value):h});{if(t.value==="aborted")return m;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?m:o.status==="dirty"||t.value==="dirty"?B(o.value):o}}if(n.type==="refinement"){const i=o=>{const h=n.refinement(o,a);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!D(i))return m;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>D(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):m);g.assertNever(n)}}V.create=(r,e,t)=>new V({schema:r,typeName:p.ZodEffects,effect:e,..._(t)});V.createWithPreprocess=(r,e,t)=>new V({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,..._(t)});class N extends y{_parse(e){return this._getType(e)===u.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}N.create=(r,e)=>new N({innerType:r,typeName:p.ZodOptional,..._(e)});class M extends y{_parse(e){return this._getType(e)===u.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}M.create=(r,e)=>new M({innerType:r,typeName:p.ZodNullable,..._(e)});class ne extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===u.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ne.create=(r,e)=>new ne({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class ae extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return H(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new I(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new I(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ae.create=(r,e)=>new ae({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class Ee extends y{_parse(e){if(this._getType(e)!==u.nan){const s=this._getOrReturnCtx(e);return c(s,{code:d.invalid_type,expected:u.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}}Ee.create=r=>new Ee({typeName:p.ZodNaN,..._(r)});class Ie extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class ge extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),B(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new ge({in:e,out:t,typeName:p.ZodPipeline})}}class ie extends y{_parse(e){const t=this._def.innerType._parse(e),s=n=>(D(n)&&(n.value=Object.freeze(n.value)),n);return H(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}ie.create=(r,e)=>new ie({innerType:r,typeName:p.ZodReadonly,..._(e)});var p;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(p||(p={}));const E=R.create,_e=z.create,ft=le.create,mt=Q.create,Ze=G.create,oe=he.create,pt=j.create,_t=S.create,w=x.create,Le=K.create,je=ye.create,Pe=ee.create;P.create;const yt=te.create,O=re.create;$.create;se.create;const J=N.create;M.create;const k=[];for(let r=0;r<256;++r)k.push((r+256).toString(16).slice(1));function gt(r,e=0){return(k[r[e+0]]+k[r[e+1]]+k[r[e+2]]+k[r[e+3]]+"-"+k[r[e+4]]+k[r[e+5]]+"-"+k[r[e+6]]+k[r[e+7]]+"-"+k[r[e+8]]+k[r[e+9]]+"-"+k[r[e+10]]+k[r[e+11]]+k[r[e+12]]+k[r[e+13]]+k[r[e+14]]+k[r[e+15]]).toLowerCase()}let ce;const vt=new Uint8Array(16);function xt(){if(!ce){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ce=crypto.getRandomValues.bind(crypto)}return ce(vt)}const kt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ae={randomUUID:kt};function bt(r,e,t){var n;if(Ae.randomUUID&&!r)return Ae.randomUUID();r=r||{};const s=r.random??((n=r.rng)==null?void 0:n.call(r))??xt();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,gt(s)}E().regex(/^[a-zA-Z0-9:_-]*::[a-z0-9]*/,"Invalid party ID format");const wt=w({method:E(),params:J(Le([_t(oe()),yt(oe())]))}),Tt=w({result:J(oe())}),St=w({error:w({code:_e(),message:E(),data:J(E().or(_e()).or(ft()).or(Ze()).or(oe()))})}),$e=Le([Tt,St]),Ve=w({jsonrpc:O("2.0"),id:J(E().or(_e()).or(mt()).or(Ze()))}),Ct=Pe(Ve,wt),Et=Pe(Ve,$e);var L;(function(r){r.SPLICE_WALLET_REQUEST="SPLICE_WALLET_REQUEST",r.SPLICE_WALLET_RESPONSE="SPLICE_WALLET_RESPONSE",r.SPLICE_WALLET_EXT_READY="SPLICE_WALLET_EXT_READY",r.SPLICE_WALLET_EXT_ACK="SPLICE_WALLET_EXT_ACK",r.SPLICE_WALLET_EXT_OPEN="SPLICE_WALLET_EXT_OPEN",r.SPLICE_WALLET_IDP_AUTH_SUCCESS="SPLICE_WALLET_IDP_AUTH_SUCCESS"})(L||(L={}));je("type",[w({type:O(L.SPLICE_WALLET_REQUEST),request:Ct}),w({type:O(L.SPLICE_WALLET_RESPONSE),response:Et}),w({type:O(L.SPLICE_WALLET_EXT_READY)}),w({type:O(L.SPLICE_WALLET_EXT_ACK)}),w({type:O(L.SPLICE_WALLET_EXT_OPEN),url:E().url()}),w({type:O(L.SPLICE_WALLET_IDP_AUTH_SUCCESS),token:E()})]);je("walletType",[w({walletType:O("extension"),url:J(pt())}),w({walletType:O("remote"),url:E().url()})]);w({name:E(),rpcUrl:E()});class At{constructor(e,t){X(this,"url");X(this,"accessToken");this.url=e,this.accessToken=t}async submit(e){const t={jsonrpc:"2.0",method:e.method,params:e.params,id:bt()},s=this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:void 0,n=await fetch(this.url.href,{method:"POST",headers:{...s,"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const a=await n.json();return $e.parse(a)}}class Ot{constructor(e){X(this,"transport");this.transport=e}async request(e,t){const s=await this.transport.submit({method:e,params:t});if("error"in s)throw new Error("RPC error: "+s.error.code+" - "+s.error.message);return s.result}}const Nt=r=>new Ot(new At(new URL(`${window.location.origin}/api/v0/user`),r));export{St as E,L as W,Nt as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as Tf,s as er,a as C0,i as B0,t as M0}from"./state-manager-BNW0y5PZ.js";import{r as Lf}from"./state-DKGJ6EmM.js";import"./index-VtAAU1cN.js";import{c as ar}from"./rpc-client-
|
|
1
|
+
import{x as Tf,s as er,a as C0,i as B0,t as M0}from"./state-manager-BNW0y5PZ.js";import{r as Lf}from"./state-DKGJ6EmM.js";import"./index-VtAAU1cN.js";import{c as ar}from"./rpc-client-TGo-LOnR.js";import"./index-BPTkodPz.js";import{h as T0}from"./handle-errors-BM-xvD4v.js";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>Wallet Kernel Remote Callback</title>
|
|
6
|
-
<script type="module" crossorigin src="/assets/callback-
|
|
6
|
+
<script type="module" crossorigin src="/assets/callback-D9y0DRns.js"></script>
|
|
7
7
|
<link rel="modulepreload" crossorigin href="/assets/state-manager-BNW0y5PZ.js">
|
|
8
|
-
<link rel="modulepreload" crossorigin href="/assets/rpc-client-
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/assets/rpc-client-TGo-LOnR.js">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<login-callback></login-callback>
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>Wallet Kernel Login</title>
|
|
6
|
-
<script type="module" crossorigin src="/assets/login-
|
|
6
|
+
<script type="module" crossorigin src="/assets/login-DJofeRCg.js"></script>
|
|
7
7
|
<link rel="modulepreload" crossorigin href="/assets/state-manager-BNW0y5PZ.js">
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/index-VtAAU1cN.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/index-BPTkodPz.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/state-DKGJ6EmM.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/rpc-client-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/rpc-client-TGo-LOnR.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-TZrNw7dA.css">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/assets/index-BknZMPaI.css">
|
|
14
14
|
</head>
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>Wallet Kernel Login</title>
|
|
6
|
-
<script type="module" crossorigin src="/assets/networks-
|
|
6
|
+
<script type="module" crossorigin src="/assets/networks-CZV8G3N2.js"></script>
|
|
7
7
|
<link rel="modulepreload" crossorigin href="/assets/state-manager-BNW0y5PZ.js">
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/index-VtAAU1cN.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/state-DKGJ6EmM.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/rpc-client-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="/assets/handle-errors-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/rpc-client-TGo-LOnR.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/handle-errors-BM-xvD4v.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-TZrNw7dA.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<title>Wallet Kernel – Wallets</title>
|
|
6
|
-
<script type="module" crossorigin src="/assets/wallets-
|
|
6
|
+
<script type="module" crossorigin src="/assets/wallets-DwPVJP85.js"></script>
|
|
7
7
|
<link rel="modulepreload" crossorigin href="/assets/state-manager-BNW0y5PZ.js">
|
|
8
8
|
<link rel="modulepreload" crossorigin href="/assets/state-DKGJ6EmM.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/index-VtAAU1cN.js">
|
|
10
|
-
<link rel="modulepreload" crossorigin href="/assets/rpc-client-
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/rpc-client-TGo-LOnR.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/index-BPTkodPz.js">
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/handle-errors-
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/handle-errors-BM-xvD4v.js">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/assets/index-TZrNw7dA.css">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="/assets/index-BknZMPaI.css">
|
|
15
15
|
</head>
|
package/dist/web/server.d.ts
CHANGED
package/dist/web/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/web/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/web/server.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAK7B,eAAO,MAAM,GAAG,GAAI,KAAK,OAAO,CAAC,OAAO,EAAE,QAAQ,MAAM,oBAmDvD,CAAA"}
|
package/dist/web/server.js
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import express from 'express';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
web
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
req.path.includes('.') || // Ignore paths with file extensions
|
|
12
|
-
req.path.includes('@vite') // Ignore Vite dev server paths
|
|
13
|
-
) {
|
|
14
|
-
return next(); // Skip if not a GET request or already has a trailing slash
|
|
4
|
+
import path, { dirname } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import ViteExpress from 'vite-express';
|
|
7
|
+
export const web = (app, server) => {
|
|
8
|
+
if (process.env.NODE_ENV === 'development') {
|
|
9
|
+
// Enable live reloading and Vite dev server for frontend in development
|
|
10
|
+
ViteExpress.bind(app, server);
|
|
15
11
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
else {
|
|
13
|
+
// Serve static files from the package build in production
|
|
14
|
+
app.use(express.static(path.resolve(dirname(fileURLToPath(import.meta.url)), '../../dist/web/frontend')));
|
|
15
|
+
}
|
|
16
|
+
// Middleware to ensure all paths end with a trailing slash
|
|
17
|
+
// This is useful for static file serving and routing consistency
|
|
18
|
+
app.use((req, res, next) => {
|
|
19
|
+
if (req.method !== 'GET' ||
|
|
20
|
+
req.path.length <= 1 || // Skip root path
|
|
21
|
+
req.path.startsWith('/api') || // Ignore API routes
|
|
22
|
+
req.path.endsWith('/') || // Path already ends with a slash
|
|
23
|
+
req.path.includes('.') || // Ignore paths with file extensions
|
|
24
|
+
req.path.includes('@vite') // Ignore Vite dev server paths
|
|
25
|
+
) {
|
|
26
|
+
return next(); // Skip if not a GET request or already has a trailing slash
|
|
21
27
|
}
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
try {
|
|
29
|
+
const query = req.url.slice(req.path.length); // Preserve query parameters
|
|
30
|
+
const redirectUrl = new URL(req.path + '/' + query, `${req.protocol}://${req.headers.host}`);
|
|
31
|
+
if (redirectUrl.origin === `${req.protocol}://${req.headers.host}`) {
|
|
32
|
+
res.redirect(301, req.path + '/' + query); // Redirect with 301 (Permanent Redirect)
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
next(); // Skip redirection if origin check fails
|
|
36
|
+
}
|
|
24
37
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
38
|
+
catch {
|
|
39
|
+
// Skip if the URL construction fails
|
|
40
|
+
next();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return app;
|
|
44
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/wallet-gateway-remote",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A server-side Wallet Gateway implementation over HTTP",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@canton-network/core-ledger-client": "",
|
|
36
|
-
"@canton-network/core-rpc-errors": "",
|
|
37
|
-
"@canton-network/core-signing-internal": "",
|
|
38
|
-
"@canton-network/core-signing-lib": "",
|
|
39
|
-
"@canton-network/core-signing-participant": "",
|
|
40
|
-
"@canton-network/core-tx-visualizer": "",
|
|
41
|
-
"@canton-network/core-types": "",
|
|
42
|
-
"@canton-network/core-wallet-auth": "",
|
|
43
|
-
"@canton-network/core-wallet-dapp-rpc-client": "",
|
|
44
|
-
"@canton-network/core-wallet-store": "",
|
|
45
|
-
"@canton-network/core-wallet-store-sql": "",
|
|
46
|
-
"@canton-network/core-wallet-ui-components": "",
|
|
47
|
-
"@canton-network/core-wallet-user-rpc-client": "",
|
|
35
|
+
"@canton-network/core-ledger-client": "^0.15.0",
|
|
36
|
+
"@canton-network/core-rpc-errors": "^0.6.0",
|
|
37
|
+
"@canton-network/core-signing-internal": "^0.9.0",
|
|
38
|
+
"@canton-network/core-signing-lib": "^0.11.0",
|
|
39
|
+
"@canton-network/core-signing-participant": "^0.9.0",
|
|
40
|
+
"@canton-network/core-tx-visualizer": "^0.9.0",
|
|
41
|
+
"@canton-network/core-types": "^0.9.0",
|
|
42
|
+
"@canton-network/core-wallet-auth": "^0.10.0",
|
|
43
|
+
"@canton-network/core-wallet-dapp-rpc-client": "^0.10.0",
|
|
44
|
+
"@canton-network/core-wallet-store": "^0.9.0",
|
|
45
|
+
"@canton-network/core-wallet-store-sql": "^0.10.0",
|
|
46
|
+
"@canton-network/core-wallet-ui-components": "^0.9.0",
|
|
47
|
+
"@canton-network/core-wallet-user-rpc-client": "^0.10.0",
|
|
48
48
|
"@commander-js/extra-typings": "^14.0.0",
|
|
49
49
|
"commander": "^14.0.1",
|
|
50
50
|
"cors": "^2.8.5",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"zod": "^3.25.64"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@canton-network/core-wallet-store-inmemory": "",
|
|
64
|
+
"@canton-network/core-wallet-store-inmemory": "^0.11.0",
|
|
65
65
|
"@jest/globals": "^29.0.0",
|
|
66
66
|
"@swc/core": "^1.11.31",
|
|
67
67
|
"@swc/jest": "^0.2.38",
|