@locale-labs/miniapp-sdk 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1 +1,185 @@
1
- # locale-miniapp-sdk
1
+ # @locale-labs/miniapp-sdk
2
+
3
+ The official SDK for developing **Mini-Apps** within the Localé ecosystem.
4
+
5
+ This package provides a secure communication bridge between your Mini-App (running in an isolated iframe) and the Localé Kernel (the main application), enabling access to authentication, geolocation, native interfaces, and more.
6
+
7
+ ## 📦 Installation
8
+
9
+ We prefer using [Bun](https://bun.sh) in this repository.
10
+
11
+ ```bash
12
+ bun add @locale-labs/miniapp-sdk
13
+ ```
14
+
15
+ Also compatible with npm or yarn:
16
+
17
+ ```bash
18
+ npm install @locale-labs/miniapp-sdk
19
+ # or
20
+ yarn add @locale-labs/miniapp-sdk
21
+ ```
22
+
23
+ ## 🚀 Basic Usage
24
+
25
+ The recommended way to start your Mini-App is by instantiating `LocaleApp` and calling the `init()` method. This will load the user, location, and authentication token in parallel.
26
+
27
+ ```typescript
28
+ import { LocaleApp } from "@locale-labs/miniapp-sdk";
29
+
30
+ const app = new LocaleApp();
31
+
32
+ async function main() {
33
+ try {
34
+ // Initialize and fetch all necessary context
35
+ const { user, location, token } = await app.init();
36
+
37
+ if (user) {
38
+ console.log(`Hello, ${user.name}!`);
39
+ }
40
+
41
+ if (location) {
42
+ console.log(`You are in: ${location.city}`);
43
+ }
44
+
45
+ // Enable scroll sync to hide/show the native header
46
+ app.enableAutoScrollSync();
47
+
48
+ } catch (error) {
49
+ console.error("Error initializing Mini-App", error);
50
+ }
51
+ }
52
+
53
+ main();
54
+ ```
55
+
56
+ ## ✨ Features
57
+
58
+ ### 🔐 Authentication & Supabase
59
+
60
+ The SDK facilitates delegated authentication. You can obtain a JWT token signed by Localé and use it to authenticate against your own database (e.g., Supabase).
61
+
62
+ ```typescript
63
+ import { createClient } from '@supabase/supabase-js';
64
+
65
+ // 1. Get the token only
66
+ const { token } = await app.getAuthToken();
67
+
68
+ // 2. Or automatically connect your Supabase client
69
+ const supabase = createClient('YOUR_URL', 'YOUR_ANON_KEY');
70
+ await app.connectSupabase(supabase);
71
+ ```
72
+
73
+ ### 📍 Geolocation
74
+
75
+ Access the user's location context or request them to select a point on the native map.
76
+
77
+ ```typescript
78
+ // Get current location (main app context)
79
+ const location = await app.getLocation();
80
+
81
+ // Open the native location picker (fullscreen map)
82
+ const coords = await app.pickLocation({
83
+ latitude: -34.6037,
84
+ longitude: -58.3816, // Optional: initial coordinates
85
+ readonly: false // Optional: view-only or selection mode
86
+ });
87
+
88
+ if (coords) {
89
+ console.log("New location selected:", coords.lat, coords.lng);
90
+ }
91
+ ```
92
+
93
+ ### 📱 Native UI
94
+
95
+ Use native Kernel components for an integrated user experience.
96
+
97
+ **Native Alerts:**
98
+ ```typescript
99
+ await app.alert(
100
+ "Confirm action",
101
+ "Are you sure you want to proceed?",
102
+ [
103
+ { text: "Cancel", style: "cancel" },
104
+ {
105
+ text: "Yes, proceed",
106
+ style: "destructive",
107
+ onPress: () => console.log("Confirmed")
108
+ }
109
+ ]
110
+ );
111
+ ```
112
+
113
+ **Scroll Sync:**
114
+ Allows the main application header to hide when scrolling down and appear when scrolling up, maximizing screen space.
115
+
116
+ ```typescript
117
+ // Enable automatically
118
+ app.enableAutoScrollSync();
119
+
120
+ // Or report manually if using a virtual container
121
+ app.reportScrollDirection("down"); // Hide header
122
+ app.reportScrollDirection("up"); // Show header
123
+ ```
124
+
125
+ ### 🔗 Navigation & Deep Linking
126
+
127
+ Controls the parent application URL to allow sharing direct links to sections of your Mini-App.
128
+
129
+ ```typescript
130
+ // Update URL: locale.lat/app/your-miniapp/user-profile
131
+ await app.updateUrlPath("user-profile");
132
+
133
+ // Request login (redirects user to Localé login flow)
134
+ // 'my-view' will be passed as a parameter upon return to restore state
135
+ await app.login("my-view");
136
+ ```
137
+
138
+ ## 🛠️ API Reference
139
+
140
+ ### `LocaleApp`
141
+
142
+ * `init()`: Initializes the app and returns `{ user, location, token }`.
143
+ * `getUser()`: Returns the current user's public profile.
144
+ * `getLocation()`: Returns the current geographic context.
145
+ * `getAuthToken()`: Returns a signed JWT for backend calls.
146
+ * `connectSupabase(client)`: Configures the session for an existing Supabase client.
147
+ * `alert(title, message?, buttons?)`: Shows a native modal.
148
+ * `pickLocation(options?)`: Opens the native map selector.
149
+ * `enableAutoScrollSync(threshold?, delta?)`: Listens to `window` scroll to manage the header.
150
+ * `updateUrlPath(slug)`: Modifies the parent browser URL.
151
+ * `login(intendedView?)`: Redirects the user to the login screen.
152
+
153
+ ## 💻 Development
154
+
155
+ If you are contributing to this SDK, you can run it in watch mode to automatically rebuild on changes:
156
+
157
+ ```bash
158
+ bun run watch
159
+ ```
160
+
161
+ This is useful when working in tandem with a Mini-App (like `locale-miniapp--mascotas-perdidas`) that is linked to this local package.
162
+
163
+ ## 📦 Deployment
164
+
165
+ The package is published to npm automatically via the `publish` GitHub Action using [`semantic-release`](https://github.com/semantic-release/semantic-release).
166
+
167
+ - Push to `main` → publishes a stable release to npm.
168
+ - Push to `dev` → publishes a `beta` pre-release to npm.
169
+
170
+ The version is bumped automatically based on commit messages following [Conventional Commits](https://github.com/angular/angular/blob/main/contributing-docs/commit-message-guidelines.md):
171
+
172
+ - Patch/Fix release: `fix: update readme` (1.0.0 -> 1.0.1)
173
+ - Minor/Feature release: `feat: add new feature` (1.0.0 -> 1.1.0)
174
+ - Major release: (1.0.0 -> 2.0.0)
175
+
176
+ ```
177
+ perf: improve performance of x
178
+
179
+ BREAKING CHANGE: The graphiteWidth option has been removed.
180
+ The default graphite width of 10mm is always used for performance reasons.
181
+ ```
182
+
183
+ ---
184
+
185
+ Developed with ❤️ by **Locale Labs**.
package/dist/sdk.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { KernelResponse, UserPayload, LocationPayload, AuthTokenPayload, AlertButton, LocationPickerOptions, AlertPayload, ScrollDirectionPayload, AuthLoginPayload, UrlUpdatePayload } from "@locale-labs/protocol";
2
- export type { UserPayload, LocationPayload, AuthTokenPayload, LocationPickerOptions, AlertPayload, ScrollDirectionPayload, AuthLoginPayload, UrlUpdatePayload, KernelResponse };
1
+ import { KernelResponse, UserPayload, LocationPayload, AuthTokenPayload, AlertButton, LocationPickerOptions, AlertPayload, AuthLoginPayload, UrlUpdatePayload } from "@locale-labs/protocol";
2
+ export type { UserPayload, LocationPayload, AuthTokenPayload, LocationPickerOptions, AlertPayload, AuthLoginPayload, UrlUpdatePayload, KernelResponse };
3
3
  export type { AlertButton };
4
4
  export interface AlertButtonWithAction extends AlertButton {
5
5
  onPress?: () => void;
@@ -14,7 +14,6 @@ export interface AlertButtonWithAction extends AlertButton {
14
14
  * ```javascript
15
15
  * const app = new LocaleApp();
16
16
  * const { user, location, token } = await app.init();
17
- * app.enableAutoScrollSync();
18
17
  * ```
19
18
  */
20
19
  export interface AlertButtonWithAction extends AlertButton {
@@ -48,9 +47,6 @@ export declare class LocaleApp {
48
47
  private requestId;
49
48
  private requests;
50
49
  private kernelOrigin;
51
- private _lastScrollY;
52
- private _lastReportedDirection;
53
- private _scrollListener;
54
50
  private debugEnabled;
55
51
  constructor(config?: LocaleAppConfig);
56
52
  /**
@@ -71,14 +67,6 @@ export declare class LocaleApp {
71
67
  * @returns Promise with user, location, and auth token
72
68
  */
73
69
  init(): Promise<InitResult>;
74
- /**
75
- * Automatically handles scroll detection to hide/show the Kernel's header.
76
- * Call this once when your app starts if you want this behavior.
77
- *
78
- * @param threshold - Minimum scroll pixels before triggering (default: 50)
79
- * @param delta - Minimum scroll change before triggering (default: 10)
80
- */
81
- enableAutoScrollSync(threshold?: number, delta?: number): void;
82
70
  /**
83
71
  * Get the current authenticated user info (public profile)
84
72
  * @returns Promise with user data including id, email, place_id, etc.
@@ -128,13 +116,6 @@ export declare class LocaleApp {
128
116
  lat: number;
129
117
  lng: number;
130
118
  } | null>;
131
- /**
132
- * Reports the scroll direction to the Kernel, allowing the parent app
133
- * to hide/show UI elements based on scroll behavior.
134
- *
135
- * @param direction - 'up' to show header, 'down' to hide header
136
- */
137
- reportScrollDirection(direction: "up" | "down"): void;
138
119
  /**
139
120
  * Requests the Kernel to initiate the login flow.
140
121
  * The Kernel will save the current URL and redirect to the login page.
package/dist/sdk.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEd,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EACV,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACf,CAAC;AAEF,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AAMH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAOD,UAAU,cAAc;IACtB,IAAI,EAAE;QACJ,UAAU,EAAE,CAAC,MAAM,EAAE;YACnB,YAAY,EAAE,MAAM,CAAC;YACrB,aAAa,EAAE,MAAM,CAAC;SACvB,KAAK,OAAO,CAAC;YAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;SAAE,CAAC,CAAC;KACxC,CAAC;CACH;AAMD,qBAAa,SAAS;IACpB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,YAAY,CAAS;IAG7B,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,sBAAsB,CAA8B;IAC5D,OAAO,CAAC,eAAe,CAAyC;IAGhE,OAAO,CAAC,YAAY,CAAiB;gBAEzB,MAAM,GAAE,eAAoB;IAsDxC;;OAEG;IACH,OAAO,CAAC,IAAI;IAMZ;;;;;OAKG;IACH,OAAO,CAAC,KAAK;IAiBb;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC;IA+BjC;;;;;;OAMG;IACH,oBAAoB,CAAC,SAAS,SAAK,EAAE,KAAK,SAAK,GAAG,IAAI;IAkEtD;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAIhD;;;;;OAKG;IACG,eAAe,CACnB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAkB7B;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAIrC;;;;;;OAMG;IACG,KAAK,CACT,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,qBAAqB,EAAE,EACjC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,GACzD,OAAO,CAAC,IAAI,CAAC;IA2ChB;;;;;;OAMG;IACG,YAAY,CAChB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAQ/C;;;;;OAKG;IACH,qBAAqB,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI;IAMrD;;;;;;OAMG;IACG,KAAK,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjD;;;;;;;OAOG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIjD;AAOD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,SAAS,EAAE,OAAO,SAAS,CAAC;KAC7B;CACF"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEd,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EACV,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACf,CAAC;AAEF,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AAMH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAOD,UAAU,cAAc;IACtB,IAAI,EAAE;QACJ,UAAU,EAAE,CAAC,MAAM,EAAE;YACnB,YAAY,EAAE,MAAM,CAAC;YACrB,aAAa,EAAE,MAAM,CAAC;SACvB,KAAK,OAAO,CAAC;YAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;SAAE,CAAC,CAAC;KACxC,CAAC;CACH;AAMD,qBAAa,SAAS;IACpB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,YAAY,CAAS;IAG7B,OAAO,CAAC,YAAY,CAAiB;gBAEzB,MAAM,GAAE,eAAoB;IAsDxC;;OAEG;IACH,OAAO,CAAC,IAAI;IAMZ;;;;;OAKG;IACH,OAAO,CAAC,KAAK;IAiBb;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC;IA+BjC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAIhD;;;;;OAKG;IACG,eAAe,CACnB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAkB7B;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAIrC;;;;;;OAMG;IACG,KAAK,CACT,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,qBAAqB,EAAE,EACjC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,GACzD,OAAO,CAAC,IAAI,CAAC;IA2ChB;;;;;;OAMG;IACG,YAAY,CAChB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAQ/C;;;;;;OAMG;IACG,KAAK,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjD;;;;;;;OAOG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIjD;AAOD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,SAAS,EAAE,OAAO,SAAS,CAAC;KAC7B;CACF"}
package/dist/sdk.js CHANGED
@@ -1 +1 @@
1
- "use strict";(()=>{var ot=Object.create;var je=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty;var O=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var ft=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ut(e))!lt.call(s,n)&&n!==t&&je(s,n,{get:()=>e[n],enumerable:!(r=dt(e,n))||r.enumerable});return s};var ht=(s,e,t)=>(t=s!=null?ot(ct(s)):{},ft(e||!s||!s.__esModule?je(t,"default",{value:s,enumerable:!0}):t,s));var fe=O(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.getParsedType=T.ZodParsedType=T.objectUtil=T.util=void 0;var ke;(function(s){s.assertEqual=n=>{};function e(n){}s.assertIs=e;function t(n){throw new Error}s.assertNever=t,s.arrayToEnum=n=>{let a={};for(let d of n)a[d]=d;return a},s.getValidEnumValues=n=>{let a=s.objectKeys(n).filter(u=>typeof n[n[u]]!="number"),d={};for(let u of a)d[u]=n[u];return s.objectValues(d)},s.objectValues=n=>s.objectKeys(n).map(function(a){return n[a]}),s.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let d in n)Object.prototype.hasOwnProperty.call(n,d)&&a.push(d);return a},s.find=(n,a)=>{for(let d of n)if(a(d))return d},s.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function r(n,a=" | "){return n.map(d=>typeof d=="string"?`'${d}'`:d).join(a)}s.joinValues=r,s.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(ke||(T.util=ke={}));var Le;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Le||(T.objectUtil=Le={}));T.ZodParsedType=ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var pt=s=>{switch(typeof s){case"undefined":return T.ZodParsedType.undefined;case"string":return T.ZodParsedType.string;case"number":return Number.isNaN(s)?T.ZodParsedType.nan:T.ZodParsedType.number;case"boolean":return T.ZodParsedType.boolean;case"function":return T.ZodParsedType.function;case"bigint":return T.ZodParsedType.bigint;case"symbol":return T.ZodParsedType.symbol;case"object":return Array.isArray(s)?T.ZodParsedType.array:s===null?T.ZodParsedType.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?T.ZodParsedType.promise:typeof Map<"u"&&s instanceof Map?T.ZodParsedType.map:typeof Set<"u"&&s instanceof Set?T.ZodParsedType.set:typeof Date<"u"&&s instanceof Date?T.ZodParsedType.date:T.ZodParsedType.object;default:return T.ZodParsedType.unknown}};T.getParsedType=pt});var ye=O(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.ZodError=U.quotelessJson=U.ZodIssueCode=void 0;var Re=fe();U.ZodIssueCode=Re.util.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"]);var mt=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");U.quotelessJson=mt;var he=class s extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},r={_errors:[]},n=a=>{for(let d of a.issues)if(d.code==="invalid_union")d.unionErrors.map(n);else if(d.code==="invalid_return_type")n(d.returnTypeError);else if(d.code==="invalid_arguments")n(d.argumentsError);else if(d.path.length===0)r._errors.push(t(d));else{let u=r,l=0;for(;l<d.path.length;){let h=d.path[l];l===d.path.length-1?(u[h]=u[h]||{_errors:[]},u[h]._errors.push(t(d))):u[h]=u[h]||{_errors:[]},u=u[h],l++}}};return n(this),r}static assert(e){if(!(e instanceof s))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Re.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};U.ZodError=he;he.create=s=>new he(s)});var Ce=O(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});var b=ye(),q=fe(),yt=(s,e)=>{let t;switch(s.code){case b.ZodIssueCode.invalid_type:s.received===q.ZodParsedType.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case b.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,q.util.jsonStringifyReplacer)}`;break;case b.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${q.util.joinValues(s.keys,", ")}`;break;case b.ZodIssueCode.invalid_union:t="Invalid input";break;case b.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${q.util.joinValues(s.options)}`;break;case b.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${q.util.joinValues(s.options)}, received '${s.received}'`;break;case b.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case b.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case b.ZodIssueCode.invalid_date:t="Invalid date";break;case b.ZodIssueCode.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:q.util.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case b.ZodIssueCode.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case b.ZodIssueCode.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case b.ZodIssueCode.custom:t="Invalid input";break;case b.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case b.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case b.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,q.util.assertNever(s)}return{message:t}};Ze.default=yt});var _e=O(V=>{"use strict";var _t=V&&V.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(V,"__esModule",{value:!0});V.defaultErrorMap=void 0;V.setErrorMap=gt;V.getErrorMap=vt;var De=_t(Ce());V.defaultErrorMap=De.default;var Ue=De.default;function gt(s){Ue=s}function vt(){return Ue}});var Ae=O(x=>{"use strict";var It=x&&x.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(x,"__esModule",{value:!0});x.isAsync=x.isValid=x.isDirty=x.isAborted=x.OK=x.DIRTY=x.INVALID=x.ParseStatus=x.EMPTY_PATH=x.makeIssue=void 0;x.addIssueToContext=bt;var xt=_e(),Ve=It(Ce()),Tt=s=>{let{data:e,path:t,errorMaps:r,issueData:n}=s,a=[...t,...n.path||[]],d={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let u="",l=r.filter(h=>!!h).slice().reverse();for(let h of l)u=h(d,{data:e,defaultError:u}).message;return{...n,path:a,message:u}};x.makeIssue=Tt;x.EMPTY_PATH=[];function bt(s,e){let t=(0,xt.getErrorMap)(),r=(0,x.makeIssue)({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===Ve.default?void 0:Ve.default].filter(n=>!!n)});s.common.issues.push(r)}var we=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return x.INVALID;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let a=await n.key,d=await n.value;r.push({key:a,value:d})}return s.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:a,value:d}=n;if(a.status==="aborted"||d.status==="aborted")return x.INVALID;a.status==="dirty"&&e.dirty(),d.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof d.value<"u"||n.alwaysSet)&&(r[a.value]=d.value)}return{status:e.value,value:r}}};x.ParseStatus=we;x.INVALID=Object.freeze({status:"aborted"});var kt=s=>({status:"dirty",value:s});x.DIRTY=kt;var Zt=s=>({status:"valid",value:s});x.OK=Zt;var Ct=s=>s.status==="aborted";x.isAborted=Ct;var wt=s=>s.status==="dirty";x.isDirty=wt;var At=s=>s.status==="valid";x.isValid=At;var Pt=s=>typeof Promise<"u"&&s instanceof Promise;x.isAsync=Pt});var ze=O(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0})});var qe=O(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.errorUtil=void 0;var $e;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})($e||(ge.errorUtil=$e={}))});var tt=O(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.discriminatedUnion=i.date=i.boolean=i.bigint=i.array=i.any=i.coerce=i.ZodFirstPartyTypeKind=i.late=i.ZodSchema=i.Schema=i.ZodReadonly=i.ZodPipeline=i.ZodBranded=i.BRAND=i.ZodNaN=i.ZodCatch=i.ZodDefault=i.ZodNullable=i.ZodOptional=i.ZodTransformer=i.ZodEffects=i.ZodPromise=i.ZodNativeEnum=i.ZodEnum=i.ZodLiteral=i.ZodLazy=i.ZodFunction=i.ZodSet=i.ZodMap=i.ZodRecord=i.ZodTuple=i.ZodIntersection=i.ZodDiscriminatedUnion=i.ZodUnion=i.ZodObject=i.ZodArray=i.ZodVoid=i.ZodNever=i.ZodUnknown=i.ZodAny=i.ZodNull=i.ZodUndefined=i.ZodSymbol=i.ZodDate=i.ZodBoolean=i.ZodBigInt=i.ZodNumber=i.ZodString=i.ZodType=void 0;i.NEVER=i.void=i.unknown=i.union=i.undefined=i.tuple=i.transformer=i.symbol=i.string=i.strictObject=i.set=i.record=i.promise=i.preprocess=i.pipeline=i.ostring=i.optional=i.onumber=i.oboolean=i.object=i.number=i.nullable=i.null=i.never=i.nativeEnum=i.nan=i.map=i.literal=i.lazy=i.intersection=i.instanceof=i.function=i.enum=i.effect=void 0;i.datetimeRegex=Ye;i.custom=Ge;var c=ye(),ve=_e(),p=qe(),o=Ae(),f=fe(),P=class{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,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}},Be=(s,e)=>{if((0,o.isValid)(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new c.ZodError(s.common.issues);return this._error=t,this._error}}};function _(s){if(!s)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:n}=s;if(e&&(t||r))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:(d,u)=>{let{message:l}=s;return d.code==="invalid_enum_value"?{message:l??u.defaultError}:typeof u.data>"u"?{message:l??r??u.defaultError}:d.code!=="invalid_type"?{message:u.defaultError}:{message:l??t??u.defaultError}},description:n}}var g=class{get description(){return this._def.description}_getType(e){return(0,f.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,f.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new o.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,f.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0,o.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,f.getParsedType)(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Be(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,f.getParsedType)(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return(0,o.isValid)(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>(0,o.isValid)(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,f.getParsedType)(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await((0,o.isAsync)(n)?n:Promise.resolve(n));return Be(r,a)}refine(e,t){let r=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let d=e(n),u=()=>a.addIssue({code:c.ZodIssueCode.custom,...r(n)});return typeof Promise<"u"&&d instanceof Promise?d.then(l=>l?!0:(u(),!1)):d?!0:(u(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new C({schema:this,typeName:m.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 A.create(this,this._def)}nullable(){return j.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D.create(this)}promise(){return $.create(this,this._def)}or(e){return G.create([this,e],this._def)}and(e){return J.create(this,e,this._def)}transform(e){return new C({..._(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new se({..._(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new pe({typeName:m.ZodBranded,type:this,..._(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new re({..._(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return me.create(this,e)}readonly(){return ne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i.ZodType=g;i.Schema=g;i.ZodSchema=g;var St=/^c[^\s-]{8,}$/i,Ot=/^[0-9a-z]+$/,Nt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Et=/^[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,jt=/^[a-z0-9_-]{21}$/i,Lt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Rt=/^[-+]?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)?)??$/,Dt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ut="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Pe,Vt=/^(?:(?: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])$/,Mt=/^(?:(?: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])$/,zt=/^(([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]))$/,$t=/^(([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])$/,qt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Bt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ke="((\\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])))",Ft=new RegExp(`^${Ke}$`);function We(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);let t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Kt(s){return new RegExp(`^${We(s)}$`)}function Ye(s){let e=`${Ke}T${We(s)}`,t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Wt(s,e){return!!((e==="v4"||!e)&&Vt.test(s)||(e==="v6"||!e)&&zt.test(s))}function Yt(s,e){if(!Lt.test(s))return!1;try{let[t]=s.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Ht(s,e){return!!((e==="v4"||!e)&&Mt.test(s)||(e==="v6"||!e)&&$t.test(s))}var M=class s extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.ZodParsedType.string){let a=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.string,received:a.parsedType}),o.INVALID}let r=new o.ParseStatus,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let d=e.data.length>a.value,u=e.data.length<a.value;(d||u)&&(n=this._getOrReturnCtx(e,n),d?(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):u&&(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"email",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Pe||(Pe=new RegExp(Ut,"u")),Pe.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"emoji",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Et.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"uuid",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")jt.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"nanoid",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")St.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"cuid",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"cuid2",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"ulid",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"url",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"regex",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.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),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Ye(a).test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Ft.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?Kt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"duration",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?Wt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"ip",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Yt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"jwt",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Ht(e.data,a.version)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"cidr",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?qt.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"base64",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?Bt.test(e.data)||(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{validation:"base64url",code:c.ZodIssueCode.invalid_string,message:a.message}),r.dirty()):f.util.assertNever(a);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(n=>e.test(n),{validation:t,code:c.ZodIssueCode.invalid_string,...p.errorUtil.errToObj(r)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errorUtil.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...p.errorUtil.errToObj(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?.precision>"u"?null:e?.precision,...p.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...p.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...p.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,p.errorUtil.errToObj(e))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...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(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};i.ZodString=M;M.create=s=>new M({checks:[],typeName:m.ZodString,coerce:s?.coerce??!1,..._(s)});function Gt(s,e){let t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,n=t>r?t:r,a=Number.parseInt(s.toFixed(n).replace(".","")),d=Number.parseInt(e.toFixed(n).replace(".",""));return a%d/10**n}var B=class s extends g{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)!==f.ZodParsedType.number){let a=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.number,received:a.parsedType}),o.INVALID}let r,n=new o.ParseStatus;for(let a of this._def.checks)a.kind==="int"?f.util.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.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)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Gt(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.not_finite,message:a.message}),n.dirty()):f.util.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.errorUtil.toString(t))}setLimit(e,t,r,n){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:p.errorUtil.toString(n)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&f.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};i.ZodNumber=B;B.create=s=>new B({checks:[],typeName:m.ZodNumber,coerce:s?.coerce||!1,..._(s)});var F=class s extends g{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)!==f.ZodParsedType.bigint)return this._getInvalidInput(e);let r,n=new o.ParseStatus;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.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)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):f.util.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.bigint,received:t.parsedType}),o.INVALID}gte(e,t){return this.setLimit("min",e,!0,p.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.errorUtil.toString(t))}setLimit(e,t,r,n){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:p.errorUtil.toString(n)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};i.ZodBigInt=F;F.create=s=>new F({checks:[],typeName:m.ZodBigInt,coerce:s?.coerce??!1,..._(s)});var K=class extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.ZodParsedType.boolean){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.boolean,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodBoolean=K;K.create=s=>new K({typeName:m.ZodBoolean,coerce:s?.coerce||!1,..._(s)});var W=class s extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.ZodParsedType.date){let a=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.date,received:a.parsedType}),o.INVALID}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_date}),o.INVALID}let r=new o.ParseStatus,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):f.util.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};i.ZodDate=W;W.create=s=>new W({checks:[],coerce:s?.coerce||!1,typeName:m.ZodDate,..._(s)});var ie=class extends g{_parse(e){if(this._getType(e)!==f.ZodParsedType.symbol){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.symbol,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodSymbol=ie;ie.create=s=>new ie({typeName:m.ZodSymbol,..._(s)});var Y=class extends g{_parse(e){if(this._getType(e)!==f.ZodParsedType.undefined){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.undefined,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodUndefined=Y;Y.create=s=>new Y({typeName:m.ZodUndefined,..._(s)});var H=class extends g{_parse(e){if(this._getType(e)!==f.ZodParsedType.null){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.null,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodNull=H;H.create=s=>new H({typeName:m.ZodNull,..._(s)});var z=class extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,o.OK)(e.data)}};i.ZodAny=z;z.create=s=>new z({typeName:m.ZodAny,..._(s)});var R=class extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,o.OK)(e.data)}};i.ZodUnknown=R;R.create=s=>new R({typeName:m.ZodUnknown,..._(s)});var N=class extends g{_parse(e){let t=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.never,received:t.parsedType}),o.INVALID}};i.ZodNever=N;N.create=s=>new N({typeName:m.ZodNever,..._(s)});var oe=class extends g{_parse(e){if(this._getType(e)!==f.ZodParsedType.undefined){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.void,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodVoid=oe;oe.create=s=>new oe({typeName:m.ZodVoid,..._(s)});var D=class s extends g{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.ZodParsedType.array)return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.array,received:t.parsedType}),o.INVALID;if(n.exactLength!==null){let d=t.data.length>n.exactLength.value,u=t.data.length<n.exactLength.value;(d||u)&&((0,o.addIssueToContext)(t,{code:d?c.ZodIssueCode.too_big:c.ZodIssueCode.too_small,minimum:u?n.exactLength.value:void 0,maximum:d?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&((0,o.addIssueToContext)(t,{code:c.ZodIssueCode.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&((0,o.addIssueToContext)(t,{code:c.ZodIssueCode.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((d,u)=>n.type._parseAsync(new P(t,d,t.path,u)))).then(d=>o.ParseStatus.mergeArray(r,d));let a=[...t.data].map((d,u)=>n.type._parseSync(new P(t,d,t.path,u)));return o.ParseStatus.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new s({...this._def,minLength:{value:e,message:p.errorUtil.toString(t)}})}max(e,t){return new s({...this._def,maxLength:{value:e,message:p.errorUtil.toString(t)}})}length(e,t){return new s({...this._def,exactLength:{value:e,message:p.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};i.ZodArray=D;D.create=(s,e)=>new D({type:s,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});function ae(s){if(s instanceof k){let e={};for(let t in s.shape){let r=s.shape[t];e[t]=A.create(ae(r))}return new k({...s._def,shape:()=>e})}else return s instanceof D?new D({...s._def,type:ae(s.element)}):s instanceof A?A.create(ae(s.unwrap())):s instanceof j?j.create(ae(s.unwrap())):s instanceof E?E.create(s.items.map(e=>ae(e))):s}var k=class s extends g{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=f.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.ZodParsedType.object){let h=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(h,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.object,received:h.parsedType}),o.INVALID}let{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:d}=this._getCached(),u=[];if(!(this._def.catchall instanceof N&&this._def.unknownKeys==="strip"))for(let h in n.data)d.includes(h)||u.push(h);let l=[];for(let h of d){let v=a[h],w=n.data[h];l.push({key:{status:"valid",value:h},value:v._parse(new P(n,w,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof N){let h=this._def.unknownKeys;if(h==="passthrough")for(let v of u)l.push({key:{status:"valid",value:v},value:{status:"valid",value:n.data[v]}});else if(h==="strict")u.length>0&&((0,o.addIssueToContext)(n,{code:c.ZodIssueCode.unrecognized_keys,keys:u}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let h=this._def.catchall;for(let v of u){let w=n.data[v];l.push({key:{status:"valid",value:v},value:h._parse(new P(n,w,n.path,v)),alwaysSet:v in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let h=[];for(let v of l){let w=await v.key,Ee=await v.value;h.push({key:w,value:Ee,alwaysSet:v.alwaysSet})}return h}).then(h=>o.ParseStatus.mergeObjectSync(r,h)):o.ParseStatus.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return p.errorUtil.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:p.errorUtil.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(e){return new s({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new s({...this._def,catchall:e})}pick(e){let t={};for(let r of f.util.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new s({...this._def,shape:()=>t})}omit(e){let t={};for(let r of f.util.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new s({...this._def,shape:()=>t})}deepPartial(){return ae(this)}partial(e){let t={};for(let r of f.util.objectKeys(this.shape)){let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}return new s({...this._def,shape:()=>t})}required(e){let t={};for(let r of f.util.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof A;)a=a._def.innerType;t[r]=a}return new s({...this._def,shape:()=>t})}keyof(){return He(f.util.objectKeys(this.shape))}};i.ZodObject=k;k.create=(s,e)=>new k({shape:()=>s,unknownKeys:"strip",catchall:N.create(),typeName:m.ZodObject,..._(e)});k.strictCreate=(s,e)=>new k({shape:()=>s,unknownKeys:"strict",catchall:N.create(),typeName:m.ZodObject,..._(e)});k.lazycreate=(s,e)=>new k({shape:s,unknownKeys:"strip",catchall:N.create(),typeName:m.ZodObject,..._(e)});var G=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(let u of a)if(u.result.status==="valid")return u.result;for(let u of a)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;let d=a.map(u=>new c.ZodError(u.ctx.common.issues));return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_union,unionErrors:d}),o.INVALID}if(t.common.async)return Promise.all(r.map(async a=>{let d={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:d}),ctx:d}})).then(n);{let a,d=[];for(let l of r){let h={...t,common:{...t.common,issues:[]},parent:null},v=l._parseSync({data:t.data,path:t.path,parent:h});if(v.status==="valid")return v;v.status==="dirty"&&!a&&(a={result:v,ctx:h}),h.common.issues.length&&d.push(h.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let u=d.map(l=>new c.ZodError(l));return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_union,unionErrors:u}),o.INVALID}}get options(){return this._def.options}};i.ZodUnion=G;G.create=(s,e)=>new G({options:s,typeName:m.ZodUnion,..._(e)});var L=s=>s instanceof Q?L(s.schema):s instanceof C?L(s.innerType()):s instanceof X?[s.value]:s instanceof ee?s.options:s instanceof te?f.util.objectValues(s.enum):s instanceof se?L(s._def.innerType):s instanceof Y?[void 0]:s instanceof H?[null]:s instanceof A?[void 0,...L(s.unwrap())]:s instanceof j?[null,...L(s.unwrap())]:s instanceof pe||s instanceof ne?L(s.unwrap()):s instanceof re?L(s._def.innerType):[],Ie=class s extends g{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.ZodParsedType.object)return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.object,received:t.parsedType}),o.INVALID;let r=this.discriminator,n=t.data[r],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}):((0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),o.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let a of t){let d=L(a.shape[e]);if(!d.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of d){if(n.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);n.set(u,a)}}return new s({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(r)})}};i.ZodDiscriminatedUnion=Ie;function Se(s,e){let t=(0,f.getParsedType)(s),r=(0,f.getParsedType)(e);if(s===e)return{valid:!0,data:s};if(t===f.ZodParsedType.object&&r===f.ZodParsedType.object){let n=f.util.objectKeys(e),a=f.util.objectKeys(s).filter(u=>n.indexOf(u)!==-1),d={...s,...e};for(let u of a){let l=Se(s[u],e[u]);if(!l.valid)return{valid:!1};d[u]=l.data}return{valid:!0,data:d}}else if(t===f.ZodParsedType.array&&r===f.ZodParsedType.array){if(s.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<s.length;a++){let d=s[a],u=e[a],l=Se(d,u);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return t===f.ZodParsedType.date&&r===f.ZodParsedType.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}var J=class extends g{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(a,d)=>{if((0,o.isAborted)(a)||(0,o.isAborted)(d))return o.INVALID;let u=Se(a.value,d.value);return u.valid?(((0,o.isDirty)(a)||(0,o.isDirty)(d))&&t.dirty(),{status:t.value,value:u.data}):((0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_intersection_types}),o.INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,d])=>n(a,d)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};i.ZodIntersection=J;J.create=(s,e,t)=>new J({left:s,right:e,typeName:m.ZodIntersection,..._(t)});var E=class s extends g{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.ZodParsedType.array)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.array,received:r.parsedType}),o.INVALID;if(r.data.length<this._def.items.length)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),o.INVALID;!this._def.rest&&r.data.length>this._def.items.length&&((0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((d,u)=>{let l=this._def.items[u]||this._def.rest;return l?l._parse(new P(r,d,r.path,u)):null}).filter(d=>!!d);return r.common.async?Promise.all(a).then(d=>o.ParseStatus.mergeArray(t,d)):o.ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};i.ZodTuple=E;E.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new E({items:s,typeName:m.ZodTuple,rest:null,..._(e)})};var xe=class s extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.ZodParsedType.object)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.object,received:r.parsedType}),o.INVALID;let n=[],a=this._def.keyType,d=this._def.valueType;for(let u in r.data)n.push({key:a._parse(new P(r,u,r.path,u)),value:d._parse(new P(r,r.data[u],r.path,u)),alwaysSet:u in r.data});return r.common.async?o.ParseStatus.mergeObjectAsync(t,n):o.ParseStatus.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof g?new s({keyType:e,valueType:t,typeName:m.ZodRecord,..._(r)}):new s({keyType:M.create(),valueType:e,typeName:m.ZodRecord,..._(t)})}};i.ZodRecord=xe;var de=class extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.ZodParsedType.map)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.map,received:r.parsedType}),o.INVALID;let n=this._def.keyType,a=this._def.valueType,d=[...r.data.entries()].map(([u,l],h)=>({key:n._parse(new P(r,u,r.path,[h,"key"])),value:a._parse(new P(r,l,r.path,[h,"value"]))}));if(r.common.async){let u=new Map;return Promise.resolve().then(async()=>{for(let l of d){let h=await l.key,v=await l.value;if(h.status==="aborted"||v.status==="aborted")return o.INVALID;(h.status==="dirty"||v.status==="dirty")&&t.dirty(),u.set(h.value,v.value)}return{status:t.value,value:u}})}else{let u=new Map;for(let l of d){let h=l.key,v=l.value;if(h.status==="aborted"||v.status==="aborted")return o.INVALID;(h.status==="dirty"||v.status==="dirty")&&t.dirty(),u.set(h.value,v.value)}return{status:t.value,value:u}}}};i.ZodMap=de;de.create=(s,e,t)=>new de({valueType:e,keyType:s,typeName:m.ZodMap,..._(t)});var ue=class s extends g{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==f.ZodParsedType.set)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.set,received:r.parsedType}),o.INVALID;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&((0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&((0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function d(l){let h=new Set;for(let v of l){if(v.status==="aborted")return o.INVALID;v.status==="dirty"&&t.dirty(),h.add(v.value)}return{status:t.value,value:h}}let u=[...r.data.values()].map((l,h)=>a._parse(new P(r,l,r.path,h)));return r.common.async?Promise.all(u).then(l=>d(l)):d(u)}min(e,t){return new s({...this._def,minSize:{value:e,message:p.errorUtil.toString(t)}})}max(e,t){return new s({...this._def,maxSize:{value:e,message:p.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};i.ZodSet=ue;ue.create=(s,e)=>new ue({valueType:s,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});var Te=class s extends g{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.ZodParsedType.function)return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.function,received:t.parsedType}),o.INVALID;function r(u,l){return(0,o.makeIssue)({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,ve.getErrorMap)(),ve.defaultErrorMap].filter(h=>!!h),issueData:{code:c.ZodIssueCode.invalid_arguments,argumentsError:l}})}function n(u,l){return(0,o.makeIssue)({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,ve.getErrorMap)(),ve.defaultErrorMap].filter(h=>!!h),issueData:{code:c.ZodIssueCode.invalid_return_type,returnTypeError:l}})}let a={errorMap:t.common.contextualErrorMap},d=t.data;if(this._def.returns instanceof $){let u=this;return(0,o.OK)(async function(...l){let h=new c.ZodError([]),v=await u._def.args.parseAsync(l,a).catch(be=>{throw h.addIssue(r(l,be)),h}),w=await Reflect.apply(d,this,v);return await u._def.returns._def.type.parseAsync(w,a).catch(be=>{throw h.addIssue(n(w,be)),h})})}else{let u=this;return(0,o.OK)(function(...l){let h=u._def.args.safeParse(l,a);if(!h.success)throw new c.ZodError([r(l,h.error)]);let v=Reflect.apply(d,this,h.data),w=u._def.returns.safeParse(v,a);if(!w.success)throw new c.ZodError([n(v,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new s({...this._def,args:E.create(e).rest(R.create())})}returns(e){return new s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new s({args:e||E.create([]).rest(R.create()),returns:t||R.create(),typeName:m.ZodFunction,..._(r)})}};i.ZodFunction=Te;var Q=class extends g{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};i.ZodLazy=Q;Q.create=(s,e)=>new Q({getter:s,typeName:m.ZodLazy,..._(e)});var X=class extends g{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(t,{received:t.data,code:c.ZodIssueCode.invalid_literal,expected:this._def.value}),o.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};i.ZodLiteral=X;X.create=(s,e)=>new X({value:s,typeName:m.ZodLiteral,..._(e)});function He(s,e){return new ee({values:s,typeName:m.ZodEnum,..._(e)})}var ee=class s extends g{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return(0,o.addIssueToContext)(t,{expected:f.util.joinValues(r),received:t.parsedType,code:c.ZodIssueCode.invalid_type}),o.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return(0,o.addIssueToContext)(t,{received:t.data,code:c.ZodIssueCode.invalid_enum_value,options:r}),o.INVALID}return(0,o.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return s.create(e,{...this._def,...t})}exclude(e,t=this._def){return s.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};i.ZodEnum=ee;ee.create=He;var te=class extends g{_parse(e){let t=f.util.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==f.ZodParsedType.string&&r.parsedType!==f.ZodParsedType.number){let n=f.util.objectValues(t);return(0,o.addIssueToContext)(r,{expected:f.util.joinValues(n),received:r.parsedType,code:c.ZodIssueCode.invalid_type}),o.INVALID}if(this._cache||(this._cache=new Set(f.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=f.util.objectValues(t);return(0,o.addIssueToContext)(r,{received:r.data,code:c.ZodIssueCode.invalid_enum_value,options:n}),o.INVALID}return(0,o.OK)(e.data)}get enum(){return this._def.values}};i.ZodNativeEnum=te;te.create=(s,e)=>new te({values:s,typeName:m.ZodNativeEnum,..._(e)});var $=class extends g{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.ZodParsedType.promise&&t.common.async===!1)return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.promise,received:t.parsedType}),o.INVALID;let r=t.parsedType===f.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,o.OK)(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};i.ZodPromise=$;$.create=(s,e)=>new $({type:s,typeName:m.ZodPromise,..._(e)});var C=class extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:d=>{(0,o.addIssueToContext)(r,d),d.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let d=n.transform(r.data,a);if(r.common.async)return Promise.resolve(d).then(async u=>{if(t.value==="aborted")return o.INVALID;let l=await this._def.schema._parseAsync({data:u,path:r.path,parent:r});return l.status==="aborted"?o.INVALID:l.status==="dirty"||t.value==="dirty"?(0,o.DIRTY)(l.value):l});{if(t.value==="aborted")return o.INVALID;let u=this._def.schema._parseSync({data:d,path:r.path,parent:r});return u.status==="aborted"?o.INVALID:u.status==="dirty"||t.value==="dirty"?(0,o.DIRTY)(u.value):u}}if(n.type==="refinement"){let d=u=>{let l=n.refinement(u,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?o.INVALID:(u.status==="dirty"&&t.dirty(),d(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?o.INVALID:(u.status==="dirty"&&t.dirty(),d(u.value).then(()=>({status:t.value,value:u.value}))))}if(n.type==="transform")if(r.common.async===!1){let d=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!(0,o.isValid)(d))return o.INVALID;let u=n.transform(d.value,a);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(d=>(0,o.isValid)(d)?Promise.resolve(n.transform(d.value,a)).then(u=>({status:t.value,value:u})):o.INVALID);f.util.assertNever(n)}};i.ZodEffects=C;i.ZodTransformer=C;C.create=(s,e,t)=>new C({schema:s,typeName:m.ZodEffects,effect:e,..._(t)});C.createWithPreprocess=(s,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:s},typeName:m.ZodEffects,..._(t)});var A=class extends g{_parse(e){return this._getType(e)===f.ZodParsedType.undefined?(0,o.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};i.ZodOptional=A;A.create=(s,e)=>new A({innerType:s,typeName:m.ZodOptional,..._(e)});var j=class extends g{_parse(e){return this._getType(e)===f.ZodParsedType.null?(0,o.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};i.ZodNullable=j;j.create=(s,e)=>new j({innerType:s,typeName:m.ZodNullable,..._(e)});var se=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===f.ZodParsedType.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};i.ZodDefault=se;se.create=(s,e)=>new se({innerType:s,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var re=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return(0,o.isAsync)(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new c.ZodError(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new c.ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};i.ZodCatch=re;re.create=(s,e)=>new re({innerType:s,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var ce=class extends g{_parse(e){if(this._getType(e)!==f.ZodParsedType.nan){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:f.ZodParsedType.nan,received:r.parsedType}),o.INVALID}return{status:"valid",value:e.data}}};i.ZodNaN=ce;ce.create=s=>new ce({typeName:m.ZodNaN,..._(s)});i.BRAND=Symbol("zod_brand");var pe=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}};i.ZodBranded=pe;var me=class s extends g{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?o.INVALID:a.status==="dirty"?(t.dirty(),(0,o.DIRTY)(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?o.INVALID:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new s({in:e,out:t,typeName:m.ZodPipeline})}};i.ZodPipeline=me;var ne=class extends g{_parse(e){let t=this._def.innerType._parse(e),r=n=>((0,o.isValid)(n)&&(n.value=Object.freeze(n.value)),n);return(0,o.isAsync)(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}};i.ZodReadonly=ne;ne.create=(s,e)=>new ne({innerType:s,typeName:m.ZodReadonly,..._(e)});function Fe(s,e){let t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function Ge(s,e={},t){return s?z.create().superRefine((r,n)=>{let a=s(r);if(a instanceof Promise)return a.then(d=>{if(!d){let u=Fe(e,r),l=u.fatal??t??!0;n.addIssue({code:"custom",...u,fatal:l})}});if(!a){let d=Fe(e,r),u=d.fatal??t??!0;n.addIssue({code:"custom",...d,fatal:u})}}):z.create()}i.late={object:k.lazycreate};var m;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(m||(i.ZodFirstPartyTypeKind=m={}));var Jt=(s,e={message:`Input not instance of ${s.name}`})=>Ge(t=>t instanceof s,e);i.instanceof=Jt;var Je=M.create;i.string=Je;var Qe=B.create;i.number=Qe;var Qt=ce.create;i.nan=Qt;var Xt=F.create;i.bigint=Xt;var Xe=K.create;i.boolean=Xe;var es=W.create;i.date=es;var ts=ie.create;i.symbol=ts;var ss=Y.create;i.undefined=ss;var rs=H.create;i.null=rs;var ns=z.create;i.any=ns;var as=R.create;i.unknown=as;var is=N.create;i.never=is;var os=oe.create;i.void=os;var ds=D.create;i.array=ds;var us=k.create;i.object=us;var cs=k.strictCreate;i.strictObject=cs;var ls=G.create;i.union=ls;var fs=Ie.create;i.discriminatedUnion=fs;var hs=J.create;i.intersection=hs;var ps=E.create;i.tuple=ps;var ms=xe.create;i.record=ms;var ys=de.create;i.map=ys;var _s=ue.create;i.set=_s;var gs=Te.create;i.function=gs;var vs=Q.create;i.lazy=vs;var Is=X.create;i.literal=Is;var xs=ee.create;i.enum=xs;var Ts=te.create;i.nativeEnum=Ts;var bs=$.create;i.promise=bs;var et=C.create;i.effect=et;i.transformer=et;var ks=A.create;i.optional=ks;var Zs=j.create;i.nullable=Zs;var Cs=C.createWithPreprocess;i.preprocess=Cs;var ws=me.create;i.pipeline=ws;var As=()=>Je().optional();i.ostring=As;var Ps=()=>Qe().optional();i.onumber=Ps;var Ss=()=>Xe().optional();i.oboolean=Ss;i.coerce={string:s=>M.create({...s,coerce:!0}),number:s=>B.create({...s,coerce:!0}),boolean:s=>K.create({...s,coerce:!0}),bigint:s=>F.create({...s,coerce:!0}),date:s=>W.create({...s,coerce:!0})};i.NEVER=o.INVALID});var Oe=O(S=>{"use strict";var Os=S&&S.__createBinding||(Object.create?function(s,e,t,r){r===void 0&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,n)}:function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]}),le=S&&S.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Os(e,s,t)};Object.defineProperty(S,"__esModule",{value:!0});le(_e(),S);le(Ae(),S);le(ze(),S);le(fe(),S);le(tt(),S);le(ye(),S)});var nt=O(Z=>{"use strict";var st=Z&&Z.__createBinding||(Object.create?function(s,e,t,r){r===void 0&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,n)}:function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]}),Ns=Z&&Z.__setModuleDefault||(Object.create?function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}:function(s,e){s.default=e}),Es=Z&&Z.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&st(e,s,t);return Ns(e,s),e},js=Z&&Z.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&st(e,s,t)};Object.defineProperty(Z,"__esModule",{value:!0});Z.z=void 0;var rt=Es(Oe());Z.z=rt;js(Oe(),Z);Z.default=rt});var at=O(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.KernelResponseSchema=I.KernelMessageSchema=I.MessageTypeSchema=I.UrlUpdatePayloadSchema=I.AuthLoginPayloadSchema=I.ScrollDirectionPayloadSchema=I.ScrollDirectionSchema=I.SelectedLocationSchema=I.LocationPickerOptionsSchema=I.AlertPayloadSchema=I.AlertButtonSchema=I.AuthTokenPayloadSchema=I.LocationPayloadSchema=I.UserPayloadSchema=void 0;var y=nt();I.UserPayloadSchema=y.z.object({id:y.z.string(),email:y.z.string().optional(),name:y.z.string().optional(),role:y.z.string().optional(),place_id:y.z.string().nullable().optional()});I.LocationPayloadSchema=y.z.object({city:y.z.string().optional(),country:y.z.string().optional(),coords:y.z.object({lat:y.z.number(),lng:y.z.number()}),latitude:y.z.number().optional(),longitude:y.z.number().optional()});I.AuthTokenPayloadSchema=y.z.object({token:y.z.string()});I.AlertButtonSchema=y.z.object({text:y.z.string().optional(),style:y.z.enum(["default","cancel","destructive"]).optional()});I.AlertPayloadSchema=y.z.object({title:y.z.string(),message:y.z.string().optional(),buttons:y.z.array(I.AlertButtonSchema).optional()});I.LocationPickerOptionsSchema=y.z.object({readonly:y.z.boolean().optional(),lat:y.z.number().optional(),lng:y.z.number().optional()});I.SelectedLocationSchema=y.z.object({lat:y.z.number(),lng:y.z.number()});I.ScrollDirectionSchema=y.z.enum(["up","down"]);I.ScrollDirectionPayloadSchema=y.z.object({direction:I.ScrollDirectionSchema});I.AuthLoginPayloadSchema=y.z.object({intendedView:y.z.string().optional()});I.UrlUpdatePayloadSchema=y.z.object({slug:y.z.string().optional()});I.MessageTypeSchema=y.z.enum(["LOCALE_INIT","GET_USER","GET_LOCATION","GET_AUTH_TOKEN","UI_ALERT","UI_PICK_LOCATION","SCROLL_DIRECTION","AUTH_LOGIN","URL_UPDATE"]);I.KernelMessageSchema=y.z.object({type:y.z.string(),payload:y.z.unknown(),requestId:y.z.number()});I.KernelResponseSchema=y.z.object({type:y.z.literal("LOCALE_RESPONSE"),requestId:y.z.number(),payload:y.z.unknown(),error:y.z.string().nullable().optional()})});var it=ht(at()),Ne=class{constructor(e={}){this._lastScrollY=0;this._lastReportedDirection=null;this._scrollListener=null;this.debugEnabled=!0;this.requestId=0,this.requests=new Map,this.kernelOrigin=e.kernelOrigin||"*",typeof window<"u"&&window.LOCALE_SDK_DEBUG===!0&&(this.debugEnabled=!0),window.addEventListener("message",t=>{if(this.kernelOrigin!=="*"&&t.origin!==this.kernelOrigin)return;let r=t.data,n=it.KernelResponseSchema.safeParse(r);if(!n.success)return;let{type:a,payload:d,requestId:u,error:l}=n.data;if(a==="LOCALE_RESPONSE"&&this.requests.has(u)){let h=this.requests.get(u);if(!h)return;this.requests.delete(u),this._log("Received response:",a,{requestId:u,error:l,payload:d}),l?h.reject(new Error(l)):h.resolve(d)}}),this._send("LOCALE_INIT",{})}_log(...e){this.debugEnabled&&console.log("[Locale SDK]",...e)}_send(e,t){return new Promise((r,n)=>{let a=++this.requestId;this.requests.set(a,{resolve:r,reject:n}),this._log("Sending message:",e,{requestId:a,payload:t});let d={type:e,payload:t,requestId:a};window.parent.postMessage(d,this.kernelOrigin)})}async init(){try{let[e,t,r]=await Promise.all([this.getUser().catch(n=>(this._log("Failed to fetch user:",n),console.warn("[SDK] Failed to fetch user:",n),null)),this.getLocation().catch(n=>(this._log("Failed to fetch location:",n),console.warn("[SDK] Failed to fetch location:",n),null)),this.getAuthToken().catch(n=>(this._log("Failed to fetch auth token:",n),console.warn("[SDK] Failed to fetch auth token:",n),null))]);return{user:e,location:t,token:r?r.token:null}}catch(e){throw console.error("[SDK] Init failed:",e),e}}enableAutoScrollSync(e=50,t=10){this._scrollListener||(this._lastScrollY=0,this._lastReportedDirection=null,this._scrollListener=r=>{let n=r.target;if(!n||typeof n.scrollTop!="number")return;let a=n.scrollTop,d=n.scrollHeight-n.clientHeight;if(a<0||a>d)return;if(a>d-100){this._lastScrollY=a;return}let u=a-this._lastScrollY;if(Math.abs(u)<t){this._lastScrollY=a;return}let l;if(u>0&&a>e)l="down";else if(u<0)l="up";else if(a<=e)l="up";else{this._lastScrollY=a;return}l!==this._lastReportedDirection&&(this._lastReportedDirection=l,this.reportScrollDirection(l)),this._lastScrollY=a},window.addEventListener("scroll",this._scrollListener,{passive:!0,capture:!0}),this._log("Auto-scroll sync enabled"))}async getUser(){return this._send("GET_USER",{})}async getAuthToken(){return this._send("GET_AUTH_TOKEN",{})}async connectSupabase(e){let{token:t}=await this.getAuthToken(),{error:r}=await e.auth.setSession({access_token:t,refresh_token:t});if(r)throw new Error("Failed to connect Supabase with Local\xE9: "+r.message);return{token:t}}async getLocation(){return this._send("GET_LOCATION",{})}async alert(e,t,r,n){let a=r&&r.length>0?r:[{text:"OK",style:"default"}],d=a.map(h=>({text:h.text||"Button",style:h.style||"default"})),u={title:e,message:t,buttons:d},l=await this._send("UI_ALERT",u);if(l!==null&&l>=0&&l<a.length){let h=a[l];h.onPress&&h.onPress()}else n?.onDismiss&&n.onDismiss()}async pickLocation(e){let t=e||{};return this._send("UI_PICK_LOCATION",t)}reportScrollDirection(e){let t={direction:e};this._send("SCROLL_DIRECTION",t)}async login(e){let t={intendedView:e};await this._send("AUTH_LOGIN",t)}async updateUrlPath(e){let t={slug:e};await this._send("URL_UPDATE",t)}};window.LocaleApp=Ne;})();
1
+ "use strict";(()=>{var ot=Object.create;var Ee=Object.defineProperty;var dt=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty;var S=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var ft=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ut(e))!lt.call(s,a)&&a!==t&&Ee(s,a,{get:()=>e[a],enumerable:!(r=dt(e,a))||r.enumerable});return s};var ht=(s,e,t)=>(t=s!=null?ot(ct(s)):{},ft(e||!s||!s.__esModule?Ee(t,"default",{value:s,enumerable:!0}):t,s));var fe=S(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.getParsedType=T.ZodParsedType=T.objectUtil=T.util=void 0;var ke;(function(s){s.assertEqual=a=>{};function e(a){}s.assertIs=e;function t(a){throw new Error}s.assertNever=t,s.arrayToEnum=a=>{let n={};for(let d of a)n[d]=d;return n},s.getValidEnumValues=a=>{let n=s.objectKeys(a).filter(u=>typeof a[a[u]]!="number"),d={};for(let u of n)d[u]=a[u];return s.objectValues(d)},s.objectValues=a=>s.objectKeys(a).map(function(n){return a[n]}),s.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let n=[];for(let d in a)Object.prototype.hasOwnProperty.call(a,d)&&n.push(d);return n},s.find=(a,n)=>{for(let d of a)if(n(d))return d},s.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,n=" | "){return a.map(d=>typeof d=="string"?`'${d}'`:d).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(ke||(T.util=ke={}));var Le;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Le||(T.objectUtil=Le={}));T.ZodParsedType=ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var pt=s=>{switch(typeof s){case"undefined":return T.ZodParsedType.undefined;case"string":return T.ZodParsedType.string;case"number":return Number.isNaN(s)?T.ZodParsedType.nan:T.ZodParsedType.number;case"boolean":return T.ZodParsedType.boolean;case"function":return T.ZodParsedType.function;case"bigint":return T.ZodParsedType.bigint;case"symbol":return T.ZodParsedType.symbol;case"object":return Array.isArray(s)?T.ZodParsedType.array:s===null?T.ZodParsedType.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?T.ZodParsedType.promise:typeof Map<"u"&&s instanceof Map?T.ZodParsedType.map:typeof Set<"u"&&s instanceof Set?T.ZodParsedType.set:typeof Date<"u"&&s instanceof Date?T.ZodParsedType.date:T.ZodParsedType.object;default:return T.ZodParsedType.unknown}};T.getParsedType=pt});var ye=S(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.ZodError=U.quotelessJson=U.ZodIssueCode=void 0;var Re=fe();U.ZodIssueCode=Re.util.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"]);var mt=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");U.quotelessJson=mt;var he=class s extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},r={_errors:[]},a=n=>{for(let d of n.issues)if(d.code==="invalid_union")d.unionErrors.map(a);else if(d.code==="invalid_return_type")a(d.returnTypeError);else if(d.code==="invalid_arguments")a(d.argumentsError);else if(d.path.length===0)r._errors.push(t(d));else{let u=r,h=0;for(;h<d.path.length;){let f=d.path[h];h===d.path.length-1?(u[f]=u[f]||{_errors:[]},u[f]._errors.push(t(d))):u[f]=u[f]||{_errors:[]},u=u[f],h++}}};return a(this),r}static assert(e){if(!(e instanceof s))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Re.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};U.ZodError=he;he.create=s=>new he(s)});var Ce=S(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});var b=ye(),q=fe(),yt=(s,e)=>{let t;switch(s.code){case b.ZodIssueCode.invalid_type:s.received===q.ZodParsedType.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case b.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,q.util.jsonStringifyReplacer)}`;break;case b.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${q.util.joinValues(s.keys,", ")}`;break;case b.ZodIssueCode.invalid_union:t="Invalid input";break;case b.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${q.util.joinValues(s.options)}`;break;case b.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${q.util.joinValues(s.options)}, received '${s.received}'`;break;case b.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case b.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case b.ZodIssueCode.invalid_date:t="Invalid date";break;case b.ZodIssueCode.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:q.util.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case b.ZodIssueCode.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case b.ZodIssueCode.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case b.ZodIssueCode.custom:t="Invalid input";break;case b.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case b.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case b.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,q.util.assertNever(s)}return{message:t}};Ze.default=yt});var _e=S(V=>{"use strict";var _t=V&&V.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(V,"__esModule",{value:!0});V.defaultErrorMap=void 0;V.setErrorMap=gt;V.getErrorMap=vt;var De=_t(Ce());V.defaultErrorMap=De.default;var Ue=De.default;function gt(s){Ue=s}function vt(){return Ue}});var Ae=S(x=>{"use strict";var It=x&&x.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(x,"__esModule",{value:!0});x.isAsync=x.isValid=x.isDirty=x.isAborted=x.OK=x.DIRTY=x.INVALID=x.ParseStatus=x.EMPTY_PATH=x.makeIssue=void 0;x.addIssueToContext=bt;var xt=_e(),Ve=It(Ce()),Tt=s=>{let{data:e,path:t,errorMaps:r,issueData:a}=s,n=[...t,...a.path||[]],d={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let u="",h=r.filter(f=>!!f).slice().reverse();for(let f of h)u=f(d,{data:e,defaultError:u}).message;return{...a,path:n,message:u}};x.makeIssue=Tt;x.EMPTY_PATH=[];function bt(s,e){let t=(0,xt.getErrorMap)(),r=(0,x.makeIssue)({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===Ve.default?void 0:Ve.default].filter(a=>!!a)});s.common.issues.push(r)}var we=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return x.INVALID;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let n=await a.key,d=await a.value;r.push({key:n,value:d})}return s.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:n,value:d}=a;if(n.status==="aborted"||d.status==="aborted")return x.INVALID;n.status==="dirty"&&e.dirty(),d.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof d.value<"u"||a.alwaysSet)&&(r[n.value]=d.value)}return{status:e.value,value:r}}};x.ParseStatus=we;x.INVALID=Object.freeze({status:"aborted"});var kt=s=>({status:"dirty",value:s});x.DIRTY=kt;var Zt=s=>({status:"valid",value:s});x.OK=Zt;var Ct=s=>s.status==="aborted";x.isAborted=Ct;var wt=s=>s.status==="dirty";x.isDirty=wt;var At=s=>s.status==="valid";x.isValid=At;var Pt=s=>typeof Promise<"u"&&s instanceof Promise;x.isAsync=Pt});var ze=S(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0})});var qe=S(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.errorUtil=void 0;var $e;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})($e||(ge.errorUtil=$e={}))});var tt=S(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.discriminatedUnion=i.date=i.boolean=i.bigint=i.array=i.any=i.coerce=i.ZodFirstPartyTypeKind=i.late=i.ZodSchema=i.Schema=i.ZodReadonly=i.ZodPipeline=i.ZodBranded=i.BRAND=i.ZodNaN=i.ZodCatch=i.ZodDefault=i.ZodNullable=i.ZodOptional=i.ZodTransformer=i.ZodEffects=i.ZodPromise=i.ZodNativeEnum=i.ZodEnum=i.ZodLiteral=i.ZodLazy=i.ZodFunction=i.ZodSet=i.ZodMap=i.ZodRecord=i.ZodTuple=i.ZodIntersection=i.ZodDiscriminatedUnion=i.ZodUnion=i.ZodObject=i.ZodArray=i.ZodVoid=i.ZodNever=i.ZodUnknown=i.ZodAny=i.ZodNull=i.ZodUndefined=i.ZodSymbol=i.ZodDate=i.ZodBoolean=i.ZodBigInt=i.ZodNumber=i.ZodString=i.ZodType=void 0;i.NEVER=i.void=i.unknown=i.union=i.undefined=i.tuple=i.transformer=i.symbol=i.string=i.strictObject=i.set=i.record=i.promise=i.preprocess=i.pipeline=i.ostring=i.optional=i.onumber=i.oboolean=i.object=i.number=i.nullable=i.null=i.never=i.nativeEnum=i.nan=i.map=i.literal=i.lazy=i.intersection=i.instanceof=i.function=i.enum=i.effect=void 0;i.datetimeRegex=Ye;i.custom=Je;var c=ye(),ve=_e(),p=qe(),o=Ae(),l=fe(),P=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}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}},Be=(s,e)=>{if((0,o.isValid)(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new c.ZodError(s.common.issues);return this._error=t,this._error}}};function _(s){if(!s)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(d,u)=>{let{message:h}=s;return d.code==="invalid_enum_value"?{message:h??u.defaultError}:typeof u.data>"u"?{message:h??r??u.defaultError}:d.code!=="invalid_type"?{message:u.defaultError}:{message:h??t??u.defaultError}},description:a}}var g=class{get description(){return this._def.description}_getType(e){return(0,l.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,l.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new o.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,l.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0,o.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,l.getParsedType)(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Be(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,l.getParsedType)(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return(0,o.isValid)(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>(0,o.isValid)(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,l.getParsedType)(e)},a=this._parse({data:e,path:r.path,parent:r}),n=await((0,o.isAsync)(a)?a:Promise.resolve(a));return Be(r,n)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{let d=e(a),u=()=>n.addIssue({code:c.ZodIssueCode.custom,...r(a)});return typeof Promise<"u"&&d instanceof Promise?d.then(h=>h?!0:(u(),!1)):d?!0:(u(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new C({schema:this,typeName:m.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 A.create(this,this._def)}nullable(){return E.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D.create(this)}promise(){return $.create(this,this._def)}or(e){return J.create([this,e],this._def)}and(e){return H.create(this,e,this._def)}transform(e){return new C({..._(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new se({..._(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new pe({typeName:m.ZodBranded,type:this,..._(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new re({..._(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return me.create(this,e)}readonly(){return ae.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i.ZodType=g;i.Schema=g;i.ZodSchema=g;var Ot=/^c[^\s-]{8,}$/i,St=/^[0-9a-z]+$/,Nt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jt=/^[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,Et=/^[a-z0-9_-]{21}$/i,Lt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Rt=/^[-+]?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)?)??$/,Dt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ut="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Pe,Vt=/^(?:(?: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])$/,Mt=/^(?:(?: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])$/,zt=/^(([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]))$/,$t=/^(([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])$/,qt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Bt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ke="((\\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])))",Ft=new RegExp(`^${Ke}$`);function We(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);let t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Kt(s){return new RegExp(`^${We(s)}$`)}function Ye(s){let e=`${Ke}T${We(s)}`,t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Wt(s,e){return!!((e==="v4"||!e)&&Vt.test(s)||(e==="v6"||!e)&&zt.test(s))}function Yt(s,e){if(!Lt.test(s))return!1;try{let[t]=s.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Gt(s,e){return!!((e==="v4"||!e)&&Mt.test(s)||(e==="v6"||!e)&&$t.test(s))}var M=class s extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.ZodParsedType.string){let n=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.string,received:n.parsedType}),o.INVALID}let r=new o.ParseStatus,a;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){let d=e.data.length>n.value,u=e.data.length<n.value;(d||u)&&(a=this._getOrReturnCtx(e,a),d?(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):u&&(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind==="email")Dt.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"email",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty());else if(n.kind==="emoji")Pe||(Pe=new RegExp(Ut,"u")),Pe.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"emoji",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty());else if(n.kind==="uuid")jt.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"uuid",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty());else if(n.kind==="nanoid")Et.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"nanoid",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid")Ot.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"cuid",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid2")St.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"cuid2",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty());else if(n.kind==="ulid")Nt.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"ulid",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"url",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"regex",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind==="datetime"?Ye(n).test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_string,validation:"datetime",message:n.message}),r.dirty()):n.kind==="date"?Ft.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_string,validation:"date",message:n.message}),r.dirty()):n.kind==="time"?Kt(n).test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.invalid_string,validation:"time",message:n.message}),r.dirty()):n.kind==="duration"?Rt.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"duration",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty()):n.kind==="ip"?Wt(e.data,n.version)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"ip",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty()):n.kind==="jwt"?Yt(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"jwt",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty()):n.kind==="cidr"?Gt(e.data,n.version)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"cidr",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty()):n.kind==="base64"?qt.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"base64",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty()):n.kind==="base64url"?Bt.test(e.data)||(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{validation:"base64url",code:c.ZodIssueCode.invalid_string,message:n.message}),r.dirty()):l.util.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:c.ZodIssueCode.invalid_string,...p.errorUtil.errToObj(r)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.errorUtil.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?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...p.errorUtil.errToObj(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?.precision>"u"?null:e?.precision,...p.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...p.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...p.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,p.errorUtil.errToObj(e))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...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(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};i.ZodString=M;M.create=s=>new M({checks:[],typeName:m.ZodString,coerce:s?.coerce??!1,..._(s)});function Jt(s,e){let t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,n=Number.parseInt(s.toFixed(a).replace(".","")),d=Number.parseInt(e.toFixed(a).replace(".",""));return n%d/10**a}var B=class s extends g{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)!==l.ZodParsedType.number){let n=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.number,received:n.parsedType}),o.INVALID}let r,a=new o.ParseStatus;for(let n of this._def.checks)n.kind==="int"?l.util.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Jt(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.not_finite,message:n.message}),a.dirty()):l.util.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.errorUtil.toString(t))}setLimit(e,t,r,a){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:p.errorUtil.toString(a)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&l.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};i.ZodNumber=B;B.create=s=>new B({checks:[],typeName:m.ZodNumber,coerce:s?.coerce||!1,..._(s)});var F=class s extends g{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)!==l.ZodParsedType.bigint)return this._getInvalidInput(e);let r,a=new o.ParseStatus;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):l.util.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.bigint,received:t.parsedType}),o.INVALID}gte(e,t){return this.setLimit("min",e,!0,p.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.errorUtil.toString(t))}setLimit(e,t,r,a){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:p.errorUtil.toString(a)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};i.ZodBigInt=F;F.create=s=>new F({checks:[],typeName:m.ZodBigInt,coerce:s?.coerce??!1,..._(s)});var K=class extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.ZodParsedType.boolean){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.boolean,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodBoolean=K;K.create=s=>new K({typeName:m.ZodBoolean,coerce:s?.coerce||!1,..._(s)});var W=class s extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.ZodParsedType.date){let n=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.date,received:n.parsedType}),o.INVALID}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(n,{code:c.ZodIssueCode.invalid_date}),o.INVALID}let r=new o.ParseStatus,a;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),(0,o.addIssueToContext)(a,{code:c.ZodIssueCode.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):l.util.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};i.ZodDate=W;W.create=s=>new W({checks:[],coerce:s?.coerce||!1,typeName:m.ZodDate,..._(s)});var ie=class extends g{_parse(e){if(this._getType(e)!==l.ZodParsedType.symbol){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.symbol,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodSymbol=ie;ie.create=s=>new ie({typeName:m.ZodSymbol,..._(s)});var Y=class extends g{_parse(e){if(this._getType(e)!==l.ZodParsedType.undefined){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.undefined,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodUndefined=Y;Y.create=s=>new Y({typeName:m.ZodUndefined,..._(s)});var G=class extends g{_parse(e){if(this._getType(e)!==l.ZodParsedType.null){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.null,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodNull=G;G.create=s=>new G({typeName:m.ZodNull,..._(s)});var z=class extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,o.OK)(e.data)}};i.ZodAny=z;z.create=s=>new z({typeName:m.ZodAny,..._(s)});var R=class extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,o.OK)(e.data)}};i.ZodUnknown=R;R.create=s=>new R({typeName:m.ZodUnknown,..._(s)});var N=class extends g{_parse(e){let t=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.never,received:t.parsedType}),o.INVALID}};i.ZodNever=N;N.create=s=>new N({typeName:m.ZodNever,..._(s)});var oe=class extends g{_parse(e){if(this._getType(e)!==l.ZodParsedType.undefined){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.void,received:r.parsedType}),o.INVALID}return(0,o.OK)(e.data)}};i.ZodVoid=oe;oe.create=s=>new oe({typeName:m.ZodVoid,..._(s)});var D=class s extends g{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==l.ZodParsedType.array)return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.array,received:t.parsedType}),o.INVALID;if(a.exactLength!==null){let d=t.data.length>a.exactLength.value,u=t.data.length<a.exactLength.value;(d||u)&&((0,o.addIssueToContext)(t,{code:d?c.ZodIssueCode.too_big:c.ZodIssueCode.too_small,minimum:u?a.exactLength.value:void 0,maximum:d?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&((0,o.addIssueToContext)(t,{code:c.ZodIssueCode.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&((0,o.addIssueToContext)(t,{code:c.ZodIssueCode.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((d,u)=>a.type._parseAsync(new P(t,d,t.path,u)))).then(d=>o.ParseStatus.mergeArray(r,d));let n=[...t.data].map((d,u)=>a.type._parseSync(new P(t,d,t.path,u)));return o.ParseStatus.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new s({...this._def,minLength:{value:e,message:p.errorUtil.toString(t)}})}max(e,t){return new s({...this._def,maxLength:{value:e,message:p.errorUtil.toString(t)}})}length(e,t){return new s({...this._def,exactLength:{value:e,message:p.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};i.ZodArray=D;D.create=(s,e)=>new D({type:s,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});function ne(s){if(s instanceof k){let e={};for(let t in s.shape){let r=s.shape[t];e[t]=A.create(ne(r))}return new k({...s._def,shape:()=>e})}else return s instanceof D?new D({...s._def,type:ne(s.element)}):s instanceof A?A.create(ne(s.unwrap())):s instanceof E?E.create(ne(s.unwrap())):s instanceof j?j.create(s.items.map(e=>ne(e))):s}var k=class s extends g{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=l.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==l.ZodParsedType.object){let f=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(f,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:f.parsedType}),o.INVALID}let{status:r,ctx:a}=this._processInputParams(e),{shape:n,keys:d}=this._getCached(),u=[];if(!(this._def.catchall instanceof N&&this._def.unknownKeys==="strip"))for(let f in a.data)d.includes(f)||u.push(f);let h=[];for(let f of d){let v=n[f],w=a.data[f];h.push({key:{status:"valid",value:f},value:v._parse(new P(a,w,a.path,f)),alwaysSet:f in a.data})}if(this._def.catchall instanceof N){let f=this._def.unknownKeys;if(f==="passthrough")for(let v of u)h.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(f==="strict")u.length>0&&((0,o.addIssueToContext)(a,{code:c.ZodIssueCode.unrecognized_keys,keys:u}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let v of u){let w=a.data[v];h.push({key:{status:"valid",value:v},value:f._parse(new P(a,w,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let f=[];for(let v of h){let w=await v.key,je=await v.value;f.push({key:w,value:je,alwaysSet:v.alwaysSet})}return f}).then(f=>o.ParseStatus.mergeObjectSync(r,f)):o.ParseStatus.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(e){return p.errorUtil.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:p.errorUtil.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(e){return new s({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new s({...this._def,catchall:e})}pick(e){let t={};for(let r of l.util.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new s({...this._def,shape:()=>t})}omit(e){let t={};for(let r of l.util.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new s({...this._def,shape:()=>t})}deepPartial(){return ne(this)}partial(e){let t={};for(let r of l.util.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new s({...this._def,shape:()=>t})}required(e){let t={};for(let r of l.util.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof A;)n=n._def.innerType;t[r]=n}return new s({...this._def,shape:()=>t})}keyof(){return Ge(l.util.objectKeys(this.shape))}};i.ZodObject=k;k.create=(s,e)=>new k({shape:()=>s,unknownKeys:"strip",catchall:N.create(),typeName:m.ZodObject,..._(e)});k.strictCreate=(s,e)=>new k({shape:()=>s,unknownKeys:"strict",catchall:N.create(),typeName:m.ZodObject,..._(e)});k.lazycreate=(s,e)=>new k({shape:s,unknownKeys:"strip",catchall:N.create(),typeName:m.ZodObject,..._(e)});var J=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(n){for(let u of n)if(u.result.status==="valid")return u.result;for(let u of n)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;let d=n.map(u=>new c.ZodError(u.ctx.common.issues));return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_union,unionErrors:d}),o.INVALID}if(t.common.async)return Promise.all(r.map(async n=>{let d={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:d}),ctx:d}})).then(a);{let n,d=[];for(let h of r){let 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"&&!n&&(n={result:v,ctx:f}),f.common.issues.length&&d.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let u=d.map(h=>new c.ZodError(h));return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_union,unionErrors:u}),o.INVALID}}get options(){return this._def.options}};i.ZodUnion=J;J.create=(s,e)=>new J({options:s,typeName:m.ZodUnion,..._(e)});var L=s=>s instanceof Q?L(s.schema):s instanceof C?L(s.innerType()):s instanceof X?[s.value]:s instanceof ee?s.options:s instanceof te?l.util.objectValues(s.enum):s instanceof se?L(s._def.innerType):s instanceof Y?[void 0]:s instanceof G?[null]:s instanceof A?[void 0,...L(s.unwrap())]:s instanceof E?[null,...L(s.unwrap())]:s instanceof pe||s instanceof ae?L(s.unwrap()):s instanceof re?L(s._def.innerType):[],Ie=class s extends g{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.ZodParsedType.object)return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:t.parsedType}),o.INVALID;let r=this.discriminator,a=t.data[r],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):((0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),o.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let n of t){let d=L(n.shape[e]);if(!d.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of d){if(a.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);a.set(u,n)}}return new s({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,..._(r)})}};i.ZodDiscriminatedUnion=Ie;function Oe(s,e){let t=(0,l.getParsedType)(s),r=(0,l.getParsedType)(e);if(s===e)return{valid:!0,data:s};if(t===l.ZodParsedType.object&&r===l.ZodParsedType.object){let a=l.util.objectKeys(e),n=l.util.objectKeys(s).filter(u=>a.indexOf(u)!==-1),d={...s,...e};for(let u of n){let h=Oe(s[u],e[u]);if(!h.valid)return{valid:!1};d[u]=h.data}return{valid:!0,data:d}}else if(t===l.ZodParsedType.array&&r===l.ZodParsedType.array){if(s.length!==e.length)return{valid:!1};let a=[];for(let n=0;n<s.length;n++){let d=s[n],u=e[n],h=Oe(d,u);if(!h.valid)return{valid:!1};a.push(h.data)}return{valid:!0,data:a}}else return t===l.ZodParsedType.date&&r===l.ZodParsedType.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}var H=class extends g{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(n,d)=>{if((0,o.isAborted)(n)||(0,o.isAborted)(d))return o.INVALID;let u=Oe(n.value,d.value);return u.valid?(((0,o.isDirty)(n)||(0,o.isDirty)(d))&&t.dirty(),{status:t.value,value:u.data}):((0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_intersection_types}),o.INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,d])=>a(n,d)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};i.ZodIntersection=H;H.create=(s,e,t)=>new H({left:s,right:e,typeName:m.ZodIntersection,..._(t)});var j=class s extends g{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.ZodParsedType.array)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.array,received:r.parsedType}),o.INVALID;if(r.data.length<this._def.items.length)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),o.INVALID;!this._def.rest&&r.data.length>this._def.items.length&&((0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...r.data].map((d,u)=>{let h=this._def.items[u]||this._def.rest;return h?h._parse(new P(r,d,r.path,u)):null}).filter(d=>!!d);return r.common.async?Promise.all(n).then(d=>o.ParseStatus.mergeArray(t,d)):o.ParseStatus.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};i.ZodTuple=j;j.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new j({items:s,typeName:m.ZodTuple,rest:null,..._(e)})};var xe=class s extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.ZodParsedType.object)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.object,received:r.parsedType}),o.INVALID;let a=[],n=this._def.keyType,d=this._def.valueType;for(let u in r.data)a.push({key:n._parse(new P(r,u,r.path,u)),value:d._parse(new P(r,r.data[u],r.path,u)),alwaysSet:u in r.data});return r.common.async?o.ParseStatus.mergeObjectAsync(t,a):o.ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof g?new s({keyType:e,valueType:t,typeName:m.ZodRecord,..._(r)}):new s({keyType:M.create(),valueType:e,typeName:m.ZodRecord,..._(t)})}};i.ZodRecord=xe;var de=class extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.ZodParsedType.map)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.map,received:r.parsedType}),o.INVALID;let a=this._def.keyType,n=this._def.valueType,d=[...r.data.entries()].map(([u,h],f)=>({key:a._parse(new P(r,u,r.path,[f,"key"])),value:n._parse(new P(r,h,r.path,[f,"value"]))}));if(r.common.async){let u=new Map;return Promise.resolve().then(async()=>{for(let h of d){let f=await h.key,v=await h.value;if(f.status==="aborted"||v.status==="aborted")return o.INVALID;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),u.set(f.value,v.value)}return{status:t.value,value:u}})}else{let u=new Map;for(let h of d){let f=h.key,v=h.value;if(f.status==="aborted"||v.status==="aborted")return o.INVALID;(f.status==="dirty"||v.status==="dirty")&&t.dirty(),u.set(f.value,v.value)}return{status:t.value,value:u}}}};i.ZodMap=de;de.create=(s,e,t)=>new de({valueType:e,keyType:s,typeName:m.ZodMap,..._(t)});var ue=class s extends g{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==l.ZodParsedType.set)return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.set,received:r.parsedType}),o.INVALID;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&((0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&((0,o.addIssueToContext)(r,{code:c.ZodIssueCode.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let n=this._def.valueType;function d(h){let f=new Set;for(let v of h){if(v.status==="aborted")return o.INVALID;v.status==="dirty"&&t.dirty(),f.add(v.value)}return{status:t.value,value:f}}let u=[...r.data.values()].map((h,f)=>n._parse(new P(r,h,r.path,f)));return r.common.async?Promise.all(u).then(h=>d(h)):d(u)}min(e,t){return new s({...this._def,minSize:{value:e,message:p.errorUtil.toString(t)}})}max(e,t){return new s({...this._def,maxSize:{value:e,message:p.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};i.ZodSet=ue;ue.create=(s,e)=>new ue({valueType:s,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});var Te=class s extends g{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.ZodParsedType.function)return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.function,received:t.parsedType}),o.INVALID;function r(u,h){return(0,o.makeIssue)({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,ve.getErrorMap)(),ve.defaultErrorMap].filter(f=>!!f),issueData:{code:c.ZodIssueCode.invalid_arguments,argumentsError:h}})}function a(u,h){return(0,o.makeIssue)({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,ve.getErrorMap)(),ve.defaultErrorMap].filter(f=>!!f),issueData:{code:c.ZodIssueCode.invalid_return_type,returnTypeError:h}})}let n={errorMap:t.common.contextualErrorMap},d=t.data;if(this._def.returns instanceof $){let u=this;return(0,o.OK)(async function(...h){let f=new c.ZodError([]),v=await u._def.args.parseAsync(h,n).catch(be=>{throw f.addIssue(r(h,be)),f}),w=await Reflect.apply(d,this,v);return await u._def.returns._def.type.parseAsync(w,n).catch(be=>{throw f.addIssue(a(w,be)),f})})}else{let u=this;return(0,o.OK)(function(...h){let f=u._def.args.safeParse(h,n);if(!f.success)throw new c.ZodError([r(h,f.error)]);let v=Reflect.apply(d,this,f.data),w=u._def.returns.safeParse(v,n);if(!w.success)throw new c.ZodError([a(v,w.error)]);return w.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new s({...this._def,args:j.create(e).rest(R.create())})}returns(e){return new s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new s({args:e||j.create([]).rest(R.create()),returns:t||R.create(),typeName:m.ZodFunction,..._(r)})}};i.ZodFunction=Te;var Q=class extends g{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};i.ZodLazy=Q;Q.create=(s,e)=>new Q({getter:s,typeName:m.ZodLazy,..._(e)});var X=class extends g{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(t,{received:t.data,code:c.ZodIssueCode.invalid_literal,expected:this._def.value}),o.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};i.ZodLiteral=X;X.create=(s,e)=>new X({value:s,typeName:m.ZodLiteral,..._(e)});function Ge(s,e){return new ee({values:s,typeName:m.ZodEnum,..._(e)})}var ee=class s extends g{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return(0,o.addIssueToContext)(t,{expected:l.util.joinValues(r),received:t.parsedType,code:c.ZodIssueCode.invalid_type}),o.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return(0,o.addIssueToContext)(t,{received:t.data,code:c.ZodIssueCode.invalid_enum_value,options:r}),o.INVALID}return(0,o.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return s.create(e,{...this._def,...t})}exclude(e,t=this._def){return s.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};i.ZodEnum=ee;ee.create=Ge;var te=class extends g{_parse(e){let t=l.util.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==l.ZodParsedType.string&&r.parsedType!==l.ZodParsedType.number){let a=l.util.objectValues(t);return(0,o.addIssueToContext)(r,{expected:l.util.joinValues(a),received:r.parsedType,code:c.ZodIssueCode.invalid_type}),o.INVALID}if(this._cache||(this._cache=new Set(l.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=l.util.objectValues(t);return(0,o.addIssueToContext)(r,{received:r.data,code:c.ZodIssueCode.invalid_enum_value,options:a}),o.INVALID}return(0,o.OK)(e.data)}get enum(){return this._def.values}};i.ZodNativeEnum=te;te.create=(s,e)=>new te({values:s,typeName:m.ZodNativeEnum,..._(e)});var $=class extends g{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.ZodParsedType.promise&&t.common.async===!1)return(0,o.addIssueToContext)(t,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.promise,received:t.parsedType}),o.INVALID;let r=t.parsedType===l.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,o.OK)(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};i.ZodPromise=$;$.create=(s,e)=>new $({type:s,typeName:m.ZodPromise,..._(e)});var C=class extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:d=>{(0,o.addIssueToContext)(r,d),d.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){let d=a.transform(r.data,n);if(r.common.async)return Promise.resolve(d).then(async u=>{if(t.value==="aborted")return o.INVALID;let h=await this._def.schema._parseAsync({data:u,path:r.path,parent:r});return h.status==="aborted"?o.INVALID:h.status==="dirty"||t.value==="dirty"?(0,o.DIRTY)(h.value):h});{if(t.value==="aborted")return o.INVALID;let u=this._def.schema._parseSync({data:d,path:r.path,parent:r});return u.status==="aborted"?o.INVALID:u.status==="dirty"||t.value==="dirty"?(0,o.DIRTY)(u.value):u}}if(a.type==="refinement"){let d=u=>{let h=a.refinement(u,n);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?o.INVALID:(u.status==="dirty"&&t.dirty(),d(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?o.INVALID:(u.status==="dirty"&&t.dirty(),d(u.value).then(()=>({status:t.value,value:u.value}))))}if(a.type==="transform")if(r.common.async===!1){let d=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!(0,o.isValid)(d))return o.INVALID;let u=a.transform(d.value,n);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(d=>(0,o.isValid)(d)?Promise.resolve(a.transform(d.value,n)).then(u=>({status:t.value,value:u})):o.INVALID);l.util.assertNever(a)}};i.ZodEffects=C;i.ZodTransformer=C;C.create=(s,e,t)=>new C({schema:s,typeName:m.ZodEffects,effect:e,..._(t)});C.createWithPreprocess=(s,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:s},typeName:m.ZodEffects,..._(t)});var A=class extends g{_parse(e){return this._getType(e)===l.ZodParsedType.undefined?(0,o.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};i.ZodOptional=A;A.create=(s,e)=>new A({innerType:s,typeName:m.ZodOptional,..._(e)});var E=class extends g{_parse(e){return this._getType(e)===l.ZodParsedType.null?(0,o.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};i.ZodNullable=E;E.create=(s,e)=>new E({innerType:s,typeName:m.ZodNullable,..._(e)});var se=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===l.ZodParsedType.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};i.ZodDefault=se;se.create=(s,e)=>new se({innerType:s,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var re=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return(0,o.isAsync)(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new c.ZodError(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new c.ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};i.ZodCatch=re;re.create=(s,e)=>new re({innerType:s,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var ce=class extends g{_parse(e){if(this._getType(e)!==l.ZodParsedType.nan){let r=this._getOrReturnCtx(e);return(0,o.addIssueToContext)(r,{code:c.ZodIssueCode.invalid_type,expected:l.ZodParsedType.nan,received:r.parsedType}),o.INVALID}return{status:"valid",value:e.data}}};i.ZodNaN=ce;ce.create=s=>new ce({typeName:m.ZodNaN,..._(s)});i.BRAND=Symbol("zod_brand");var pe=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}};i.ZodBranded=pe;var me=class s extends g{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?o.INVALID:n.status==="dirty"?(t.dirty(),(0,o.DIRTY)(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?o.INVALID:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new s({in:e,out:t,typeName:m.ZodPipeline})}};i.ZodPipeline=me;var ae=class extends g{_parse(e){let t=this._def.innerType._parse(e),r=a=>((0,o.isValid)(a)&&(a.value=Object.freeze(a.value)),a);return(0,o.isAsync)(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};i.ZodReadonly=ae;ae.create=(s,e)=>new ae({innerType:s,typeName:m.ZodReadonly,..._(e)});function Fe(s,e){let t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function Je(s,e={},t){return s?z.create().superRefine((r,a)=>{let n=s(r);if(n instanceof Promise)return n.then(d=>{if(!d){let u=Fe(e,r),h=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:h})}});if(!n){let d=Fe(e,r),u=d.fatal??t??!0;a.addIssue({code:"custom",...d,fatal:u})}}):z.create()}i.late={object:k.lazycreate};var m;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(m||(i.ZodFirstPartyTypeKind=m={}));var Ht=(s,e={message:`Input not instance of ${s.name}`})=>Je(t=>t instanceof s,e);i.instanceof=Ht;var He=M.create;i.string=He;var Qe=B.create;i.number=Qe;var Qt=ce.create;i.nan=Qt;var Xt=F.create;i.bigint=Xt;var Xe=K.create;i.boolean=Xe;var es=W.create;i.date=es;var ts=ie.create;i.symbol=ts;var ss=Y.create;i.undefined=ss;var rs=G.create;i.null=rs;var as=z.create;i.any=as;var ns=R.create;i.unknown=ns;var is=N.create;i.never=is;var os=oe.create;i.void=os;var ds=D.create;i.array=ds;var us=k.create;i.object=us;var cs=k.strictCreate;i.strictObject=cs;var ls=J.create;i.union=ls;var fs=Ie.create;i.discriminatedUnion=fs;var hs=H.create;i.intersection=hs;var ps=j.create;i.tuple=ps;var ms=xe.create;i.record=ms;var ys=de.create;i.map=ys;var _s=ue.create;i.set=_s;var gs=Te.create;i.function=gs;var vs=Q.create;i.lazy=vs;var Is=X.create;i.literal=Is;var xs=ee.create;i.enum=xs;var Ts=te.create;i.nativeEnum=Ts;var bs=$.create;i.promise=bs;var et=C.create;i.effect=et;i.transformer=et;var ks=A.create;i.optional=ks;var Zs=E.create;i.nullable=Zs;var Cs=C.createWithPreprocess;i.preprocess=Cs;var ws=me.create;i.pipeline=ws;var As=()=>He().optional();i.ostring=As;var Ps=()=>Qe().optional();i.onumber=Ps;var Os=()=>Xe().optional();i.oboolean=Os;i.coerce={string:s=>M.create({...s,coerce:!0}),number:s=>B.create({...s,coerce:!0}),boolean:s=>K.create({...s,coerce:!0}),bigint:s=>F.create({...s,coerce:!0}),date:s=>W.create({...s,coerce:!0})};i.NEVER=o.INVALID});var Se=S(O=>{"use strict";var Ss=O&&O.__createBinding||(Object.create?function(s,e,t,r){r===void 0&&(r=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,a)}:function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]}),le=O&&O.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ss(e,s,t)};Object.defineProperty(O,"__esModule",{value:!0});le(_e(),O);le(Ae(),O);le(ze(),O);le(fe(),O);le(tt(),O);le(ye(),O)});var at=S(Z=>{"use strict";var st=Z&&Z.__createBinding||(Object.create?function(s,e,t,r){r===void 0&&(r=t);var a=Object.getOwnPropertyDescriptor(e,t);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,a)}:function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]}),Ns=Z&&Z.__setModuleDefault||(Object.create?function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}:function(s,e){s.default=e}),js=Z&&Z.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&st(e,s,t);return Ns(e,s),e},Es=Z&&Z.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&st(e,s,t)};Object.defineProperty(Z,"__esModule",{value:!0});Z.z=void 0;var rt=js(Se());Z.z=rt;Es(Se(),Z);Z.default=rt});var nt=S(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.KernelResponseSchema=I.KernelMessageSchema=I.MessageTypeSchema=I.UrlUpdatePayloadSchema=I.AuthLoginPayloadSchema=I.ScrollDirectionPayloadSchema=I.ScrollDirectionSchema=I.SelectedLocationSchema=I.LocationPickerOptionsSchema=I.AlertPayloadSchema=I.AlertButtonSchema=I.AuthTokenPayloadSchema=I.LocationPayloadSchema=I.UserPayloadSchema=void 0;var y=at();I.UserPayloadSchema=y.z.object({id:y.z.string(),email:y.z.string().optional(),name:y.z.string().optional(),role:y.z.string().optional(),place_id:y.z.string().nullable().optional()});I.LocationPayloadSchema=y.z.object({city:y.z.string().optional(),country:y.z.string().optional(),coords:y.z.object({lat:y.z.number(),lng:y.z.number()}),latitude:y.z.number().optional(),longitude:y.z.number().optional()});I.AuthTokenPayloadSchema=y.z.object({token:y.z.string()});I.AlertButtonSchema=y.z.object({text:y.z.string().optional(),style:y.z.enum(["default","cancel","destructive"]).optional()});I.AlertPayloadSchema=y.z.object({title:y.z.string(),message:y.z.string().optional(),buttons:y.z.array(I.AlertButtonSchema).optional()});I.LocationPickerOptionsSchema=y.z.object({readonly:y.z.boolean().optional(),lat:y.z.number().optional(),lng:y.z.number().optional()});I.SelectedLocationSchema=y.z.object({lat:y.z.number(),lng:y.z.number()});I.ScrollDirectionSchema=y.z.enum(["up","down"]);I.ScrollDirectionPayloadSchema=y.z.object({direction:I.ScrollDirectionSchema});I.AuthLoginPayloadSchema=y.z.object({intendedView:y.z.string().optional()});I.UrlUpdatePayloadSchema=y.z.object({slug:y.z.string().optional()});I.MessageTypeSchema=y.z.enum(["LOCALE_INIT","GET_USER","GET_LOCATION","GET_AUTH_TOKEN","UI_ALERT","UI_PICK_LOCATION","SCROLL_DIRECTION","AUTH_LOGIN","URL_UPDATE"]);I.KernelMessageSchema=y.z.object({type:y.z.string(),payload:y.z.unknown(),requestId:y.z.number()});I.KernelResponseSchema=y.z.object({type:y.z.literal("LOCALE_RESPONSE"),requestId:y.z.number(),payload:y.z.unknown(),error:y.z.string().nullable().optional()})});var it=ht(nt()),Ne=class{constructor(e={}){this.debugEnabled=!0;this.requestId=0,this.requests=new Map,this.kernelOrigin=e.kernelOrigin||"*",typeof window<"u"&&window.LOCALE_SDK_DEBUG===!0&&(this.debugEnabled=!0),window.addEventListener("message",t=>{if(this.kernelOrigin!=="*"&&t.origin!==this.kernelOrigin)return;let r=t.data,a=it.KernelResponseSchema.safeParse(r);if(!a.success)return;let{type:n,payload:d,requestId:u,error:h}=a.data;if(n==="LOCALE_RESPONSE"&&this.requests.has(u)){let f=this.requests.get(u);if(!f)return;this.requests.delete(u),this._log("Received response:",n,{requestId:u,error:h,payload:d}),h?f.reject(new Error(h)):f.resolve(d)}}),this._send("LOCALE_INIT",{})}_log(...e){this.debugEnabled&&console.log("[Locale SDK]",...e)}_send(e,t){return new Promise((r,a)=>{let n=++this.requestId;this.requests.set(n,{resolve:r,reject:a}),this._log("Sending message:",e,{requestId:n,payload:t});let d={type:e,payload:t,requestId:n};window.parent.postMessage(d,this.kernelOrigin)})}async init(){try{let[e,t,r]=await Promise.all([this.getUser().catch(a=>(this._log("Failed to fetch user:",a),console.warn("[SDK] Failed to fetch user:",a),null)),this.getLocation().catch(a=>(this._log("Failed to fetch location:",a),console.warn("[SDK] Failed to fetch location:",a),null)),this.getAuthToken().catch(a=>(this._log("Failed to fetch auth token:",a),console.warn("[SDK] Failed to fetch auth token:",a),null))]);return{user:e,location:t,token:r?r.token:null}}catch(e){throw console.error("[SDK] Init failed:",e),e}}async getUser(){return this._send("GET_USER",{})}async getAuthToken(){return this._send("GET_AUTH_TOKEN",{})}async connectSupabase(e){let{token:t}=await this.getAuthToken(),{error:r}=await e.auth.setSession({access_token:t,refresh_token:t});if(r)throw new Error("Failed to connect Supabase with Local\xE9: "+r.message);return{token:t}}async getLocation(){return this._send("GET_LOCATION",{})}async alert(e,t,r,a){let n=r&&r.length>0?r:[{text:"OK",style:"default"}],d=n.map(f=>({text:f.text||"Button",style:f.style||"default"})),u={title:e,message:t,buttons:d},h=await this._send("UI_ALERT",u);if(h!==null&&h>=0&&h<n.length){let f=n[h];f.onPress&&f.onPress()}else a?.onDismiss&&a.onDismiss()}async pickLocation(e){let t=e||{};return this._send("UI_PICK_LOCATION",t)}async login(e){let t={intendedView:e};await this._send("AUTH_LOGIN",t)}async updateUrlPath(e){let t={slug:e};await this._send("URL_UPDATE",t)}};window.LocaleApp=Ne;})();
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@locale-labs/miniapp-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "SDK for Localé Mini-Apps - Bridge between Mini-Apps and the Localé Kernel",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/locale-labs/locale-miniapp-sdk.git"
8
+ },
5
9
  "main": "dist/sdk.js",
6
10
  "types": "dist/sdk.d.ts",
7
11
  "files": [
@@ -9,13 +13,19 @@
9
13
  ],
10
14
  "scripts": {
11
15
  "build": "bun run build:types && esbuild src/sdk.ts --bundle --minify --format=iife --target=es2020 --outfile=dist/sdk.js",
12
- "build:types": "tsc --emitDeclarationOnly --declaration --outDir dist"
16
+ "build:types": "tsc --emitDeclarationOnly --declaration --outDir dist",
17
+ "watch": "concurrently \"tsc --emitDeclarationOnly --declaration --outDir dist --watch\" \"esbuild src/sdk.ts --bundle --outfile=dist/sdk.js --watch\"",
18
+ "security-check": "bunx @socketsecurity/cli ci"
13
19
  },
14
20
  "dependencies": {
15
21
  "@locale-labs/protocol": "^0.1.3"
16
22
  },
17
23
  "devDependencies": {
24
+ "@semantic-release/changelog": "6.0.3",
25
+ "@semantic-release/git": "10.0.1",
26
+ "concurrently": "^9.1.2",
18
27
  "esbuild": "^0.23.0",
28
+ "semantic-release": "25.0.2",
19
29
  "typescript": "^5.0.0"
20
30
  },
21
31
  "keywords": [
@@ -24,5 +34,8 @@
24
34
  "sdk",
25
35
  "iframe",
26
36
  "postmessage"
27
- ]
37
+ ],
38
+ "publishConfig": {
39
+ "access": "public"
40
+ }
28
41
  }