react-semaphor 0.1.544 → 0.1.545
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/analytics-protocol/index.js +35 -34
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +2 -2
- package/dist/briefings/index.js +50 -47
- package/dist/chunks/{class-utils-Df1OVOT1.js → _commonjsHelpers-DimLPMtv.js} +124 -98
- package/dist/chunks/{apply-dashboard-operations-Bz4n1Lq6.js → apply-dashboard-operations-CZEMsx8E.js} +778 -958
- package/dist/chunks/{assistant-chat-BNLkCDml.js → assistant-chat-D7sWTypJ.js} +308 -309
- package/dist/chunks/calendar-day-equality-dvoQp1xW.js +410 -0
- package/dist/chunks/{comparison-window-caption-BTkrN3W4.js → comparison-window-caption-D4E6IHPD.js} +56 -55
- package/dist/chunks/{custom-visual-inputs-DUtpYZOk.js → custom-visual-inputs-DLCD9Y5V.js} +8 -2
- package/dist/chunks/{dashboard-g5a4DKWq.js → dashboard-B1tMju0u.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DQ_8O_e2.js → dashboard-briefing-launcher-CePgIu0Z.js} +771 -776
- package/dist/chunks/{dashboard-controls-8RyBTQUO.js → dashboard-controls-Cq05n3e0.js} +28 -28
- package/dist/chunks/{dashboard-json-7qT9jmfL.js → dashboard-json-CoYRPqxx.js} +3 -3
- package/dist/chunks/document-dashboard-inputs-BesAHZvB.js +3112 -0
- package/dist/chunks/{edit-dashboard-visual-BfJwnRIZ.js → edit-dashboard-visual-JPtNfJRb.js} +5624 -5615
- package/dist/chunks/{filter-value-text-CYsVYPuD.js → filter-value-text-ff7osJr7.js} +1 -1
- package/dist/chunks/{index-DkAyQvC6.js → index-DRWiuqyd.js} +378 -333
- package/dist/chunks/{matrix-formatter-CxJLkztA.js → matrix-formatter-DnCyRXJE.js} +13 -13
- package/dist/chunks/{numeric-presentation-DESvLiu9.js → numeric-presentation-7X_IrD58.js} +2571 -2572
- package/dist/chunks/{raw-temporal-presentation-CLiVi90c.js → raw-temporal-presentation-C3mUgnEx.js} +1 -1
- package/dist/chunks/{zoned-wall-clock-MulfA26h.js → relative-date-label-Bk2j94pA.js} +21 -64
- package/dist/chunks/rendered-file-D8xEuVVx.js +108 -0
- package/dist/chunks/{report-preferences-dialog-Df7VpRVW.js → report-preferences-dialog-DUtuUL_5.js} +631 -603
- package/dist/chunks/resolve-dashboard-input-context-DJ2tICwz.js +9415 -0
- package/dist/chunks/{saved-dashboard-context-B-mQ--nV.js → saved-dashboard-context-LrF_kW0l.js} +183 -211
- package/dist/chunks/selection-filter-compiler-BKXmyLrS.js +79 -0
- package/dist/chunks/{semaphor-ready-indicator-DDAxk8us.js → semaphor-ready-indicator-BxF96Yhv.js} +45764 -46519
- package/dist/chunks/{shelf-drop-preview-context-BSRPwaED.js → shelf-drop-preview-context-CNaM_Gmh.js} +885 -866
- package/dist/chunks/{switch-C3jLxlG0.js → switch-uDtPgQlQ.js} +44 -45
- package/dist/chunks/{table-export-sheet-CPfGAQ9X.js → table-export-sheet-YzMioA7Y.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BxzFviM-.js → use-create-flow-overlay-state-CjB7ig1o.js} +105 -105
- package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +556 -544
- package/dist/data-app-sdk/index.js +1 -1
- package/dist/format-utils/index.js +163 -152
- package/dist/index.js +351 -323
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/briefings/attachments.d.ts +33 -6
- package/dist/types/briefings/index.d.ts +6 -5
- package/dist/types/components/surfboard/filter/types.d.ts +0 -14
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +68 -82
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +0 -8
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +35 -1
- package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +199 -0
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +7 -2
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +1 -1
- package/dist/types/lib/dashboard-viewer/captured-runtime-values.d.ts +40 -0
- package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +16 -16
- package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +11 -9
- package/dist/types/lib/download-pdf.d.ts +75 -1
- package/dist/types/lib/hooks/use-date-filter.d.ts +5 -0
- package/dist/types/lib/hooks/use-text-filter.d.ts +5 -0
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +5 -4
- package/dist/types/lib/query-context/assemble-card-query.d.ts +158 -0
- package/dist/types/lib/query-context/build-card-query-context.d.ts +3 -3
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +15 -6
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +11 -13
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +22 -12
- package/dist/types/lib/stores/dashboard-store.d.ts +39 -55
- package/dist/types/lib/stores/editor-store.d.ts +0 -3
- package/dist/types/lib/types/common-types.d.ts +21 -6
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +4 -11
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +12 -12
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +92 -0
- package/dist/types/shared/dashboard-authoring/filter-model/ad-hoc-filter-values.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +29 -0
- package/dist/types/shared/dashboard-authoring/filter-model/filter-values.d.ts +58 -0
- package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/filter-model/prototype-document-inputs.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/filter-model/read-dashboard-filter-model.d.ts +78 -0
- package/dist/types/shared/dashboard-authoring/filter-model/stored-dashboard.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/filter-model/toolbar-filter-reach.d.ts +23 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +2 -0
- package/dist/types/shared/format-utils/exporters/index.d.ts +2 -0
- package/dist/types/shared/format-utils/exporters/rendered-file.d.ts +106 -0
- package/package.json +2 -2
- package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +0 -28
- package/dist/chunks/calendar-day-equality-BmJAWduY.js +0 -460
- package/dist/chunks/document-dashboard-inputs-BC6p-ESg.js +0 -8087
- package/dist/chunks/document-sheet-utils-Duo9uLoH.js +0 -3619
- package/dist/chunks/sort-target-MT1WK1vX.js +0 -29
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +0 -88
- package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +0 -10
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
var
|
|
1
|
+
var yr = (e) => {
|
|
2
2
|
throw TypeError(e);
|
|
3
3
|
};
|
|
4
|
-
var xr = (e, t, r) => t.has(e) ||
|
|
5
|
-
var Z = (e, t, r) => (xr(e, t, "read from private field"), r ? r.call(e) : t.get(e)), se = (e, t, r) => t.has(e) ?
|
|
4
|
+
var xr = (e, t, r) => t.has(e) || yr("Cannot " + r);
|
|
5
|
+
var Z = (e, t, r) => (xr(e, t, "read from private field"), r ? r.call(e) : t.get(e)), se = (e, t, r) => t.has(e) ? yr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), J = (e, t, r, n) => (xr(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
|
|
6
6
|
import { jsx as m, jsxs as T, Fragment as Ve } from "react/jsx-runtime";
|
|
7
7
|
import { useCallback as ae, useRef as oe, useMemo as qe, useEffect as ke, useState as L, useLayoutEffect as Ze, useId as fo } from "react";
|
|
8
|
-
import { u as H,
|
|
8
|
+
import { u as H, dj as mo, bZ as ho, b$ as go, b0 as vo, cN as bo, T as yo, dk as xo, dl as wo, aZ as _o, dm as Io, bl as So, dn as Gt, cI as Eo, dp as No, dq as Yt, dr as bn, ds as ko, aT as yn, cc as wr, dt as xn, du as To, dv as Ao, dw as Co, bX as wn, aY as _n, aK as $o, a_ as zo, bk as at, dx as Oo, dy as Mo, dz as Po, dA as Ro, $ as In, c9 as Zo, ca as Do, cb as jo, cg as Fo, dB as Lo, dC as Uo, dD as Bo } from "./semaphor-ready-indicator-BxF96Yhv.js";
|
|
9
9
|
import { i as Vo } from "./conversation-sQiWYUOb.js";
|
|
10
|
-
import { B as te, i as qo, j as Jo, c as Sn, L as Je, P as En, a as Nn, b as kn } from "./switch-
|
|
10
|
+
import { B as te, i as qo, j as Jo, c as Sn, L as Je, P as En, a as Nn, b as kn } from "./switch-uDtPgQlQ.js";
|
|
11
11
|
import "./index-CuHybtft.js";
|
|
12
12
|
import "./validators-DMHTpf7a.js";
|
|
13
13
|
import "./matrix-operation-contract-8OIO4gob.js";
|
|
14
14
|
import "./analytics-base-schemas-BFAoRlkU.js";
|
|
15
15
|
import "zod";
|
|
16
16
|
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as Ko } from "../value-format-preferences/index.js";
|
|
17
|
-
import { c as q } from "./
|
|
17
|
+
import { g as Wo, c as q } from "./_commonjsHelpers-DimLPMtv.js";
|
|
18
18
|
import { f as Tn } from "./editor-draft-sync-BN5qYHPF.js";
|
|
19
|
-
import { A as
|
|
20
|
-
import { l as
|
|
21
|
-
import { p as Ir, a as
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { w as
|
|
25
|
-
import { A as
|
|
26
|
-
import { v as Sr } from "./custom-visual-inputs-
|
|
27
|
-
import { g as ss } from "./_commonjsHelpers-BkfeUUK-.js";
|
|
19
|
+
import { A as Go } from "./table-settings-CLZocegs.js";
|
|
20
|
+
import { l as Yo, m as Ke, c as _r, A as We, d as An } from "./context-ClREvqCZ.js";
|
|
21
|
+
import { p as Ir, a as Ho, A as Cn } from "./saved-dashboard-context-LrF_kW0l.js";
|
|
22
|
+
import { ch as Xo, aX as Qo } from "./resolve-dashboard-input-context-DJ2tICwz.js";
|
|
23
|
+
import { d as es } from "./document-dashboard-inputs-BesAHZvB.js";
|
|
24
|
+
import { w as ts, c as $n } from "./visual-choice-JiJ-_3bi.js";
|
|
25
|
+
import { A as rs, v as zn, t as ns, e as ue, d as as, b as os, f as Ht, s as Dt, a as ss } from "./add-to-dashboard-BuAqfA2Y.js";
|
|
26
|
+
import { v as Sr } from "./custom-visual-inputs-DLCD9Y5V.js";
|
|
28
27
|
import { S as Er, U as Nr, V as kr, O as Tr, f as is, F as ls } from "./temporal-bucket-D7NBrrtL.js";
|
|
29
28
|
import { C as cs, a as us } from "./selection-reducer-Dj_8xD69.js";
|
|
30
|
-
import { c as
|
|
31
|
-
import {
|
|
29
|
+
import { c as yt, X as Ge } from "./x-4f5U2XwU.js";
|
|
30
|
+
import { s as ds, t as ps, u as fs, v as ot, w as ms, x as Ar, y as hs } from "./matrix-formatter-DnCyRXJE.js";
|
|
32
31
|
import { L as Cr } from "./layout-grid-Bgzth8vd.js";
|
|
33
32
|
function gs(e, t, r) {
|
|
34
33
|
const n = ds(), a = (r == null ? void 0 : r.locale) ?? n.locale ?? ps, o = fs(e, t);
|
|
@@ -40,10 +39,10 @@ function gs(e, t, r) {
|
|
|
40
39
|
});
|
|
41
40
|
let c, p;
|
|
42
41
|
o > 0 ? (c = ot(t), p = ot(e)) : (c = ot(e), p = ot(t));
|
|
43
|
-
const i = ms((r == null ? void 0 : r.roundingMethod) ?? "round"),
|
|
42
|
+
const i = ms((r == null ? void 0 : r.roundingMethod) ?? "round"), y = p.getTime() - c.getTime(), u = y / Tr, g = Ar(p) - Ar(c), I = (y - g) / Tr, _ = r == null ? void 0 : r.unit;
|
|
44
43
|
let N;
|
|
45
44
|
if (_ ? N = _ : u < 1 ? N = "second" : u < 60 ? N = "minute" : u < Er ? N = "hour" : I < Nr ? N = "day" : I < kr ? N = "month" : N = "year", N === "second") {
|
|
46
|
-
const E = i(
|
|
45
|
+
const E = i(y / 1e3);
|
|
47
46
|
return a.formatDistance("xSeconds", E, s);
|
|
48
47
|
} else if (N === "minute") {
|
|
49
48
|
const E = i(u);
|
|
@@ -71,7 +70,7 @@ function vs(e, t) {
|
|
|
71
70
|
* This source code is licensed under the ISC license.
|
|
72
71
|
* See the LICENSE file in the root directory of this source tree.
|
|
73
72
|
*/
|
|
74
|
-
const
|
|
73
|
+
const bs = yt("AppWindow", [
|
|
75
74
|
["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }],
|
|
76
75
|
["path", { d: "M10 4v4", key: "pp8u80" }],
|
|
77
76
|
["path", { d: "M2 8h20", key: "d11cs7" }],
|
|
@@ -83,7 +82,7 @@ const ys = bt("AppWindow", [
|
|
|
83
82
|
* This source code is licensed under the ISC license.
|
|
84
83
|
* See the LICENSE file in the root directory of this source tree.
|
|
85
84
|
*/
|
|
86
|
-
const
|
|
85
|
+
const ys = yt("CornerDownLeft", [
|
|
87
86
|
["polyline", { points: "9 10 4 15 9 20", key: "r3jprv" }],
|
|
88
87
|
["path", { d: "M20 4v7a4 4 0 0 1-4 4H4", key: "6o5b7l" }]
|
|
89
88
|
]);
|
|
@@ -93,7 +92,7 @@ const bs = bt("CornerDownLeft", [
|
|
|
93
92
|
* This source code is licensed under the ISC license.
|
|
94
93
|
* See the LICENSE file in the root directory of this source tree.
|
|
95
94
|
*/
|
|
96
|
-
const xs =
|
|
95
|
+
const xs = yt("PanelLeft", [
|
|
97
96
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
98
97
|
["path", { d: "M9 3v18", key: "fh3hqa" }]
|
|
99
98
|
]);
|
|
@@ -103,7 +102,7 @@ const xs = bt("PanelLeft", [
|
|
|
103
102
|
* This source code is licensed under the ISC license.
|
|
104
103
|
* See the LICENSE file in the root directory of this source tree.
|
|
105
104
|
*/
|
|
106
|
-
const On =
|
|
105
|
+
const On = yt("PanelRight", [
|
|
107
106
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
108
107
|
["path", { d: "M15 3v18", key: "14nvp0" }]
|
|
109
108
|
]);
|
|
@@ -115,7 +114,7 @@ class Mn extends Error {
|
|
|
115
114
|
function ws(e = "dashboard") {
|
|
116
115
|
let t;
|
|
117
116
|
return e === "none" ? () => {
|
|
118
|
-
const r =
|
|
117
|
+
const r = Xo();
|
|
119
118
|
return t && $r(t.reads, [r]) || (t = { reads: [r], sent: { context: Ir({ surface: "none", timeZone: r }) } }), t.sent;
|
|
120
119
|
} : ({ focus: r, snapshot: n, editing: a }) => {
|
|
121
120
|
var _;
|
|
@@ -129,7 +128,7 @@ function ws(e = "dashboard") {
|
|
|
129
128
|
unsavedEdits: !1,
|
|
130
129
|
runtimeValues: {
|
|
131
130
|
dashboardInputValues: o.dashboardInputValues,
|
|
132
|
-
|
|
131
|
+
adHocFilterValues: o.adHocFilterValues,
|
|
133
132
|
controlValues: o.controlValues,
|
|
134
133
|
inlineFilterValuesMap: o.inlineFilterValuesMap,
|
|
135
134
|
cardControlValuesMap: o.cardControlValuesMap,
|
|
@@ -139,7 +138,7 @@ function ws(e = "dashboard") {
|
|
|
139
138
|
...c && p !== void 0 ? { selectedCard: { cardId: c, snapshot: p, ...a ? { card: a.card } : {} } } : {},
|
|
140
139
|
...a ? { editing: { mode: a.mode } } : {},
|
|
141
140
|
calendar: s
|
|
142
|
-
},
|
|
141
|
+
}, y = [
|
|
143
142
|
i.dashboard,
|
|
144
143
|
i.sheetId,
|
|
145
144
|
...Object.values(i.runtimeValues),
|
|
@@ -150,37 +149,37 @@ function ws(e = "dashboard") {
|
|
|
150
149
|
a == null ? void 0 : a.mode,
|
|
151
150
|
s
|
|
152
151
|
];
|
|
153
|
-
if (t && $r(t.reads,
|
|
154
|
-
const u = Ir(i), g = u.selectedCard ?
|
|
152
|
+
if (t && $r(t.reads, y)) return t.sent;
|
|
153
|
+
const u = Ir(i), g = u.selectedCard ? Ho({
|
|
155
154
|
dashboard: o.dashboard,
|
|
156
155
|
cardId: u.selectedCard.id,
|
|
157
156
|
snapshot: p ?? "pending",
|
|
158
157
|
...a ? { card: a.card } : {}
|
|
159
158
|
}) : void 0, I = { context: u, ...g ? { cardReplay: g } : {} };
|
|
160
|
-
return t = { reads:
|
|
159
|
+
return t = { reads: y, sent: I }, I;
|
|
161
160
|
};
|
|
162
161
|
}
|
|
163
162
|
function $r(e, t) {
|
|
164
163
|
return e.length === t.length && e.every((r, n) => Object.is(r, t[n]));
|
|
165
164
|
}
|
|
166
165
|
function _s(e) {
|
|
167
|
-
const { canEditDashboard: t, isInspectionMode: r } = ho(), n = go(), a = H((
|
|
166
|
+
const { canEditDashboard: t, isInspectionMode: r } = ho(), n = go(), a = H((y) => {
|
|
168
167
|
var g, I;
|
|
169
|
-
const u = (I = (g =
|
|
168
|
+
const u = (I = (g = y.dashboard) == null ? void 0 : g.sheets) == null ? void 0 : I.find((_) => _.id === y.selectedSheetId);
|
|
170
169
|
return !!u && !Qo(u);
|
|
171
|
-
}), o = H((
|
|
172
|
-
async (
|
|
170
|
+
}), o = H((y) => y.isVisualEditing), s = vo(), c = bo(), p = ae(
|
|
171
|
+
async (y, u) => {
|
|
173
172
|
var C, M;
|
|
174
173
|
const g = H.getState(), I = (C = g.dashboard) == null ? void 0 : C.id, _ = g.selectedSheetId;
|
|
175
174
|
if (!I || !_) throw new dt(Nt);
|
|
176
|
-
const N = { title:
|
|
175
|
+
const N = { title: y.title, type: rs[u], ...y.card }, E = !Is({ ...N, id: "check" }, y, u), b = { ...N, ...E ? { type: "table" } : {}, id: Sr() }, w = { id: Sr(), cards: [b], activeCardId: b.id }, h = await c(w, { reuseLoaded: !0 }).catch((Q) => {
|
|
177
176
|
console.warn("Adding the result without refreshed semantic metadata:", Q);
|
|
178
177
|
}), d = structuredClone(H.getState().semanticExecutionPayload);
|
|
179
|
-
|
|
180
|
-
const v =
|
|
181
|
-
|
|
182
|
-
Ss(
|
|
183
|
-
), f = v === (
|
|
178
|
+
yo(d, h);
|
|
179
|
+
const v = ts(
|
|
180
|
+
b.config ?? {},
|
|
181
|
+
Ss(b, _, d, s)
|
|
182
|
+
), f = v === (b.config ?? {}) ? w : { ...w, cards: [{ ...b, config: v }] }, x = H.getState();
|
|
184
183
|
if (((M = x.dashboard) == null ? void 0 : M.id) !== I || x.selectedSheetId !== _ || x.isVisualEditing)
|
|
185
184
|
throw new dt(Nt);
|
|
186
185
|
const { actions: k } = x;
|
|
@@ -197,7 +196,7 @@ function Is(e, t, r) {
|
|
|
197
196
|
if (r !== "line" && r !== "bar" && r !== "stackedBar") return !0;
|
|
198
197
|
const n = $n(zn(t), r);
|
|
199
198
|
if (!n.ok) return !1;
|
|
200
|
-
const { x: a, y: o = [], series: s } = n.visual.encodings, c = xo({ card: e, cardType: e.type, records: t.records }), p = (i,
|
|
199
|
+
const { x: a, y: o = [], series: s } = n.visual.encodings, c = xo({ card: e, cardType: e.type, records: t.records }), p = (i, y, u) => JSON.stringify([i, y ?? null, [...u].sort()]);
|
|
201
200
|
return p(c.axisKeys, c.seriesKey, c.valueKeys) === p(a ? [a] : [], s, o);
|
|
202
201
|
}
|
|
203
202
|
class dt extends Error {
|
|
@@ -214,7 +213,7 @@ function Pn(e, t) {
|
|
|
214
213
|
}
|
|
215
214
|
function Ss(e, t, r, n) {
|
|
216
215
|
var s;
|
|
217
|
-
const a = wo(H.getState()), o =
|
|
216
|
+
const a = wo(H.getState()), o = es({
|
|
218
217
|
...a,
|
|
219
218
|
cardId: e.id,
|
|
220
219
|
cardOverride: e,
|
|
@@ -366,8 +365,8 @@ function S(e, t, r) {
|
|
|
366
365
|
value: c._zod ?? {},
|
|
367
366
|
enumerable: !1
|
|
368
367
|
}), (i = c._zod).traits ?? (i.traits = /* @__PURE__ */ new Set()), c._zod.traits.add(e), t(c, p);
|
|
369
|
-
for (const
|
|
370
|
-
|
|
368
|
+
for (const y in s.prototype)
|
|
369
|
+
y in c || Object.defineProperty(c, y, { value: s.prototype[y].bind(c) });
|
|
371
370
|
c._zod.constr = s, c._zod.def = p;
|
|
372
371
|
}
|
|
373
372
|
const a = (r == null ? void 0 : r.Parent) ?? Object;
|
|
@@ -378,8 +377,8 @@ function S(e, t, r) {
|
|
|
378
377
|
var p;
|
|
379
378
|
const i = r != null && r.Parent ? new o() : this;
|
|
380
379
|
n(i, c), (p = i._zod).deferred ?? (p.deferred = []);
|
|
381
|
-
for (const
|
|
382
|
-
|
|
380
|
+
for (const y of i._zod.deferred)
|
|
381
|
+
y();
|
|
383
382
|
return i;
|
|
384
383
|
}
|
|
385
384
|
return Object.defineProperty(s, "init", { value: n }), Object.defineProperty(s, Symbol.hasInstance, {
|
|
@@ -629,8 +628,8 @@ function ge(e, t, r) {
|
|
|
629
628
|
var a, o, s, c, p, i;
|
|
630
629
|
const n = { ...e, path: e.path ?? [] };
|
|
631
630
|
if (!e.message) {
|
|
632
|
-
const
|
|
633
|
-
n.message =
|
|
631
|
+
const y = st((s = (o = (a = e.inst) == null ? void 0 : a._zod.def) == null ? void 0 : o.error) == null ? void 0 : s.call(o, e)) ?? st((c = t == null ? void 0 : t.error) == null ? void 0 : c.call(t, e)) ?? st((p = r.customError) == null ? void 0 : p.call(r, e)) ?? st((i = r.localeError) == null ? void 0 : i.call(r, e)) ?? "Invalid input";
|
|
632
|
+
n.message = y;
|
|
634
633
|
}
|
|
635
634
|
return delete n.inst, delete n.continue, t != null && t.reportInput || delete n.input, n;
|
|
636
635
|
}
|
|
@@ -734,10 +733,10 @@ function ia(e) {
|
|
|
734
733
|
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
735
734
|
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+)?)?`;
|
|
736
735
|
}
|
|
737
|
-
function
|
|
736
|
+
function bi(e) {
|
|
738
737
|
return new RegExp(`^${ia(e)}$`);
|
|
739
738
|
}
|
|
740
|
-
function
|
|
739
|
+
function yi(e) {
|
|
741
740
|
const t = ia({ precision: e.precision }), r = ["Z"];
|
|
742
741
|
e.local && r.push(""), e.offset && r.push("([+-]\\d{2}:\\d{2})");
|
|
743
742
|
const n = `${t}(?:${r.join("|")})`;
|
|
@@ -1060,7 +1059,7 @@ const Fi = {
|
|
|
1060
1059
|
});
|
|
1061
1060
|
else {
|
|
1062
1061
|
const o = (s, c, p) => {
|
|
1063
|
-
let i = Be(s),
|
|
1062
|
+
let i = Be(s), y;
|
|
1064
1063
|
for (const u of c) {
|
|
1065
1064
|
if (u._zod.def.when) {
|
|
1066
1065
|
if (!u._zod.def.when(s))
|
|
@@ -1070,8 +1069,8 @@ const Fi = {
|
|
|
1070
1069
|
const g = s.issues.length, I = u._zod.check(s);
|
|
1071
1070
|
if (I instanceof Promise && (p == null ? void 0 : p.async) === !1)
|
|
1072
1071
|
throw new Ye();
|
|
1073
|
-
if (
|
|
1074
|
-
|
|
1072
|
+
if (y || I instanceof Promise)
|
|
1073
|
+
y = (y ?? Promise.resolve()).then(async () => {
|
|
1075
1074
|
await I, s.issues.length !== g && (i || (i = Be(s, g)));
|
|
1076
1075
|
});
|
|
1077
1076
|
else {
|
|
@@ -1080,7 +1079,7 @@ const Fi = {
|
|
|
1080
1079
|
i || (i = Be(s, g));
|
|
1081
1080
|
}
|
|
1082
1081
|
}
|
|
1083
|
-
return
|
|
1082
|
+
return y ? y.then(() => s) : s;
|
|
1084
1083
|
};
|
|
1085
1084
|
e._zod.run = (s, c) => {
|
|
1086
1085
|
const p = e._zod.parse(s, c);
|
|
@@ -1194,11 +1193,11 @@ const Fi = {
|
|
|
1194
1193
|
}), Hi = /* @__PURE__ */ S("$ZodKSUID", (e, t) => {
|
|
1195
1194
|
t.pattern ?? (t.pattern = ni), j.init(e, t);
|
|
1196
1195
|
}), Xi = /* @__PURE__ */ S("$ZodISODateTime", (e, t) => {
|
|
1197
|
-
t.pattern ?? (t.pattern =
|
|
1196
|
+
t.pattern ?? (t.pattern = yi(t)), j.init(e, t);
|
|
1198
1197
|
}), Qi = /* @__PURE__ */ S("$ZodISODate", (e, t) => {
|
|
1199
1198
|
t.pattern ?? (t.pattern = vi), j.init(e, t);
|
|
1200
1199
|
}), el = /* @__PURE__ */ S("$ZodISOTime", (e, t) => {
|
|
1201
|
-
t.pattern ?? (t.pattern =
|
|
1200
|
+
t.pattern ?? (t.pattern = bi(t)), j.init(e, t);
|
|
1202
1201
|
}), tl = /* @__PURE__ */ S("$ZodISODuration", (e, t) => {
|
|
1203
1202
|
t.pattern ?? (t.pattern = oi), j.init(e, t);
|
|
1204
1203
|
}), rl = /* @__PURE__ */ S("$ZodIPv4", (e, t) => {
|
|
@@ -1404,7 +1403,7 @@ function it(e, t, r) {
|
|
|
1404
1403
|
function Rr(e, t, r, n) {
|
|
1405
1404
|
e.issues.length ? n[r] === void 0 ? r in n ? t.value[r] = void 0 : t.value[r] = e.value : t.issues.push(..._e(r, e.issues)) : e.value === void 0 ? r in n && (t.value[r] = void 0) : t.value[r] = e.value;
|
|
1406
1405
|
}
|
|
1407
|
-
const
|
|
1406
|
+
const bl = /* @__PURE__ */ S("$ZodObject", (e, t) => {
|
|
1408
1407
|
D.init(e, t);
|
|
1409
1408
|
const r = Xt(() => {
|
|
1410
1409
|
const u = Object.keys(t.shape);
|
|
@@ -1477,14 +1476,14 @@ const yl = /* @__PURE__ */ S("$ZodObject", (e, t) => {
|
|
|
1477
1476
|
})));`), g.write(`newResult[${Fe(w)}] = ${h}.value`);
|
|
1478
1477
|
}
|
|
1479
1478
|
g.write("payload.value = newResult;"), g.write("return payload;");
|
|
1480
|
-
const
|
|
1481
|
-
return (w, h) =>
|
|
1479
|
+
const b = g.compile();
|
|
1480
|
+
return (w, h) => b(u, w, h);
|
|
1482
1481
|
};
|
|
1483
1482
|
let a;
|
|
1484
1483
|
const o = mt, s = !Hn.jitless, p = s && Zs.value, i = t.catchall;
|
|
1485
|
-
let
|
|
1484
|
+
let y;
|
|
1486
1485
|
e._zod.parse = (u, g) => {
|
|
1487
|
-
|
|
1486
|
+
y ?? (y = r.value);
|
|
1488
1487
|
const I = u.value;
|
|
1489
1488
|
if (!o(I))
|
|
1490
1489
|
return u.issues.push({
|
|
@@ -1498,15 +1497,15 @@ const yl = /* @__PURE__ */ S("$ZodObject", (e, t) => {
|
|
|
1498
1497
|
a || (a = n(t.shape)), u = a(u, g);
|
|
1499
1498
|
else {
|
|
1500
1499
|
u.value = {};
|
|
1501
|
-
const h =
|
|
1502
|
-
for (const d of
|
|
1500
|
+
const h = y.shape;
|
|
1501
|
+
for (const d of y.keys) {
|
|
1503
1502
|
const v = h[d], f = v._zod.run({ value: I[d], issues: [] }, g), x = v._zod.optin === "optional" && v._zod.optout === "optional";
|
|
1504
1503
|
f instanceof Promise ? _.push(f.then((k) => x ? Rr(k, u, d, I) : it(k, u, d))) : x ? Rr(f, u, d, I) : it(f, u, d);
|
|
1505
1504
|
}
|
|
1506
1505
|
}
|
|
1507
1506
|
if (!i)
|
|
1508
1507
|
return _.length ? Promise.all(_).then(() => u) : u;
|
|
1509
|
-
const N = [], E =
|
|
1508
|
+
const N = [], E = y.keySet, b = i._zod, w = b.def.type;
|
|
1510
1509
|
for (const h of Object.keys(I)) {
|
|
1511
1510
|
if (E.has(h))
|
|
1512
1511
|
continue;
|
|
@@ -1514,7 +1513,7 @@ const yl = /* @__PURE__ */ S("$ZodObject", (e, t) => {
|
|
|
1514
1513
|
N.push(h);
|
|
1515
1514
|
continue;
|
|
1516
1515
|
}
|
|
1517
|
-
const d =
|
|
1516
|
+
const d = b.run({ value: I[h], issues: [] }, g);
|
|
1518
1517
|
d instanceof Promise ? _.push(d.then((v) => it(v, u, h))) : it(d, u, h);
|
|
1519
1518
|
}
|
|
1520
1519
|
return N.length && u.issues.push({
|
|
@@ -1563,7 +1562,7 @@ const fa = /* @__PURE__ */ S("$ZodUnion", (e, t) => {
|
|
|
1563
1562
|
}
|
|
1564
1563
|
return a ? Promise.all(o).then((s) => Zr(s, r, e, n)) : Zr(o, r, e, n);
|
|
1565
1564
|
};
|
|
1566
|
-
}),
|
|
1565
|
+
}), yl = /* @__PURE__ */ S("$ZodDiscriminatedUnion", (e, t) => {
|
|
1567
1566
|
fa.init(e, t);
|
|
1568
1567
|
const r = e._zod.parse;
|
|
1569
1568
|
P(e._zod, "propValues", () => {
|
|
@@ -1679,8 +1678,8 @@ const wl = /* @__PURE__ */ S("$ZodRecord", (e, t) => {
|
|
|
1679
1678
|
for (const p of s)
|
|
1680
1679
|
if (typeof p == "string" || typeof p == "number" || typeof p == "symbol") {
|
|
1681
1680
|
const i = t.valueType._zod.run({ value: a[p], issues: [] }, n);
|
|
1682
|
-
i instanceof Promise ? o.push(i.then((
|
|
1683
|
-
|
|
1681
|
+
i instanceof Promise ? o.push(i.then((y) => {
|
|
1682
|
+
y.issues.length && r.issues.push(..._e(p, y.issues)), r.value[p] = y.value;
|
|
1684
1683
|
})) : (i.issues.length && r.issues.push(..._e(p, i.issues)), r.value[p] = i.value);
|
|
1685
1684
|
}
|
|
1686
1685
|
let c;
|
|
@@ -2258,7 +2257,7 @@ function vc(e, t) {
|
|
|
2258
2257
|
includes: e
|
|
2259
2258
|
});
|
|
2260
2259
|
}
|
|
2261
|
-
function
|
|
2260
|
+
function bc(e, t) {
|
|
2262
2261
|
return new Ri({
|
|
2263
2262
|
check: "string_format",
|
|
2264
2263
|
format: "starts_with",
|
|
@@ -2266,7 +2265,7 @@ function yc(e, t) {
|
|
|
2266
2265
|
prefix: e
|
|
2267
2266
|
});
|
|
2268
2267
|
}
|
|
2269
|
-
function
|
|
2268
|
+
function yc(e, t) {
|
|
2270
2269
|
return new Zi({
|
|
2271
2270
|
check: "string_format",
|
|
2272
2271
|
format: "ends_with",
|
|
@@ -2354,12 +2353,12 @@ class Wr {
|
|
|
2354
2353
|
const E = c.schema;
|
|
2355
2354
|
switch (a.type) {
|
|
2356
2355
|
case "string": {
|
|
2357
|
-
const
|
|
2358
|
-
|
|
2356
|
+
const b = E;
|
|
2357
|
+
b.type = "string";
|
|
2359
2358
|
const { minimum: w, maximum: h, format: d, patterns: v, contentEncoding: f } = t._zod.bag;
|
|
2360
|
-
if (typeof w == "number" && (
|
|
2359
|
+
if (typeof w == "number" && (b.minLength = w), typeof h == "number" && (b.maxLength = h), d && (b.format = o[d] ?? d, b.format === "" && delete b.format), f && (b.contentEncoding = f), v && v.size > 0) {
|
|
2361
2360
|
const x = [...v];
|
|
2362
|
-
x.length === 1 ?
|
|
2361
|
+
x.length === 1 ? b.pattern = x[0].source : x.length > 1 && (c.schema.allOf = [
|
|
2363
2362
|
...x.map((k) => ({
|
|
2364
2363
|
...this.target === "draft-7" ? { type: "string" } : {},
|
|
2365
2364
|
pattern: k.source
|
|
@@ -2369,13 +2368,13 @@ class Wr {
|
|
|
2369
2368
|
break;
|
|
2370
2369
|
}
|
|
2371
2370
|
case "number": {
|
|
2372
|
-
const
|
|
2373
|
-
typeof d == "string" && d.includes("int") ?
|
|
2371
|
+
const b = E, { minimum: w, maximum: h, format: d, multipleOf: v, exclusiveMaximum: f, exclusiveMinimum: x } = t._zod.bag;
|
|
2372
|
+
typeof d == "string" && d.includes("int") ? b.type = "integer" : b.type = "number", typeof x == "number" && (b.exclusiveMinimum = x), typeof w == "number" && (b.minimum = w, typeof x == "number" && (x >= w ? delete b.minimum : delete b.exclusiveMinimum)), typeof f == "number" && (b.exclusiveMaximum = f), typeof h == "number" && (b.maximum = h, typeof f == "number" && (f <= h ? delete b.maximum : delete b.exclusiveMaximum)), typeof v == "number" && (b.multipleOf = v);
|
|
2374
2373
|
break;
|
|
2375
2374
|
}
|
|
2376
2375
|
case "boolean": {
|
|
2377
|
-
const
|
|
2378
|
-
|
|
2376
|
+
const b = E;
|
|
2377
|
+
b.type = "boolean";
|
|
2379
2378
|
break;
|
|
2380
2379
|
}
|
|
2381
2380
|
case "bigint": {
|
|
@@ -2416,16 +2415,16 @@ class Wr {
|
|
|
2416
2415
|
break;
|
|
2417
2416
|
}
|
|
2418
2417
|
case "array": {
|
|
2419
|
-
const
|
|
2420
|
-
typeof w == "number" && (
|
|
2418
|
+
const b = E, { minimum: w, maximum: h } = t._zod.bag;
|
|
2419
|
+
typeof w == "number" && (b.minItems = w), typeof h == "number" && (b.maxItems = h), b.type = "array", b.items = this.process(a.element, { ..._, path: [..._.path, "items"] });
|
|
2421
2420
|
break;
|
|
2422
2421
|
}
|
|
2423
2422
|
case "object": {
|
|
2424
|
-
const
|
|
2425
|
-
|
|
2423
|
+
const b = E;
|
|
2424
|
+
b.type = "object", b.properties = {};
|
|
2426
2425
|
const w = a.shape;
|
|
2427
2426
|
for (const v in w)
|
|
2428
|
-
|
|
2427
|
+
b.properties[v] = this.process(w[v], {
|
|
2429
2428
|
..._,
|
|
2430
2429
|
path: [..._.path, "properties", v]
|
|
2431
2430
|
});
|
|
@@ -2433,22 +2432,22 @@ class Wr {
|
|
|
2433
2432
|
const f = a.shape[v]._zod;
|
|
2434
2433
|
return this.io === "input" ? f.optin === void 0 : f.optout === void 0;
|
|
2435
2434
|
}));
|
|
2436
|
-
d.size > 0 && (
|
|
2435
|
+
d.size > 0 && (b.required = Array.from(d)), ((I = a.catchall) == null ? void 0 : I._zod.def.type) === "never" ? b.additionalProperties = !1 : a.catchall ? a.catchall && (b.additionalProperties = this.process(a.catchall, {
|
|
2437
2436
|
..._,
|
|
2438
2437
|
path: [..._.path, "additionalProperties"]
|
|
2439
|
-
})) : this.io === "output" && (
|
|
2438
|
+
})) : this.io === "output" && (b.additionalProperties = !1);
|
|
2440
2439
|
break;
|
|
2441
2440
|
}
|
|
2442
2441
|
case "union": {
|
|
2443
|
-
const
|
|
2444
|
-
|
|
2442
|
+
const b = E;
|
|
2443
|
+
b.anyOf = a.options.map((w, h) => this.process(w, {
|
|
2445
2444
|
..._,
|
|
2446
2445
|
path: [..._.path, "anyOf", h]
|
|
2447
2446
|
}));
|
|
2448
2447
|
break;
|
|
2449
2448
|
}
|
|
2450
2449
|
case "intersection": {
|
|
2451
|
-
const
|
|
2450
|
+
const b = E, w = this.process(a.left, {
|
|
2452
2451
|
..._,
|
|
2453
2452
|
path: [..._.path, "allOf", 0]
|
|
2454
2453
|
}), h = this.process(a.right, {
|
|
@@ -2458,31 +2457,31 @@ class Wr {
|
|
|
2458
2457
|
...d(w) ? w.allOf : [w],
|
|
2459
2458
|
...d(h) ? h.allOf : [h]
|
|
2460
2459
|
];
|
|
2461
|
-
|
|
2460
|
+
b.allOf = v;
|
|
2462
2461
|
break;
|
|
2463
2462
|
}
|
|
2464
2463
|
case "tuple": {
|
|
2465
|
-
const
|
|
2466
|
-
|
|
2464
|
+
const b = E;
|
|
2465
|
+
b.type = "array";
|
|
2467
2466
|
const w = a.items.map((v, f) => this.process(v, { ..._, path: [..._.path, "prefixItems", f] }));
|
|
2468
|
-
if (this.target === "draft-2020-12" ?
|
|
2467
|
+
if (this.target === "draft-2020-12" ? b.prefixItems = w : b.items = w, a.rest) {
|
|
2469
2468
|
const v = this.process(a.rest, {
|
|
2470
2469
|
..._,
|
|
2471
2470
|
path: [..._.path, "items"]
|
|
2472
2471
|
});
|
|
2473
|
-
this.target === "draft-2020-12" ?
|
|
2472
|
+
this.target === "draft-2020-12" ? b.items = v : b.additionalItems = v;
|
|
2474
2473
|
}
|
|
2475
|
-
a.rest && (
|
|
2474
|
+
a.rest && (b.items = this.process(a.rest, {
|
|
2476
2475
|
..._,
|
|
2477
2476
|
path: [..._.path, "items"]
|
|
2478
2477
|
}));
|
|
2479
2478
|
const { minimum: h, maximum: d } = t._zod.bag;
|
|
2480
|
-
typeof h == "number" && (
|
|
2479
|
+
typeof h == "number" && (b.minItems = h), typeof d == "number" && (b.maxItems = d);
|
|
2481
2480
|
break;
|
|
2482
2481
|
}
|
|
2483
2482
|
case "record": {
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2483
|
+
const b = E;
|
|
2484
|
+
b.type = "object", b.propertyNames = this.process(a.keyType, { ..._, path: [..._.path, "propertyNames"] }), b.additionalProperties = this.process(a.valueType, {
|
|
2486
2485
|
..._,
|
|
2487
2486
|
path: [..._.path, "additionalProperties"]
|
|
2488
2487
|
});
|
|
@@ -2499,12 +2498,12 @@ class Wr {
|
|
|
2499
2498
|
break;
|
|
2500
2499
|
}
|
|
2501
2500
|
case "enum": {
|
|
2502
|
-
const
|
|
2503
|
-
w.every((h) => typeof h == "number") && (
|
|
2501
|
+
const b = E, w = Xn(a.entries);
|
|
2502
|
+
w.every((h) => typeof h == "number") && (b.type = "number"), w.every((h) => typeof h == "string") && (b.type = "string"), b.enum = w;
|
|
2504
2503
|
break;
|
|
2505
2504
|
}
|
|
2506
2505
|
case "literal": {
|
|
2507
|
-
const
|
|
2506
|
+
const b = E, w = [];
|
|
2508
2507
|
for (const h of a.values)
|
|
2509
2508
|
if (h === void 0) {
|
|
2510
2509
|
if (this.unrepresentable === "throw")
|
|
@@ -2517,18 +2516,18 @@ class Wr {
|
|
|
2517
2516
|
w.push(h);
|
|
2518
2517
|
if (w.length !== 0) if (w.length === 1) {
|
|
2519
2518
|
const h = w[0];
|
|
2520
|
-
|
|
2519
|
+
b.type = h === null ? "null" : typeof h, b.const = h;
|
|
2521
2520
|
} else
|
|
2522
|
-
w.every((h) => typeof h == "number") && (
|
|
2521
|
+
w.every((h) => typeof h == "number") && (b.type = "number"), w.every((h) => typeof h == "string") && (b.type = "string"), w.every((h) => typeof h == "boolean") && (b.type = "string"), w.every((h) => h === null) && (b.type = "null"), b.enum = w;
|
|
2523
2522
|
break;
|
|
2524
2523
|
}
|
|
2525
2524
|
case "file": {
|
|
2526
|
-
const
|
|
2525
|
+
const b = E, w = {
|
|
2527
2526
|
type: "string",
|
|
2528
2527
|
format: "binary",
|
|
2529
2528
|
contentEncoding: "binary"
|
|
2530
2529
|
}, { minimum: h, maximum: d, mime: v } = t._zod.bag;
|
|
2531
|
-
h !== void 0 && (w.minLength = h), d !== void 0 && (w.maxLength = d), v ? v.length === 1 ? (w.contentMediaType = v[0], Object.assign(
|
|
2530
|
+
h !== void 0 && (w.minLength = h), d !== void 0 && (w.maxLength = d), v ? v.length === 1 ? (w.contentMediaType = v[0], Object.assign(b, w)) : b.anyOf = v.map((f) => ({ ...w, contentMediaType: f })) : Object.assign(b, w);
|
|
2532
2531
|
break;
|
|
2533
2532
|
}
|
|
2534
2533
|
case "transform": {
|
|
@@ -2537,8 +2536,8 @@ class Wr {
|
|
|
2537
2536
|
break;
|
|
2538
2537
|
}
|
|
2539
2538
|
case "nullable": {
|
|
2540
|
-
const
|
|
2541
|
-
E.anyOf = [
|
|
2539
|
+
const b = this.process(a.innerType, _);
|
|
2540
|
+
E.anyOf = [b, { type: "null" }];
|
|
2542
2541
|
break;
|
|
2543
2542
|
}
|
|
2544
2543
|
case "nonoptional": {
|
|
@@ -2546,8 +2545,8 @@ class Wr {
|
|
|
2546
2545
|
break;
|
|
2547
2546
|
}
|
|
2548
2547
|
case "success": {
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2548
|
+
const b = E;
|
|
2549
|
+
b.type = "boolean";
|
|
2551
2550
|
break;
|
|
2552
2551
|
}
|
|
2553
2552
|
case "default": {
|
|
@@ -2560,13 +2559,13 @@ class Wr {
|
|
|
2560
2559
|
}
|
|
2561
2560
|
case "catch": {
|
|
2562
2561
|
this.process(a.innerType, _), c.ref = a.innerType;
|
|
2563
|
-
let
|
|
2562
|
+
let b;
|
|
2564
2563
|
try {
|
|
2565
|
-
|
|
2564
|
+
b = a.catchValue(void 0);
|
|
2566
2565
|
} catch {
|
|
2567
2566
|
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
2568
2567
|
}
|
|
2569
|
-
E.default =
|
|
2568
|
+
E.default = b;
|
|
2570
2569
|
break;
|
|
2571
2570
|
}
|
|
2572
2571
|
case "nan": {
|
|
@@ -2575,15 +2574,15 @@ class Wr {
|
|
|
2575
2574
|
break;
|
|
2576
2575
|
}
|
|
2577
2576
|
case "template_literal": {
|
|
2578
|
-
const
|
|
2577
|
+
const b = E, w = t._zod.pattern;
|
|
2579
2578
|
if (!w)
|
|
2580
2579
|
throw new Error("Pattern not found in template literal");
|
|
2581
|
-
|
|
2580
|
+
b.type = "string", b.pattern = w.source;
|
|
2582
2581
|
break;
|
|
2583
2582
|
}
|
|
2584
2583
|
case "pipe": {
|
|
2585
|
-
const
|
|
2586
|
-
this.process(
|
|
2584
|
+
const b = this.io === "input" ? a.in._zod.def.type === "transform" ? a.out : a.in : a.out;
|
|
2585
|
+
this.process(b, _), c.ref = b;
|
|
2587
2586
|
break;
|
|
2588
2587
|
}
|
|
2589
2588
|
case "readonly": {
|
|
@@ -2599,8 +2598,8 @@ class Wr {
|
|
|
2599
2598
|
break;
|
|
2600
2599
|
}
|
|
2601
2600
|
case "lazy": {
|
|
2602
|
-
const
|
|
2603
|
-
this.process(
|
|
2601
|
+
const b = t._zod.innerType;
|
|
2602
|
+
this.process(b, _), c.ref = b;
|
|
2604
2603
|
break;
|
|
2605
2604
|
}
|
|
2606
2605
|
case "custom": {
|
|
@@ -2615,7 +2614,7 @@ class Wr {
|
|
|
2615
2614
|
return i && Object.assign(c.schema, i), this.io === "input" && B(t) && (delete c.schema.examples, delete c.schema.default), this.io === "input" && c.schema._prefault && ((n = c.schema).default ?? (n.default = c.schema._prefault)), delete c.schema._prefault, this.seen.get(t).schema;
|
|
2616
2615
|
}
|
|
2617
2616
|
emit(t, r) {
|
|
2618
|
-
var
|
|
2617
|
+
var y, u, g, I, _, N;
|
|
2619
2618
|
const n = {
|
|
2620
2619
|
cycles: (r == null ? void 0 : r.cycles) ?? "ref",
|
|
2621
2620
|
reused: (r == null ? void 0 : r.reused) ?? "inline",
|
|
@@ -2627,38 +2626,38 @@ class Wr {
|
|
|
2627
2626
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2628
2627
|
const o = (E) => {
|
|
2629
2628
|
var v;
|
|
2630
|
-
const
|
|
2629
|
+
const b = this.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
2631
2630
|
if (n.external) {
|
|
2632
2631
|
const f = (v = n.external.registry.get(E[0])) == null ? void 0 : v.id, x = n.external.uri ?? ((C) => C);
|
|
2633
2632
|
if (f)
|
|
2634
2633
|
return { ref: x(f) };
|
|
2635
2634
|
const k = E[1].defId ?? E[1].schema.id ?? `schema${this.counter++}`;
|
|
2636
|
-
return E[1].defId = k, { defId: k, ref: `${x("__shared")}#/${
|
|
2635
|
+
return E[1].defId = k, { defId: k, ref: `${x("__shared")}#/${b}/${k}` };
|
|
2637
2636
|
}
|
|
2638
2637
|
if (E[1] === a)
|
|
2639
2638
|
return { ref: "#" };
|
|
2640
|
-
const h = `#/${
|
|
2639
|
+
const h = `#/${b}/`, d = E[1].schema.id ?? `__schema${this.counter++}`;
|
|
2641
2640
|
return { defId: d, ref: h + d };
|
|
2642
2641
|
}, s = (E) => {
|
|
2643
2642
|
if (E[1].schema.$ref)
|
|
2644
2643
|
return;
|
|
2645
|
-
const
|
|
2646
|
-
|
|
2647
|
-
const d =
|
|
2644
|
+
const b = E[1], { ref: w, defId: h } = o(E);
|
|
2645
|
+
b.def = { ...b.schema }, h && (b.defId = h);
|
|
2646
|
+
const d = b.schema;
|
|
2648
2647
|
for (const v in d)
|
|
2649
2648
|
delete d[v];
|
|
2650
2649
|
d.$ref = w;
|
|
2651
2650
|
};
|
|
2652
2651
|
if (n.cycles === "throw")
|
|
2653
2652
|
for (const E of this.seen.entries()) {
|
|
2654
|
-
const
|
|
2655
|
-
if (
|
|
2656
|
-
throw new Error(`Cycle detected: #/${(
|
|
2653
|
+
const b = E[1];
|
|
2654
|
+
if (b.cycle)
|
|
2655
|
+
throw new Error(`Cycle detected: #/${(y = b.cycle) == null ? void 0 : y.join("/")}/<root>
|
|
2657
2656
|
|
|
2658
2657
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
2659
2658
|
}
|
|
2660
2659
|
for (const E of this.seen.entries()) {
|
|
2661
|
-
const
|
|
2660
|
+
const b = E[1];
|
|
2662
2661
|
if (t === E[0]) {
|
|
2663
2662
|
s(E);
|
|
2664
2663
|
continue;
|
|
@@ -2674,24 +2673,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
2674
2673
|
s(E);
|
|
2675
2674
|
continue;
|
|
2676
2675
|
}
|
|
2677
|
-
if (
|
|
2676
|
+
if (b.cycle) {
|
|
2678
2677
|
s(E);
|
|
2679
2678
|
continue;
|
|
2680
2679
|
}
|
|
2681
|
-
if (
|
|
2680
|
+
if (b.count > 1 && n.reused === "ref") {
|
|
2682
2681
|
s(E);
|
|
2683
2682
|
continue;
|
|
2684
2683
|
}
|
|
2685
2684
|
}
|
|
2686
|
-
const c = (E,
|
|
2685
|
+
const c = (E, b) => {
|
|
2687
2686
|
const w = this.seen.get(E), h = w.def ?? w.schema, d = { ...h };
|
|
2688
2687
|
if (w.ref === null)
|
|
2689
2688
|
return;
|
|
2690
2689
|
const v = w.ref;
|
|
2691
2690
|
if (w.ref = null, v) {
|
|
2692
|
-
c(v,
|
|
2691
|
+
c(v, b);
|
|
2693
2692
|
const f = this.seen.get(v).schema;
|
|
2694
|
-
f.$ref &&
|
|
2693
|
+
f.$ref && b.target === "draft-7" ? (h.allOf = h.allOf ?? [], h.allOf.push(f)) : (Object.assign(h, f), Object.assign(h, d));
|
|
2695
2694
|
}
|
|
2696
2695
|
w.isParent || this.override({
|
|
2697
2696
|
zodSchema: E,
|
|
@@ -2711,8 +2710,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
2711
2710
|
Object.assign(p, a.def);
|
|
2712
2711
|
const i = ((N = n.external) == null ? void 0 : N.defs) ?? {};
|
|
2713
2712
|
for (const E of this.seen.entries()) {
|
|
2714
|
-
const
|
|
2715
|
-
|
|
2713
|
+
const b = E[1];
|
|
2714
|
+
b.def && b.defId && (i[b.defId] = b.def);
|
|
2716
2715
|
}
|
|
2717
2716
|
n.external || Object.keys(i).length > 0 && (this.target === "draft-2020-12" ? p.$defs = i : p.definitions = i);
|
|
2718
2717
|
try {
|
|
@@ -2890,7 +2889,7 @@ const Rc = (e, t) => {
|
|
|
2890
2889
|
]
|
|
2891
2890
|
}
|
|
2892
2891
|
// { parent: true }
|
|
2893
|
-
), e.clone = (r, n) => Ae(e, r, n), e.brand = () => e, e.register = (r, n) => (r.add(e, n), e), e.parse = (r, n) => Zc(e, r, n, { callee: e.parse }), e.safeParse = (r, n) => jc(e, r, n), e.parseAsync = async (r, n) => Dc(e, r, n, { callee: e.parseAsync }), e.safeParseAsync = async (r, n) => va(e, r, n), e.spa = e.safeParseAsync, e.refine = (r, n) => e.check(Lu(r, n)), e.superRefine = (r) => e.check(Uu(r)), e.overwrite = (r) => e.check(tt(r)), e.optional = () => Hr(e), e.nullable = () => Xr(e), e.nullish = () => Hr(Xr(e)), e.nonoptional = (r) => $u(e, r), e.array = () => wa(e), e.or = (r) => Sa([e, r]), e.and = (r) =>
|
|
2892
|
+
), e.clone = (r, n) => Ae(e, r, n), e.brand = () => e, e.register = (r, n) => (r.add(e, n), e), e.parse = (r, n) => Zc(e, r, n, { callee: e.parse }), e.safeParse = (r, n) => jc(e, r, n), e.parseAsync = async (r, n) => Dc(e, r, n, { callee: e.parseAsync }), e.safeParseAsync = async (r, n) => va(e, r, n), e.spa = e.safeParseAsync, e.refine = (r, n) => e.check(Lu(r, n)), e.superRefine = (r) => e.check(Uu(r)), e.overwrite = (r) => e.check(tt(r)), e.optional = () => Hr(e), e.nullable = () => Xr(e), e.nullish = () => Hr(Xr(e)), e.nonoptional = (r) => $u(e, r), e.array = () => wa(e), e.or = (r) => Sa([e, r]), e.and = (r) => yu(e, r), e.transform = (r) => Qr(e, Eu(r)), e.default = (r) => Tu(e, r), e.prefault = (r) => Cu(e, r), e.catch = (r) => Ou(e, r), e.pipe = (r) => Qr(e, r), e.readonly = () => Ru(e), e.describe = (r) => {
|
|
2894
2893
|
const n = e.clone();
|
|
2895
2894
|
return Ue.add(n, { description: r }), n;
|
|
2896
2895
|
}, Object.defineProperty(e, "description", {
|
|
@@ -2904,18 +2903,18 @@ const Rc = (e, t) => {
|
|
|
2904
2903
|
return Ue.get(e);
|
|
2905
2904
|
const n = e.clone();
|
|
2906
2905
|
return Ue.add(n, r[0]), n;
|
|
2907
|
-
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)),
|
|
2906
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), ba = /* @__PURE__ */ S("_ZodString", (e, t) => {
|
|
2908
2907
|
rr.init(e, t), F.init(e, t);
|
|
2909
2908
|
const r = e._zod.bag;
|
|
2910
|
-
e.format = r.format ?? null, e.minLength = r.minimum ?? null, e.maxLength = r.maximum ?? null, e.regex = (...n) => e.check(mc(...n)), e.includes = (...n) => e.check(vc(...n)), e.startsWith = (...n) => e.check(
|
|
2909
|
+
e.format = r.format ?? null, e.minLength = r.minimum ?? null, e.maxLength = r.maximum ?? null, e.regex = (...n) => e.check(mc(...n)), e.includes = (...n) => e.check(vc(...n)), e.startsWith = (...n) => e.check(bc(...n)), e.endsWith = (...n) => e.check(yc(...n)), e.min = (...n) => e.check(gt(...n)), e.max = (...n) => e.check(ha(...n)), e.length = (...n) => e.check(ga(...n)), e.nonempty = (...n) => e.check(gt(1, ...n)), e.lowercase = (n) => e.check(hc(n)), e.uppercase = (n) => e.check(gc(n)), e.trim = () => e.check(wc()), e.normalize = (...n) => e.check(xc(...n)), e.toLowerCase = () => e.check(_c()), e.toUpperCase = () => e.check(Ic());
|
|
2911
2910
|
}), Fc = /* @__PURE__ */ S("ZodString", (e, t) => {
|
|
2912
|
-
rr.init(e, t),
|
|
2911
|
+
rr.init(e, t), ba.init(e, t), e.email = (r) => e.check(Zl(Uc, r)), e.url = (r) => e.check(Ul(Bc, r)), e.jwt = (r) => e.check(nc(au, r)), e.emoji = (r) => e.check(Bl(Vc, r)), e.guid = (r) => e.check(Vr(Gr, r)), e.uuid = (r) => e.check(Dl(lt, r)), e.uuidv4 = (r) => e.check(jl(lt, r)), e.uuidv6 = (r) => e.check(Fl(lt, r)), e.uuidv7 = (r) => e.check(Ll(lt, r)), e.nanoid = (r) => e.check(Vl(qc, r)), e.guid = (r) => e.check(Vr(Gr, r)), e.cuid = (r) => e.check(ql(Jc, r)), e.cuid2 = (r) => e.check(Jl(Kc, r)), e.ulid = (r) => e.check(Kl(Wc, r)), e.base64 = (r) => e.check(ec(tu, r)), e.base64url = (r) => e.check(tc(ru, r)), e.xid = (r) => e.check(Wl(Gc, r)), e.ksuid = (r) => e.check(Gl(Yc, r)), e.ipv4 = (r) => e.check(Yl(Hc, r)), e.ipv6 = (r) => e.check(Hl(Xc, r)), e.cidrv4 = (r) => e.check(Xl(Qc, r)), e.cidrv6 = (r) => e.check(Ql(eu, r)), e.e164 = (r) => e.check(rc(nu, r)), e.datetime = (r) => e.check(Ac(r)), e.date = (r) => e.check($c(r)), e.time = (r) => e.check(Oc(r)), e.duration = (r) => e.check(Pc(r));
|
|
2913
2912
|
});
|
|
2914
2913
|
function Lc(e) {
|
|
2915
2914
|
return Rl(Fc, e);
|
|
2916
2915
|
}
|
|
2917
2916
|
const U = /* @__PURE__ */ S("ZodStringFormat", (e, t) => {
|
|
2918
|
-
j.init(e, t),
|
|
2917
|
+
j.init(e, t), ba.init(e, t);
|
|
2919
2918
|
}), Uc = /* @__PURE__ */ S("ZodEmail", (e, t) => {
|
|
2920
2919
|
Bi.init(e, t), U.init(e, t);
|
|
2921
2920
|
}), Gr = /* @__PURE__ */ S("ZodGUID", (e, t) => {
|
|
@@ -2954,16 +2953,16 @@ const U = /* @__PURE__ */ S("ZodStringFormat", (e, t) => {
|
|
|
2954
2953
|
cl.init(e, t), U.init(e, t);
|
|
2955
2954
|
}), au = /* @__PURE__ */ S("ZodJWT", (e, t) => {
|
|
2956
2955
|
dl.init(e, t), U.init(e, t);
|
|
2957
|
-
}),
|
|
2956
|
+
}), ya = /* @__PURE__ */ S("ZodNumber", (e, t) => {
|
|
2958
2957
|
pa.init(e, t), F.init(e, t), e.gt = (n, a) => e.check(Jr(n, a)), e.gte = (n, a) => e.check(Tt(n, a)), e.min = (n, a) => e.check(Tt(n, a)), e.lt = (n, a) => e.check(qr(n, a)), e.lte = (n, a) => e.check(kt(n, a)), e.max = (n, a) => e.check(kt(n, a)), e.int = (n) => e.check(Yr(n)), e.safe = (n) => e.check(Yr(n)), e.positive = (n) => e.check(Jr(0, n)), e.nonnegative = (n) => e.check(Tt(0, n)), e.negative = (n) => e.check(qr(0, n)), e.nonpositive = (n) => e.check(kt(0, n)), e.multipleOf = (n, a) => e.check(Kr(n, a)), e.step = (n, a) => e.check(Kr(n, a)), e.finite = () => e;
|
|
2959
2958
|
const r = e._zod.bag;
|
|
2960
2959
|
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;
|
|
2961
2960
|
});
|
|
2962
2961
|
function ou(e) {
|
|
2963
|
-
return lc(
|
|
2962
|
+
return lc(ya, e);
|
|
2964
2963
|
}
|
|
2965
2964
|
const su = /* @__PURE__ */ S("ZodNumberFormat", (e, t) => {
|
|
2966
|
-
pl.init(e, t),
|
|
2965
|
+
pl.init(e, t), ya.init(e, t);
|
|
2967
2966
|
});
|
|
2968
2967
|
function Yr(e) {
|
|
2969
2968
|
return cc(su, e);
|
|
@@ -2999,7 +2998,7 @@ function wa(e, t) {
|
|
|
2999
2998
|
return Sc(fu, e, t);
|
|
3000
2999
|
}
|
|
3001
3000
|
const _a = /* @__PURE__ */ S("ZodObject", (e, t) => {
|
|
3002
|
-
|
|
3001
|
+
bl.init(e, t), F.init(e, t), P(e, "shape", () => t.shape), e.keyof = () => Ea(Object.keys(e._zod.def.shape)), e.catchall = (r) => e.clone({ ...e._zod.def, catchall: r }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: vt() }), e.loose = () => e.clone({ ...e._zod.def, catchall: vt() }), e.strict = () => e.clone({ ...e._zod.def, catchall: xa() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (r) => Bs(e, r), e.merge = (r) => Vs(e, r), e.pick = (r) => Ls(e, r), e.omit = (r) => Us(e, r), e.partial = (...r) => qs(Na, e, r[0]), e.required = (...r) => Js(ka, e, r[0]);
|
|
3003
3002
|
});
|
|
3004
3003
|
function mu(e, t) {
|
|
3005
3004
|
const r = {
|
|
@@ -3032,7 +3031,7 @@ function Sa(e, t) {
|
|
|
3032
3031
|
});
|
|
3033
3032
|
}
|
|
3034
3033
|
const gu = /* @__PURE__ */ S("ZodDiscriminatedUnion", (e, t) => {
|
|
3035
|
-
Ia.init(e, t),
|
|
3034
|
+
Ia.init(e, t), yl.init(e, t);
|
|
3036
3035
|
});
|
|
3037
3036
|
function vu(e, t, r) {
|
|
3038
3037
|
return new gu({
|
|
@@ -3042,11 +3041,11 @@ function vu(e, t, r) {
|
|
|
3042
3041
|
...$(r)
|
|
3043
3042
|
});
|
|
3044
3043
|
}
|
|
3045
|
-
const
|
|
3044
|
+
const bu = /* @__PURE__ */ S("ZodIntersection", (e, t) => {
|
|
3046
3045
|
xl.init(e, t), F.init(e, t);
|
|
3047
3046
|
});
|
|
3048
|
-
function
|
|
3049
|
-
return new
|
|
3047
|
+
function yu(e, t) {
|
|
3048
|
+
return new bu({
|
|
3050
3049
|
type: "intersection",
|
|
3051
3050
|
left: e,
|
|
3052
3051
|
right: t
|
|
@@ -3282,7 +3281,7 @@ function qu(e) {
|
|
|
3282
3281
|
"`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
|
|
3283
3282
|
);
|
|
3284
3283
|
const { onEvent: t = Ct, onError: r = Ct, onRetry: n = Ct, onComment: a, maxBufferSize: o } = e, s = [];
|
|
3285
|
-
let c = 0, p = !0, i,
|
|
3284
|
+
let c = 0, p = !0, i, y = "", u = 0, g, I = !1;
|
|
3286
3285
|
function _(v) {
|
|
3287
3286
|
if (I)
|
|
3288
3287
|
throw new Error(
|
|
@@ -3305,7 +3304,7 @@ function qu(e) {
|
|
|
3305
3304
|
x !== "" && (s.push(x), c = x.length), N();
|
|
3306
3305
|
}
|
|
3307
3306
|
function N() {
|
|
3308
|
-
o !== void 0 && (c +
|
|
3307
|
+
o !== void 0 && (c + y.length <= o || (I = !0, s.length = 0, c = 0, i = void 0, y = "", u = 0, g = void 0, r(
|
|
3309
3308
|
new At(`Buffered data exceeded max buffer size of ${o} characters`, {
|
|
3310
3309
|
type: "max-buffer-size-exceeded"
|
|
3311
3310
|
})
|
|
@@ -3318,7 +3317,7 @@ function qu(e) {
|
|
|
3318
3317
|
`, f);
|
|
3319
3318
|
for (; x !== -1; ) {
|
|
3320
3319
|
if (f === x) {
|
|
3321
|
-
u > 0 && t({ id: i, event: g, data:
|
|
3320
|
+
u > 0 && t({ id: i, event: g, data: y }), i = void 0, y = "", u = 0, g = void 0, f = x + 1, x = v.indexOf(`
|
|
3322
3321
|
`, f);
|
|
3323
3322
|
continue;
|
|
3324
3323
|
}
|
|
@@ -3326,16 +3325,16 @@ function qu(e) {
|
|
|
3326
3325
|
if (tn(v, f, k)) {
|
|
3327
3326
|
const C = v.charCodeAt(f + 5) === xe ? f + 6 : f + 5, M = v.slice(C, x);
|
|
3328
3327
|
if (u === 0 && v.charCodeAt(x + 1) === en) {
|
|
3329
|
-
t({ id: i, event: g, data: M }), i = void 0,
|
|
3328
|
+
t({ id: i, event: g, data: M }), i = void 0, y = "", g = void 0, f = x + 2, x = v.indexOf(`
|
|
3330
3329
|
`, f);
|
|
3331
3330
|
continue;
|
|
3332
3331
|
}
|
|
3333
|
-
|
|
3332
|
+
y = u === 0 ? M : `${y}
|
|
3334
3333
|
${M}`, u++;
|
|
3335
3334
|
} else rn(v, f, k) ? g = v.slice(
|
|
3336
3335
|
v.charCodeAt(f + 6) === xe ? f + 7 : f + 6,
|
|
3337
3336
|
x
|
|
3338
|
-
) || void 0 :
|
|
3337
|
+
) || void 0 : b(v, f, x);
|
|
3339
3338
|
f = x + 1, x = v.indexOf(`
|
|
3340
3339
|
`, f);
|
|
3341
3340
|
}
|
|
@@ -3347,11 +3346,11 @@ ${M}`, u++;
|
|
|
3347
3346
|
let C = -1;
|
|
3348
3347
|
if (x !== -1 && k !== -1 ? C = x < k ? x : k : x !== -1 ? x === v.length - 1 ? C = -1 : C = x : k !== -1 && (C = k), C === -1)
|
|
3349
3348
|
break;
|
|
3350
|
-
|
|
3349
|
+
b(v, f, C), f = C + 1, v.charCodeAt(f - 1) === Vu && v.charCodeAt(f) === en && f++;
|
|
3351
3350
|
}
|
|
3352
3351
|
return v.slice(f);
|
|
3353
3352
|
}
|
|
3354
|
-
function
|
|
3353
|
+
function b(v, f, x) {
|
|
3355
3354
|
if (f === x) {
|
|
3356
3355
|
h();
|
|
3357
3356
|
return;
|
|
@@ -3359,7 +3358,7 @@ ${M}`, u++;
|
|
|
3359
3358
|
const k = v.charCodeAt(f);
|
|
3360
3359
|
if (tn(v, f, k)) {
|
|
3361
3360
|
const G = v.charCodeAt(f + 5) === xe ? f + 6 : f + 5, pe = v.slice(G, x);
|
|
3362
|
-
|
|
3361
|
+
y = u === 0 ? pe : `${y}
|
|
3363
3362
|
${pe}`, u++;
|
|
3364
3363
|
return;
|
|
3365
3364
|
}
|
|
@@ -3393,7 +3392,7 @@ ${pe}`, u++;
|
|
|
3393
3392
|
g = f || void 0;
|
|
3394
3393
|
break;
|
|
3395
3394
|
case "data":
|
|
3396
|
-
|
|
3395
|
+
y = u === 0 ? f : `${y}
|
|
3397
3396
|
${f}`, u++;
|
|
3398
3397
|
break;
|
|
3399
3398
|
case "id":
|
|
@@ -3422,15 +3421,15 @@ ${f}`, u++;
|
|
|
3422
3421
|
u > 0 && t({
|
|
3423
3422
|
id: i,
|
|
3424
3423
|
event: g,
|
|
3425
|
-
data:
|
|
3426
|
-
}), i = void 0,
|
|
3424
|
+
data: y
|
|
3425
|
+
}), i = void 0, y = "", u = 0, g = void 0;
|
|
3427
3426
|
}
|
|
3428
3427
|
function d(v = {}) {
|
|
3429
3428
|
if (v.consume && s.length > 0) {
|
|
3430
3429
|
const f = s.join("");
|
|
3431
|
-
|
|
3430
|
+
b(f, 0, f.length);
|
|
3432
3431
|
}
|
|
3433
|
-
p = !0, i = void 0,
|
|
3432
|
+
p = !0, i = void 0, y = "", u = 0, g = void 0, s.length = 0, c = 0, I = !1;
|
|
3434
3433
|
}
|
|
3435
3434
|
return { feed: _, reset: d };
|
|
3436
3435
|
}
|
|
@@ -3980,7 +3979,7 @@ const Ut = {
|
|
|
3980
3979
|
ZodBoolean: "boolean",
|
|
3981
3980
|
ZodNull: "null"
|
|
3982
3981
|
};
|
|
3983
|
-
function
|
|
3982
|
+
function bd(e, t) {
|
|
3984
3983
|
const r = e.options instanceof Map ? Array.from(e.options.values()) : e.options;
|
|
3985
3984
|
if (r.every((n) => n._def.typeName in Ut && (!n._def.checks || !n._def.checks.length))) {
|
|
3986
3985
|
const n = r.reduce((a, o) => {
|
|
@@ -4015,9 +4014,9 @@ function yd(e, t) {
|
|
|
4015
4014
|
type: "string",
|
|
4016
4015
|
enum: r.reduce((n, a) => [...n, ...a._def.values.filter((o) => !n.includes(o))], [])
|
|
4017
4016
|
};
|
|
4018
|
-
return
|
|
4017
|
+
return yd(e, t);
|
|
4019
4018
|
}
|
|
4020
|
-
const
|
|
4019
|
+
const yd = (e, t) => {
|
|
4021
4020
|
const r = (e.options instanceof Map ? Array.from(e.options.values()) : e.options).map((n, a) => R(n._def, {
|
|
4022
4021
|
...t,
|
|
4023
4022
|
currentPath: [
|
|
@@ -4216,7 +4215,7 @@ const zd = (e, t) => R(e.innerType._def, t), Od = (e, t, r) => {
|
|
|
4216
4215
|
return td(e, r);
|
|
4217
4216
|
case "ZodUnion":
|
|
4218
4217
|
case "ZodDiscriminatedUnion":
|
|
4219
|
-
return
|
|
4218
|
+
return bd(e, r);
|
|
4220
4219
|
case "ZodIntersection":
|
|
4221
4220
|
return ud(e, r);
|
|
4222
4221
|
case "ZodTuple":
|
|
@@ -4329,9 +4328,9 @@ const Pd = (e, t) => {
|
|
|
4329
4328
|
};
|
|
4330
4329
|
}, Dd = (e, t) => {
|
|
4331
4330
|
const r = Zd(t);
|
|
4332
|
-
let n = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((p, [i,
|
|
4331
|
+
let n = typeof t == "object" && t.definitions ? Object.entries(t.definitions).reduce((p, [i, y]) => ({
|
|
4333
4332
|
...p,
|
|
4334
|
-
[i]: R(
|
|
4333
|
+
[i]: R(y._def, {
|
|
4335
4334
|
...r,
|
|
4336
4335
|
currentPath: [
|
|
4337
4336
|
...r.basePath,
|
|
@@ -4813,11 +4812,11 @@ l.union([
|
|
|
4813
4812
|
function cp(e) {
|
|
4814
4813
|
const t = ["ROOT"];
|
|
4815
4814
|
let r = -1, n = null, a = 0;
|
|
4816
|
-
function o(
|
|
4817
|
-
return
|
|
4815
|
+
function o(y) {
|
|
4816
|
+
return y >= "0" && y <= "9" || y >= "A" && y <= "F" || y >= "a" && y <= "f";
|
|
4818
4817
|
}
|
|
4819
|
-
function s(
|
|
4820
|
-
switch (
|
|
4818
|
+
function s(y, u, g) {
|
|
4819
|
+
switch (y) {
|
|
4821
4820
|
case '"':
|
|
4822
4821
|
r = u, t.pop(), t.push(g), t.push("INSIDE_STRING");
|
|
4823
4822
|
break;
|
|
@@ -4848,8 +4847,8 @@ function cp(e) {
|
|
|
4848
4847
|
r = u, t.pop(), t.push(g), t.push("INSIDE_ARRAY_START");
|
|
4849
4848
|
}
|
|
4850
4849
|
}
|
|
4851
|
-
function c(
|
|
4852
|
-
switch (
|
|
4850
|
+
function c(y, u) {
|
|
4851
|
+
switch (y) {
|
|
4853
4852
|
case ",":
|
|
4854
4853
|
t.pop(), t.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
4855
4854
|
break;
|
|
@@ -4857,8 +4856,8 @@ function cp(e) {
|
|
|
4857
4856
|
r = u, t.pop();
|
|
4858
4857
|
}
|
|
4859
4858
|
}
|
|
4860
|
-
function p(
|
|
4861
|
-
switch (
|
|
4859
|
+
function p(y, u) {
|
|
4860
|
+
switch (y) {
|
|
4862
4861
|
case ",":
|
|
4863
4862
|
t.pop(), t.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
4864
4863
|
break;
|
|
@@ -4866,11 +4865,11 @@ function cp(e) {
|
|
|
4866
4865
|
r = u, t.pop();
|
|
4867
4866
|
}
|
|
4868
4867
|
}
|
|
4869
|
-
for (let
|
|
4870
|
-
const u = e[
|
|
4868
|
+
for (let y = 0; y < e.length; y++) {
|
|
4869
|
+
const u = e[y];
|
|
4871
4870
|
switch (t[t.length - 1]) {
|
|
4872
4871
|
case "ROOT":
|
|
4873
|
-
s(u,
|
|
4872
|
+
s(u, y, "FINISH");
|
|
4874
4873
|
break;
|
|
4875
4874
|
case "INSIDE_OBJECT_START":
|
|
4876
4875
|
switch (u) {
|
|
@@ -4878,7 +4877,7 @@ function cp(e) {
|
|
|
4878
4877
|
t.pop(), t.push("INSIDE_OBJECT_KEY");
|
|
4879
4878
|
break;
|
|
4880
4879
|
case "}":
|
|
4881
|
-
r =
|
|
4880
|
+
r = y, t.pop();
|
|
4882
4881
|
}
|
|
4883
4882
|
break;
|
|
4884
4883
|
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
@@ -4900,30 +4899,30 @@ function cp(e) {
|
|
|
4900
4899
|
}
|
|
4901
4900
|
break;
|
|
4902
4901
|
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
4903
|
-
s(u,
|
|
4902
|
+
s(u, y, "INSIDE_OBJECT_AFTER_VALUE");
|
|
4904
4903
|
break;
|
|
4905
4904
|
case "INSIDE_OBJECT_AFTER_VALUE":
|
|
4906
|
-
c(u,
|
|
4905
|
+
c(u, y);
|
|
4907
4906
|
break;
|
|
4908
4907
|
case "INSIDE_STRING":
|
|
4909
4908
|
switch (u) {
|
|
4910
4909
|
case '"':
|
|
4911
|
-
t.pop(), r =
|
|
4910
|
+
t.pop(), r = y;
|
|
4912
4911
|
break;
|
|
4913
4912
|
case "\\":
|
|
4914
4913
|
t.push("INSIDE_STRING_ESCAPE");
|
|
4915
4914
|
break;
|
|
4916
4915
|
default:
|
|
4917
|
-
r =
|
|
4916
|
+
r = y;
|
|
4918
4917
|
}
|
|
4919
4918
|
break;
|
|
4920
4919
|
case "INSIDE_ARRAY_START":
|
|
4921
4920
|
switch (u) {
|
|
4922
4921
|
case "]":
|
|
4923
|
-
r =
|
|
4922
|
+
r = y, t.pop();
|
|
4924
4923
|
break;
|
|
4925
4924
|
default:
|
|
4926
|
-
r =
|
|
4925
|
+
r = y, s(u, y, "INSIDE_ARRAY_AFTER_VALUE");
|
|
4927
4926
|
}
|
|
4928
4927
|
break;
|
|
4929
4928
|
case "INSIDE_ARRAY_AFTER_VALUE":
|
|
@@ -4932,20 +4931,20 @@ function cp(e) {
|
|
|
4932
4931
|
t.pop(), t.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
4933
4932
|
break;
|
|
4934
4933
|
case "]":
|
|
4935
|
-
r =
|
|
4934
|
+
r = y, t.pop();
|
|
4936
4935
|
break;
|
|
4937
4936
|
default:
|
|
4938
|
-
r =
|
|
4937
|
+
r = y;
|
|
4939
4938
|
}
|
|
4940
4939
|
break;
|
|
4941
4940
|
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
4942
|
-
s(u,
|
|
4941
|
+
s(u, y, "INSIDE_ARRAY_AFTER_VALUE");
|
|
4943
4942
|
break;
|
|
4944
4943
|
case "INSIDE_STRING_ESCAPE":
|
|
4945
|
-
t.pop(), u === "u" ? (a = 0, t.push("INSIDE_STRING_UNICODE_ESCAPE")) : r =
|
|
4944
|
+
t.pop(), u === "u" ? (a = 0, t.push("INSIDE_STRING_UNICODE_ESCAPE")) : r = y;
|
|
4946
4945
|
break;
|
|
4947
4946
|
case "INSIDE_STRING_UNICODE_ESCAPE":
|
|
4948
|
-
o(u) && (a++, a === 4 && (t.pop(), r =
|
|
4947
|
+
o(u) && (a++, a === 4 && (t.pop(), r = y));
|
|
4949
4948
|
break;
|
|
4950
4949
|
case "INSIDE_NUMBER":
|
|
4951
4950
|
switch (u) {
|
|
@@ -4959,7 +4958,7 @@ function cp(e) {
|
|
|
4959
4958
|
case "7":
|
|
4960
4959
|
case "8":
|
|
4961
4960
|
case "9":
|
|
4962
|
-
r =
|
|
4961
|
+
r = y;
|
|
4963
4962
|
break;
|
|
4964
4963
|
case "e":
|
|
4965
4964
|
case "E":
|
|
@@ -4967,27 +4966,27 @@ function cp(e) {
|
|
|
4967
4966
|
case ".":
|
|
4968
4967
|
break;
|
|
4969
4968
|
case ",":
|
|
4970
|
-
t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u,
|
|
4969
|
+
t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u, y), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && c(u, y);
|
|
4971
4970
|
break;
|
|
4972
4971
|
case "}":
|
|
4973
|
-
t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && c(u,
|
|
4972
|
+
t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" && c(u, y);
|
|
4974
4973
|
break;
|
|
4975
4974
|
case "]":
|
|
4976
|
-
t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u,
|
|
4975
|
+
t.pop(), t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u, y);
|
|
4977
4976
|
break;
|
|
4978
4977
|
default:
|
|
4979
4978
|
t.pop();
|
|
4980
4979
|
}
|
|
4981
4980
|
break;
|
|
4982
4981
|
case "INSIDE_LITERAL": {
|
|
4983
|
-
const g = e.substring(n,
|
|
4984
|
-
!"false".startsWith(g) && !"true".startsWith(g) && !"null".startsWith(g) ? (t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" ? c(u,
|
|
4982
|
+
const g = e.substring(n, y + 1);
|
|
4983
|
+
!"false".startsWith(g) && !"true".startsWith(g) && !"null".startsWith(g) ? (t.pop(), t[t.length - 1] === "INSIDE_OBJECT_AFTER_VALUE" ? c(u, y) : t[t.length - 1] === "INSIDE_ARRAY_AFTER_VALUE" && p(u, y)) : r = y;
|
|
4985
4984
|
break;
|
|
4986
4985
|
}
|
|
4987
4986
|
}
|
|
4988
4987
|
}
|
|
4989
4988
|
let i = e.slice(0, r + 1);
|
|
4990
|
-
for (let
|
|
4989
|
+
for (let y = t.length - 1; y >= 0; y--) switch (t[y]) {
|
|
4991
4990
|
case "INSIDE_STRING":
|
|
4992
4991
|
i += '"';
|
|
4993
4992
|
break;
|
|
@@ -5243,14 +5242,14 @@ function pp(e) {
|
|
|
5243
5242
|
function Me() {
|
|
5244
5243
|
return /* @__PURE__ */ Object.create(null);
|
|
5245
5244
|
}
|
|
5246
|
-
function
|
|
5245
|
+
function bt(e) {
|
|
5247
5246
|
return e.type.startsWith("tool-");
|
|
5248
5247
|
}
|
|
5249
5248
|
function fp(e) {
|
|
5250
5249
|
return e.type === "dynamic-tool";
|
|
5251
5250
|
}
|
|
5252
5251
|
function ce(e) {
|
|
5253
|
-
return
|
|
5252
|
+
return bt(e) || fp(e);
|
|
5254
5253
|
}
|
|
5255
5254
|
function qt(e) {
|
|
5256
5255
|
return e.type.split("-").slice(1).join("-");
|
|
@@ -5266,7 +5265,7 @@ function Ba({ lastMessage: e, messageId: t }) {
|
|
|
5266
5265
|
for (const s of r.parts.slice(a + 1)) {
|
|
5267
5266
|
if (!ce(s)) continue;
|
|
5268
5267
|
const c = o;
|
|
5269
|
-
|
|
5268
|
+
bt(s) && o++, s.state === "input-streaming" && (n[s.toolCallId] = {
|
|
5270
5269
|
text: s.rawInput ?? "",
|
|
5271
5270
|
index: c,
|
|
5272
5271
|
toolName: s.type === "dynamic-tool" ? s.toolName : qt(s),
|
|
@@ -5283,7 +5282,7 @@ function Ba({ lastMessage: e, messageId: t }) {
|
|
|
5283
5282
|
};
|
|
5284
5283
|
}
|
|
5285
5284
|
function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdateMessageJob: n, onError: a, onToolCall: o, onData: s, resetStateOnMessageIdChange: c = !1, resetStateOnFirstMessageStart: p = !1 }) {
|
|
5286
|
-
return e.pipeThrough(new TransformStream({ async transform(i,
|
|
5285
|
+
return e.pipeThrough(new TransformStream({ async transform(i, y) {
|
|
5287
5286
|
await n(async ({ state: u, write: g }) => {
|
|
5288
5287
|
function I() {
|
|
5289
5288
|
const d = u.message.parts;
|
|
@@ -5325,8 +5324,8 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5325
5324
|
});
|
|
5326
5325
|
return v;
|
|
5327
5326
|
}
|
|
5328
|
-
function
|
|
5329
|
-
const f = v ?? I().find((C) =>
|
|
5327
|
+
function b(d, v) {
|
|
5328
|
+
const f = v ?? I().find((C) => bt(C) && C.toolCallId === d.toolCallId), x = d, k = f;
|
|
5330
5329
|
if (f != null) {
|
|
5331
5330
|
f.state = d.state, k.input = x.input, k.output = x.output, k.errorText = x.errorText, k.rawInput = x.rawInput, k.preliminary = x.preliminary, d.title !== void 0 && (k.title = d.title), d.toolMetadata !== void 0 && (k.toolMetadata = d.toolMetadata), k.providerExecuted = x.providerExecuted ?? f.providerExecuted;
|
|
5332
5331
|
const C = x.providerMetadata;
|
|
@@ -5490,7 +5489,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5490
5489
|
}), g();
|
|
5491
5490
|
break;
|
|
5492
5491
|
case "tool-input-start": {
|
|
5493
|
-
const d = I().filter(
|
|
5492
|
+
const d = I().filter(bt);
|
|
5494
5493
|
u.partialToolCalls[i.toolCallId] = {
|
|
5495
5494
|
text: "",
|
|
5496
5495
|
toolName: i.toolName,
|
|
@@ -5507,7 +5506,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5507
5506
|
title: i.title,
|
|
5508
5507
|
toolMetadata: i.toolMetadata,
|
|
5509
5508
|
providerMetadata: i.providerMetadata
|
|
5510
|
-
}) :
|
|
5509
|
+
}) : b({
|
|
5511
5510
|
toolCallId: i.toolCallId,
|
|
5512
5511
|
toolName: i.toolName,
|
|
5513
5512
|
state: "input-streaming",
|
|
@@ -5536,7 +5535,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5536
5535
|
rawInput: d.text,
|
|
5537
5536
|
title: d.title,
|
|
5538
5537
|
toolMetadata: d.toolMetadata
|
|
5539
|
-
}) :
|
|
5538
|
+
}) : b({
|
|
5540
5539
|
toolCallId: i.toolCallId,
|
|
5541
5540
|
toolName: d.toolName,
|
|
5542
5541
|
state: "input-streaming",
|
|
@@ -5557,7 +5556,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5557
5556
|
providerMetadata: i.providerMetadata,
|
|
5558
5557
|
title: i.title,
|
|
5559
5558
|
toolMetadata: i.toolMetadata
|
|
5560
|
-
}) :
|
|
5559
|
+
}) : b({
|
|
5561
5560
|
toolCallId: i.toolCallId,
|
|
5562
5561
|
toolName: i.toolName,
|
|
5563
5562
|
state: "input-available",
|
|
@@ -5579,7 +5578,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5579
5578
|
providerExecuted: i.providerExecuted,
|
|
5580
5579
|
providerMetadata: i.providerMetadata,
|
|
5581
5580
|
toolMetadata: i.toolMetadata
|
|
5582
|
-
}) :
|
|
5581
|
+
}) : b({
|
|
5583
5582
|
toolCallId: i.toolCallId,
|
|
5584
5583
|
toolName: i.toolName,
|
|
5585
5584
|
state: "output-error",
|
|
@@ -5631,7 +5630,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5631
5630
|
providerMetadata: i.providerMetadata,
|
|
5632
5631
|
title: d.title,
|
|
5633
5632
|
toolMetadata: i.toolMetadata ?? d.toolMetadata
|
|
5634
|
-
}, d) :
|
|
5633
|
+
}, d) : b({
|
|
5635
5634
|
toolCallId: i.toolCallId,
|
|
5636
5635
|
toolName: qt(d),
|
|
5637
5636
|
state: "output-available",
|
|
@@ -5657,7 +5656,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5657
5656
|
providerMetadata: i.providerMetadata,
|
|
5658
5657
|
title: d.title,
|
|
5659
5658
|
toolMetadata: i.toolMetadata ?? d.toolMetadata
|
|
5660
|
-
}, d) :
|
|
5659
|
+
}, d) : b({
|
|
5661
5660
|
toolCallId: i.toolCallId,
|
|
5662
5661
|
toolName: qt(d),
|
|
5663
5662
|
state: "output-error",
|
|
@@ -5719,7 +5718,7 @@ function mp({ stream: e, messageMetadataSchema: t, dataPartSchemas: r, runUpdate
|
|
|
5719
5718
|
v != null ? v.data = d.data : u.message.parts.push(d), s == null || s(d), g();
|
|
5720
5719
|
}
|
|
5721
5720
|
}
|
|
5722
|
-
|
|
5721
|
+
y.enqueue(i);
|
|
5723
5722
|
});
|
|
5724
5723
|
} }));
|
|
5725
5724
|
}
|
|
@@ -5866,7 +5865,7 @@ async function ln({ response: e, url: t, fallbackMessage: r }) {
|
|
|
5866
5865
|
responseBody: n
|
|
5867
5866
|
});
|
|
5868
5867
|
}
|
|
5869
|
-
async function
|
|
5868
|
+
async function bp(e) {
|
|
5870
5869
|
if (e == null) return [];
|
|
5871
5870
|
if (!globalThis.FileList || !(e instanceof globalThis.FileList)) throw new Ms({
|
|
5872
5871
|
functionality: "FileList",
|
|
@@ -5888,7 +5887,7 @@ async function yp(e) {
|
|
|
5888
5887
|
};
|
|
5889
5888
|
}));
|
|
5890
5889
|
}
|
|
5891
|
-
function
|
|
5890
|
+
function yp(e, t) {
|
|
5892
5891
|
const r = e.search(/[?#]/), n = r === -1 ? e : e.slice(0, r), a = r === -1 ? "" : e.slice(r);
|
|
5893
5892
|
return `${n.endsWith("/") && t.startsWith("/") ? n.slice(0, -1) : n}${t}${a}`;
|
|
5894
5893
|
}
|
|
@@ -5921,14 +5920,14 @@ var xp = class {
|
|
|
5921
5920
|
messages: t.messages,
|
|
5922
5921
|
trigger: t.trigger,
|
|
5923
5922
|
messageId: t.messageId
|
|
5924
|
-
},
|
|
5923
|
+
}, y = (s == null ? void 0 : s.credentials) ?? a, u = await (this.fetch ?? globalThis.fetch)(c, {
|
|
5925
5924
|
method: "POST",
|
|
5926
5925
|
headers: {
|
|
5927
5926
|
"content-type": "application/json",
|
|
5928
5927
|
...p
|
|
5929
5928
|
},
|
|
5930
5929
|
body: JSON.stringify(i),
|
|
5931
|
-
credentials:
|
|
5930
|
+
credentials: y,
|
|
5932
5931
|
signal: e
|
|
5933
5932
|
});
|
|
5934
5933
|
if (!u.ok) throw await ln({
|
|
@@ -5940,11 +5939,11 @@ var xp = class {
|
|
|
5940
5939
|
return this.processResponseStream(u.body);
|
|
5941
5940
|
}
|
|
5942
5941
|
async reconnectToStream(e) {
|
|
5943
|
-
var
|
|
5942
|
+
var y;
|
|
5944
5943
|
const t = await Oe(this.body), r = await Oe(this.headers), n = await Oe(this.credentials), a = {
|
|
5945
5944
|
...ze(r),
|
|
5946
5945
|
...ze(e.headers)
|
|
5947
|
-
}, o = await ((
|
|
5946
|
+
}, o = await ((y = this.prepareReconnectToStreamRequest) == null ? void 0 : y.call(this, {
|
|
5948
5947
|
api: this.api,
|
|
5949
5948
|
id: e.chatId,
|
|
5950
5949
|
body: {
|
|
@@ -5962,7 +5961,7 @@ var xp = class {
|
|
|
5962
5961
|
value: e.chatId,
|
|
5963
5962
|
message: 'Chat IDs must not be "." or ".." when using the default reconnect URL.'
|
|
5964
5963
|
});
|
|
5965
|
-
s =
|
|
5964
|
+
s = yp(this.api, `/${encodeURIComponent(e.chatId)}/stream`);
|
|
5966
5965
|
}
|
|
5967
5966
|
const c = (o == null ? void 0 : o.headers) !== void 0 ? ze(o.headers) : a, p = (o == null ? void 0 : o.credentials) ?? n, i = await (this.fetch ?? globalThis.fetch)(s, {
|
|
5968
5967
|
method: "GET",
|
|
@@ -5993,22 +5992,22 @@ var xp = class {
|
|
|
5993
5992
|
} }));
|
|
5994
5993
|
}
|
|
5995
5994
|
}, wp = class {
|
|
5996
|
-
constructor({ generateId: e = Ku, id: t = e(), transport: r = new sr(), messageMetadataSchema: n, dataPartSchemas: a, state: o, onError: s, onToolCall: c, onFinish: p, onData: i, sendAutomaticallyWhen:
|
|
5995
|
+
constructor({ generateId: e = Ku, id: t = e(), transport: r = new sr(), messageMetadataSchema: n, dataPartSchemas: a, state: o, onError: s, onToolCall: c, onFinish: p, onData: i, sendAutomaticallyWhen: y }) {
|
|
5997
5996
|
this.pendingMessagePreparations = /* @__PURE__ */ new Set(), this.activeResponse = void 0, this.activeResumeRequest = void 0, this.resumableStreamState = void 0, this.jobExecutor = new vp(), this.activeStopCount = 0, this.stopGeneration = 0, this.sendMessage = async (u, g) => {
|
|
5998
5997
|
var _;
|
|
5999
5998
|
if (u == null) {
|
|
6000
5999
|
let N = this.pendingApprovalMessageId;
|
|
6001
6000
|
if (N == null) {
|
|
6002
6001
|
N = (_ = this.lastMessage) == null ? void 0 : _.id;
|
|
6003
|
-
for (let
|
|
6004
|
-
const w = this.state.messages[
|
|
6002
|
+
for (let b = this.state.messages.length - 1; b >= 0; b--) {
|
|
6003
|
+
const w = this.state.messages[b];
|
|
6005
6004
|
if (w.role === "assistant" && w.parts.some((h) => ce(h) && h.state === "approval-responded")) {
|
|
6006
6005
|
N = w.id;
|
|
6007
6006
|
break;
|
|
6008
6007
|
}
|
|
6009
6008
|
}
|
|
6010
6009
|
}
|
|
6011
|
-
const E = N != null && N === this.pendingApprovalMessageId ? this.state.messages.findIndex((
|
|
6010
|
+
const E = N != null && N === this.pendingApprovalMessageId ? this.state.messages.findIndex((b) => b.id === N) : -1;
|
|
6012
6011
|
await this.makeRequestForToolApproval({
|
|
6013
6012
|
messageId: N,
|
|
6014
6013
|
messageIndex: E,
|
|
@@ -6022,7 +6021,7 @@ var xp = class {
|
|
|
6022
6021
|
this.pendingMessagePreparations.add(N);
|
|
6023
6022
|
let E;
|
|
6024
6023
|
try {
|
|
6025
|
-
E = Array.isArray(u.files) ? u.files : await
|
|
6024
|
+
E = Array.isArray(u.files) ? u.files : await bp(u.files);
|
|
6026
6025
|
} finally {
|
|
6027
6026
|
this.pendingMessagePreparations.delete(N);
|
|
6028
6027
|
}
|
|
@@ -6090,28 +6089,28 @@ var xp = class {
|
|
|
6090
6089
|
approved: g,
|
|
6091
6090
|
reason: I
|
|
6092
6091
|
}
|
|
6093
|
-
} : w,
|
|
6094
|
-
if (
|
|
6095
|
-
const w = N[
|
|
6096
|
-
this.state.replaceMessage(
|
|
6092
|
+
} : w, b = N.findIndex((w) => w.parts.some((h) => ce(h) && h.state === "approval-requested" && h.approval.id === u));
|
|
6093
|
+
if (b !== -1) {
|
|
6094
|
+
const w = N[b];
|
|
6095
|
+
this.state.replaceMessage(b, {
|
|
6097
6096
|
...w,
|
|
6098
6097
|
parts: w.parts.map(E)
|
|
6099
6098
|
}), this.pendingApprovalMessageId = w.id;
|
|
6100
6099
|
}
|
|
6101
|
-
if (this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(E)),
|
|
6100
|
+
if (this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(E)), b !== -1 && this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen) {
|
|
6102
6101
|
const w = await this.shouldSendAutomatically();
|
|
6103
6102
|
w && this.runAutomaticRequest(() => {
|
|
6104
6103
|
var d;
|
|
6105
|
-
const h =
|
|
6104
|
+
const h = b === -1 ? (d = this.lastMessage) == null ? void 0 : d.id : N[b].id;
|
|
6106
6105
|
return this.makeRequestForToolApproval({
|
|
6107
6106
|
messageId: h,
|
|
6108
|
-
messageIndex:
|
|
6107
|
+
messageIndex: b,
|
|
6109
6108
|
..._
|
|
6110
6109
|
});
|
|
6111
6110
|
}, w);
|
|
6112
6111
|
}
|
|
6113
6112
|
}), this.addToolOutput = async ({ state: u, toolCallId: g, output: I, errorText: _, options: N }) => this.jobExecutor.run(async () => {
|
|
6114
|
-
const E = this.state.messages,
|
|
6113
|
+
const E = this.state.messages, b = E[E.length - 1], w = (h) => {
|
|
6115
6114
|
if (!ce(h) || h.toolCallId !== g) return h;
|
|
6116
6115
|
const { approval: d, ...v } = h, f = (d == null ? void 0 : d.approved) === !0 ? { approval: {
|
|
6117
6116
|
...d,
|
|
@@ -6134,8 +6133,8 @@ var xp = class {
|
|
|
6134
6133
|
};
|
|
6135
6134
|
};
|
|
6136
6135
|
if (this.state.replaceMessage(E.length - 1, {
|
|
6137
|
-
...
|
|
6138
|
-
parts:
|
|
6136
|
+
...b,
|
|
6137
|
+
parts: b.parts.map(w)
|
|
6139
6138
|
}), this.activeResponse && (this.activeResponse.state.message.parts = this.activeResponse.state.message.parts.map(w)), this.status !== "streaming" && this.status !== "submitted" && this.sendAutomaticallyWhen) {
|
|
6140
6139
|
const h = await this.shouldSendAutomatically();
|
|
6141
6140
|
h && this.runAutomaticRequest(() => {
|
|
@@ -6159,7 +6158,7 @@ var xp = class {
|
|
|
6159
6158
|
}, this.dispose = async () => {
|
|
6160
6159
|
var u, g;
|
|
6161
6160
|
await this.stop(), (g = (u = this.transport).close) == null || g.call(u);
|
|
6162
|
-
}, this.id = t, this.transport = r, this.generateId = e, this.messageMetadataSchema = n, this.dataPartSchemas = a, this.state = o, this.onError = s, this.onToolCall = c, this.onFinish = p, this.onData = i, this.sendAutomaticallyWhen =
|
|
6161
|
+
}, this.id = t, this.transport = r, this.generateId = e, this.messageMetadataSchema = n, this.dataPartSchemas = a, this.state = o, this.onError = s, this.onToolCall = c, this.onFinish = p, this.onData = i, this.sendAutomaticallyWhen = y;
|
|
6163
6162
|
}
|
|
6164
6163
|
/**
|
|
6165
6164
|
* Hook status:
|
|
@@ -6231,7 +6230,7 @@ var xp = class {
|
|
|
6231
6230
|
const p = () => c == null || this.activeResumeRequest === c, i = () => {
|
|
6232
6231
|
this.activeResumeRequest === c && (this.activeResumeRequest = void 0);
|
|
6233
6232
|
};
|
|
6234
|
-
let
|
|
6233
|
+
let y;
|
|
6235
6234
|
if (e === "resume-stream") try {
|
|
6236
6235
|
const f = await this.transport.reconnectToStream({
|
|
6237
6236
|
chatId: this.id,
|
|
@@ -6249,7 +6248,7 @@ var xp = class {
|
|
|
6249
6248
|
this.setStatus({ status: "ready" }), this.resumableStreamState = void 0, i();
|
|
6250
6249
|
return;
|
|
6251
6250
|
}
|
|
6252
|
-
|
|
6251
|
+
y = f;
|
|
6253
6252
|
} catch (f) {
|
|
6254
6253
|
if (s.signal.aborted || f.name === "AbortError") {
|
|
6255
6254
|
p() && (this.setStatus({ status: "ready" }), this.resumableStreamState = void 0), i();
|
|
@@ -6267,7 +6266,7 @@ var xp = class {
|
|
|
6267
6266
|
error: void 0
|
|
6268
6267
|
});
|
|
6269
6268
|
const u = this.lastMessage, g = e === "submit-message" && a != null ? this.state.messages.findIndex((f) => f.id === a) : this.state.messages.length - 1, I = g === -1 ? u : this.state.messages[g], _ = e === "resume-stream" && (I == null ? void 0 : I.role) === "assistant" && I.parts.some((f) => ce(f) && (f.state === "input-streaming" || f.state === "input-available" && f.providerExecuted || f.state === "approval-responded")) ? this.state.snapshot(I) : void 0, N = g !== -1 && g < this.state.messages.length - 1 && (I == null ? void 0 : I.role) === "assistant";
|
|
6270
|
-
let E = !1,
|
|
6269
|
+
let E = !1, b = !1, w = !1, h;
|
|
6271
6270
|
try {
|
|
6272
6271
|
const f = {
|
|
6273
6272
|
state: e === "resume-stream" && this.resumableStreamState != null ? this.resumableStreamState : Ba({
|
|
@@ -6281,7 +6280,7 @@ var xp = class {
|
|
|
6281
6280
|
E = !0;
|
|
6282
6281
|
}), this.activeResponse = f;
|
|
6283
6282
|
let x;
|
|
6284
|
-
e === "resume-stream" ? x =
|
|
6283
|
+
e === "resume-stream" ? x = y : x = await this.transport.sendMessages({
|
|
6285
6284
|
chatId: this.id,
|
|
6286
6285
|
messages: this.state.messages,
|
|
6287
6286
|
abortSignal: f.abortController.signal,
|
|
@@ -6325,9 +6324,9 @@ var xp = class {
|
|
|
6325
6324
|
if (!p()) return null;
|
|
6326
6325
|
if (w = !0, f instanceof TypeError) {
|
|
6327
6326
|
const x = f.message.toLowerCase();
|
|
6328
|
-
|
|
6327
|
+
b = x.includes("fetch") || x.includes("network") || x === "load failed";
|
|
6329
6328
|
}
|
|
6330
|
-
|
|
6329
|
+
b ? this.resumableStreamState = h == null ? void 0 : h.state : this.resumableStreamState === (h == null ? void 0 : h.state) && (this.resumableStreamState = void 0), this.onError && f instanceof Error && this.onError(f), this.setStatus({
|
|
6331
6330
|
status: "error",
|
|
6332
6331
|
error: f
|
|
6333
6332
|
});
|
|
@@ -6337,7 +6336,7 @@ var xp = class {
|
|
|
6337
6336
|
message: h.state.message,
|
|
6338
6337
|
messages: this.state.messages,
|
|
6339
6338
|
isAbort: E,
|
|
6340
|
-
isDisconnect:
|
|
6339
|
+
isDisconnect: b,
|
|
6341
6340
|
isError: w,
|
|
6342
6341
|
finishReason: h.state.finishReason
|
|
6343
6342
|
}));
|
|
@@ -6370,7 +6369,7 @@ function _p(e, t) {
|
|
|
6370
6369
|
};
|
|
6371
6370
|
}
|
|
6372
6371
|
var Ip = _p;
|
|
6373
|
-
const Sp = /* @__PURE__ */
|
|
6372
|
+
const Sp = /* @__PURE__ */ Wo(Ip);
|
|
6374
6373
|
function Ep(e, t) {
|
|
6375
6374
|
return t != null ? Sp(e, t) : e;
|
|
6376
6375
|
}
|
|
@@ -6508,10 +6507,10 @@ function Ap({ throttle: e, experimental_throttle: t, resume: r = !1, ...n } = {}
|
|
|
6508
6507
|
var d, v;
|
|
6509
6508
|
return ((v = (d = s.current).sendAutomaticallyWhen) == null ? void 0 : v.call(d, h)) ?? !1;
|
|
6510
6509
|
}
|
|
6511
|
-
},
|
|
6510
|
+
}, y = "chat" in n ? n.chat : n.id, { chat: u, isExternallyManaged: g } = qe(() => ({
|
|
6512
6511
|
chat: "chat" in n ? n.chat : new Va(i),
|
|
6513
6512
|
isExternallyManaged: "chat" in n
|
|
6514
|
-
}), [
|
|
6513
|
+
}), [y]);
|
|
6515
6514
|
ke(() => {
|
|
6516
6515
|
if (!g)
|
|
6517
6516
|
return () => {
|
|
@@ -6534,7 +6533,7 @@ function Ap({ throttle: e, experimental_throttle: t, resume: r = !1, ...n } = {}
|
|
|
6534
6533
|
h = !1, v.forEach((x) => x());
|
|
6535
6534
|
};
|
|
6536
6535
|
}, [u, a]);
|
|
6537
|
-
const { messages: N, status: E, error:
|
|
6536
|
+
const { messages: N, status: E, error: b } = I, w = ae((h) => {
|
|
6538
6537
|
typeof h == "function" && (h = h(u.messages)), u.messages = h;
|
|
6539
6538
|
}, [u]);
|
|
6540
6539
|
return ke(() => {
|
|
@@ -6550,7 +6549,7 @@ function Ap({ throttle: e, experimental_throttle: t, resume: r = !1, ...n } = {}
|
|
|
6550
6549
|
regenerate: u.regenerate,
|
|
6551
6550
|
clearError: u.clearError,
|
|
6552
6551
|
stop: u.stop,
|
|
6553
|
-
error:
|
|
6552
|
+
error: b,
|
|
6554
6553
|
resumeStream: u.resumeStream,
|
|
6555
6554
|
status: E,
|
|
6556
6555
|
/**
|
|
@@ -6563,7 +6562,7 @@ function Ap({ throttle: e, experimental_throttle: t, resume: r = !1, ...n } = {}
|
|
|
6563
6562
|
}
|
|
6564
6563
|
class De extends Error {
|
|
6565
6564
|
constructor(t, r = {}) {
|
|
6566
|
-
super(
|
|
6565
|
+
super(Yo(t, r)), this.code = t, this.name = "AssistantTurnRefusedError";
|
|
6567
6566
|
}
|
|
6568
6567
|
}
|
|
6569
6568
|
const ir = async (e, t) => {
|
|
@@ -6623,7 +6622,7 @@ function Rp(e) {
|
|
|
6623
6622
|
}
|
|
6624
6623
|
})), [n, a] = L(() => Mt(r)), { messages: o, status: s, error: c } = Ap({ chat: n.chat });
|
|
6625
6624
|
ke(() => () => void n.chat.stop(), [n]);
|
|
6626
|
-
const [p, i] = L(), [
|
|
6625
|
+
const [p, i] = L(), [y, u] = L([]), g = oe(void 0), [I, _] = L(!1);
|
|
6627
6626
|
ke(() => () => {
|
|
6628
6627
|
var x;
|
|
6629
6628
|
return (x = g.current) == null ? void 0 : x.abort();
|
|
@@ -6642,12 +6641,12 @@ function Rp(e) {
|
|
|
6642
6641
|
} catch (G) {
|
|
6643
6642
|
return i(Fp(G)), G instanceof Cn && t.current.onStaleFocus(), "not_sent";
|
|
6644
6643
|
}
|
|
6645
|
-
if (
|
|
6644
|
+
if (ns(M.context, k).length)
|
|
6646
6645
|
return i(Pp), "not_sent";
|
|
6647
6646
|
const Q = {
|
|
6648
6647
|
turnId: Up(),
|
|
6649
6648
|
context: M.context,
|
|
6650
|
-
addedSources:
|
|
6649
|
+
addedSources: y,
|
|
6651
6650
|
...M.cardReplay ?? {},
|
|
6652
6651
|
...k.length ? { taggedFields: k } : {}
|
|
6653
6652
|
};
|
|
@@ -6660,8 +6659,8 @@ function Rp(e) {
|
|
|
6660
6659
|
{ body: Q }
|
|
6661
6660
|
), "sent";
|
|
6662
6661
|
},
|
|
6663
|
-
[n,
|
|
6664
|
-
),
|
|
6662
|
+
[n, y]
|
|
6663
|
+
), b = ae(() => void n.chat.stop(), [n]), w = ae(() => {
|
|
6665
6664
|
N(), i(void 0), a(Mt(r)), u([]);
|
|
6666
6665
|
}, [N, r]), h = ae(
|
|
6667
6666
|
(x, k) => {
|
|
@@ -6704,7 +6703,7 @@ function Rp(e) {
|
|
|
6704
6703
|
busy: Pt(s),
|
|
6705
6704
|
/** A stored conversation is loading; sending waits. */
|
|
6706
6705
|
loading: I,
|
|
6707
|
-
addedSources:
|
|
6706
|
+
addedSources: y,
|
|
6708
6707
|
addSource: d,
|
|
6709
6708
|
removeSource: v,
|
|
6710
6709
|
/** What went wrong with the last send, in plain words; never a raw error. */
|
|
@@ -6712,7 +6711,7 @@ function Rp(e) {
|
|
|
6712
6711
|
notice: p,
|
|
6713
6712
|
clearNotice: () => i(void 0),
|
|
6714
6713
|
send: E,
|
|
6715
|
-
stop:
|
|
6714
|
+
stop: b,
|
|
6716
6715
|
startNew: w,
|
|
6717
6716
|
askedAbout: h,
|
|
6718
6717
|
open: f
|
|
@@ -6723,12 +6722,12 @@ function Mt(e, t) {
|
|
|
6723
6722
|
fetch: ir,
|
|
6724
6723
|
// One new message and the context; never history (spec 2.1).
|
|
6725
6724
|
prepareSendMessagesRequest: ({ messages: a, body: o }) => {
|
|
6726
|
-
const { apiServiceUrl: s, accessToken: c } = e.connection(), { turnId: p, context: i, addedSources:
|
|
6725
|
+
const { apiServiceUrl: s, accessToken: c } = e.connection(), { turnId: p, context: i, addedSources: y, selectedCardRequest: u, selectedCardUnavailable: g, taggedFields: I } = o, _ = {
|
|
6727
6726
|
turnId: p,
|
|
6728
6727
|
...r.conversationId ? { conversationId: r.conversationId } : {},
|
|
6729
6728
|
message: Lp(a.at(-1)),
|
|
6730
6729
|
context: i,
|
|
6731
|
-
addedSources:
|
|
6730
|
+
addedSources: y,
|
|
6732
6731
|
...u ? { selectedCardRequest: u } : {},
|
|
6733
6732
|
...g ? { selectedCardUnavailable: g } : {},
|
|
6734
6733
|
...I ? { taggedFields: I } : {}
|
|
@@ -6753,7 +6752,7 @@ function Mt(e, t) {
|
|
|
6753
6752
|
function Zp(e) {
|
|
6754
6753
|
return e.turns.flatMap((t) => {
|
|
6755
6754
|
var a;
|
|
6756
|
-
const r =
|
|
6755
|
+
const r = as(t.outcome), n = [...t.parts, ...r ? [r] : []].map(os);
|
|
6757
6756
|
return [
|
|
6758
6757
|
{
|
|
6759
6758
|
id: `${t.turnId}-question`,
|
|
@@ -6829,8 +6828,8 @@ function pn(e, t) {
|
|
|
6829
6828
|
function Vp(e, t, r, n = {}) {
|
|
6830
6829
|
var g;
|
|
6831
6830
|
if (t.kind !== "line" && t.kind !== "bar" && t.kind !== "stackedBar") return null;
|
|
6832
|
-
const a = new Map(e.columns.map((I) => [I.key, I])), { x: o, y: s = [], series: c } = t.encodings, p = o ? a.get(o) : void 0, i = s.map((I) => a.get(I)),
|
|
6833
|
-
if (!p || i.length === 0 || !Jp(i) || c && !
|
|
6831
|
+
const a = new Map(e.columns.map((I) => [I.key, I])), { x: o, y: s = [], series: c } = t.encodings, p = o ? a.get(o) : void 0, i = s.map((I) => a.get(I)), y = c ? a.get(c) : void 0;
|
|
6832
|
+
if (!p || i.length === 0 || !Jp(i) || c && !y) return null;
|
|
6834
6833
|
const u = { id: `assistant-artifact-${e.artifactId}`, title: e.title, type: t.kind };
|
|
6835
6834
|
try {
|
|
6836
6835
|
const I = Io({
|
|
@@ -6841,10 +6840,10 @@ function Vp(e, t, r, n = {}) {
|
|
|
6841
6840
|
resultColumns: e.columns,
|
|
6842
6841
|
fieldRoles: {
|
|
6843
6842
|
axisKeys: [p.key],
|
|
6844
|
-
...
|
|
6845
|
-
valueKeys:
|
|
6843
|
+
...y ? { seriesKey: y.key } : {},
|
|
6844
|
+
valueKeys: y ? [i[0].key] : i.map((N) => N.key)
|
|
6846
6845
|
},
|
|
6847
|
-
temporalPresentation: qp([p, ...
|
|
6846
|
+
temporalPresentation: qp([p, ...y ? [y] : []], p.key, r),
|
|
6848
6847
|
themeStyle: n.themeStyle
|
|
6849
6848
|
});
|
|
6850
6849
|
if (!I) return null;
|
|
@@ -6857,7 +6856,7 @@ function Vp(e, t, r, n = {}) {
|
|
|
6857
6856
|
var E;
|
|
6858
6857
|
return {
|
|
6859
6858
|
...N,
|
|
6860
|
-
label:
|
|
6859
|
+
label: y ? "semaphorCanonicalSeriesKey" in N ? ur(N.semaphorCanonicalSeriesKey, y, r) || "(Blank)" : N.label : ((E = a.get(N.semaphorResultColumnKey ?? "")) == null ? void 0 : E.label) ?? N.label
|
|
6861
6860
|
};
|
|
6862
6861
|
})
|
|
6863
6862
|
}
|
|
@@ -6964,7 +6963,7 @@ function Yp(e, t, r) {
|
|
|
6964
6963
|
},
|
|
6965
6964
|
className: "inline-flex h-[26px] items-center gap-1 rounded-control border border-border px-2 text-[11.5px] font-medium text-foreground hover:bg-accent disabled:opacity-60",
|
|
6966
6965
|
children: [
|
|
6967
|
-
s ? /* @__PURE__ */ m(Je, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ m(
|
|
6966
|
+
s ? /* @__PURE__ */ m(Je, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ m(yn, { className: "h-3.5 w-3.5" }),
|
|
6968
6967
|
"Add"
|
|
6969
6968
|
]
|
|
6970
6969
|
}
|
|
@@ -7014,8 +7013,8 @@ function Xp({ artifact: e, onClose: t }) {
|
|
|
7014
7013
|
columns: e.columns,
|
|
7015
7014
|
records: i,
|
|
7016
7015
|
sort: c,
|
|
7017
|
-
onSort: (
|
|
7018
|
-
(u) => (u == null ? void 0 : u.key) ===
|
|
7016
|
+
onSort: (y) => p(
|
|
7017
|
+
(u) => (u == null ? void 0 : u.key) === y ? { key: y, direction: u.direction === "asc" ? "desc" : "asc" } : { key: y, direction: "asc" }
|
|
7019
7018
|
)
|
|
7020
7019
|
}
|
|
7021
7020
|
) : s === "number" ? /* @__PURE__ */ m(Qa, { artifact: e, visual: a }) : /* @__PURE__ */ m(Xa, { cfg: o, className: "h-[360px]" }),
|
|
@@ -7102,7 +7101,7 @@ function eo({
|
|
|
7102
7101
|
onClick: () => n(s.key),
|
|
7103
7102
|
children: [
|
|
7104
7103
|
s.label,
|
|
7105
|
-
(r == null ? void 0 : r.key) === s.key ? r.direction === "asc" ? /* @__PURE__ */ m(Yt, { className: "h-3 w-3" }) : /* @__PURE__ */ m(
|
|
7104
|
+
(r == null ? void 0 : r.key) === s.key ? r.direction === "asc" ? /* @__PURE__ */ m(Yt, { className: "h-3 w-3" }) : /* @__PURE__ */ m(bn, { className: "h-3 w-3" }) : null
|
|
7106
7105
|
]
|
|
7107
7106
|
}
|
|
7108
7107
|
) : s.label }, s.key)) }) }),
|
|
@@ -7255,7 +7254,7 @@ function lf({
|
|
|
7255
7254
|
/* @__PURE__ */ m("span", { className: "block text-[13px] font-medium leading-[1.45] text-foreground", children: a.label }),
|
|
7256
7255
|
a.description ? /* @__PURE__ */ m("span", { className: "block text-[12px] leading-[1.45] text-muted-foreground", children: a.description }) : null
|
|
7257
7256
|
] }),
|
|
7258
|
-
/* @__PURE__ */ m(
|
|
7257
|
+
/* @__PURE__ */ m(ys, { "aria-hidden": "true", className: "mt-1 h-3.5 w-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100" })
|
|
7259
7258
|
]
|
|
7260
7259
|
},
|
|
7261
7260
|
a.optionId
|
|
@@ -7410,8 +7409,8 @@ function ff({
|
|
|
7410
7409
|
onAdd: n,
|
|
7411
7410
|
onPick: a
|
|
7412
7411
|
}) {
|
|
7413
|
-
var
|
|
7414
|
-
const o = e.parts.find(mf), s = (
|
|
7412
|
+
var y;
|
|
7413
|
+
const o = e.parts.find(mf), s = (y = e.parts.find(hf)) == null ? void 0 : y.data, c = e.parts.filter(gf).map((u) => u.data), p = e.parts.filter(
|
|
7415
7414
|
(u) => u.type === "text" || u.type === "data-refusal" || u.type === "data-artifact" || u.type === "data-clarify"
|
|
7416
7415
|
), i = t ? [...c].reverse().find((u) => u.state === "live") : void 0;
|
|
7417
7416
|
return /* @__PURE__ */ T("div", { className: "space-y-2", "data-testid": "assistant-answer", "data-message-id": e.id, children: [
|
|
@@ -7440,10 +7439,10 @@ function gf(e) {
|
|
|
7440
7439
|
return e.type === "data-stage";
|
|
7441
7440
|
}
|
|
7442
7441
|
function vf({ items: e, notes: t }) {
|
|
7443
|
-
const r = e.map(
|
|
7442
|
+
const r = e.map(yf), n = r.slice(0, fn), a = r.slice(fn);
|
|
7444
7443
|
return /* @__PURE__ */ T("div", { className: "space-y-0.5", "data-testid": "assistant-using", children: [
|
|
7445
7444
|
/* @__PURE__ */ T("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "What this answer used", children: [
|
|
7446
|
-
n.map((o, s) => /* @__PURE__ */ m(
|
|
7445
|
+
n.map((o, s) => /* @__PURE__ */ m(bf, { children: o }, s)),
|
|
7447
7446
|
a.length ? /* @__PURE__ */ T(En, { children: [
|
|
7448
7447
|
/* @__PURE__ */ m(Nn, { asChild: !0, children: /* @__PURE__ */ T("button", { type: "button", "aria-label": `${a.length} more`, className: no, children: [
|
|
7449
7448
|
"+",
|
|
@@ -7456,10 +7455,10 @@ function vf({ items: e, notes: t }) {
|
|
|
7456
7455
|
] });
|
|
7457
7456
|
}
|
|
7458
7457
|
const no = "inline-flex h-5 min-w-0 max-w-full items-center truncate whitespace-nowrap rounded-control border border-border bg-muted/50 px-1.5 text-[11px] text-muted-foreground";
|
|
7459
|
-
function
|
|
7458
|
+
function bf({ children: e }) {
|
|
7460
7459
|
return /* @__PURE__ */ m("span", { className: no, title: e, children: e });
|
|
7461
7460
|
}
|
|
7462
|
-
function
|
|
7461
|
+
function yf(e) {
|
|
7463
7462
|
switch (e.kind) {
|
|
7464
7463
|
case "card":
|
|
7465
7464
|
return e.change ? `${e.title} ${e.change}` : e.title;
|
|
@@ -7566,11 +7565,11 @@ function Sf({
|
|
|
7566
7565
|
staleTime: 0,
|
|
7567
7566
|
// A failed read says so at once, whichever client the host mounted.
|
|
7568
7567
|
retry: !1
|
|
7569
|
-
}), p = _n(), [i,
|
|
7570
|
-
|
|
7568
|
+
}), p = _n(), [i, y] = L(), [u, g] = L(() => /* @__PURE__ */ new Set()), [I, _] = L(), N = (w = c.data) == null ? void 0 : w.filter((h) => !u.has(h.conversationId)), E = async (h) => {
|
|
7569
|
+
y(h);
|
|
7571
7570
|
const d = await n(h);
|
|
7572
|
-
|
|
7573
|
-
},
|
|
7571
|
+
y((v) => v === h ? void 0 : v), d === "not_opened" && Kt(p, Jt(e));
|
|
7572
|
+
}, b = async (h) => {
|
|
7574
7573
|
_(void 0), g((d) => new Set(d).add(h)), a(h);
|
|
7575
7574
|
try {
|
|
7576
7575
|
await Op(t(), h);
|
|
@@ -7622,7 +7621,7 @@ function Sf({
|
|
|
7622
7621
|
type: "button",
|
|
7623
7622
|
"aria-label": `Delete ${h.title}`,
|
|
7624
7623
|
title: "Delete",
|
|
7625
|
-
onClick: () => void
|
|
7624
|
+
onClick: () => void b(h.conversationId),
|
|
7626
7625
|
className: "absolute right-1 top-1.5 flex h-6 w-6 items-center justify-center rounded-control text-muted-foreground opacity-0 hover:bg-background hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100",
|
|
7627
7626
|
children: /* @__PURE__ */ m($o, { className: "h-3 w-3" })
|
|
7628
7627
|
}
|
|
@@ -7691,7 +7690,7 @@ function kf({
|
|
|
7691
7690
|
disabled: n,
|
|
7692
7691
|
onAdd: a
|
|
7693
7692
|
}) {
|
|
7694
|
-
const [o, s] = L(!1), [c, p] = L(""), i = oo(e, t, o || r.length > 0),
|
|
7693
|
+
const [o, s] = L(!1), [c, p] = L(""), i = oo(e, t, o || r.length > 0), y = new Set(r.map(ue)), u = (i.data ?? []).filter((_) => !y.has(ue(_.source))), g = c.trim().toLowerCase(), I = g ? u.filter((_) => `${_.label} ${_.domainLabel ?? ""}`.toLowerCase().includes(g)) : u;
|
|
7695
7694
|
return /* @__PURE__ */ T(
|
|
7696
7695
|
En,
|
|
7697
7696
|
{
|
|
@@ -7710,7 +7709,7 @@ function kf({
|
|
|
7710
7709
|
"aria-label": "Add source",
|
|
7711
7710
|
title: "Add source",
|
|
7712
7711
|
disabled: n,
|
|
7713
|
-
children: /* @__PURE__ */ m(
|
|
7712
|
+
children: /* @__PURE__ */ m(yn, { className: "h-4 w-4" })
|
|
7714
7713
|
}
|
|
7715
7714
|
) }),
|
|
7716
7715
|
/* @__PURE__ */ m(kn, { align: "start", className: "w-72 p-1.5", children: i.isPending ? /* @__PURE__ */ T("p", { className: "flex items-center gap-1.5 px-1.5 py-1 text-[12px] text-muted-foreground", role: "status", children: [
|
|
@@ -7794,24 +7793,24 @@ function Cf(e, t) {
|
|
|
7794
7793
|
return { text: e.slice(0, n) + e.slice(t), caret: n };
|
|
7795
7794
|
}
|
|
7796
7795
|
const $f = [], zf = { withRequest: !0 };
|
|
7797
|
-
function
|
|
7796
|
+
function hm({
|
|
7798
7797
|
instance: e,
|
|
7799
7798
|
surface: t = "dashboard",
|
|
7800
7799
|
placement: r
|
|
7801
7800
|
}) {
|
|
7802
|
-
var vr,
|
|
7803
|
-
const n = t === "none", a = zo(), o = at(e.store, (A) => A.focus), s = at(e.store, (A) => A.isOpen), c = at(e.store, (A) => A.askCount), p = at(e.store, (A) => A.layout), i = n ? "full-page" : p,
|
|
7801
|
+
var vr, br;
|
|
7802
|
+
const n = t === "none", a = zo(), o = at(e.store, (A) => A.focus), s = at(e.store, (A) => A.isOpen), c = at(e.store, (A) => A.askCount), p = at(e.store, (A) => A.layout), i = n ? "full-page" : p, y = r ?? i, u = y === "beside-card", g = H(
|
|
7804
7803
|
(A) => {
|
|
7805
7804
|
var O;
|
|
7806
|
-
return o && A.dashboard ? (O =
|
|
7805
|
+
return o && A.dashboard ? (O = Go(A.dashboard, o.cardId)) == null ? void 0 : O.card : void 0;
|
|
7807
7806
|
}
|
|
7808
|
-
), I = Rf(n), _ = oe(void 0), [N] = L(() => ws(t)), [E,
|
|
7807
|
+
), I = Rf(n), _ = oe(void 0), [N] = L(() => ws(t)), [E, b] = L([]), w = ae(
|
|
7809
7808
|
(A) => {
|
|
7810
7809
|
_.current = A;
|
|
7811
7810
|
const O = Of(
|
|
7812
7811
|
() => N({ focus: e.store.getState().focus, snapshot: A, editing: io(n) })
|
|
7813
7812
|
);
|
|
7814
|
-
|
|
7813
|
+
b((ne) => Mf(ne, O) ? ne : O);
|
|
7815
7814
|
},
|
|
7816
7815
|
[e, N, n]
|
|
7817
7816
|
), h = _n(), d = () => {
|
|
@@ -7842,7 +7841,7 @@ function gm({
|
|
|
7842
7841
|
const { focus: A, beside: O } = e.store.getState();
|
|
7843
7842
|
A && M.current(A.cardId, { beside: O });
|
|
7844
7843
|
}, [c, e]);
|
|
7845
|
-
const Q = (I == null ? void 0 : I.id) ?? (g == null ? void 0 : g.id), V = Af(Q), ve = Q ? E : [], [G, pe] = L(), Ce = G ? V.available(ve).filter((A) => A.label.toLowerCase().includes(G.query.toLowerCase())) : [],
|
|
7844
|
+
const Q = (I == null ? void 0 : I.id) ?? (g == null ? void 0 : g.id), V = Af(Q), ve = Q ? E : [], [G, pe] = L(), Ce = G ? V.available(ve).filter((A) => A.label.toLowerCase().includes(G.query.toLowerCase())) : [], be = G && Ce.length ? { ...G, active: Math.min(G.active, Ce.length - 1) } : void 0, je = oe(void 0);
|
|
7846
7845
|
Ze(() => {
|
|
7847
7846
|
var A;
|
|
7848
7847
|
je.current !== void 0 && ((A = C.current) == null || A.setSelectionRange(je.current, je.current), je.current = void 0);
|
|
@@ -7858,19 +7857,19 @@ function gm({
|
|
|
7858
7857
|
const O = f.send(A) === "sent";
|
|
7859
7858
|
return O && ((ne = C.current) == null || ne.focus()), O;
|
|
7860
7859
|
}, co = (A) => {
|
|
7861
|
-
if (
|
|
7860
|
+
if (be) {
|
|
7862
7861
|
if (A.key === "ArrowDown" || A.key === "ArrowUp") {
|
|
7863
7862
|
A.preventDefault();
|
|
7864
7863
|
const O = A.key === "ArrowDown" ? 1 : -1;
|
|
7865
|
-
pe({ ...
|
|
7864
|
+
pe({ ...be, active: (be.active + O + Ce.length) % Ce.length });
|
|
7866
7865
|
return;
|
|
7867
7866
|
}
|
|
7868
7867
|
if ((A.key === "Enter" || A.key === "Tab") && !A.nativeEvent.isComposing) {
|
|
7869
|
-
A.preventDefault(), pr(Ce[
|
|
7868
|
+
A.preventDefault(), pr(Ce[be.active]);
|
|
7870
7869
|
return;
|
|
7871
7870
|
}
|
|
7872
7871
|
}
|
|
7873
|
-
if (
|
|
7872
|
+
if (be && A.key === "Escape") {
|
|
7874
7873
|
A.preventDefault(), pe(void 0);
|
|
7875
7874
|
return;
|
|
7876
7875
|
}
|
|
@@ -7881,7 +7880,7 @@ function gm({
|
|
|
7881
7880
|
A.key === "Enter" && !A.shiftKey && !A.nativeEvent.isComposing && fr(A);
|
|
7882
7881
|
}, St = f.messages.length === 0, [$e, mr] = L(), hr = ($e == null ? void 0 : $e.sessionKey) === f.sessionKey ? Pf(f.messages, $e.artifactId) : void 0, uo = (A) => {
|
|
7883
7882
|
mr((O) => ({ sessionKey: f.sessionKey, artifactId: A, opened: ((O == null ? void 0 : O.opened) ?? 0) + 1 })), e.leaveBeside(), i !== "full-page" && e.setLayout("full-page");
|
|
7884
|
-
},
|
|
7883
|
+
}, ye = y === "full-page", gr = /* @__PURE__ */ m(
|
|
7885
7884
|
te,
|
|
7886
7885
|
{
|
|
7887
7886
|
variant: "ghost",
|
|
@@ -7907,7 +7906,7 @@ function gm({
|
|
|
7907
7906
|
onClick: e.close,
|
|
7908
7907
|
children: /* @__PURE__ */ m(Ge, { className: "h-3.5 w-3.5" })
|
|
7909
7908
|
}
|
|
7910
|
-
), nt = St &&
|
|
7909
|
+
), nt = St && ye && !f.loading, po = /* @__PURE__ */ T("footer", { className: q("shrink-0 space-y-2", nt ? "px-0" : "p-3"), children: [
|
|
7911
7910
|
g && !I && !u ? /* @__PURE__ */ T("div", { className: "flex items-center gap-1.5", children: [
|
|
7912
7911
|
/* @__PURE__ */ T(
|
|
7913
7912
|
"span",
|
|
@@ -7944,7 +7943,7 @@ function gm({
|
|
|
7944
7943
|
),
|
|
7945
7944
|
f.notice ? /* @__PURE__ */ m("p", { role: "alert", className: "text-[12px] leading-[1.5] text-destructive", children: f.notice }) : null,
|
|
7946
7945
|
/* @__PURE__ */ T("form", { onSubmit: fr, className: "relative rounded-control border border-input bg-background focus-within:border-ring", children: [
|
|
7947
|
-
|
|
7946
|
+
be ? /* @__PURE__ */ m(uf, { fields: Ce, active: be.active, onPick: pr }) : null,
|
|
7948
7947
|
V.shown.length ? (
|
|
7949
7948
|
// The tagged fields sit in the question itself, before its words.
|
|
7950
7949
|
/* @__PURE__ */ m("div", { className: "flex flex-wrap gap-1 px-2.5 pt-2", "data-testid": "assistant-question-tags", children: V.shown.map((A) => /* @__PURE__ */ m(ro, { field: A, onRemove: () => V.remove(A) }, `${A.role}:${A.name}:${A.aggregate ?? ""}:${A.granularity ?? ""}`)) })
|
|
@@ -8027,8 +8026,8 @@ function gm({
|
|
|
8027
8026
|
] });
|
|
8028
8027
|
return (
|
|
8029
8028
|
// Full page stacks on a narrow screen: the sidebar's title row becomes a top bar.
|
|
8030
|
-
/* @__PURE__ */ T("div", { className: q("relative flex h-full min-h-0 w-full",
|
|
8031
|
-
|
|
8029
|
+
/* @__PURE__ */ T("div", { className: q("relative flex h-full min-h-0 w-full", ye && "flex-col md:flex-row"), children: [
|
|
8030
|
+
ye ? /* @__PURE__ */ m(
|
|
8032
8031
|
Sf,
|
|
8033
8032
|
{
|
|
8034
8033
|
instanceId: e.id,
|
|
@@ -8051,7 +8050,7 @@ function gm({
|
|
|
8051
8050
|
}
|
|
8052
8051
|
) : null,
|
|
8053
8052
|
/* @__PURE__ */ T("div", { className: "relative flex min-h-0 min-w-0 flex-1 flex-col", children: [
|
|
8054
|
-
|
|
8053
|
+
ye && !n ? (
|
|
8055
8054
|
// No header bar: back to docked and Close sit at the page's top right.
|
|
8056
8055
|
/* @__PURE__ */ T("div", { className: "absolute right-3 top-2 z-10 flex items-center gap-0.5", children: [
|
|
8057
8056
|
/* @__PURE__ */ m(mn, { layout: i, onChange: e.setLayout }),
|
|
@@ -8065,7 +8064,7 @@ function gm({
|
|
|
8065
8064
|
"flex h-full min-h-0 min-w-0 flex-1 flex-col",
|
|
8066
8065
|
// Full page reads as one column of conversation, not a page-wide
|
|
8067
8066
|
// line length, set off by whitespace rather than lines.
|
|
8068
|
-
|
|
8067
|
+
ye && "mx-auto w-full max-w-[820px] pt-11"
|
|
8069
8068
|
),
|
|
8070
8069
|
children: [
|
|
8071
8070
|
u ? (
|
|
@@ -8073,7 +8072,7 @@ function gm({
|
|
|
8073
8072
|
/* @__PURE__ */ T("header", { className: "flex h-10 shrink-0 items-center justify-between gap-2 pl-3 pr-1.5", children: [
|
|
8074
8073
|
/* @__PURE__ */ T("h2", { className: "flex min-w-0 items-center gap-1.5 text-[12.5px] font-medium text-foreground", children: [
|
|
8075
8074
|
/* @__PURE__ */ m(Cr, { className: "h-3 w-3 shrink-0 text-muted-foreground" }),
|
|
8076
|
-
/* @__PURE__ */ m("span", { className: "truncate", children: ((
|
|
8075
|
+
/* @__PURE__ */ m("span", { className: "truncate", children: ((br = g == null ? void 0 : g.title) == null ? void 0 : br.trim()) || "Untitled" })
|
|
8077
8076
|
] }),
|
|
8078
8077
|
/* @__PURE__ */ T("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
8079
8078
|
/* @__PURE__ */ T(
|
|
@@ -8095,7 +8094,7 @@ function gm({
|
|
|
8095
8094
|
Et
|
|
8096
8095
|
] })
|
|
8097
8096
|
] })
|
|
8098
|
-
) :
|
|
8097
|
+
) : ye ? null : /* @__PURE__ */ T("header", { className: "flex h-11 shrink-0 items-center justify-between gap-2 px-3", children: [
|
|
8099
8098
|
/* @__PURE__ */ m("h2", { className: "truncate text-[13px] font-semibold text-foreground", children: e.assistantName }),
|
|
8100
8099
|
/* @__PURE__ */ T("div", { className: "flex items-center gap-0.5", children: [
|
|
8101
8100
|
/* @__PURE__ */ m(mn, { layout: i, onChange: e.setLayout }),
|
|
@@ -8116,7 +8115,7 @@ function gm({
|
|
|
8116
8115
|
{
|
|
8117
8116
|
conversation: f,
|
|
8118
8117
|
empty: St,
|
|
8119
|
-
layout:
|
|
8118
|
+
layout: y,
|
|
8120
8119
|
onExpand: uo,
|
|
8121
8120
|
onAdd: v,
|
|
8122
8121
|
onPick: lo
|
|
@@ -8136,7 +8135,7 @@ function gm({
|
|
|
8136
8135
|
}
|
|
8137
8136
|
)
|
|
8138
8137
|
] }),
|
|
8139
|
-
|
|
8138
|
+
ye && $e && hr ? (
|
|
8140
8139
|
// Beside the conversation; on a narrow screen, where the page stacks, it covers it.
|
|
8141
8140
|
/* @__PURE__ */ m("aside", { className: "absolute inset-0 z-20 h-full bg-background md:static md:w-[min(560px,45%)] md:shrink-0 md:border-l md:border-border", children: /* @__PURE__ */ m(Xp, { artifact: hr, onClose: () => mr(void 0) }, $e.opened) })
|
|
8142
8141
|
) : null
|
|
@@ -8145,7 +8144,7 @@ function gm({
|
|
|
8145
8144
|
}
|
|
8146
8145
|
function Of(e) {
|
|
8147
8146
|
try {
|
|
8148
|
-
return
|
|
8147
|
+
return ss(e().context);
|
|
8149
8148
|
} catch {
|
|
8150
8149
|
return [];
|
|
8151
8150
|
}
|
|
@@ -8161,7 +8160,7 @@ function Pf(e, t) {
|
|
|
8161
8160
|
const Zt = [
|
|
8162
8161
|
{ layout: "docked-right", label: "Dock right", icon: On },
|
|
8163
8162
|
{ layout: "docked-left", label: "Dock left", icon: xs },
|
|
8164
|
-
{ layout: "centered", label: "Centered", icon:
|
|
8163
|
+
{ layout: "centered", label: "Centered", icon: bs },
|
|
8165
8164
|
{ layout: "full-page", label: "Full page", icon: us }
|
|
8166
8165
|
];
|
|
8167
8166
|
function mn({ layout: e, onChange: t }) {
|
|
@@ -8244,10 +8243,10 @@ function Ff({
|
|
|
8244
8243
|
onAdd: a,
|
|
8245
8244
|
onPick: o
|
|
8246
8245
|
}) {
|
|
8247
|
-
const s = oe(null), [c, p] = L(!0), i = oe(void 0),
|
|
8246
|
+
const s = oe(null), [c, p] = L(!0), i = oe(void 0), y = oe(r);
|
|
8248
8247
|
Ze(() => {
|
|
8249
8248
|
const _ = s.current;
|
|
8250
|
-
!_ ||
|
|
8249
|
+
!_ || y.current === r || (y.current = r, c ? _.scrollTop = _.scrollHeight : i.current && jf(_, i.current));
|
|
8251
8250
|
}, [r, c]);
|
|
8252
8251
|
const u = e.messages.at(-1), g = qe(
|
|
8253
8252
|
() => `${e.messages.length}:${(u == null ? void 0 : u.parts.length) ?? 0}:${e.status}:${e.failure ?? ""}`,
|
|
@@ -8293,11 +8292,11 @@ function Ff({
|
|
|
8293
8292
|
onClick: () => {
|
|
8294
8293
|
I(), p(!0);
|
|
8295
8294
|
},
|
|
8296
|
-
children: /* @__PURE__ */ m(
|
|
8295
|
+
children: /* @__PURE__ */ m(bn, { className: "h-3.5 w-3.5" })
|
|
8297
8296
|
}
|
|
8298
8297
|
) : null
|
|
8299
8298
|
] });
|
|
8300
8299
|
}
|
|
8301
8300
|
export {
|
|
8302
|
-
|
|
8301
|
+
hm as default
|
|
8303
8302
|
};
|