@gengage/assistant-fe 0.1.0 → 0.1.2
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/LICENSE +2 -2
- package/README.md +2 -2
- package/dist/assistant-fe.css +1 -1
- package/dist/chat/api.d.ts +12 -2
- package/dist/chat/api.d.ts.map +1 -1
- package/dist/chat/catalog.d.ts +246 -896
- package/dist/chat/catalog.d.ts.map +1 -1
- package/dist/chat/components/AIGroupingCards.d.ts.map +1 -1
- package/dist/chat/components/AISuggestedSearchCards.d.ts.map +1 -1
- package/dist/chat/components/AITopPicks.d.ts.map +1 -1
- package/dist/chat/components/CategoriesContainer.d.ts.map +1 -1
- package/dist/chat/components/ChatDrawer.d.ts +16 -3
- package/dist/chat/components/ChatDrawer.d.ts.map +1 -1
- package/dist/chat/components/ComparisonTable.d.ts +9 -0
- package/dist/chat/components/ComparisonTable.d.ts.map +1 -1
- package/dist/chat/components/GroundingReviewCard.d.ts.map +1 -1
- package/dist/chat/components/HandoffNotice.d.ts +5 -0
- package/dist/chat/components/HandoffNotice.d.ts.map +1 -0
- package/dist/chat/components/KvkkBanner.d.ts +1 -0
- package/dist/chat/components/KvkkBanner.d.ts.map +1 -1
- package/dist/chat/components/ProactivePopup.d.ts +9 -0
- package/dist/chat/components/ProactivePopup.d.ts.map +1 -1
- package/dist/chat/components/ProductSummaryCard.d.ts +4 -0
- package/dist/chat/components/ProductSummaryCard.d.ts.map +1 -0
- package/dist/chat/components/ReviewHighlights.d.ts +3 -1
- package/dist/chat/components/ReviewHighlights.d.ts.map +1 -1
- package/dist/chat/components/ThumbnailsColumn.d.ts.map +1 -1
- package/dist/chat/components/renderUISpec.d.ts +4 -3
- package/dist/chat/components/renderUISpec.d.ts.map +1 -1
- package/dist/chat/heartbeat.d.ts +71 -0
- package/dist/chat/heartbeat.d.ts.map +1 -0
- package/dist/chat/index.d.ts +39 -78
- package/dist/chat/index.d.ts.map +1 -1
- package/dist/chat/kvkk.d.ts +21 -0
- package/dist/chat/kvkk.d.ts.map +1 -0
- package/dist/chat/locales/en.d.ts.map +1 -1
- package/dist/chat/locales/tr.d.ts.map +1 -1
- package/dist/chat/panel-manager.d.ts +81 -0
- package/dist/chat/panel-manager.d.ts.map +1 -0
- package/dist/chat/session-persistence.d.ts +56 -0
- package/dist/chat/session-persistence.d.ts.map +1 -0
- package/dist/chat/types.d.ts +39 -1
- package/dist/chat/types.d.ts.map +1 -1
- package/dist/chat.cjs +1 -1
- package/dist/chat.iife.js +48 -10
- package/dist/chat.iife.js.map +1 -1
- package/dist/chat.js +9 -8
- package/dist/chat.js.map +1 -1
- package/dist/common/analytics-events.d.ts +2 -0
- package/dist/common/analytics-events.d.ts.map +1 -1
- package/dist/common/analytics.d.ts.map +1 -1
- package/dist/common/api-paths.d.ts +5 -0
- package/dist/common/api-paths.d.ts.map +1 -1
- package/dist/common/client.d.ts +4 -1
- package/dist/common/client.d.ts.map +1 -1
- package/dist/common/communication-bridge.d.ts.map +1 -1
- package/dist/common/config-schema.d.ts +33 -195
- package/dist/common/config-schema.d.ts.map +1 -1
- package/dist/common/ga-datalayer.d.ts +62 -0
- package/dist/common/ga-datalayer.d.ts.map +1 -0
- package/dist/common/index.d.ts +7 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/indexed-db.d.ts +1 -1
- package/dist/common/indexed-db.d.ts.map +1 -1
- package/dist/common/merchant-configs.d.ts +22 -0
- package/dist/common/merchant-configs.d.ts.map +1 -0
- package/dist/common/overlay.d.ts +5 -0
- package/dist/common/overlay.d.ts.map +1 -1
- package/dist/common/page-detect.d.ts +31 -0
- package/dist/common/page-detect.d.ts.map +1 -0
- package/dist/common/preflight.d.ts +3 -1
- package/dist/common/preflight.d.ts.map +1 -1
- package/dist/common/price-formatter.d.ts +33 -0
- package/dist/common/price-formatter.d.ts.map +1 -0
- package/dist/common/product-utils.d.ts +26 -0
- package/dist/common/product-utils.d.ts.map +1 -0
- package/dist/common/quantity-stepper.d.ts +22 -0
- package/dist/common/quantity-stepper.d.ts.map +1 -0
- package/dist/common/safe-html.d.ts +10 -6
- package/dist/common/safe-html.d.ts.map +1 -1
- package/dist/common/streaming.d.ts +6 -0
- package/dist/common/streaming.d.ts.map +1 -1
- package/dist/common/tts-player.d.ts +12 -0
- package/dist/common/tts-player.d.ts.map +1 -0
- package/dist/common/types.d.ts +51 -0
- package/dist/common/types.d.ts.map +1 -1
- package/dist/common/v1-protocol-adapter.d.ts +9 -0
- package/dist/common/v1-protocol-adapter.d.ts.map +1 -1
- package/dist/common/voice-input.d.ts +74 -0
- package/dist/common/voice-input.d.ts.map +1 -0
- package/dist/common/widget-base.d.ts +18 -1
- package/dist/common/widget-base.d.ts.map +1 -1
- package/dist/common.cjs +1 -1
- package/dist/common.cjs.map +1 -1
- package/dist/common.js +564 -244
- package/dist/common.js.map +1 -1
- package/dist/index-CXbH-cw8.js +4337 -0
- package/dist/index-CXbH-cw8.js.map +1 -0
- package/dist/index-DHfTHscz.cjs +13 -0
- package/dist/index-DHfTHscz.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -53
- package/dist/qna/catalog.d.ts +30 -96
- package/dist/qna/catalog.d.ts.map +1 -1
- package/dist/qna/components/TextInput.d.ts.map +1 -1
- package/dist/qna/components/renderUISpec.d.ts.map +1 -1
- package/dist/qna/index.d.ts +2 -0
- package/dist/qna/index.d.ts.map +1 -1
- package/dist/qna.cjs +1 -1
- package/dist/qna.cjs.map +1 -1
- package/dist/qna.iife.js +46 -8
- package/dist/qna.iife.js.map +1 -1
- package/dist/qna.js +94 -86
- package/dist/qna.js.map +1 -1
- package/dist/quantity-stepper-B8kX8GbN.js +209 -0
- package/dist/quantity-stepper-B8kX8GbN.js.map +1 -0
- package/dist/quantity-stepper-UbAp53Ow.cjs +2 -0
- package/dist/quantity-stepper-UbAp53Ow.cjs.map +1 -0
- package/dist/schemas-CPkzbgia.js +4572 -0
- package/dist/schemas-CPkzbgia.js.map +1 -0
- package/dist/schemas-tCxs1sED.cjs +86 -0
- package/dist/schemas-tCxs1sED.cjs.map +1 -0
- package/dist/simrel/api.d.ts.map +1 -1
- package/dist/simrel/catalog.d.ts +32 -240
- package/dist/simrel/catalog.d.ts.map +1 -1
- package/dist/simrel/components/GroupTabs.d.ts.map +1 -1
- package/dist/simrel/components/ProductCard.d.ts +2 -0
- package/dist/simrel/components/ProductCard.d.ts.map +1 -1
- package/dist/simrel/components/renderUISpec.d.ts.map +1 -1
- package/dist/simrel/index.d.ts.map +1 -1
- package/dist/simrel/types.d.ts +5 -0
- package/dist/simrel/types.d.ts.map +1 -1
- package/dist/simrel.cjs +1 -1
- package/dist/simrel.cjs.map +1 -1
- package/dist/simrel.css +1 -1
- package/dist/simrel.iife.js +46 -8
- package/dist/simrel.iife.js.map +1 -1
- package/dist/simrel.js +319 -279
- package/dist/simrel.js.map +1 -1
- package/package.json +28 -8
- package/dist/index-CFA70IGF.js +0 -3626
- package/dist/index-CFA70IGF.js.map +0 -1
- package/dist/index-Dfl89zpe.cjs +0 -13
- package/dist/index-Dfl89zpe.cjs.map +0 -1
- package/dist/types-CeON7iBO.cjs +0 -48
- package/dist/types-CeON7iBO.cjs.map +0 -1
- package/dist/types-yxW8WA7u.js +0 -4132
- package/dist/types-yxW8WA7u.js.map +0 -1
|
@@ -0,0 +1,4572 @@
|
|
|
1
|
+
const jt = ({ element: e, renderElement: t }) => {
|
|
2
|
+
if (!e.children || e.children.length === 0)
|
|
3
|
+
return null;
|
|
4
|
+
const n = document.createElement("div");
|
|
5
|
+
for (const r of e.children) {
|
|
6
|
+
const o = t(r);
|
|
7
|
+
o && n.appendChild(o);
|
|
8
|
+
}
|
|
9
|
+
return n;
|
|
10
|
+
};
|
|
11
|
+
function Da(e) {
|
|
12
|
+
const t = document.createElement("div");
|
|
13
|
+
if (t.className = e.containerClassName, !e.spec.elements[e.spec.root]) return t;
|
|
14
|
+
const r = e.unknownRenderer ?? jt, o = (s) => {
|
|
15
|
+
const a = e.spec.elements[s];
|
|
16
|
+
if (!a) return null;
|
|
17
|
+
const c = e.registry[a.type];
|
|
18
|
+
return c ? c({
|
|
19
|
+
elementId: s,
|
|
20
|
+
element: a,
|
|
21
|
+
spec: e.spec,
|
|
22
|
+
context: e.context,
|
|
23
|
+
renderElement: o
|
|
24
|
+
}) : r({
|
|
25
|
+
elementId: s,
|
|
26
|
+
element: a,
|
|
27
|
+
spec: e.spec,
|
|
28
|
+
context: e.context,
|
|
29
|
+
renderElement: o
|
|
30
|
+
});
|
|
31
|
+
}, i = o(e.spec.root);
|
|
32
|
+
return i && t.appendChild(i), t;
|
|
33
|
+
}
|
|
34
|
+
function ja(e, t) {
|
|
35
|
+
if (!t) return e;
|
|
36
|
+
const n = { ...e };
|
|
37
|
+
for (const [r, o] of Object.entries(t))
|
|
38
|
+
o && (n[r] = o);
|
|
39
|
+
return n;
|
|
40
|
+
}
|
|
41
|
+
function La(e, t) {
|
|
42
|
+
const n = {
|
|
43
|
+
event_name: "stream.start",
|
|
44
|
+
account_id: e.account_id,
|
|
45
|
+
session_id: e.session_id,
|
|
46
|
+
correlation_id: e.correlation_id,
|
|
47
|
+
payload: {
|
|
48
|
+
endpoint: t.endpoint,
|
|
49
|
+
request_id: t.request_id
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
53
|
+
}
|
|
54
|
+
function Ua(e, t) {
|
|
55
|
+
const n = {
|
|
56
|
+
request_id: t.request_id,
|
|
57
|
+
chunk_index: t.chunk_index
|
|
58
|
+
};
|
|
59
|
+
t.latency_ms !== void 0 && (n.latency_ms = t.latency_ms);
|
|
60
|
+
const r = {
|
|
61
|
+
event_name: "stream.chunk",
|
|
62
|
+
account_id: e.account_id,
|
|
63
|
+
session_id: e.session_id,
|
|
64
|
+
correlation_id: e.correlation_id,
|
|
65
|
+
payload: n
|
|
66
|
+
};
|
|
67
|
+
return e.view_id !== void 0 && (r.view_id = e.view_id), e.user_id !== void 0 && (r.user_id = e.user_id), t.widget !== void 0 && (r.widget = t.widget), e.page_type !== void 0 && (r.page_type = e.page_type), e.sku !== void 0 && (r.sku = e.sku), r;
|
|
68
|
+
}
|
|
69
|
+
function Ma(e, t) {
|
|
70
|
+
const n = {
|
|
71
|
+
event_name: "stream.ui_spec",
|
|
72
|
+
account_id: e.account_id,
|
|
73
|
+
session_id: e.session_id,
|
|
74
|
+
correlation_id: e.correlation_id,
|
|
75
|
+
payload: {
|
|
76
|
+
request_id: t.request_id,
|
|
77
|
+
chunk_index: t.chunk_index,
|
|
78
|
+
component_type: t.component_type
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
82
|
+
}
|
|
83
|
+
function Fa(e, t) {
|
|
84
|
+
const n = {
|
|
85
|
+
event_name: "stream.done",
|
|
86
|
+
account_id: e.account_id,
|
|
87
|
+
session_id: e.session_id,
|
|
88
|
+
correlation_id: e.correlation_id,
|
|
89
|
+
payload: {
|
|
90
|
+
request_id: t.request_id,
|
|
91
|
+
latency_ms: t.latency_ms,
|
|
92
|
+
chunk_count: t.chunk_count
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
96
|
+
}
|
|
97
|
+
function Ja(e, t) {
|
|
98
|
+
const n = {
|
|
99
|
+
event_name: "stream.error",
|
|
100
|
+
account_id: e.account_id,
|
|
101
|
+
session_id: e.session_id,
|
|
102
|
+
correlation_id: e.correlation_id,
|
|
103
|
+
payload: {
|
|
104
|
+
request_id: t.request_id,
|
|
105
|
+
error_code: t.error_code,
|
|
106
|
+
error_message: t.error_message
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
110
|
+
}
|
|
111
|
+
function xa(e, t) {
|
|
112
|
+
const n = {
|
|
113
|
+
model: t.model,
|
|
114
|
+
prompt_tokens: t.prompt_tokens,
|
|
115
|
+
completion_tokens: t.completion_tokens,
|
|
116
|
+
total_tokens: t.total_tokens
|
|
117
|
+
};
|
|
118
|
+
t.provider !== void 0 && (n.provider = t.provider);
|
|
119
|
+
const r = {
|
|
120
|
+
event_name: "llm.usage",
|
|
121
|
+
account_id: e.account_id,
|
|
122
|
+
session_id: e.session_id,
|
|
123
|
+
correlation_id: e.correlation_id,
|
|
124
|
+
payload: n
|
|
125
|
+
};
|
|
126
|
+
return e.view_id !== void 0 && (r.view_id = e.view_id), e.user_id !== void 0 && (r.user_id = e.user_id), e.page_type !== void 0 && (r.page_type = e.page_type), e.sku !== void 0 && (r.sku = e.sku), r;
|
|
127
|
+
}
|
|
128
|
+
function qa(e, t) {
|
|
129
|
+
const n = {
|
|
130
|
+
event_name: "metering.increment",
|
|
131
|
+
account_id: e.account_id,
|
|
132
|
+
session_id: e.session_id,
|
|
133
|
+
correlation_id: e.correlation_id,
|
|
134
|
+
payload: {
|
|
135
|
+
meter_key: t.meter_key,
|
|
136
|
+
quantity: t.quantity,
|
|
137
|
+
unit: t.unit
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
141
|
+
}
|
|
142
|
+
function Lt(e, t) {
|
|
143
|
+
const n = {
|
|
144
|
+
event_name: "metering.summary",
|
|
145
|
+
account_id: e.account_id,
|
|
146
|
+
session_id: e.session_id,
|
|
147
|
+
correlation_id: e.correlation_id,
|
|
148
|
+
payload: {
|
|
149
|
+
meter_key: t.meter_key,
|
|
150
|
+
quantity: t.quantity,
|
|
151
|
+
unit: t.unit
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
155
|
+
}
|
|
156
|
+
function Va(e, t) {
|
|
157
|
+
const n = {
|
|
158
|
+
event_name: "chat.history.snapshot",
|
|
159
|
+
account_id: e.account_id,
|
|
160
|
+
session_id: e.session_id,
|
|
161
|
+
correlation_id: e.correlation_id,
|
|
162
|
+
payload: {
|
|
163
|
+
message_count: t.message_count,
|
|
164
|
+
history_ref: t.history_ref,
|
|
165
|
+
redaction_level: t.redaction_level
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
169
|
+
}
|
|
170
|
+
function Ba(e, t) {
|
|
171
|
+
const n = {
|
|
172
|
+
event_name: "widget.history.snapshot",
|
|
173
|
+
account_id: e.account_id,
|
|
174
|
+
session_id: e.session_id,
|
|
175
|
+
correlation_id: e.correlation_id,
|
|
176
|
+
widget: t.widget,
|
|
177
|
+
payload: {
|
|
178
|
+
message_count: t.message_count,
|
|
179
|
+
history_ref: t.history_ref,
|
|
180
|
+
redaction_level: t.redaction_level
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
184
|
+
}
|
|
185
|
+
function Ga(e, t) {
|
|
186
|
+
const n = {
|
|
187
|
+
event_name: "basket.add",
|
|
188
|
+
account_id: e.account_id,
|
|
189
|
+
session_id: e.session_id,
|
|
190
|
+
correlation_id: e.correlation_id,
|
|
191
|
+
widget: t.attribution_source,
|
|
192
|
+
payload: {
|
|
193
|
+
attribution_source: t.attribution_source,
|
|
194
|
+
attribution_action_id: t.attribution_action_id,
|
|
195
|
+
cart_value: t.cart_value,
|
|
196
|
+
currency: t.currency,
|
|
197
|
+
line_items: t.line_items,
|
|
198
|
+
sku: t.sku
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
202
|
+
}
|
|
203
|
+
function Ut(e, t) {
|
|
204
|
+
const n = {
|
|
205
|
+
event_name: "checkout.start",
|
|
206
|
+
account_id: e.account_id,
|
|
207
|
+
session_id: e.session_id,
|
|
208
|
+
correlation_id: e.correlation_id,
|
|
209
|
+
widget: t.attribution_source,
|
|
210
|
+
payload: {
|
|
211
|
+
attribution_source: t.attribution_source,
|
|
212
|
+
attribution_action_id: t.attribution_action_id,
|
|
213
|
+
cart_value: t.cart_value,
|
|
214
|
+
currency: t.currency,
|
|
215
|
+
line_items: t.line_items
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
219
|
+
}
|
|
220
|
+
function Mt(e, t) {
|
|
221
|
+
const n = {
|
|
222
|
+
event_name: "checkout.complete",
|
|
223
|
+
account_id: e.account_id,
|
|
224
|
+
session_id: e.session_id,
|
|
225
|
+
correlation_id: e.correlation_id,
|
|
226
|
+
widget: t.attribution_source,
|
|
227
|
+
payload: {
|
|
228
|
+
attribution_source: t.attribution_source,
|
|
229
|
+
attribution_action_id: t.attribution_action_id,
|
|
230
|
+
cart_value: t.cart_value,
|
|
231
|
+
currency: t.currency,
|
|
232
|
+
line_items: t.line_items
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
|
|
236
|
+
}
|
|
237
|
+
function Wa(e, t) {
|
|
238
|
+
window.dispatchEvent(new CustomEvent(e, { detail: t, bubbles: !1 }));
|
|
239
|
+
}
|
|
240
|
+
function X(e, t) {
|
|
241
|
+
const n = (r) => {
|
|
242
|
+
t(r.detail);
|
|
243
|
+
};
|
|
244
|
+
return window.addEventListener(e, n), () => window.removeEventListener(e, n);
|
|
245
|
+
}
|
|
246
|
+
function Ha(e) {
|
|
247
|
+
let t = !1;
|
|
248
|
+
function n() {
|
|
249
|
+
return window.gengage?.chat !== void 0 ? !0 : (t || (console.warn(
|
|
250
|
+
"[gengage] QNA tried to open chat, but chat widget is not initialized. Ensure GengageChat is initialized before calling wireQNAToChat()."
|
|
251
|
+
), t = !0), e?.onChatUnavailable?.(), !1);
|
|
252
|
+
}
|
|
253
|
+
const r = X("gengage:qna:action", (i) => {
|
|
254
|
+
n() && window.gengage?.chat?.openWithAction(i);
|
|
255
|
+
}), o = X("gengage:qna:open-chat", () => {
|
|
256
|
+
n() && window.gengage?.chat?.open();
|
|
257
|
+
});
|
|
258
|
+
return () => {
|
|
259
|
+
r(), o();
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function Ka() {
|
|
263
|
+
return X("gengage:similar:product-click", ({ sku: e, url: t, sessionId: n }) => {
|
|
264
|
+
n && window.gengage?.chat?.saveSession(n, e), window.location.href = t;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function Ft() {
|
|
268
|
+
const t = window.__gengageSessionId ?? sessionStorage.getItem("gengage_session_id") ?? null ?? crypto.randomUUID();
|
|
269
|
+
return window.__gengageSessionId = t, sessionStorage.setItem("gengage_session_id", t), window.gengage || (window.gengage = {}), window.gengage.sessionId = t, t;
|
|
270
|
+
}
|
|
271
|
+
function Ya() {
|
|
272
|
+
return window.gengage?.pageContext ?? null;
|
|
273
|
+
}
|
|
274
|
+
function Qa(e) {
|
|
275
|
+
window.gengage || (window.gengage = {}), window.gengage.pageContext = {
|
|
276
|
+
pageType: "other",
|
|
277
|
+
...window.gengage.pageContext,
|
|
278
|
+
...e
|
|
279
|
+
}, window.dispatchEvent(new CustomEvent("gengage:context:update", { detail: e }));
|
|
280
|
+
}
|
|
281
|
+
function Jt(e) {
|
|
282
|
+
return {
|
|
283
|
+
sessionId: e?.sessionId ?? Ft(),
|
|
284
|
+
...e
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
const Ee = {
|
|
288
|
+
"--gengage-chat-offset": "20px",
|
|
289
|
+
"--gengage-chat-launcher-size": "56px",
|
|
290
|
+
"--gengage-chat-width": "400px",
|
|
291
|
+
"--gengage-chat-shell-radius": "12px",
|
|
292
|
+
"--gengage-chat-header-height": "60px",
|
|
293
|
+
"--gengage-chat-conversation-width": "396px",
|
|
294
|
+
"--gengage-chat-panel-min-width": "320px",
|
|
295
|
+
"--gengage-chat-panel-max-width": "860px",
|
|
296
|
+
"--gengage-chat-input-height": "48px",
|
|
297
|
+
"--gengage-qna-pill-radius": "999px",
|
|
298
|
+
"--gengage-qna-input-radius": "14px",
|
|
299
|
+
"--gengage-simrel-card-radius": "14px"
|
|
300
|
+
};
|
|
301
|
+
function xt(e) {
|
|
302
|
+
return e ? { ...Ee, ...e } : { ...Ee };
|
|
303
|
+
}
|
|
304
|
+
const N = "gengage-global-toast-root", Ze = "gengage-global-toast-style", _e = "gengage-global-toast-root--visible", qt = 4200, Vt = 1500, Bt = 15e3;
|
|
305
|
+
let Te = !1, M = null;
|
|
306
|
+
function Xa(e) {
|
|
307
|
+
return typeof e == "string" && e.toLowerCase().startsWith("tr") ? "Baglanti sorunu olustu. Lutfen tekrar deneyin." : "Connection issue. Please try again.";
|
|
308
|
+
}
|
|
309
|
+
function Gt() {
|
|
310
|
+
Te || typeof window > "u" || typeof document > "u" || (Te = !0, X("gengage:global:error", (e) => {
|
|
311
|
+
Wt(e);
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
314
|
+
function Wt(e) {
|
|
315
|
+
if (typeof document > "u") return;
|
|
316
|
+
const t = e.message.trim();
|
|
317
|
+
if (!t) return;
|
|
318
|
+
Xt();
|
|
319
|
+
const n = Yt();
|
|
320
|
+
n.innerHTML = "";
|
|
321
|
+
const r = document.createElement("section");
|
|
322
|
+
r.className = "gengage-global-toast gengage-global-toast--error", r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite");
|
|
323
|
+
const o = document.createElement("div");
|
|
324
|
+
o.className = "gengage-global-toast-title", o.textContent = Kt(e.source);
|
|
325
|
+
const i = document.createElement("div");
|
|
326
|
+
i.className = "gengage-global-toast-message", i.textContent = t, r.appendChild(o), r.appendChild(i), n.appendChild(r), n.classList.add(_e), M && (clearTimeout(M), M = null), M = setTimeout(() => {
|
|
327
|
+
Ht();
|
|
328
|
+
}, Qt(e.durationMs));
|
|
329
|
+
}
|
|
330
|
+
function Ht() {
|
|
331
|
+
if (typeof document > "u") return;
|
|
332
|
+
const e = document.getElementById(N);
|
|
333
|
+
e && (e.classList.remove(_e), e.innerHTML = "", M && (clearTimeout(M), M = null));
|
|
334
|
+
}
|
|
335
|
+
function Kt(e) {
|
|
336
|
+
switch (e) {
|
|
337
|
+
case "chat":
|
|
338
|
+
return "Chat warning";
|
|
339
|
+
case "qna":
|
|
340
|
+
return "QnA warning";
|
|
341
|
+
case "simrel":
|
|
342
|
+
return "Widget warning";
|
|
343
|
+
default:
|
|
344
|
+
return "Connection warning";
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function Yt() {
|
|
348
|
+
const e = document.getElementById(N);
|
|
349
|
+
if (e instanceof HTMLElement) return e;
|
|
350
|
+
const t = document.createElement("div");
|
|
351
|
+
return t.id = N, t.className = "gengage-global-toast-root", document.body.appendChild(t), t;
|
|
352
|
+
}
|
|
353
|
+
function Qt(e) {
|
|
354
|
+
return typeof e != "number" || !Number.isFinite(e) ? qt : Math.min(Bt, Math.max(Vt, Math.round(e)));
|
|
355
|
+
}
|
|
356
|
+
function Xt() {
|
|
357
|
+
if (document.getElementById(Ze)) return;
|
|
358
|
+
const e = document.createElement("style");
|
|
359
|
+
e.id = Ze, e.textContent = `
|
|
360
|
+
#${N} {
|
|
361
|
+
position: fixed;
|
|
362
|
+
top: 16px;
|
|
363
|
+
right: 16px;
|
|
364
|
+
z-index: 2147483646;
|
|
365
|
+
pointer-events: none;
|
|
366
|
+
}
|
|
367
|
+
#${N}.${_e} {
|
|
368
|
+
pointer-events: auto;
|
|
369
|
+
}
|
|
370
|
+
#${N} .gengage-global-toast {
|
|
371
|
+
min-width: 260px;
|
|
372
|
+
max-width: min(92vw, 420px);
|
|
373
|
+
border-radius: 12px;
|
|
374
|
+
border: 1px solid #f5c2c7;
|
|
375
|
+
border-left: 4px solid #d93025;
|
|
376
|
+
background: #fff9f9;
|
|
377
|
+
color: #4a1f21;
|
|
378
|
+
box-shadow: 0 10px 30px rgba(38, 18, 18, 0.18);
|
|
379
|
+
padding: 10px 12px;
|
|
380
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
381
|
+
font-size: 13px;
|
|
382
|
+
line-height: 1.4;
|
|
383
|
+
animation: gengage-global-toast-in 180ms ease-out forwards;
|
|
384
|
+
}
|
|
385
|
+
#${N} .gengage-global-toast-title {
|
|
386
|
+
margin: 0 0 4px;
|
|
387
|
+
font-size: 12px;
|
|
388
|
+
font-weight: 700;
|
|
389
|
+
}
|
|
390
|
+
#${N} .gengage-global-toast-message {
|
|
391
|
+
margin: 0;
|
|
392
|
+
font-weight: 500;
|
|
393
|
+
}
|
|
394
|
+
@keyframes gengage-global-toast-in {
|
|
395
|
+
from {
|
|
396
|
+
opacity: 0;
|
|
397
|
+
transform: translateY(-8px);
|
|
398
|
+
}
|
|
399
|
+
to {
|
|
400
|
+
opacity: 1;
|
|
401
|
+
transform: translateY(0);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
`, document.head.appendChild(e);
|
|
405
|
+
}
|
|
406
|
+
class ec {
|
|
407
|
+
constructor() {
|
|
408
|
+
this.isVisible = !1, this.isInitialised = !1, this._handlers = /* @__PURE__ */ new Map(), this._cleanups = [], this._ownsRoot = !1, this._destroying = !1;
|
|
409
|
+
}
|
|
410
|
+
// ---------------------------------------------------------------------------
|
|
411
|
+
// Public API
|
|
412
|
+
// ---------------------------------------------------------------------------
|
|
413
|
+
async init(t) {
|
|
414
|
+
if (this.isInitialised) {
|
|
415
|
+
console.warn("[gengage] Widget already initialised. Call update() instead.");
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const n = xt(t.theme);
|
|
419
|
+
this.config = {
|
|
420
|
+
...t,
|
|
421
|
+
theme: n,
|
|
422
|
+
session: Jt(t.session)
|
|
423
|
+
}, this.root = this._resolveMount(t.mountTarget), this._applyTheme(n), Gt();
|
|
424
|
+
const r = X("gengage:context:update", (o) => this.update(o));
|
|
425
|
+
this._cleanups.push(r);
|
|
426
|
+
try {
|
|
427
|
+
await this.onInit(this.config);
|
|
428
|
+
} catch (o) {
|
|
429
|
+
throw this.destroy(), o;
|
|
430
|
+
}
|
|
431
|
+
this.isInitialised = !0, this.emit("ready");
|
|
432
|
+
}
|
|
433
|
+
update(t) {
|
|
434
|
+
this.isInitialised && (this.config.pageContext ? this.config = {
|
|
435
|
+
...this.config,
|
|
436
|
+
pageContext: { ...this.config.pageContext, ...t }
|
|
437
|
+
} : t.pageType !== void 0 && (this.config = { ...this.config, pageContext: t }), this.onUpdate(t), this.emit("context-update", this.config.pageContext));
|
|
438
|
+
}
|
|
439
|
+
show() {
|
|
440
|
+
this.isVisible || (this.isVisible = !0, this.root.style.display = "", this.onShow(), this.emit("show"));
|
|
441
|
+
}
|
|
442
|
+
hide() {
|
|
443
|
+
this.isVisible && (this.isVisible = !1, this.root.style.display = "none", this.onHide(), this.emit("hide"));
|
|
444
|
+
}
|
|
445
|
+
destroy() {
|
|
446
|
+
this._destroying || (this._destroying = !0, this.emit("destroy"), this._cleanups.forEach((t) => t()), this._cleanups.length = 0, this._handlers.clear(), this.onDestroy(), this.config.analyticsClient?.destroy(), this._ownsRoot ? this.root.remove() : this.root.innerHTML = "", this.isInitialised = !1);
|
|
447
|
+
}
|
|
448
|
+
on(t, n) {
|
|
449
|
+
return this._handlers.has(t) || this._handlers.set(t, /* @__PURE__ */ new Set()), this._handlers.get(t).add(n), () => this._handlers.get(t)?.delete(n);
|
|
450
|
+
}
|
|
451
|
+
/** Track a checkout start event. Called by host page to attribute checkout to widget interaction. */
|
|
452
|
+
trackCheckout(t, n) {
|
|
453
|
+
const r = t === "start" ? Ut : Mt;
|
|
454
|
+
this.track(r(this.analyticsContext(), n));
|
|
455
|
+
}
|
|
456
|
+
/** Track a metering summary event. Called by host page for session-level aggregation. */
|
|
457
|
+
flushMeteringSummary(t) {
|
|
458
|
+
this.track(Lt(this.analyticsContext(), t));
|
|
459
|
+
}
|
|
460
|
+
// ---------------------------------------------------------------------------
|
|
461
|
+
// Protected helpers
|
|
462
|
+
// ---------------------------------------------------------------------------
|
|
463
|
+
/** Emit a widget event to all registered handlers. */
|
|
464
|
+
emit(t, ...n) {
|
|
465
|
+
this._handlers.get(t)?.forEach((r) => r(...n));
|
|
466
|
+
}
|
|
467
|
+
/** Register a cleanup function to run on destroy(). */
|
|
468
|
+
addCleanup(t) {
|
|
469
|
+
this._cleanups.push(t);
|
|
470
|
+
}
|
|
471
|
+
/** Track an analytics event (no-op if analyticsClient is not configured). */
|
|
472
|
+
track(t) {
|
|
473
|
+
this.config.analyticsClient?.track(t);
|
|
474
|
+
}
|
|
475
|
+
/** Build the shared analytics context from widget config. */
|
|
476
|
+
analyticsContext() {
|
|
477
|
+
const t = {
|
|
478
|
+
account_id: this.config.accountId,
|
|
479
|
+
session_id: this.config.session?.sessionId ?? "",
|
|
480
|
+
correlation_id: this.config.session?.sessionId ?? ""
|
|
481
|
+
};
|
|
482
|
+
return this.config.session?.viewId !== void 0 && (t.view_id = this.config.session.viewId), this.config.session?.userId !== void 0 && (t.user_id = this.config.session.userId), this.config.pageContext?.pageType !== void 0 && (t.page_type = this.config.pageContext.pageType), this.config.pageContext?.sku !== void 0 && (t.sku = this.config.pageContext.sku), this.config.session?.abTestVariant !== void 0 && (t.ab_test_variant = this.config.session.abTestVariant), this.config.session?.abTestExperimentId !== void 0 && (t.ab_test_experiment_id = this.config.session.abTestExperimentId), t;
|
|
483
|
+
}
|
|
484
|
+
// ---------------------------------------------------------------------------
|
|
485
|
+
// Private helpers
|
|
486
|
+
// ---------------------------------------------------------------------------
|
|
487
|
+
_resolveMount(t) {
|
|
488
|
+
if (t instanceof HTMLElement) return t;
|
|
489
|
+
if (typeof t == "string") {
|
|
490
|
+
const r = document.querySelector(t);
|
|
491
|
+
if (!r) throw new Error(`[gengage] Mount target not found: "${t}"`);
|
|
492
|
+
return r;
|
|
493
|
+
}
|
|
494
|
+
const n = document.createElement("div");
|
|
495
|
+
return n.dataset.gengageWidget = this.constructor.name.toLowerCase(), document.body.appendChild(n), this._ownsRoot = !0, n;
|
|
496
|
+
}
|
|
497
|
+
_applyTheme(t) {
|
|
498
|
+
if (t) {
|
|
499
|
+
for (const [n, r] of Object.entries(t))
|
|
500
|
+
if (r !== void 0) {
|
|
501
|
+
const o = n.startsWith("--") ? n : `--gengage-${en(n)}`;
|
|
502
|
+
this.root.style.setProperty(o, r);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
function en(e) {
|
|
508
|
+
return e.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
509
|
+
}
|
|
510
|
+
function Ie(e) {
|
|
511
|
+
return typeof e == "object" && e !== null && typeof e.type == "string";
|
|
512
|
+
}
|
|
513
|
+
function tn(e) {
|
|
514
|
+
const t = [];
|
|
515
|
+
let n = 0, r = !1, o = !1, i = 0;
|
|
516
|
+
for (let s = 0; s < e.length; s++) {
|
|
517
|
+
const a = e[s];
|
|
518
|
+
if (o) {
|
|
519
|
+
o = !1;
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
if (a === "\\" && r) {
|
|
523
|
+
o = !0;
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
if (a === '"') {
|
|
527
|
+
r = !r;
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
r || (a === "{" && n++, a === "}" && (n--, n === 0 && (t.push(e.slice(i, s + 1)), i = s + 1)));
|
|
531
|
+
}
|
|
532
|
+
return t.length > 0 ? t : [e];
|
|
533
|
+
}
|
|
534
|
+
function Oe(e, t) {
|
|
535
|
+
const n = e.trim();
|
|
536
|
+
if (!n || n.startsWith(":")) return !1;
|
|
537
|
+
const r = n.startsWith("data: ") ? n.slice(6) : n;
|
|
538
|
+
if (r === "[DONE]") return !0;
|
|
539
|
+
try {
|
|
540
|
+
const o = JSON.parse(r);
|
|
541
|
+
return Ie(o) ? (t.onEvent(o), o.type === "done" ? (t.onDone?.(), !0) : !1) : !1;
|
|
542
|
+
} catch {
|
|
543
|
+
const o = tn(r);
|
|
544
|
+
if (o.length > 1) {
|
|
545
|
+
for (const i of o)
|
|
546
|
+
try {
|
|
547
|
+
const s = JSON.parse(i);
|
|
548
|
+
if (!Ie(s)) continue;
|
|
549
|
+
if (t.onEvent(s), s.type === "done")
|
|
550
|
+
return t.onDone?.(), !0;
|
|
551
|
+
} catch {
|
|
552
|
+
}
|
|
553
|
+
return !1;
|
|
554
|
+
}
|
|
555
|
+
return !1;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
async function nn(e, t) {
|
|
559
|
+
if (!e.ok) {
|
|
560
|
+
t.onError?.(new Error(`HTTP ${e.status}: ${e.statusText}`));
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (!e.body) {
|
|
564
|
+
t.onError?.(new Error("Response body is null — streaming not supported"));
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
const n = e.body.getReader(), r = new TextDecoder("utf-8");
|
|
568
|
+
let o = "";
|
|
569
|
+
const i = t.idleTimeoutMs ?? 6e4, s = /* @__PURE__ */ Symbol("idle-timeout");
|
|
570
|
+
let a = !1;
|
|
571
|
+
try {
|
|
572
|
+
for (; ; ) {
|
|
573
|
+
const c = n.read();
|
|
574
|
+
let u;
|
|
575
|
+
const l = await (i > 0 ? Promise.race([
|
|
576
|
+
c.then((m) => (clearTimeout(u), m)),
|
|
577
|
+
new Promise((m) => {
|
|
578
|
+
u = setTimeout(() => m(s), i);
|
|
579
|
+
})
|
|
580
|
+
]) : c);
|
|
581
|
+
if (l === s) {
|
|
582
|
+
a = !0, await n.cancel();
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
const { done: f, value: g } = l;
|
|
586
|
+
if (f) break;
|
|
587
|
+
o += r.decode(g, { stream: !0 });
|
|
588
|
+
const p = o.split(`
|
|
589
|
+
`);
|
|
590
|
+
o = p.pop() ?? "";
|
|
591
|
+
for (const m of p)
|
|
592
|
+
if (Oe(m, t)) return;
|
|
593
|
+
}
|
|
594
|
+
if (o.trim() && Oe(o, t))
|
|
595
|
+
return;
|
|
596
|
+
} catch (c) {
|
|
597
|
+
if (c instanceof DOMException && c.name === "AbortError") return;
|
|
598
|
+
t.onError?.(c instanceof Error ? c : new Error(String(c)));
|
|
599
|
+
} finally {
|
|
600
|
+
a || n.releaseLock();
|
|
601
|
+
}
|
|
602
|
+
t.onDone?.();
|
|
603
|
+
}
|
|
604
|
+
function tc(e, t, n) {
|
|
605
|
+
const r = new AbortController(), o = n.signal ? rn([n.signal, r.signal]) : r.signal;
|
|
606
|
+
return fetch(e, {
|
|
607
|
+
method: "POST",
|
|
608
|
+
headers: {
|
|
609
|
+
"Content-Type": "application/json",
|
|
610
|
+
...n.headers
|
|
611
|
+
},
|
|
612
|
+
body: JSON.stringify(t),
|
|
613
|
+
signal: o
|
|
614
|
+
}).then((i) => nn(i, { ...n, signal: o })).catch((i) => {
|
|
615
|
+
i instanceof DOMException && i.name === "AbortError" || n.onError?.(i instanceof Error ? i : new Error(String(i)));
|
|
616
|
+
}), r;
|
|
617
|
+
}
|
|
618
|
+
function rn(e) {
|
|
619
|
+
const t = new AbortController(), n = [];
|
|
620
|
+
for (const r of e) {
|
|
621
|
+
if (r.aborted)
|
|
622
|
+
return t.abort(r.reason), t.signal;
|
|
623
|
+
const o = () => t.abort(r.reason);
|
|
624
|
+
r.addEventListener("abort", o, { once: !0 }), n.push(() => r.removeEventListener("abort", o));
|
|
625
|
+
}
|
|
626
|
+
return t.signal.addEventListener(
|
|
627
|
+
"abort",
|
|
628
|
+
() => {
|
|
629
|
+
for (const r of n) r();
|
|
630
|
+
},
|
|
631
|
+
{ once: !0 }
|
|
632
|
+
), t.signal;
|
|
633
|
+
}
|
|
634
|
+
function nc(e) {
|
|
635
|
+
if (typeof e.type != "string") return null;
|
|
636
|
+
if (on(e))
|
|
637
|
+
return e;
|
|
638
|
+
const n = e;
|
|
639
|
+
switch (n.type) {
|
|
640
|
+
case "outputText":
|
|
641
|
+
return sn(n);
|
|
642
|
+
case "suggestedActions":
|
|
643
|
+
return an(n);
|
|
644
|
+
case "productList":
|
|
645
|
+
return cn(n);
|
|
646
|
+
case "productDetails":
|
|
647
|
+
return un(n);
|
|
648
|
+
case "productDetailsSimilars":
|
|
649
|
+
return dn(n);
|
|
650
|
+
case "comparisonTable":
|
|
651
|
+
return ln(n);
|
|
652
|
+
case "context":
|
|
653
|
+
return fn(n);
|
|
654
|
+
case "chatStreamEnd":
|
|
655
|
+
return pn();
|
|
656
|
+
case "loading":
|
|
657
|
+
return gn(n);
|
|
658
|
+
case "panelLoading":
|
|
659
|
+
return hn(n);
|
|
660
|
+
case "similarLoading":
|
|
661
|
+
return mn(n);
|
|
662
|
+
case "redirect":
|
|
663
|
+
return _n(n);
|
|
664
|
+
case "error":
|
|
665
|
+
return yn(n);
|
|
666
|
+
case "dummy":
|
|
667
|
+
return vn();
|
|
668
|
+
case "launcherAction":
|
|
669
|
+
return wn(n);
|
|
670
|
+
case "text":
|
|
671
|
+
return ye(n);
|
|
672
|
+
case "productItem":
|
|
673
|
+
return bn(n);
|
|
674
|
+
case "text_image":
|
|
675
|
+
return tt(n);
|
|
676
|
+
case "quick_qna":
|
|
677
|
+
return nt(n);
|
|
678
|
+
case "reviewHighlights":
|
|
679
|
+
return kn(n);
|
|
680
|
+
case "aiProductSuggestions":
|
|
681
|
+
return Sn(n);
|
|
682
|
+
case "aiProductGroupings":
|
|
683
|
+
return En(n);
|
|
684
|
+
case "aiSuggestedSearches":
|
|
685
|
+
return Zn(n);
|
|
686
|
+
case "prosAndCons":
|
|
687
|
+
return zn(n);
|
|
688
|
+
case "getGroundingReview":
|
|
689
|
+
return Tn(n);
|
|
690
|
+
case "voice":
|
|
691
|
+
return On(n);
|
|
692
|
+
case "visitorDataResponse":
|
|
693
|
+
return $n(n);
|
|
694
|
+
case "productListPreview":
|
|
695
|
+
return In();
|
|
696
|
+
case "groupList":
|
|
697
|
+
return Pn(n);
|
|
698
|
+
case "formGetInfo":
|
|
699
|
+
case "formTestDrive":
|
|
700
|
+
case "formServiceRequest":
|
|
701
|
+
case "launchFormPage":
|
|
702
|
+
return An(n);
|
|
703
|
+
case "launcherContent":
|
|
704
|
+
return Cn(n);
|
|
705
|
+
case "handoff":
|
|
706
|
+
return Nn(n);
|
|
707
|
+
default:
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
function on(e) {
|
|
712
|
+
const t = e.type;
|
|
713
|
+
if (typeof t != "string") return !1;
|
|
714
|
+
switch (t) {
|
|
715
|
+
case "metadata":
|
|
716
|
+
return typeof e.sessionId == "string" && typeof e.model == "string";
|
|
717
|
+
case "text_chunk":
|
|
718
|
+
return typeof e.content == "string";
|
|
719
|
+
case "ui_spec": {
|
|
720
|
+
const n = e.widget;
|
|
721
|
+
if (n !== "chat" && n !== "qna" && n !== "simrel") return !1;
|
|
722
|
+
const r = F(e.spec);
|
|
723
|
+
return r ? typeof r.root == "string" && F(r.elements) !== null : !1;
|
|
724
|
+
}
|
|
725
|
+
case "action": {
|
|
726
|
+
const n = F(e.action);
|
|
727
|
+
return n !== null && typeof n.kind == "string";
|
|
728
|
+
}
|
|
729
|
+
case "error":
|
|
730
|
+
return typeof e.code == "string" && typeof e.message == "string";
|
|
731
|
+
case "done":
|
|
732
|
+
return !0;
|
|
733
|
+
default:
|
|
734
|
+
return !1;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
function sn(e) {
|
|
738
|
+
const t = y(e.payload.text, e.payload.plain_text) ?? "", n = y(e.payload.plain_text, e.payload.text) ?? t;
|
|
739
|
+
if (e.payload.is_error)
|
|
740
|
+
return {
|
|
741
|
+
type: "error",
|
|
742
|
+
code: "BACKEND_ERROR",
|
|
743
|
+
message: n || "Backend returned an error"
|
|
744
|
+
};
|
|
745
|
+
const r = {
|
|
746
|
+
type: "text_chunk",
|
|
747
|
+
content: t,
|
|
748
|
+
final: !0
|
|
749
|
+
}, o = e.payload.product_mentions;
|
|
750
|
+
Array.isArray(o) && o.length > 0 && (r.productMentions = o.filter(
|
|
751
|
+
(a) => typeof a == "object" && a !== null && typeof a.sku == "string" && typeof a.short_name == "string"
|
|
752
|
+
));
|
|
753
|
+
const i = e.payload.sku_to_product_item;
|
|
754
|
+
i && typeof i == "object" && !Array.isArray(i) && (r.skuToProductItem = i);
|
|
755
|
+
const s = e.payload.conversation_mode;
|
|
756
|
+
return typeof s == "string" && s && (r.conversationMode = s), r;
|
|
757
|
+
}
|
|
758
|
+
function an(e) {
|
|
759
|
+
const t = (e.payload.actions ?? []).map((n) => {
|
|
760
|
+
const r = y(n.title) ?? "", o = D(n.requestDetails, r), i = o ? {
|
|
761
|
+
label: r,
|
|
762
|
+
action: o
|
|
763
|
+
} : null;
|
|
764
|
+
return i ? (typeof n.icon == "string" && (i.icon = n.icon), typeof n.image == "string" && (i.image = n.image), i) : null;
|
|
765
|
+
});
|
|
766
|
+
return rt(t.filter(it), "chat");
|
|
767
|
+
}
|
|
768
|
+
function cn(e) {
|
|
769
|
+
const t = ot(e.payload.product_list ?? [], "chat");
|
|
770
|
+
t.panelHint = "panel";
|
|
771
|
+
const n = t.spec.elements[t.spec.root];
|
|
772
|
+
return n && (typeof e.payload.offset == "number" && (n.props = { ...n.props, offset: e.payload.offset }), typeof e.payload.end_of_list == "boolean" && (n.props = { ...n.props, endOfList: e.payload.end_of_list })), t;
|
|
773
|
+
}
|
|
774
|
+
function un(e) {
|
|
775
|
+
const t = e.payload.productDetails;
|
|
776
|
+
return t ? {
|
|
777
|
+
type: "ui_spec",
|
|
778
|
+
widget: "chat",
|
|
779
|
+
spec: {
|
|
780
|
+
root: "root",
|
|
781
|
+
elements: {
|
|
782
|
+
root: {
|
|
783
|
+
type: "ProductDetailsPanel",
|
|
784
|
+
props: { product: j(t) }
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
panelHint: "panel"
|
|
789
|
+
} : Dn("chat");
|
|
790
|
+
}
|
|
791
|
+
function dn(e) {
|
|
792
|
+
const t = ot(e.payload.similarProducts ?? [], "chat"), n = t.spec.elements[t.spec.root];
|
|
793
|
+
return n && (n.props = { ...n.props, similarsAppend: !0 }), { ...t, panelHint: "panel" };
|
|
794
|
+
}
|
|
795
|
+
function ln(e) {
|
|
796
|
+
const t = e.payload.multiple_product_details ?? [], n = e.payload.product_comparison_framework, r = e.payload.table, o = [];
|
|
797
|
+
for (const m of t) {
|
|
798
|
+
const v = j(m);
|
|
799
|
+
o.push(v);
|
|
800
|
+
}
|
|
801
|
+
const i = [];
|
|
802
|
+
if (r) {
|
|
803
|
+
const m = n?.criteria_view ?? n?.criteria_view_short ?? {}, v = n?.compared_field_names ?? Object.keys(r);
|
|
804
|
+
for (const A of v) {
|
|
805
|
+
const H = r[A];
|
|
806
|
+
if (!H || !Array.isArray(H)) continue;
|
|
807
|
+
const le = m[A] ?? A;
|
|
808
|
+
i.push({ label: le, values: H.map((Z) => typeof Z == "string" ? Z : String(Z ?? "")) });
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
let s;
|
|
812
|
+
n?.recommended_choice_sku ? s = n.recommended_choice_sku : n?.winner_product && n.winner_product.length > 0 && (s = n.winner_product[0]?.product_detail?.sku ?? n.winner_product[0]?.sku);
|
|
813
|
+
const a = s ? o.find((m) => m.sku === s) ?? o[0] : o[0], c = [];
|
|
814
|
+
if (Array.isArray(n?.key_differences))
|
|
815
|
+
for (const m of n.key_differences)
|
|
816
|
+
typeof m == "string" && c.push(m);
|
|
817
|
+
const u = [];
|
|
818
|
+
if (n?.special_considerations)
|
|
819
|
+
for (const m of n.special_considerations)
|
|
820
|
+
typeof m == "string" && u.push(m);
|
|
821
|
+
const l = n?.recommended_choice, f = n?.winner_hits, g = {};
|
|
822
|
+
for (const m of o) {
|
|
823
|
+
const v = m.sku;
|
|
824
|
+
v && (g[v] = {
|
|
825
|
+
title: m.name ?? v,
|
|
826
|
+
type: "launchSingleProduct",
|
|
827
|
+
payload: { sku: v }
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
const p = {
|
|
831
|
+
products: o,
|
|
832
|
+
attributes: i,
|
|
833
|
+
highlights: c,
|
|
834
|
+
productActions: g
|
|
835
|
+
};
|
|
836
|
+
return a && (p.recommended = a), u.length > 0 && (p.specialCases = u), l && (p.recommendedText = l), f && (p.winnerHits = f), typeof n?.key_differences == "string" && (p.keyDifferencesHtml = n.key_differences), n?.special_considerations && (p.specialConsiderations = n.special_considerations), {
|
|
837
|
+
type: "ui_spec",
|
|
838
|
+
widget: "chat",
|
|
839
|
+
spec: {
|
|
840
|
+
root: "root",
|
|
841
|
+
elements: {
|
|
842
|
+
root: {
|
|
843
|
+
type: "ComparisonTable",
|
|
844
|
+
props: p
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
panelHint: "panel"
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
function fn(e) {
|
|
852
|
+
return {
|
|
853
|
+
type: "metadata",
|
|
854
|
+
sessionId: "",
|
|
855
|
+
model: "",
|
|
856
|
+
meta: {
|
|
857
|
+
panel: e.payload.panel,
|
|
858
|
+
messages: e.payload.messages,
|
|
859
|
+
message_id: e.payload.message_id
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
}
|
|
863
|
+
function pn() {
|
|
864
|
+
return { type: "done" };
|
|
865
|
+
}
|
|
866
|
+
function gn(e) {
|
|
867
|
+
return {
|
|
868
|
+
type: "metadata",
|
|
869
|
+
sessionId: "",
|
|
870
|
+
model: "",
|
|
871
|
+
meta: {
|
|
872
|
+
loading: !0,
|
|
873
|
+
loadingText: e.payload.text,
|
|
874
|
+
thinkingMessages: e.payload.thinking_messages,
|
|
875
|
+
dynamicLoading: e.payload.is_dynamic === !0
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
function hn(e) {
|
|
880
|
+
return {
|
|
881
|
+
type: "metadata",
|
|
882
|
+
sessionId: "",
|
|
883
|
+
model: "",
|
|
884
|
+
meta: {
|
|
885
|
+
loading: !0,
|
|
886
|
+
panelLoading: !0,
|
|
887
|
+
panelPendingType: e.payload?.pending_type,
|
|
888
|
+
loadingText: e.payload?.text
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
function mn(e) {
|
|
893
|
+
return {
|
|
894
|
+
type: "metadata",
|
|
895
|
+
sessionId: "",
|
|
896
|
+
model: "",
|
|
897
|
+
meta: {
|
|
898
|
+
loading: !0,
|
|
899
|
+
similarPanelLoading: !0,
|
|
900
|
+
panelPendingType: e.payload?.pending_type,
|
|
901
|
+
loadingText: e.payload?.text
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
function _n(e) {
|
|
906
|
+
const t = y(e.payload.url);
|
|
907
|
+
return t ? {
|
|
908
|
+
type: "action",
|
|
909
|
+
action: {
|
|
910
|
+
kind: "navigate",
|
|
911
|
+
url: t,
|
|
912
|
+
newTab: e.payload.new_tab === !0
|
|
913
|
+
}
|
|
914
|
+
} : {
|
|
915
|
+
type: "metadata",
|
|
916
|
+
sessionId: "",
|
|
917
|
+
model: "",
|
|
918
|
+
meta: {
|
|
919
|
+
redirect: e.payload,
|
|
920
|
+
redirectTarget: y(e.payload.to)
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
function yn(e) {
|
|
925
|
+
return {
|
|
926
|
+
type: "error",
|
|
927
|
+
code: "BACKEND_ERROR",
|
|
928
|
+
message: y(e.payload?.text, e.payload?.message, e.payload?.error) ?? "Backend returned an error"
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
function vn(e) {
|
|
932
|
+
return {
|
|
933
|
+
type: "metadata",
|
|
934
|
+
sessionId: "",
|
|
935
|
+
model: "",
|
|
936
|
+
meta: {
|
|
937
|
+
noop: !0
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
function wn(e) {
|
|
942
|
+
const t = e.payload ?? {};
|
|
943
|
+
if (Array.isArray(t.action_list)) {
|
|
944
|
+
const i = {
|
|
945
|
+
action_list: t.action_list
|
|
946
|
+
}, s = typeof t.type == "string" ? t.type : void 0, a = typeof t.theme == "string" ? t.theme : void 0;
|
|
947
|
+
return s !== void 0 && (i.type = s), a !== void 0 && (i.theme = a), nt({
|
|
948
|
+
payload: i
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
const r = F(t.action);
|
|
952
|
+
if (r) {
|
|
953
|
+
const i = {
|
|
954
|
+
action: r
|
|
955
|
+
}, s = typeof t.text == "string" ? t.text : void 0, a = typeof t.image_url == "string" ? t.image_url : void 0, c = typeof t.theme == "string" ? t.theme : void 0;
|
|
956
|
+
return s !== void 0 && (i.text = s), a !== void 0 && (i.image_url = a), c !== void 0 && (i.theme = c), tt({
|
|
957
|
+
payload: i
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
const o = typeof t.text == "string" ? t.text : "";
|
|
961
|
+
if (o) {
|
|
962
|
+
const i = { text: o }, s = typeof t.type == "string" ? t.type : void 0, a = typeof t.theme == "string" ? t.theme : void 0, c = F(t.payload) ?? void 0;
|
|
963
|
+
return s !== void 0 && (i.type = s), c !== void 0 && (i.payload = c), a !== void 0 && (i.theme = a), ye({
|
|
964
|
+
payload: i
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
return {
|
|
968
|
+
type: "metadata",
|
|
969
|
+
sessionId: "",
|
|
970
|
+
model: "",
|
|
971
|
+
meta: {
|
|
972
|
+
launcherAction: t
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
function ye(e) {
|
|
977
|
+
const t = {
|
|
978
|
+
text: y(e.payload.text) ?? ""
|
|
979
|
+
};
|
|
980
|
+
return typeof e.payload.theme == "string" && (t.theme = e.payload.theme), e.payload.payload !== void 0 && (t.payload = e.payload.payload), {
|
|
981
|
+
type: "ui_spec",
|
|
982
|
+
widget: "qna",
|
|
983
|
+
spec: {
|
|
984
|
+
root: "root",
|
|
985
|
+
elements: {
|
|
986
|
+
root: {
|
|
987
|
+
type: "QuestionHeading",
|
|
988
|
+
props: t
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
function bn(e) {
|
|
995
|
+
return Rn(e.payload, "qna");
|
|
996
|
+
}
|
|
997
|
+
function tt(e) {
|
|
998
|
+
const t = y(e.payload.text) ?? "", n = D(e.payload.action, t);
|
|
999
|
+
if (n) {
|
|
1000
|
+
const o = {
|
|
1001
|
+
label: t || n.title,
|
|
1002
|
+
action: n
|
|
1003
|
+
};
|
|
1004
|
+
return typeof e.payload.image_url == "string" && (o.image = e.payload.image_url), typeof e.payload.theme == "string" && (o.theme = e.payload.theme), {
|
|
1005
|
+
type: "ui_spec",
|
|
1006
|
+
widget: "qna",
|
|
1007
|
+
spec: {
|
|
1008
|
+
root: "root",
|
|
1009
|
+
elements: {
|
|
1010
|
+
root: {
|
|
1011
|
+
type: "ActionButton",
|
|
1012
|
+
props: o
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
const r = {
|
|
1019
|
+
text: t
|
|
1020
|
+
};
|
|
1021
|
+
return typeof e.payload.theme == "string" && (r.theme = e.payload.theme), ye({
|
|
1022
|
+
payload: r
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
function nt(e) {
|
|
1026
|
+
const t = (e.payload.action_list ?? []).map((n) => {
|
|
1027
|
+
const r = y(n.title) ?? "", o = D(n.requestDetails, r), i = o ? {
|
|
1028
|
+
label: r,
|
|
1029
|
+
action: o
|
|
1030
|
+
} : null;
|
|
1031
|
+
return i ? (typeof n.icon == "string" && (i.icon = n.icon), typeof n.image == "string" && (i.image = n.image), i) : null;
|
|
1032
|
+
});
|
|
1033
|
+
return rt(t.filter(it), "qna");
|
|
1034
|
+
}
|
|
1035
|
+
function kn(e) {
|
|
1036
|
+
const n = { reviews: (e.payload.reviews ?? []).map((r) => {
|
|
1037
|
+
const o = {};
|
|
1038
|
+
return typeof r.review_class == "string" && (o.review_class = r.review_class), typeof r.review_text == "string" && (o.review_text = r.review_text), (typeof r.review_rating == "string" || typeof r.review_rating == "number") && (o.review_rating = r.review_rating), typeof r.review_tag == "string" && (o.review_tag = r.review_tag), o;
|
|
1039
|
+
}) };
|
|
1040
|
+
return typeof e.payload.sku == "string" && (n.sku = e.payload.sku), {
|
|
1041
|
+
type: "ui_spec",
|
|
1042
|
+
widget: "chat",
|
|
1043
|
+
spec: {
|
|
1044
|
+
root: "root",
|
|
1045
|
+
elements: {
|
|
1046
|
+
root: {
|
|
1047
|
+
type: "ReviewHighlights",
|
|
1048
|
+
props: n
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
function zn(e) {
|
|
1055
|
+
const t = {};
|
|
1056
|
+
return Array.isArray(e.payload.pros) && (t.pros = e.payload.pros), Array.isArray(e.payload.cons) && (t.cons = e.payload.cons), typeof e.payload.product_name == "string" && (t.productName = e.payload.product_name), {
|
|
1057
|
+
type: "ui_spec",
|
|
1058
|
+
widget: "chat",
|
|
1059
|
+
spec: {
|
|
1060
|
+
root: "root",
|
|
1061
|
+
elements: {
|
|
1062
|
+
root: {
|
|
1063
|
+
type: "ProsAndCons",
|
|
1064
|
+
props: t
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
function $n(e) {
|
|
1071
|
+
return {
|
|
1072
|
+
type: "metadata",
|
|
1073
|
+
sessionId: "",
|
|
1074
|
+
model: "",
|
|
1075
|
+
meta: {
|
|
1076
|
+
visitorDataResponse: e.payload
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
function Sn(e) {
|
|
1081
|
+
const t = e.payload.product_suggestions ?? [], n = [];
|
|
1082
|
+
for (let r = 0; r < t.length; r++) {
|
|
1083
|
+
const o = t[r];
|
|
1084
|
+
if (!o) continue;
|
|
1085
|
+
const i = jn(o);
|
|
1086
|
+
if (!i) continue;
|
|
1087
|
+
const s = { product: i }, a = D(o.requestDetails, i.name);
|
|
1088
|
+
a && (s.action = a), typeof o.role == "string" && (s.role = o.role), typeof o.reason == "string" && (s.reason = o.reason), typeof o.review_highlight == "string" && (s.reviewHighlight = o.review_highlight), Array.isArray(o.labels) && (s.labels = o.labels), typeof o.expert_quality_score == "number" && (s.expertQualityScore = o.expert_quality_score), n.push(s);
|
|
1089
|
+
}
|
|
1090
|
+
return n.length === 0 ? {
|
|
1091
|
+
type: "metadata",
|
|
1092
|
+
sessionId: "",
|
|
1093
|
+
model: "",
|
|
1094
|
+
meta: {
|
|
1095
|
+
aiProductSuggestions: e.payload.product_suggestions ?? []
|
|
1096
|
+
}
|
|
1097
|
+
} : {
|
|
1098
|
+
type: "ui_spec",
|
|
1099
|
+
widget: "chat",
|
|
1100
|
+
spec: {
|
|
1101
|
+
root: "root",
|
|
1102
|
+
elements: {
|
|
1103
|
+
root: {
|
|
1104
|
+
type: "AITopPicks",
|
|
1105
|
+
props: { suggestions: n }
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
function En(e) {
|
|
1112
|
+
const t = e.payload.product_groupings ?? [], n = [];
|
|
1113
|
+
for (let r = 0; r < t.length; r++) {
|
|
1114
|
+
const o = t[r];
|
|
1115
|
+
if (!o) continue;
|
|
1116
|
+
const i = y(o.name) ?? "", s = o.sku && o.sku.length > 0 ? { type: "findSimilar", payload: { sku: o.sku } } : void 0, a = D(o.requestDetails ?? s, i);
|
|
1117
|
+
if (!a) continue;
|
|
1118
|
+
const c = { name: i, action: a };
|
|
1119
|
+
if (Array.isArray(o.labels)) {
|
|
1120
|
+
const u = o.labels.filter((l) => typeof l == "string");
|
|
1121
|
+
u.length > 0 && (c.labels = u);
|
|
1122
|
+
}
|
|
1123
|
+
typeof o.image == "string" && (c.image = o.image), n.push(c);
|
|
1124
|
+
}
|
|
1125
|
+
return n.length === 0 ? {
|
|
1126
|
+
type: "metadata",
|
|
1127
|
+
sessionId: "",
|
|
1128
|
+
model: "",
|
|
1129
|
+
meta: {
|
|
1130
|
+
aiProductGroupings: e.payload.product_groupings ?? []
|
|
1131
|
+
}
|
|
1132
|
+
} : {
|
|
1133
|
+
type: "ui_spec",
|
|
1134
|
+
widget: "chat",
|
|
1135
|
+
spec: {
|
|
1136
|
+
root: "root",
|
|
1137
|
+
elements: {
|
|
1138
|
+
root: {
|
|
1139
|
+
type: "AIGroupingCards",
|
|
1140
|
+
props: { entries: n }
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
function Zn(e) {
|
|
1147
|
+
const t = e.payload.suggested_searches ?? [], n = [];
|
|
1148
|
+
for (let r = 0; r < t.length; r++) {
|
|
1149
|
+
const o = t[r];
|
|
1150
|
+
if (!o) continue;
|
|
1151
|
+
const i = y(o.short_name, o.chosen_attribute, o.detailed_user_message) ?? `Arama ${r + 1}`, s = {}, a = y(o.detailed_user_message);
|
|
1152
|
+
a && (s.text = a), o.group_skus && Array.isArray(o.group_skus) && (s.group_skus = o.group_skus);
|
|
1153
|
+
const c = y(o.sku, o.representative_product_sku);
|
|
1154
|
+
c && (s.sku = c), s.is_suggested_text = 1;
|
|
1155
|
+
const u = { type: "inputText", payload: s }, l = D(o.requestDetails ?? u, i);
|
|
1156
|
+
if (!l) continue;
|
|
1157
|
+
const f = { shortName: i, action: l }, g = y(o.detailed_user_message);
|
|
1158
|
+
g && g !== i && (f.detailedMessage = g);
|
|
1159
|
+
const p = y(o.why_different);
|
|
1160
|
+
p && (f.whyDifferent = p), typeof o.image == "string" && (f.image = o.image), n.push(f);
|
|
1161
|
+
}
|
|
1162
|
+
return n.length === 0 ? {
|
|
1163
|
+
type: "metadata",
|
|
1164
|
+
sessionId: "",
|
|
1165
|
+
model: "",
|
|
1166
|
+
meta: {
|
|
1167
|
+
aiSuggestedSearches: e.payload.suggested_searches ?? []
|
|
1168
|
+
}
|
|
1169
|
+
} : {
|
|
1170
|
+
type: "ui_spec",
|
|
1171
|
+
widget: "chat",
|
|
1172
|
+
spec: {
|
|
1173
|
+
root: "root",
|
|
1174
|
+
elements: {
|
|
1175
|
+
root: {
|
|
1176
|
+
type: "AISuggestedSearchCards",
|
|
1177
|
+
props: { entries: n }
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
function Tn(e) {
|
|
1184
|
+
const t = D(
|
|
1185
|
+
e.payload.requestDetails,
|
|
1186
|
+
y(e.payload.review_count, e.payload.text, e.payload.title) ?? "Urun yorumlarini goster"
|
|
1187
|
+
);
|
|
1188
|
+
if (!t)
|
|
1189
|
+
return {
|
|
1190
|
+
type: "metadata",
|
|
1191
|
+
sessionId: "",
|
|
1192
|
+
model: "",
|
|
1193
|
+
meta: {
|
|
1194
|
+
groundingReview: e.payload
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
const n = { action: t };
|
|
1198
|
+
return e.payload.title && (n.title = e.payload.title), e.payload.text && (n.text = e.payload.text), e.payload.review_count && (n.reviewCount = e.payload.review_count), {
|
|
1199
|
+
type: "ui_spec",
|
|
1200
|
+
widget: "chat",
|
|
1201
|
+
spec: {
|
|
1202
|
+
root: "root",
|
|
1203
|
+
elements: {
|
|
1204
|
+
root: {
|
|
1205
|
+
type: "GroundingReviewCard",
|
|
1206
|
+
props: n
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
function In() {
|
|
1213
|
+
return {
|
|
1214
|
+
type: "metadata",
|
|
1215
|
+
sessionId: "",
|
|
1216
|
+
model: "",
|
|
1217
|
+
meta: {
|
|
1218
|
+
analyzeAnimation: !0
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
function On(e) {
|
|
1223
|
+
return {
|
|
1224
|
+
type: "metadata",
|
|
1225
|
+
sessionId: "",
|
|
1226
|
+
model: "",
|
|
1227
|
+
meta: {
|
|
1228
|
+
voice: e.payload
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
function Pn(e) {
|
|
1233
|
+
const t = e.payload.group_list ?? [], n = [];
|
|
1234
|
+
for (const o of t) {
|
|
1235
|
+
const i = o.group_name ?? "", s = (o.product_list ?? []).map(j);
|
|
1236
|
+
n.push({ groupName: i, products: s });
|
|
1237
|
+
}
|
|
1238
|
+
const r = [];
|
|
1239
|
+
for (const o of e.payload.filter_tags ?? []) {
|
|
1240
|
+
const i = o.title ?? "";
|
|
1241
|
+
if (!i) continue;
|
|
1242
|
+
const s = D(o.requestDetails, i), a = { title: i };
|
|
1243
|
+
s && (a.action = s), r.push(a);
|
|
1244
|
+
}
|
|
1245
|
+
return {
|
|
1246
|
+
type: "ui_spec",
|
|
1247
|
+
widget: "chat",
|
|
1248
|
+
spec: {
|
|
1249
|
+
root: "root",
|
|
1250
|
+
elements: {
|
|
1251
|
+
root: {
|
|
1252
|
+
type: "CategoriesContainer",
|
|
1253
|
+
props: { groups: n, filterTags: r }
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
},
|
|
1257
|
+
panelHint: "panel"
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
function An(e) {
|
|
1261
|
+
return {
|
|
1262
|
+
type: "metadata",
|
|
1263
|
+
sessionId: "",
|
|
1264
|
+
model: "",
|
|
1265
|
+
meta: {
|
|
1266
|
+
formType: e.type,
|
|
1267
|
+
formPayload: e.payload ?? {}
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
function Nn(e) {
|
|
1272
|
+
const t = {};
|
|
1273
|
+
return typeof e.payload?.summary == "string" && (t.summary = e.payload.summary), Array.isArray(e.payload?.products_discussed) && (t.products_discussed = e.payload.products_discussed), typeof e.payload?.user_sentiment == "string" && (t.user_sentiment = e.payload.user_sentiment), {
|
|
1274
|
+
type: "ui_spec",
|
|
1275
|
+
widget: "chat",
|
|
1276
|
+
spec: {
|
|
1277
|
+
root: "root",
|
|
1278
|
+
elements: {
|
|
1279
|
+
root: {
|
|
1280
|
+
type: "HandoffNotice",
|
|
1281
|
+
props: t
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
function Cn(e) {
|
|
1288
|
+
return {
|
|
1289
|
+
type: "metadata",
|
|
1290
|
+
sessionId: "",
|
|
1291
|
+
model: "",
|
|
1292
|
+
meta: {
|
|
1293
|
+
launcherContent: e.payload ?? {}
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
function rt(e, t) {
|
|
1298
|
+
const n = {}, r = [];
|
|
1299
|
+
for (let o = 0; o < e.length; o++) {
|
|
1300
|
+
const i = e[o];
|
|
1301
|
+
if (!i) continue;
|
|
1302
|
+
const s = `action-${o}`;
|
|
1303
|
+
r.push(s);
|
|
1304
|
+
const a = {
|
|
1305
|
+
label: i.label,
|
|
1306
|
+
action: i.action
|
|
1307
|
+
};
|
|
1308
|
+
i.icon !== void 0 && (a.icon = i.icon), i.image !== void 0 && (a.image = i.image), i.description !== void 0 && (a.description = i.description), n[s] = {
|
|
1309
|
+
type: "ActionButton",
|
|
1310
|
+
props: a
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
return n.root = {
|
|
1314
|
+
type: "ActionButtons",
|
|
1315
|
+
props: {
|
|
1316
|
+
buttons: e.map((o) => {
|
|
1317
|
+
const i = {
|
|
1318
|
+
label: o.label,
|
|
1319
|
+
action: o.action
|
|
1320
|
+
};
|
|
1321
|
+
return o.image !== void 0 && (i.image = o.image), o.description !== void 0 && (i.description = o.description), o.icon !== void 0 && (i.icon = o.icon), i;
|
|
1322
|
+
})
|
|
1323
|
+
},
|
|
1324
|
+
children: r
|
|
1325
|
+
}, {
|
|
1326
|
+
type: "ui_spec",
|
|
1327
|
+
widget: t,
|
|
1328
|
+
spec: { root: "root", elements: n }
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
function ot(e, t) {
|
|
1332
|
+
const n = {}, r = [];
|
|
1333
|
+
for (let o = 0; o < e.length; o++) {
|
|
1334
|
+
const i = e[o];
|
|
1335
|
+
if (!i) continue;
|
|
1336
|
+
const s = `product-${o}`;
|
|
1337
|
+
r.push(s), n[s] = {
|
|
1338
|
+
type: "ProductCard",
|
|
1339
|
+
props: { product: j(i), index: o }
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
return n.root = {
|
|
1343
|
+
type: "ProductGrid",
|
|
1344
|
+
props: { layout: "grid" },
|
|
1345
|
+
children: r
|
|
1346
|
+
}, {
|
|
1347
|
+
type: "ui_spec",
|
|
1348
|
+
widget: t,
|
|
1349
|
+
spec: { root: "root", elements: n }
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
function Rn(e, t) {
|
|
1353
|
+
return {
|
|
1354
|
+
type: "ui_spec",
|
|
1355
|
+
widget: t,
|
|
1356
|
+
spec: {
|
|
1357
|
+
root: "root",
|
|
1358
|
+
elements: {
|
|
1359
|
+
root: {
|
|
1360
|
+
type: "ProductCard",
|
|
1361
|
+
props: { product: j(e), index: 0 }
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
function Dn(e) {
|
|
1368
|
+
return {
|
|
1369
|
+
type: "ui_spec",
|
|
1370
|
+
widget: e,
|
|
1371
|
+
spec: {
|
|
1372
|
+
root: "root",
|
|
1373
|
+
elements: {
|
|
1374
|
+
root: {
|
|
1375
|
+
type: "ActionButtons",
|
|
1376
|
+
props: { buttons: [] },
|
|
1377
|
+
children: []
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
function jn(e) {
|
|
1384
|
+
const t = y(e.sku), n = y(e.short_name), r = F(e.product_item) ?? e;
|
|
1385
|
+
return Ln(r, t, n);
|
|
1386
|
+
}
|
|
1387
|
+
function Ln(e, t, n) {
|
|
1388
|
+
const r = y(e.sku, t), o = y(e.name, n);
|
|
1389
|
+
if (!r || !o) return null;
|
|
1390
|
+
const i = {
|
|
1391
|
+
sku: r,
|
|
1392
|
+
name: o
|
|
1393
|
+
}, s = y(e.brand);
|
|
1394
|
+
s && (i.brand = s);
|
|
1395
|
+
const a = y(e.url);
|
|
1396
|
+
a && (i.url = a);
|
|
1397
|
+
const c = Un(e.images);
|
|
1398
|
+
if (c.length > 0)
|
|
1399
|
+
i.images = c;
|
|
1400
|
+
else {
|
|
1401
|
+
const m = y(e.image, e.image_url, e.imageUrl);
|
|
1402
|
+
m && (i.images = [m]);
|
|
1403
|
+
}
|
|
1404
|
+
const u = K(e.price_discounted);
|
|
1405
|
+
u !== void 0 && (i.price_discounted = u);
|
|
1406
|
+
const l = K(e.price);
|
|
1407
|
+
l !== void 0 && (i.price = l);
|
|
1408
|
+
const f = K(e.rating);
|
|
1409
|
+
f !== void 0 && (i.rating = f);
|
|
1410
|
+
const g = K(e.review_count) ?? K(e.reviewCount);
|
|
1411
|
+
g !== void 0 && (i.review_count = g);
|
|
1412
|
+
const p = y(e.cart_code, e.cartCode);
|
|
1413
|
+
return p && (i.cart_code = p), typeof e.in_stock == "boolean" && (i.in_stock = e.in_stock), typeof e.inStock == "boolean" && (i.in_stock = e.inStock), j(i);
|
|
1414
|
+
}
|
|
1415
|
+
function D(e, t) {
|
|
1416
|
+
const n = F(e);
|
|
1417
|
+
if (!n) return null;
|
|
1418
|
+
const r = n.type;
|
|
1419
|
+
if (typeof r != "string" || r.length === 0) return null;
|
|
1420
|
+
const o = {
|
|
1421
|
+
title: t || r,
|
|
1422
|
+
type: r
|
|
1423
|
+
};
|
|
1424
|
+
return n.payload !== void 0 && (o.payload = n.payload), o;
|
|
1425
|
+
}
|
|
1426
|
+
function F(e) {
|
|
1427
|
+
return !e || typeof e != "object" || Array.isArray(e) ? null : e;
|
|
1428
|
+
}
|
|
1429
|
+
function y(...e) {
|
|
1430
|
+
for (const t of e)
|
|
1431
|
+
if (typeof t == "string") {
|
|
1432
|
+
const n = t.trim();
|
|
1433
|
+
if (n.length > 0) return n;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
function Un(e) {
|
|
1437
|
+
return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.length > 0) : [];
|
|
1438
|
+
}
|
|
1439
|
+
function K(e) {
|
|
1440
|
+
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
1441
|
+
if (typeof e == "string") {
|
|
1442
|
+
let t;
|
|
1443
|
+
e.includes(".") && e.includes(",") ? t = e.replace(/\./g, "").replace(",", ".") : t = e.replace(",", ".");
|
|
1444
|
+
const n = Number(t);
|
|
1445
|
+
if (Number.isFinite(n)) return n;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
function it(e) {
|
|
1449
|
+
return e != null;
|
|
1450
|
+
}
|
|
1451
|
+
function j(e) {
|
|
1452
|
+
const t = e.price_discounted != null && e.price_discounted > 0 ? e.price_discounted : e.price, n = e.price_discounted != null && e.price_discounted > 0 && e.price != null ? e.price : void 0;
|
|
1453
|
+
let r;
|
|
1454
|
+
n != null && t != null && n > 0 && (r = Math.round((n - t) / n * 100));
|
|
1455
|
+
const o = y(e.brand), i = y(e.name) ?? e.sku, s = o && !i.toLowerCase().startsWith(o.toLowerCase()) ? `${o} ${i}` : i, a = {
|
|
1456
|
+
sku: e.sku,
|
|
1457
|
+
name: s,
|
|
1458
|
+
url: y(e.url) ?? ""
|
|
1459
|
+
}, c = e.images?.[0];
|
|
1460
|
+
return c && (a.imageUrl = c), e.images && e.images.length > 1 && (a.images = e.images), t != null && (a.price = String(t)), n != null && (a.originalPrice = String(n)), r !== void 0 && (a.discountPercent = r), o !== void 0 && (a.brand = o), e.rating !== void 0 && (a.rating = e.rating), e.review_count !== void 0 && (a.reviewCount = e.review_count), e.cart_code !== void 0 && (a.cartCode = e.cart_code), e.in_stock !== void 0 && (a.inStock = e.in_stock), e.variants && e.variants.length > 0 && (a.variants = e.variants), e.discount_reason !== void 0 && (a.discountReason = e.discount_reason), e.promotions && e.promotions.length > 0 && (a.promotions = e.promotions), a;
|
|
1461
|
+
}
|
|
1462
|
+
function rc(e) {
|
|
1463
|
+
return e.results.map(j);
|
|
1464
|
+
}
|
|
1465
|
+
function oc(e) {
|
|
1466
|
+
return e.product_groupings.map((t) => {
|
|
1467
|
+
const n = {
|
|
1468
|
+
name: t.name,
|
|
1469
|
+
products: (t.group_products ?? []).map(j)
|
|
1470
|
+
};
|
|
1471
|
+
return t.highlight !== void 0 && (n.highlight = t.highlight), n;
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
const Mn = {
|
|
1475
|
+
process_action: "/process_action",
|
|
1476
|
+
launcher_action: "/launcher_action",
|
|
1477
|
+
similar_products: "/similar_products",
|
|
1478
|
+
product_groupings: "/product_groupings",
|
|
1479
|
+
proactive_action: "/proactive_action"
|
|
1480
|
+
}, Fn = {
|
|
1481
|
+
process_action: "/message",
|
|
1482
|
+
launcher_action: "/message"
|
|
1483
|
+
};
|
|
1484
|
+
function Jn(e) {
|
|
1485
|
+
if (e === void 0)
|
|
1486
|
+
throw new Error("[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.");
|
|
1487
|
+
const t = e.trim();
|
|
1488
|
+
return t === "" ? "" : t.replace(/\/+$/, "");
|
|
1489
|
+
}
|
|
1490
|
+
function ic(e, t) {
|
|
1491
|
+
const n = Jn(t?.middlewareUrl);
|
|
1492
|
+
if (t.backendType === "acap") {
|
|
1493
|
+
const r = t.accountId ?? "", o = Fn[e];
|
|
1494
|
+
if (o)
|
|
1495
|
+
return `${n}/api/chat/${r}${o}`;
|
|
1496
|
+
}
|
|
1497
|
+
return `${n}/chat${Mn[e]}`;
|
|
1498
|
+
}
|
|
1499
|
+
function xn() {
|
|
1500
|
+
return typeof window < "u" && Array.isArray(window.dataLayer);
|
|
1501
|
+
}
|
|
1502
|
+
function S(e, t) {
|
|
1503
|
+
const n = {
|
|
1504
|
+
event: e,
|
|
1505
|
+
...t
|
|
1506
|
+
};
|
|
1507
|
+
xn() && window.dataLayer.push(n);
|
|
1508
|
+
}
|
|
1509
|
+
function qn(e) {
|
|
1510
|
+
S("gengage-on-init", { gengage_widget: e });
|
|
1511
|
+
}
|
|
1512
|
+
function Pe(e) {
|
|
1513
|
+
S("gengage-show", { gengage_widget: e });
|
|
1514
|
+
}
|
|
1515
|
+
function Vn(e) {
|
|
1516
|
+
S("gengage-hide", { gengage_widget: e });
|
|
1517
|
+
}
|
|
1518
|
+
function Bn(e, t) {
|
|
1519
|
+
S("gengage-suggested-question", {
|
|
1520
|
+
gengage_question_title: e,
|
|
1521
|
+
gengage_action_type: t
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
1524
|
+
function sc(e) {
|
|
1525
|
+
S("gengage-find-similars", { gengage_sku: e });
|
|
1526
|
+
}
|
|
1527
|
+
function ac(e) {
|
|
1528
|
+
S("gengage-compare-preselection", { gengage_sku: e });
|
|
1529
|
+
}
|
|
1530
|
+
function cc(e) {
|
|
1531
|
+
S("gengage-compare-selected", {
|
|
1532
|
+
gengage_skus: e,
|
|
1533
|
+
gengage_product_count: e.length
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
function uc() {
|
|
1537
|
+
S("gengage-compare-clear");
|
|
1538
|
+
}
|
|
1539
|
+
function dc(e) {
|
|
1540
|
+
S("gengage-compare-received", {
|
|
1541
|
+
gengage_product_count: e
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
function lc(e) {
|
|
1545
|
+
S("gengage-like-product", { gengage_sku: e });
|
|
1546
|
+
}
|
|
1547
|
+
function fc() {
|
|
1548
|
+
S("gengage-like-list");
|
|
1549
|
+
}
|
|
1550
|
+
function pc(e, t) {
|
|
1551
|
+
S("gengage-search", {
|
|
1552
|
+
gengage_search_query: e,
|
|
1553
|
+
gengage_result_count: t
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
function Gn(e, t) {
|
|
1557
|
+
S("gengage-product-detail", {
|
|
1558
|
+
gengage_sku: e,
|
|
1559
|
+
gengage_product_name: t
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
function Ae(e, t) {
|
|
1563
|
+
S("gengage-cart-add", {
|
|
1564
|
+
gengage_sku: e,
|
|
1565
|
+
gengage_quantity: t
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
function gc() {
|
|
1569
|
+
S("gengage-message-sent");
|
|
1570
|
+
}
|
|
1571
|
+
function hc() {
|
|
1572
|
+
S("gengage-message-received");
|
|
1573
|
+
}
|
|
1574
|
+
function mc() {
|
|
1575
|
+
S("gengage-conversation-start");
|
|
1576
|
+
}
|
|
1577
|
+
function Wn() {
|
|
1578
|
+
S("gengage-voice-input");
|
|
1579
|
+
}
|
|
1580
|
+
function Hn(e, t) {
|
|
1581
|
+
S("gengage-error", { gengage_widget: e, gengage_error: t });
|
|
1582
|
+
}
|
|
1583
|
+
let Y = null;
|
|
1584
|
+
function _c() {
|
|
1585
|
+
if (typeof window > "u") return () => {
|
|
1586
|
+
};
|
|
1587
|
+
if (Y) return Y;
|
|
1588
|
+
const e = [];
|
|
1589
|
+
function t(n, r) {
|
|
1590
|
+
const o = (i) => r(i.detail);
|
|
1591
|
+
window.addEventListener(n, o), e.push(() => window.removeEventListener(n, o));
|
|
1592
|
+
}
|
|
1593
|
+
return t("gengage:chat:open", () => Pe("chat")), t("gengage:chat:close", () => Vn("chat")), t("gengage:chat:ready", () => qn("chat")), t("gengage:chat:add-to-cart", ({ sku: n, quantity: r }) => {
|
|
1594
|
+
Ae(n, r);
|
|
1595
|
+
}), t("gengage:similar:add-to-cart", ({ sku: n, quantity: r }) => {
|
|
1596
|
+
Ae(n, r);
|
|
1597
|
+
}), t("gengage:similar:product-click", ({ sku: n }) => {
|
|
1598
|
+
Gn(n);
|
|
1599
|
+
}), t("gengage:qna:action", ({ title: n, type: r }) => {
|
|
1600
|
+
Bn(n, r);
|
|
1601
|
+
}), t("gengage:chat:voice", () => Wn()), t("gengage:qna:open-chat", () => Pe("chat")), t("gengage:global:error", ({ source: n, message: r }) => {
|
|
1602
|
+
Hn(n, r);
|
|
1603
|
+
}), Y = () => {
|
|
1604
|
+
for (const n of e) n();
|
|
1605
|
+
e.length = 0, Y = null;
|
|
1606
|
+
}, Y;
|
|
1607
|
+
}
|
|
1608
|
+
function d(e, t, n) {
|
|
1609
|
+
function r(a, c) {
|
|
1610
|
+
if (a._zod || Object.defineProperty(a, "_zod", {
|
|
1611
|
+
value: {
|
|
1612
|
+
def: c,
|
|
1613
|
+
constr: s,
|
|
1614
|
+
traits: /* @__PURE__ */ new Set()
|
|
1615
|
+
},
|
|
1616
|
+
enumerable: !1
|
|
1617
|
+
}), a._zod.traits.has(e))
|
|
1618
|
+
return;
|
|
1619
|
+
a._zod.traits.add(e), t(a, c);
|
|
1620
|
+
const u = s.prototype, l = Object.keys(u);
|
|
1621
|
+
for (let f = 0; f < l.length; f++) {
|
|
1622
|
+
const g = l[f];
|
|
1623
|
+
g in a || (a[g] = u[g].bind(a));
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
const o = n?.Parent ?? Object;
|
|
1627
|
+
class i extends o {
|
|
1628
|
+
}
|
|
1629
|
+
Object.defineProperty(i, "name", { value: e });
|
|
1630
|
+
function s(a) {
|
|
1631
|
+
var c;
|
|
1632
|
+
const u = n?.Parent ? new i() : this;
|
|
1633
|
+
r(u, a), (c = u._zod).deferred ?? (c.deferred = []);
|
|
1634
|
+
for (const l of u._zod.deferred)
|
|
1635
|
+
l();
|
|
1636
|
+
return u;
|
|
1637
|
+
}
|
|
1638
|
+
return Object.defineProperty(s, "init", { value: r }), Object.defineProperty(s, Symbol.hasInstance, {
|
|
1639
|
+
value: (a) => n?.Parent && a instanceof n.Parent ? !0 : a?._zod?.traits?.has(e)
|
|
1640
|
+
}), Object.defineProperty(s, "name", { value: e }), s;
|
|
1641
|
+
}
|
|
1642
|
+
class V extends Error {
|
|
1643
|
+
constructor() {
|
|
1644
|
+
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
class st extends Error {
|
|
1648
|
+
constructor(t) {
|
|
1649
|
+
super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
const at = {};
|
|
1653
|
+
function C(e) {
|
|
1654
|
+
return at;
|
|
1655
|
+
}
|
|
1656
|
+
function ct(e) {
|
|
1657
|
+
const t = Object.values(e).filter((r) => typeof r == "number");
|
|
1658
|
+
return Object.entries(e).filter(([r, o]) => t.indexOf(+r) === -1).map(([r, o]) => o);
|
|
1659
|
+
}
|
|
1660
|
+
function ge(e, t) {
|
|
1661
|
+
return typeof t == "bigint" ? t.toString() : t;
|
|
1662
|
+
}
|
|
1663
|
+
function ve(e) {
|
|
1664
|
+
return {
|
|
1665
|
+
get value() {
|
|
1666
|
+
{
|
|
1667
|
+
const t = e();
|
|
1668
|
+
return Object.defineProperty(this, "value", { value: t }), t;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
function we(e) {
|
|
1674
|
+
return e == null;
|
|
1675
|
+
}
|
|
1676
|
+
function be(e) {
|
|
1677
|
+
const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
|
|
1678
|
+
return e.slice(t, n);
|
|
1679
|
+
}
|
|
1680
|
+
function Kn(e, t) {
|
|
1681
|
+
const n = (e.toString().split(".")[1] || "").length, r = t.toString();
|
|
1682
|
+
let o = (r.split(".")[1] || "").length;
|
|
1683
|
+
if (o === 0 && /\d?e-\d?/.test(r)) {
|
|
1684
|
+
const c = r.match(/\d?e-(\d?)/);
|
|
1685
|
+
c?.[1] && (o = Number.parseInt(c[1]));
|
|
1686
|
+
}
|
|
1687
|
+
const i = n > o ? n : o, s = Number.parseInt(e.toFixed(i).replace(".", "")), a = Number.parseInt(t.toFixed(i).replace(".", ""));
|
|
1688
|
+
return s % a / 10 ** i;
|
|
1689
|
+
}
|
|
1690
|
+
const Ne = /* @__PURE__ */ Symbol("evaluating");
|
|
1691
|
+
function _(e, t, n) {
|
|
1692
|
+
let r;
|
|
1693
|
+
Object.defineProperty(e, t, {
|
|
1694
|
+
get() {
|
|
1695
|
+
if (r !== Ne)
|
|
1696
|
+
return r === void 0 && (r = Ne, r = n()), r;
|
|
1697
|
+
},
|
|
1698
|
+
set(o) {
|
|
1699
|
+
Object.defineProperty(e, t, {
|
|
1700
|
+
value: o
|
|
1701
|
+
// configurable: true,
|
|
1702
|
+
});
|
|
1703
|
+
},
|
|
1704
|
+
configurable: !0
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
function J(e, t, n) {
|
|
1708
|
+
Object.defineProperty(e, t, {
|
|
1709
|
+
value: n,
|
|
1710
|
+
writable: !0,
|
|
1711
|
+
enumerable: !0,
|
|
1712
|
+
configurable: !0
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
function L(...e) {
|
|
1716
|
+
const t = {};
|
|
1717
|
+
for (const n of e) {
|
|
1718
|
+
const r = Object.getOwnPropertyDescriptors(n);
|
|
1719
|
+
Object.assign(t, r);
|
|
1720
|
+
}
|
|
1721
|
+
return Object.defineProperties({}, t);
|
|
1722
|
+
}
|
|
1723
|
+
function Ce(e) {
|
|
1724
|
+
return JSON.stringify(e);
|
|
1725
|
+
}
|
|
1726
|
+
function Yn(e) {
|
|
1727
|
+
return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1728
|
+
}
|
|
1729
|
+
const ut = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
1730
|
+
};
|
|
1731
|
+
function oe(e) {
|
|
1732
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
1733
|
+
}
|
|
1734
|
+
const Qn = ve(() => {
|
|
1735
|
+
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
1736
|
+
return !1;
|
|
1737
|
+
try {
|
|
1738
|
+
const e = Function;
|
|
1739
|
+
return new e(""), !0;
|
|
1740
|
+
} catch {
|
|
1741
|
+
return !1;
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1744
|
+
function B(e) {
|
|
1745
|
+
if (oe(e) === !1)
|
|
1746
|
+
return !1;
|
|
1747
|
+
const t = e.constructor;
|
|
1748
|
+
if (t === void 0 || typeof t != "function")
|
|
1749
|
+
return !0;
|
|
1750
|
+
const n = t.prototype;
|
|
1751
|
+
return !(oe(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
1752
|
+
}
|
|
1753
|
+
function dt(e) {
|
|
1754
|
+
return B(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
|
|
1755
|
+
}
|
|
1756
|
+
const Xn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
1757
|
+
function G(e) {
|
|
1758
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1759
|
+
}
|
|
1760
|
+
function U(e, t, n) {
|
|
1761
|
+
const r = new e._zod.constr(t ?? e._zod.def);
|
|
1762
|
+
return (!t || n?.parent) && (r._zod.parent = e), r;
|
|
1763
|
+
}
|
|
1764
|
+
function h(e) {
|
|
1765
|
+
const t = e;
|
|
1766
|
+
if (!t)
|
|
1767
|
+
return {};
|
|
1768
|
+
if (typeof t == "string")
|
|
1769
|
+
return { error: () => t };
|
|
1770
|
+
if (t?.message !== void 0) {
|
|
1771
|
+
if (t?.error !== void 0)
|
|
1772
|
+
throw new Error("Cannot specify both `message` and `error` params");
|
|
1773
|
+
t.error = t.message;
|
|
1774
|
+
}
|
|
1775
|
+
return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
|
|
1776
|
+
}
|
|
1777
|
+
function er(e) {
|
|
1778
|
+
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
1779
|
+
}
|
|
1780
|
+
const tr = {
|
|
1781
|
+
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
1782
|
+
int32: [-2147483648, 2147483647],
|
|
1783
|
+
uint32: [0, 4294967295],
|
|
1784
|
+
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
1785
|
+
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
1786
|
+
};
|
|
1787
|
+
function nr(e, t) {
|
|
1788
|
+
const n = e._zod.def, r = n.checks;
|
|
1789
|
+
if (r && r.length > 0)
|
|
1790
|
+
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
1791
|
+
const i = L(e._zod.def, {
|
|
1792
|
+
get shape() {
|
|
1793
|
+
const s = {};
|
|
1794
|
+
for (const a in t) {
|
|
1795
|
+
if (!(a in n.shape))
|
|
1796
|
+
throw new Error(`Unrecognized key: "${a}"`);
|
|
1797
|
+
t[a] && (s[a] = n.shape[a]);
|
|
1798
|
+
}
|
|
1799
|
+
return J(this, "shape", s), s;
|
|
1800
|
+
},
|
|
1801
|
+
checks: []
|
|
1802
|
+
});
|
|
1803
|
+
return U(e, i);
|
|
1804
|
+
}
|
|
1805
|
+
function rr(e, t) {
|
|
1806
|
+
const n = e._zod.def, r = n.checks;
|
|
1807
|
+
if (r && r.length > 0)
|
|
1808
|
+
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
1809
|
+
const i = L(e._zod.def, {
|
|
1810
|
+
get shape() {
|
|
1811
|
+
const s = { ...e._zod.def.shape };
|
|
1812
|
+
for (const a in t) {
|
|
1813
|
+
if (!(a in n.shape))
|
|
1814
|
+
throw new Error(`Unrecognized key: "${a}"`);
|
|
1815
|
+
t[a] && delete s[a];
|
|
1816
|
+
}
|
|
1817
|
+
return J(this, "shape", s), s;
|
|
1818
|
+
},
|
|
1819
|
+
checks: []
|
|
1820
|
+
});
|
|
1821
|
+
return U(e, i);
|
|
1822
|
+
}
|
|
1823
|
+
function or(e, t) {
|
|
1824
|
+
if (!B(t))
|
|
1825
|
+
throw new Error("Invalid input to extend: expected a plain object");
|
|
1826
|
+
const n = e._zod.def.checks;
|
|
1827
|
+
if (n && n.length > 0) {
|
|
1828
|
+
const i = e._zod.def.shape;
|
|
1829
|
+
for (const s in t)
|
|
1830
|
+
if (Object.getOwnPropertyDescriptor(i, s) !== void 0)
|
|
1831
|
+
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
1832
|
+
}
|
|
1833
|
+
const o = L(e._zod.def, {
|
|
1834
|
+
get shape() {
|
|
1835
|
+
const i = { ...e._zod.def.shape, ...t };
|
|
1836
|
+
return J(this, "shape", i), i;
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1839
|
+
return U(e, o);
|
|
1840
|
+
}
|
|
1841
|
+
function ir(e, t) {
|
|
1842
|
+
if (!B(t))
|
|
1843
|
+
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
1844
|
+
const n = L(e._zod.def, {
|
|
1845
|
+
get shape() {
|
|
1846
|
+
const r = { ...e._zod.def.shape, ...t };
|
|
1847
|
+
return J(this, "shape", r), r;
|
|
1848
|
+
}
|
|
1849
|
+
});
|
|
1850
|
+
return U(e, n);
|
|
1851
|
+
}
|
|
1852
|
+
function sr(e, t) {
|
|
1853
|
+
const n = L(e._zod.def, {
|
|
1854
|
+
get shape() {
|
|
1855
|
+
const r = { ...e._zod.def.shape, ...t._zod.def.shape };
|
|
1856
|
+
return J(this, "shape", r), r;
|
|
1857
|
+
},
|
|
1858
|
+
get catchall() {
|
|
1859
|
+
return t._zod.def.catchall;
|
|
1860
|
+
},
|
|
1861
|
+
checks: []
|
|
1862
|
+
// delete existing checks
|
|
1863
|
+
});
|
|
1864
|
+
return U(e, n);
|
|
1865
|
+
}
|
|
1866
|
+
function ar(e, t, n) {
|
|
1867
|
+
const o = t._zod.def.checks;
|
|
1868
|
+
if (o && o.length > 0)
|
|
1869
|
+
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
1870
|
+
const s = L(t._zod.def, {
|
|
1871
|
+
get shape() {
|
|
1872
|
+
const a = t._zod.def.shape, c = { ...a };
|
|
1873
|
+
if (n)
|
|
1874
|
+
for (const u in n) {
|
|
1875
|
+
if (!(u in a))
|
|
1876
|
+
throw new Error(`Unrecognized key: "${u}"`);
|
|
1877
|
+
n[u] && (c[u] = e ? new e({
|
|
1878
|
+
type: "optional",
|
|
1879
|
+
innerType: a[u]
|
|
1880
|
+
}) : a[u]);
|
|
1881
|
+
}
|
|
1882
|
+
else
|
|
1883
|
+
for (const u in a)
|
|
1884
|
+
c[u] = e ? new e({
|
|
1885
|
+
type: "optional",
|
|
1886
|
+
innerType: a[u]
|
|
1887
|
+
}) : a[u];
|
|
1888
|
+
return J(this, "shape", c), c;
|
|
1889
|
+
},
|
|
1890
|
+
checks: []
|
|
1891
|
+
});
|
|
1892
|
+
return U(t, s);
|
|
1893
|
+
}
|
|
1894
|
+
function cr(e, t, n) {
|
|
1895
|
+
const r = L(t._zod.def, {
|
|
1896
|
+
get shape() {
|
|
1897
|
+
const o = t._zod.def.shape, i = { ...o };
|
|
1898
|
+
if (n)
|
|
1899
|
+
for (const s in n) {
|
|
1900
|
+
if (!(s in i))
|
|
1901
|
+
throw new Error(`Unrecognized key: "${s}"`);
|
|
1902
|
+
n[s] && (i[s] = new e({
|
|
1903
|
+
type: "nonoptional",
|
|
1904
|
+
innerType: o[s]
|
|
1905
|
+
}));
|
|
1906
|
+
}
|
|
1907
|
+
else
|
|
1908
|
+
for (const s in o)
|
|
1909
|
+
i[s] = new e({
|
|
1910
|
+
type: "nonoptional",
|
|
1911
|
+
innerType: o[s]
|
|
1912
|
+
});
|
|
1913
|
+
return J(this, "shape", i), i;
|
|
1914
|
+
}
|
|
1915
|
+
});
|
|
1916
|
+
return U(t, r);
|
|
1917
|
+
}
|
|
1918
|
+
function x(e, t = 0) {
|
|
1919
|
+
if (e.aborted === !0)
|
|
1920
|
+
return !0;
|
|
1921
|
+
for (let n = t; n < e.issues.length; n++)
|
|
1922
|
+
if (e.issues[n]?.continue !== !0)
|
|
1923
|
+
return !0;
|
|
1924
|
+
return !1;
|
|
1925
|
+
}
|
|
1926
|
+
function q(e, t) {
|
|
1927
|
+
return t.map((n) => {
|
|
1928
|
+
var r;
|
|
1929
|
+
return (r = n).path ?? (r.path = []), n.path.unshift(e), n;
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
function te(e) {
|
|
1933
|
+
return typeof e == "string" ? e : e?.message;
|
|
1934
|
+
}
|
|
1935
|
+
function R(e, t, n) {
|
|
1936
|
+
const r = { ...e, path: e.path ?? [] };
|
|
1937
|
+
if (!e.message) {
|
|
1938
|
+
const o = te(e.inst?._zod.def?.error?.(e)) ?? te(t?.error?.(e)) ?? te(n.customError?.(e)) ?? te(n.localeError?.(e)) ?? "Invalid input";
|
|
1939
|
+
r.message = o;
|
|
1940
|
+
}
|
|
1941
|
+
return delete r.inst, delete r.continue, t?.reportInput || delete r.input, r;
|
|
1942
|
+
}
|
|
1943
|
+
function ke(e) {
|
|
1944
|
+
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
1945
|
+
}
|
|
1946
|
+
function ee(...e) {
|
|
1947
|
+
const [t, n, r] = e;
|
|
1948
|
+
return typeof t == "string" ? {
|
|
1949
|
+
message: t,
|
|
1950
|
+
code: "custom",
|
|
1951
|
+
input: n,
|
|
1952
|
+
inst: r
|
|
1953
|
+
} : { ...t };
|
|
1954
|
+
}
|
|
1955
|
+
const lt = (e, t) => {
|
|
1956
|
+
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
1957
|
+
value: e._zod,
|
|
1958
|
+
enumerable: !1
|
|
1959
|
+
}), Object.defineProperty(e, "issues", {
|
|
1960
|
+
value: t,
|
|
1961
|
+
enumerable: !1
|
|
1962
|
+
}), e.message = JSON.stringify(t, ge, 2), Object.defineProperty(e, "toString", {
|
|
1963
|
+
value: () => e.message,
|
|
1964
|
+
enumerable: !1
|
|
1965
|
+
});
|
|
1966
|
+
}, ft = d("$ZodError", lt), pt = d("$ZodError", lt, { Parent: Error });
|
|
1967
|
+
function ur(e, t = (n) => n.message) {
|
|
1968
|
+
const n = {}, r = [];
|
|
1969
|
+
for (const o of e.issues)
|
|
1970
|
+
o.path.length > 0 ? (n[o.path[0]] = n[o.path[0]] || [], n[o.path[0]].push(t(o))) : r.push(t(o));
|
|
1971
|
+
return { formErrors: r, fieldErrors: n };
|
|
1972
|
+
}
|
|
1973
|
+
function dr(e, t = (n) => n.message) {
|
|
1974
|
+
const n = { _errors: [] }, r = (o) => {
|
|
1975
|
+
for (const i of o.issues)
|
|
1976
|
+
if (i.code === "invalid_union" && i.errors.length)
|
|
1977
|
+
i.errors.map((s) => r({ issues: s }));
|
|
1978
|
+
else if (i.code === "invalid_key")
|
|
1979
|
+
r({ issues: i.issues });
|
|
1980
|
+
else if (i.code === "invalid_element")
|
|
1981
|
+
r({ issues: i.issues });
|
|
1982
|
+
else if (i.path.length === 0)
|
|
1983
|
+
n._errors.push(t(i));
|
|
1984
|
+
else {
|
|
1985
|
+
let s = n, a = 0;
|
|
1986
|
+
for (; a < i.path.length; ) {
|
|
1987
|
+
const c = i.path[a];
|
|
1988
|
+
a === i.path.length - 1 ? (s[c] = s[c] || { _errors: [] }, s[c]._errors.push(t(i))) : s[c] = s[c] || { _errors: [] }, s = s[c], a++;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
return r(e), n;
|
|
1993
|
+
}
|
|
1994
|
+
const ze = (e) => (t, n, r, o) => {
|
|
1995
|
+
const i = r ? Object.assign(r, { async: !1 }) : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i);
|
|
1996
|
+
if (s instanceof Promise)
|
|
1997
|
+
throw new V();
|
|
1998
|
+
if (s.issues.length) {
|
|
1999
|
+
const a = new (o?.Err ?? e)(s.issues.map((c) => R(c, i, C())));
|
|
2000
|
+
throw ut(a, o?.callee), a;
|
|
2001
|
+
}
|
|
2002
|
+
return s.value;
|
|
2003
|
+
}, $e = (e) => async (t, n, r, o) => {
|
|
2004
|
+
const i = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
2005
|
+
let s = t._zod.run({ value: n, issues: [] }, i);
|
|
2006
|
+
if (s instanceof Promise && (s = await s), s.issues.length) {
|
|
2007
|
+
const a = new (o?.Err ?? e)(s.issues.map((c) => R(c, i, C())));
|
|
2008
|
+
throw ut(a, o?.callee), a;
|
|
2009
|
+
}
|
|
2010
|
+
return s.value;
|
|
2011
|
+
}, ce = (e) => (t, n, r) => {
|
|
2012
|
+
const o = r ? { ...r, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, o);
|
|
2013
|
+
if (i instanceof Promise)
|
|
2014
|
+
throw new V();
|
|
2015
|
+
return i.issues.length ? {
|
|
2016
|
+
success: !1,
|
|
2017
|
+
error: new (e ?? ft)(i.issues.map((s) => R(s, o, C())))
|
|
2018
|
+
} : { success: !0, data: i.value };
|
|
2019
|
+
}, lr = /* @__PURE__ */ ce(pt), ue = (e) => async (t, n, r) => {
|
|
2020
|
+
const o = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
2021
|
+
let i = t._zod.run({ value: n, issues: [] }, o);
|
|
2022
|
+
return i instanceof Promise && (i = await i), i.issues.length ? {
|
|
2023
|
+
success: !1,
|
|
2024
|
+
error: new e(i.issues.map((s) => R(s, o, C())))
|
|
2025
|
+
} : { success: !0, data: i.value };
|
|
2026
|
+
}, fr = /* @__PURE__ */ ue(pt), pr = (e) => (t, n, r) => {
|
|
2027
|
+
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
2028
|
+
return ze(e)(t, n, o);
|
|
2029
|
+
}, gr = (e) => (t, n, r) => ze(e)(t, n, r), hr = (e) => async (t, n, r) => {
|
|
2030
|
+
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
2031
|
+
return $e(e)(t, n, o);
|
|
2032
|
+
}, mr = (e) => async (t, n, r) => $e(e)(t, n, r), _r = (e) => (t, n, r) => {
|
|
2033
|
+
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
2034
|
+
return ce(e)(t, n, o);
|
|
2035
|
+
}, yr = (e) => (t, n, r) => ce(e)(t, n, r), vr = (e) => async (t, n, r) => {
|
|
2036
|
+
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
2037
|
+
return ue(e)(t, n, o);
|
|
2038
|
+
}, wr = (e) => async (t, n, r) => ue(e)(t, n, r), br = /^[cC][^\s-]{8,}$/, kr = /^[0-9a-z]+$/, zr = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, $r = /^[0-9a-vA-V]{20}$/, Sr = /^[A-Za-z0-9]{27}$/, Er = /^[a-zA-Z0-9_-]{21}$/, Zr = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Tr = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Re = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Ir = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Or = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
2039
|
+
function Pr() {
|
|
2040
|
+
return new RegExp(Or, "u");
|
|
2041
|
+
}
|
|
2042
|
+
const Ar = /^(?:(?: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])$/, Nr = /^(([0-9a-fA-F]{1,4}:){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}|:))$/, Cr = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, Rr = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Dr = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, gt = /^[A-Za-z0-9_-]*$/, jr = /^\+[1-9]\d{6,14}$/, ht = "(?:(?:\\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])))", Lr = /* @__PURE__ */ new RegExp(`^${ht}$`);
|
|
2043
|
+
function mt(e) {
|
|
2044
|
+
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
2045
|
+
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
2046
|
+
}
|
|
2047
|
+
function Ur(e) {
|
|
2048
|
+
return new RegExp(`^${mt(e)}$`);
|
|
2049
|
+
}
|
|
2050
|
+
function Mr(e) {
|
|
2051
|
+
const t = mt({ precision: e.precision }), n = ["Z"];
|
|
2052
|
+
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
2053
|
+
const r = `${t}(?:${n.join("|")})`;
|
|
2054
|
+
return new RegExp(`^${ht}T(?:${r})$`);
|
|
2055
|
+
}
|
|
2056
|
+
const Fr = (e) => {
|
|
2057
|
+
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
2058
|
+
return new RegExp(`^${t}$`);
|
|
2059
|
+
}, Jr = /^-?\d+$/, _t = /^-?\d+(?:\.\d+)?$/, xr = /^(?:true|false)$/i, qr = /^[^A-Z]*$/, Vr = /^[^a-z]*$/, I = /* @__PURE__ */ d("$ZodCheck", (e, t) => {
|
|
2060
|
+
var n;
|
|
2061
|
+
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
2062
|
+
}), yt = {
|
|
2063
|
+
number: "number",
|
|
2064
|
+
bigint: "bigint",
|
|
2065
|
+
object: "date"
|
|
2066
|
+
}, vt = /* @__PURE__ */ d("$ZodCheckLessThan", (e, t) => {
|
|
2067
|
+
I.init(e, t);
|
|
2068
|
+
const n = yt[typeof t.value];
|
|
2069
|
+
e._zod.onattach.push((r) => {
|
|
2070
|
+
const o = r._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
2071
|
+
t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value);
|
|
2072
|
+
}), e._zod.check = (r) => {
|
|
2073
|
+
(t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({
|
|
2074
|
+
origin: n,
|
|
2075
|
+
code: "too_big",
|
|
2076
|
+
maximum: typeof t.value == "object" ? t.value.getTime() : t.value,
|
|
2077
|
+
input: r.value,
|
|
2078
|
+
inclusive: t.inclusive,
|
|
2079
|
+
inst: e,
|
|
2080
|
+
continue: !t.abort
|
|
2081
|
+
});
|
|
2082
|
+
};
|
|
2083
|
+
}), wt = /* @__PURE__ */ d("$ZodCheckGreaterThan", (e, t) => {
|
|
2084
|
+
I.init(e, t);
|
|
2085
|
+
const n = yt[typeof t.value];
|
|
2086
|
+
e._zod.onattach.push((r) => {
|
|
2087
|
+
const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
2088
|
+
t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
|
|
2089
|
+
}), e._zod.check = (r) => {
|
|
2090
|
+
(t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({
|
|
2091
|
+
origin: n,
|
|
2092
|
+
code: "too_small",
|
|
2093
|
+
minimum: typeof t.value == "object" ? t.value.getTime() : t.value,
|
|
2094
|
+
input: r.value,
|
|
2095
|
+
inclusive: t.inclusive,
|
|
2096
|
+
inst: e,
|
|
2097
|
+
continue: !t.abort
|
|
2098
|
+
});
|
|
2099
|
+
};
|
|
2100
|
+
}), Br = /* @__PURE__ */ d("$ZodCheckMultipleOf", (e, t) => {
|
|
2101
|
+
I.init(e, t), e._zod.onattach.push((n) => {
|
|
2102
|
+
var r;
|
|
2103
|
+
(r = n._zod.bag).multipleOf ?? (r.multipleOf = t.value);
|
|
2104
|
+
}), e._zod.check = (n) => {
|
|
2105
|
+
if (typeof n.value != typeof t.value)
|
|
2106
|
+
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
2107
|
+
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : Kn(n.value, t.value) === 0) || n.issues.push({
|
|
2108
|
+
origin: typeof n.value,
|
|
2109
|
+
code: "not_multiple_of",
|
|
2110
|
+
divisor: t.value,
|
|
2111
|
+
input: n.value,
|
|
2112
|
+
inst: e,
|
|
2113
|
+
continue: !t.abort
|
|
2114
|
+
});
|
|
2115
|
+
};
|
|
2116
|
+
}), Gr = /* @__PURE__ */ d("$ZodCheckNumberFormat", (e, t) => {
|
|
2117
|
+
I.init(e, t), t.format = t.format || "float64";
|
|
2118
|
+
const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = tr[t.format];
|
|
2119
|
+
e._zod.onattach.push((s) => {
|
|
2120
|
+
const a = s._zod.bag;
|
|
2121
|
+
a.format = t.format, a.minimum = o, a.maximum = i, n && (a.pattern = Jr);
|
|
2122
|
+
}), e._zod.check = (s) => {
|
|
2123
|
+
const a = s.value;
|
|
2124
|
+
if (n) {
|
|
2125
|
+
if (!Number.isInteger(a)) {
|
|
2126
|
+
s.issues.push({
|
|
2127
|
+
expected: r,
|
|
2128
|
+
format: t.format,
|
|
2129
|
+
code: "invalid_type",
|
|
2130
|
+
continue: !1,
|
|
2131
|
+
input: a,
|
|
2132
|
+
inst: e
|
|
2133
|
+
});
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2136
|
+
if (!Number.isSafeInteger(a)) {
|
|
2137
|
+
a > 0 ? s.issues.push({
|
|
2138
|
+
input: a,
|
|
2139
|
+
code: "too_big",
|
|
2140
|
+
maximum: Number.MAX_SAFE_INTEGER,
|
|
2141
|
+
note: "Integers must be within the safe integer range.",
|
|
2142
|
+
inst: e,
|
|
2143
|
+
origin: r,
|
|
2144
|
+
inclusive: !0,
|
|
2145
|
+
continue: !t.abort
|
|
2146
|
+
}) : s.issues.push({
|
|
2147
|
+
input: a,
|
|
2148
|
+
code: "too_small",
|
|
2149
|
+
minimum: Number.MIN_SAFE_INTEGER,
|
|
2150
|
+
note: "Integers must be within the safe integer range.",
|
|
2151
|
+
inst: e,
|
|
2152
|
+
origin: r,
|
|
2153
|
+
inclusive: !0,
|
|
2154
|
+
continue: !t.abort
|
|
2155
|
+
});
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
a < o && s.issues.push({
|
|
2160
|
+
origin: "number",
|
|
2161
|
+
input: a,
|
|
2162
|
+
code: "too_small",
|
|
2163
|
+
minimum: o,
|
|
2164
|
+
inclusive: !0,
|
|
2165
|
+
inst: e,
|
|
2166
|
+
continue: !t.abort
|
|
2167
|
+
}), a > i && s.issues.push({
|
|
2168
|
+
origin: "number",
|
|
2169
|
+
input: a,
|
|
2170
|
+
code: "too_big",
|
|
2171
|
+
maximum: i,
|
|
2172
|
+
inclusive: !0,
|
|
2173
|
+
inst: e,
|
|
2174
|
+
continue: !t.abort
|
|
2175
|
+
});
|
|
2176
|
+
};
|
|
2177
|
+
}), Wr = /* @__PURE__ */ d("$ZodCheckMaxLength", (e, t) => {
|
|
2178
|
+
var n;
|
|
2179
|
+
I.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
2180
|
+
const o = r.value;
|
|
2181
|
+
return !we(o) && o.length !== void 0;
|
|
2182
|
+
}), e._zod.onattach.push((r) => {
|
|
2183
|
+
const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
2184
|
+
t.maximum < o && (r._zod.bag.maximum = t.maximum);
|
|
2185
|
+
}), e._zod.check = (r) => {
|
|
2186
|
+
const o = r.value;
|
|
2187
|
+
if (o.length <= t.maximum)
|
|
2188
|
+
return;
|
|
2189
|
+
const s = ke(o);
|
|
2190
|
+
r.issues.push({
|
|
2191
|
+
origin: s,
|
|
2192
|
+
code: "too_big",
|
|
2193
|
+
maximum: t.maximum,
|
|
2194
|
+
inclusive: !0,
|
|
2195
|
+
input: o,
|
|
2196
|
+
inst: e,
|
|
2197
|
+
continue: !t.abort
|
|
2198
|
+
});
|
|
2199
|
+
};
|
|
2200
|
+
}), Hr = /* @__PURE__ */ d("$ZodCheckMinLength", (e, t) => {
|
|
2201
|
+
var n;
|
|
2202
|
+
I.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
2203
|
+
const o = r.value;
|
|
2204
|
+
return !we(o) && o.length !== void 0;
|
|
2205
|
+
}), e._zod.onattach.push((r) => {
|
|
2206
|
+
const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
2207
|
+
t.minimum > o && (r._zod.bag.minimum = t.minimum);
|
|
2208
|
+
}), e._zod.check = (r) => {
|
|
2209
|
+
const o = r.value;
|
|
2210
|
+
if (o.length >= t.minimum)
|
|
2211
|
+
return;
|
|
2212
|
+
const s = ke(o);
|
|
2213
|
+
r.issues.push({
|
|
2214
|
+
origin: s,
|
|
2215
|
+
code: "too_small",
|
|
2216
|
+
minimum: t.minimum,
|
|
2217
|
+
inclusive: !0,
|
|
2218
|
+
input: o,
|
|
2219
|
+
inst: e,
|
|
2220
|
+
continue: !t.abort
|
|
2221
|
+
});
|
|
2222
|
+
};
|
|
2223
|
+
}), Kr = /* @__PURE__ */ d("$ZodCheckLengthEquals", (e, t) => {
|
|
2224
|
+
var n;
|
|
2225
|
+
I.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
2226
|
+
const o = r.value;
|
|
2227
|
+
return !we(o) && o.length !== void 0;
|
|
2228
|
+
}), e._zod.onattach.push((r) => {
|
|
2229
|
+
const o = r._zod.bag;
|
|
2230
|
+
o.minimum = t.length, o.maximum = t.length, o.length = t.length;
|
|
2231
|
+
}), e._zod.check = (r) => {
|
|
2232
|
+
const o = r.value, i = o.length;
|
|
2233
|
+
if (i === t.length)
|
|
2234
|
+
return;
|
|
2235
|
+
const s = ke(o), a = i > t.length;
|
|
2236
|
+
r.issues.push({
|
|
2237
|
+
origin: s,
|
|
2238
|
+
...a ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
|
|
2239
|
+
inclusive: !0,
|
|
2240
|
+
exact: !0,
|
|
2241
|
+
input: r.value,
|
|
2242
|
+
inst: e,
|
|
2243
|
+
continue: !t.abort
|
|
2244
|
+
});
|
|
2245
|
+
};
|
|
2246
|
+
}), de = /* @__PURE__ */ d("$ZodCheckStringFormat", (e, t) => {
|
|
2247
|
+
var n, r;
|
|
2248
|
+
I.init(e, t), e._zod.onattach.push((o) => {
|
|
2249
|
+
const i = o._zod.bag;
|
|
2250
|
+
i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
|
|
2251
|
+
}), t.pattern ? (n = e._zod).check ?? (n.check = (o) => {
|
|
2252
|
+
t.pattern.lastIndex = 0, !t.pattern.test(o.value) && o.issues.push({
|
|
2253
|
+
origin: "string",
|
|
2254
|
+
code: "invalid_format",
|
|
2255
|
+
format: t.format,
|
|
2256
|
+
input: o.value,
|
|
2257
|
+
...t.pattern ? { pattern: t.pattern.toString() } : {},
|
|
2258
|
+
inst: e,
|
|
2259
|
+
continue: !t.abort
|
|
2260
|
+
});
|
|
2261
|
+
}) : (r = e._zod).check ?? (r.check = () => {
|
|
2262
|
+
});
|
|
2263
|
+
}), Yr = /* @__PURE__ */ d("$ZodCheckRegex", (e, t) => {
|
|
2264
|
+
de.init(e, t), e._zod.check = (n) => {
|
|
2265
|
+
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
2266
|
+
origin: "string",
|
|
2267
|
+
code: "invalid_format",
|
|
2268
|
+
format: "regex",
|
|
2269
|
+
input: n.value,
|
|
2270
|
+
pattern: t.pattern.toString(),
|
|
2271
|
+
inst: e,
|
|
2272
|
+
continue: !t.abort
|
|
2273
|
+
});
|
|
2274
|
+
};
|
|
2275
|
+
}), Qr = /* @__PURE__ */ d("$ZodCheckLowerCase", (e, t) => {
|
|
2276
|
+
t.pattern ?? (t.pattern = qr), de.init(e, t);
|
|
2277
|
+
}), Xr = /* @__PURE__ */ d("$ZodCheckUpperCase", (e, t) => {
|
|
2278
|
+
t.pattern ?? (t.pattern = Vr), de.init(e, t);
|
|
2279
|
+
}), eo = /* @__PURE__ */ d("$ZodCheckIncludes", (e, t) => {
|
|
2280
|
+
I.init(e, t);
|
|
2281
|
+
const n = G(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
2282
|
+
t.pattern = r, e._zod.onattach.push((o) => {
|
|
2283
|
+
const i = o._zod.bag;
|
|
2284
|
+
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
2285
|
+
}), e._zod.check = (o) => {
|
|
2286
|
+
o.value.includes(t.includes, t.position) || o.issues.push({
|
|
2287
|
+
origin: "string",
|
|
2288
|
+
code: "invalid_format",
|
|
2289
|
+
format: "includes",
|
|
2290
|
+
includes: t.includes,
|
|
2291
|
+
input: o.value,
|
|
2292
|
+
inst: e,
|
|
2293
|
+
continue: !t.abort
|
|
2294
|
+
});
|
|
2295
|
+
};
|
|
2296
|
+
}), to = /* @__PURE__ */ d("$ZodCheckStartsWith", (e, t) => {
|
|
2297
|
+
I.init(e, t);
|
|
2298
|
+
const n = new RegExp(`^${G(t.prefix)}.*`);
|
|
2299
|
+
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
2300
|
+
const o = r._zod.bag;
|
|
2301
|
+
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
2302
|
+
}), e._zod.check = (r) => {
|
|
2303
|
+
r.value.startsWith(t.prefix) || r.issues.push({
|
|
2304
|
+
origin: "string",
|
|
2305
|
+
code: "invalid_format",
|
|
2306
|
+
format: "starts_with",
|
|
2307
|
+
prefix: t.prefix,
|
|
2308
|
+
input: r.value,
|
|
2309
|
+
inst: e,
|
|
2310
|
+
continue: !t.abort
|
|
2311
|
+
});
|
|
2312
|
+
};
|
|
2313
|
+
}), no = /* @__PURE__ */ d("$ZodCheckEndsWith", (e, t) => {
|
|
2314
|
+
I.init(e, t);
|
|
2315
|
+
const n = new RegExp(`.*${G(t.suffix)}$`);
|
|
2316
|
+
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
2317
|
+
const o = r._zod.bag;
|
|
2318
|
+
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
2319
|
+
}), e._zod.check = (r) => {
|
|
2320
|
+
r.value.endsWith(t.suffix) || r.issues.push({
|
|
2321
|
+
origin: "string",
|
|
2322
|
+
code: "invalid_format",
|
|
2323
|
+
format: "ends_with",
|
|
2324
|
+
suffix: t.suffix,
|
|
2325
|
+
input: r.value,
|
|
2326
|
+
inst: e,
|
|
2327
|
+
continue: !t.abort
|
|
2328
|
+
});
|
|
2329
|
+
};
|
|
2330
|
+
}), ro = /* @__PURE__ */ d("$ZodCheckOverwrite", (e, t) => {
|
|
2331
|
+
I.init(e, t), e._zod.check = (n) => {
|
|
2332
|
+
n.value = t.tx(n.value);
|
|
2333
|
+
};
|
|
2334
|
+
});
|
|
2335
|
+
class oo {
|
|
2336
|
+
constructor(t = []) {
|
|
2337
|
+
this.content = [], this.indent = 0, this && (this.args = t);
|
|
2338
|
+
}
|
|
2339
|
+
indented(t) {
|
|
2340
|
+
this.indent += 1, t(this), this.indent -= 1;
|
|
2341
|
+
}
|
|
2342
|
+
write(t) {
|
|
2343
|
+
if (typeof t == "function") {
|
|
2344
|
+
t(this, { execution: "sync" }), t(this, { execution: "async" });
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2347
|
+
const r = t.split(`
|
|
2348
|
+
`).filter((s) => s), o = Math.min(...r.map((s) => s.length - s.trimStart().length)), i = r.map((s) => s.slice(o)).map((s) => " ".repeat(this.indent * 2) + s);
|
|
2349
|
+
for (const s of i)
|
|
2350
|
+
this.content.push(s);
|
|
2351
|
+
}
|
|
2352
|
+
compile() {
|
|
2353
|
+
const t = Function, n = this?.args, o = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
|
|
2354
|
+
return new t(...n, o.join(`
|
|
2355
|
+
`));
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
const io = {
|
|
2359
|
+
major: 4,
|
|
2360
|
+
minor: 3,
|
|
2361
|
+
patch: 6
|
|
2362
|
+
}, b = /* @__PURE__ */ d("$ZodType", (e, t) => {
|
|
2363
|
+
var n;
|
|
2364
|
+
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = io;
|
|
2365
|
+
const r = [...e._zod.def.checks ?? []];
|
|
2366
|
+
e._zod.traits.has("$ZodCheck") && r.unshift(e);
|
|
2367
|
+
for (const o of r)
|
|
2368
|
+
for (const i of o._zod.onattach)
|
|
2369
|
+
i(e);
|
|
2370
|
+
if (r.length === 0)
|
|
2371
|
+
(n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
|
|
2372
|
+
e._zod.run = e._zod.parse;
|
|
2373
|
+
});
|
|
2374
|
+
else {
|
|
2375
|
+
const o = (s, a, c) => {
|
|
2376
|
+
let u = x(s), l;
|
|
2377
|
+
for (const f of a) {
|
|
2378
|
+
if (f._zod.def.when) {
|
|
2379
|
+
if (!f._zod.def.when(s))
|
|
2380
|
+
continue;
|
|
2381
|
+
} else if (u)
|
|
2382
|
+
continue;
|
|
2383
|
+
const g = s.issues.length, p = f._zod.check(s);
|
|
2384
|
+
if (p instanceof Promise && c?.async === !1)
|
|
2385
|
+
throw new V();
|
|
2386
|
+
if (l || p instanceof Promise)
|
|
2387
|
+
l = (l ?? Promise.resolve()).then(async () => {
|
|
2388
|
+
await p, s.issues.length !== g && (u || (u = x(s, g)));
|
|
2389
|
+
});
|
|
2390
|
+
else {
|
|
2391
|
+
if (s.issues.length === g)
|
|
2392
|
+
continue;
|
|
2393
|
+
u || (u = x(s, g));
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
return l ? l.then(() => s) : s;
|
|
2397
|
+
}, i = (s, a, c) => {
|
|
2398
|
+
if (x(s))
|
|
2399
|
+
return s.aborted = !0, s;
|
|
2400
|
+
const u = o(a, r, c);
|
|
2401
|
+
if (u instanceof Promise) {
|
|
2402
|
+
if (c.async === !1)
|
|
2403
|
+
throw new V();
|
|
2404
|
+
return u.then((l) => e._zod.parse(l, c));
|
|
2405
|
+
}
|
|
2406
|
+
return e._zod.parse(u, c);
|
|
2407
|
+
};
|
|
2408
|
+
e._zod.run = (s, a) => {
|
|
2409
|
+
if (a.skipChecks)
|
|
2410
|
+
return e._zod.parse(s, a);
|
|
2411
|
+
if (a.direction === "backward") {
|
|
2412
|
+
const u = e._zod.parse({ value: s.value, issues: [] }, { ...a, skipChecks: !0 });
|
|
2413
|
+
return u instanceof Promise ? u.then((l) => i(l, s, a)) : i(u, s, a);
|
|
2414
|
+
}
|
|
2415
|
+
const c = e._zod.parse(s, a);
|
|
2416
|
+
if (c instanceof Promise) {
|
|
2417
|
+
if (a.async === !1)
|
|
2418
|
+
throw new V();
|
|
2419
|
+
return c.then((u) => o(u, r, a));
|
|
2420
|
+
}
|
|
2421
|
+
return o(c, r, a);
|
|
2422
|
+
};
|
|
2423
|
+
}
|
|
2424
|
+
_(e, "~standard", () => ({
|
|
2425
|
+
validate: (o) => {
|
|
2426
|
+
try {
|
|
2427
|
+
const i = lr(e, o);
|
|
2428
|
+
return i.success ? { value: i.data } : { issues: i.error?.issues };
|
|
2429
|
+
} catch {
|
|
2430
|
+
return fr(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
|
|
2431
|
+
}
|
|
2432
|
+
},
|
|
2433
|
+
vendor: "zod",
|
|
2434
|
+
version: 1
|
|
2435
|
+
}));
|
|
2436
|
+
}), Se = /* @__PURE__ */ d("$ZodString", (e, t) => {
|
|
2437
|
+
b.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Fr(e._zod.bag), e._zod.parse = (n, r) => {
|
|
2438
|
+
if (t.coerce)
|
|
2439
|
+
try {
|
|
2440
|
+
n.value = String(n.value);
|
|
2441
|
+
} catch {
|
|
2442
|
+
}
|
|
2443
|
+
return typeof n.value == "string" || n.issues.push({
|
|
2444
|
+
expected: "string",
|
|
2445
|
+
code: "invalid_type",
|
|
2446
|
+
input: n.value,
|
|
2447
|
+
inst: e
|
|
2448
|
+
}), n;
|
|
2449
|
+
};
|
|
2450
|
+
}), w = /* @__PURE__ */ d("$ZodStringFormat", (e, t) => {
|
|
2451
|
+
de.init(e, t), Se.init(e, t);
|
|
2452
|
+
}), so = /* @__PURE__ */ d("$ZodGUID", (e, t) => {
|
|
2453
|
+
t.pattern ?? (t.pattern = Tr), w.init(e, t);
|
|
2454
|
+
}), ao = /* @__PURE__ */ d("$ZodUUID", (e, t) => {
|
|
2455
|
+
if (t.version) {
|
|
2456
|
+
const r = {
|
|
2457
|
+
v1: 1,
|
|
2458
|
+
v2: 2,
|
|
2459
|
+
v3: 3,
|
|
2460
|
+
v4: 4,
|
|
2461
|
+
v5: 5,
|
|
2462
|
+
v6: 6,
|
|
2463
|
+
v7: 7,
|
|
2464
|
+
v8: 8
|
|
2465
|
+
}[t.version];
|
|
2466
|
+
if (r === void 0)
|
|
2467
|
+
throw new Error(`Invalid UUID version: "${t.version}"`);
|
|
2468
|
+
t.pattern ?? (t.pattern = Re(r));
|
|
2469
|
+
} else
|
|
2470
|
+
t.pattern ?? (t.pattern = Re());
|
|
2471
|
+
w.init(e, t);
|
|
2472
|
+
}), co = /* @__PURE__ */ d("$ZodEmail", (e, t) => {
|
|
2473
|
+
t.pattern ?? (t.pattern = Ir), w.init(e, t);
|
|
2474
|
+
}), uo = /* @__PURE__ */ d("$ZodURL", (e, t) => {
|
|
2475
|
+
w.init(e, t), e._zod.check = (n) => {
|
|
2476
|
+
try {
|
|
2477
|
+
const r = n.value.trim(), o = new URL(r);
|
|
2478
|
+
t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || n.issues.push({
|
|
2479
|
+
code: "invalid_format",
|
|
2480
|
+
format: "url",
|
|
2481
|
+
note: "Invalid hostname",
|
|
2482
|
+
pattern: t.hostname.source,
|
|
2483
|
+
input: n.value,
|
|
2484
|
+
inst: e,
|
|
2485
|
+
continue: !t.abort
|
|
2486
|
+
})), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(o.protocol.endsWith(":") ? o.protocol.slice(0, -1) : o.protocol) || n.issues.push({
|
|
2487
|
+
code: "invalid_format",
|
|
2488
|
+
format: "url",
|
|
2489
|
+
note: "Invalid protocol",
|
|
2490
|
+
pattern: t.protocol.source,
|
|
2491
|
+
input: n.value,
|
|
2492
|
+
inst: e,
|
|
2493
|
+
continue: !t.abort
|
|
2494
|
+
})), t.normalize ? n.value = o.href : n.value = r;
|
|
2495
|
+
return;
|
|
2496
|
+
} catch {
|
|
2497
|
+
n.issues.push({
|
|
2498
|
+
code: "invalid_format",
|
|
2499
|
+
format: "url",
|
|
2500
|
+
input: n.value,
|
|
2501
|
+
inst: e,
|
|
2502
|
+
continue: !t.abort
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
};
|
|
2506
|
+
}), lo = /* @__PURE__ */ d("$ZodEmoji", (e, t) => {
|
|
2507
|
+
t.pattern ?? (t.pattern = Pr()), w.init(e, t);
|
|
2508
|
+
}), fo = /* @__PURE__ */ d("$ZodNanoID", (e, t) => {
|
|
2509
|
+
t.pattern ?? (t.pattern = Er), w.init(e, t);
|
|
2510
|
+
}), po = /* @__PURE__ */ d("$ZodCUID", (e, t) => {
|
|
2511
|
+
t.pattern ?? (t.pattern = br), w.init(e, t);
|
|
2512
|
+
}), go = /* @__PURE__ */ d("$ZodCUID2", (e, t) => {
|
|
2513
|
+
t.pattern ?? (t.pattern = kr), w.init(e, t);
|
|
2514
|
+
}), ho = /* @__PURE__ */ d("$ZodULID", (e, t) => {
|
|
2515
|
+
t.pattern ?? (t.pattern = zr), w.init(e, t);
|
|
2516
|
+
}), mo = /* @__PURE__ */ d("$ZodXID", (e, t) => {
|
|
2517
|
+
t.pattern ?? (t.pattern = $r), w.init(e, t);
|
|
2518
|
+
}), _o = /* @__PURE__ */ d("$ZodKSUID", (e, t) => {
|
|
2519
|
+
t.pattern ?? (t.pattern = Sr), w.init(e, t);
|
|
2520
|
+
}), yo = /* @__PURE__ */ d("$ZodISODateTime", (e, t) => {
|
|
2521
|
+
t.pattern ?? (t.pattern = Mr(t)), w.init(e, t);
|
|
2522
|
+
}), vo = /* @__PURE__ */ d("$ZodISODate", (e, t) => {
|
|
2523
|
+
t.pattern ?? (t.pattern = Lr), w.init(e, t);
|
|
2524
|
+
}), wo = /* @__PURE__ */ d("$ZodISOTime", (e, t) => {
|
|
2525
|
+
t.pattern ?? (t.pattern = Ur(t)), w.init(e, t);
|
|
2526
|
+
}), bo = /* @__PURE__ */ d("$ZodISODuration", (e, t) => {
|
|
2527
|
+
t.pattern ?? (t.pattern = Zr), w.init(e, t);
|
|
2528
|
+
}), ko = /* @__PURE__ */ d("$ZodIPv4", (e, t) => {
|
|
2529
|
+
t.pattern ?? (t.pattern = Ar), w.init(e, t), e._zod.bag.format = "ipv4";
|
|
2530
|
+
}), zo = /* @__PURE__ */ d("$ZodIPv6", (e, t) => {
|
|
2531
|
+
t.pattern ?? (t.pattern = Nr), w.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
|
|
2532
|
+
try {
|
|
2533
|
+
new URL(`http://[${n.value}]`);
|
|
2534
|
+
} catch {
|
|
2535
|
+
n.issues.push({
|
|
2536
|
+
code: "invalid_format",
|
|
2537
|
+
format: "ipv6",
|
|
2538
|
+
input: n.value,
|
|
2539
|
+
inst: e,
|
|
2540
|
+
continue: !t.abort
|
|
2541
|
+
});
|
|
2542
|
+
}
|
|
2543
|
+
};
|
|
2544
|
+
}), $o = /* @__PURE__ */ d("$ZodCIDRv4", (e, t) => {
|
|
2545
|
+
t.pattern ?? (t.pattern = Cr), w.init(e, t);
|
|
2546
|
+
}), So = /* @__PURE__ */ d("$ZodCIDRv6", (e, t) => {
|
|
2547
|
+
t.pattern ?? (t.pattern = Rr), w.init(e, t), e._zod.check = (n) => {
|
|
2548
|
+
const r = n.value.split("/");
|
|
2549
|
+
try {
|
|
2550
|
+
if (r.length !== 2)
|
|
2551
|
+
throw new Error();
|
|
2552
|
+
const [o, i] = r;
|
|
2553
|
+
if (!i)
|
|
2554
|
+
throw new Error();
|
|
2555
|
+
const s = Number(i);
|
|
2556
|
+
if (`${s}` !== i)
|
|
2557
|
+
throw new Error();
|
|
2558
|
+
if (s < 0 || s > 128)
|
|
2559
|
+
throw new Error();
|
|
2560
|
+
new URL(`http://[${o}]`);
|
|
2561
|
+
} catch {
|
|
2562
|
+
n.issues.push({
|
|
2563
|
+
code: "invalid_format",
|
|
2564
|
+
format: "cidrv6",
|
|
2565
|
+
input: n.value,
|
|
2566
|
+
inst: e,
|
|
2567
|
+
continue: !t.abort
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
};
|
|
2571
|
+
});
|
|
2572
|
+
function bt(e) {
|
|
2573
|
+
if (e === "")
|
|
2574
|
+
return !0;
|
|
2575
|
+
if (e.length % 4 !== 0)
|
|
2576
|
+
return !1;
|
|
2577
|
+
try {
|
|
2578
|
+
return atob(e), !0;
|
|
2579
|
+
} catch {
|
|
2580
|
+
return !1;
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
const Eo = /* @__PURE__ */ d("$ZodBase64", (e, t) => {
|
|
2584
|
+
t.pattern ?? (t.pattern = Dr), w.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
|
|
2585
|
+
bt(n.value) || n.issues.push({
|
|
2586
|
+
code: "invalid_format",
|
|
2587
|
+
format: "base64",
|
|
2588
|
+
input: n.value,
|
|
2589
|
+
inst: e,
|
|
2590
|
+
continue: !t.abort
|
|
2591
|
+
});
|
|
2592
|
+
};
|
|
2593
|
+
});
|
|
2594
|
+
function Zo(e) {
|
|
2595
|
+
if (!gt.test(e))
|
|
2596
|
+
return !1;
|
|
2597
|
+
const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
|
|
2598
|
+
return bt(n);
|
|
2599
|
+
}
|
|
2600
|
+
const To = /* @__PURE__ */ d("$ZodBase64URL", (e, t) => {
|
|
2601
|
+
t.pattern ?? (t.pattern = gt), w.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
|
|
2602
|
+
Zo(n.value) || n.issues.push({
|
|
2603
|
+
code: "invalid_format",
|
|
2604
|
+
format: "base64url",
|
|
2605
|
+
input: n.value,
|
|
2606
|
+
inst: e,
|
|
2607
|
+
continue: !t.abort
|
|
2608
|
+
});
|
|
2609
|
+
};
|
|
2610
|
+
}), Io = /* @__PURE__ */ d("$ZodE164", (e, t) => {
|
|
2611
|
+
t.pattern ?? (t.pattern = jr), w.init(e, t);
|
|
2612
|
+
});
|
|
2613
|
+
function Oo(e, t = null) {
|
|
2614
|
+
try {
|
|
2615
|
+
const n = e.split(".");
|
|
2616
|
+
if (n.length !== 3)
|
|
2617
|
+
return !1;
|
|
2618
|
+
const [r] = n;
|
|
2619
|
+
if (!r)
|
|
2620
|
+
return !1;
|
|
2621
|
+
const o = JSON.parse(atob(r));
|
|
2622
|
+
return !("typ" in o && o?.typ !== "JWT" || !o.alg || t && (!("alg" in o) || o.alg !== t));
|
|
2623
|
+
} catch {
|
|
2624
|
+
return !1;
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
const Po = /* @__PURE__ */ d("$ZodJWT", (e, t) => {
|
|
2628
|
+
w.init(e, t), e._zod.check = (n) => {
|
|
2629
|
+
Oo(n.value, t.alg) || n.issues.push({
|
|
2630
|
+
code: "invalid_format",
|
|
2631
|
+
format: "jwt",
|
|
2632
|
+
input: n.value,
|
|
2633
|
+
inst: e,
|
|
2634
|
+
continue: !t.abort
|
|
2635
|
+
});
|
|
2636
|
+
};
|
|
2637
|
+
}), kt = /* @__PURE__ */ d("$ZodNumber", (e, t) => {
|
|
2638
|
+
b.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? _t, e._zod.parse = (n, r) => {
|
|
2639
|
+
if (t.coerce)
|
|
2640
|
+
try {
|
|
2641
|
+
n.value = Number(n.value);
|
|
2642
|
+
} catch {
|
|
2643
|
+
}
|
|
2644
|
+
const o = n.value;
|
|
2645
|
+
if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o))
|
|
2646
|
+
return n;
|
|
2647
|
+
const i = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
|
|
2648
|
+
return n.issues.push({
|
|
2649
|
+
expected: "number",
|
|
2650
|
+
code: "invalid_type",
|
|
2651
|
+
input: o,
|
|
2652
|
+
inst: e,
|
|
2653
|
+
...i ? { received: i } : {}
|
|
2654
|
+
}), n;
|
|
2655
|
+
};
|
|
2656
|
+
}), Ao = /* @__PURE__ */ d("$ZodNumberFormat", (e, t) => {
|
|
2657
|
+
Gr.init(e, t), kt.init(e, t);
|
|
2658
|
+
}), No = /* @__PURE__ */ d("$ZodBoolean", (e, t) => {
|
|
2659
|
+
b.init(e, t), e._zod.pattern = xr, e._zod.parse = (n, r) => {
|
|
2660
|
+
if (t.coerce)
|
|
2661
|
+
try {
|
|
2662
|
+
n.value = !!n.value;
|
|
2663
|
+
} catch {
|
|
2664
|
+
}
|
|
2665
|
+
const o = n.value;
|
|
2666
|
+
return typeof o == "boolean" || n.issues.push({
|
|
2667
|
+
expected: "boolean",
|
|
2668
|
+
code: "invalid_type",
|
|
2669
|
+
input: o,
|
|
2670
|
+
inst: e
|
|
2671
|
+
}), n;
|
|
2672
|
+
};
|
|
2673
|
+
}), Co = /* @__PURE__ */ d("$ZodUnknown", (e, t) => {
|
|
2674
|
+
b.init(e, t), e._zod.parse = (n) => n;
|
|
2675
|
+
}), Ro = /* @__PURE__ */ d("$ZodNever", (e, t) => {
|
|
2676
|
+
b.init(e, t), e._zod.parse = (n, r) => (n.issues.push({
|
|
2677
|
+
expected: "never",
|
|
2678
|
+
code: "invalid_type",
|
|
2679
|
+
input: n.value,
|
|
2680
|
+
inst: e
|
|
2681
|
+
}), n);
|
|
2682
|
+
});
|
|
2683
|
+
function De(e, t, n) {
|
|
2684
|
+
e.issues.length && t.issues.push(...q(n, e.issues)), t.value[n] = e.value;
|
|
2685
|
+
}
|
|
2686
|
+
const Do = /* @__PURE__ */ d("$ZodArray", (e, t) => {
|
|
2687
|
+
b.init(e, t), e._zod.parse = (n, r) => {
|
|
2688
|
+
const o = n.value;
|
|
2689
|
+
if (!Array.isArray(o))
|
|
2690
|
+
return n.issues.push({
|
|
2691
|
+
expected: "array",
|
|
2692
|
+
code: "invalid_type",
|
|
2693
|
+
input: o,
|
|
2694
|
+
inst: e
|
|
2695
|
+
}), n;
|
|
2696
|
+
n.value = Array(o.length);
|
|
2697
|
+
const i = [];
|
|
2698
|
+
for (let s = 0; s < o.length; s++) {
|
|
2699
|
+
const a = o[s], c = t.element._zod.run({
|
|
2700
|
+
value: a,
|
|
2701
|
+
issues: []
|
|
2702
|
+
}, r);
|
|
2703
|
+
c instanceof Promise ? i.push(c.then((u) => De(u, n, s))) : De(c, n, s);
|
|
2704
|
+
}
|
|
2705
|
+
return i.length ? Promise.all(i).then(() => n) : n;
|
|
2706
|
+
};
|
|
2707
|
+
});
|
|
2708
|
+
function ie(e, t, n, r, o) {
|
|
2709
|
+
if (e.issues.length) {
|
|
2710
|
+
if (o && !(n in r))
|
|
2711
|
+
return;
|
|
2712
|
+
t.issues.push(...q(n, e.issues));
|
|
2713
|
+
}
|
|
2714
|
+
e.value === void 0 ? n in r && (t.value[n] = void 0) : t.value[n] = e.value;
|
|
2715
|
+
}
|
|
2716
|
+
function zt(e) {
|
|
2717
|
+
const t = Object.keys(e.shape);
|
|
2718
|
+
for (const r of t)
|
|
2719
|
+
if (!e.shape?.[r]?._zod?.traits?.has("$ZodType"))
|
|
2720
|
+
throw new Error(`Invalid element at key "${r}": expected a Zod schema`);
|
|
2721
|
+
const n = er(e.shape);
|
|
2722
|
+
return {
|
|
2723
|
+
...e,
|
|
2724
|
+
keys: t,
|
|
2725
|
+
keySet: new Set(t),
|
|
2726
|
+
numKeys: t.length,
|
|
2727
|
+
optionalKeys: new Set(n)
|
|
2728
|
+
};
|
|
2729
|
+
}
|
|
2730
|
+
function $t(e, t, n, r, o, i) {
|
|
2731
|
+
const s = [], a = o.keySet, c = o.catchall._zod, u = c.def.type, l = c.optout === "optional";
|
|
2732
|
+
for (const f in t) {
|
|
2733
|
+
if (a.has(f))
|
|
2734
|
+
continue;
|
|
2735
|
+
if (u === "never") {
|
|
2736
|
+
s.push(f);
|
|
2737
|
+
continue;
|
|
2738
|
+
}
|
|
2739
|
+
const g = c.run({ value: t[f], issues: [] }, r);
|
|
2740
|
+
g instanceof Promise ? e.push(g.then((p) => ie(p, n, f, t, l))) : ie(g, n, f, t, l);
|
|
2741
|
+
}
|
|
2742
|
+
return s.length && n.issues.push({
|
|
2743
|
+
code: "unrecognized_keys",
|
|
2744
|
+
keys: s,
|
|
2745
|
+
input: t,
|
|
2746
|
+
inst: i
|
|
2747
|
+
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
2748
|
+
}
|
|
2749
|
+
const jo = /* @__PURE__ */ d("$ZodObject", (e, t) => {
|
|
2750
|
+
if (b.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
2751
|
+
const a = t.shape;
|
|
2752
|
+
Object.defineProperty(t, "shape", {
|
|
2753
|
+
get: () => {
|
|
2754
|
+
const c = { ...a };
|
|
2755
|
+
return Object.defineProperty(t, "shape", {
|
|
2756
|
+
value: c
|
|
2757
|
+
}), c;
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
const r = ve(() => zt(t));
|
|
2762
|
+
_(e._zod, "propValues", () => {
|
|
2763
|
+
const a = t.shape, c = {};
|
|
2764
|
+
for (const u in a) {
|
|
2765
|
+
const l = a[u]._zod;
|
|
2766
|
+
if (l.values) {
|
|
2767
|
+
c[u] ?? (c[u] = /* @__PURE__ */ new Set());
|
|
2768
|
+
for (const f of l.values)
|
|
2769
|
+
c[u].add(f);
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
return c;
|
|
2773
|
+
});
|
|
2774
|
+
const o = oe, i = t.catchall;
|
|
2775
|
+
let s;
|
|
2776
|
+
e._zod.parse = (a, c) => {
|
|
2777
|
+
s ?? (s = r.value);
|
|
2778
|
+
const u = a.value;
|
|
2779
|
+
if (!o(u))
|
|
2780
|
+
return a.issues.push({
|
|
2781
|
+
expected: "object",
|
|
2782
|
+
code: "invalid_type",
|
|
2783
|
+
input: u,
|
|
2784
|
+
inst: e
|
|
2785
|
+
}), a;
|
|
2786
|
+
a.value = {};
|
|
2787
|
+
const l = [], f = s.shape;
|
|
2788
|
+
for (const g of s.keys) {
|
|
2789
|
+
const p = f[g], m = p._zod.optout === "optional", v = p._zod.run({ value: u[g], issues: [] }, c);
|
|
2790
|
+
v instanceof Promise ? l.push(v.then((A) => ie(A, a, g, u, m))) : ie(v, a, g, u, m);
|
|
2791
|
+
}
|
|
2792
|
+
return i ? $t(l, u, a, c, r.value, e) : l.length ? Promise.all(l).then(() => a) : a;
|
|
2793
|
+
};
|
|
2794
|
+
}), Lo = /* @__PURE__ */ d("$ZodObjectJIT", (e, t) => {
|
|
2795
|
+
jo.init(e, t);
|
|
2796
|
+
const n = e._zod.parse, r = ve(() => zt(t)), o = (g) => {
|
|
2797
|
+
const p = new oo(["shape", "payload", "ctx"]), m = r.value, v = (Z) => {
|
|
2798
|
+
const T = Ce(Z);
|
|
2799
|
+
return `shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`;
|
|
2800
|
+
};
|
|
2801
|
+
p.write("const input = payload.value;");
|
|
2802
|
+
const A = /* @__PURE__ */ Object.create(null);
|
|
2803
|
+
let H = 0;
|
|
2804
|
+
for (const Z of m.keys)
|
|
2805
|
+
A[Z] = `key_${H++}`;
|
|
2806
|
+
p.write("const newResult = {};");
|
|
2807
|
+
for (const Z of m.keys) {
|
|
2808
|
+
const T = A[Z], P = Ce(Z), Dt = g[Z]?._zod?.optout === "optional";
|
|
2809
|
+
p.write(`const ${T} = ${v(Z)};`), Dt ? p.write(`
|
|
2810
|
+
if (${T}.issues.length) {
|
|
2811
|
+
if (${P} in input) {
|
|
2812
|
+
payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
|
|
2813
|
+
...iss,
|
|
2814
|
+
path: iss.path ? [${P}, ...iss.path] : [${P}]
|
|
2815
|
+
})));
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
if (${T}.value === undefined) {
|
|
2820
|
+
if (${P} in input) {
|
|
2821
|
+
newResult[${P}] = undefined;
|
|
2822
|
+
}
|
|
2823
|
+
} else {
|
|
2824
|
+
newResult[${P}] = ${T}.value;
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
`) : p.write(`
|
|
2828
|
+
if (${T}.issues.length) {
|
|
2829
|
+
payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
|
|
2830
|
+
...iss,
|
|
2831
|
+
path: iss.path ? [${P}, ...iss.path] : [${P}]
|
|
2832
|
+
})));
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
if (${T}.value === undefined) {
|
|
2836
|
+
if (${P} in input) {
|
|
2837
|
+
newResult[${P}] = undefined;
|
|
2838
|
+
}
|
|
2839
|
+
} else {
|
|
2840
|
+
newResult[${P}] = ${T}.value;
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
`);
|
|
2844
|
+
}
|
|
2845
|
+
p.write("payload.value = newResult;"), p.write("return payload;");
|
|
2846
|
+
const le = p.compile();
|
|
2847
|
+
return (Z, T) => le(g, Z, T);
|
|
2848
|
+
};
|
|
2849
|
+
let i;
|
|
2850
|
+
const s = oe, a = !at.jitless, u = a && Qn.value, l = t.catchall;
|
|
2851
|
+
let f;
|
|
2852
|
+
e._zod.parse = (g, p) => {
|
|
2853
|
+
f ?? (f = r.value);
|
|
2854
|
+
const m = g.value;
|
|
2855
|
+
return s(m) ? a && u && p?.async === !1 && p.jitless !== !0 ? (i || (i = o(t.shape)), g = i(g, p), l ? $t([], m, g, p, f, e) : g) : n(g, p) : (g.issues.push({
|
|
2856
|
+
expected: "object",
|
|
2857
|
+
code: "invalid_type",
|
|
2858
|
+
input: m,
|
|
2859
|
+
inst: e
|
|
2860
|
+
}), g);
|
|
2861
|
+
};
|
|
2862
|
+
});
|
|
2863
|
+
function je(e, t, n, r) {
|
|
2864
|
+
for (const i of e)
|
|
2865
|
+
if (i.issues.length === 0)
|
|
2866
|
+
return t.value = i.value, t;
|
|
2867
|
+
const o = e.filter((i) => !x(i));
|
|
2868
|
+
return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
|
|
2869
|
+
code: "invalid_union",
|
|
2870
|
+
input: t.value,
|
|
2871
|
+
inst: n,
|
|
2872
|
+
errors: e.map((i) => i.issues.map((s) => R(s, r, C())))
|
|
2873
|
+
}), t);
|
|
2874
|
+
}
|
|
2875
|
+
const Uo = /* @__PURE__ */ d("$ZodUnion", (e, t) => {
|
|
2876
|
+
b.init(e, t), _(e._zod, "optin", () => t.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0), _(e._zod, "optout", () => t.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0), _(e._zod, "values", () => {
|
|
2877
|
+
if (t.options.every((o) => o._zod.values))
|
|
2878
|
+
return new Set(t.options.flatMap((o) => Array.from(o._zod.values)));
|
|
2879
|
+
}), _(e._zod, "pattern", () => {
|
|
2880
|
+
if (t.options.every((o) => o._zod.pattern)) {
|
|
2881
|
+
const o = t.options.map((i) => i._zod.pattern);
|
|
2882
|
+
return new RegExp(`^(${o.map((i) => be(i.source)).join("|")})$`);
|
|
2883
|
+
}
|
|
2884
|
+
});
|
|
2885
|
+
const n = t.options.length === 1, r = t.options[0]._zod.run;
|
|
2886
|
+
e._zod.parse = (o, i) => {
|
|
2887
|
+
if (n)
|
|
2888
|
+
return r(o, i);
|
|
2889
|
+
let s = !1;
|
|
2890
|
+
const a = [];
|
|
2891
|
+
for (const c of t.options) {
|
|
2892
|
+
const u = c._zod.run({
|
|
2893
|
+
value: o.value,
|
|
2894
|
+
issues: []
|
|
2895
|
+
}, i);
|
|
2896
|
+
if (u instanceof Promise)
|
|
2897
|
+
a.push(u), s = !0;
|
|
2898
|
+
else {
|
|
2899
|
+
if (u.issues.length === 0)
|
|
2900
|
+
return u;
|
|
2901
|
+
a.push(u);
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
return s ? Promise.all(a).then((c) => je(c, o, e, i)) : je(a, o, e, i);
|
|
2905
|
+
};
|
|
2906
|
+
}), Mo = /* @__PURE__ */ d("$ZodIntersection", (e, t) => {
|
|
2907
|
+
b.init(e, t), e._zod.parse = (n, r) => {
|
|
2908
|
+
const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r), s = t.right._zod.run({ value: o, issues: [] }, r);
|
|
2909
|
+
return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([c, u]) => Le(n, c, u)) : Le(n, i, s);
|
|
2910
|
+
};
|
|
2911
|
+
});
|
|
2912
|
+
function he(e, t) {
|
|
2913
|
+
if (e === t)
|
|
2914
|
+
return { valid: !0, data: e };
|
|
2915
|
+
if (e instanceof Date && t instanceof Date && +e == +t)
|
|
2916
|
+
return { valid: !0, data: e };
|
|
2917
|
+
if (B(e) && B(t)) {
|
|
2918
|
+
const n = Object.keys(t), r = Object.keys(e).filter((i) => n.indexOf(i) !== -1), o = { ...e, ...t };
|
|
2919
|
+
for (const i of r) {
|
|
2920
|
+
const s = he(e[i], t[i]);
|
|
2921
|
+
if (!s.valid)
|
|
2922
|
+
return {
|
|
2923
|
+
valid: !1,
|
|
2924
|
+
mergeErrorPath: [i, ...s.mergeErrorPath]
|
|
2925
|
+
};
|
|
2926
|
+
o[i] = s.data;
|
|
2927
|
+
}
|
|
2928
|
+
return { valid: !0, data: o };
|
|
2929
|
+
}
|
|
2930
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
2931
|
+
if (e.length !== t.length)
|
|
2932
|
+
return { valid: !1, mergeErrorPath: [] };
|
|
2933
|
+
const n = [];
|
|
2934
|
+
for (let r = 0; r < e.length; r++) {
|
|
2935
|
+
const o = e[r], i = t[r], s = he(o, i);
|
|
2936
|
+
if (!s.valid)
|
|
2937
|
+
return {
|
|
2938
|
+
valid: !1,
|
|
2939
|
+
mergeErrorPath: [r, ...s.mergeErrorPath]
|
|
2940
|
+
};
|
|
2941
|
+
n.push(s.data);
|
|
2942
|
+
}
|
|
2943
|
+
return { valid: !0, data: n };
|
|
2944
|
+
}
|
|
2945
|
+
return { valid: !1, mergeErrorPath: [] };
|
|
2946
|
+
}
|
|
2947
|
+
function Le(e, t, n) {
|
|
2948
|
+
const r = /* @__PURE__ */ new Map();
|
|
2949
|
+
let o;
|
|
2950
|
+
for (const a of t.issues)
|
|
2951
|
+
if (a.code === "unrecognized_keys") {
|
|
2952
|
+
o ?? (o = a);
|
|
2953
|
+
for (const c of a.keys)
|
|
2954
|
+
r.has(c) || r.set(c, {}), r.get(c).l = !0;
|
|
2955
|
+
} else
|
|
2956
|
+
e.issues.push(a);
|
|
2957
|
+
for (const a of n.issues)
|
|
2958
|
+
if (a.code === "unrecognized_keys")
|
|
2959
|
+
for (const c of a.keys)
|
|
2960
|
+
r.has(c) || r.set(c, {}), r.get(c).r = !0;
|
|
2961
|
+
else
|
|
2962
|
+
e.issues.push(a);
|
|
2963
|
+
const i = [...r].filter(([, a]) => a.l && a.r).map(([a]) => a);
|
|
2964
|
+
if (i.length && o && e.issues.push({ ...o, keys: i }), x(e))
|
|
2965
|
+
return e;
|
|
2966
|
+
const s = he(t.value, n.value);
|
|
2967
|
+
if (!s.valid)
|
|
2968
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);
|
|
2969
|
+
return e.value = s.data, e;
|
|
2970
|
+
}
|
|
2971
|
+
const Fo = /* @__PURE__ */ d("$ZodRecord", (e, t) => {
|
|
2972
|
+
b.init(e, t), e._zod.parse = (n, r) => {
|
|
2973
|
+
const o = n.value;
|
|
2974
|
+
if (!B(o))
|
|
2975
|
+
return n.issues.push({
|
|
2976
|
+
expected: "record",
|
|
2977
|
+
code: "invalid_type",
|
|
2978
|
+
input: o,
|
|
2979
|
+
inst: e
|
|
2980
|
+
}), n;
|
|
2981
|
+
const i = [], s = t.keyType._zod.values;
|
|
2982
|
+
if (s) {
|
|
2983
|
+
n.value = {};
|
|
2984
|
+
const a = /* @__PURE__ */ new Set();
|
|
2985
|
+
for (const u of s)
|
|
2986
|
+
if (typeof u == "string" || typeof u == "number" || typeof u == "symbol") {
|
|
2987
|
+
a.add(typeof u == "number" ? u.toString() : u);
|
|
2988
|
+
const l = t.valueType._zod.run({ value: o[u], issues: [] }, r);
|
|
2989
|
+
l instanceof Promise ? i.push(l.then((f) => {
|
|
2990
|
+
f.issues.length && n.issues.push(...q(u, f.issues)), n.value[u] = f.value;
|
|
2991
|
+
})) : (l.issues.length && n.issues.push(...q(u, l.issues)), n.value[u] = l.value);
|
|
2992
|
+
}
|
|
2993
|
+
let c;
|
|
2994
|
+
for (const u in o)
|
|
2995
|
+
a.has(u) || (c = c ?? [], c.push(u));
|
|
2996
|
+
c && c.length > 0 && n.issues.push({
|
|
2997
|
+
code: "unrecognized_keys",
|
|
2998
|
+
input: o,
|
|
2999
|
+
inst: e,
|
|
3000
|
+
keys: c
|
|
3001
|
+
});
|
|
3002
|
+
} else {
|
|
3003
|
+
n.value = {};
|
|
3004
|
+
for (const a of Reflect.ownKeys(o)) {
|
|
3005
|
+
if (a === "__proto__")
|
|
3006
|
+
continue;
|
|
3007
|
+
let c = t.keyType._zod.run({ value: a, issues: [] }, r);
|
|
3008
|
+
if (c instanceof Promise)
|
|
3009
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
3010
|
+
if (typeof a == "string" && _t.test(a) && c.issues.length) {
|
|
3011
|
+
const f = t.keyType._zod.run({ value: Number(a), issues: [] }, r);
|
|
3012
|
+
if (f instanceof Promise)
|
|
3013
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
3014
|
+
f.issues.length === 0 && (c = f);
|
|
3015
|
+
}
|
|
3016
|
+
if (c.issues.length) {
|
|
3017
|
+
t.mode === "loose" ? n.value[a] = o[a] : n.issues.push({
|
|
3018
|
+
code: "invalid_key",
|
|
3019
|
+
origin: "record",
|
|
3020
|
+
issues: c.issues.map((f) => R(f, r, C())),
|
|
3021
|
+
input: a,
|
|
3022
|
+
path: [a],
|
|
3023
|
+
inst: e
|
|
3024
|
+
});
|
|
3025
|
+
continue;
|
|
3026
|
+
}
|
|
3027
|
+
const l = t.valueType._zod.run({ value: o[a], issues: [] }, r);
|
|
3028
|
+
l instanceof Promise ? i.push(l.then((f) => {
|
|
3029
|
+
f.issues.length && n.issues.push(...q(a, f.issues)), n.value[c.value] = f.value;
|
|
3030
|
+
})) : (l.issues.length && n.issues.push(...q(a, l.issues)), n.value[c.value] = l.value);
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
return i.length ? Promise.all(i).then(() => n) : n;
|
|
3034
|
+
};
|
|
3035
|
+
}), Jo = /* @__PURE__ */ d("$ZodEnum", (e, t) => {
|
|
3036
|
+
b.init(e, t);
|
|
3037
|
+
const n = ct(t.entries), r = new Set(n);
|
|
3038
|
+
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => Xn.has(typeof o)).map((o) => typeof o == "string" ? G(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
|
|
3039
|
+
const s = o.value;
|
|
3040
|
+
return r.has(s) || o.issues.push({
|
|
3041
|
+
code: "invalid_value",
|
|
3042
|
+
values: n,
|
|
3043
|
+
input: s,
|
|
3044
|
+
inst: e
|
|
3045
|
+
}), o;
|
|
3046
|
+
};
|
|
3047
|
+
}), xo = /* @__PURE__ */ d("$ZodLiteral", (e, t) => {
|
|
3048
|
+
if (b.init(e, t), t.values.length === 0)
|
|
3049
|
+
throw new Error("Cannot create literal schema with no valid values");
|
|
3050
|
+
const n = new Set(t.values);
|
|
3051
|
+
e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((r) => typeof r == "string" ? G(r) : r ? G(r.toString()) : String(r)).join("|")})$`), e._zod.parse = (r, o) => {
|
|
3052
|
+
const i = r.value;
|
|
3053
|
+
return n.has(i) || r.issues.push({
|
|
3054
|
+
code: "invalid_value",
|
|
3055
|
+
values: t.values,
|
|
3056
|
+
input: i,
|
|
3057
|
+
inst: e
|
|
3058
|
+
}), r;
|
|
3059
|
+
};
|
|
3060
|
+
}), qo = /* @__PURE__ */ d("$ZodTransform", (e, t) => {
|
|
3061
|
+
b.init(e, t), e._zod.parse = (n, r) => {
|
|
3062
|
+
if (r.direction === "backward")
|
|
3063
|
+
throw new st(e.constructor.name);
|
|
3064
|
+
const o = t.transform(n.value, n);
|
|
3065
|
+
if (r.async)
|
|
3066
|
+
return (o instanceof Promise ? o : Promise.resolve(o)).then((s) => (n.value = s, n));
|
|
3067
|
+
if (o instanceof Promise)
|
|
3068
|
+
throw new V();
|
|
3069
|
+
return n.value = o, n;
|
|
3070
|
+
};
|
|
3071
|
+
});
|
|
3072
|
+
function Ue(e, t) {
|
|
3073
|
+
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
|
|
3074
|
+
}
|
|
3075
|
+
const St = /* @__PURE__ */ d("$ZodOptional", (e, t) => {
|
|
3076
|
+
b.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", _(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), _(e._zod, "pattern", () => {
|
|
3077
|
+
const n = t.innerType._zod.pattern;
|
|
3078
|
+
return n ? new RegExp(`^(${be(n.source)})?$`) : void 0;
|
|
3079
|
+
}), e._zod.parse = (n, r) => {
|
|
3080
|
+
if (t.innerType._zod.optin === "optional") {
|
|
3081
|
+
const o = t.innerType._zod.run(n, r);
|
|
3082
|
+
return o instanceof Promise ? o.then((i) => Ue(i, n.value)) : Ue(o, n.value);
|
|
3083
|
+
}
|
|
3084
|
+
return n.value === void 0 ? n : t.innerType._zod.run(n, r);
|
|
3085
|
+
};
|
|
3086
|
+
}), Vo = /* @__PURE__ */ d("$ZodExactOptional", (e, t) => {
|
|
3087
|
+
St.init(e, t), _(e._zod, "values", () => t.innerType._zod.values), _(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (n, r) => t.innerType._zod.run(n, r);
|
|
3088
|
+
}), Bo = /* @__PURE__ */ d("$ZodNullable", (e, t) => {
|
|
3089
|
+
b.init(e, t), _(e._zod, "optin", () => t.innerType._zod.optin), _(e._zod, "optout", () => t.innerType._zod.optout), _(e._zod, "pattern", () => {
|
|
3090
|
+
const n = t.innerType._zod.pattern;
|
|
3091
|
+
return n ? new RegExp(`^(${be(n.source)}|null)$`) : void 0;
|
|
3092
|
+
}), _(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, r) => n.value === null ? n : t.innerType._zod.run(n, r);
|
|
3093
|
+
}), Go = /* @__PURE__ */ d("$ZodDefault", (e, t) => {
|
|
3094
|
+
b.init(e, t), e._zod.optin = "optional", _(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
3095
|
+
if (r.direction === "backward")
|
|
3096
|
+
return t.innerType._zod.run(n, r);
|
|
3097
|
+
if (n.value === void 0)
|
|
3098
|
+
return n.value = t.defaultValue, n;
|
|
3099
|
+
const o = t.innerType._zod.run(n, r);
|
|
3100
|
+
return o instanceof Promise ? o.then((i) => Me(i, t)) : Me(o, t);
|
|
3101
|
+
};
|
|
3102
|
+
});
|
|
3103
|
+
function Me(e, t) {
|
|
3104
|
+
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
3105
|
+
}
|
|
3106
|
+
const Wo = /* @__PURE__ */ d("$ZodPrefault", (e, t) => {
|
|
3107
|
+
b.init(e, t), e._zod.optin = "optional", _(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => (r.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, r));
|
|
3108
|
+
}), Ho = /* @__PURE__ */ d("$ZodNonOptional", (e, t) => {
|
|
3109
|
+
b.init(e, t), _(e._zod, "values", () => {
|
|
3110
|
+
const n = t.innerType._zod.values;
|
|
3111
|
+
return n ? new Set([...n].filter((r) => r !== void 0)) : void 0;
|
|
3112
|
+
}), e._zod.parse = (n, r) => {
|
|
3113
|
+
const o = t.innerType._zod.run(n, r);
|
|
3114
|
+
return o instanceof Promise ? o.then((i) => Fe(i, e)) : Fe(o, e);
|
|
3115
|
+
};
|
|
3116
|
+
});
|
|
3117
|
+
function Fe(e, t) {
|
|
3118
|
+
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
3119
|
+
code: "invalid_type",
|
|
3120
|
+
expected: "nonoptional",
|
|
3121
|
+
input: e.value,
|
|
3122
|
+
inst: t
|
|
3123
|
+
}), e;
|
|
3124
|
+
}
|
|
3125
|
+
const Ko = /* @__PURE__ */ d("$ZodCatch", (e, t) => {
|
|
3126
|
+
b.init(e, t), _(e._zod, "optin", () => t.innerType._zod.optin), _(e._zod, "optout", () => t.innerType._zod.optout), _(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
3127
|
+
if (r.direction === "backward")
|
|
3128
|
+
return t.innerType._zod.run(n, r);
|
|
3129
|
+
const o = t.innerType._zod.run(n, r);
|
|
3130
|
+
return o instanceof Promise ? o.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
|
|
3131
|
+
...n,
|
|
3132
|
+
error: {
|
|
3133
|
+
issues: i.issues.map((s) => R(s, r, C()))
|
|
3134
|
+
},
|
|
3135
|
+
input: n.value
|
|
3136
|
+
}), n.issues = []), n)) : (n.value = o.value, o.issues.length && (n.value = t.catchValue({
|
|
3137
|
+
...n,
|
|
3138
|
+
error: {
|
|
3139
|
+
issues: o.issues.map((i) => R(i, r, C()))
|
|
3140
|
+
},
|
|
3141
|
+
input: n.value
|
|
3142
|
+
}), n.issues = []), n);
|
|
3143
|
+
};
|
|
3144
|
+
}), Yo = /* @__PURE__ */ d("$ZodPipe", (e, t) => {
|
|
3145
|
+
b.init(e, t), _(e._zod, "values", () => t.in._zod.values), _(e._zod, "optin", () => t.in._zod.optin), _(e._zod, "optout", () => t.out._zod.optout), _(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, r) => {
|
|
3146
|
+
if (r.direction === "backward") {
|
|
3147
|
+
const i = t.out._zod.run(n, r);
|
|
3148
|
+
return i instanceof Promise ? i.then((s) => ne(s, t.in, r)) : ne(i, t.in, r);
|
|
3149
|
+
}
|
|
3150
|
+
const o = t.in._zod.run(n, r);
|
|
3151
|
+
return o instanceof Promise ? o.then((i) => ne(i, t.out, r)) : ne(o, t.out, r);
|
|
3152
|
+
};
|
|
3153
|
+
});
|
|
3154
|
+
function ne(e, t, n) {
|
|
3155
|
+
return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues }, n);
|
|
3156
|
+
}
|
|
3157
|
+
const Qo = /* @__PURE__ */ d("$ZodReadonly", (e, t) => {
|
|
3158
|
+
b.init(e, t), _(e._zod, "propValues", () => t.innerType._zod.propValues), _(e._zod, "values", () => t.innerType._zod.values), _(e._zod, "optin", () => t.innerType?._zod?.optin), _(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (n, r) => {
|
|
3159
|
+
if (r.direction === "backward")
|
|
3160
|
+
return t.innerType._zod.run(n, r);
|
|
3161
|
+
const o = t.innerType._zod.run(n, r);
|
|
3162
|
+
return o instanceof Promise ? o.then(Je) : Je(o);
|
|
3163
|
+
};
|
|
3164
|
+
});
|
|
3165
|
+
function Je(e) {
|
|
3166
|
+
return e.value = Object.freeze(e.value), e;
|
|
3167
|
+
}
|
|
3168
|
+
const Xo = /* @__PURE__ */ d("$ZodCustom", (e, t) => {
|
|
3169
|
+
I.init(e, t), b.init(e, t), e._zod.parse = (n, r) => n, e._zod.check = (n) => {
|
|
3170
|
+
const r = n.value, o = t.fn(r);
|
|
3171
|
+
if (o instanceof Promise)
|
|
3172
|
+
return o.then((i) => xe(i, n, r, e));
|
|
3173
|
+
xe(o, n, r, e);
|
|
3174
|
+
};
|
|
3175
|
+
});
|
|
3176
|
+
function xe(e, t, n, r) {
|
|
3177
|
+
if (!e) {
|
|
3178
|
+
const o = {
|
|
3179
|
+
code: "custom",
|
|
3180
|
+
input: n,
|
|
3181
|
+
inst: r,
|
|
3182
|
+
// incorporates params.error into issue reporting
|
|
3183
|
+
path: [...r._zod.def.path ?? []],
|
|
3184
|
+
// incorporates params.error into issue reporting
|
|
3185
|
+
continue: !r._zod.def.abort
|
|
3186
|
+
// params: inst._zod.def.params,
|
|
3187
|
+
};
|
|
3188
|
+
r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(ee(o));
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
var qe;
|
|
3192
|
+
class ei {
|
|
3193
|
+
constructor() {
|
|
3194
|
+
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
3195
|
+
}
|
|
3196
|
+
add(t, ...n) {
|
|
3197
|
+
const r = n[0];
|
|
3198
|
+
return this._map.set(t, r), r && typeof r == "object" && "id" in r && this._idmap.set(r.id, t), this;
|
|
3199
|
+
}
|
|
3200
|
+
clear() {
|
|
3201
|
+
return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
|
|
3202
|
+
}
|
|
3203
|
+
remove(t) {
|
|
3204
|
+
const n = this._map.get(t);
|
|
3205
|
+
return n && typeof n == "object" && "id" in n && this._idmap.delete(n.id), this._map.delete(t), this;
|
|
3206
|
+
}
|
|
3207
|
+
get(t) {
|
|
3208
|
+
const n = t._zod.parent;
|
|
3209
|
+
if (n) {
|
|
3210
|
+
const r = { ...this.get(n) ?? {} };
|
|
3211
|
+
delete r.id;
|
|
3212
|
+
const o = { ...r, ...this._map.get(t) };
|
|
3213
|
+
return Object.keys(o).length ? o : void 0;
|
|
3214
|
+
}
|
|
3215
|
+
return this._map.get(t);
|
|
3216
|
+
}
|
|
3217
|
+
has(t) {
|
|
3218
|
+
return this._map.has(t);
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
function ti() {
|
|
3222
|
+
return new ei();
|
|
3223
|
+
}
|
|
3224
|
+
(qe = globalThis).__zod_globalRegistry ?? (qe.__zod_globalRegistry = ti());
|
|
3225
|
+
const Q = globalThis.__zod_globalRegistry;
|
|
3226
|
+
// @__NO_SIDE_EFFECTS__
|
|
3227
|
+
function ni(e, t) {
|
|
3228
|
+
return new e({
|
|
3229
|
+
type: "string",
|
|
3230
|
+
...h(t)
|
|
3231
|
+
});
|
|
3232
|
+
}
|
|
3233
|
+
// @__NO_SIDE_EFFECTS__
|
|
3234
|
+
function ri(e, t) {
|
|
3235
|
+
return new e({
|
|
3236
|
+
type: "string",
|
|
3237
|
+
format: "email",
|
|
3238
|
+
check: "string_format",
|
|
3239
|
+
abort: !1,
|
|
3240
|
+
...h(t)
|
|
3241
|
+
});
|
|
3242
|
+
}
|
|
3243
|
+
// @__NO_SIDE_EFFECTS__
|
|
3244
|
+
function Ve(e, t) {
|
|
3245
|
+
return new e({
|
|
3246
|
+
type: "string",
|
|
3247
|
+
format: "guid",
|
|
3248
|
+
check: "string_format",
|
|
3249
|
+
abort: !1,
|
|
3250
|
+
...h(t)
|
|
3251
|
+
});
|
|
3252
|
+
}
|
|
3253
|
+
// @__NO_SIDE_EFFECTS__
|
|
3254
|
+
function oi(e, t) {
|
|
3255
|
+
return new e({
|
|
3256
|
+
type: "string",
|
|
3257
|
+
format: "uuid",
|
|
3258
|
+
check: "string_format",
|
|
3259
|
+
abort: !1,
|
|
3260
|
+
...h(t)
|
|
3261
|
+
});
|
|
3262
|
+
}
|
|
3263
|
+
// @__NO_SIDE_EFFECTS__
|
|
3264
|
+
function ii(e, t) {
|
|
3265
|
+
return new e({
|
|
3266
|
+
type: "string",
|
|
3267
|
+
format: "uuid",
|
|
3268
|
+
check: "string_format",
|
|
3269
|
+
abort: !1,
|
|
3270
|
+
version: "v4",
|
|
3271
|
+
...h(t)
|
|
3272
|
+
});
|
|
3273
|
+
}
|
|
3274
|
+
// @__NO_SIDE_EFFECTS__
|
|
3275
|
+
function si(e, t) {
|
|
3276
|
+
return new e({
|
|
3277
|
+
type: "string",
|
|
3278
|
+
format: "uuid",
|
|
3279
|
+
check: "string_format",
|
|
3280
|
+
abort: !1,
|
|
3281
|
+
version: "v6",
|
|
3282
|
+
...h(t)
|
|
3283
|
+
});
|
|
3284
|
+
}
|
|
3285
|
+
// @__NO_SIDE_EFFECTS__
|
|
3286
|
+
function ai(e, t) {
|
|
3287
|
+
return new e({
|
|
3288
|
+
type: "string",
|
|
3289
|
+
format: "uuid",
|
|
3290
|
+
check: "string_format",
|
|
3291
|
+
abort: !1,
|
|
3292
|
+
version: "v7",
|
|
3293
|
+
...h(t)
|
|
3294
|
+
});
|
|
3295
|
+
}
|
|
3296
|
+
// @__NO_SIDE_EFFECTS__
|
|
3297
|
+
function ci(e, t) {
|
|
3298
|
+
return new e({
|
|
3299
|
+
type: "string",
|
|
3300
|
+
format: "url",
|
|
3301
|
+
check: "string_format",
|
|
3302
|
+
abort: !1,
|
|
3303
|
+
...h(t)
|
|
3304
|
+
});
|
|
3305
|
+
}
|
|
3306
|
+
// @__NO_SIDE_EFFECTS__
|
|
3307
|
+
function ui(e, t) {
|
|
3308
|
+
return new e({
|
|
3309
|
+
type: "string",
|
|
3310
|
+
format: "emoji",
|
|
3311
|
+
check: "string_format",
|
|
3312
|
+
abort: !1,
|
|
3313
|
+
...h(t)
|
|
3314
|
+
});
|
|
3315
|
+
}
|
|
3316
|
+
// @__NO_SIDE_EFFECTS__
|
|
3317
|
+
function di(e, t) {
|
|
3318
|
+
return new e({
|
|
3319
|
+
type: "string",
|
|
3320
|
+
format: "nanoid",
|
|
3321
|
+
check: "string_format",
|
|
3322
|
+
abort: !1,
|
|
3323
|
+
...h(t)
|
|
3324
|
+
});
|
|
3325
|
+
}
|
|
3326
|
+
// @__NO_SIDE_EFFECTS__
|
|
3327
|
+
function li(e, t) {
|
|
3328
|
+
return new e({
|
|
3329
|
+
type: "string",
|
|
3330
|
+
format: "cuid",
|
|
3331
|
+
check: "string_format",
|
|
3332
|
+
abort: !1,
|
|
3333
|
+
...h(t)
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
3336
|
+
// @__NO_SIDE_EFFECTS__
|
|
3337
|
+
function fi(e, t) {
|
|
3338
|
+
return new e({
|
|
3339
|
+
type: "string",
|
|
3340
|
+
format: "cuid2",
|
|
3341
|
+
check: "string_format",
|
|
3342
|
+
abort: !1,
|
|
3343
|
+
...h(t)
|
|
3344
|
+
});
|
|
3345
|
+
}
|
|
3346
|
+
// @__NO_SIDE_EFFECTS__
|
|
3347
|
+
function pi(e, t) {
|
|
3348
|
+
return new e({
|
|
3349
|
+
type: "string",
|
|
3350
|
+
format: "ulid",
|
|
3351
|
+
check: "string_format",
|
|
3352
|
+
abort: !1,
|
|
3353
|
+
...h(t)
|
|
3354
|
+
});
|
|
3355
|
+
}
|
|
3356
|
+
// @__NO_SIDE_EFFECTS__
|
|
3357
|
+
function gi(e, t) {
|
|
3358
|
+
return new e({
|
|
3359
|
+
type: "string",
|
|
3360
|
+
format: "xid",
|
|
3361
|
+
check: "string_format",
|
|
3362
|
+
abort: !1,
|
|
3363
|
+
...h(t)
|
|
3364
|
+
});
|
|
3365
|
+
}
|
|
3366
|
+
// @__NO_SIDE_EFFECTS__
|
|
3367
|
+
function hi(e, t) {
|
|
3368
|
+
return new e({
|
|
3369
|
+
type: "string",
|
|
3370
|
+
format: "ksuid",
|
|
3371
|
+
check: "string_format",
|
|
3372
|
+
abort: !1,
|
|
3373
|
+
...h(t)
|
|
3374
|
+
});
|
|
3375
|
+
}
|
|
3376
|
+
// @__NO_SIDE_EFFECTS__
|
|
3377
|
+
function mi(e, t) {
|
|
3378
|
+
return new e({
|
|
3379
|
+
type: "string",
|
|
3380
|
+
format: "ipv4",
|
|
3381
|
+
check: "string_format",
|
|
3382
|
+
abort: !1,
|
|
3383
|
+
...h(t)
|
|
3384
|
+
});
|
|
3385
|
+
}
|
|
3386
|
+
// @__NO_SIDE_EFFECTS__
|
|
3387
|
+
function _i(e, t) {
|
|
3388
|
+
return new e({
|
|
3389
|
+
type: "string",
|
|
3390
|
+
format: "ipv6",
|
|
3391
|
+
check: "string_format",
|
|
3392
|
+
abort: !1,
|
|
3393
|
+
...h(t)
|
|
3394
|
+
});
|
|
3395
|
+
}
|
|
3396
|
+
// @__NO_SIDE_EFFECTS__
|
|
3397
|
+
function yi(e, t) {
|
|
3398
|
+
return new e({
|
|
3399
|
+
type: "string",
|
|
3400
|
+
format: "cidrv4",
|
|
3401
|
+
check: "string_format",
|
|
3402
|
+
abort: !1,
|
|
3403
|
+
...h(t)
|
|
3404
|
+
});
|
|
3405
|
+
}
|
|
3406
|
+
// @__NO_SIDE_EFFECTS__
|
|
3407
|
+
function vi(e, t) {
|
|
3408
|
+
return new e({
|
|
3409
|
+
type: "string",
|
|
3410
|
+
format: "cidrv6",
|
|
3411
|
+
check: "string_format",
|
|
3412
|
+
abort: !1,
|
|
3413
|
+
...h(t)
|
|
3414
|
+
});
|
|
3415
|
+
}
|
|
3416
|
+
// @__NO_SIDE_EFFECTS__
|
|
3417
|
+
function wi(e, t) {
|
|
3418
|
+
return new e({
|
|
3419
|
+
type: "string",
|
|
3420
|
+
format: "base64",
|
|
3421
|
+
check: "string_format",
|
|
3422
|
+
abort: !1,
|
|
3423
|
+
...h(t)
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3426
|
+
// @__NO_SIDE_EFFECTS__
|
|
3427
|
+
function bi(e, t) {
|
|
3428
|
+
return new e({
|
|
3429
|
+
type: "string",
|
|
3430
|
+
format: "base64url",
|
|
3431
|
+
check: "string_format",
|
|
3432
|
+
abort: !1,
|
|
3433
|
+
...h(t)
|
|
3434
|
+
});
|
|
3435
|
+
}
|
|
3436
|
+
// @__NO_SIDE_EFFECTS__
|
|
3437
|
+
function ki(e, t) {
|
|
3438
|
+
return new e({
|
|
3439
|
+
type: "string",
|
|
3440
|
+
format: "e164",
|
|
3441
|
+
check: "string_format",
|
|
3442
|
+
abort: !1,
|
|
3443
|
+
...h(t)
|
|
3444
|
+
});
|
|
3445
|
+
}
|
|
3446
|
+
// @__NO_SIDE_EFFECTS__
|
|
3447
|
+
function zi(e, t) {
|
|
3448
|
+
return new e({
|
|
3449
|
+
type: "string",
|
|
3450
|
+
format: "jwt",
|
|
3451
|
+
check: "string_format",
|
|
3452
|
+
abort: !1,
|
|
3453
|
+
...h(t)
|
|
3454
|
+
});
|
|
3455
|
+
}
|
|
3456
|
+
// @__NO_SIDE_EFFECTS__
|
|
3457
|
+
function $i(e, t) {
|
|
3458
|
+
return new e({
|
|
3459
|
+
type: "string",
|
|
3460
|
+
format: "datetime",
|
|
3461
|
+
check: "string_format",
|
|
3462
|
+
offset: !1,
|
|
3463
|
+
local: !1,
|
|
3464
|
+
precision: null,
|
|
3465
|
+
...h(t)
|
|
3466
|
+
});
|
|
3467
|
+
}
|
|
3468
|
+
// @__NO_SIDE_EFFECTS__
|
|
3469
|
+
function Si(e, t) {
|
|
3470
|
+
return new e({
|
|
3471
|
+
type: "string",
|
|
3472
|
+
format: "date",
|
|
3473
|
+
check: "string_format",
|
|
3474
|
+
...h(t)
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
// @__NO_SIDE_EFFECTS__
|
|
3478
|
+
function Ei(e, t) {
|
|
3479
|
+
return new e({
|
|
3480
|
+
type: "string",
|
|
3481
|
+
format: "time",
|
|
3482
|
+
check: "string_format",
|
|
3483
|
+
precision: null,
|
|
3484
|
+
...h(t)
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3487
|
+
// @__NO_SIDE_EFFECTS__
|
|
3488
|
+
function Zi(e, t) {
|
|
3489
|
+
return new e({
|
|
3490
|
+
type: "string",
|
|
3491
|
+
format: "duration",
|
|
3492
|
+
check: "string_format",
|
|
3493
|
+
...h(t)
|
|
3494
|
+
});
|
|
3495
|
+
}
|
|
3496
|
+
// @__NO_SIDE_EFFECTS__
|
|
3497
|
+
function Ti(e, t) {
|
|
3498
|
+
return new e({
|
|
3499
|
+
type: "number",
|
|
3500
|
+
checks: [],
|
|
3501
|
+
...h(t)
|
|
3502
|
+
});
|
|
3503
|
+
}
|
|
3504
|
+
// @__NO_SIDE_EFFECTS__
|
|
3505
|
+
function Ii(e, t) {
|
|
3506
|
+
return new e({
|
|
3507
|
+
type: "number",
|
|
3508
|
+
check: "number_format",
|
|
3509
|
+
abort: !1,
|
|
3510
|
+
format: "safeint",
|
|
3511
|
+
...h(t)
|
|
3512
|
+
});
|
|
3513
|
+
}
|
|
3514
|
+
// @__NO_SIDE_EFFECTS__
|
|
3515
|
+
function Oi(e, t) {
|
|
3516
|
+
return new e({
|
|
3517
|
+
type: "boolean",
|
|
3518
|
+
...h(t)
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3521
|
+
// @__NO_SIDE_EFFECTS__
|
|
3522
|
+
function Pi(e) {
|
|
3523
|
+
return new e({
|
|
3524
|
+
type: "unknown"
|
|
3525
|
+
});
|
|
3526
|
+
}
|
|
3527
|
+
// @__NO_SIDE_EFFECTS__
|
|
3528
|
+
function Ai(e, t) {
|
|
3529
|
+
return new e({
|
|
3530
|
+
type: "never",
|
|
3531
|
+
...h(t)
|
|
3532
|
+
});
|
|
3533
|
+
}
|
|
3534
|
+
// @__NO_SIDE_EFFECTS__
|
|
3535
|
+
function Be(e, t) {
|
|
3536
|
+
return new vt({
|
|
3537
|
+
check: "less_than",
|
|
3538
|
+
...h(t),
|
|
3539
|
+
value: e,
|
|
3540
|
+
inclusive: !1
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
// @__NO_SIDE_EFFECTS__
|
|
3544
|
+
function fe(e, t) {
|
|
3545
|
+
return new vt({
|
|
3546
|
+
check: "less_than",
|
|
3547
|
+
...h(t),
|
|
3548
|
+
value: e,
|
|
3549
|
+
inclusive: !0
|
|
3550
|
+
});
|
|
3551
|
+
}
|
|
3552
|
+
// @__NO_SIDE_EFFECTS__
|
|
3553
|
+
function Ge(e, t) {
|
|
3554
|
+
return new wt({
|
|
3555
|
+
check: "greater_than",
|
|
3556
|
+
...h(t),
|
|
3557
|
+
value: e,
|
|
3558
|
+
inclusive: !1
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
// @__NO_SIDE_EFFECTS__
|
|
3562
|
+
function pe(e, t) {
|
|
3563
|
+
return new wt({
|
|
3564
|
+
check: "greater_than",
|
|
3565
|
+
...h(t),
|
|
3566
|
+
value: e,
|
|
3567
|
+
inclusive: !0
|
|
3568
|
+
});
|
|
3569
|
+
}
|
|
3570
|
+
// @__NO_SIDE_EFFECTS__
|
|
3571
|
+
function We(e, t) {
|
|
3572
|
+
return new Br({
|
|
3573
|
+
check: "multiple_of",
|
|
3574
|
+
...h(t),
|
|
3575
|
+
value: e
|
|
3576
|
+
});
|
|
3577
|
+
}
|
|
3578
|
+
// @__NO_SIDE_EFFECTS__
|
|
3579
|
+
function Et(e, t) {
|
|
3580
|
+
return new Wr({
|
|
3581
|
+
check: "max_length",
|
|
3582
|
+
...h(t),
|
|
3583
|
+
maximum: e
|
|
3584
|
+
});
|
|
3585
|
+
}
|
|
3586
|
+
// @__NO_SIDE_EFFECTS__
|
|
3587
|
+
function se(e, t) {
|
|
3588
|
+
return new Hr({
|
|
3589
|
+
check: "min_length",
|
|
3590
|
+
...h(t),
|
|
3591
|
+
minimum: e
|
|
3592
|
+
});
|
|
3593
|
+
}
|
|
3594
|
+
// @__NO_SIDE_EFFECTS__
|
|
3595
|
+
function Zt(e, t) {
|
|
3596
|
+
return new Kr({
|
|
3597
|
+
check: "length_equals",
|
|
3598
|
+
...h(t),
|
|
3599
|
+
length: e
|
|
3600
|
+
});
|
|
3601
|
+
}
|
|
3602
|
+
// @__NO_SIDE_EFFECTS__
|
|
3603
|
+
function Ni(e, t) {
|
|
3604
|
+
return new Yr({
|
|
3605
|
+
check: "string_format",
|
|
3606
|
+
format: "regex",
|
|
3607
|
+
...h(t),
|
|
3608
|
+
pattern: e
|
|
3609
|
+
});
|
|
3610
|
+
}
|
|
3611
|
+
// @__NO_SIDE_EFFECTS__
|
|
3612
|
+
function Ci(e) {
|
|
3613
|
+
return new Qr({
|
|
3614
|
+
check: "string_format",
|
|
3615
|
+
format: "lowercase",
|
|
3616
|
+
...h(e)
|
|
3617
|
+
});
|
|
3618
|
+
}
|
|
3619
|
+
// @__NO_SIDE_EFFECTS__
|
|
3620
|
+
function Ri(e) {
|
|
3621
|
+
return new Xr({
|
|
3622
|
+
check: "string_format",
|
|
3623
|
+
format: "uppercase",
|
|
3624
|
+
...h(e)
|
|
3625
|
+
});
|
|
3626
|
+
}
|
|
3627
|
+
// @__NO_SIDE_EFFECTS__
|
|
3628
|
+
function Di(e, t) {
|
|
3629
|
+
return new eo({
|
|
3630
|
+
check: "string_format",
|
|
3631
|
+
format: "includes",
|
|
3632
|
+
...h(t),
|
|
3633
|
+
includes: e
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
// @__NO_SIDE_EFFECTS__
|
|
3637
|
+
function ji(e, t) {
|
|
3638
|
+
return new to({
|
|
3639
|
+
check: "string_format",
|
|
3640
|
+
format: "starts_with",
|
|
3641
|
+
...h(t),
|
|
3642
|
+
prefix: e
|
|
3643
|
+
});
|
|
3644
|
+
}
|
|
3645
|
+
// @__NO_SIDE_EFFECTS__
|
|
3646
|
+
function Li(e, t) {
|
|
3647
|
+
return new no({
|
|
3648
|
+
check: "string_format",
|
|
3649
|
+
format: "ends_with",
|
|
3650
|
+
...h(t),
|
|
3651
|
+
suffix: e
|
|
3652
|
+
});
|
|
3653
|
+
}
|
|
3654
|
+
// @__NO_SIDE_EFFECTS__
|
|
3655
|
+
function W(e) {
|
|
3656
|
+
return new ro({
|
|
3657
|
+
check: "overwrite",
|
|
3658
|
+
tx: e
|
|
3659
|
+
});
|
|
3660
|
+
}
|
|
3661
|
+
// @__NO_SIDE_EFFECTS__
|
|
3662
|
+
function Ui(e) {
|
|
3663
|
+
return /* @__PURE__ */ W((t) => t.normalize(e));
|
|
3664
|
+
}
|
|
3665
|
+
// @__NO_SIDE_EFFECTS__
|
|
3666
|
+
function Mi() {
|
|
3667
|
+
return /* @__PURE__ */ W((e) => e.trim());
|
|
3668
|
+
}
|
|
3669
|
+
// @__NO_SIDE_EFFECTS__
|
|
3670
|
+
function Fi() {
|
|
3671
|
+
return /* @__PURE__ */ W((e) => e.toLowerCase());
|
|
3672
|
+
}
|
|
3673
|
+
// @__NO_SIDE_EFFECTS__
|
|
3674
|
+
function Ji() {
|
|
3675
|
+
return /* @__PURE__ */ W((e) => e.toUpperCase());
|
|
3676
|
+
}
|
|
3677
|
+
// @__NO_SIDE_EFFECTS__
|
|
3678
|
+
function xi() {
|
|
3679
|
+
return /* @__PURE__ */ W((e) => Yn(e));
|
|
3680
|
+
}
|
|
3681
|
+
// @__NO_SIDE_EFFECTS__
|
|
3682
|
+
function qi(e, t, n) {
|
|
3683
|
+
return new e({
|
|
3684
|
+
type: "array",
|
|
3685
|
+
element: t,
|
|
3686
|
+
// get element() {
|
|
3687
|
+
// return element;
|
|
3688
|
+
// },
|
|
3689
|
+
...h(n)
|
|
3690
|
+
});
|
|
3691
|
+
}
|
|
3692
|
+
// @__NO_SIDE_EFFECTS__
|
|
3693
|
+
function Vi(e, t, n) {
|
|
3694
|
+
return new e({
|
|
3695
|
+
type: "custom",
|
|
3696
|
+
check: "custom",
|
|
3697
|
+
fn: t,
|
|
3698
|
+
...h(n)
|
|
3699
|
+
});
|
|
3700
|
+
}
|
|
3701
|
+
// @__NO_SIDE_EFFECTS__
|
|
3702
|
+
function Bi(e) {
|
|
3703
|
+
const t = /* @__PURE__ */ Gi((n) => (n.addIssue = (r) => {
|
|
3704
|
+
if (typeof r == "string")
|
|
3705
|
+
n.issues.push(ee(r, n.value, t._zod.def));
|
|
3706
|
+
else {
|
|
3707
|
+
const o = r;
|
|
3708
|
+
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = n.value), o.inst ?? (o.inst = t), o.continue ?? (o.continue = !t._zod.def.abort), n.issues.push(ee(o));
|
|
3709
|
+
}
|
|
3710
|
+
}, e(n.value, n)));
|
|
3711
|
+
return t;
|
|
3712
|
+
}
|
|
3713
|
+
// @__NO_SIDE_EFFECTS__
|
|
3714
|
+
function Gi(e, t) {
|
|
3715
|
+
const n = new I({
|
|
3716
|
+
check: "custom",
|
|
3717
|
+
...h(t)
|
|
3718
|
+
});
|
|
3719
|
+
return n._zod.check = e, n;
|
|
3720
|
+
}
|
|
3721
|
+
function Tt(e) {
|
|
3722
|
+
let t = e?.target ?? "draft-2020-12";
|
|
3723
|
+
return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
|
|
3724
|
+
processors: e.processors ?? {},
|
|
3725
|
+
metadataRegistry: e?.metadata ?? Q,
|
|
3726
|
+
target: t,
|
|
3727
|
+
unrepresentable: e?.unrepresentable ?? "throw",
|
|
3728
|
+
override: e?.override ?? (() => {
|
|
3729
|
+
}),
|
|
3730
|
+
io: e?.io ?? "output",
|
|
3731
|
+
counter: 0,
|
|
3732
|
+
seen: /* @__PURE__ */ new Map(),
|
|
3733
|
+
cycles: e?.cycles ?? "ref",
|
|
3734
|
+
reused: e?.reused ?? "inline",
|
|
3735
|
+
external: e?.external ?? void 0
|
|
3736
|
+
};
|
|
3737
|
+
}
|
|
3738
|
+
function $(e, t, n = { path: [], schemaPath: [] }) {
|
|
3739
|
+
var r;
|
|
3740
|
+
const o = e._zod.def, i = t.seen.get(e);
|
|
3741
|
+
if (i)
|
|
3742
|
+
return i.count++, n.schemaPath.includes(e) && (i.cycle = n.path), i.schema;
|
|
3743
|
+
const s = { schema: {}, count: 1, cycle: void 0, path: n.path };
|
|
3744
|
+
t.seen.set(e, s);
|
|
3745
|
+
const a = e._zod.toJSONSchema?.();
|
|
3746
|
+
if (a)
|
|
3747
|
+
s.schema = a;
|
|
3748
|
+
else {
|
|
3749
|
+
const l = {
|
|
3750
|
+
...n,
|
|
3751
|
+
schemaPath: [...n.schemaPath, e],
|
|
3752
|
+
path: n.path
|
|
3753
|
+
};
|
|
3754
|
+
if (e._zod.processJSONSchema)
|
|
3755
|
+
e._zod.processJSONSchema(t, s.schema, l);
|
|
3756
|
+
else {
|
|
3757
|
+
const g = s.schema, p = t.processors[o.type];
|
|
3758
|
+
if (!p)
|
|
3759
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);
|
|
3760
|
+
p(e, t, g, l);
|
|
3761
|
+
}
|
|
3762
|
+
const f = e._zod.parent;
|
|
3763
|
+
f && (s.ref || (s.ref = f), $(f, t, l), t.seen.get(f).isParent = !0);
|
|
3764
|
+
}
|
|
3765
|
+
const c = t.metadataRegistry.get(e);
|
|
3766
|
+
return c && Object.assign(s.schema, c), t.io === "input" && E(e) && (delete s.schema.examples, delete s.schema.default), t.io === "input" && s.schema._prefault && ((r = s.schema).default ?? (r.default = s.schema._prefault)), delete s.schema._prefault, t.seen.get(e).schema;
|
|
3767
|
+
}
|
|
3768
|
+
function It(e, t) {
|
|
3769
|
+
const n = e.seen.get(t);
|
|
3770
|
+
if (!n)
|
|
3771
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3772
|
+
const r = /* @__PURE__ */ new Map();
|
|
3773
|
+
for (const s of e.seen.entries()) {
|
|
3774
|
+
const a = e.metadataRegistry.get(s[0])?.id;
|
|
3775
|
+
if (a) {
|
|
3776
|
+
const c = r.get(a);
|
|
3777
|
+
if (c && c !== s[0])
|
|
3778
|
+
throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
3779
|
+
r.set(a, s[0]);
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
const o = (s) => {
|
|
3783
|
+
const a = e.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
3784
|
+
if (e.external) {
|
|
3785
|
+
const f = e.external.registry.get(s[0])?.id, g = e.external.uri ?? ((m) => m);
|
|
3786
|
+
if (f)
|
|
3787
|
+
return { ref: g(f) };
|
|
3788
|
+
const p = s[1].defId ?? s[1].schema.id ?? `schema${e.counter++}`;
|
|
3789
|
+
return s[1].defId = p, { defId: p, ref: `${g("__shared")}#/${a}/${p}` };
|
|
3790
|
+
}
|
|
3791
|
+
if (s[1] === n)
|
|
3792
|
+
return { ref: "#" };
|
|
3793
|
+
const u = `#/${a}/`, l = s[1].schema.id ?? `__schema${e.counter++}`;
|
|
3794
|
+
return { defId: l, ref: u + l };
|
|
3795
|
+
}, i = (s) => {
|
|
3796
|
+
if (s[1].schema.$ref)
|
|
3797
|
+
return;
|
|
3798
|
+
const a = s[1], { ref: c, defId: u } = o(s);
|
|
3799
|
+
a.def = { ...a.schema }, u && (a.defId = u);
|
|
3800
|
+
const l = a.schema;
|
|
3801
|
+
for (const f in l)
|
|
3802
|
+
delete l[f];
|
|
3803
|
+
l.$ref = c;
|
|
3804
|
+
};
|
|
3805
|
+
if (e.cycles === "throw")
|
|
3806
|
+
for (const s of e.seen.entries()) {
|
|
3807
|
+
const a = s[1];
|
|
3808
|
+
if (a.cycle)
|
|
3809
|
+
throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
3810
|
+
|
|
3811
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
3812
|
+
}
|
|
3813
|
+
for (const s of e.seen.entries()) {
|
|
3814
|
+
const a = s[1];
|
|
3815
|
+
if (t === s[0]) {
|
|
3816
|
+
i(s);
|
|
3817
|
+
continue;
|
|
3818
|
+
}
|
|
3819
|
+
if (e.external) {
|
|
3820
|
+
const u = e.external.registry.get(s[0])?.id;
|
|
3821
|
+
if (t !== s[0] && u) {
|
|
3822
|
+
i(s);
|
|
3823
|
+
continue;
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
if (e.metadataRegistry.get(s[0])?.id) {
|
|
3827
|
+
i(s);
|
|
3828
|
+
continue;
|
|
3829
|
+
}
|
|
3830
|
+
if (a.cycle) {
|
|
3831
|
+
i(s);
|
|
3832
|
+
continue;
|
|
3833
|
+
}
|
|
3834
|
+
if (a.count > 1 && e.reused === "ref") {
|
|
3835
|
+
i(s);
|
|
3836
|
+
continue;
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
function Ot(e, t) {
|
|
3841
|
+
const n = e.seen.get(t);
|
|
3842
|
+
if (!n)
|
|
3843
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3844
|
+
const r = (s) => {
|
|
3845
|
+
const a = e.seen.get(s);
|
|
3846
|
+
if (a.ref === null)
|
|
3847
|
+
return;
|
|
3848
|
+
const c = a.def ?? a.schema, u = { ...c }, l = a.ref;
|
|
3849
|
+
if (a.ref = null, l) {
|
|
3850
|
+
r(l);
|
|
3851
|
+
const g = e.seen.get(l), p = g.schema;
|
|
3852
|
+
if (p.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (c.allOf = c.allOf ?? [], c.allOf.push(p)) : Object.assign(c, p), Object.assign(c, u), s._zod.parent === l)
|
|
3853
|
+
for (const v in c)
|
|
3854
|
+
v === "$ref" || v === "allOf" || v in u || delete c[v];
|
|
3855
|
+
if (p.$ref && g.def)
|
|
3856
|
+
for (const v in c)
|
|
3857
|
+
v === "$ref" || v === "allOf" || v in g.def && JSON.stringify(c[v]) === JSON.stringify(g.def[v]) && delete c[v];
|
|
3858
|
+
}
|
|
3859
|
+
const f = s._zod.parent;
|
|
3860
|
+
if (f && f !== l) {
|
|
3861
|
+
r(f);
|
|
3862
|
+
const g = e.seen.get(f);
|
|
3863
|
+
if (g?.schema.$ref && (c.$ref = g.schema.$ref, g.def))
|
|
3864
|
+
for (const p in c)
|
|
3865
|
+
p === "$ref" || p === "allOf" || p in g.def && JSON.stringify(c[p]) === JSON.stringify(g.def[p]) && delete c[p];
|
|
3866
|
+
}
|
|
3867
|
+
e.override({
|
|
3868
|
+
zodSchema: s,
|
|
3869
|
+
jsonSchema: c,
|
|
3870
|
+
path: a.path ?? []
|
|
3871
|
+
});
|
|
3872
|
+
};
|
|
3873
|
+
for (const s of [...e.seen.entries()].reverse())
|
|
3874
|
+
r(s[0]);
|
|
3875
|
+
const o = {};
|
|
3876
|
+
if (e.target === "draft-2020-12" ? o.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? o.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? o.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
|
|
3877
|
+
const s = e.external.registry.get(t)?.id;
|
|
3878
|
+
if (!s)
|
|
3879
|
+
throw new Error("Schema is missing an `id` property");
|
|
3880
|
+
o.$id = e.external.uri(s);
|
|
3881
|
+
}
|
|
3882
|
+
Object.assign(o, n.def ?? n.schema);
|
|
3883
|
+
const i = e.external?.defs ?? {};
|
|
3884
|
+
for (const s of e.seen.entries()) {
|
|
3885
|
+
const a = s[1];
|
|
3886
|
+
a.def && a.defId && (i[a.defId] = a.def);
|
|
3887
|
+
}
|
|
3888
|
+
e.external || Object.keys(i).length > 0 && (e.target === "draft-2020-12" ? o.$defs = i : o.definitions = i);
|
|
3889
|
+
try {
|
|
3890
|
+
const s = JSON.parse(JSON.stringify(o));
|
|
3891
|
+
return Object.defineProperty(s, "~standard", {
|
|
3892
|
+
value: {
|
|
3893
|
+
...t["~standard"],
|
|
3894
|
+
jsonSchema: {
|
|
3895
|
+
input: ae(t, "input", e.processors),
|
|
3896
|
+
output: ae(t, "output", e.processors)
|
|
3897
|
+
}
|
|
3898
|
+
},
|
|
3899
|
+
enumerable: !1,
|
|
3900
|
+
writable: !1
|
|
3901
|
+
}), s;
|
|
3902
|
+
} catch {
|
|
3903
|
+
throw new Error("Error converting schema to JSON.");
|
|
3904
|
+
}
|
|
3905
|
+
}
|
|
3906
|
+
function E(e, t) {
|
|
3907
|
+
const n = t ?? { seen: /* @__PURE__ */ new Set() };
|
|
3908
|
+
if (n.seen.has(e))
|
|
3909
|
+
return !1;
|
|
3910
|
+
n.seen.add(e);
|
|
3911
|
+
const r = e._zod.def;
|
|
3912
|
+
if (r.type === "transform")
|
|
3913
|
+
return !0;
|
|
3914
|
+
if (r.type === "array")
|
|
3915
|
+
return E(r.element, n);
|
|
3916
|
+
if (r.type === "set")
|
|
3917
|
+
return E(r.valueType, n);
|
|
3918
|
+
if (r.type === "lazy")
|
|
3919
|
+
return E(r.getter(), n);
|
|
3920
|
+
if (r.type === "promise" || r.type === "optional" || r.type === "nonoptional" || r.type === "nullable" || r.type === "readonly" || r.type === "default" || r.type === "prefault")
|
|
3921
|
+
return E(r.innerType, n);
|
|
3922
|
+
if (r.type === "intersection")
|
|
3923
|
+
return E(r.left, n) || E(r.right, n);
|
|
3924
|
+
if (r.type === "record" || r.type === "map")
|
|
3925
|
+
return E(r.keyType, n) || E(r.valueType, n);
|
|
3926
|
+
if (r.type === "pipe")
|
|
3927
|
+
return E(r.in, n) || E(r.out, n);
|
|
3928
|
+
if (r.type === "object") {
|
|
3929
|
+
for (const o in r.shape)
|
|
3930
|
+
if (E(r.shape[o], n))
|
|
3931
|
+
return !0;
|
|
3932
|
+
return !1;
|
|
3933
|
+
}
|
|
3934
|
+
if (r.type === "union") {
|
|
3935
|
+
for (const o of r.options)
|
|
3936
|
+
if (E(o, n))
|
|
3937
|
+
return !0;
|
|
3938
|
+
return !1;
|
|
3939
|
+
}
|
|
3940
|
+
if (r.type === "tuple") {
|
|
3941
|
+
for (const o of r.items)
|
|
3942
|
+
if (E(o, n))
|
|
3943
|
+
return !0;
|
|
3944
|
+
return !!(r.rest && E(r.rest, n));
|
|
3945
|
+
}
|
|
3946
|
+
return !1;
|
|
3947
|
+
}
|
|
3948
|
+
const Wi = (e, t = {}) => (n) => {
|
|
3949
|
+
const r = Tt({ ...n, processors: t });
|
|
3950
|
+
return $(e, r), It(r, e), Ot(r, e);
|
|
3951
|
+
}, ae = (e, t, n = {}) => (r) => {
|
|
3952
|
+
const { libraryOptions: o, target: i } = r ?? {}, s = Tt({ ...o ?? {}, target: i, io: t, processors: n });
|
|
3953
|
+
return $(e, s), It(s, e), Ot(s, e);
|
|
3954
|
+
}, Hi = {
|
|
3955
|
+
guid: "uuid",
|
|
3956
|
+
url: "uri",
|
|
3957
|
+
datetime: "date-time",
|
|
3958
|
+
json_string: "json-string",
|
|
3959
|
+
regex: ""
|
|
3960
|
+
// do not set
|
|
3961
|
+
}, Ki = (e, t, n, r) => {
|
|
3962
|
+
const o = n;
|
|
3963
|
+
o.type = "string";
|
|
3964
|
+
const { minimum: i, maximum: s, format: a, patterns: c, contentEncoding: u } = e._zod.bag;
|
|
3965
|
+
if (typeof i == "number" && (o.minLength = i), typeof s == "number" && (o.maxLength = s), a && (o.format = Hi[a] ?? a, o.format === "" && delete o.format, a === "time" && delete o.format), u && (o.contentEncoding = u), c && c.size > 0) {
|
|
3966
|
+
const l = [...c];
|
|
3967
|
+
l.length === 1 ? o.pattern = l[0].source : l.length > 1 && (o.allOf = [
|
|
3968
|
+
...l.map((f) => ({
|
|
3969
|
+
...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3970
|
+
pattern: f.source
|
|
3971
|
+
}))
|
|
3972
|
+
]);
|
|
3973
|
+
}
|
|
3974
|
+
}, Yi = (e, t, n, r) => {
|
|
3975
|
+
const o = n, { minimum: i, maximum: s, format: a, multipleOf: c, exclusiveMaximum: u, exclusiveMinimum: l } = e._zod.bag;
|
|
3976
|
+
typeof a == "string" && a.includes("int") ? o.type = "integer" : o.type = "number", typeof l == "number" && (t.target === "draft-04" || t.target === "openapi-3.0" ? (o.minimum = l, o.exclusiveMinimum = !0) : o.exclusiveMinimum = l), typeof i == "number" && (o.minimum = i, typeof l == "number" && t.target !== "draft-04" && (l >= i ? delete o.minimum : delete o.exclusiveMinimum)), typeof u == "number" && (t.target === "draft-04" || t.target === "openapi-3.0" ? (o.maximum = u, o.exclusiveMaximum = !0) : o.exclusiveMaximum = u), typeof s == "number" && (o.maximum = s, typeof u == "number" && t.target !== "draft-04" && (u <= s ? delete o.maximum : delete o.exclusiveMaximum)), typeof c == "number" && (o.multipleOf = c);
|
|
3977
|
+
}, Qi = (e, t, n, r) => {
|
|
3978
|
+
n.type = "boolean";
|
|
3979
|
+
}, Xi = (e, t, n, r) => {
|
|
3980
|
+
n.not = {};
|
|
3981
|
+
}, es = (e, t, n, r) => {
|
|
3982
|
+
}, ts = (e, t, n, r) => {
|
|
3983
|
+
const o = e._zod.def, i = ct(o.entries);
|
|
3984
|
+
i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), n.enum = i;
|
|
3985
|
+
}, ns = (e, t, n, r) => {
|
|
3986
|
+
const o = e._zod.def, i = [];
|
|
3987
|
+
for (const s of o.values)
|
|
3988
|
+
if (s === void 0) {
|
|
3989
|
+
if (t.unrepresentable === "throw")
|
|
3990
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
3991
|
+
} else if (typeof s == "bigint") {
|
|
3992
|
+
if (t.unrepresentable === "throw")
|
|
3993
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
3994
|
+
i.push(Number(s));
|
|
3995
|
+
} else
|
|
3996
|
+
i.push(s);
|
|
3997
|
+
if (i.length !== 0) if (i.length === 1) {
|
|
3998
|
+
const s = i[0];
|
|
3999
|
+
n.type = s === null ? "null" : typeof s, t.target === "draft-04" || t.target === "openapi-3.0" ? n.enum = [s] : n.const = s;
|
|
4000
|
+
} else
|
|
4001
|
+
i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), i.every((s) => typeof s == "boolean") && (n.type = "boolean"), i.every((s) => s === null) && (n.type = "null"), n.enum = i;
|
|
4002
|
+
}, rs = (e, t, n, r) => {
|
|
4003
|
+
if (t.unrepresentable === "throw")
|
|
4004
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
4005
|
+
}, os = (e, t, n, r) => {
|
|
4006
|
+
if (t.unrepresentable === "throw")
|
|
4007
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
4008
|
+
}, is = (e, t, n, r) => {
|
|
4009
|
+
const o = n, i = e._zod.def, { minimum: s, maximum: a } = e._zod.bag;
|
|
4010
|
+
typeof s == "number" && (o.minItems = s), typeof a == "number" && (o.maxItems = a), o.type = "array", o.items = $(i.element, t, { ...r, path: [...r.path, "items"] });
|
|
4011
|
+
}, ss = (e, t, n, r) => {
|
|
4012
|
+
const o = n, i = e._zod.def;
|
|
4013
|
+
o.type = "object", o.properties = {};
|
|
4014
|
+
const s = i.shape;
|
|
4015
|
+
for (const u in s)
|
|
4016
|
+
o.properties[u] = $(s[u], t, {
|
|
4017
|
+
...r,
|
|
4018
|
+
path: [...r.path, "properties", u]
|
|
4019
|
+
});
|
|
4020
|
+
const a = new Set(Object.keys(s)), c = new Set([...a].filter((u) => {
|
|
4021
|
+
const l = i.shape[u]._zod;
|
|
4022
|
+
return t.io === "input" ? l.optin === void 0 : l.optout === void 0;
|
|
4023
|
+
}));
|
|
4024
|
+
c.size > 0 && (o.required = Array.from(c)), i.catchall?._zod.def.type === "never" ? o.additionalProperties = !1 : i.catchall ? i.catchall && (o.additionalProperties = $(i.catchall, t, {
|
|
4025
|
+
...r,
|
|
4026
|
+
path: [...r.path, "additionalProperties"]
|
|
4027
|
+
})) : t.io === "output" && (o.additionalProperties = !1);
|
|
4028
|
+
}, as = (e, t, n, r) => {
|
|
4029
|
+
const o = e._zod.def, i = o.inclusive === !1, s = o.options.map((a, c) => $(a, t, {
|
|
4030
|
+
...r,
|
|
4031
|
+
path: [...r.path, i ? "oneOf" : "anyOf", c]
|
|
4032
|
+
}));
|
|
4033
|
+
i ? n.oneOf = s : n.anyOf = s;
|
|
4034
|
+
}, cs = (e, t, n, r) => {
|
|
4035
|
+
const o = e._zod.def, i = $(o.left, t, {
|
|
4036
|
+
...r,
|
|
4037
|
+
path: [...r.path, "allOf", 0]
|
|
4038
|
+
}), s = $(o.right, t, {
|
|
4039
|
+
...r,
|
|
4040
|
+
path: [...r.path, "allOf", 1]
|
|
4041
|
+
}), a = (u) => "allOf" in u && Object.keys(u).length === 1, c = [
|
|
4042
|
+
...a(i) ? i.allOf : [i],
|
|
4043
|
+
...a(s) ? s.allOf : [s]
|
|
4044
|
+
];
|
|
4045
|
+
n.allOf = c;
|
|
4046
|
+
}, us = (e, t, n, r) => {
|
|
4047
|
+
const o = n, i = e._zod.def;
|
|
4048
|
+
o.type = "object";
|
|
4049
|
+
const s = i.keyType, c = s._zod.bag?.patterns;
|
|
4050
|
+
if (i.mode === "loose" && c && c.size > 0) {
|
|
4051
|
+
const l = $(i.valueType, t, {
|
|
4052
|
+
...r,
|
|
4053
|
+
path: [...r.path, "patternProperties", "*"]
|
|
4054
|
+
});
|
|
4055
|
+
o.patternProperties = {};
|
|
4056
|
+
for (const f of c)
|
|
4057
|
+
o.patternProperties[f.source] = l;
|
|
4058
|
+
} else
|
|
4059
|
+
(t.target === "draft-07" || t.target === "draft-2020-12") && (o.propertyNames = $(i.keyType, t, {
|
|
4060
|
+
...r,
|
|
4061
|
+
path: [...r.path, "propertyNames"]
|
|
4062
|
+
})), o.additionalProperties = $(i.valueType, t, {
|
|
4063
|
+
...r,
|
|
4064
|
+
path: [...r.path, "additionalProperties"]
|
|
4065
|
+
});
|
|
4066
|
+
const u = s._zod.values;
|
|
4067
|
+
if (u) {
|
|
4068
|
+
const l = [...u].filter((f) => typeof f == "string" || typeof f == "number");
|
|
4069
|
+
l.length > 0 && (o.required = l);
|
|
4070
|
+
}
|
|
4071
|
+
}, ds = (e, t, n, r) => {
|
|
4072
|
+
const o = e._zod.def, i = $(o.innerType, t, r), s = t.seen.get(e);
|
|
4073
|
+
t.target === "openapi-3.0" ? (s.ref = o.innerType, n.nullable = !0) : n.anyOf = [i, { type: "null" }];
|
|
4074
|
+
}, ls = (e, t, n, r) => {
|
|
4075
|
+
const o = e._zod.def;
|
|
4076
|
+
$(o.innerType, t, r);
|
|
4077
|
+
const i = t.seen.get(e);
|
|
4078
|
+
i.ref = o.innerType;
|
|
4079
|
+
}, fs = (e, t, n, r) => {
|
|
4080
|
+
const o = e._zod.def;
|
|
4081
|
+
$(o.innerType, t, r);
|
|
4082
|
+
const i = t.seen.get(e);
|
|
4083
|
+
i.ref = o.innerType, n.default = JSON.parse(JSON.stringify(o.defaultValue));
|
|
4084
|
+
}, ps = (e, t, n, r) => {
|
|
4085
|
+
const o = e._zod.def;
|
|
4086
|
+
$(o.innerType, t, r);
|
|
4087
|
+
const i = t.seen.get(e);
|
|
4088
|
+
i.ref = o.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(o.defaultValue)));
|
|
4089
|
+
}, gs = (e, t, n, r) => {
|
|
4090
|
+
const o = e._zod.def;
|
|
4091
|
+
$(o.innerType, t, r);
|
|
4092
|
+
const i = t.seen.get(e);
|
|
4093
|
+
i.ref = o.innerType;
|
|
4094
|
+
let s;
|
|
4095
|
+
try {
|
|
4096
|
+
s = o.catchValue(void 0);
|
|
4097
|
+
} catch {
|
|
4098
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
4099
|
+
}
|
|
4100
|
+
n.default = s;
|
|
4101
|
+
}, hs = (e, t, n, r) => {
|
|
4102
|
+
const o = e._zod.def, i = t.io === "input" ? o.in._zod.def.type === "transform" ? o.out : o.in : o.out;
|
|
4103
|
+
$(i, t, r);
|
|
4104
|
+
const s = t.seen.get(e);
|
|
4105
|
+
s.ref = i;
|
|
4106
|
+
}, ms = (e, t, n, r) => {
|
|
4107
|
+
const o = e._zod.def;
|
|
4108
|
+
$(o.innerType, t, r);
|
|
4109
|
+
const i = t.seen.get(e);
|
|
4110
|
+
i.ref = o.innerType, n.readOnly = !0;
|
|
4111
|
+
}, Pt = (e, t, n, r) => {
|
|
4112
|
+
const o = e._zod.def;
|
|
4113
|
+
$(o.innerType, t, r);
|
|
4114
|
+
const i = t.seen.get(e);
|
|
4115
|
+
i.ref = o.innerType;
|
|
4116
|
+
}, _s = /* @__PURE__ */ d("ZodISODateTime", (e, t) => {
|
|
4117
|
+
yo.init(e, t), z.init(e, t);
|
|
4118
|
+
});
|
|
4119
|
+
function ys(e) {
|
|
4120
|
+
return /* @__PURE__ */ $i(_s, e);
|
|
4121
|
+
}
|
|
4122
|
+
const vs = /* @__PURE__ */ d("ZodISODate", (e, t) => {
|
|
4123
|
+
vo.init(e, t), z.init(e, t);
|
|
4124
|
+
});
|
|
4125
|
+
function ws(e) {
|
|
4126
|
+
return /* @__PURE__ */ Si(vs, e);
|
|
4127
|
+
}
|
|
4128
|
+
const bs = /* @__PURE__ */ d("ZodISOTime", (e, t) => {
|
|
4129
|
+
wo.init(e, t), z.init(e, t);
|
|
4130
|
+
});
|
|
4131
|
+
function ks(e) {
|
|
4132
|
+
return /* @__PURE__ */ Ei(bs, e);
|
|
4133
|
+
}
|
|
4134
|
+
const zs = /* @__PURE__ */ d("ZodISODuration", (e, t) => {
|
|
4135
|
+
bo.init(e, t), z.init(e, t);
|
|
4136
|
+
});
|
|
4137
|
+
function $s(e) {
|
|
4138
|
+
return /* @__PURE__ */ Zi(zs, e);
|
|
4139
|
+
}
|
|
4140
|
+
const Ss = (e, t) => {
|
|
4141
|
+
ft.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
4142
|
+
format: {
|
|
4143
|
+
value: (n) => dr(e, n)
|
|
4144
|
+
// enumerable: false,
|
|
4145
|
+
},
|
|
4146
|
+
flatten: {
|
|
4147
|
+
value: (n) => ur(e, n)
|
|
4148
|
+
// enumerable: false,
|
|
4149
|
+
},
|
|
4150
|
+
addIssue: {
|
|
4151
|
+
value: (n) => {
|
|
4152
|
+
e.issues.push(n), e.message = JSON.stringify(e.issues, ge, 2);
|
|
4153
|
+
}
|
|
4154
|
+
// enumerable: false,
|
|
4155
|
+
},
|
|
4156
|
+
addIssues: {
|
|
4157
|
+
value: (n) => {
|
|
4158
|
+
e.issues.push(...n), e.message = JSON.stringify(e.issues, ge, 2);
|
|
4159
|
+
}
|
|
4160
|
+
// enumerable: false,
|
|
4161
|
+
},
|
|
4162
|
+
isEmpty: {
|
|
4163
|
+
get() {
|
|
4164
|
+
return e.issues.length === 0;
|
|
4165
|
+
}
|
|
4166
|
+
// enumerable: false,
|
|
4167
|
+
}
|
|
4168
|
+
});
|
|
4169
|
+
}, O = d("ZodError", Ss, {
|
|
4170
|
+
Parent: Error
|
|
4171
|
+
}), Es = /* @__PURE__ */ ze(O), Zs = /* @__PURE__ */ $e(O), Ts = /* @__PURE__ */ ce(O), Is = /* @__PURE__ */ ue(O), Os = /* @__PURE__ */ pr(O), Ps = /* @__PURE__ */ gr(O), As = /* @__PURE__ */ hr(O), Ns = /* @__PURE__ */ mr(O), Cs = /* @__PURE__ */ _r(O), Rs = /* @__PURE__ */ yr(O), Ds = /* @__PURE__ */ vr(O), js = /* @__PURE__ */ wr(O), k = /* @__PURE__ */ d("ZodType", (e, t) => (b.init(e, t), Object.assign(e["~standard"], {
|
|
4172
|
+
jsonSchema: {
|
|
4173
|
+
input: ae(e, "input"),
|
|
4174
|
+
output: ae(e, "output")
|
|
4175
|
+
}
|
|
4176
|
+
}), e.toJSONSchema = Wi(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(L(t, {
|
|
4177
|
+
checks: [
|
|
4178
|
+
...t.checks ?? [],
|
|
4179
|
+
...n.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
|
|
4180
|
+
]
|
|
4181
|
+
}), {
|
|
4182
|
+
parent: !0
|
|
4183
|
+
}), e.with = e.check, e.clone = (n, r) => U(e, n, r), e.brand = () => e, e.register = ((n, r) => (n.add(e, r), e)), e.parse = (n, r) => Es(e, n, r, { callee: e.parse }), e.safeParse = (n, r) => Ts(e, n, r), e.parseAsync = async (n, r) => Zs(e, n, r, { callee: e.parseAsync }), e.safeParseAsync = async (n, r) => Is(e, n, r), e.spa = e.safeParseAsync, e.encode = (n, r) => Os(e, n, r), e.decode = (n, r) => Ps(e, n, r), e.encodeAsync = async (n, r) => As(e, n, r), e.decodeAsync = async (n, r) => Ns(e, n, r), e.safeEncode = (n, r) => Cs(e, n, r), e.safeDecode = (n, r) => Rs(e, n, r), e.safeEncodeAsync = async (n, r) => Ds(e, n, r), e.safeDecodeAsync = async (n, r) => js(e, n, r), e.refine = (n, r) => e.check(Na(n, r)), e.superRefine = (n) => e.check(Ca(n)), e.overwrite = (n) => e.check(/* @__PURE__ */ W(n)), e.optional = () => Qe(e), e.exactOptional = () => wa(e), e.nullable = () => Xe(e), e.nullish = () => Qe(Xe(e)), e.nonoptional = (n) => Ea(e, n), e.array = () => ca(e), e.or = (n) => la([e, n]), e.and = (n) => pa(e, n), e.transform = (n) => et(e, ya(n)), e.default = (n) => za(e, n), e.prefault = (n) => Sa(e, n), e.catch = (n) => Ta(e, n), e.pipe = (n) => et(e, n), e.readonly = () => Pa(e), e.describe = (n) => {
|
|
4184
|
+
const r = e.clone();
|
|
4185
|
+
return Q.add(r, { description: n }), r;
|
|
4186
|
+
}, Object.defineProperty(e, "description", {
|
|
4187
|
+
get() {
|
|
4188
|
+
return Q.get(e)?.description;
|
|
4189
|
+
},
|
|
4190
|
+
configurable: !0
|
|
4191
|
+
}), e.meta = (...n) => {
|
|
4192
|
+
if (n.length === 0)
|
|
4193
|
+
return Q.get(e);
|
|
4194
|
+
const r = e.clone();
|
|
4195
|
+
return Q.add(r, n[0]), r;
|
|
4196
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e.apply = (n) => n(e), e)), At = /* @__PURE__ */ d("_ZodString", (e, t) => {
|
|
4197
|
+
Se.init(e, t), k.init(e, t), e._zod.processJSONSchema = (r, o, i) => Ki(e, r, o);
|
|
4198
|
+
const n = e._zod.bag;
|
|
4199
|
+
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...r) => e.check(/* @__PURE__ */ Ni(...r)), e.includes = (...r) => e.check(/* @__PURE__ */ Di(...r)), e.startsWith = (...r) => e.check(/* @__PURE__ */ ji(...r)), e.endsWith = (...r) => e.check(/* @__PURE__ */ Li(...r)), e.min = (...r) => e.check(/* @__PURE__ */ se(...r)), e.max = (...r) => e.check(/* @__PURE__ */ Et(...r)), e.length = (...r) => e.check(/* @__PURE__ */ Zt(...r)), e.nonempty = (...r) => e.check(/* @__PURE__ */ se(1, ...r)), e.lowercase = (r) => e.check(/* @__PURE__ */ Ci(r)), e.uppercase = (r) => e.check(/* @__PURE__ */ Ri(r)), e.trim = () => e.check(/* @__PURE__ */ Mi()), e.normalize = (...r) => e.check(/* @__PURE__ */ Ui(...r)), e.toLowerCase = () => e.check(/* @__PURE__ */ Fi()), e.toUpperCase = () => e.check(/* @__PURE__ */ Ji()), e.slugify = () => e.check(/* @__PURE__ */ xi());
|
|
4200
|
+
}), Ls = /* @__PURE__ */ d("ZodString", (e, t) => {
|
|
4201
|
+
Se.init(e, t), At.init(e, t), e.email = (n) => e.check(/* @__PURE__ */ ri(Us, n)), e.url = (n) => e.check(/* @__PURE__ */ ci(Ms, n)), e.jwt = (n) => e.check(/* @__PURE__ */ zi(ta, n)), e.emoji = (n) => e.check(/* @__PURE__ */ ui(Fs, n)), e.guid = (n) => e.check(/* @__PURE__ */ Ve(He, n)), e.uuid = (n) => e.check(/* @__PURE__ */ oi(re, n)), e.uuidv4 = (n) => e.check(/* @__PURE__ */ ii(re, n)), e.uuidv6 = (n) => e.check(/* @__PURE__ */ si(re, n)), e.uuidv7 = (n) => e.check(/* @__PURE__ */ ai(re, n)), e.nanoid = (n) => e.check(/* @__PURE__ */ di(Js, n)), e.guid = (n) => e.check(/* @__PURE__ */ Ve(He, n)), e.cuid = (n) => e.check(/* @__PURE__ */ li(xs, n)), e.cuid2 = (n) => e.check(/* @__PURE__ */ fi(qs, n)), e.ulid = (n) => e.check(/* @__PURE__ */ pi(Vs, n)), e.base64 = (n) => e.check(/* @__PURE__ */ wi(Qs, n)), e.base64url = (n) => e.check(/* @__PURE__ */ bi(Xs, n)), e.xid = (n) => e.check(/* @__PURE__ */ gi(Bs, n)), e.ksuid = (n) => e.check(/* @__PURE__ */ hi(Gs, n)), e.ipv4 = (n) => e.check(/* @__PURE__ */ mi(Ws, n)), e.ipv6 = (n) => e.check(/* @__PURE__ */ _i(Hs, n)), e.cidrv4 = (n) => e.check(/* @__PURE__ */ yi(Ks, n)), e.cidrv6 = (n) => e.check(/* @__PURE__ */ vi(Ys, n)), e.e164 = (n) => e.check(/* @__PURE__ */ ki(ea, n)), e.datetime = (n) => e.check(ys(n)), e.date = (n) => e.check(ws(n)), e.time = (n) => e.check(ks(n)), e.duration = (n) => e.check($s(n));
|
|
4202
|
+
});
|
|
4203
|
+
function yc(e) {
|
|
4204
|
+
return /* @__PURE__ */ ni(Ls, e);
|
|
4205
|
+
}
|
|
4206
|
+
const z = /* @__PURE__ */ d("ZodStringFormat", (e, t) => {
|
|
4207
|
+
w.init(e, t), At.init(e, t);
|
|
4208
|
+
}), Us = /* @__PURE__ */ d("ZodEmail", (e, t) => {
|
|
4209
|
+
co.init(e, t), z.init(e, t);
|
|
4210
|
+
}), He = /* @__PURE__ */ d("ZodGUID", (e, t) => {
|
|
4211
|
+
so.init(e, t), z.init(e, t);
|
|
4212
|
+
}), re = /* @__PURE__ */ d("ZodUUID", (e, t) => {
|
|
4213
|
+
ao.init(e, t), z.init(e, t);
|
|
4214
|
+
}), Ms = /* @__PURE__ */ d("ZodURL", (e, t) => {
|
|
4215
|
+
uo.init(e, t), z.init(e, t);
|
|
4216
|
+
}), Fs = /* @__PURE__ */ d("ZodEmoji", (e, t) => {
|
|
4217
|
+
lo.init(e, t), z.init(e, t);
|
|
4218
|
+
}), Js = /* @__PURE__ */ d("ZodNanoID", (e, t) => {
|
|
4219
|
+
fo.init(e, t), z.init(e, t);
|
|
4220
|
+
}), xs = /* @__PURE__ */ d("ZodCUID", (e, t) => {
|
|
4221
|
+
po.init(e, t), z.init(e, t);
|
|
4222
|
+
}), qs = /* @__PURE__ */ d("ZodCUID2", (e, t) => {
|
|
4223
|
+
go.init(e, t), z.init(e, t);
|
|
4224
|
+
}), Vs = /* @__PURE__ */ d("ZodULID", (e, t) => {
|
|
4225
|
+
ho.init(e, t), z.init(e, t);
|
|
4226
|
+
}), Bs = /* @__PURE__ */ d("ZodXID", (e, t) => {
|
|
4227
|
+
mo.init(e, t), z.init(e, t);
|
|
4228
|
+
}), Gs = /* @__PURE__ */ d("ZodKSUID", (e, t) => {
|
|
4229
|
+
_o.init(e, t), z.init(e, t);
|
|
4230
|
+
}), Ws = /* @__PURE__ */ d("ZodIPv4", (e, t) => {
|
|
4231
|
+
ko.init(e, t), z.init(e, t);
|
|
4232
|
+
}), Hs = /* @__PURE__ */ d("ZodIPv6", (e, t) => {
|
|
4233
|
+
zo.init(e, t), z.init(e, t);
|
|
4234
|
+
}), Ks = /* @__PURE__ */ d("ZodCIDRv4", (e, t) => {
|
|
4235
|
+
$o.init(e, t), z.init(e, t);
|
|
4236
|
+
}), Ys = /* @__PURE__ */ d("ZodCIDRv6", (e, t) => {
|
|
4237
|
+
So.init(e, t), z.init(e, t);
|
|
4238
|
+
}), Qs = /* @__PURE__ */ d("ZodBase64", (e, t) => {
|
|
4239
|
+
Eo.init(e, t), z.init(e, t);
|
|
4240
|
+
}), Xs = /* @__PURE__ */ d("ZodBase64URL", (e, t) => {
|
|
4241
|
+
To.init(e, t), z.init(e, t);
|
|
4242
|
+
}), ea = /* @__PURE__ */ d("ZodE164", (e, t) => {
|
|
4243
|
+
Io.init(e, t), z.init(e, t);
|
|
4244
|
+
}), ta = /* @__PURE__ */ d("ZodJWT", (e, t) => {
|
|
4245
|
+
Po.init(e, t), z.init(e, t);
|
|
4246
|
+
}), Nt = /* @__PURE__ */ d("ZodNumber", (e, t) => {
|
|
4247
|
+
kt.init(e, t), k.init(e, t), e._zod.processJSONSchema = (r, o, i) => Yi(e, r, o), e.gt = (r, o) => e.check(/* @__PURE__ */ Ge(r, o)), e.gte = (r, o) => e.check(/* @__PURE__ */ pe(r, o)), e.min = (r, o) => e.check(/* @__PURE__ */ pe(r, o)), e.lt = (r, o) => e.check(/* @__PURE__ */ Be(r, o)), e.lte = (r, o) => e.check(/* @__PURE__ */ fe(r, o)), e.max = (r, o) => e.check(/* @__PURE__ */ fe(r, o)), e.int = (r) => e.check(Ke(r)), e.safe = (r) => e.check(Ke(r)), e.positive = (r) => e.check(/* @__PURE__ */ Ge(0, r)), e.nonnegative = (r) => e.check(/* @__PURE__ */ pe(0, r)), e.negative = (r) => e.check(/* @__PURE__ */ Be(0, r)), e.nonpositive = (r) => e.check(/* @__PURE__ */ fe(0, r)), e.multipleOf = (r, o) => e.check(/* @__PURE__ */ We(r, o)), e.step = (r, o) => e.check(/* @__PURE__ */ We(r, o)), e.finite = () => e;
|
|
4248
|
+
const n = e._zod.bag;
|
|
4249
|
+
e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
|
|
4250
|
+
});
|
|
4251
|
+
function vc(e) {
|
|
4252
|
+
return /* @__PURE__ */ Ti(Nt, e);
|
|
4253
|
+
}
|
|
4254
|
+
const na = /* @__PURE__ */ d("ZodNumberFormat", (e, t) => {
|
|
4255
|
+
Ao.init(e, t), Nt.init(e, t);
|
|
4256
|
+
});
|
|
4257
|
+
function Ke(e) {
|
|
4258
|
+
return /* @__PURE__ */ Ii(na, e);
|
|
4259
|
+
}
|
|
4260
|
+
const ra = /* @__PURE__ */ d("ZodBoolean", (e, t) => {
|
|
4261
|
+
No.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Qi(e, n, r);
|
|
4262
|
+
});
|
|
4263
|
+
function wc(e) {
|
|
4264
|
+
return /* @__PURE__ */ Oi(ra, e);
|
|
4265
|
+
}
|
|
4266
|
+
const oa = /* @__PURE__ */ d("ZodUnknown", (e, t) => {
|
|
4267
|
+
Co.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => es();
|
|
4268
|
+
});
|
|
4269
|
+
function Ye() {
|
|
4270
|
+
return /* @__PURE__ */ Pi(oa);
|
|
4271
|
+
}
|
|
4272
|
+
const ia = /* @__PURE__ */ d("ZodNever", (e, t) => {
|
|
4273
|
+
Ro.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Xi(e, n, r);
|
|
4274
|
+
});
|
|
4275
|
+
function sa(e) {
|
|
4276
|
+
return /* @__PURE__ */ Ai(ia, e);
|
|
4277
|
+
}
|
|
4278
|
+
const aa = /* @__PURE__ */ d("ZodArray", (e, t) => {
|
|
4279
|
+
Do.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => is(e, n, r, o), e.element = t.element, e.min = (n, r) => e.check(/* @__PURE__ */ se(n, r)), e.nonempty = (n) => e.check(/* @__PURE__ */ se(1, n)), e.max = (n, r) => e.check(/* @__PURE__ */ Et(n, r)), e.length = (n, r) => e.check(/* @__PURE__ */ Zt(n, r)), e.unwrap = () => e.element;
|
|
4280
|
+
});
|
|
4281
|
+
function ca(e, t) {
|
|
4282
|
+
return /* @__PURE__ */ qi(aa, e, t);
|
|
4283
|
+
}
|
|
4284
|
+
const ua = /* @__PURE__ */ d("ZodObject", (e, t) => {
|
|
4285
|
+
Lo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ss(e, n, r, o), _(e, "shape", () => t.shape), e.keyof = () => ha(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: Ye() }), e.loose = () => e.clone({ ...e._zod.def, catchall: Ye() }), e.strict = () => e.clone({ ...e._zod.def, catchall: sa() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => or(e, n), e.safeExtend = (n) => ir(e, n), e.merge = (n) => sr(e, n), e.pick = (n) => nr(e, n), e.omit = (n) => rr(e, n), e.partial = (...n) => ar(Ct, e, n[0]), e.required = (...n) => cr(Rt, e, n[0]);
|
|
4286
|
+
});
|
|
4287
|
+
function bc(e, t) {
|
|
4288
|
+
const n = {
|
|
4289
|
+
type: "object",
|
|
4290
|
+
shape: e ?? {},
|
|
4291
|
+
...h(t)
|
|
4292
|
+
};
|
|
4293
|
+
return new ua(n);
|
|
4294
|
+
}
|
|
4295
|
+
const da = /* @__PURE__ */ d("ZodUnion", (e, t) => {
|
|
4296
|
+
Uo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => as(e, n, r, o), e.options = t.options;
|
|
4297
|
+
});
|
|
4298
|
+
function la(e, t) {
|
|
4299
|
+
return new da({
|
|
4300
|
+
type: "union",
|
|
4301
|
+
options: e,
|
|
4302
|
+
...h(t)
|
|
4303
|
+
});
|
|
4304
|
+
}
|
|
4305
|
+
const fa = /* @__PURE__ */ d("ZodIntersection", (e, t) => {
|
|
4306
|
+
Mo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => cs(e, n, r, o);
|
|
4307
|
+
});
|
|
4308
|
+
function pa(e, t) {
|
|
4309
|
+
return new fa({
|
|
4310
|
+
type: "intersection",
|
|
4311
|
+
left: e,
|
|
4312
|
+
right: t
|
|
4313
|
+
});
|
|
4314
|
+
}
|
|
4315
|
+
const ga = /* @__PURE__ */ d("ZodRecord", (e, t) => {
|
|
4316
|
+
Fo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => us(e, n, r, o), e.keyType = t.keyType, e.valueType = t.valueType;
|
|
4317
|
+
});
|
|
4318
|
+
function kc(e, t, n) {
|
|
4319
|
+
return new ga({
|
|
4320
|
+
type: "record",
|
|
4321
|
+
keyType: e,
|
|
4322
|
+
valueType: t,
|
|
4323
|
+
...h(n)
|
|
4324
|
+
});
|
|
4325
|
+
}
|
|
4326
|
+
const me = /* @__PURE__ */ d("ZodEnum", (e, t) => {
|
|
4327
|
+
Jo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (r, o, i) => ts(e, r, o), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
4328
|
+
const n = new Set(Object.keys(t.entries));
|
|
4329
|
+
e.extract = (r, o) => {
|
|
4330
|
+
const i = {};
|
|
4331
|
+
for (const s of r)
|
|
4332
|
+
if (n.has(s))
|
|
4333
|
+
i[s] = t.entries[s];
|
|
4334
|
+
else
|
|
4335
|
+
throw new Error(`Key ${s} not found in enum`);
|
|
4336
|
+
return new me({
|
|
4337
|
+
...t,
|
|
4338
|
+
checks: [],
|
|
4339
|
+
...h(o),
|
|
4340
|
+
entries: i
|
|
4341
|
+
});
|
|
4342
|
+
}, e.exclude = (r, o) => {
|
|
4343
|
+
const i = { ...t.entries };
|
|
4344
|
+
for (const s of r)
|
|
4345
|
+
if (n.has(s))
|
|
4346
|
+
delete i[s];
|
|
4347
|
+
else
|
|
4348
|
+
throw new Error(`Key ${s} not found in enum`);
|
|
4349
|
+
return new me({
|
|
4350
|
+
...t,
|
|
4351
|
+
checks: [],
|
|
4352
|
+
...h(o),
|
|
4353
|
+
entries: i
|
|
4354
|
+
});
|
|
4355
|
+
};
|
|
4356
|
+
});
|
|
4357
|
+
function ha(e, t) {
|
|
4358
|
+
const n = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
|
|
4359
|
+
return new me({
|
|
4360
|
+
type: "enum",
|
|
4361
|
+
entries: n,
|
|
4362
|
+
...h(t)
|
|
4363
|
+
});
|
|
4364
|
+
}
|
|
4365
|
+
const ma = /* @__PURE__ */ d("ZodLiteral", (e, t) => {
|
|
4366
|
+
xo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ns(e, n, r), e.values = new Set(t.values), Object.defineProperty(e, "value", {
|
|
4367
|
+
get() {
|
|
4368
|
+
if (t.values.length > 1)
|
|
4369
|
+
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
4370
|
+
return t.values[0];
|
|
4371
|
+
}
|
|
4372
|
+
});
|
|
4373
|
+
});
|
|
4374
|
+
function zc(e, t) {
|
|
4375
|
+
return new ma({
|
|
4376
|
+
type: "literal",
|
|
4377
|
+
values: Array.isArray(e) ? e : [e],
|
|
4378
|
+
...h(t)
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4381
|
+
const _a = /* @__PURE__ */ d("ZodTransform", (e, t) => {
|
|
4382
|
+
qo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => os(e, n), e._zod.parse = (n, r) => {
|
|
4383
|
+
if (r.direction === "backward")
|
|
4384
|
+
throw new st(e.constructor.name);
|
|
4385
|
+
n.addIssue = (i) => {
|
|
4386
|
+
if (typeof i == "string")
|
|
4387
|
+
n.issues.push(ee(i, n.value, t));
|
|
4388
|
+
else {
|
|
4389
|
+
const s = i;
|
|
4390
|
+
s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = n.value), s.inst ?? (s.inst = e), n.issues.push(ee(s));
|
|
4391
|
+
}
|
|
4392
|
+
};
|
|
4393
|
+
const o = t.transform(n.value, n);
|
|
4394
|
+
return o instanceof Promise ? o.then((i) => (n.value = i, n)) : (n.value = o, n);
|
|
4395
|
+
};
|
|
4396
|
+
});
|
|
4397
|
+
function ya(e) {
|
|
4398
|
+
return new _a({
|
|
4399
|
+
type: "transform",
|
|
4400
|
+
transform: e
|
|
4401
|
+
});
|
|
4402
|
+
}
|
|
4403
|
+
const Ct = /* @__PURE__ */ d("ZodOptional", (e, t) => {
|
|
4404
|
+
St.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Pt(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
4405
|
+
});
|
|
4406
|
+
function Qe(e) {
|
|
4407
|
+
return new Ct({
|
|
4408
|
+
type: "optional",
|
|
4409
|
+
innerType: e
|
|
4410
|
+
});
|
|
4411
|
+
}
|
|
4412
|
+
const va = /* @__PURE__ */ d("ZodExactOptional", (e, t) => {
|
|
4413
|
+
Vo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Pt(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
4414
|
+
});
|
|
4415
|
+
function wa(e) {
|
|
4416
|
+
return new va({
|
|
4417
|
+
type: "optional",
|
|
4418
|
+
innerType: e
|
|
4419
|
+
});
|
|
4420
|
+
}
|
|
4421
|
+
const ba = /* @__PURE__ */ d("ZodNullable", (e, t) => {
|
|
4422
|
+
Bo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ds(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
4423
|
+
});
|
|
4424
|
+
function Xe(e) {
|
|
4425
|
+
return new ba({
|
|
4426
|
+
type: "nullable",
|
|
4427
|
+
innerType: e
|
|
4428
|
+
});
|
|
4429
|
+
}
|
|
4430
|
+
const ka = /* @__PURE__ */ d("ZodDefault", (e, t) => {
|
|
4431
|
+
Go.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => fs(e, n, r, o), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
4432
|
+
});
|
|
4433
|
+
function za(e, t) {
|
|
4434
|
+
return new ka({
|
|
4435
|
+
type: "default",
|
|
4436
|
+
innerType: e,
|
|
4437
|
+
get defaultValue() {
|
|
4438
|
+
return typeof t == "function" ? t() : dt(t);
|
|
4439
|
+
}
|
|
4440
|
+
});
|
|
4441
|
+
}
|
|
4442
|
+
const $a = /* @__PURE__ */ d("ZodPrefault", (e, t) => {
|
|
4443
|
+
Wo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ps(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
4444
|
+
});
|
|
4445
|
+
function Sa(e, t) {
|
|
4446
|
+
return new $a({
|
|
4447
|
+
type: "prefault",
|
|
4448
|
+
innerType: e,
|
|
4449
|
+
get defaultValue() {
|
|
4450
|
+
return typeof t == "function" ? t() : dt(t);
|
|
4451
|
+
}
|
|
4452
|
+
});
|
|
4453
|
+
}
|
|
4454
|
+
const Rt = /* @__PURE__ */ d("ZodNonOptional", (e, t) => {
|
|
4455
|
+
Ho.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ls(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
4456
|
+
});
|
|
4457
|
+
function Ea(e, t) {
|
|
4458
|
+
return new Rt({
|
|
4459
|
+
type: "nonoptional",
|
|
4460
|
+
innerType: e,
|
|
4461
|
+
...h(t)
|
|
4462
|
+
});
|
|
4463
|
+
}
|
|
4464
|
+
const Za = /* @__PURE__ */ d("ZodCatch", (e, t) => {
|
|
4465
|
+
Ko.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => gs(e, n, r, o), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
4466
|
+
});
|
|
4467
|
+
function Ta(e, t) {
|
|
4468
|
+
return new Za({
|
|
4469
|
+
type: "catch",
|
|
4470
|
+
innerType: e,
|
|
4471
|
+
catchValue: typeof t == "function" ? t : () => t
|
|
4472
|
+
});
|
|
4473
|
+
}
|
|
4474
|
+
const Ia = /* @__PURE__ */ d("ZodPipe", (e, t) => {
|
|
4475
|
+
Yo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => hs(e, n, r, o), e.in = t.in, e.out = t.out;
|
|
4476
|
+
});
|
|
4477
|
+
function et(e, t) {
|
|
4478
|
+
return new Ia({
|
|
4479
|
+
type: "pipe",
|
|
4480
|
+
in: e,
|
|
4481
|
+
out: t
|
|
4482
|
+
// ...util.normalizeParams(params),
|
|
4483
|
+
});
|
|
4484
|
+
}
|
|
4485
|
+
const Oa = /* @__PURE__ */ d("ZodReadonly", (e, t) => {
|
|
4486
|
+
Qo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ms(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
4487
|
+
});
|
|
4488
|
+
function Pa(e) {
|
|
4489
|
+
return new Oa({
|
|
4490
|
+
type: "readonly",
|
|
4491
|
+
innerType: e
|
|
4492
|
+
});
|
|
4493
|
+
}
|
|
4494
|
+
const Aa = /* @__PURE__ */ d("ZodCustom", (e, t) => {
|
|
4495
|
+
Xo.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => rs(e, n);
|
|
4496
|
+
});
|
|
4497
|
+
function Na(e, t = {}) {
|
|
4498
|
+
return /* @__PURE__ */ Vi(Aa, e, t);
|
|
4499
|
+
}
|
|
4500
|
+
function Ca(e) {
|
|
4501
|
+
return /* @__PURE__ */ Bi(e);
|
|
4502
|
+
}
|
|
4503
|
+
export {
|
|
4504
|
+
Ut as $,
|
|
4505
|
+
Jn as A,
|
|
4506
|
+
ec as B,
|
|
4507
|
+
kc as C,
|
|
4508
|
+
fc as D,
|
|
4509
|
+
gc as E,
|
|
4510
|
+
mc as F,
|
|
4511
|
+
lc as G,
|
|
4512
|
+
uc as H,
|
|
4513
|
+
ac as I,
|
|
4514
|
+
sc as J,
|
|
4515
|
+
cc as K,
|
|
4516
|
+
hc as L,
|
|
4517
|
+
qa as M,
|
|
4518
|
+
Va as N,
|
|
4519
|
+
Wn as O,
|
|
4520
|
+
xa as P,
|
|
4521
|
+
Ma as Q,
|
|
4522
|
+
dc as R,
|
|
4523
|
+
pc as S,
|
|
4524
|
+
Ua as T,
|
|
4525
|
+
zc as U,
|
|
4526
|
+
Jt as V,
|
|
4527
|
+
Ha as W,
|
|
4528
|
+
Ee as X,
|
|
4529
|
+
Ft as Y,
|
|
4530
|
+
Mt as Z,
|
|
4531
|
+
ha as _,
|
|
4532
|
+
nc as a,
|
|
4533
|
+
jt as a0,
|
|
4534
|
+
Ht as a1,
|
|
4535
|
+
Ya as a2,
|
|
4536
|
+
X as a3,
|
|
4537
|
+
Lt as a4,
|
|
4538
|
+
j as a5,
|
|
4539
|
+
Gt as a6,
|
|
4540
|
+
Wt as a7,
|
|
4541
|
+
tc as a8,
|
|
4542
|
+
Qa as a9,
|
|
4543
|
+
_c as aa,
|
|
4544
|
+
Ka as ab,
|
|
4545
|
+
xt as ac,
|
|
4546
|
+
ic as b,
|
|
4547
|
+
nn as c,
|
|
4548
|
+
wc as d,
|
|
4549
|
+
Ye as e,
|
|
4550
|
+
ca as f,
|
|
4551
|
+
La as g,
|
|
4552
|
+
Fa as h,
|
|
4553
|
+
Pe as i,
|
|
4554
|
+
Wa as j,
|
|
4555
|
+
Xa as k,
|
|
4556
|
+
Ja as l,
|
|
4557
|
+
ja as m,
|
|
4558
|
+
Bn as n,
|
|
4559
|
+
bc as o,
|
|
4560
|
+
rc as p,
|
|
4561
|
+
oc as q,
|
|
4562
|
+
Da as r,
|
|
4563
|
+
yc as s,
|
|
4564
|
+
qn as t,
|
|
4565
|
+
la as u,
|
|
4566
|
+
vc as v,
|
|
4567
|
+
Ba as w,
|
|
4568
|
+
Gn as x,
|
|
4569
|
+
Ae as y,
|
|
4570
|
+
Ga as z
|
|
4571
|
+
};
|
|
4572
|
+
//# sourceMappingURL=schemas-CPkzbgia.js.map
|