@canton-network/wallet-gateway-remote 0.3.0 → 0.5.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.
Files changed (70) hide show
  1. package/README.md +4 -16
  2. package/dist/auth/jwt-auth-service.d.ts +1 -1
  3. package/dist/auth/jwt-auth-service.d.ts.map +1 -1
  4. package/dist/auth/jwt-auth-service.js +11 -1
  5. package/dist/auth/jwt-unsafe-auth-service.d.ts +11 -0
  6. package/dist/auth/jwt-unsafe-auth-service.d.ts.map +1 -0
  7. package/dist/auth/jwt-unsafe-auth-service.js +50 -0
  8. package/dist/config/Config.d.ts +144 -30
  9. package/dist/config/Config.d.ts.map +1 -1
  10. package/dist/dapp-api/controller.d.ts +2 -0
  11. package/dist/dapp-api/controller.d.ts.map +1 -1
  12. package/dist/dapp-api/controller.js +29 -7
  13. package/dist/dapp-api/rpc-gen/index.d.ts +6 -0
  14. package/dist/dapp-api/rpc-gen/index.d.ts.map +1 -1
  15. package/dist/dapp-api/rpc-gen/index.js +2 -0
  16. package/dist/dapp-api/rpc-gen/typings.d.ts +23 -17
  17. package/dist/dapp-api/rpc-gen/typings.d.ts.map +1 -1
  18. package/dist/dapp-api/server.d.ts +4 -1
  19. package/dist/dapp-api/server.d.ts.map +1 -1
  20. package/dist/dapp-api/server.js +12 -16
  21. package/dist/dapp-api/server.test.js +19 -9
  22. package/dist/index.d.ts +7 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +15 -1
  25. package/dist/init.d.ts +3 -8
  26. package/dist/init.d.ts.map +1 -1
  27. package/dist/init.js +55 -32
  28. package/dist/ledger/party-allocation-service.d.ts +2 -1
  29. package/dist/ledger/party-allocation-service.d.ts.map +1 -1
  30. package/dist/ledger/party-allocation-service.js +4 -4
  31. package/dist/ledger/party-allocation-service.test.js +11 -2
  32. package/dist/ledger/wallet-sync-service.d.ts.map +1 -1
  33. package/dist/ledger/wallet-sync-service.js +1 -1
  34. package/dist/user-api/controller.d.ts.map +1 -1
  35. package/dist/user-api/controller.js +57 -12
  36. package/dist/user-api/rpc-gen/typings.d.ts +10 -0
  37. package/dist/user-api/rpc-gen/typings.d.ts.map +1 -1
  38. package/dist/user-api/server.d.ts +6 -4
  39. package/dist/user-api/server.d.ts.map +1 -1
  40. package/dist/user-api/server.js +4 -13
  41. package/dist/user-api/server.test.js +11 -10
  42. package/dist/web/frontend/404/index.html +3 -6
  43. package/dist/web/frontend/approve/index.html +5 -9
  44. package/dist/web/frontend/assets/{404-FxmR286l.js → 404-BJiXCpwg.js} +3 -3
  45. package/dist/web/frontend/assets/approve-hB6irrWF.js +157 -0
  46. package/dist/web/frontend/assets/callback-DHz7ggNR.js +1 -0
  47. package/dist/web/frontend/assets/handle-errors-DT2Go5Ch.js +1 -0
  48. package/dist/web/frontend/assets/{index-BknZMPaI.css → index-HEe9--Xd.css} +1 -1
  49. package/dist/web/frontend/assets/{index-VtAAU1cN.js → index-YpAHEASq.js} +64 -51
  50. package/dist/web/frontend/assets/login-Dw5jymys.js +159 -0
  51. package/dist/web/frontend/assets/{networks-CjofhwC9.js → networks-CaAXx7MG.js} +9 -9
  52. package/dist/web/frontend/assets/{state-DKGJ6EmM.js → state-BTqOtYLt.js} +2 -2
  53. package/dist/web/frontend/assets/{wallets-BPtpBguD.js → wallets-fk9mMhcI.js} +4 -4
  54. package/dist/web/frontend/callback/index.html +3 -3
  55. package/dist/web/frontend/index.html +2 -5
  56. package/dist/web/frontend/login/index.html +5 -8
  57. package/dist/web/frontend/networks/index.html +6 -8
  58. package/dist/web/frontend/wallets/index.html +5 -9
  59. package/dist/web/server.d.ts +3 -1
  60. package/dist/web/server.d.ts.map +1 -1
  61. package/dist/web/server.js +38 -24
  62. package/package.json +17 -17
  63. package/dist/web/frontend/assets/approve-DjrMmUo0.js +0 -157
  64. package/dist/web/frontend/assets/callback-QrXhW3mX.js +0 -1
  65. package/dist/web/frontend/assets/handle-errors-BcwHAkCd.js +0 -1
  66. package/dist/web/frontend/assets/index-BPTkodPz.js +0 -1
  67. package/dist/web/frontend/assets/index-TZrNw7dA.css +0 -1
  68. package/dist/web/frontend/assets/login-kWEHTsIr.js +0 -159
  69. package/dist/web/frontend/assets/rpc-client-CCUlY3sp.js +0 -1
  70. package/dist/web/frontend/assets/state-manager-BNW0y5PZ.js +0 -23
