@sanity/vision 6.21.0-next.75 → 6.21.0-next.92
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/lib/{SanityVision-DOH_LzRg.js → SanityVision-tHhBPbsg.js} +3 -3
- package/lib/{SanityVision-DOH_LzRg.js.map → SanityVision-tHhBPbsg.js.map} +1 -1
- package/lib/{VistaGui-C6cdsk92.js → VistaGui-D3NHSIsK.js} +787 -343
- package/lib/VistaGui-D3NHSIsK.js.map +1 -0
- package/lib/{i18n-fzZ8Bvax.js → i18n-BGSN3nAJ.js} +2 -2
- package/lib/{i18n-fzZ8Bvax.js.map → i18n-BGSN3nAJ.js.map} +1 -1
- package/lib/index.d.ts +28 -4
- package/lib/index.js +2 -2
- package/lib/{resources-CFs_-mXU.js → resources-DpvWKOpU.js} +29 -5
- package/lib/resources-DpvWKOpU.js.map +1 -0
- package/package.json +12 -12
- package/lib/VistaGui-C6cdsk92.js.map +0 -1
- package/lib/resources-CFs_-mXU.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as visionLocaleNamespace } from "./i18n-
|
|
2
|
-
import { A as DEFAULT_API_VERSION, C as getActivePerspective, D as paramsExtensions, E as groqExtensions, M as prefixApiVersion, O as resultJsonExtensions, S as encodeQueryString, T as VisionCodeMirror, _ as VISION_STORAGE_KEY_PREFIX, a as getAtKeypath, b as isPlainObject, c as DelayedSpinner, d as getJsonBlobUrl, f as useSavedQueries, g as validateApiVersion, h as parseQueryUrl, i as describeKeypath, j as VARIANTS_API_VERSION, k as API_VERSIONS, l as canEncodeCsv, m as isApiCdnHost, n as createRetryableLazy, o as QueryErrorDialog, p as parseParams, r as ResultView, s as isApiVersionBelow, u as getCsvBlobUrl, v as getStorage, w as useVariantsEnabled, x as isVisionPasteTarget, y as onLocalStorageCleared } from "./SanityVision-
|
|
1
|
+
import { t as visionLocaleNamespace } from "./i18n-BGSN3nAJ.js";
|
|
2
|
+
import { A as DEFAULT_API_VERSION, C as getActivePerspective, D as paramsExtensions, E as groqExtensions, M as prefixApiVersion, O as resultJsonExtensions, S as encodeQueryString, T as VisionCodeMirror, _ as VISION_STORAGE_KEY_PREFIX, a as getAtKeypath, b as isPlainObject, c as DelayedSpinner, d as getJsonBlobUrl, f as useSavedQueries, g as validateApiVersion, h as parseQueryUrl, i as describeKeypath, j as VARIANTS_API_VERSION, k as API_VERSIONS, l as canEncodeCsv, m as isApiCdnHost, n as createRetryableLazy, o as QueryErrorDialog, p as parseParams, r as ResultView, s as isApiVersionBelow, u as getCsvBlobUrl, v as getStorage, w as useVariantsEnabled, x as isVisionPasteTarget, y as onLocalStorageCleared } from "./SanityVision-tHhBPbsg.js";
|
|
3
3
|
import { Component, Suspense, createContext, memo, use, useContext, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
|
-
import { ContextMenuButton, UserAvatar, getDefaultVariant, getReleaseIdFromReleaseDocumentId, getVariantTitle, isCardinalityOneRelease, sortReleases, useActiveReleases, useClient, useDateTimeFormat, usePerspective, useScheduledDraftsEnabled, useSchema, useTranslation, useWorkspace } from "sanity";
|
|
4
|
+
import { ContextMenuButton, UserAvatar, getDefaultVariant, getReleaseIdFromReleaseDocumentId, getVariantTitle, isCardinalityOneRelease, sortReleases, useActiveReleases, useClient, useDateTimeFormat, useNumberFormat, usePerspective, useProjectStore, useScheduledDraftsEnabled, useSchema, useTranslation, useWorkspace } from "sanity";
|
|
5
5
|
import { useRouter } from "sanity/router";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
7
|
import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
|
|
@@ -32,7 +32,9 @@ import { uuid } from "@sanity/uuid";
|
|
|
32
32
|
import { PlayIcon } from "@sanity/icons/Play";
|
|
33
33
|
import { StopIcon } from "@sanity/icons/Stop";
|
|
34
34
|
import { CopyIcon } from "@sanity/icons/Copy";
|
|
35
|
+
import { isHttpError } from "@sanity/client";
|
|
35
36
|
import { DocumentSheetIcon } from "@sanity/icons/DocumentSheet";
|
|
37
|
+
import { useObservable } from "react-rx";
|
|
36
38
|
import { useActorRef, useSelector } from "@xstate/react";
|
|
37
39
|
import { assign, enqueueActions, fromObservable, fromPromise, raise, setup } from "xstate";
|
|
38
40
|
import { BoltIcon } from "@sanity/icons/Bolt";
|
|
@@ -709,7 +711,10 @@ const vistaMachine = setup({
|
|
|
709
711
|
...context.runners,
|
|
710
712
|
[tab.id]: spawnRunner(spawn, tab.id)
|
|
711
713
|
},
|
|
712
|
-
fetchOnOpen: event.fetch ?
|
|
714
|
+
fetchOnOpen: event.fetch ? {
|
|
715
|
+
...context.fetchOnOpen,
|
|
716
|
+
[tab.id]: event.fetch
|
|
717
|
+
} : context.fetchOnOpen
|
|
713
718
|
};
|
|
714
719
|
}),
|
|
715
720
|
closeTab: enqueueActions(({ context, event, enqueue }) => {
|
|
@@ -719,7 +724,11 @@ const vistaMachine = setup({
|
|
|
719
724
|
let runner = context.runners[event.id];
|
|
720
725
|
runner && enqueue.stopChild(runner);
|
|
721
726
|
let { [event.id]: _removed, ...runners } = context.runners, remaining = context.tabs.filter((tab) => tab.id !== event.id);
|
|
722
|
-
if (
|
|
727
|
+
if (event.id in context.fetchOnOpen) {
|
|
728
|
+
let { [event.id]: _pending, ...fetchOnOpen } = context.fetchOnOpen;
|
|
729
|
+
enqueue.assign({ fetchOnOpen });
|
|
730
|
+
}
|
|
731
|
+
if (remaining.length === 0) {
|
|
723
732
|
let fallback = createTab(context.settings);
|
|
724
733
|
enqueue.assign(({ spawn }) => ({
|
|
725
734
|
tabs: [fallback],
|
|
@@ -749,7 +758,7 @@ const vistaMachine = setup({
|
|
|
749
758
|
historyDiff: fresh.historyDiff,
|
|
750
759
|
functions: fresh.functions,
|
|
751
760
|
runners: spawnRunners(spawn, fresh.tabs),
|
|
752
|
-
fetchOnOpen:
|
|
761
|
+
fetchOnOpen: {}
|
|
753
762
|
};
|
|
754
763
|
});
|
|
755
764
|
})
|
|
@@ -767,7 +776,7 @@ const vistaMachine = setup({
|
|
|
767
776
|
functions: input.persisted.functions,
|
|
768
777
|
runners: spawnRunners(spawn, input.persisted.tabs),
|
|
769
778
|
loadRevisions: {},
|
|
770
|
-
fetchOnOpen:
|
|
779
|
+
fetchOnOpen: {},
|
|
771
780
|
restoredSidebar: input.persisted.sidebar,
|
|
772
781
|
drawer: input.persisted.sidebar.drawer ?? "saved",
|
|
773
782
|
restoredPanels: input.persisted.panels
|
|
@@ -786,7 +795,10 @@ const vistaMachine = setup({
|
|
|
786
795
|
return event.ids.flatMap((id) => byId.get(id) ?? []);
|
|
787
796
|
} })
|
|
788
797
|
},
|
|
789
|
-
"tab.fetchedOnOpen": { actions: assign({ fetchOnOpen: ({ context, event }) =>
|
|
798
|
+
"tab.fetchedOnOpen": { actions: assign({ fetchOnOpen: ({ context, event }) => {
|
|
799
|
+
let { [event.id]: _fetched, ...fetchOnOpen } = context.fetchOnOpen;
|
|
800
|
+
return fetchOnOpen;
|
|
801
|
+
} }) },
|
|
790
802
|
"tab.rename": { actions: assign({ tabs: ({ context, event }) => updateTab(context.tabs, event.id, (tab) => ({
|
|
791
803
|
...tab,
|
|
792
804
|
title: event.title?.trim() || void 0
|
|
@@ -823,7 +835,10 @@ const vistaMachine = setup({
|
|
|
823
835
|
...context.loadRevisions,
|
|
824
836
|
[event.id]: (context.loadRevisions[event.id] || 0) + 1
|
|
825
837
|
}),
|
|
826
|
-
fetchOnOpen: ({ context, event }) => event.fetch
|
|
838
|
+
fetchOnOpen: ({ context, event }) => event.fetch ? {
|
|
839
|
+
...context.fetchOnOpen,
|
|
840
|
+
[event.id]: event.fetch
|
|
841
|
+
} : context.fetchOnOpen
|
|
827
842
|
}) },
|
|
828
843
|
"settings.update": { actions: assign({ settings: ({ context, event }) => ({
|
|
829
844
|
...context.settings,
|
|
@@ -3153,7 +3168,7 @@ function createByteOffsetConverter(text) {
|
|
|
3153
3168
|
return index;
|
|
3154
3169
|
};
|
|
3155
3170
|
}
|
|
3156
|
-
const PARSE_WRAPPER_RE = /Parse\("((?:[^"\\]|\\.)*)"\)/, PREFIX_RE = /^(?:(?:Failed to parse query|Format failed|Lint failed|Format error|Lint error): )+/, POSITION_RE = /\s*at Position \{ start: (\d+), end: (\d+) \}\s*$/;
|
|
3171
|
+
const PARSE_WRAPPER_RE = /Parse\("((?:[^"\\]|\\.)*)"\)/, PREFIX_RE = /^(?:(?:Failed to parse query|Format failed|Lint failed|Format error|Lint error|Parse error): )+/, POSITION_RE = /\s*at Position \{ start: (\d+), end: (\d+) \}\s*$/;
|
|
3157
3172
|
/** Turns the wasm wrapper's parse failures into a {@link GroqSyntaxError}; anything else is rethrown */
|
|
3158
3173
|
function toSyntaxError(error, query) {
|
|
3159
3174
|
if (!(error instanceof Error)) throw error;
|
|
@@ -3187,11 +3202,11 @@ async function lintGroq(query) {
|
|
|
3187
3202
|
}
|
|
3188
3203
|
return toGroqFindings(findings, query);
|
|
3189
3204
|
}
|
|
3190
|
-
/** Converts the wasm findings'
|
|
3205
|
+
/** Converts the wasm findings' spans into ranges of `query`; a finding without a span covers all of it */
|
|
3191
3206
|
function toGroqFindings(findings, query) {
|
|
3192
|
-
let
|
|
3207
|
+
let clamp = (index) => Math.max(0, Math.min(index, query.length));
|
|
3193
3208
|
return findings.map(({ ruleId, message, severity, span }) => {
|
|
3194
|
-
let from = span ?
|
|
3209
|
+
let from = span ? clamp(span.start.offset) : 0, to = span ? Math.max(from, clamp(span.end.offset)) : query.length;
|
|
3195
3210
|
return {
|
|
3196
3211
|
ruleId,
|
|
3197
3212
|
message: message.trim(),
|
|
@@ -3201,6 +3216,52 @@ function toGroqFindings(findings, query) {
|
|
|
3201
3216
|
};
|
|
3202
3217
|
});
|
|
3203
3218
|
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Extracts every `$name` parameter a query references, with their locations. `extractParams`
|
|
3221
|
+
* already returns indices into the query string, so no conversion happens here. Rejects with a
|
|
3222
|
+
* {@link GroqSyntaxError} when the query does not parse.
|
|
3223
|
+
*/
|
|
3224
|
+
async function extractQueryParams(query) {
|
|
3225
|
+
let wasm = await loadGroqWasm();
|
|
3226
|
+
try {
|
|
3227
|
+
return wasm.extractParams(query).map(({ name, references }) => ({
|
|
3228
|
+
name,
|
|
3229
|
+
references: references.map(({ start, end }) => ({
|
|
3230
|
+
from: start,
|
|
3231
|
+
to: end
|
|
3232
|
+
}))
|
|
3233
|
+
}));
|
|
3234
|
+
} catch (error) {
|
|
3235
|
+
throw toSyntaxError(error, query);
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
function buildParamsInsertion(names) {
|
|
3239
|
+
return names.map((name) => ` ${JSON.stringify(name)}: "",\n`).join("");
|
|
3240
|
+
}
|
|
3241
|
+
/**
|
|
3242
|
+
* Appends `"name": ""` for every `name` not already a key `rawParams` has, without touching any
|
|
3243
|
+
* of its existing text (so comments, formatting and values survive untouched). `rawParams` is
|
|
3244
|
+
* returned unchanged when its root is not a `{...}` object, since there is then nowhere
|
|
3245
|
+
* unambiguous to insert into; an empty or whitespace-only `rawParams` is treated as `{}`.
|
|
3246
|
+
*/
|
|
3247
|
+
function addMissingParams(rawParams, missingNames) {
|
|
3248
|
+
if (missingNames.length === 0) return rawParams;
|
|
3249
|
+
let trimmed = rawParams.trim();
|
|
3250
|
+
if (trimmed === "") return `{\n${buildParamsInsertion(missingNames)}}`;
|
|
3251
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) return rawParams;
|
|
3252
|
+
let closeIndex = rawParams.lastIndexOf("}"), before = rawParams.slice(0, closeIndex), after = rawParams.slice(closeIndex), isEmptyObject = before.trimEnd().endsWith("{"), hasTrailingComma = /,\s*$/.test(before);
|
|
3253
|
+
return `${before}${!isEmptyObject && !hasTrailingComma ? ",\n" : before.endsWith("\n") ? "" : "\n"}${buildParamsInsertion(missingNames)}${after}`;
|
|
3254
|
+
}
|
|
3255
|
+
/**
|
|
3256
|
+
* Which of `referencedNames` `rawParams` has no key for yet. `undefined` when `rawParams` is not
|
|
3257
|
+
* valid JSON5 (common while it is mid-edit, and not worth reporting as an error here).
|
|
3258
|
+
*/
|
|
3259
|
+
function missingParamNames(referencedNames, rawParams, t) {
|
|
3260
|
+
let current = parseParams(rawParams, t);
|
|
3261
|
+
if (!current.valid) return;
|
|
3262
|
+
let existing = current.parsed ?? {};
|
|
3263
|
+
return referencedNames.filter((name) => !Object.hasOwn(existing, name));
|
|
3264
|
+
}
|
|
3204
3265
|
const NO_FUNCTIONS = [], functionLibrary = Facet.define({ combine: (values) => values[0] ?? NO_FUNCTIONS }), groqEditorLabels = Facet.define({ combine: (values) => values[0] }), querySchema = Facet.define({ combine: (values) => values[0] }), V2021 = "v2021-03-25";
|
|
3205
3266
|
function exactly(count) {
|
|
3206
3267
|
return {
|
|
@@ -5109,6 +5170,38 @@ function ActionRail(t0) {
|
|
|
5109
5170
|
}), $[0] = children, $[1] = testId, $[2] = t1) : t1 = $[2], t1;
|
|
5110
5171
|
}
|
|
5111
5172
|
/**
|
|
5173
|
+
* Tooltip of a control that calls Sanity Agent Actions: what it does, and that it spends the
|
|
5174
|
+
* organization's AI credits, which nothing else in the tool would say before the request is made
|
|
5175
|
+
*/
|
|
5176
|
+
function AgentActionsTooltip(props) {
|
|
5177
|
+
let $ = c(13), { title, placement: t0, children } = props, placement = t0 === void 0 ? "bottom" : t0, { t } = useTranslation(visionLocaleNamespace), t1;
|
|
5178
|
+
$[0] === title ? t1 = $[1] : (t1 = title && /* @__PURE__ */ jsx(Text, {
|
|
5179
|
+
size: 1,
|
|
5180
|
+
children: title
|
|
5181
|
+
}), $[0] = title, $[1] = t1);
|
|
5182
|
+
let t2;
|
|
5183
|
+
$[2] === t ? t2 = $[3] : (t2 = t("vista.agent-actions.credits"), $[2] = t, $[3] = t2);
|
|
5184
|
+
let t3;
|
|
5185
|
+
$[4] === t2 ? t3 = $[5] : (t3 = /* @__PURE__ */ jsx(Text, {
|
|
5186
|
+
muted: !0,
|
|
5187
|
+
size: 1,
|
|
5188
|
+
children: t2
|
|
5189
|
+
}), $[4] = t2, $[5] = t3);
|
|
5190
|
+
let t4;
|
|
5191
|
+
$[6] !== t1 || $[7] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Stack, {
|
|
5192
|
+
gap: 2,
|
|
5193
|
+
children: [t1, t3]
|
|
5194
|
+
}), $[6] = t1, $[7] = t3, $[8] = t4) : t4 = $[8];
|
|
5195
|
+
let t5;
|
|
5196
|
+
return $[9] !== children || $[10] !== placement || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsx(Tooltip, {
|
|
5197
|
+
animate: !0,
|
|
5198
|
+
content: t4,
|
|
5199
|
+
placement,
|
|
5200
|
+
portal: !0,
|
|
5201
|
+
children
|
|
5202
|
+
}), $[9] = children, $[10] = placement, $[11] = t4, $[12] = t5) : t5 = $[12], t5;
|
|
5203
|
+
}
|
|
5204
|
+
/**
|
|
5112
5205
|
* The tabbed bottom panel of the request and response columns. When collapsed only the tab
|
|
5113
5206
|
* header remains, and picking a tab expands it again.
|
|
5114
5207
|
*/
|
|
@@ -5398,6 +5491,146 @@ async function generateQuery(options) {
|
|
|
5398
5491
|
}
|
|
5399
5492
|
throw new GenerateQueryError(previous?.problem ?? "No query was generated", previous?.attempt);
|
|
5400
5493
|
}
|
|
5494
|
+
function optionalString(value) {
|
|
5495
|
+
return typeof value == "string" && value ? value : void 0;
|
|
5496
|
+
}
|
|
5497
|
+
function optionalNumber(value) {
|
|
5498
|
+
return typeof value == "number" && Number.isFinite(value) ? value : void 0;
|
|
5499
|
+
}
|
|
5500
|
+
/**
|
|
5501
|
+
* The credits as the `ai-usage` resource of the project's subscription reports them; `undefined`
|
|
5502
|
+
* for a response of another shape, which is what a Studio talking to an API without it gets
|
|
5503
|
+
*/
|
|
5504
|
+
function readAiCredits(response) {
|
|
5505
|
+
if (!isPlainObject(response) || typeof response.granted != "boolean") return;
|
|
5506
|
+
let subscription = isPlainObject(response.subscription) ? response.subscription : {}, usage = isPlainObject(response.usage) ? response.usage : {};
|
|
5507
|
+
return {
|
|
5508
|
+
granted: response.granted,
|
|
5509
|
+
reasonCode: optionalString(response.reasonCode),
|
|
5510
|
+
used: optionalNumber(usage.value),
|
|
5511
|
+
quota: optionalNumber(subscription.quota)
|
|
5512
|
+
};
|
|
5513
|
+
}
|
|
5514
|
+
/**
|
|
5515
|
+
* Reads the organization's AI credits through the project. The resource only exists on the
|
|
5516
|
+
* experimental API, and a Studio talking to an API without it resolves with `undefined`, so
|
|
5517
|
+
* nothing depends on the answer.
|
|
5518
|
+
*/
|
|
5519
|
+
async function fetchAiCredits(client, signal) {
|
|
5520
|
+
let { projectId } = client.config();
|
|
5521
|
+
if (projectId) return readAiCredits(await client.withConfig({ apiVersion: "vX" }).request({
|
|
5522
|
+
url: `/subscriptions/project/${projectId}/resources/ai-usage`,
|
|
5523
|
+
tag: "vista.ai-credits",
|
|
5524
|
+
signal
|
|
5525
|
+
}));
|
|
5526
|
+
}
|
|
5527
|
+
/**
|
|
5528
|
+
* The credits a request was turned down for, from the 429 response Agent Actions give once the
|
|
5529
|
+
* organization's spending limit is reached: its body names the limit and carries the usage and
|
|
5530
|
+
* the quota, which a plain rate limit response does not. `undefined` for any other error.
|
|
5531
|
+
*/
|
|
5532
|
+
function readAiCreditsLimit(error) {
|
|
5533
|
+
if (!isHttpError(error) || error.statusCode !== 429) return;
|
|
5534
|
+
let body = error.response.body;
|
|
5535
|
+
if (!isPlainObject(body)) return;
|
|
5536
|
+
let reasonCode = optionalString(body.reasonCode), quota = optionalNumber(body.quota);
|
|
5537
|
+
if (reasonCode !== void 0 || quota !== void 0) return {
|
|
5538
|
+
granted: !1,
|
|
5539
|
+
reasonCode,
|
|
5540
|
+
used: optionalNumber(body.usageValue),
|
|
5541
|
+
quota
|
|
5542
|
+
};
|
|
5543
|
+
}
|
|
5544
|
+
/** The Sanity website the project's API host belongs to, for links into Manage */
|
|
5545
|
+
function websiteUrl(apiHost) {
|
|
5546
|
+
return apiHost?.endsWith(".work") ? "https://www.sanity.work" : "https://www.sanity.io";
|
|
5547
|
+
}
|
|
5548
|
+
/**
|
|
5549
|
+
* The organization's AI usage in Manage; without the organization ID, Manage's own redirect to
|
|
5550
|
+
* the organization of the signed-in user
|
|
5551
|
+
*/
|
|
5552
|
+
function aiUsageUrl(apiHost, organizationId) {
|
|
5553
|
+
let site = websiteUrl(apiHost);
|
|
5554
|
+
return organizationId ? `${site}/organizations/${organizationId}/usage/ai` : `${site}/manage/org/usage/ai`;
|
|
5555
|
+
}
|
|
5556
|
+
/** The organization's spending limits in Manage, where the AI credits limit is raised */
|
|
5557
|
+
function aiSpendingLimitUrl(apiHost, organizationId) {
|
|
5558
|
+
let site = websiteUrl(apiHost);
|
|
5559
|
+
return organizationId ? `${site}/organizations/${organizationId}/settings#caps` : `${site}/manage/org/settings`;
|
|
5560
|
+
}
|
|
5561
|
+
/** How long a reading stands before a control that mounts reads again */
|
|
5562
|
+
const entries = /* @__PURE__ */ new Map(), listeners = /* @__PURE__ */ new Set();
|
|
5563
|
+
function subscribe(listener) {
|
|
5564
|
+
return listeners.add(listener), () => {
|
|
5565
|
+
listeners.delete(listener);
|
|
5566
|
+
};
|
|
5567
|
+
}
|
|
5568
|
+
function update(projectId, entry) {
|
|
5569
|
+
entries.set(projectId, entry), listeners.forEach((listener) => listener());
|
|
5570
|
+
}
|
|
5571
|
+
async function read(projectId, client) {
|
|
5572
|
+
let previous = entries.get(projectId), version = (previous?.version ?? 0) + 1;
|
|
5573
|
+
update(projectId, {
|
|
5574
|
+
credits: previous?.credits,
|
|
5575
|
+
readAt: previous?.readAt ?? 0,
|
|
5576
|
+
reading: !0,
|
|
5577
|
+
version
|
|
5578
|
+
});
|
|
5579
|
+
let credits;
|
|
5580
|
+
try {
|
|
5581
|
+
credits = await fetchAiCredits(client);
|
|
5582
|
+
} catch {
|
|
5583
|
+
credits = void 0;
|
|
5584
|
+
}
|
|
5585
|
+
entries.get(projectId)?.version === version && update(projectId, {
|
|
5586
|
+
credits,
|
|
5587
|
+
readAt: Date.now(),
|
|
5588
|
+
reading: !1,
|
|
5589
|
+
version
|
|
5590
|
+
});
|
|
5591
|
+
}
|
|
5592
|
+
/**
|
|
5593
|
+
* The organization's AI credits, read through the project when a control that spends them
|
|
5594
|
+
* mounts and the last reading is more than a minute old; `undefined` until read, and when the
|
|
5595
|
+
* API has nothing to say about them
|
|
5596
|
+
*/
|
|
5597
|
+
function useAiCredits(client) {
|
|
5598
|
+
let $ = c(8), t0;
|
|
5599
|
+
$[0] === client ? t0 = $[1] : (t0 = client.config(), $[0] = client, $[1] = t0);
|
|
5600
|
+
let { projectId } = t0, t1;
|
|
5601
|
+
$[2] === projectId ? t1 = $[3] : (t1 = () => projectId ? entries.get(projectId)?.credits : void 0, $[2] = projectId, $[3] = t1);
|
|
5602
|
+
let credits = useSyncExternalStore(subscribe, t1), t2, t3;
|
|
5603
|
+
return $[4] !== client || $[5] !== projectId ? (t2 = () => {
|
|
5604
|
+
if (!projectId) return;
|
|
5605
|
+
let entry = entries.get(projectId);
|
|
5606
|
+
entry && (entry.reading || Date.now() - entry.readAt < 6e4) || read(projectId, client);
|
|
5607
|
+
}, t3 = [client, projectId], $[4] = client, $[5] = projectId, $[6] = t2, $[7] = t3) : (t2 = $[6], t3 = $[7]), useEffect(t2, t3), credits;
|
|
5608
|
+
}
|
|
5609
|
+
/**
|
|
5610
|
+
* A request was turned down for the credits: every control shows the limit right away, with the
|
|
5611
|
+
* usage the response carried, rather than the reading from before
|
|
5612
|
+
*/
|
|
5613
|
+
function reportAiCreditsLimit(client, limit) {
|
|
5614
|
+
let { projectId } = client.config();
|
|
5615
|
+
if (!projectId) return;
|
|
5616
|
+
let version = (entries.get(projectId)?.version ?? 0) + 1;
|
|
5617
|
+
update(projectId, {
|
|
5618
|
+
credits: limit,
|
|
5619
|
+
readAt: Date.now(),
|
|
5620
|
+
reading: !1,
|
|
5621
|
+
version
|
|
5622
|
+
});
|
|
5623
|
+
}
|
|
5624
|
+
/**
|
|
5625
|
+
* A request went through: a limit reported before no longer holds (the spending limit was
|
|
5626
|
+
* raised, or the month turned), so the credits are read again
|
|
5627
|
+
*/
|
|
5628
|
+
function reportAiCreditsGranted(client) {
|
|
5629
|
+
let { projectId } = client.config();
|
|
5630
|
+
if (!projectId) return;
|
|
5631
|
+
let entry = entries.get(projectId);
|
|
5632
|
+
entry?.credits?.granted === !1 && !entry.reading && read(projectId, client);
|
|
5633
|
+
}
|
|
5401
5634
|
function isReferenceType(type) {
|
|
5402
5635
|
for (let current = type; current; current = current.type) if (current.name === "reference") return "to" in type;
|
|
5403
5636
|
return !1;
|
|
@@ -5455,6 +5688,156 @@ function summarizeSchema(schema, request) {
|
|
|
5455
5688
|
let lines = [...detailed];
|
|
5456
5689
|
return others.length > 0 && lines.push(`${detailed.length > 0 ? "Other document types" : "Document types"}: ${others.join(", ")}`), lines.join("\n");
|
|
5457
5690
|
}
|
|
5691
|
+
/** The ID of the organization the project belongs to, for links to its pages in Manage */
|
|
5692
|
+
function useOrganizationId() {
|
|
5693
|
+
let $ = c(2), projectStore = useProjectStore(), t0;
|
|
5694
|
+
return $[0] === projectStore ? t0 = $[1] : (t0 = projectStore.getOrganizationId(), $[0] = projectStore, $[1] = t0), useObservable(t0, null);
|
|
5695
|
+
}
|
|
5696
|
+
/** How many credits are left this month, with a link to the organization's AI usage in Manage */
|
|
5697
|
+
function AiCreditsNote(t0) {
|
|
5698
|
+
let $ = c(28), { used, quota, apiHost, size } = t0, { t } = useTranslation(visionLocaleNamespace), numberFormat = useNumberFormat(), organizationId = useOrganizationId(), t1;
|
|
5699
|
+
$[0] === numberFormat ? t1 = $[1] : (t1 = (value) => numberFormat.format(value), $[0] = numberFormat, $[1] = t1);
|
|
5700
|
+
let format = t1, note;
|
|
5701
|
+
if (quota === void 0) {
|
|
5702
|
+
let t2;
|
|
5703
|
+
$[2] !== format || $[3] !== t || $[4] !== used ? (t2 = t("vista.ai-credits.used", { used: format(used) }), $[2] = format, $[3] = t, $[4] = used, $[5] = t2) : t2 = $[5], note = t2;
|
|
5704
|
+
} else if (used > quota) {
|
|
5705
|
+
let t2;
|
|
5706
|
+
$[6] !== format || $[7] !== quota || $[8] !== t || $[9] !== used ? (t2 = t("vista.ai-credits.deficit", {
|
|
5707
|
+
used: format(used),
|
|
5708
|
+
deficit: format(used - quota),
|
|
5709
|
+
quota: format(quota)
|
|
5710
|
+
}), $[6] = format, $[7] = quota, $[8] = t, $[9] = used, $[10] = t2) : t2 = $[10], note = t2;
|
|
5711
|
+
} else {
|
|
5712
|
+
let t2;
|
|
5713
|
+
$[11] !== format || $[12] !== quota || $[13] !== t || $[14] !== used ? (t2 = t("vista.ai-credits.balance", {
|
|
5714
|
+
balance: format(quota - used),
|
|
5715
|
+
quota: format(quota)
|
|
5716
|
+
}), $[11] = format, $[12] = quota, $[13] = t, $[14] = used, $[15] = t2) : t2 = $[15], note = t2;
|
|
5717
|
+
}
|
|
5718
|
+
let t2 = note, t3;
|
|
5719
|
+
$[16] !== apiHost || $[17] !== organizationId ? (t3 = aiUsageUrl(apiHost, organizationId), $[16] = apiHost, $[17] = organizationId, $[18] = t3) : t3 = $[18];
|
|
5720
|
+
let t4;
|
|
5721
|
+
$[19] === t ? t4 = $[20] : (t4 = t("vista.ai-credits.usage"), $[19] = t, $[20] = t4);
|
|
5722
|
+
let t5;
|
|
5723
|
+
$[21] !== t3 || $[22] !== t4 ? (t5 = /* @__PURE__ */ jsx("a", {
|
|
5724
|
+
href: t3,
|
|
5725
|
+
rel: "noreferrer",
|
|
5726
|
+
target: "_blank",
|
|
5727
|
+
children: t4
|
|
5728
|
+
}), $[21] = t3, $[22] = t4, $[23] = t5) : t5 = $[23];
|
|
5729
|
+
let t6;
|
|
5730
|
+
return $[24] !== note || $[25] !== size || $[26] !== t5 ? (t6 = /* @__PURE__ */ jsxs(Text, {
|
|
5731
|
+
"data-testid": "vista-ai-credits",
|
|
5732
|
+
muted: !0,
|
|
5733
|
+
size,
|
|
5734
|
+
children: [
|
|
5735
|
+
t2,
|
|
5736
|
+
" ",
|
|
5737
|
+
t5
|
|
5738
|
+
]
|
|
5739
|
+
}), $[24] = note, $[25] = size, $[26] = t5, $[27] = t6) : t6 = $[27], t6;
|
|
5740
|
+
}
|
|
5741
|
+
/**
|
|
5742
|
+
* The organization is out of AI credits: what that means, and where the limit is raised. Agent
|
|
5743
|
+
* Actions turn every request down until then, so this stands where their result would.
|
|
5744
|
+
*/
|
|
5745
|
+
function AiCreditsLimitCard(t0) {
|
|
5746
|
+
let $ = c(30), { credits, apiHost } = t0, { t } = useTranslation(visionLocaleNamespace), numberFormat = useNumberFormat(), organizationId = useOrganizationId(), { used, quota } = credits, t1;
|
|
5747
|
+
$[0] === t ? t1 = $[1] : (t1 = t("vista.ai-credits.limit.title"), $[0] = t, $[1] = t1);
|
|
5748
|
+
let t2;
|
|
5749
|
+
$[2] === t1 ? t2 = $[3] : (t2 = /* @__PURE__ */ jsx(Text, {
|
|
5750
|
+
size: 1,
|
|
5751
|
+
weight: "medium",
|
|
5752
|
+
children: t1
|
|
5753
|
+
}), $[2] = t1, $[3] = t2);
|
|
5754
|
+
let t3;
|
|
5755
|
+
$[4] !== numberFormat || $[5] !== quota || $[6] !== t || $[7] !== used ? (t3 = used === void 0 || quota === void 0 ? t("vista.ai-credits.limit.description-unknown") : t("vista.ai-credits.limit.description", {
|
|
5756
|
+
used: numberFormat.format(used),
|
|
5757
|
+
quota: numberFormat.format(quota)
|
|
5758
|
+
}), $[4] = numberFormat, $[5] = quota, $[6] = t, $[7] = used, $[8] = t3) : t3 = $[8];
|
|
5759
|
+
let t4;
|
|
5760
|
+
$[9] === t3 ? t4 = $[10] : (t4 = /* @__PURE__ */ jsx(Text, {
|
|
5761
|
+
muted: !0,
|
|
5762
|
+
size: 1,
|
|
5763
|
+
children: t3
|
|
5764
|
+
}), $[9] = t3, $[10] = t4);
|
|
5765
|
+
let t5;
|
|
5766
|
+
$[11] === t ? t5 = $[12] : (t5 = t("vista.ai-credits.limit.learn-more"), $[11] = t, $[12] = t5);
|
|
5767
|
+
let t6;
|
|
5768
|
+
$[13] === t5 ? t6 = $[14] : (t6 = /* @__PURE__ */ jsx(Button, {
|
|
5769
|
+
as: "a",
|
|
5770
|
+
fontSize: 1,
|
|
5771
|
+
href: "https://www.sanity.io/docs/platform-management/how-ai-credits-work",
|
|
5772
|
+
iconRight: LaunchIcon,
|
|
5773
|
+
mode: "bleed",
|
|
5774
|
+
padding: 2,
|
|
5775
|
+
rel: "noreferrer",
|
|
5776
|
+
target: "_blank",
|
|
5777
|
+
text: t5
|
|
5778
|
+
}), $[13] = t5, $[14] = t6);
|
|
5779
|
+
let t7;
|
|
5780
|
+
$[15] !== apiHost || $[16] !== organizationId ? (t7 = aiSpendingLimitUrl(apiHost, organizationId), $[15] = apiHost, $[16] = organizationId, $[17] = t7) : t7 = $[17];
|
|
5781
|
+
let t8;
|
|
5782
|
+
$[18] === t ? t8 = $[19] : (t8 = t("vista.ai-credits.limit.manage"), $[18] = t, $[19] = t8);
|
|
5783
|
+
let t9;
|
|
5784
|
+
$[20] !== t7 || $[21] !== t8 ? (t9 = /* @__PURE__ */ jsx(Button, {
|
|
5785
|
+
as: "a",
|
|
5786
|
+
"data-testid": "vista-ai-credits-manage",
|
|
5787
|
+
fontSize: 1,
|
|
5788
|
+
href: t7,
|
|
5789
|
+
padding: 2,
|
|
5790
|
+
rel: "noreferrer",
|
|
5791
|
+
target: "_blank",
|
|
5792
|
+
text: t8,
|
|
5793
|
+
tone: "primary"
|
|
5794
|
+
}), $[20] = t7, $[21] = t8, $[22] = t9) : t9 = $[22];
|
|
5795
|
+
let t10;
|
|
5796
|
+
$[23] !== t6 || $[24] !== t9 ? (t10 = /* @__PURE__ */ jsxs(Flex, {
|
|
5797
|
+
gap: 2,
|
|
5798
|
+
justifyContent: "flex-end",
|
|
5799
|
+
children: [t6, t9]
|
|
5800
|
+
}), $[23] = t6, $[24] = t9, $[25] = t10) : t10 = $[25];
|
|
5801
|
+
let t11;
|
|
5802
|
+
return $[26] !== t10 || $[27] !== t2 || $[28] !== t4 ? (t11 = /* @__PURE__ */ jsx(Card, {
|
|
5803
|
+
border: !0,
|
|
5804
|
+
"data-testid": "vista-ai-credits-limit",
|
|
5805
|
+
padding: 3,
|
|
5806
|
+
radius: 2,
|
|
5807
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
5808
|
+
gap: 3,
|
|
5809
|
+
children: [
|
|
5810
|
+
t2,
|
|
5811
|
+
t4,
|
|
5812
|
+
t10
|
|
5813
|
+
]
|
|
5814
|
+
})
|
|
5815
|
+
}), $[26] = t10, $[27] = t2, $[28] = t4, $[29] = t11) : t11 = $[29], t11;
|
|
5816
|
+
}
|
|
5817
|
+
/**
|
|
5818
|
+
* What the organization's AI credits mean for the Agent Actions control this stands under:
|
|
5819
|
+
* nothing while they are unknown, how many are left while requests go through, and the way to
|
|
5820
|
+
* more of them once the spending limit is reached
|
|
5821
|
+
*/
|
|
5822
|
+
function AiCreditsStatus(t0) {
|
|
5823
|
+
let $ = c(8), { credits, apiHost, size: t1 } = t0, size = t1 === void 0 ? 1 : t1;
|
|
5824
|
+
if (!credits) return null;
|
|
5825
|
+
if (!credits.granted) {
|
|
5826
|
+
let t2;
|
|
5827
|
+
return $[0] !== apiHost || $[1] !== credits ? (t2 = /* @__PURE__ */ jsx(AiCreditsLimitCard, {
|
|
5828
|
+
apiHost,
|
|
5829
|
+
credits
|
|
5830
|
+
}), $[0] = apiHost, $[1] = credits, $[2] = t2) : t2 = $[2], t2;
|
|
5831
|
+
}
|
|
5832
|
+
if (credits.used === void 0) return null;
|
|
5833
|
+
let t2;
|
|
5834
|
+
return $[3] !== apiHost || $[4] !== credits.quota || $[5] !== credits.used || $[6] !== size ? (t2 = /* @__PURE__ */ jsx(AiCreditsNote, {
|
|
5835
|
+
apiHost,
|
|
5836
|
+
quota: credits.quota,
|
|
5837
|
+
size,
|
|
5838
|
+
used: credits.used
|
|
5839
|
+
}), $[3] = apiHost, $[4] = credits.quota, $[5] = credits.used, $[6] = size, $[7] = t2) : t2 = $[7], t2;
|
|
5840
|
+
}
|
|
5458
5841
|
/** A description to generate from, with the button that generates: Enter submits, Escape closes */
|
|
5459
5842
|
function PromptRow(props) {
|
|
5460
5843
|
let $ = c(34), { label, placeholder, value, onChange, onSubmit, onClose, pending, testIdPrefix } = props, { t } = useTranslation(visionLocaleNamespace), t0;
|
|
@@ -5529,9 +5912,9 @@ function PromptRow(props) {
|
|
|
5529
5912
|
* replaces the tab's query and params, and runs.
|
|
5530
5913
|
*/
|
|
5531
5914
|
function GenerateQueryBar(t0) {
|
|
5532
|
-
let $ = c(
|
|
5915
|
+
let $ = c(54), { tab, client, formatForEditor, onClose } = t0, { t } = useTranslation(visionLocaleNamespace), actorRef = useVistaActor(), schema = useSchema(), [request, setRequest] = useState(""), t1;
|
|
5533
5916
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = { type: "idle" }, $[0] = t1) : t1 = $[0];
|
|
5534
|
-
let [status, setStatus] = useState(t1), controllerRef = useRef(null), t2, t3;
|
|
5917
|
+
let [status, setStatus] = useState(t1), controllerRef = useRef(null), credits = useAiCredits(client), t2, t3;
|
|
5535
5918
|
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => () => controllerRef.current?.abort(), t3 = [], $[1] = t2, $[2] = t3) : (t2 = $[1], t3 = $[2]), useEffect(t2, t3);
|
|
5536
5919
|
let t4;
|
|
5537
5920
|
$[3] !== actorRef || $[4] !== formatForEditor || $[5] !== onClose || $[6] !== tab.id || $[7] !== tab.query || $[8] !== tab.title ? (t4 = async (generated, fetch, signal) => {
|
|
@@ -5546,7 +5929,7 @@ function GenerateQueryBar(t0) {
|
|
|
5546
5929
|
rawParams: JSON.stringify(generated.params, null, 2),
|
|
5547
5930
|
...named ? { title: generated.title } : {}
|
|
5548
5931
|
},
|
|
5549
|
-
fetch
|
|
5932
|
+
fetch: fetch ? "generated" : void 0
|
|
5550
5933
|
}), onClose();
|
|
5551
5934
|
}, $[3] = actorRef, $[4] = formatForEditor, $[5] = onClose, $[6] = tab.id, $[7] = tab.query, $[8] = tab.title, $[9] = t4) : t4 = $[9];
|
|
5552
5935
|
let open = t4, t5;
|
|
@@ -5570,18 +5953,20 @@ function GenerateQueryBar(t0) {
|
|
|
5570
5953
|
attempt
|
|
5571
5954
|
})
|
|
5572
5955
|
});
|
|
5573
|
-
await open(generated_0, !0, controller.signal);
|
|
5956
|
+
reportAiCreditsGranted(client), await open(generated_0, !0, controller.signal);
|
|
5574
5957
|
} catch (t6) {
|
|
5575
5958
|
let error = t6;
|
|
5576
5959
|
if (controller.signal.aborted) return;
|
|
5577
|
-
|
|
5960
|
+
let limit = readAiCreditsLimit(error);
|
|
5961
|
+
limit && reportAiCreditsLimit(client, limit), setStatus({
|
|
5578
5962
|
type: "failed",
|
|
5579
5963
|
message: error instanceof Error ? error.message : String(error),
|
|
5580
|
-
lastAttempt: error instanceof GenerateQueryError ? error.lastAttempt : void 0
|
|
5964
|
+
lastAttempt: error instanceof GenerateQueryError ? error.lastAttempt : void 0,
|
|
5965
|
+
limit
|
|
5581
5966
|
});
|
|
5582
5967
|
}
|
|
5583
5968
|
}, $[10] = client, $[11] = open, $[12] = request, $[13] = schema, $[14] = t5) : t5 = $[14];
|
|
5584
|
-
let generate = t5, generating = status.type === "generating", lastAttempt = status.type === "failed" ? status.lastAttempt : void 0, t6;
|
|
5969
|
+
let generate = t5, generating = status.type === "generating", lastAttempt = status.type === "failed" ? status.lastAttempt : void 0, shownCredits = status.type === "failed" ? status.limit : status.type === "idle" ? credits : void 0, atLimit = shownCredits?.granted === !1, t6;
|
|
5585
5970
|
$[15] === t ? t6 = $[16] : (t6 = t("vista.generate.label"), $[15] = t, $[16] = t6);
|
|
5586
5971
|
let t7;
|
|
5587
5972
|
$[17] === generate ? t7 = $[18] : (t7 = () => void generate(), $[17] = generate, $[18] = t7);
|
|
@@ -5599,13 +5984,13 @@ function GenerateQueryBar(t0) {
|
|
|
5599
5984
|
value: request
|
|
5600
5985
|
}), $[21] = generating, $[22] = onClose, $[23] = request, $[24] = t6, $[25] = t7, $[26] = t8, $[27] = t9) : t9 = $[27];
|
|
5601
5986
|
let t10;
|
|
5602
|
-
$[28] !== status.type || $[
|
|
5987
|
+
$[28] !== atLimit || $[29] !== status.type || $[30] !== t ? (t10 = status.type === "idle" && !atLimit && /* @__PURE__ */ jsx(Text, {
|
|
5603
5988
|
muted: !0,
|
|
5604
5989
|
size: 0,
|
|
5605
5990
|
children: t("vista.generate.description")
|
|
5606
|
-
}), $[28] = status.type, $[
|
|
5991
|
+
}), $[28] = atLimit, $[29] = status.type, $[30] = t, $[31] = t10) : t10 = $[31];
|
|
5607
5992
|
let t11;
|
|
5608
|
-
$[
|
|
5993
|
+
$[32] !== status.attempt || $[33] !== status.type || $[34] !== t ? (t11 = status.type === "generating" && /* @__PURE__ */ jsx(Text, {
|
|
5609
5994
|
"data-testid": "vista-generate-progress",
|
|
5610
5995
|
muted: !0,
|
|
5611
5996
|
size: 1,
|
|
@@ -5613,9 +5998,9 @@ function GenerateQueryBar(t0) {
|
|
|
5613
5998
|
attempt: status.attempt,
|
|
5614
5999
|
max: 3
|
|
5615
6000
|
}) : t("vista.generate.progress")
|
|
5616
|
-
}), $[
|
|
6001
|
+
}), $[32] = status.attempt, $[33] = status.type, $[34] = t, $[35] = t11) : t11 = $[35];
|
|
5617
6002
|
let t12;
|
|
5618
|
-
$[
|
|
6003
|
+
$[36] !== atLimit || $[37] !== lastAttempt || $[38] !== open || $[39] !== status.message || $[40] !== status.type || $[41] !== t ? (t12 = status.type === "failed" && !atLimit && /* @__PURE__ */ jsx(Card, {
|
|
5619
6004
|
"data-testid": "vista-generate-error",
|
|
5620
6005
|
padding: 3,
|
|
5621
6006
|
radius: 2,
|
|
@@ -5645,9 +6030,17 @@ function GenerateQueryBar(t0) {
|
|
|
5645
6030
|
}) })] })
|
|
5646
6031
|
]
|
|
5647
6032
|
})
|
|
5648
|
-
}), $[
|
|
6033
|
+
}), $[36] = atLimit, $[37] = lastAttempt, $[38] = open, $[39] = status.message, $[40] = status.type, $[41] = t, $[42] = t12) : t12 = $[42];
|
|
5649
6034
|
let t13;
|
|
5650
|
-
|
|
6035
|
+
$[43] === client ? t13 = $[44] : (t13 = client.config(), $[43] = client, $[44] = t13);
|
|
6036
|
+
let t14;
|
|
6037
|
+
$[45] !== shownCredits || $[46] !== t13.apiHost ? (t14 = /* @__PURE__ */ jsx(AiCreditsStatus, {
|
|
6038
|
+
apiHost: t13.apiHost,
|
|
6039
|
+
credits: shownCredits,
|
|
6040
|
+
size: 0
|
|
6041
|
+
}), $[45] = shownCredits, $[46] = t13.apiHost, $[47] = t14) : t14 = $[47];
|
|
6042
|
+
let t15;
|
|
6043
|
+
return $[48] !== t10 || $[49] !== t11 || $[50] !== t12 || $[51] !== t14 || $[52] !== t9 ? (t15 = /* @__PURE__ */ jsx(Card, {
|
|
5651
6044
|
borderBottom: !0,
|
|
5652
6045
|
"data-testid": "vista-generate-bar",
|
|
5653
6046
|
padding: 2,
|
|
@@ -5657,10 +6050,11 @@ function GenerateQueryBar(t0) {
|
|
|
5657
6050
|
t9,
|
|
5658
6051
|
t10,
|
|
5659
6052
|
t11,
|
|
5660
|
-
t12
|
|
6053
|
+
t12,
|
|
6054
|
+
t14
|
|
5661
6055
|
]
|
|
5662
6056
|
})
|
|
5663
|
-
}), $[
|
|
6057
|
+
}), $[48] = t10, $[49] = t11, $[50] = t12, $[51] = t14, $[52] = t9, $[53] = t15) : t15 = $[53], t15;
|
|
5664
6058
|
}
|
|
5665
6059
|
/**
|
|
5666
6060
|
* Live fetch, an alternative to Fetch: fetches the query, then fetches again whenever the
|
|
@@ -7369,14 +7763,8 @@ function RequestPanel(props) {
|
|
|
7369
7763
|
flexGrow: 1
|
|
7370
7764
|
}), $[40] = t16) : t16 = $[40];
|
|
7371
7765
|
let t17;
|
|
7372
|
-
$[41] !== generatorOpen || $[42] !== t ? (t17 = !generatorOpen && /* @__PURE__ */ jsx(
|
|
7373
|
-
|
|
7374
|
-
content: /* @__PURE__ */ jsx(Text, {
|
|
7375
|
-
size: 1,
|
|
7376
|
-
children: t("vista.generate.button")
|
|
7377
|
-
}),
|
|
7378
|
-
placement: "bottom",
|
|
7379
|
-
portal: !0,
|
|
7766
|
+
$[41] !== generatorOpen || $[42] !== t ? (t17 = !generatorOpen && /* @__PURE__ */ jsx(AgentActionsTooltip, {
|
|
7767
|
+
title: t("vista.generate.button"),
|
|
7380
7768
|
children: /* @__PURE__ */ jsx(Button, {
|
|
7381
7769
|
"aria-label": t("vista.generate.button"),
|
|
7382
7770
|
"data-testid": "vista-generate-query",
|
|
@@ -7796,7 +8184,8 @@ function useQueryExplain(request) {
|
|
|
7796
8184
|
setPlan({
|
|
7797
8185
|
status: "failed",
|
|
7798
8186
|
url: current.url,
|
|
7799
|
-
message: toMessage(error)
|
|
8187
|
+
message: toMessage(error),
|
|
8188
|
+
limit: void 0
|
|
7800
8189
|
});
|
|
7801
8190
|
return;
|
|
7802
8191
|
}
|
|
@@ -7816,17 +8205,18 @@ function useQueryExplain(request) {
|
|
|
7816
8205
|
if (planText === void 0) setExplanation(IDLE);
|
|
7817
8206
|
else try {
|
|
7818
8207
|
let text_0 = await explainQuery(request.client, request, planText);
|
|
7819
|
-
setExplanation({
|
|
8208
|
+
reportAiCreditsGranted(request.client), setExplanation({
|
|
7820
8209
|
status: "done",
|
|
7821
8210
|
url: request.url,
|
|
7822
8211
|
text: text_0
|
|
7823
8212
|
});
|
|
7824
8213
|
} catch (t3) {
|
|
7825
|
-
let error_0 = t3;
|
|
7826
|
-
setExplanation({
|
|
8214
|
+
let error_0 = t3, limit = readAiCreditsLimit(error_0);
|
|
8215
|
+
limit && reportAiCreditsLimit(request.client, limit), setExplanation({
|
|
7827
8216
|
status: "failed",
|
|
7828
8217
|
url: request.url,
|
|
7829
|
-
message: toMessage(error_0)
|
|
8218
|
+
message: toMessage(error_0),
|
|
8219
|
+
limit
|
|
7830
8220
|
});
|
|
7831
8221
|
}
|
|
7832
8222
|
}, $[3] = currentPlan, $[4] = request, $[5] = t2) : t2 = $[5];
|
|
@@ -8581,9 +8971,9 @@ function describeInsight(insight, t) {
|
|
|
8581
8971
|
* and on request an explanation of the query and the plan written by Agent Actions
|
|
8582
8972
|
*/
|
|
8583
8973
|
function ExplainTab(props) {
|
|
8584
|
-
let $ = c(
|
|
8974
|
+
let $ = c(61), { client, plan, explanation, canExplain, onShowPlan, onExplain } = props, { t } = useTranslation(visionLocaleNamespace), credits = useAiCredits(client), explaining = explanation.status === "loading", planText = plan.status === "done" ? plan.text : void 0, t0;
|
|
8585
8975
|
$[0] === planText ? t0 = $[1] : (t0 = planText ? readPlanInsights(planText) : [], $[0] = planText, $[1] = t0);
|
|
8586
|
-
let insights = t0, t1;
|
|
8976
|
+
let insights = t0, limit = explanation.status === "failed" ? explanation.limit : void 0, t1;
|
|
8587
8977
|
$[2] === t ? t1 = $[3] : (t1 = t("vista.explain.description"), $[2] = t, $[3] = t1);
|
|
8588
8978
|
let t2;
|
|
8589
8979
|
$[4] === t1 ? t2 = $[5] : (t2 = /* @__PURE__ */ jsx(Text, {
|
|
@@ -8594,7 +8984,7 @@ function ExplainTab(props) {
|
|
|
8594
8984
|
let t3 = !canExplain || explaining, t4;
|
|
8595
8985
|
$[6] === t ? t4 = $[7] : (t4 = t("vista.explain.explain"), $[6] = t, $[7] = t4);
|
|
8596
8986
|
let t5;
|
|
8597
|
-
$[8] !== explaining || $[9] !== onExplain || $[10] !== t3 || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsx(Button, {
|
|
8987
|
+
$[8] !== explaining || $[9] !== onExplain || $[10] !== t3 || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsx(AgentActionsTooltip, { children: /* @__PURE__ */ jsx(Button, {
|
|
8598
8988
|
"data-testid": "vista-explain-button",
|
|
8599
8989
|
disabled: t3,
|
|
8600
8990
|
fontSize: 1,
|
|
@@ -8604,7 +8994,7 @@ function ExplainTab(props) {
|
|
|
8604
8994
|
padding: 2,
|
|
8605
8995
|
text: t4,
|
|
8606
8996
|
tone: "primary"
|
|
8607
|
-
}), $[8] = explaining, $[9] = onExplain, $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12];
|
|
8997
|
+
}) }), $[8] = explaining, $[9] = onExplain, $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12];
|
|
8608
8998
|
let t6 = !canExplain || plan.status === "loading", t7 = plan.status === "loading" && !explaining, t8;
|
|
8609
8999
|
$[13] === t ? t8 = $[14] : (t8 = t("vista.explain.plan"), $[13] = t, $[14] = t8);
|
|
8610
9000
|
let t9;
|
|
@@ -8625,13 +9015,20 @@ function ExplainTab(props) {
|
|
|
8625
9015
|
children: [t5, t9]
|
|
8626
9016
|
}), $[20] = t5, $[21] = t9, $[22] = t10) : t10 = $[22];
|
|
8627
9017
|
let t11;
|
|
8628
|
-
$[23]
|
|
9018
|
+
$[23] === client ? t11 = $[24] : (t11 = client.config(), $[23] = client, $[24] = t11);
|
|
9019
|
+
let t12 = limit ?? credits, t13;
|
|
9020
|
+
$[25] !== t11.apiHost || $[26] !== t12 ? (t13 = /* @__PURE__ */ jsx(AiCreditsStatus, {
|
|
9021
|
+
apiHost: t11.apiHost,
|
|
9022
|
+
credits: t12
|
|
9023
|
+
}), $[25] = t11.apiHost, $[26] = t12, $[27] = t13) : t13 = $[27];
|
|
9024
|
+
let t14;
|
|
9025
|
+
$[28] !== canExplain || $[29] !== t ? (t14 = !canExplain && /* @__PURE__ */ jsx(Text, {
|
|
8629
9026
|
muted: !0,
|
|
8630
9027
|
size: 1,
|
|
8631
9028
|
children: t("vista.explain.empty")
|
|
8632
|
-
}), $[
|
|
8633
|
-
let
|
|
8634
|
-
$[
|
|
9029
|
+
}), $[28] = canExplain, $[29] = t, $[30] = t14) : t14 = $[30];
|
|
9030
|
+
let t15;
|
|
9031
|
+
$[31] !== explanation.status || $[32] !== explanation.text ? (t15 = explanation.status === "done" && /* @__PURE__ */ jsx(Card, {
|
|
8635
9032
|
"data-testid": "vista-explanation",
|
|
8636
9033
|
padding: 3,
|
|
8637
9034
|
radius: 2,
|
|
@@ -8641,21 +9038,21 @@ function ExplainTab(props) {
|
|
|
8641
9038
|
gap: 4,
|
|
8642
9039
|
children: explanation.text.split(/\n+/).filter(_temp$12).map(_temp3$6)
|
|
8643
9040
|
})
|
|
8644
|
-
}), $[
|
|
8645
|
-
let
|
|
8646
|
-
$[
|
|
9041
|
+
}), $[31] = explanation.status, $[32] = explanation.text, $[33] = t15) : t15 = $[33];
|
|
9042
|
+
let t16;
|
|
9043
|
+
$[34] !== explanation.message || $[35] !== explanation.status || $[36] !== limit || $[37] !== t ? (t16 = explanation.status === "failed" && !limit && /* @__PURE__ */ jsx(Text, {
|
|
8647
9044
|
"data-testid": "vista-explain-error",
|
|
8648
9045
|
size: 1,
|
|
8649
9046
|
children: t("vista.explain.failed", { message: explanation.message })
|
|
8650
|
-
}), $[
|
|
8651
|
-
let
|
|
8652
|
-
$[
|
|
9047
|
+
}), $[34] = explanation.message, $[35] = explanation.status, $[36] = limit, $[37] = t, $[38] = t16) : t16 = $[38];
|
|
9048
|
+
let t17;
|
|
9049
|
+
$[39] !== plan.message || $[40] !== plan.status || $[41] !== t ? (t17 = plan.status === "failed" && /* @__PURE__ */ jsx(Text, {
|
|
8653
9050
|
"data-testid": "vista-explain-error",
|
|
8654
9051
|
size: 1,
|
|
8655
9052
|
children: t("vista.explain.plan-failed", { message: plan.message })
|
|
8656
|
-
}), $[
|
|
8657
|
-
let
|
|
8658
|
-
$[
|
|
9053
|
+
}), $[39] = plan.message, $[40] = plan.status, $[41] = t, $[42] = t17) : t17 = $[42];
|
|
9054
|
+
let t18;
|
|
9055
|
+
$[43] !== insights || $[44] !== plan.status || $[45] !== t ? (t18 = plan.status === "done" && insights.length > 0 && /* @__PURE__ */ jsxs(Stack, {
|
|
8659
9056
|
"data-testid": "vista-plan-insights",
|
|
8660
9057
|
gap: 2,
|
|
8661
9058
|
children: [
|
|
@@ -8692,9 +9089,9 @@ function ExplainTab(props) {
|
|
|
8692
9089
|
})
|
|
8693
9090
|
})
|
|
8694
9091
|
]
|
|
8695
|
-
}), $[
|
|
8696
|
-
let
|
|
8697
|
-
$[
|
|
9092
|
+
}), $[43] = insights, $[44] = plan.status, $[45] = t, $[46] = t18) : t18 = $[46];
|
|
9093
|
+
let t19;
|
|
9094
|
+
$[47] !== plan.status || $[48] !== plan.text || $[49] !== t ? (t19 = plan.status === "done" && /* @__PURE__ */ jsxs(Stack, {
|
|
8698
9095
|
"data-testid": "vista-query-plan",
|
|
8699
9096
|
gap: 2,
|
|
8700
9097
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
@@ -8705,9 +9102,9 @@ function ExplainTab(props) {
|
|
|
8705
9102
|
size: 1,
|
|
8706
9103
|
children: plan.text
|
|
8707
9104
|
})]
|
|
8708
|
-
}), $[
|
|
8709
|
-
let
|
|
8710
|
-
return $[
|
|
9105
|
+
}), $[47] = plan.status, $[48] = plan.text, $[49] = t, $[50] = t19) : t19 = $[50];
|
|
9106
|
+
let t20;
|
|
9107
|
+
return $[51] !== t10 || $[52] !== t13 || $[53] !== t14 || $[54] !== t15 || $[55] !== t16 || $[56] !== t17 || $[57] !== t18 || $[58] !== t19 || $[59] !== t2 ? (t20 = /* @__PURE__ */ jsx(Box, {
|
|
8711
9108
|
"data-testid": "vista-explain",
|
|
8712
9109
|
padding: 3,
|
|
8713
9110
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
@@ -8715,15 +9112,16 @@ function ExplainTab(props) {
|
|
|
8715
9112
|
children: [
|
|
8716
9113
|
t2,
|
|
8717
9114
|
t10,
|
|
8718
|
-
t11,
|
|
8719
|
-
t12,
|
|
8720
9115
|
t13,
|
|
8721
9116
|
t14,
|
|
8722
9117
|
t15,
|
|
8723
|
-
t16
|
|
9118
|
+
t16,
|
|
9119
|
+
t17,
|
|
9120
|
+
t18,
|
|
9121
|
+
t19
|
|
8724
9122
|
]
|
|
8725
9123
|
})
|
|
8726
|
-
}), $[
|
|
9124
|
+
}), $[51] = t10, $[52] = t13, $[53] = t14, $[54] = t15, $[55] = t16, $[56] = t17, $[57] = t18, $[58] = t19, $[59] = t2, $[60] = t20) : t20 = $[60], t20;
|
|
8727
9125
|
}
|
|
8728
9126
|
function _temp4$6(insight_0) {
|
|
8729
9127
|
return insight_0.tone === "caution";
|
|
@@ -9133,6 +9531,8 @@ function describeFetchReason(reason, t) {
|
|
|
9133
9531
|
case "resume": return t("vista.history.reason.resume");
|
|
9134
9532
|
case "live-start": return t("vista.history.reason.live-start");
|
|
9135
9533
|
case "generated": return t("vista.history.reason.generated");
|
|
9534
|
+
case "paste": return t("vista.history.reason.paste");
|
|
9535
|
+
case "link": return t("vista.history.reason.link");
|
|
9136
9536
|
case "mutation": return t("vista.history.reason.mutation");
|
|
9137
9537
|
case "live": return reason.matchedTags.length > 0 ? t("vista.history.reason.live") : t("vista.history.reason.live-restart");
|
|
9138
9538
|
default: return String(reason);
|
|
@@ -9843,9 +10243,9 @@ function toText(mutations) {
|
|
|
9843
10243
|
* dry-run, which writes nothing, so what it would change shows straight away.
|
|
9844
10244
|
*/
|
|
9845
10245
|
function GenerateMutationsBar(props) {
|
|
9846
|
-
let $ = c(
|
|
10246
|
+
let $ = c(50), { client, dataset, result, mutationOptions, onGenerated, onOpenAttempt, onClose } = props, { t } = useTranslation(visionLocaleNamespace), schema = useSchema(), [request, setRequest] = useState(""), t0;
|
|
9847
10247
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { type: "idle" }, $[0] = t0) : t0 = $[0];
|
|
9848
|
-
let [status, setStatus] = useState(t0), controllerRef = useRef(null), t1, t2;
|
|
10248
|
+
let [status, setStatus] = useState(t0), controllerRef = useRef(null), credits = useAiCredits(client), t1, t2;
|
|
9849
10249
|
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => () => controllerRef.current?.abort(), t2 = [], $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), useEffect(t1, t2);
|
|
9850
10250
|
let t3;
|
|
9851
10251
|
$[3] !== client || $[4] !== dataset || $[5] !== mutationOptions || $[6] !== onGenerated || $[7] !== request || $[8] !== result || $[9] !== schema ? (t3 = async () => {
|
|
@@ -9872,21 +10272,23 @@ function GenerateMutationsBar(props) {
|
|
|
9872
10272
|
})
|
|
9873
10273
|
});
|
|
9874
10274
|
if (controller.signal.aborted) return;
|
|
9875
|
-
onGenerated(toText(generated.mutations), {
|
|
10275
|
+
reportAiCreditsGranted(client), onGenerated(toText(generated.mutations), {
|
|
9876
10276
|
key: mutationRunKey(dataset, generated.mutations, mutationOptions),
|
|
9877
10277
|
result: generated.preview
|
|
9878
10278
|
});
|
|
9879
10279
|
} catch (t4) {
|
|
9880
10280
|
let error = t4;
|
|
9881
10281
|
if (controller.signal.aborted) return;
|
|
9882
|
-
|
|
10282
|
+
let limit = readAiCreditsLimit(error);
|
|
10283
|
+
limit && reportAiCreditsLimit(client, limit), setStatus({
|
|
9883
10284
|
type: "failed",
|
|
9884
10285
|
message: error instanceof Error ? error.message : String(error),
|
|
9885
|
-
lastAttempt: error instanceof GenerateMutationsError ? error.lastAttempt : void 0
|
|
10286
|
+
lastAttempt: error instanceof GenerateMutationsError ? error.lastAttempt : void 0,
|
|
10287
|
+
limit
|
|
9886
10288
|
});
|
|
9887
10289
|
}
|
|
9888
10290
|
}, $[3] = client, $[4] = dataset, $[5] = mutationOptions, $[6] = onGenerated, $[7] = request, $[8] = result, $[9] = schema, $[10] = t3) : t3 = $[10];
|
|
9889
|
-
let generate = t3, generating = status.type === "generating", lastAttempt = status.type === "failed" ? status.lastAttempt : void 0, t4;
|
|
10291
|
+
let generate = t3, generating = status.type === "generating", lastAttempt = status.type === "failed" ? status.lastAttempt : void 0, shownCredits = status.type === "failed" ? status.limit : status.type === "idle" ? credits : void 0, atLimit = shownCredits?.granted === !1, t4;
|
|
9890
10292
|
$[11] === t ? t4 = $[12] : (t4 = t("vista.mutate.generate.label"), $[11] = t, $[12] = t4);
|
|
9891
10293
|
let t5;
|
|
9892
10294
|
$[13] === generate ? t5 = $[14] : (t5 = () => void generate(), $[13] = generate, $[14] = t5);
|
|
@@ -9904,13 +10306,13 @@ function GenerateMutationsBar(props) {
|
|
|
9904
10306
|
value: request
|
|
9905
10307
|
}), $[17] = generating, $[18] = onClose, $[19] = request, $[20] = t4, $[21] = t5, $[22] = t6, $[23] = t7) : t7 = $[23];
|
|
9906
10308
|
let t8;
|
|
9907
|
-
$[24] !== status.type || $[
|
|
10309
|
+
$[24] !== atLimit || $[25] !== status.type || $[26] !== t ? (t8 = status.type === "idle" && !atLimit && /* @__PURE__ */ jsx(Text, {
|
|
9908
10310
|
muted: !0,
|
|
9909
10311
|
size: 0,
|
|
9910
10312
|
children: t("vista.mutate.generate.description")
|
|
9911
|
-
}), $[24] = status.type, $[
|
|
10313
|
+
}), $[24] = atLimit, $[25] = status.type, $[26] = t, $[27] = t8) : t8 = $[27];
|
|
9912
10314
|
let t9;
|
|
9913
|
-
$[
|
|
10315
|
+
$[28] !== status.attempt || $[29] !== status.type || $[30] !== t ? (t9 = status.type === "generating" && /* @__PURE__ */ jsx(Text, {
|
|
9914
10316
|
"data-testid": "vista-mutate-generate-progress",
|
|
9915
10317
|
muted: !0,
|
|
9916
10318
|
size: 1,
|
|
@@ -9918,9 +10320,9 @@ function GenerateMutationsBar(props) {
|
|
|
9918
10320
|
attempt: status.attempt,
|
|
9919
10321
|
max: 3
|
|
9920
10322
|
}) : t("vista.mutate.generate.progress")
|
|
9921
|
-
}), $[
|
|
10323
|
+
}), $[28] = status.attempt, $[29] = status.type, $[30] = t, $[31] = t9) : t9 = $[31];
|
|
9922
10324
|
let t10;
|
|
9923
|
-
$[
|
|
10325
|
+
$[32] !== atLimit || $[33] !== lastAttempt || $[34] !== onOpenAttempt || $[35] !== status.message || $[36] !== status.type || $[37] !== t ? (t10 = status.type === "failed" && !atLimit && /* @__PURE__ */ jsx(Card, {
|
|
9924
10326
|
"data-testid": "vista-mutate-generate-error",
|
|
9925
10327
|
padding: 3,
|
|
9926
10328
|
radius: 2,
|
|
@@ -9947,9 +10349,17 @@ function GenerateMutationsBar(props) {
|
|
|
9947
10349
|
}) })
|
|
9948
10350
|
]
|
|
9949
10351
|
})
|
|
9950
|
-
}), $[
|
|
10352
|
+
}), $[32] = atLimit, $[33] = lastAttempt, $[34] = onOpenAttempt, $[35] = status.message, $[36] = status.type, $[37] = t, $[38] = t10) : t10 = $[38];
|
|
9951
10353
|
let t11;
|
|
9952
|
-
|
|
10354
|
+
$[39] === client ? t11 = $[40] : (t11 = client.config(), $[39] = client, $[40] = t11);
|
|
10355
|
+
let t12;
|
|
10356
|
+
$[41] !== shownCredits || $[42] !== t11.apiHost ? (t12 = /* @__PURE__ */ jsx(AiCreditsStatus, {
|
|
10357
|
+
apiHost: t11.apiHost,
|
|
10358
|
+
credits: shownCredits,
|
|
10359
|
+
size: 0
|
|
10360
|
+
}), $[41] = shownCredits, $[42] = t11.apiHost, $[43] = t12) : t12 = $[43];
|
|
10361
|
+
let t13;
|
|
10362
|
+
return $[44] !== t10 || $[45] !== t12 || $[46] !== t7 || $[47] !== t8 || $[48] !== t9 ? (t13 = /* @__PURE__ */ jsx(Card, {
|
|
9953
10363
|
border: !0,
|
|
9954
10364
|
"data-testid": "vista-mutate-generate-bar",
|
|
9955
10365
|
padding: 2,
|
|
@@ -9960,10 +10370,11 @@ function GenerateMutationsBar(props) {
|
|
|
9960
10370
|
t7,
|
|
9961
10371
|
t8,
|
|
9962
10372
|
t9,
|
|
9963
|
-
t10
|
|
10373
|
+
t10,
|
|
10374
|
+
t12
|
|
9964
10375
|
]
|
|
9965
10376
|
})
|
|
9966
|
-
}), $[
|
|
10377
|
+
}), $[44] = t10, $[45] = t12, $[46] = t7, $[47] = t8, $[48] = t9, $[49] = t13) : t13 = $[49], t13;
|
|
9967
10378
|
}
|
|
9968
10379
|
function _temp$8(document) {
|
|
9969
10380
|
return document.type ?? [];
|
|
@@ -10296,7 +10707,7 @@ function MutateTab(props) {
|
|
|
10296
10707
|
let run = t2, t3;
|
|
10297
10708
|
$[12] === result ? t3 = $[13] : (t3 = documentsInResult(result), $[12] = result, $[13] = t3);
|
|
10298
10709
|
let documents = t3, previewIsCurrent = run !== void 0 && state.preview?.key === run.key, t4;
|
|
10299
|
-
$[14] === state.preview ? t4 = $[15] : (t4 = state.preview ? state.preview.result.changes.some(_temp5$
|
|
10710
|
+
$[14] === state.preview ? t4 = $[15] : (t4 = state.preview ? state.preview.result.changes.some(_temp5$3) || state.preview.result.notShown > 0 : !1, $[14] = state.preview, $[15] = t4);
|
|
10300
10711
|
let canApply = canRequest && previewIsCurrent && t4 && !state.pending, canAdd = input.status === "empty" || input.status === "valid", t5;
|
|
10301
10712
|
$[16] !== documents || $[17] !== mutate || $[18] !== state.text ? (t5 = (template) => {
|
|
10302
10713
|
let next = addMutation(state.text, createMutationTemplate(template, documents));
|
|
@@ -10329,14 +10740,8 @@ function MutateTab(props) {
|
|
|
10329
10740
|
result
|
|
10330
10741
|
}), $[31] = client, $[32] = dataset, $[33] = generatorOpen, $[34] = mutate, $[35] = options, $[36] = result, $[37] = t9) : t9 = $[37];
|
|
10331
10742
|
let t10 = hasOutcome ? "minmax(140px, 1fr) fit-content(50%)" : "minmax(140px, 1fr)", t11;
|
|
10332
|
-
$[38] !== generatorOpen || $[39] !== t ? (t11 = !generatorOpen && /* @__PURE__ */ jsx(
|
|
10333
|
-
|
|
10334
|
-
content: /* @__PURE__ */ jsx(Text, {
|
|
10335
|
-
size: 1,
|
|
10336
|
-
children: t("vista.mutate.generate.button")
|
|
10337
|
-
}),
|
|
10338
|
-
placement: "bottom",
|
|
10339
|
-
portal: !0,
|
|
10743
|
+
$[38] !== generatorOpen || $[39] !== t ? (t11 = !generatorOpen && /* @__PURE__ */ jsx(AgentActionsTooltip, {
|
|
10744
|
+
title: t("vista.mutate.generate.button"),
|
|
10340
10745
|
children: /* @__PURE__ */ jsx(Button, {
|
|
10341
10746
|
"aria-label": t("vista.mutate.generate.button"),
|
|
10342
10747
|
"data-testid": "vista-mutate-generate",
|
|
@@ -10616,7 +11021,7 @@ function MutateTab(props) {
|
|
|
10616
11021
|
children: [t36, t54]
|
|
10617
11022
|
}), $[160] = t36, $[161] = t54, $[162] = t55) : t55 = $[162], t55;
|
|
10618
11023
|
}
|
|
10619
|
-
function _temp5$
|
|
11024
|
+
function _temp5$3(change) {
|
|
10620
11025
|
return change.operation !== "none";
|
|
10621
11026
|
}
|
|
10622
11027
|
const GCP_REGIONS = {
|
|
@@ -12399,9 +12804,9 @@ const DEFAULT_BOTTOM_PANEL_SIZE = {
|
|
|
12399
12804
|
mobile: 160
|
|
12400
12805
|
};
|
|
12401
12806
|
function ResponsePanel(props) {
|
|
12402
|
-
let $ = c(
|
|
12807
|
+
let $ = c(191), { tab, runnerRef, resolved, request, lintFindings, onRevealRange, onEditQuery, onMutationsApplied } = props, { t } = useTranslation(visionLocaleNamespace), toast = useToast(), status = useSelector(runnerRef, selectRequestStatus), result = useSelector(runnerRef, _temp$3), settledRequest = useSelector(runnerRef, _temp2$3), error = useSelector(runnerRef, _temp3$2), failedRequest = useSelector(runnerRef, _temp4$2), t0;
|
|
12403
12808
|
$[0] === failedRequest?.client ? t0 = $[1] : (t0 = failedRequest?.client.config(), $[0] = failedRequest?.client, $[1] = t0);
|
|
12404
|
-
let failedConfig = t0, meta = useSelector(runnerRef, _temp5$
|
|
12809
|
+
let failedConfig = t0, meta = useSelector(runnerRef, _temp5$2), url = useSelector(runnerRef, _temp6), history = useSelector(runnerRef, _temp7), hiddenDiffFields = useVistaSelector(_temp8), isLive = useSelector(runnerRef, _temp9), hasResult = meta !== void 0, t1;
|
|
12405
12810
|
$[2] !== hasResult || $[3] !== request || $[4] !== settledRequest ? (t1 = hasResult && settledRequest !== void 0 && request !== null && haveSameQuery(settledRequest, request), $[2] = hasResult, $[3] = request, $[4] = settledRequest, $[5] = t1) : t1 = $[5];
|
|
12406
12811
|
let resultIsCurrent = t1, t2;
|
|
12407
12812
|
$[6] !== resolved.dataset || $[7] !== settledRequest?.client ? (t2 = settledRequest?.client.config().dataset || resolved.dataset, $[6] = resolved.dataset, $[7] = settledRequest?.client, $[8] = t2) : t2 = $[8];
|
|
@@ -12498,42 +12903,43 @@ function ResponsePanel(props) {
|
|
|
12498
12903
|
let t25 = request !== null, t26;
|
|
12499
12904
|
$[67] === queryExplain ? t26 = $[68] : (t26 = () => void queryExplain.explain(), $[67] = queryExplain, $[68] = t26);
|
|
12500
12905
|
let t27;
|
|
12501
|
-
$[69] !== queryExplain.explanation || $[70] !== queryExplain.plan || $[71] !== queryExplain.showPlan || $[72] !==
|
|
12906
|
+
$[69] !== queryExplain.explanation || $[70] !== queryExplain.plan || $[71] !== queryExplain.showPlan || $[72] !== resolved.client || $[73] !== t25 || $[74] !== t26 ? (t27 = /* @__PURE__ */ jsx(ExplainTab, {
|
|
12502
12907
|
canExplain: t25,
|
|
12908
|
+
client: resolved.client,
|
|
12503
12909
|
explanation: queryExplain.explanation,
|
|
12504
12910
|
onExplain: t26,
|
|
12505
12911
|
onShowPlan: queryExplain.showPlan,
|
|
12506
12912
|
plan: queryExplain.plan
|
|
12507
|
-
}), $[69] = queryExplain.explanation, $[70] = queryExplain.plan, $[71] = queryExplain.showPlan, $[72] =
|
|
12913
|
+
}), $[69] = queryExplain.explanation, $[70] = queryExplain.plan, $[71] = queryExplain.showPlan, $[72] = resolved.client, $[73] = t25, $[74] = t26, $[75] = t27) : t27 = $[75];
|
|
12508
12914
|
let t28;
|
|
12509
|
-
$[
|
|
12915
|
+
$[76] !== t24 || $[77] !== t27 ? (t28 = {
|
|
12510
12916
|
id: "explain",
|
|
12511
12917
|
label: t24,
|
|
12512
12918
|
content: t27
|
|
12513
|
-
}, $[
|
|
12919
|
+
}, $[76] = t24, $[77] = t27, $[78] = t28) : t28 = $[78];
|
|
12514
12920
|
let t29;
|
|
12515
|
-
$[
|
|
12921
|
+
$[79] === t ? t29 = $[80] : (t29 = t("vista.panel.source-map"), $[79] = t, $[80] = t29);
|
|
12516
12922
|
let t30;
|
|
12517
|
-
$[
|
|
12923
|
+
$[81] !== meta || $[82] !== resultDataset ? (t30 = /* @__PURE__ */ jsx(SourceMapTab, {
|
|
12518
12924
|
dataset: resultDataset,
|
|
12519
12925
|
meta
|
|
12520
|
-
}), $[
|
|
12926
|
+
}), $[81] = meta, $[82] = resultDataset, $[83] = t30) : t30 = $[83];
|
|
12521
12927
|
let t31;
|
|
12522
|
-
$[
|
|
12928
|
+
$[84] !== t29 || $[85] !== t30 ? (t31 = {
|
|
12523
12929
|
id: "source-map",
|
|
12524
12930
|
label: t29,
|
|
12525
12931
|
content: t30
|
|
12526
|
-
}, $[
|
|
12932
|
+
}, $[84] = t29, $[85] = t30, $[86] = t31) : t31 = $[86];
|
|
12527
12933
|
let t32;
|
|
12528
|
-
$[
|
|
12934
|
+
$[87] !== t17 || $[88] !== t20 || $[89] !== t23 || $[90] !== t28 || $[91] !== t31 ? (t32 = [
|
|
12529
12935
|
t17,
|
|
12530
12936
|
t20,
|
|
12531
12937
|
t23,
|
|
12532
12938
|
t28,
|
|
12533
12939
|
t31
|
|
12534
|
-
], $[
|
|
12940
|
+
], $[87] = t17, $[88] = t20, $[89] = t23, $[90] = t28, $[91] = t31, $[92] = t32) : t32 = $[92];
|
|
12535
12941
|
let panelTabs = t32, tabDrawer = useVistaSelector(selectOpenTabDrawer), t33;
|
|
12536
|
-
$[
|
|
12942
|
+
$[93] !== declaredFunctions || $[94] !== delta || $[95] !== functionLibrary || $[96] !== hasResult || $[97] !== hiddenDiffFields || $[98] !== lintFindings || $[99] !== mutate || $[100] !== onEditQuery || $[101] !== onMutationsApplied || $[102] !== onRevealRange || $[103] !== removeFunction || $[104] !== request || $[105] !== resolved.client || $[106] !== resolved.dataset || $[107] !== resolved.isValidApiVersion || $[108] !== result || $[109] !== saveFunction || $[110] !== tab.query ? (t33 = (drawer) => {
|
|
12537
12943
|
switch (drawer) {
|
|
12538
12944
|
case "lint": return /* @__PURE__ */ jsx(LintTab, {
|
|
12539
12945
|
findings: lintFindings,
|
|
@@ -12563,9 +12969,9 @@ function ResponsePanel(props) {
|
|
|
12563
12969
|
});
|
|
12564
12970
|
default: return String(drawer);
|
|
12565
12971
|
}
|
|
12566
|
-
}, $[
|
|
12972
|
+
}, $[93] = declaredFunctions, $[94] = delta, $[95] = functionLibrary, $[96] = hasResult, $[97] = hiddenDiffFields, $[98] = lintFindings, $[99] = mutate, $[100] = onEditQuery, $[101] = onMutationsApplied, $[102] = onRevealRange, $[103] = removeFunction, $[104] = request, $[105] = resolved.client, $[106] = resolved.dataset, $[107] = resolved.isValidApiVersion, $[108] = result, $[109] = saveFunction, $[110] = tab.query, $[111] = t33) : t33 = $[111];
|
|
12567
12973
|
let renderTabDrawer = t33, sidebarBadges = useSidebarBadges(), lintCount = lintFindings.length, lintTone = lintFindings.some(_temp11) ? "critical" : "caution", functionCount = declaredFunctions.length, t34, t35;
|
|
12568
|
-
$[
|
|
12974
|
+
$[112] !== functionCount || $[113] !== lintCount || $[114] !== lintTone || $[115] !== sidebarBadges ? (t34 = () => {
|
|
12569
12975
|
sidebarBadges.set("lint", lintCount > 0 ? {
|
|
12570
12976
|
count: lintCount,
|
|
12571
12977
|
tone: lintTone
|
|
@@ -12578,29 +12984,29 @@ function ResponsePanel(props) {
|
|
|
12578
12984
|
lintCount,
|
|
12579
12985
|
lintTone,
|
|
12580
12986
|
sidebarBadges
|
|
12581
|
-
], $[
|
|
12987
|
+
], $[112] = functionCount, $[113] = lintCount, $[114] = lintTone, $[115] = sidebarBadges, $[116] = t34, $[117] = t35) : (t34 = $[116], t35 = $[117]), useEffect(t34, t35);
|
|
12582
12988
|
let t36, t37;
|
|
12583
|
-
$[
|
|
12989
|
+
$[118] === sidebarBadges ? (t36 = $[119], t37 = $[120]) : (t36 = () => () => {
|
|
12584
12990
|
sidebarBadges.set("lint", void 0), sidebarBadges.set("functions", void 0);
|
|
12585
|
-
}, t37 = [sidebarBadges], $[
|
|
12991
|
+
}, t37 = [sidebarBadges], $[118] = sidebarBadges, $[119] = t36, $[120] = t37), useEffect(t36, t37);
|
|
12586
12992
|
let t38;
|
|
12587
|
-
$[
|
|
12993
|
+
$[121] !== renderTabDrawer || $[122] !== tabDrawer ? (t38 = tabDrawer && /* @__PURE__ */ jsx(TabDrawerPortal, { children: renderTabDrawer(tabDrawer) }), $[121] = renderTabDrawer, $[122] = tabDrawer, $[123] = t38) : t38 = $[123];
|
|
12588
12994
|
let t39 = hasResult ? getJsonUrl : void 0, t40;
|
|
12589
|
-
$[
|
|
12995
|
+
$[124] === t ? t40 = $[125] : (t40 = t("vista.result.export-json"), $[124] = t, $[125] = t40);
|
|
12590
12996
|
let t41;
|
|
12591
|
-
$[
|
|
12997
|
+
$[126] !== t39 || $[127] !== t40 ? (t41 = /* @__PURE__ */ jsx(DownloadButton, {
|
|
12592
12998
|
download: "query-result.json",
|
|
12593
12999
|
getBlobUrl: t39,
|
|
12594
13000
|
icon: JsonIcon,
|
|
12595
13001
|
label: t40,
|
|
12596
13002
|
testId: "vista-export-json"
|
|
12597
|
-
}), $[
|
|
13003
|
+
}), $[126] = t39, $[127] = t40, $[128] = t41) : t41 = $[128];
|
|
12598
13004
|
let t42 = canExportCsv ? getCsvUrl : void 0, t43;
|
|
12599
|
-
$[
|
|
13005
|
+
$[129] === t ? t43 = $[130] : (t43 = t("vista.result.export-csv"), $[129] = t, $[130] = t43);
|
|
12600
13006
|
let t44;
|
|
12601
|
-
$[
|
|
13007
|
+
$[131] !== canExportCsv || $[132] !== hasResult || $[133] !== t ? (t44 = hasResult && !canExportCsv ? t("result.save-result-as-csv.not-csv-encodable") : void 0, $[131] = canExportCsv, $[132] = hasResult, $[133] = t, $[134] = t44) : t44 = $[134];
|
|
12602
13008
|
let t45;
|
|
12603
|
-
$[
|
|
13009
|
+
$[135] !== reportCsvUnavailable || $[136] !== t42 || $[137] !== t43 || $[138] !== t44 ? (t45 = /* @__PURE__ */ jsx(DownloadButton, {
|
|
12604
13010
|
download: "query-result.csv",
|
|
12605
13011
|
getBlobUrl: t42,
|
|
12606
13012
|
icon: DocumentSheetIcon,
|
|
@@ -12608,44 +13014,44 @@ function ResponsePanel(props) {
|
|
|
12608
13014
|
onUnavailable: reportCsvUnavailable,
|
|
12609
13015
|
testId: "vista-export-csv",
|
|
12610
13016
|
tooltip: t44
|
|
12611
|
-
}), $[
|
|
13017
|
+
}), $[135] = reportCsvUnavailable, $[136] = t42, $[137] = t43, $[138] = t44, $[139] = t45) : t45 = $[139];
|
|
12612
13018
|
let t46;
|
|
12613
|
-
$[
|
|
13019
|
+
$[140] !== hasResult || $[141] !== result || $[142] !== resultIsCurrent || $[143] !== tab ? (t46 = /* @__PURE__ */ jsx(ResultActionsMenu, {
|
|
12614
13020
|
hasResult,
|
|
12615
13021
|
result,
|
|
12616
13022
|
resultIsCurrent,
|
|
12617
13023
|
tab
|
|
12618
|
-
}), $[
|
|
13024
|
+
}), $[140] = hasResult, $[141] = result, $[142] = resultIsCurrent, $[143] = tab, $[144] = t46) : t46 = $[144];
|
|
12619
13025
|
let t47;
|
|
12620
|
-
$[
|
|
13026
|
+
$[145] !== t41 || $[146] !== t45 || $[147] !== t46 ? (t47 = /* @__PURE__ */ jsxs(ActionRail, {
|
|
12621
13027
|
testId: "vista-result-actions",
|
|
12622
13028
|
children: [
|
|
12623
13029
|
t41,
|
|
12624
13030
|
t45,
|
|
12625
13031
|
t46
|
|
12626
13032
|
]
|
|
12627
|
-
}), $[
|
|
13033
|
+
}), $[145] = t41, $[146] = t45, $[147] = t46, $[148] = t47) : t47 = $[148];
|
|
12628
13034
|
let t48 = status === "failed" ? "critical" : "default", t49;
|
|
12629
|
-
$[
|
|
13035
|
+
$[149] === t ? t49 = $[150] : (t49 = t("result.label"), $[149] = t, $[150] = t49);
|
|
12630
13036
|
let t50;
|
|
12631
|
-
$[
|
|
13037
|
+
$[151] === t49 ? t50 = $[152] : (t50 = /* @__PURE__ */ jsx(Label, {
|
|
12632
13038
|
muted: !0,
|
|
12633
13039
|
size: 1,
|
|
12634
13040
|
children: t49
|
|
12635
|
-
}), $[
|
|
13041
|
+
}), $[151] = t49, $[152] = t50);
|
|
12636
13042
|
let t51;
|
|
12637
|
-
$[
|
|
13043
|
+
$[153] !== isLive || $[154] !== t ? (t51 = isLive && /* @__PURE__ */ jsx(Badge, {
|
|
12638
13044
|
fontSize: 0,
|
|
12639
13045
|
tone: "positive",
|
|
12640
13046
|
children: t("vista.live.active")
|
|
12641
|
-
}), $[
|
|
13047
|
+
}), $[153] = isLive, $[154] = t, $[155] = t51) : t51 = $[155];
|
|
12642
13048
|
let t52;
|
|
12643
|
-
$[
|
|
13049
|
+
$[156] === Symbol.for("react.memo_cache_sentinel") ? (t52 = /* @__PURE__ */ jsx(Box, {
|
|
12644
13050
|
flexBasis: "0%",
|
|
12645
13051
|
flexGrow: 1
|
|
12646
|
-
}), $[
|
|
13052
|
+
}), $[156] = t52) : t52 = $[156];
|
|
12647
13053
|
let t53;
|
|
12648
|
-
$[
|
|
13054
|
+
$[157] !== copyResult || $[158] !== hasResult || $[159] !== resultView || $[160] !== setResultView || $[161] !== t ? (t53 = hasResult && /* @__PURE__ */ jsxs(Flex, {
|
|
12649
13055
|
alignItems: "center",
|
|
12650
13056
|
className: "cTWfhW_labelActions",
|
|
12651
13057
|
gap: 1,
|
|
@@ -12699,9 +13105,9 @@ function ResponsePanel(props) {
|
|
|
12699
13105
|
padding: 2
|
|
12700
13106
|
})
|
|
12701
13107
|
})]
|
|
12702
|
-
}), $[
|
|
13108
|
+
}), $[157] = copyResult, $[158] = hasResult, $[159] = resultView, $[160] = setResultView, $[161] = t, $[162] = t53) : t53 = $[162];
|
|
12703
13109
|
let t54;
|
|
12704
|
-
$[
|
|
13110
|
+
$[163] !== t50 || $[164] !== t51 || $[165] !== t53 ? (t54 = /* @__PURE__ */ jsx(Box, {
|
|
12705
13111
|
className: "cTWfhW_resultLabel cTWfhW_editorLabel",
|
|
12706
13112
|
children: /* @__PURE__ */ jsxs(Flex, {
|
|
12707
13113
|
alignItems: "center",
|
|
@@ -12713,9 +13119,9 @@ function ResponsePanel(props) {
|
|
|
12713
13119
|
t53
|
|
12714
13120
|
]
|
|
12715
13121
|
})
|
|
12716
|
-
}), $[
|
|
13122
|
+
}), $[163] = t50, $[164] = t51, $[165] = t53, $[166] = t54) : t54 = $[166];
|
|
12717
13123
|
let t55;
|
|
12718
|
-
$[
|
|
13124
|
+
$[167] !== copyValue || $[168] !== error || $[169] !== failedConfig || $[170] !== hasResult || $[171] !== resolved.apiVersion || $[172] !== resolved.perspective || $[173] !== resolved.variant || $[174] !== result || $[175] !== resultDataset || $[176] !== resultView || $[177] !== status || $[178] !== t ? (t55 = hasResult && resultView === "json" ? /* @__PURE__ */ jsx(ResultJson, {
|
|
12719
13125
|
id: "vista-result-content",
|
|
12720
13126
|
value: result
|
|
12721
13127
|
}) : hasResult && resultView === "graph" ? /* @__PURE__ */ jsx(ResultGraph, {
|
|
@@ -12748,25 +13154,25 @@ function ResponsePanel(props) {
|
|
|
12748
13154
|
children: t("vista.result.empty")
|
|
12749
13155
|
})
|
|
12750
13156
|
]
|
|
12751
|
-
}), $[
|
|
13157
|
+
}), $[167] = copyValue, $[168] = error, $[169] = failedConfig, $[170] = hasResult, $[171] = resolved.apiVersion, $[172] = resolved.perspective, $[173] = resolved.variant, $[174] = result, $[175] = resultDataset, $[176] = resultView, $[177] = status, $[178] = t, $[179] = t55) : t55 = $[179];
|
|
12752
13158
|
let t56;
|
|
12753
|
-
$[
|
|
13159
|
+
$[180] !== t48 || $[181] !== t54 || $[182] !== t55 ? (t56 = /* @__PURE__ */ jsxs(Card, {
|
|
12754
13160
|
className: "cTWfhW_resultContainer",
|
|
12755
13161
|
"data-testid": "vista-result",
|
|
12756
13162
|
tone: t48,
|
|
12757
13163
|
children: [t54, t55]
|
|
12758
|
-
}), $[
|
|
13164
|
+
}), $[180] = t48, $[181] = t54, $[182] = t55, $[183] = t56) : t56 = $[183];
|
|
12759
13165
|
let t57;
|
|
12760
|
-
$[
|
|
13166
|
+
$[184] !== panelTabs || $[185] !== t47 || $[186] !== t56 ? (t57 = /* @__PURE__ */ jsx(SplitWithBottomPanel, {
|
|
12761
13167
|
defaultBottomSize: DEFAULT_BOTTOM_PANEL_SIZE,
|
|
12762
13168
|
footer: t47,
|
|
12763
13169
|
id: "vista-response",
|
|
12764
13170
|
tabs: panelTabs,
|
|
12765
13171
|
testId: "vista-response-panel",
|
|
12766
13172
|
children: t56
|
|
12767
|
-
}), $[
|
|
13173
|
+
}), $[184] = panelTabs, $[185] = t47, $[186] = t56, $[187] = t57) : t57 = $[187];
|
|
12768
13174
|
let t58;
|
|
12769
|
-
return $[
|
|
13175
|
+
return $[188] !== t38 || $[189] !== t57 ? (t58 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t38, t57] }), $[188] = t38, $[189] = t57, $[190] = t58) : t58 = $[190], t58;
|
|
12770
13176
|
}
|
|
12771
13177
|
function _temp11(finding) {
|
|
12772
13178
|
return finding.severity === "error";
|
|
@@ -12786,7 +13192,7 @@ function _temp7(snapshot_5) {
|
|
|
12786
13192
|
function _temp6(snapshot_4) {
|
|
12787
13193
|
return snapshot_4.context.meta?.url ?? snapshot_4.context.url;
|
|
12788
13194
|
}
|
|
12789
|
-
function _temp5$
|
|
13195
|
+
function _temp5$2(snapshot_3) {
|
|
12790
13196
|
return snapshot_3.context.meta;
|
|
12791
13197
|
}
|
|
12792
13198
|
function _temp4$2(snapshot_2) {
|
|
@@ -12963,7 +13369,7 @@ function QueryTabBar() {
|
|
|
12963
13369
|
let stopRenaming = t1, t2;
|
|
12964
13370
|
$[2] === actorRef ? t2 = $[3] : (t2 = (ordered) => actorRef.send({
|
|
12965
13371
|
type: "tab.reorder",
|
|
12966
|
-
ids: ordered.map(_temp5)
|
|
13372
|
+
ids: ordered.map(_temp5$1)
|
|
12967
13373
|
}), $[2] = actorRef, $[3] = t2);
|
|
12968
13374
|
let reorder = t2, t3;
|
|
12969
13375
|
$[4] !== activeTabId || $[5] !== actorRef || $[6] !== reorder || $[7] !== tabs ? (t3 = (event) => {
|
|
@@ -13066,7 +13472,7 @@ function QueryTabBar() {
|
|
|
13066
13472
|
children: [t6, t9]
|
|
13067
13473
|
}), $[29] = t6, $[30] = t9, $[31] = t10) : t10 = $[31], t10;
|
|
13068
13474
|
}
|
|
13069
|
-
function _temp5(tab) {
|
|
13475
|
+
function _temp5$1(tab) {
|
|
13070
13476
|
return tab.id;
|
|
13071
13477
|
}
|
|
13072
13478
|
function _temp4$1(snapshot_0) {
|
|
@@ -13098,7 +13504,7 @@ const DEFAULT_REQUEST_SHARE = {
|
|
|
13098
13504
|
* paste-a-query-URL handler.
|
|
13099
13505
|
*/
|
|
13100
13506
|
function QueryTab(t0) {
|
|
13101
|
-
let $ = c(
|
|
13507
|
+
let $ = c(227), { tab, rootElement } = t0, { t } = useTranslation(visionLocaleNamespace), toast = useToast(), copyToClipboard = useCopyToClipboard(), actorRef = useVistaActor(), { layout } = useVistaExperience(), datasets = useVistaSelector(selectDatasets), t1;
|
|
13102
13508
|
$[0] === tab.id ? t1 = $[1] : (t1 = (snapshot) => snapshot.context.runners[tab.id], $[0] = tab.id, $[1] = t1);
|
|
13103
13509
|
let runnerRef = useVistaSelector(t1), t2;
|
|
13104
13510
|
$[2] === tab.id ? t2 = $[3] : (t2 = (snapshot_0) => snapshot_0.context.loadRevisions[tab.id] || 0, $[2] = tab.id, $[3] = t2);
|
|
@@ -13135,34 +13541,59 @@ function QueryTab(t0) {
|
|
|
13135
13541
|
setParams.cancel(), setParamsNow(rawParams_0);
|
|
13136
13542
|
}, $[25] = setParams, $[26] = setParamsNow, $[27] = t14) : t14 = $[27];
|
|
13137
13543
|
let replaceParams = t14, t15;
|
|
13138
|
-
$[28] !== actorRef || $[29] !==
|
|
13544
|
+
$[28] !== actorRef || $[29] !== setParams || $[30] !== setParamsNow || $[31] !== t || $[32] !== tab.id ? (t15 = async (query_0) => {
|
|
13545
|
+
if (!paramsEditorRef.current) return;
|
|
13546
|
+
let referenced;
|
|
13547
|
+
try {
|
|
13548
|
+
referenced = await extractQueryParams(query_0);
|
|
13549
|
+
} catch {
|
|
13550
|
+
return;
|
|
13551
|
+
}
|
|
13552
|
+
if (referenced.length === 0 || !paramsEditorRef.current) return;
|
|
13139
13553
|
setParams.flush();
|
|
13140
|
-
let latest = actorRef.getSnapshot().context.tabs.find((it) => it.id === tab.id)
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13554
|
+
let latest = actorRef.getSnapshot().context.tabs.find((it) => it.id === tab.id);
|
|
13555
|
+
if (!latest || latest.query !== query_0) return;
|
|
13556
|
+
let missing = missingParamNames(referenced.map(_temp2$1), latest.rawParams, t);
|
|
13557
|
+
if (!missing || missing.length === 0) return;
|
|
13558
|
+
let nextRawParams = addMissingParams(latest.rawParams, missing);
|
|
13559
|
+
nextRawParams !== latest.rawParams && (paramsEditorRef.current.resetEditorContent(nextRawParams), setParamsNow(nextRawParams));
|
|
13560
|
+
}, $[28] = actorRef, $[29] = setParams, $[30] = setParamsNow, $[31] = t, $[32] = tab.id, $[33] = t15) : t15 = $[33];
|
|
13561
|
+
let prefillParams = useEffectEvent(t15), t16;
|
|
13562
|
+
$[34] !== prefillParams || $[35] !== tab.query ? (t16 = () => {
|
|
13563
|
+
let timeoutId = setTimeout(() => void prefillParams(tab.query), 333);
|
|
13564
|
+
return () => clearTimeout(timeoutId);
|
|
13565
|
+
}, $[34] = prefillParams, $[35] = tab.query, $[36] = t16) : t16 = $[36];
|
|
13566
|
+
let t17;
|
|
13567
|
+
$[37] === tab.query ? t17 = $[38] : (t17 = [tab.query], $[37] = tab.query, $[38] = t17), useEffect(t16, t17);
|
|
13568
|
+
let t18;
|
|
13569
|
+
$[39] !== actorRef || $[40] !== buildRequest || $[41] !== setParams || $[42] !== tab ? (t18 = () => {
|
|
13570
|
+
setParams.flush();
|
|
13571
|
+
let latest_0 = actorRef.getSnapshot().context.tabs.find((it_0) => it_0.id === tab.id) ?? tab;
|
|
13572
|
+
return buildRequest(latest_0.query, latest_0.rawParams);
|
|
13573
|
+
}, $[39] = actorRef, $[40] = buildRequest, $[41] = setParams, $[42] = tab, $[43] = t18) : t18 = $[43];
|
|
13574
|
+
let buildCurrentRequest = t18, t19;
|
|
13575
|
+
$[44] !== buildCurrentRequest || $[45] !== layout || $[46] !== runnerRef ? (t19 = (reason) => {
|
|
13145
13576
|
let current = buildCurrentRequest();
|
|
13146
13577
|
return current ? (runnerRef.send({
|
|
13147
13578
|
type: "fetch",
|
|
13148
13579
|
request: current,
|
|
13149
13580
|
reason
|
|
13150
13581
|
}), layout === "mobile" && setMobilePane("response"), !0) : !1;
|
|
13151
|
-
}, $[
|
|
13152
|
-
let run =
|
|
13153
|
-
$[
|
|
13154
|
-
let cancel =
|
|
13155
|
-
$[
|
|
13582
|
+
}, $[44] = buildCurrentRequest, $[45] = layout, $[46] = runnerRef, $[47] = t19) : t19 = $[47];
|
|
13583
|
+
let run = t19, t20;
|
|
13584
|
+
$[48] === runnerRef ? t20 = $[49] : (t20 = () => runnerRef.send({ type: "cancel" }), $[48] = runnerRef, $[49] = t20);
|
|
13585
|
+
let cancel = t20, t21;
|
|
13586
|
+
$[50] === run ? t21 = $[51] : (t21 = () => {
|
|
13156
13587
|
run({ type: "mutation" });
|
|
13157
|
-
}, $[
|
|
13158
|
-
let refetchAfterMutations =
|
|
13159
|
-
$[
|
|
13588
|
+
}, $[50] = run, $[51] = t21);
|
|
13589
|
+
let refetchAfterMutations = t21, t22;
|
|
13590
|
+
$[52] !== actorRef || $[53] !== tab.id ? (t22 = (options) => actorRef.send({
|
|
13160
13591
|
type: "tab.setOptions",
|
|
13161
13592
|
id: tab.id,
|
|
13162
13593
|
options
|
|
13163
|
-
}), $[
|
|
13164
|
-
let setOptions =
|
|
13165
|
-
$[
|
|
13594
|
+
}), $[52] = actorRef, $[53] = tab.id, $[54] = t22) : t22 = $[54];
|
|
13595
|
+
let setOptions = t22, t23;
|
|
13596
|
+
$[55] !== actorRef || $[56] !== run || $[57] !== tab.autoRefetch || $[58] !== tab.id ? (t23 = () => {
|
|
13166
13597
|
tab.autoRefetch ? actorRef.send({
|
|
13167
13598
|
type: "tab.setAutoRefetch",
|
|
13168
13599
|
id: tab.id,
|
|
@@ -13172,28 +13603,28 @@ function QueryTab(t0) {
|
|
|
13172
13603
|
id: tab.id,
|
|
13173
13604
|
autoRefetch: !0
|
|
13174
13605
|
});
|
|
13175
|
-
}, $[
|
|
13176
|
-
let toggleAutoRefetch =
|
|
13177
|
-
$[
|
|
13178
|
-
let editor = queryEditorRef.current, width = editor?.getVisibleColumns(countLines(
|
|
13606
|
+
}, $[55] = actorRef, $[56] = run, $[57] = tab.autoRefetch, $[58] = tab.id, $[59] = t23) : t23 = $[59];
|
|
13607
|
+
let toggleAutoRefetch = t23, t24;
|
|
13608
|
+
$[60] === Symbol.for("react.memo_cache_sentinel") ? (t24 = async (query_1) => {
|
|
13609
|
+
let editor = queryEditorRef.current, width = editor?.getVisibleColumns(countLines(query_1)), formatted = await formatGroq(query_1, width);
|
|
13179
13610
|
for (let pass = 0; pass < 2 && width !== void 0; pass++) {
|
|
13180
13611
|
let nextWidth = editor?.getVisibleColumns(countLines(formatted));
|
|
13181
13612
|
if (nextWidth === void 0 || nextWidth >= width) break;
|
|
13182
|
-
width = nextWidth, formatted = await formatGroq(
|
|
13613
|
+
width = nextWidth, formatted = await formatGroq(query_1, width);
|
|
13183
13614
|
}
|
|
13184
13615
|
return formatted;
|
|
13185
|
-
}, $[
|
|
13186
|
-
let formatForEditor =
|
|
13187
|
-
$[
|
|
13188
|
-
let { query:
|
|
13189
|
-
actorRef.getSnapshot().context.tabs.find((
|
|
13190
|
-
}, $[
|
|
13191
|
-
let formatQuery =
|
|
13192
|
-
$[
|
|
13616
|
+
}, $[60] = t24) : t24 = $[60];
|
|
13617
|
+
let formatForEditor = t24, t25;
|
|
13618
|
+
$[61] !== actorRef || $[62] !== setQuery || $[63] !== tab ? (t25 = async () => {
|
|
13619
|
+
let { query: query_2 } = tab, formatted_0 = await formatForEditor(query_2);
|
|
13620
|
+
actorRef.getSnapshot().context.tabs.find((it_1) => it_1.id === tab.id)?.query === query_2 && formatted_0 !== query_2 && (queryEditorRef.current?.resetEditorContent(formatted_0), setQuery(formatted_0));
|
|
13621
|
+
}, $[61] = actorRef, $[62] = setQuery, $[63] = tab, $[64] = t25) : t25 = $[64];
|
|
13622
|
+
let formatQuery = t25, t26;
|
|
13623
|
+
$[65] !== formatQuery || $[66] !== t || $[67] !== toast ? (t26 = async () => {
|
|
13193
13624
|
try {
|
|
13194
13625
|
await formatQuery();
|
|
13195
|
-
} catch (
|
|
13196
|
-
let error =
|
|
13626
|
+
} catch (t27) {
|
|
13627
|
+
let error = t27;
|
|
13197
13628
|
toast.push({
|
|
13198
13629
|
closable: !0,
|
|
13199
13630
|
description: error instanceof GroqSyntaxError ? error.message : void 0,
|
|
@@ -13201,33 +13632,33 @@ function QueryTab(t0) {
|
|
|
13201
13632
|
title: t("vista.query.prettify.failed")
|
|
13202
13633
|
});
|
|
13203
13634
|
}
|
|
13204
|
-
}, $[
|
|
13205
|
-
let prettify =
|
|
13206
|
-
$[
|
|
13207
|
-
let copyQuery =
|
|
13208
|
-
$[
|
|
13635
|
+
}, $[65] = formatQuery, $[66] = t, $[67] = toast, $[68] = t26) : t26 = $[68];
|
|
13636
|
+
let prettify = t26, t27;
|
|
13637
|
+
$[69] !== copyToClipboard || $[70] !== t || $[71] !== tab.query ? (t27 = () => void copyToClipboard(tab.query, t("vista.query.copied")), $[69] = copyToClipboard, $[70] = t, $[71] = tab.query, $[72] = t27) : t27 = $[72];
|
|
13638
|
+
let copyQuery = t27, pendingRevealRef = useRef(null), drawerOpen = useVistaSelector(_temp3), t28;
|
|
13639
|
+
$[73] !== actorRef || $[74] !== drawerOpen || $[75] !== layout || $[76] !== mobilePane ? (t28 = (range) => {
|
|
13209
13640
|
layout === "mobile" && (mobilePane !== "request" || drawerOpen) ? (pendingRevealRef.current = range, setMobilePane("request"), drawerOpen && actorRef.send({ type: "drawer.close" })) : queryEditorRef.current?.selectRange(range.from, range.to);
|
|
13210
|
-
}, $[
|
|
13211
|
-
let revealRange =
|
|
13212
|
-
$[
|
|
13213
|
-
let editQuery =
|
|
13214
|
-
$[
|
|
13641
|
+
}, $[73] = actorRef, $[74] = drawerOpen, $[75] = layout, $[76] = mobilePane, $[77] = t28) : t28 = $[77];
|
|
13642
|
+
let revealRange = t28, t29;
|
|
13643
|
+
$[78] === Symbol.for("react.memo_cache_sentinel") ? (t29 = (edit) => queryEditorRef.current?.applyChanges([edit]), $[78] = t29) : t29 = $[78];
|
|
13644
|
+
let editQuery = t29, t30, t31;
|
|
13645
|
+
$[79] !== drawerOpen || $[80] !== mobilePane ? (t30 = () => {
|
|
13215
13646
|
let pending = pendingRevealRef.current;
|
|
13216
13647
|
mobilePane === "request" && !drawerOpen && pending && (pendingRevealRef.current = null, queryEditorRef.current?.selectRange(pending.from, pending.to));
|
|
13217
|
-
},
|
|
13218
|
-
let
|
|
13219
|
-
$[
|
|
13648
|
+
}, t31 = [drawerOpen, mobilePane], $[79] = drawerOpen, $[80] = mobilePane, $[81] = t30, $[82] = t31) : (t30 = $[81], t31 = $[82]), useEffect(t30, t31);
|
|
13649
|
+
let t32;
|
|
13650
|
+
$[83] !== runnerRef || $[84] !== setParams || $[85] !== tab.query || $[86] !== tab.rawParams ? (t32 = () => {
|
|
13220
13651
|
setParams.cancel(), queryEditorRef.current?.resetEditorContent(tab.query), paramsEditorRef.current?.resetEditorContent(tab.rawParams), runnerRef.send({ type: "clear" });
|
|
13221
|
-
}, $[
|
|
13222
|
-
let
|
|
13223
|
-
$[
|
|
13652
|
+
}, $[83] = runnerRef, $[84] = setParams, $[85] = tab.query, $[86] = tab.rawParams, $[87] = t32) : t32 = $[87], useOnValueChange(loadRevision, t32);
|
|
13653
|
+
let t33 = tab.autoRefetch && resolved.supportsSyncTags, t34;
|
|
13654
|
+
$[88] !== resolved.dataset || $[89] !== runnerRef || $[90] !== t33 || $[91] !== tab.id ? (t34 = {
|
|
13224
13655
|
runnerRef,
|
|
13225
13656
|
dataset: resolved.dataset,
|
|
13226
|
-
enabled:
|
|
13657
|
+
enabled: t33,
|
|
13227
13658
|
tabId: tab.id
|
|
13228
|
-
}, $[
|
|
13229
|
-
let
|
|
13230
|
-
$[
|
|
13659
|
+
}, $[88] = resolved.dataset, $[89] = runnerRef, $[90] = t33, $[91] = tab.id, $[92] = t34) : t34 = $[92], useLiveSubscription(t34);
|
|
13660
|
+
let t35;
|
|
13661
|
+
$[93] !== buildCurrentRequest || $[94] !== buildRequest || $[95] !== runnerRef || $[96] !== tab.autoRefetch ? (t35 = () => {
|
|
13231
13662
|
if (!tab.autoRefetch) return;
|
|
13232
13663
|
let lastRequest = runnerRef.getSnapshot().context.request;
|
|
13233
13664
|
if (!lastRequest) {
|
|
@@ -13245,79 +13676,86 @@ function QueryTab(t0) {
|
|
|
13245
13676
|
request: current_1,
|
|
13246
13677
|
reason: { type: "resume" }
|
|
13247
13678
|
});
|
|
13248
|
-
}, $[
|
|
13249
|
-
let resumeAutoRefetch = useEffectEvent(
|
|
13250
|
-
$[
|
|
13251
|
-
let
|
|
13252
|
-
$[
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
|
|
13262
|
-
|
|
13679
|
+
}, $[93] = buildCurrentRequest, $[94] = buildRequest, $[95] = runnerRef, $[96] = tab.autoRefetch, $[97] = t35) : t35 = $[97];
|
|
13680
|
+
let resumeAutoRefetch = useEffectEvent(t35), t36;
|
|
13681
|
+
$[98] === tab.id ? t36 = $[99] : (t36 = (snapshot_3) => snapshot_3.context.fetchOnOpen[tab.id], $[98] = tab.id, $[99] = t36);
|
|
13682
|
+
let fetchOnOpen = useVistaSelector(t36), t37;
|
|
13683
|
+
$[100] !== actorRef || $[101] !== formatQuery || $[102] !== run || $[103] !== tab.id ? (t37 = async () => {
|
|
13684
|
+
let source = actorRef.getSnapshot().context.fetchOnOpen[tab.id];
|
|
13685
|
+
if (source) {
|
|
13686
|
+
if (actorRef.send({
|
|
13687
|
+
type: "tab.fetchedOnOpen",
|
|
13688
|
+
id: tab.id
|
|
13689
|
+
}), source === "generated") {
|
|
13690
|
+
let previousColumns, settledFrames = 0;
|
|
13691
|
+
for (let frame = 0; frame < 30; frame++) {
|
|
13692
|
+
let columns = queryEditorRef.current?.getVisibleColumns();
|
|
13693
|
+
if (settledFrames = columns !== void 0 && columns === previousColumns ? settledFrames + 1 : 0, settledFrames >= 3) break;
|
|
13694
|
+
previousColumns = columns, await new Promise(_temp4);
|
|
13695
|
+
}
|
|
13696
|
+
await formatQuery().catch(_temp5);
|
|
13697
|
+
}
|
|
13698
|
+
run({ type: source });
|
|
13263
13699
|
}
|
|
13264
|
-
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
$[94] === resumeAutoRefetch ? t35 = $[95] : (t35 = () => {
|
|
13700
|
+
}, $[100] = actorRef, $[101] = formatQuery, $[102] = run, $[103] = tab.id, $[104] = t37) : t37 = $[104];
|
|
13701
|
+
let fetchOpenedQuery = useEffectEvent(t37), t38;
|
|
13702
|
+
$[105] === resumeAutoRefetch ? t38 = $[106] : (t38 = () => {
|
|
13268
13703
|
resumeAutoRefetch();
|
|
13269
|
-
}, $[
|
|
13270
|
-
let t36;
|
|
13271
|
-
$[96] === Symbol.for("react.memo_cache_sentinel") ? (t36 = [], $[96] = t36) : t36 = $[96], useEffect(t35, t36);
|
|
13272
|
-
let t37;
|
|
13273
|
-
$[97] !== fetchGeneratedQuery || $[98] !== generatedQueryPending ? (t37 = () => {
|
|
13274
|
-
generatedQueryPending && fetchGeneratedQuery();
|
|
13275
|
-
}, $[97] = fetchGeneratedQuery, $[98] = generatedQueryPending, $[99] = t37) : t37 = $[99];
|
|
13276
|
-
let t38;
|
|
13277
|
-
$[100] === generatedQueryPending ? t38 = $[101] : (t38 = [generatedQueryPending], $[100] = generatedQueryPending, $[101] = t38), useEffect(t37, t38);
|
|
13704
|
+
}, $[105] = resumeAutoRefetch, $[106] = t38);
|
|
13278
13705
|
let t39;
|
|
13279
|
-
$[
|
|
13706
|
+
$[107] === Symbol.for("react.memo_cache_sentinel") ? (t39 = [], $[107] = t39) : t39 = $[107], useEffect(t38, t39);
|
|
13707
|
+
let t40;
|
|
13708
|
+
$[108] !== fetchOnOpen || $[109] !== fetchOpenedQuery ? (t40 = () => {
|
|
13709
|
+
fetchOnOpen && fetchOpenedQuery();
|
|
13710
|
+
}, $[108] = fetchOnOpen, $[109] = fetchOpenedQuery, $[110] = t40) : t40 = $[110];
|
|
13711
|
+
let t41;
|
|
13712
|
+
$[111] === fetchOnOpen ? t41 = $[112] : (t41 = [fetchOnOpen], $[111] = fetchOnOpen, $[112] = t41), useEffect(t40, t41);
|
|
13713
|
+
let t42;
|
|
13714
|
+
$[113] !== resolved.apiVersion || $[114] !== resolved.dataset || $[115] !== resolved.perspective || $[116] !== resolved.useCdn || $[117] !== resolved.variant || $[118] !== tab.options.includeSourceMap ? (t42 = JSON.stringify([
|
|
13280
13715
|
resolved.apiVersion,
|
|
13281
13716
|
resolved.dataset,
|
|
13282
13717
|
resolved.perspective,
|
|
13283
13718
|
resolved.variant,
|
|
13284
13719
|
resolved.useCdn,
|
|
13285
13720
|
tab.options.includeSourceMap
|
|
13286
|
-
]), $[
|
|
13287
|
-
let refetchKey = `${loadRevision}|${
|
|
13288
|
-
$[
|
|
13721
|
+
]), $[113] = resolved.apiVersion, $[114] = resolved.dataset, $[115] = resolved.perspective, $[116] = resolved.useCdn, $[117] = resolved.variant, $[118] = tab.options.includeSourceMap, $[119] = t42) : t42 = $[119];
|
|
13722
|
+
let refetchKey = `${loadRevision}|${t42}`, t43;
|
|
13723
|
+
$[120] !== buildCurrentRequest || $[121] !== fetchOnOpen || $[122] !== runnerRef || $[123] !== tab.autoRefetch ? (t43 = (key, previous) => {
|
|
13289
13724
|
if (!tab.autoRefetch) return;
|
|
13290
|
-
let loaded = key.split("|", 1)[0] !== previous.split("|", 1)[0]
|
|
13725
|
+
let loaded = key.split("|", 1)[0] !== previous.split("|", 1)[0];
|
|
13726
|
+
if (loaded && fetchOnOpen) return;
|
|
13727
|
+
let current_2 = buildCurrentRequest();
|
|
13291
13728
|
current_2 && runnerRef.send({
|
|
13292
13729
|
type: "fetch",
|
|
13293
13730
|
request: current_2,
|
|
13294
13731
|
reason: { type: loaded ? "load" : "options" }
|
|
13295
13732
|
});
|
|
13296
|
-
}, $[
|
|
13297
|
-
let
|
|
13298
|
-
$[
|
|
13299
|
-
let
|
|
13300
|
-
$[
|
|
13301
|
-
|
|
13733
|
+
}, $[120] = buildCurrentRequest, $[121] = fetchOnOpen, $[122] = runnerRef, $[123] = tab.autoRefetch, $[124] = t43) : t43 = $[124], useOnValueChange(refetchKey, t43);
|
|
13734
|
+
let t44;
|
|
13735
|
+
$[125] === setOptions ? t44 = $[126] : (t44 = (perspective) => setOptions({ perspective }), $[125] = setOptions, $[126] = t44), useFollowNavbarPerspective(resolved.tabPerspective, t44);
|
|
13736
|
+
let t45;
|
|
13737
|
+
$[127] !== copyQuery || $[128] !== prettify || $[129] !== run ? (t45 = (shortcut) => {
|
|
13738
|
+
bb317: switch (shortcut) {
|
|
13302
13739
|
case "fetch":
|
|
13303
13740
|
run({ type: "shortcut" });
|
|
13304
|
-
break
|
|
13741
|
+
break bb317;
|
|
13305
13742
|
case "prettify":
|
|
13306
13743
|
prettify();
|
|
13307
|
-
break
|
|
13744
|
+
break bb317;
|
|
13308
13745
|
case "copy-query":
|
|
13309
13746
|
copyQuery();
|
|
13310
|
-
break
|
|
13747
|
+
break bb317;
|
|
13311
13748
|
default: throw Error(`Unhandled shortcut: ${String(shortcut)}`);
|
|
13312
13749
|
}
|
|
13313
|
-
}, $[
|
|
13314
|
-
let
|
|
13315
|
-
$[
|
|
13750
|
+
}, $[127] = copyQuery, $[128] = prettify, $[129] = run, $[130] = t45) : t45 = $[130];
|
|
13751
|
+
let t46;
|
|
13752
|
+
$[131] !== actorRef || $[132] !== datasets || $[133] !== isVariantsEnabled || $[134] !== resolved.variant || $[135] !== t || $[136] !== tab.id || $[137] !== toast ? (t46 = (text) => {
|
|
13316
13753
|
let parsed = parseQueryUrl(text, datasets);
|
|
13317
13754
|
return parsed ? (actorRef.send({
|
|
13318
13755
|
type: "tab.load",
|
|
13319
13756
|
id: tab.id,
|
|
13320
|
-
tab: parsedQueryToTabInit(parsed)
|
|
13757
|
+
tab: parsedQueryToTabInit(parsed),
|
|
13758
|
+
fetch: "paste"
|
|
13321
13759
|
}), toast.push({
|
|
13322
13760
|
closable: !0,
|
|
13323
13761
|
id: "vista-paste",
|
|
@@ -13339,19 +13777,19 @@ function QueryTab(t0) {
|
|
|
13339
13777
|
status: "warning",
|
|
13340
13778
|
title: t(isVariantsEnabled ? "vista.paste.unavailable-variant" : "vista.paste.variants-disabled", { variant: parsed.variant })
|
|
13341
13779
|
}), !0) : !1;
|
|
13342
|
-
}, $[
|
|
13343
|
-
let t44;
|
|
13344
|
-
$[127] !== rootElement || $[128] !== t42 || $[129] !== t43 ? (t44 = {
|
|
13345
|
-
rootElement,
|
|
13346
|
-
onShortcut: t42,
|
|
13347
|
-
onPaste: t43
|
|
13348
|
-
}, $[127] = rootElement, $[128] = t42, $[129] = t43, $[130] = t44) : t44 = $[130], useVistaDocumentEvents(t44);
|
|
13349
|
-
let t45;
|
|
13350
|
-
$[131] === prettify ? t45 = $[132] : (t45 = () => void prettify(), $[131] = prettify, $[132] = t45);
|
|
13351
|
-
let t46;
|
|
13352
|
-
$[133] === run ? t46 = $[134] : (t46 = () => run({ type: "manual" }), $[133] = run, $[134] = t46);
|
|
13780
|
+
}, $[131] = actorRef, $[132] = datasets, $[133] = isVariantsEnabled, $[134] = resolved.variant, $[135] = t, $[136] = tab.id, $[137] = toast, $[138] = t46) : t46 = $[138];
|
|
13353
13781
|
let t47;
|
|
13354
|
-
$[
|
|
13782
|
+
$[139] !== rootElement || $[140] !== t45 || $[141] !== t46 ? (t47 = {
|
|
13783
|
+
rootElement,
|
|
13784
|
+
onShortcut: t45,
|
|
13785
|
+
onPaste: t46
|
|
13786
|
+
}, $[139] = rootElement, $[140] = t45, $[141] = t46, $[142] = t47) : t47 = $[142], useVistaDocumentEvents(t47);
|
|
13787
|
+
let t48;
|
|
13788
|
+
$[143] === prettify ? t48 = $[144] : (t48 = () => void prettify(), $[143] = prettify, $[144] = t48);
|
|
13789
|
+
let t49;
|
|
13790
|
+
$[145] === run ? t49 = $[146] : (t49 = () => run({ type: "manual" }), $[145] = run, $[146] = t49);
|
|
13791
|
+
let t50;
|
|
13792
|
+
$[147] !== buildRequest || $[148] !== cancel || $[149] !== copyQuery || $[150] !== isFetching || $[151] !== params || $[152] !== replaceParams || $[153] !== request || $[154] !== resolved || $[155] !== setOptions || $[156] !== setParams || $[157] !== setQuery || $[158] !== t48 || $[159] !== t49 || $[160] !== tab || $[161] !== toggleAutoRefetch ? (t50 = /* @__PURE__ */ jsx(RequestPanel, {
|
|
13355
13793
|
buildRequest,
|
|
13356
13794
|
formatForEditor,
|
|
13357
13795
|
isFetching,
|
|
@@ -13361,9 +13799,9 @@ function QueryTab(t0) {
|
|
|
13361
13799
|
onOptionsChange: setOptions,
|
|
13362
13800
|
onParamsChange: setParams,
|
|
13363
13801
|
onParamsReplace: replaceParams,
|
|
13364
|
-
onPrettify:
|
|
13802
|
+
onPrettify: t48,
|
|
13365
13803
|
onQueryChange: setQuery,
|
|
13366
|
-
onRun:
|
|
13804
|
+
onRun: t49,
|
|
13367
13805
|
onToggleAutoRefetch: toggleAutoRefetch,
|
|
13368
13806
|
params,
|
|
13369
13807
|
paramsEditorRef,
|
|
@@ -13371,9 +13809,9 @@ function QueryTab(t0) {
|
|
|
13371
13809
|
request,
|
|
13372
13810
|
resolved,
|
|
13373
13811
|
tab
|
|
13374
|
-
}), $[
|
|
13375
|
-
let requestPanel =
|
|
13376
|
-
$[
|
|
13812
|
+
}), $[147] = buildRequest, $[148] = cancel, $[149] = copyQuery, $[150] = isFetching, $[151] = params, $[152] = replaceParams, $[153] = request, $[154] = resolved, $[155] = setOptions, $[156] = setParams, $[157] = setQuery, $[158] = t48, $[159] = t49, $[160] = tab, $[161] = toggleAutoRefetch, $[162] = t50) : t50 = $[162];
|
|
13813
|
+
let requestPanel = t50, t51;
|
|
13814
|
+
$[163] !== lintFindings || $[164] !== refetchAfterMutations || $[165] !== request || $[166] !== resolved || $[167] !== revealRange || $[168] !== runnerRef || $[169] !== tab ? (t51 = /* @__PURE__ */ jsx(ResponsePanel, {
|
|
13377
13815
|
lintFindings,
|
|
13378
13816
|
onEditQuery: editQuery,
|
|
13379
13817
|
onMutationsApplied: refetchAfterMutations,
|
|
@@ -13382,142 +13820,145 @@ function QueryTab(t0) {
|
|
|
13382
13820
|
resolved,
|
|
13383
13821
|
runnerRef,
|
|
13384
13822
|
tab
|
|
13385
|
-
}), $[
|
|
13386
|
-
let responsePanel =
|
|
13387
|
-
$[
|
|
13388
|
-
let
|
|
13389
|
-
$[
|
|
13390
|
-
"aria-labelledby":
|
|
13823
|
+
}), $[163] = lintFindings, $[164] = refetchAfterMutations, $[165] = request, $[166] = resolved, $[167] = revealRange, $[168] = runnerRef, $[169] = tab, $[170] = t51) : t51 = $[170];
|
|
13824
|
+
let responsePanel = t51, t52;
|
|
13825
|
+
$[171] === tab.id ? t52 = $[172] : (t52 = getQueryTabId(tab.id), $[171] = tab.id, $[172] = t52);
|
|
13826
|
+
let t53;
|
|
13827
|
+
$[173] === t52 ? t53 = $[174] : (t53 = {
|
|
13828
|
+
"aria-labelledby": t52,
|
|
13391
13829
|
"data-testid": "vista-query-tab",
|
|
13392
13830
|
id: QUERY_TAB_PANEL_ID,
|
|
13393
13831
|
role: "tabpanel"
|
|
13394
|
-
}, $[
|
|
13395
|
-
let panelProps =
|
|
13832
|
+
}, $[173] = t52, $[174] = t53);
|
|
13833
|
+
let panelProps = t53;
|
|
13396
13834
|
if (layout === "mobile") {
|
|
13397
|
-
let
|
|
13398
|
-
$[
|
|
13399
|
-
let
|
|
13400
|
-
$[
|
|
13401
|
-
let
|
|
13402
|
-
$[
|
|
13835
|
+
let t54;
|
|
13836
|
+
$[175] === t ? t54 = $[176] : (t54 = t("query.label"), $[175] = t, $[176] = t54);
|
|
13837
|
+
let t55;
|
|
13838
|
+
$[177] === Symbol.for("react.memo_cache_sentinel") ? (t55 = () => setMobilePane("request"), $[177] = t55) : t55 = $[177];
|
|
13839
|
+
let t56 = mobilePane === "request", t57;
|
|
13840
|
+
$[178] !== t54 || $[179] !== t56 ? (t57 = /* @__PURE__ */ jsx(Tab, {
|
|
13403
13841
|
"aria-controls": "vista-mobile-request-pane",
|
|
13404
13842
|
fontSize: 1,
|
|
13405
13843
|
id: "vista-mobile-request-tab",
|
|
13406
|
-
label:
|
|
13407
|
-
onClick:
|
|
13844
|
+
label: t54,
|
|
13845
|
+
onClick: t55,
|
|
13408
13846
|
padding: 2,
|
|
13409
|
-
selected:
|
|
13410
|
-
}), $[
|
|
13411
|
-
let
|
|
13412
|
-
$[
|
|
13413
|
-
let
|
|
13414
|
-
$[
|
|
13415
|
-
let
|
|
13416
|
-
$[
|
|
13847
|
+
selected: t56
|
|
13848
|
+
}), $[178] = t54, $[179] = t56, $[180] = t57) : t57 = $[180];
|
|
13849
|
+
let t58;
|
|
13850
|
+
$[181] === t ? t58 = $[182] : (t58 = t("result.label"), $[181] = t, $[182] = t58);
|
|
13851
|
+
let t59;
|
|
13852
|
+
$[183] === Symbol.for("react.memo_cache_sentinel") ? (t59 = () => setMobilePane("response"), $[183] = t59) : t59 = $[183];
|
|
13853
|
+
let t60 = mobilePane === "response", t61;
|
|
13854
|
+
$[184] !== t58 || $[185] !== t60 ? (t61 = /* @__PURE__ */ jsx(Tab, {
|
|
13417
13855
|
"aria-controls": "vista-mobile-response-pane",
|
|
13418
13856
|
fontSize: 1,
|
|
13419
13857
|
id: "vista-mobile-response-tab",
|
|
13420
|
-
label:
|
|
13421
|
-
onClick:
|
|
13858
|
+
label: t58,
|
|
13859
|
+
onClick: t59,
|
|
13422
13860
|
padding: 2,
|
|
13423
|
-
selected:
|
|
13424
|
-
}), $[
|
|
13425
|
-
let
|
|
13426
|
-
$[
|
|
13861
|
+
selected: t60
|
|
13862
|
+
}), $[184] = t58, $[185] = t60, $[186] = t61) : t61 = $[186];
|
|
13863
|
+
let t62;
|
|
13864
|
+
$[187] !== t57 || $[188] !== t61 ? (t62 = /* @__PURE__ */ jsx(Flex, {
|
|
13427
13865
|
borderBottom: !0,
|
|
13428
13866
|
flexShrink: 0,
|
|
13429
13867
|
justifyContent: "center",
|
|
13430
13868
|
paddingY: 1,
|
|
13431
13869
|
children: /* @__PURE__ */ jsxs(TabList, {
|
|
13432
13870
|
gap: 1,
|
|
13433
|
-
children: [
|
|
13871
|
+
children: [t57, t61]
|
|
13434
13872
|
})
|
|
13435
|
-
}), $[
|
|
13436
|
-
let
|
|
13437
|
-
$[
|
|
13438
|
-
let
|
|
13439
|
-
$[
|
|
13873
|
+
}), $[187] = t57, $[188] = t61, $[189] = t62) : t62 = $[189];
|
|
13874
|
+
let t63 = mobilePane !== "request" && "cTWfhW_hiddenPane", t64;
|
|
13875
|
+
$[190] === t63 ? t64 = $[191] : (t64 = cx(_key12$1, t63), $[190] = t63, $[191] = t64);
|
|
13876
|
+
let t65;
|
|
13877
|
+
$[192] !== requestPanel || $[193] !== t64 ? (t65 = /* @__PURE__ */ jsx(Box, {
|
|
13440
13878
|
"aria-labelledby": "vista-mobile-request-tab",
|
|
13441
|
-
className:
|
|
13879
|
+
className: t64,
|
|
13442
13880
|
flexBasis: "0%",
|
|
13443
13881
|
flexGrow: 1,
|
|
13444
13882
|
id: "vista-mobile-request-pane",
|
|
13445
13883
|
role: "tabpanel",
|
|
13446
13884
|
children: requestPanel
|
|
13447
|
-
}), $[
|
|
13448
|
-
let
|
|
13449
|
-
$[
|
|
13450
|
-
let
|
|
13451
|
-
$[
|
|
13885
|
+
}), $[192] = requestPanel, $[193] = t64, $[194] = t65) : t65 = $[194];
|
|
13886
|
+
let t66 = mobilePane !== "response" && "cTWfhW_hiddenPane", t67;
|
|
13887
|
+
$[195] === t66 ? t67 = $[196] : (t67 = cx(_key12$1, t66), $[195] = t66, $[196] = t67);
|
|
13888
|
+
let t68;
|
|
13889
|
+
$[197] !== responsePanel || $[198] !== t67 ? (t68 = /* @__PURE__ */ jsx(Box, {
|
|
13452
13890
|
"aria-labelledby": "vista-mobile-response-tab",
|
|
13453
|
-
className:
|
|
13891
|
+
className: t67,
|
|
13454
13892
|
flexBasis: "0%",
|
|
13455
13893
|
flexGrow: 1,
|
|
13456
13894
|
id: "vista-mobile-response-pane",
|
|
13457
13895
|
role: "tabpanel",
|
|
13458
13896
|
children: responsePanel
|
|
13459
|
-
}), $[
|
|
13460
|
-
let
|
|
13461
|
-
return $[
|
|
13897
|
+
}), $[197] = responsePanel, $[198] = t67, $[199] = t68) : t68 = $[199];
|
|
13898
|
+
let t69;
|
|
13899
|
+
return $[200] !== panelProps || $[201] !== t62 || $[202] !== t65 || $[203] !== t68 ? (t69 = /* @__PURE__ */ jsxs(Flex, {
|
|
13462
13900
|
...panelProps,
|
|
13463
13901
|
flexBasis: "0%",
|
|
13464
13902
|
flexDirection: "column",
|
|
13465
13903
|
flexGrow: 1,
|
|
13466
13904
|
minHeight: "0",
|
|
13467
13905
|
children: [
|
|
13468
|
-
t59,
|
|
13469
13906
|
t62,
|
|
13470
|
-
t65
|
|
13907
|
+
t65,
|
|
13908
|
+
t68
|
|
13471
13909
|
]
|
|
13472
|
-
}), $[
|
|
13910
|
+
}), $[200] = panelProps, $[201] = t62, $[202] = t65, $[203] = t68, $[204] = t69) : t69 = $[204], t69;
|
|
13473
13911
|
}
|
|
13474
|
-
let minSize = MIN_PANE_SIZE[layout], containerExtent = layout === "stacked" ? splitContainerSize?.height : splitContainerSize?.width, defaultSplitSize = Math.max(minSize, Math.floor((containerExtent || 0) * DEFAULT_REQUEST_SHARE[layout])),
|
|
13475
|
-
$[
|
|
13476
|
-
let
|
|
13477
|
-
$[
|
|
13912
|
+
let minSize = MIN_PANE_SIZE[layout], containerExtent = layout === "stacked" ? splitContainerSize?.height : splitContainerSize?.width, defaultSplitSize = Math.max(minSize, Math.floor((containerExtent || 0) * DEFAULT_REQUEST_SHARE[layout])), t54;
|
|
13913
|
+
$[205] === t ? t54 = $[206] : (t54 = t("vista.split.request-response"), $[205] = t, $[206] = t54);
|
|
13914
|
+
let t55, t56;
|
|
13915
|
+
$[207] === layout ? (t55 = $[208], t56 = $[209]) : (t55 = (size) => setSplitSizes((sizes) => ({
|
|
13478
13916
|
...sizes,
|
|
13479
13917
|
[layout]: size
|
|
13480
|
-
})),
|
|
13918
|
+
})), t56 = () => setSplitSizes((sizes_0) => ({
|
|
13481
13919
|
...sizes_0,
|
|
13482
13920
|
[layout]: void 0
|
|
13483
|
-
})), $[
|
|
13484
|
-
let
|
|
13485
|
-
$[
|
|
13921
|
+
})), $[207] = layout, $[208] = t55, $[209] = t56);
|
|
13922
|
+
let t57 = splitSizes[layout] ?? defaultSplitSize, t58 = layout === "stacked" ? "horizontal" : "vertical", t59;
|
|
13923
|
+
$[210] === requestPanel ? t59 = $[211] : (t59 = /* @__PURE__ */ jsx(Box, {
|
|
13486
13924
|
className: _key12$1,
|
|
13487
13925
|
children: requestPanel
|
|
13488
|
-
}), $[
|
|
13489
|
-
let
|
|
13490
|
-
$[
|
|
13926
|
+
}), $[210] = requestPanel, $[211] = t59);
|
|
13927
|
+
let t60;
|
|
13928
|
+
$[212] === responsePanel ? t60 = $[213] : (t60 = /* @__PURE__ */ jsx(Box, {
|
|
13491
13929
|
className: _key12$1,
|
|
13492
13930
|
children: responsePanel
|
|
13493
|
-
}), $[
|
|
13494
|
-
let
|
|
13495
|
-
$[
|
|
13496
|
-
label:
|
|
13931
|
+
}), $[212] = responsePanel, $[213] = t60);
|
|
13932
|
+
let t61;
|
|
13933
|
+
$[214] !== layout || $[215] !== minSize || $[216] !== t54 || $[217] !== t55 || $[218] !== t56 || $[219] !== t57 || $[220] !== t58 || $[221] !== t59 || $[222] !== t60 ? (t61 = /* @__PURE__ */ jsxs(ResizableSplit, {
|
|
13934
|
+
label: t54,
|
|
13497
13935
|
minSecondarySize: minSize,
|
|
13498
13936
|
minSize,
|
|
13499
|
-
onChange:
|
|
13500
|
-
onReset:
|
|
13501
|
-
size:
|
|
13502
|
-
split:
|
|
13937
|
+
onChange: t55,
|
|
13938
|
+
onReset: t56,
|
|
13939
|
+
size: t57,
|
|
13940
|
+
split: t58,
|
|
13503
13941
|
testId: "vista-split",
|
|
13504
|
-
children: [
|
|
13505
|
-
}, layout), $[
|
|
13506
|
-
let
|
|
13507
|
-
return $[
|
|
13942
|
+
children: [t59, t60]
|
|
13943
|
+
}, layout), $[214] = layout, $[215] = minSize, $[216] = t54, $[217] = t55, $[218] = t56, $[219] = t57, $[220] = t58, $[221] = t59, $[222] = t60, $[223] = t61) : t61 = $[223];
|
|
13944
|
+
let t62;
|
|
13945
|
+
return $[224] !== panelProps || $[225] !== t61 ? (t62 = /* @__PURE__ */ jsx(Box, {
|
|
13508
13946
|
...panelProps,
|
|
13509
13947
|
className: _key42,
|
|
13510
13948
|
ref: setSplitContainer,
|
|
13511
|
-
children:
|
|
13512
|
-
}), $[
|
|
13949
|
+
children: t61
|
|
13950
|
+
}), $[224] = panelProps, $[225] = t61, $[226] = t62) : t62 = $[226], t62;
|
|
13513
13951
|
}
|
|
13514
|
-
function
|
|
13515
|
-
function
|
|
13952
|
+
function _temp5() {}
|
|
13953
|
+
function _temp4(resolve) {
|
|
13516
13954
|
return requestAnimationFrame(resolve);
|
|
13517
13955
|
}
|
|
13518
|
-
function
|
|
13956
|
+
function _temp3(snapshot_2) {
|
|
13519
13957
|
return selectOpenDrawer(snapshot_2) !== null;
|
|
13520
13958
|
}
|
|
13959
|
+
function _temp2$1(param) {
|
|
13960
|
+
return param.name;
|
|
13961
|
+
}
|
|
13521
13962
|
function _temp$1(snapshot_1) {
|
|
13522
13963
|
return isPanelExpanded(snapshot_1, "params");
|
|
13523
13964
|
}
|
|
@@ -13587,7 +14028,9 @@ function VistaDialogs() {
|
|
|
13587
14028
|
* shared, and opens the request a URL names when it is not what the tool wrote there itself (a
|
|
13588
14029
|
* link opened from elsewhere, a bookmark). The value is the query URL the Response panel shows,
|
|
13589
14030
|
* read the way a pasted one is: a tab already showing the request is selected, otherwise one
|
|
13590
|
-
* opens for it.
|
|
14031
|
+
* opens for it and runs the query right away, as a pasted URL does. A tab that already shows the
|
|
14032
|
+
* request is only selected (after a reload, the address names the active tab's own request), so
|
|
14033
|
+
* its last result stays as it was.
|
|
13591
14034
|
*/
|
|
13592
14035
|
function VistaUrlState(t0) {
|
|
13593
14036
|
let $ = c(21), { tab } = t0, { t } = useTranslation(visionLocaleNamespace), toast = useToast(), router = useRouter(), actorRef = useVistaActor(), datasets = useVistaSelector(selectDatasets), environment = useRequestEnvironment(), { request } = useQueryRequestBuilder(tab), activeUrl = request?.url ?? null, t1;
|
|
@@ -13602,7 +14045,8 @@ function VistaUrlState(t0) {
|
|
|
13602
14045
|
id: existing.id
|
|
13603
14046
|
}) : (actorRef.send({
|
|
13604
14047
|
type: "tab.add",
|
|
13605
|
-
tab: parsedQueryToTabInit(parsed)
|
|
14048
|
+
tab: parsedQueryToTabInit(parsed),
|
|
14049
|
+
fetch: "link"
|
|
13606
14050
|
}), parsed.isKnownDataset || toast.push({
|
|
13607
14051
|
closable: !0,
|
|
13608
14052
|
status: "warning",
|
|
@@ -13802,7 +14246,7 @@ function VistaWebMcp(t0) {
|
|
|
13802
14246
|
title,
|
|
13803
14247
|
options: tab.options
|
|
13804
14248
|
},
|
|
13805
|
-
fetch: input.run
|
|
14249
|
+
fetch: input.run === !1 ? void 0 : "generated"
|
|
13806
14250
|
}), text(`Opened the query in a new tab${input.run === !1 ? "" : " and ran it"}.`);
|
|
13807
14251
|
}
|
|
13808
14252
|
case "vision_check_query": {
|
|
@@ -14001,4 +14445,4 @@ function VistaGui(props) {
|
|
|
14001
14445
|
}
|
|
14002
14446
|
export { VistaGui };
|
|
14003
14447
|
|
|
14004
|
-
//# sourceMappingURL=VistaGui-
|
|
14448
|
+
//# sourceMappingURL=VistaGui-D3NHSIsK.js.map
|