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