@@ -1 +0,0 @@
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-CCUlY3sp.js";var I=Object.create,u=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?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,T=(e,t)=>u(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,w=0,b=e[w]||(e[w]=[]),_=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),_&&u(a,o,_),l?r^4?c:_:a},C,f,S;C=[L("login-callback")];class h 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:"http://localhost:3002/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);h=M(f,0,"LoginCallback",C,h);D(f,1,h);
@@ -1 +0,0 @@
1
- import{E as i}from"./rpc-client-CCUlY3sp.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 +0,0 @@
1
- import{i as E,s as T,t as m}from"./state-manager-BNW0y5PZ.js";import"./index-VtAAU1cN.js";var y=Object.create,u=Object.defineProperty,g=Object.getOwnPropertyDescriptor,I=(e,r)=>(r=Symbol[e])?r:Symbol.for("Symbol."+e),b=e=>{throw TypeError(e)},z=(e,r,o)=>r in e?u(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,F=(e,r)=>u(e,"name",{value:r,configurable:!0}),O=e=>[,,,y((e==null?void 0:e[I("metadata")])??null)],L=["class","method","getter","setter","accessor","field","value","get","set"],A=e=>e!==void 0&&typeof e!="function"?b("Function expected"):e,N=(e,r,o,c,t)=>({kind:L[e],name:r,metadata:c,addInitializer:a=>o._?b("Already initialized"):t.push(A(a||null))}),j=(e,r)=>z(r,I("metadata"),e[3]),R=(e,r,o,c)=>{for(var t=0,a=e[r>>1],n=a&&a.length;t<n;t++)a[t].call(o);return c},k=(e,r,o,c,t,a)=>{var n,w,U,i=r&7,f=!1,h=0,S=e[h]||(e[h]=[]),l=i&&(t=t.prototype,i<5&&(i>3||!f)&&g(t,o));F(t,o);for(var _=c.length-1;_>=0;_--)U=N(i,o,w={},e[3],S),n=(0,c[_])(t,U),w._=1,A(n)&&(t=n);return j(e,t),l&&u(t,o,l),f?i^4?a:l:t},x,v,C,D,p,P;const G="/wallets",M="/404",W=["/wallets","/networks","approve","/"];x=[m("user-ui")];class d extends(C=E){connectedCallback(){super.connectedCallback(),W.includes(window.location.pathname)?window.location.href=G:window.location.href=M}}v=O(C);d=k(v,0,"UserUI",x,d);R(v,1,d);D=[m("user-ui-auth-redirect")];class s extends(P=E){connectedCallback(){super.connectedCallback(),T.accessToken.get()||(window.location.href="/login/")}}p=O(P);s=k(p,0,"UserUIAuthRedirect",D,s);R(p,1,s);
@@ -1 +0,0 @@
1
- body{margin:0}
@@ -1,159 +0,0 @@
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-CCUlY3sp.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
- <div class="card">
3
- <h1>Sign in to Canton Network</h1>
4
-
5
- <select id="network" @change=${this.handleChange}>
6
- <option value="">Select Network</option>
7
- ${this.idps.map((t,r)=>b`<option
8
- value=${r}
9
- ?disabled=${t.auth.type!=="implicit"}
10
- >
11
- ${t.name}
12
- </option>`)}
13
- </select>
14
-
15
- <button @click=${this.handleConnectToIDP}>Connect</button>
16
-
17
- ${this.message?b`<div class="message ${this.messageType}">
18
- ${this.message}
19
- </div>`:b`<p>
20
- ${this.selectedNetwork?`Selected: ${this.selectedNetwork.name}`:"Please choose a network"}
21
- </p>`}
22
- </div>
23
- `}}a=re(I);T=new WeakMap;P=new WeakMap;U=new WeakMap;O=new WeakMap;f(a,4,"idps",H,g,T);f(a,4,"selectedNetwork",B,g,P);f(a,4,"message",J,g,U);f(a,4,"messageType",G,g,O);g=f(a,0,"LoginUI",K,g);g.styles=V`
24
- :host {
25
- display: flex;
26
- align-items: center;
27
- justify-content: center;
28
- width: 100%;
29
- padding: 1.5rem;
30
- box-sizing: border-box;
31
- color: var(--text-color, #222);
32
- background: transparent;
33
- }
34
-
35
- :host([theme='dark']) {
36
- --card-bg: #1e1e1e;
37
- --text-color: #fff;
38
- --border-color: #333;
39
- --button-bg: #4caf50;
40
- --button-hover: #66bb6a;
41
- --error-color: #ff6b6b;
42
- --info-color: #81c784;
43
- }
44
-
45
- :host(:not([theme='dark'])) {
46
- --card-bg: #fff;
47
- --border-color: #ddd;
48
- --button-bg: #4caf50;
49
- --button-hover: #43a047;
50
- --error-color: #d32f2f;
51
- --info-color: #388e3c;
52
- }
53
-
54
- .card {
55
- background: var(--card-bg);
56
- border: 1px solid var(--border-color);
57
- border-radius: 16px;
58
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
59
- padding: 1.5rem;
60
- width: 100%;
61
- max-width: 360px;
62
- display: flex;
63
- flex-direction: column;
64
- gap: 1rem;
65
- text-align: center;
66
- box-sizing: border-box;
67
- }
68
-
69
- h1 {
70
- font-size: 1.25rem;
71
- margin: 0.25rem 0 0.5rem 0;
72
- }
73
-
74
- select {
75
- appearance: none;
76
- padding: 0.6rem 0.75rem;
77
- border-radius: 8px;
78
- border: 1px solid var(--border-color);
79
- background: var(--card-bg);
80
- color: var(--text-color);
81
- font-size: 1rem;
82
- cursor: pointer;
83
- outline: none;
84
- transition: border 0.2s ease;
85
- width: 100%;
86
- box-sizing: border-box;
87
- }
88
-
89
- select:focus {
90
- border-color: #4caf50;
91
- }
92
-
93
- button {
94
- padding: 0.7rem;
95
- border-radius: 8px;
96
- border: none;
97
- cursor: pointer;
98
- background: var(--button-bg);
99
- color: white;
100
- font-weight: 600;
101
- font-size: 1rem;
102
- transition: background 0.2s ease;
103
- width: 100%;
104
- }
105
-
106
- button:hover {
107
- background: var(--button-hover);
108
- }
109
-
110
- .message {
111
- font-size: 0.85rem;
112
- border-radius: 6px;
113
- padding: 0.5rem;
114
- text-align: center;
115
- transition: opacity 0.2s ease;
116
- }
117
-
118
- .message.error {
119
- color: var(--error-color);
120
- background-color: color-mix(
121
- in srgb,
122
- var(--error-color) 10%,
123
- transparent
124
- );
125
- }
126
-
127
- .message.info {
128
- color: var(--info-color);
129
- background-color: color-mix(
130
- in srgb,
131
- var(--info-color) 10%,
132
- transparent
133
- );
134
- }
135
-
136
- p {
137
- font-size: 0.85rem;
138
- color: var(--text-color);
139
- opacity: 0.8;
140
- margin-top: 0.25rem;
141
- }
142
-
143
- @media (max-width: 480px) {
144
- .card {
145
- border-radius: 12px;
146
- padding: 1.25rem;
147
- gap: 0.75rem;
148
- }
149
-
150
- h1 {
151
- font-size: 1.1rem;
152
- }
153
-
154
- button,
155
- select {
156
- font-size: 0.95rem;
157
- }
158
- }
159
- `;u(a,1,g);
@@ -1 +0,0 @@
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,23 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const n of o.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&i(n)}).observe(document,{childList:!0,subtree:!0});function e(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=e(s);fetch(s.href,o)}})();/**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const M=globalThis,j=M.ShadowRoot&&(M.ShadyCSS===void 0||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,B=Symbol(),q=new WeakMap;let st=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==B)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(j&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=q.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&q.set(e,t))}return t}toString(){return this.cssText}};const at=r=>new st(typeof r=="string"?r:r+"",void 0,B),xt=(r,...t)=>{const e=r.length===1?r[0]:t.reduce(((i,s,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[o+1]),r[0]);return new st(e,r,B)},lt=(r,t)=>{if(j)r.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const e of t){const i=document.createElement("style"),s=M.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,r.appendChild(i)}},K=j?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return at(e)})(r):r;/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:ct,defineProperty:dt,getOwnPropertyDescriptor:ut,getOwnPropertyNames:pt,getOwnPropertySymbols:$t,getPrototypeOf:ft}=Object,_=globalThis,F=_.trustedTypes,_t=F?F.emptyScript:"",L=_.reactiveElementPolyfillSupport,w=(r,t)=>r,k={toAttribute(r,t){switch(t){case Boolean:r=r?_t:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},it=(r,t)=>!ct(r,t),J={attribute:!0,type:String,converter:k,reflect:!1,useDefault:!1,hasChanged:it};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),_.litPropertyMetadata??(_.litPropertyMetadata=new WeakMap);let v=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=J){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);s!==void 0&&dt(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:o}=ut(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:s,set(n){const a=s==null?void 0:s.call(this);o==null||o.call(this,n),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??J}static _$Ei(){if(this.hasOwnProperty(w("elementProperties")))return;const t=ft(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(w("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(w("properties"))){const e=this.properties,i=[...pt(e),...$t(e)];for(const s of i)this.createProperty(s,e[s])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,s]of e)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const s=this._$Eu(e,i);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(K(s))}else t!==void 0&&e.push(K(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach((e=>e(this)))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return lt(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach((e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)}))}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach((e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){var o;const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(s!==void 0&&i.reflect===!0){const n=(((o=i.converter)==null?void 0:o.toAttribute)!==void 0?i.converter:k).toAttribute(e,i.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){var o,n;const i=this.constructor,s=i._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=i.getPropertyOptions(s),h=typeof a.converter=="function"?{fromAttribute:a.converter}:((o=a.converter)==null?void 0:o.fromAttribute)!==void 0?a.converter:k;this._$Em=s;const c=h.fromAttribute(e,a.type);this[s]=c??((n=this._$Ej)==null?void 0:n.get(s))??c,this._$Em=null}}requestUpdate(t,e,i){var s;if(t!==void 0){const o=this.constructor,n=this[t];if(i??(i=o.getPropertyOptions(t)),!((i.hasChanged??it)(n,e)||i.useDefault&&i.reflect&&n===((s=this._$Ej)==null?void 0:s.get(t))&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:o},n){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),s===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,n]of this._$Ep)this[o]=n;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[o,n]of s){const{wrapped:a}=n,h=this[o];a!==!0||this._$AL.has(o)||h===void 0||this.C(o,void 0,n,h)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach((s=>{var o;return(o=s.hostUpdate)==null?void 0:o.call(s)})),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach((i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach((e=>this._$ET(e,this[e])))),this._$EM()}updated(t){}firstUpdated(t){}};v.elementStyles=[],v.shadowRootOptions={mode:"open"},v[w("elementProperties")]=new Map,v[w("finalized")]=new Map,L==null||L({ReactiveElement:v}),(_.reactiveElementVersions??(_.reactiveElementVersions=[])).push("2.1.1");/**
10
- * @license
11
- * Copyright 2017 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const C=globalThis,R=C.trustedTypes,Z=R?R.createPolicy("lit-html",{createHTML:r=>r}):void 0,rt="$lit$",f=`lit$${Math.random().toFixed(9).slice(2)}$`,ot="?"+f,gt=`<${ot}>`,y=document,x=()=>y.createComment(""),O=r=>r===null||typeof r!="object"&&typeof r!="function",V=Array.isArray,mt=r=>V(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",W=`[
14
- \f\r]`,b=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,G=/-->/g,Q=/>/g,g=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),X=/'/g,Y=/"/g,nt=/^(?:script|style|textarea|title)$/i,At=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),Ut=At(1),S=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),tt=new WeakMap,m=y.createTreeWalker(y,129);function ht(r,t){if(!V(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Z!==void 0?Z.createHTML(t):t}const yt=(r,t)=>{const e=r.length-1,i=[];let s,o=t===2?"<svg>":t===3?"<math>":"",n=b;for(let a=0;a<e;a++){const h=r[a];let c,u,l=-1,p=0;for(;p<h.length&&(n.lastIndex=p,u=n.exec(h),u!==null);)p=n.lastIndex,n===b?u[1]==="!--"?n=G:u[1]!==void 0?n=Q:u[2]!==void 0?(nt.test(u[2])&&(s=RegExp("</"+u[2],"g")),n=g):u[3]!==void 0&&(n=g):n===g?u[0]===">"?(n=s??b,l=-1):u[1]===void 0?l=-2:(l=n.lastIndex-u[2].length,c=u[1],n=u[3]===void 0?g:u[3]==='"'?Y:X):n===Y||n===X?n=g:n===G||n===Q?n=b:(n=g,s=void 0);const $=n===g&&r[a+1].startsWith("/>")?" ":"";o+=n===b?h+gt:l>=0?(i.push(c),h.slice(0,l)+rt+h.slice(l)+f+$):h+f+(l===-2?a:$)}return[ht(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};class U{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,n=0;const a=t.length-1,h=this.parts,[c,u]=yt(t,e);if(this.el=U.createElement(c,i),m.currentNode=this.el.content,e===2||e===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(s=m.nextNode())!==null&&h.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const l of s.getAttributeNames())if(l.endsWith(rt)){const p=u[n++],$=s.getAttribute(l).split(f),H=/([.?@])?(.*)/.exec(p);h.push({type:1,index:o,name:H[2],strings:$,ctor:H[1]==="."?St:H[1]==="?"?Et:H[1]==="@"?bt:I}),s.removeAttribute(l)}else l.startsWith(f)&&(h.push({type:6,index:o}),s.removeAttribute(l));if(nt.test(s.tagName)){const l=s.textContent.split(f),p=l.length-1;if(p>0){s.textContent=R?R.emptyScript:"";for(let $=0;$<p;$++)s.append(l[$],x()),m.nextNode(),h.push({type:2,index:++o});s.append(l[p],x())}}}else if(s.nodeType===8)if(s.data===ot)h.push({type:2,index:o});else{let l=-1;for(;(l=s.data.indexOf(f,l+1))!==-1;)h.push({type:7,index:o}),l+=f.length-1}o++}}static createElement(t,e){const i=y.createElement("template");return i.innerHTML=t,i}}function E(r,t,e=r,i){var n,a;if(t===S)return t;let s=i!==void 0?(n=e._$Co)==null?void 0:n[i]:e._$Cl;const o=O(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==o&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),o===void 0?s=void 0:(s=new o(r),s._$AT(r,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=s:e._$Cl=s),s!==void 0&&(t=E(r,s._$AS(r,t.values),s,i)),t}class vt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=((t==null?void 0:t.creationScope)??y).importNode(e,!0);m.currentNode=s;let o=m.nextNode(),n=0,a=0,h=i[0];for(;h!==void 0;){if(n===h.index){let c;h.type===2?c=new T(o,o.nextSibling,this,t):h.type===1?c=new h.ctor(o,h.name,h.strings,this,t):h.type===6&&(c=new wt(o,this,t)),this._$AV.push(c),h=i[++a]}n!==(h==null?void 0:h.index)&&(o=m.nextNode(),n++)}return m.currentNode=y,s}p(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class T{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=E(this,t,e),O(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):mt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&O(this._$AH)?this._$AA.nextSibling.data=t:this.T(y.createTextNode(t)),this._$AH=t}$(t){var o;const{values:e,_$litType$:i}=t,s=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=U.createElement(ht(i.h,i.h[0]),this.options)),i);if(((o=this._$AH)==null?void 0:o._$AD)===s)this._$AH.p(e);else{const n=new vt(s,this),a=n.u(this.options);n.p(e),this.T(a),this._$AH=n}}_$AC(t){let e=tt.get(t.strings);return e===void 0&&tt.set(t.strings,e=new U(t)),e}k(t){V(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new T(this.O(x()),this.O(x()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class I{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}_$AI(t,e=this,i,s){const o=this.strings;let n=!1;if(o===void 0)t=E(this,t,e,0),n=!O(t)||t!==this._$AH&&t!==S,n&&(this._$AH=t);else{const a=t;let h,c;for(t=o[0],h=0;h<o.length-1;h++)c=E(this,a[i+h],e,h),c===S&&(c=this._$AH[h]),n||(n=!O(c)||c!==this._$AH[h]),c===d?t=d:t!==d&&(t+=(c??"")+o[h+1]),this._$AH[h]=c}n&&!s&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class St extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class Et extends I{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class bt extends I{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){if((t=E(this,t,e,0)??d)===S)return;const i=this._$AH,s=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==d&&(i===d||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class wt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){E(this,t)}}const z=C.litHtmlPolyfillSupport;z==null||z(U,T),(C.litHtmlVersions??(C.litHtmlVersions=[])).push("3.3.1");const Ct=(r,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let s=i._$litPart$;if(s===void 0){const o=(e==null?void 0:e.renderBefore)??null;i._$litPart$=s=new T(t.insertBefore(x(),o),o,void 0,e??{})}return s._$AI(r),s};/**
16
- * @license
17
- * Copyright 2017 Google LLC
18
- * SPDX-License-Identifier: BSD-3-Clause
19
- */const A=globalThis;class N extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ct(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return S}}var et;N._$litElement$=!0,N.finalized=!0,(et=A.litElementHydrateSupport)==null||et.call(A,{LitElement:N});const D=A.litElementPolyfillSupport;D==null||D({LitElement:N});(A.litElementVersions??(A.litElementVersions=[])).push("4.2.1");/**
20
- * @license
21
- * Copyright 2017 Google LLC
22
- * SPDX-License-Identifier: BSD-3-Clause
23
- */const Tt=r=>(t,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(r,t)})):customElements.define(r,t)};class P{constructor(){this.state=new Map,this.accessToken={get:()=>this.getWithStorage("accessToken"),set:t=>this.setWithStorage("accessToken",t),clear:()=>this.clearWithStorage("accessToken")},this.chainId={get:()=>this.getWithStorage("chainId"),set:t=>this.setWithStorage("chainId",t),clear:()=>this.clearWithStorage("chainId")}}static localStorageKey(t){return`com.splice.wallet.${t}`}getWithStorage(t){if(this.state.has(t))return this.state.get(t);const e=localStorage.getItem(P.localStorageKey(t));if(e)return this.state.set(t,e),e}setWithStorage(t,e){localStorage.setItem(P.localStorageKey(t),e),this.state.set(t,e)}clearWithStorage(t){localStorage.removeItem(P.localStorageKey(t)),this.state.delete(t)}}const Ht=new P;export{xt as a,it as f,N as i,Ht as s,Tt as t,k as u,Ut as x};