@sanity/vision 4.13.1-next.1 → 4.14.0-next.4

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.
@@ -104,6 +104,8 @@ const visionLocaleStrings = sanity.defineLocalesResources("vision", {
104
104
  "settings.perspectives.new-default.description": 'The default perspective will change from "<code>raw</code>" to "<code>published</code>" in an upcoming API version. Please consult docs for more details.',
105
105
  /** Label for the pinned release perspective */
106
106
  "settings.perspectives.pinned-release-label": "Pinned release",
107
+ /** Label for the scheduled drafts perspective */
108
+ "settings.perspectives.scheduled-drafts": "Scheduled drafts",
107
109
  /** Title for popover that explains what "Perspectives" are */
108
110
  "settings.perspectives.title": "Perspectives"
109
111
  });
@@ -1 +1 @@
1
- {"version":3,"file":"resources.js","sources":["../../src/i18n/resources.ts"],"sourcesContent":["/* eslint sort-keys: \"error\" */\nimport {defineLocalesResources} from 'sanity'\n\n/**\n * Defined locale strings for the vision tool, in US English.\n *\n * @internal\n */\nconst visionLocaleStrings = defineLocalesResources('vision', {\n /** Label for action \"Copy to clipboard\", tied to the \"Query URL\" field. Also used for accessibility purposes on button */\n 'action.copy-url-to-clipboard': 'Copy to clipboard',\n /** Label for deleting a query */\n 'action.delete': 'Delete',\n /** Label for editing a query's title */\n 'action.edit-title': 'Edit title',\n /** Label for stopping an ongoing listen operation */\n 'action.listen-cancel': 'Stop',\n /** Label for setting up a listener */\n 'action.listen-execute': 'Listen',\n /** Label for query loading table */\n 'action.load-queries': 'Load queries',\n /** Label for loading a query */\n 'action.load-query': 'Load query',\n /** Label for cancelling an ongoing query */\n 'action.query-cancel': 'Cancel',\n /** Label for executing the query, eg doing a fetch */\n 'action.query-execute': 'Fetch',\n /** Label for saving a query */\n 'action.save-query': 'Save query',\n /** Label for updating a query */\n 'action.update': 'Update',\n\n /** Label for actions user can take */\n 'label.actions': 'Actions',\n /** Label for saved queries that have been edited */\n 'label.edited': 'Edited',\n\n /**\n * Some features has a \"New\" label indicating that the feature was recently introduced.\n * This defines what the text of that label is. Keep it short and sweet.\n */\n 'label.new': 'New',\n /** Label for query type \"personal\" */\n 'label.personal': 'Personal',\n /** Label for savedAt date */\n 'label.saved-at': 'Saved at',\n /** Saved queries */\n 'label.saved-queries': 'Saved queries',\n /** Search queries */\n 'label.search-queries': 'Search queries',\n /** Share query */\n 'label.share': 'Share',\n /** Label for saved query type \"team\" */\n 'label.team': 'Team',\n\n /** Error message for when the \"Params\" input are not a valid json */\n 'params.error.params-invalid-json': 'Parameters are not valid JSON',\n /** Label for \"Params\" (parameters) editor/input */\n 'params.label': 'Params',\n\n /** Label for 'Column' indicator when there is an error within the query */\n 'query.error.column': 'Column',\n /** Label for 'Line' indicator when there is an error within the query */\n 'query.error.line': 'Line',\n /** Label for \"Query\" editor/input */\n 'query.label': 'Query',\n /** Label for the \"Query URL\" field, shown after executing a query, and allows for copying */\n 'query.url': 'Query URL',\n\n /** Label for \"End to End time\" information of the fetched query */\n 'result.end-to-end-time-label': 'End-to-end',\n /** Label for \"Execution time\" information of the fetched query */\n 'result.execution-time-label': 'Execution',\n /** Label for \"Result\" explorer/view */\n 'result.label': 'Result',\n /** Tooltip text shown when the query result is not encodable as CSV */\n 'result.save-result-as-csv.not-csv-encodable': 'Result cannot be encoded as CSV',\n /** Label for \"Save result as\" result action */\n 'result.save-result-as-format': 'Save result as <SaveResultButtons/>',\n /**\n * \"Not applicable\" message for when there is no Execution time or End to End time information\n * available for the query (eg when the query has not been executed, or errored)\n */\n 'result.timing-not-applicable': 'n/a',\n\n /** Query already saved error label */\n 'save-query.already-saved': 'Query already saved',\n /** Save error label */\n 'save-query.error': 'Error saving query',\n /** Save success label */\n 'save-query.success': 'Query saved',\n\n /** Label for the \"API version\" dropdown in settings */\n 'settings.api-version-label': 'API version',\n /** Label for the \"Custom API version\" input in settings, shown when \"other\" is chosen as API version */\n 'settings.custom-api-version-label': 'Custom API version',\n /** Label for the \"Dataset\" dropdown in vision settings */\n 'settings.dataset-label': 'Dataset',\n /** Error label for when the API version in 'Custom API version' input is invalid */\n 'settings.error.invalid-api-version': 'Invalid API version',\n /** Label for the \"other\" versions within the \"API version\" dropdown */\n 'settings.other-api-version-label': 'Other',\n /**\n * Label for the \"Perspective\" dropdown in vision settings\n * @see {@link https://www.sanity.io/docs/perspectives}\n */\n 'settings.perspective-label': 'Perspective',\n /** Notification about previewDrafts to drafts rename */\n 'settings.perspective.preview-drafts-renamed-to-drafts.description':\n 'The \"<code>previewDrafts</code>\" perspective has been renamed to \"<code>drafts</code>\" and is now deprecated. This change is effective for all versions with perspective support (>= v2021-03-25).',\n /** Call to action to read the docs related to \"Perspectives\" */\n 'settings.perspectives.action.docs-link': 'Read docs',\n /** Option for selecting default perspective */\n 'settings.perspectives.default': 'No perspective (API default)',\n /** Description for popover that explains what \"Perspectives\" are */\n 'settings.perspectives.description':\n 'Perspectives allow your query to run against different \"views\" of the content in your dataset',\n /** Description for upcoming default perspective change */\n 'settings.perspectives.new-default.description':\n 'The default perspective will change from \"<code>raw</code>\" to \"<code>published</code>\" in an upcoming API version. Please consult docs for more details.',\n /** Label for the pinned release perspective */\n 'settings.perspectives.pinned-release-label': 'Pinned release',\n /** Title for popover that explains what \"Perspectives\" are */\n 'settings.perspectives.title': 'Perspectives',\n} as const)\n\n/**\n * @alpha\n */\nexport type VisionLocaleResourceKeys = keyof typeof visionLocaleStrings\n\nexport default visionLocaleStrings\n"],"names":["visionLocaleStrings","defineLocalesResources"],"mappings":";;AAQA,MAAMA,sBAAsBC,OAAAA,uBAAuB,UAAU;AAAA;AAAA,EAE3D,gCAAgC;AAAA;AAAA,EAEhC,iBAAiB;AAAA;AAAA,EAEjB,qBAAqB;AAAA;AAAA,EAErB,wBAAwB;AAAA;AAAA,EAExB,yBAAyB;AAAA;AAAA,EAEzB,uBAAuB;AAAA;AAAA,EAEvB,qBAAqB;AAAA;AAAA,EAErB,uBAAuB;AAAA;AAAA,EAEvB,wBAAwB;AAAA;AAAA,EAExB,qBAAqB;AAAA;AAAA,EAErB,iBAAiB;AAAA;AAAA,EAGjB,iBAAiB;AAAA;AAAA,EAEjB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhB,aAAa;AAAA;AAAA,EAEb,kBAAkB;AAAA;AAAA,EAElB,kBAAkB;AAAA;AAAA,EAElB,uBAAuB;AAAA;AAAA,EAEvB,wBAAwB;AAAA;AAAA,EAExB,eAAe;AAAA;AAAA,EAEf,cAAc;AAAA;AAAA,EAGd,oCAAoC;AAAA;AAAA,EAEpC,gBAAgB;AAAA;AAAA,EAGhB,sBAAsB;AAAA;AAAA,EAEtB,oBAAoB;AAAA;AAAA,EAEpB,eAAe;AAAA;AAAA,EAEf,aAAa;AAAA;AAAA,EAGb,gCAAgC;AAAA;AAAA,EAEhC,+BAA+B;AAAA;AAAA,EAE/B,gBAAgB;AAAA;AAAA,EAEhB,+CAA+C;AAAA;AAAA,EAE/C,gCAAgC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhC,gCAAgC;AAAA;AAAA,EAGhC,4BAA4B;AAAA;AAAA,EAE5B,oBAAoB;AAAA;AAAA,EAEpB,sBAAsB;AAAA;AAAA,EAGtB,8BAA8B;AAAA;AAAA,EAE9B,qCAAqC;AAAA;AAAA,EAErC,0BAA0B;AAAA;AAAA,EAE1B,sCAAsC;AAAA;AAAA,EAEtC,oCAAoC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKpC,8BAA8B;AAAA;AAAA,EAE9B,qEACE;AAAA;AAAA,EAEF,0CAA0C;AAAA;AAAA,EAE1C,iCAAiC;AAAA;AAAA,EAEjC,qCACE;AAAA;AAAA,EAEF,iDACE;AAAA;AAAA,EAEF,8CAA8C;AAAA;AAAA,EAE9C,+BAA+B;AACjC,CAAU;;"}
1
+ {"version":3,"file":"resources.js","sources":["../../src/i18n/resources.ts"],"sourcesContent":["/* eslint sort-keys: \"error\" */\nimport {defineLocalesResources} from 'sanity'\n\n/**\n * Defined locale strings for the vision tool, in US English.\n *\n * @internal\n */\nconst visionLocaleStrings = defineLocalesResources('vision', {\n /** Label for action \"Copy to clipboard\", tied to the \"Query URL\" field. Also used for accessibility purposes on button */\n 'action.copy-url-to-clipboard': 'Copy to clipboard',\n /** Label for deleting a query */\n 'action.delete': 'Delete',\n /** Label for editing a query's title */\n 'action.edit-title': 'Edit title',\n /** Label for stopping an ongoing listen operation */\n 'action.listen-cancel': 'Stop',\n /** Label for setting up a listener */\n 'action.listen-execute': 'Listen',\n /** Label for query loading table */\n 'action.load-queries': 'Load queries',\n /** Label for loading a query */\n 'action.load-query': 'Load query',\n /** Label for cancelling an ongoing query */\n 'action.query-cancel': 'Cancel',\n /** Label for executing the query, eg doing a fetch */\n 'action.query-execute': 'Fetch',\n /** Label for saving a query */\n 'action.save-query': 'Save query',\n /** Label for updating a query */\n 'action.update': 'Update',\n\n /** Label for actions user can take */\n 'label.actions': 'Actions',\n /** Label for saved queries that have been edited */\n 'label.edited': 'Edited',\n\n /**\n * Some features has a \"New\" label indicating that the feature was recently introduced.\n * This defines what the text of that label is. Keep it short and sweet.\n */\n 'label.new': 'New',\n /** Label for query type \"personal\" */\n 'label.personal': 'Personal',\n /** Label for savedAt date */\n 'label.saved-at': 'Saved at',\n /** Saved queries */\n 'label.saved-queries': 'Saved queries',\n /** Search queries */\n 'label.search-queries': 'Search queries',\n /** Share query */\n 'label.share': 'Share',\n /** Label for saved query type \"team\" */\n 'label.team': 'Team',\n\n /** Error message for when the \"Params\" input are not a valid json */\n 'params.error.params-invalid-json': 'Parameters are not valid JSON',\n /** Label for \"Params\" (parameters) editor/input */\n 'params.label': 'Params',\n\n /** Label for 'Column' indicator when there is an error within the query */\n 'query.error.column': 'Column',\n /** Label for 'Line' indicator when there is an error within the query */\n 'query.error.line': 'Line',\n /** Label for \"Query\" editor/input */\n 'query.label': 'Query',\n /** Label for the \"Query URL\" field, shown after executing a query, and allows for copying */\n 'query.url': 'Query URL',\n\n /** Label for \"End to End time\" information of the fetched query */\n 'result.end-to-end-time-label': 'End-to-end',\n /** Label for \"Execution time\" information of the fetched query */\n 'result.execution-time-label': 'Execution',\n /** Label for \"Result\" explorer/view */\n 'result.label': 'Result',\n /** Tooltip text shown when the query result is not encodable as CSV */\n 'result.save-result-as-csv.not-csv-encodable': 'Result cannot be encoded as CSV',\n /** Label for \"Save result as\" result action */\n 'result.save-result-as-format': 'Save result as <SaveResultButtons/>',\n /**\n * \"Not applicable\" message for when there is no Execution time or End to End time information\n * available for the query (eg when the query has not been executed, or errored)\n */\n 'result.timing-not-applicable': 'n/a',\n\n /** Query already saved error label */\n 'save-query.already-saved': 'Query already saved',\n /** Save error label */\n 'save-query.error': 'Error saving query',\n /** Save success label */\n 'save-query.success': 'Query saved',\n\n /** Label for the \"API version\" dropdown in settings */\n 'settings.api-version-label': 'API version',\n /** Label for the \"Custom API version\" input in settings, shown when \"other\" is chosen as API version */\n 'settings.custom-api-version-label': 'Custom API version',\n /** Label for the \"Dataset\" dropdown in vision settings */\n 'settings.dataset-label': 'Dataset',\n /** Error label for when the API version in 'Custom API version' input is invalid */\n 'settings.error.invalid-api-version': 'Invalid API version',\n /** Label for the \"other\" versions within the \"API version\" dropdown */\n 'settings.other-api-version-label': 'Other',\n /**\n * Label for the \"Perspective\" dropdown in vision settings\n * @see {@link https://www.sanity.io/docs/perspectives}\n */\n 'settings.perspective-label': 'Perspective',\n /** Notification about previewDrafts to drafts rename */\n 'settings.perspective.preview-drafts-renamed-to-drafts.description':\n 'The \"<code>previewDrafts</code>\" perspective has been renamed to \"<code>drafts</code>\" and is now deprecated. This change is effective for all versions with perspective support (>= v2021-03-25).',\n /** Call to action to read the docs related to \"Perspectives\" */\n 'settings.perspectives.action.docs-link': 'Read docs',\n /** Option for selecting default perspective */\n 'settings.perspectives.default': 'No perspective (API default)',\n /** Description for popover that explains what \"Perspectives\" are */\n 'settings.perspectives.description':\n 'Perspectives allow your query to run against different \"views\" of the content in your dataset',\n /** Description for upcoming default perspective change */\n 'settings.perspectives.new-default.description':\n 'The default perspective will change from \"<code>raw</code>\" to \"<code>published</code>\" in an upcoming API version. Please consult docs for more details.',\n /** Label for the pinned release perspective */\n 'settings.perspectives.pinned-release-label': 'Pinned release',\n /** Label for the scheduled drafts perspective */\n 'settings.perspectives.scheduled-drafts': 'Scheduled drafts',\n /** Title for popover that explains what \"Perspectives\" are */\n 'settings.perspectives.title': 'Perspectives',\n} as const)\n\n/**\n * @alpha\n */\nexport type VisionLocaleResourceKeys = keyof typeof visionLocaleStrings\n\nexport default visionLocaleStrings\n"],"names":["visionLocaleStrings","defineLocalesResources"],"mappings":";;AAQA,MAAMA,sBAAsBC,OAAAA,uBAAuB,UAAU;AAAA;AAAA,EAE3D,gCAAgC;AAAA;AAAA,EAEhC,iBAAiB;AAAA;AAAA,EAEjB,qBAAqB;AAAA;AAAA,EAErB,wBAAwB;AAAA;AAAA,EAExB,yBAAyB;AAAA;AAAA,EAEzB,uBAAuB;AAAA;AAAA,EAEvB,qBAAqB;AAAA;AAAA,EAErB,uBAAuB;AAAA;AAAA,EAEvB,wBAAwB;AAAA;AAAA,EAExB,qBAAqB;AAAA;AAAA,EAErB,iBAAiB;AAAA;AAAA,EAGjB,iBAAiB;AAAA;AAAA,EAEjB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhB,aAAa;AAAA;AAAA,EAEb,kBAAkB;AAAA;AAAA,EAElB,kBAAkB;AAAA;AAAA,EAElB,uBAAuB;AAAA;AAAA,EAEvB,wBAAwB;AAAA;AAAA,EAExB,eAAe;AAAA;AAAA,EAEf,cAAc;AAAA;AAAA,EAGd,oCAAoC;AAAA;AAAA,EAEpC,gBAAgB;AAAA;AAAA,EAGhB,sBAAsB;AAAA;AAAA,EAEtB,oBAAoB;AAAA;AAAA,EAEpB,eAAe;AAAA;AAAA,EAEf,aAAa;AAAA;AAAA,EAGb,gCAAgC;AAAA;AAAA,EAEhC,+BAA+B;AAAA;AAAA,EAE/B,gBAAgB;AAAA;AAAA,EAEhB,+CAA+C;AAAA;AAAA,EAE/C,gCAAgC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhC,gCAAgC;AAAA;AAAA,EAGhC,4BAA4B;AAAA;AAAA,EAE5B,oBAAoB;AAAA;AAAA,EAEpB,sBAAsB;AAAA;AAAA,EAGtB,8BAA8B;AAAA;AAAA,EAE9B,qCAAqC;AAAA;AAAA,EAErC,0BAA0B;AAAA;AAAA,EAE1B,sCAAsC;AAAA;AAAA,EAEtC,oCAAoC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKpC,8BAA8B;AAAA;AAAA,EAE9B,qEACE;AAAA;AAAA,EAEF,0CAA0C;AAAA;AAAA,EAE1C,iCAAiC;AAAA;AAAA,EAEjC,qCACE;AAAA;AAAA,EAEF,iDACE;AAAA;AAAA,EAEF,8CAA8C;AAAA;AAAA,EAE9C,0CAA0C;AAAA;AAAA,EAE1C,+BAA+B;AACjC,CAAU;;"}
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
- import { useTranslation, useKeyValueStore, useDateTimeFormat, ContextMenuButton, Translate, usePerspective, useDataset, useClient } from "sanity";
4
- import { Spinner, rem, useTheme, Flex, Card, Label, Box, Text, Tooltip, Stack, useToast, TextInput, MenuButton, Menu, MenuItem, Code, Button, Hotkeys, useClickOutsideEvent, Popover, Inline, Badge, Grid, Select, Container, Heading } from "@sanity/ui";
3
+ import { useTranslation, useKeyValueStore, useDateTimeFormat, ContextMenuButton, Translate, usePerspective, useDataset, useScheduledDraftsEnabled, useActiveReleases, useWorkspace, isCardinalityOneRelease, sortReleases, getReleaseIdFromReleaseDocumentId, useClient } from "sanity";
4
+ import { Spinner, rem, useTheme, Flex, Box, Card, Label, Text, Tooltip, Stack, useToast, TextInput, MenuButton, Menu, MenuItem, Code, Button, Hotkeys, useClickOutsideEvent, Popover, Inline, Badge, Grid, Select, Container, Heading } from "@sanity/ui";
5
5
  import { useState, useEffect, forwardRef, useRef, useImperativeHandle, useMemo, useCallback, Fragment, Component } from "react";
6
6
  import { SplitPane } from "@rexxars/react-split-pane";
7
7
  import { ErrorOutlineIcon, TrashIcon, AddIcon, SearchIcon, StopIcon, PlayIcon, HelpCircleIcon, CopyIcon, LinkIcon, DocumentSheetIcon, ChevronLeftIcon, ChevronRightIcon } from "@sanity/icons";
@@ -211,7 +211,7 @@ const EditorRoot = styled.div`
211
211
  return $[3] !== initialValue || $[4] !== props.onChange || $[5] !== theme ? (t3 = /* @__PURE__ */ jsx(EditorRoot, { children: /* @__PURE__ */ jsx(CodeMirror, { ref: codeMirrorRef, basicSetup: !1, theme, extensions: codemirrorExtensions, value: initialValue, onChange: props.onChange }) }), $[3] = initialValue, $[4] = props.onChange, $[5] = theme, $[6] = t3) : t3 = $[6], t3;
212
212
  });
213
213
  VisionCodeMirror.displayName = "VisionCodeMirror";
214
- const SUPPORTED_PERSPECTIVES = ["pinnedRelease", "raw", "published", "drafts"], VIRTUAL_PERSPECTIVES = ["pinnedRelease"];
214
+ const SUPPORTED_PERSPECTIVES = ["pinnedRelease", "scheduledDrafts", "raw", "published", "drafts"], VIRTUAL_PERSPECTIVES = ["pinnedRelease", "scheduledDrafts"];
215
215
  function isSupportedPerspective(p) {
216
216
  return SUPPORTED_PERSPECTIVES.includes(p);
217
217
  }
@@ -225,9 +225,10 @@ function hasPinnedPerspective({
225
225
  }
226
226
  function getActivePerspective({
227
227
  visionPerspective,
228
- perspectiveStack
228
+ perspectiveStack,
229
+ scheduledDraftsStack
229
230
  }) {
230
- return visionPerspective !== "pinnedRelease" ? visionPerspective : perspectiveStack;
231
+ return visionPerspective === "pinnedRelease" ? perspectiveStack : visionPerspective === "scheduledDrafts" ? scheduledDraftsStack : visionPerspective;
231
232
  }
232
233
  function encodeQueryString(query, params = {}, options = {}) {
233
234
  const searchParams = new URLSearchParams();
@@ -1005,7 +1006,7 @@ const PinnedReleasePerspectiveOption = (t0) => {
1005
1006
  return $[6] !== t3 || $[7] !== text ? (t4 = /* @__PURE__ */ jsx("option", { value: "pinnedRelease", disabled: t3, children: text }), $[6] = t3, $[7] = text, $[8] = t4) : t4 = $[8], t4;
1006
1007
  };
1007
1008
  function VisionGuiHeader(t0) {
1008
- const $ = c(64), {
1009
+ const $ = c(65), {
1009
1010
  onChangeDataset,
1010
1011
  dataset,
1011
1012
  customApiVersion,
@@ -1017,7 +1018,8 @@ function VisionGuiHeader(t0) {
1017
1018
  isValidApiVersion,
1018
1019
  onChangePerspective,
1019
1020
  url,
1020
- perspective
1021
+ perspective,
1022
+ isScheduledDraftsEnabled
1021
1023
  } = t0, pinnedPerspective = usePerspective(), {
1022
1024
  t
1023
1025
  } = useTranslation(visionLocaleNamespace), operationUrlElement = useRef(null);
@@ -1086,20 +1088,20 @@ function VisionGuiHeader(t0) {
1086
1088
  ] }) }), $[42] = t18, $[43] = t20) : t20 = $[43];
1087
1089
  const t21 = perspective || "default";
1088
1090
  let t22;
1089
- $[44] !== pinnedPerspective || $[45] !== t ? (t22 = SUPPORTED_PERSPECTIVES.map((perspectiveName) => perspectiveName === "pinnedRelease" ? /* @__PURE__ */ jsxs(Fragment, { children: [
1091
+ $[44] !== isScheduledDraftsEnabled || $[45] !== pinnedPerspective || $[46] !== t ? (t22 = SUPPORTED_PERSPECTIVES.map((perspectiveName) => perspectiveName === "pinnedRelease" ? /* @__PURE__ */ jsxs(Fragment, { children: [
1090
1092
  /* @__PURE__ */ jsx(PinnedReleasePerspectiveOption, { pinnedPerspective, t }),
1091
1093
  /* @__PURE__ */ jsx("option", { value: "default", children: t("settings.perspectives.default") }, "default"),
1092
1094
  /* @__PURE__ */ jsx("hr", {})
1093
- ] }, "pinnedRelease") : /* @__PURE__ */ jsx("option", { children: perspectiveName }, perspectiveName)), $[44] = pinnedPerspective, $[45] = t, $[46] = t22) : t22 = $[46];
1095
+ ] }, "pinnedRelease") : perspectiveName === "scheduledDrafts" ? isScheduledDraftsEnabled ? /* @__PURE__ */ jsx("option", { value: "scheduledDrafts", children: t("settings.perspectives.scheduled-drafts") }, "scheduledDrafts") : null : /* @__PURE__ */ jsx("option", { children: perspectiveName }, perspectiveName)), $[44] = isScheduledDraftsEnabled, $[45] = pinnedPerspective, $[46] = t, $[47] = t22) : t22 = $[47];
1094
1096
  let t23;
1095
- $[47] !== onChangePerspective || $[48] !== t21 || $[49] !== t22 ? (t23 = /* @__PURE__ */ jsx(Select, { value: t21, onChange: onChangePerspective, children: t22 }), $[47] = onChangePerspective, $[48] = t21, $[49] = t22, $[50] = t23) : t23 = $[50];
1097
+ $[48] !== onChangePerspective || $[49] !== t21 || $[50] !== t22 ? (t23 = /* @__PURE__ */ jsx(Select, { value: t21, onChange: onChangePerspective, children: t22 }), $[48] = onChangePerspective, $[49] = t21, $[50] = t22, $[51] = t23) : t23 = $[51];
1096
1098
  let t24;
1097
- $[51] !== t20 || $[52] !== t23 ? (t24 = /* @__PURE__ */ jsx(Box, { padding: 1, column: 2, children: /* @__PURE__ */ jsxs(Stack, { children: [
1099
+ $[52] !== t20 || $[53] !== t23 ? (t24 = /* @__PURE__ */ jsx(Box, { padding: 1, column: 2, children: /* @__PURE__ */ jsxs(Stack, { children: [
1098
1100
  t20,
1099
1101
  t23
1100
- ] }) }), $[51] = t20, $[52] = t23, $[53] = t24) : t24 = $[53];
1102
+ ] }) }), $[52] = t20, $[53] = t23, $[54] = t24) : t24 = $[54];
1101
1103
  let t25;
1102
- $[54] !== customApiVersion || $[55] !== t || $[56] !== url ? (t25 = typeof url == "string" ? /* @__PURE__ */ jsx(Box, { padding: 1, flex: 1, column: customApiVersion === !1 ? 6 : 4, children: /* @__PURE__ */ jsxs(Stack, { children: [
1104
+ $[55] !== customApiVersion || $[56] !== t || $[57] !== url ? (t25 = typeof url == "string" ? /* @__PURE__ */ jsx(Box, { padding: 1, flex: 1, column: customApiVersion === !1 ? 6 : 4, children: /* @__PURE__ */ jsxs(Stack, { children: [
1103
1105
  /* @__PURE__ */ jsx(Card, { paddingTop: 2, paddingBottom: 3, children: /* @__PURE__ */ jsxs(StyledLabel, { children: [
1104
1106
  t("query.url"),
1105
1107
  "\xA0",
@@ -1113,15 +1115,15 @@ function VisionGuiHeader(t0) {
1113
1115
  /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(TextInput, { readOnly: !0, type: "url", ref: operationUrlElement, value: url }) }),
1114
1116
  /* @__PURE__ */ jsx(Tooltip, { content: t("action.copy-url-to-clipboard"), children: /* @__PURE__ */ jsx(Button, { "aria-label": t("action.copy-url-to-clipboard"), type: "button", mode: "ghost", icon: CopyIcon, onClick: handleCopyUrl }) })
1115
1117
  ] })
1116
- ] }) }) : /* @__PURE__ */ jsx(Box, { flex: 1 }), $[54] = customApiVersion, $[55] = t, $[56] = url, $[57] = t25) : t25 = $[57];
1118
+ ] }) }) : /* @__PURE__ */ jsx(Box, { flex: 1 }), $[55] = customApiVersion, $[56] = t, $[57] = url, $[58] = t25) : t25 = $[58];
1117
1119
  let t26;
1118
- return $[58] !== t15 || $[59] !== t16 || $[60] !== t24 || $[61] !== t25 || $[62] !== t7 ? (t26 = /* @__PURE__ */ jsx(Header, { paddingX: 3, paddingY: 2, children: /* @__PURE__ */ jsxs(Grid, { columns: t2, children: [
1120
+ return $[59] !== t15 || $[60] !== t16 || $[61] !== t24 || $[62] !== t25 || $[63] !== t7 ? (t26 = /* @__PURE__ */ jsx(Header, { paddingX: 3, paddingY: 2, children: /* @__PURE__ */ jsxs(Grid, { columns: t2, children: [
1119
1121
  t7,
1120
1122
  t15,
1121
1123
  t16,
1122
1124
  t24,
1123
1125
  t25
1124
- ] }) }), $[58] = t15, $[59] = t16, $[60] = t24, $[61] = t25, $[62] = t7, $[63] = t26) : t26 = $[63], t26;
1126
+ ] }) }), $[59] = t15, $[60] = t16, $[61] = t24, $[62] = t25, $[63] = t7, $[64] = t26) : t26 = $[64], t26;
1125
1127
  }
1126
1128
  function _temp3$1(version) {
1127
1129
  return /* @__PURE__ */ jsx("option", { children: version }, version);
@@ -1516,7 +1518,7 @@ function nodeContains(node, other) {
1516
1518
  }
1517
1519
  const sanityUrl = /\.(?:api|apicdn)\.sanity\.(?:io|work)\/(vX|v1|v\d{4}-\d\d-\d\d)\/.*?(?:query|listen)\/(.*?)\?(.*)/, isRunHotkey = (event) => isHotkey("ctrl+enter", event) || isHotkey("mod+enter", event);
1518
1520
  function VisionGui(props) {
1519
- const $ = c(199), {
1521
+ const {
1520
1522
  datasets,
1521
1523
  config,
1522
1524
  projectId,
@@ -1525,84 +1527,35 @@ function VisionGui(props) {
1525
1527
  t
1526
1528
  } = useTranslation(visionLocaleNamespace), {
1527
1529
  perspectiveStack
1528
- } = usePerspective(), editorQueryRef = useRef(null), editorParamsRef = useRef(null), visionRootRef = useRef(null), customApiVersionElementRef = useRef(null), querySubscriptionRef = useRef(void 0), listenSubscriptionRef = useRef(void 0);
1529
- let t0;
1530
- $[0] !== projectId ? (t0 = () => getLocalStorage(projectId || "default"), $[0] = projectId, $[1] = t0) : t0 = $[1];
1531
- const [localStorage2] = useState(t0);
1532
- let t1;
1533
- $[2] !== defaultDataset || $[3] !== localStorage2 ? (t1 = localStorage2.get("dataset", defaultDataset), $[2] = defaultDataset, $[3] = localStorage2, $[4] = t1) : t1 = $[4];
1534
- const storedDataset = t1;
1535
- let t2;
1536
- $[5] !== config.defaultApiVersion || $[6] !== localStorage2 ? (t2 = localStorage2.get("apiVersion", prefixApiVersion(`${config.defaultApiVersion}`)), $[5] = config.defaultApiVersion, $[6] = localStorage2, $[7] = t2) : t2 = $[7];
1537
- const storedApiVersion = t2;
1538
- let t3;
1539
- $[8] !== localStorage2 ? (t3 = localStorage2.get("query", ""), $[8] = localStorage2, $[9] = t3) : t3 = $[9];
1540
- const storedQuery = t3;
1541
- let t4;
1542
- $[10] !== localStorage2 ? (t4 = localStorage2.get("params", `{
1530
+ } = usePerspective(), isScheduledDraftsEnabled = useScheduledDraftsEnabled(), {
1531
+ data: releases = []
1532
+ } = useActiveReleases(), isDraftModelEnabled = useWorkspace().document.drafts.enabled, editorQueryRef = useRef(null), editorParamsRef = useRef(null), visionRootRef = useRef(null), customApiVersionElementRef = useRef(null), querySubscriptionRef = useRef(void 0), listenSubscriptionRef = useRef(void 0), [localStorage2] = useState(() => getLocalStorage(projectId || "default")), storedDataset = localStorage2.get("dataset", defaultDataset), storedApiVersion = localStorage2.get("apiVersion", prefixApiVersion(`${config.defaultApiVersion}`)), storedQuery = localStorage2.get("query", ""), storedParams = localStorage2.get("params", `{
1543
1533
 
1544
- }`), $[10] = localStorage2, $[11] = t4) : t4 = $[11];
1545
- const storedParams = t4;
1546
- let t5;
1547
- $[12] !== localStorage2 ? (t5 = localStorage2.get("perspective", void 0), $[12] = localStorage2, $[13] = t5) : t5 = $[13];
1548
- const storedPerspective = t5;
1549
- let t6;
1550
- $[14] !== datasets || $[15] !== defaultDataset || $[16] !== storedDataset ? (t6 = () => datasets.includes(storedDataset) ? storedDataset : datasets.includes(defaultDataset) ? defaultDataset : datasets[0], $[14] = datasets, $[15] = defaultDataset, $[16] = storedDataset, $[17] = t6) : t6 = $[17];
1551
- const [dataset, setDataset] = useState(t6);
1552
- let t7;
1553
- $[18] !== storedApiVersion ? (t7 = () => API_VERSIONS.includes(storedApiVersion) ? storedApiVersion : DEFAULT_API_VERSION, $[18] = storedApiVersion, $[19] = t7) : t7 = $[19];
1554
- const [apiVersion, setApiVersion] = useState(t7);
1555
- let t8;
1556
- $[20] !== storedApiVersion ? (t8 = () => API_VERSIONS.includes(storedApiVersion) ? !1 : storedApiVersion, $[20] = storedApiVersion, $[21] = t8) : t8 = $[21];
1557
- const [customApiVersion, setCustomApiVersion] = useState(t8), [perspective, setPerspectiveState] = useState(storedPerspective || "raw");
1558
- let t9;
1559
- $[22] !== customApiVersion ? (t9 = customApiVersion ? validateApiVersion(customApiVersion) : !0, $[22] = customApiVersion, $[23] = t9) : t9 = $[23];
1560
- const isValidApiVersion = t9, [url, setUrl] = useState(void 0);
1561
- let t10;
1562
- $[24] !== storedQuery ? (t10 = () => typeof storedQuery == "string" ? storedQuery : "", $[24] = storedQuery, $[25] = t10) : t10 = $[25];
1563
- const [query, setQuery] = useState(t10), [rawParams, setRawParams] = useState(storedParams);
1564
- let t11;
1565
- $[26] !== rawParams || $[27] !== t ? (t11 = parseParams(rawParams, t), $[26] = rawParams, $[27] = t, $[28] = t11) : t11 = $[28];
1566
- const params = t11, [queryResult, setQueryResult] = useState(void 0);
1567
- let t12;
1568
- $[29] === Symbol.for("react.memo_cache_sentinel") ? (t12 = [], $[29] = t12) : t12 = $[29];
1569
- const [listenMutations, setListenMutations] = useState(t12), [error, setError] = useState(void 0), [queryTime, setQueryTime] = useState(void 0), [e2eTime, setE2eTime] = useState(void 0), [queryInProgress, setQueryInProgress] = useState(!1), [listenInProgress, setListenInProgress] = useState(!1), [isQueryRecallCollapsed, setIsQueryRecallCollapsed] = useState(!1);
1570
- let t13;
1571
- $[30] === Symbol.for("react.memo_cache_sentinel") ? (t13 = {
1572
- visionRootRef
1573
- }, $[30] = t13) : t13 = $[30];
1574
- const {
1534
+ }`), storedPerspective = localStorage2.get("perspective", void 0), [dataset, setDataset] = useState(() => datasets.includes(storedDataset) ? storedDataset : datasets.includes(defaultDataset) ? defaultDataset : datasets[0]), [apiVersion, setApiVersion] = useState(() => API_VERSIONS.includes(storedApiVersion) ? storedApiVersion : DEFAULT_API_VERSION), [customApiVersion, setCustomApiVersion] = useState(() => API_VERSIONS.includes(storedApiVersion) ? !1 : storedApiVersion), [perspective, setPerspectiveState] = useState(storedPerspective || "raw"), isValidApiVersion = customApiVersion ? validateApiVersion(customApiVersion) : !0, [url, setUrl] = useState(void 0), [query, setQuery] = useState(() => typeof storedQuery == "string" ? storedQuery : ""), [rawParams, setRawParams] = useState(storedParams), params = useMemo(() => parseParams(rawParams, t), [rawParams, t]), [queryResult, setQueryResult] = useState(void 0), [listenMutations, setListenMutations] = useState([]), [error, setError] = useState(void 0), [queryTime, setQueryTime] = useState(void 0), [e2eTime, setE2eTime] = useState(void 0), [queryInProgress, setQueryInProgress] = useState(!1), [listenInProgress, setListenInProgress] = useState(!1), [isQueryRecallCollapsed, setIsQueryRecallCollapsed] = useState(!1), {
1575
1535
  paneSizeOptions,
1576
1536
  isNarrowBreakpoint
1577
- } = usePaneSize(t13), t14 = isValidApiVersion && customApiVersion ? customApiVersion : apiVersion;
1578
- let t15;
1579
- $[31] !== t14 ? (t15 = {
1580
- apiVersion: t14
1581
- }, $[31] = t14, $[32] = t15) : t15 = $[32];
1582
- const _client = useClient(t15);
1583
- let t16;
1584
- $[33] !== _client || $[34] !== apiVersion || $[35] !== customApiVersion || $[36] !== dataset || $[37] !== isValidApiVersion || $[38] !== perspective || $[39] !== perspectiveStack ? (t16 = _client.withConfig({
1537
+ } = usePaneSize({
1538
+ visionRootRef
1539
+ }), scheduledDraftsStack = useMemo(() => {
1540
+ if (!isScheduledDraftsEnabled) return;
1541
+ const scheduledDraftReleases = releases.filter((release) => isCardinalityOneRelease(release) && release.state === "scheduled"), releaseIds = sortReleases(scheduledDraftReleases).map((release_0) => getReleaseIdFromReleaseDocumentId(release_0._id)), defaultPerspective = isDraftModelEnabled ? ["drafts"] : ["published"];
1542
+ return [...releaseIds, ...defaultPerspective];
1543
+ }, [releases, isDraftModelEnabled, isScheduledDraftsEnabled]), _client = useClient({
1544
+ apiVersion: isValidApiVersion && customApiVersion ? customApiVersion : apiVersion
1545
+ }), client = useMemo(() => _client.withConfig({
1585
1546
  apiVersion: isValidApiVersion && customApiVersion ? customApiVersion : apiVersion,
1586
1547
  perspective: getActivePerspective({
1587
1548
  visionPerspective: perspective,
1588
- perspectiveStack
1549
+ perspectiveStack,
1550
+ scheduledDraftsStack
1589
1551
  }),
1590
1552
  dataset,
1591
1553
  allowReconfigure: !0
1592
- }), $[33] = _client, $[34] = apiVersion, $[35] = customApiVersion, $[36] = dataset, $[37] = isValidApiVersion, $[38] = perspective, $[39] = perspectiveStack, $[40] = t16) : t16 = $[40];
1593
- const client = t16;
1594
- let t17;
1595
- $[41] === Symbol.for("react.memo_cache_sentinel") ? (t17 = () => {
1554
+ }), [perspectiveStack, scheduledDraftsStack, perspective, customApiVersion, apiVersion, dataset, _client, isValidApiVersion]), cancelQuerySubscription = useCallback(() => {
1596
1555
  querySubscriptionRef.current && (querySubscriptionRef.current.unsubscribe(), querySubscriptionRef.current = void 0);
1597
- }, $[41] = t17) : t17 = $[41];
1598
- const cancelQuerySubscription = t17;
1599
- let t18;
1600
- $[42] === Symbol.for("react.memo_cache_sentinel") ? (t18 = () => {
1556
+ }, []), cancelListenerSubscription = useCallback(() => {
1601
1557
  listenSubscriptionRef.current && (listenSubscriptionRef.current.unsubscribe(), listenSubscriptionRef.current = void 0);
1602
- }, $[42] = t18) : t18 = $[42];
1603
- const cancelListenerSubscription = t18;
1604
- let t19;
1605
- $[43] !== apiVersion || $[44] !== client || $[45] !== customApiVersion || $[46] !== dataset || $[47] !== isValidApiVersion || $[48] !== localStorage2 || $[49] !== params.parsed || $[50] !== perspective || $[51] !== perspectiveStack || $[52] !== query || $[53] !== queryInProgress || $[54] !== t ? (t19 = (options) => {
1558
+ }, []), handleQueryExecution = useCallback((options) => {
1606
1559
  if (queryInProgress) {
1607
1560
  cancelQuerySubscription(), cancelListenerSubscription(), setQueryInProgress(!1);
1608
1561
  return;
@@ -1612,8 +1565,9 @@ function VisionGui(props) {
1612
1565
  dataset: options?.dataset || dataset,
1613
1566
  params: parseParams(JSON.stringify(options?.params || params.parsed, null, 2), t),
1614
1567
  perspective: getActivePerspective({
1615
- visionPerspective: options?.perspective || perspective,
1616
- perspectiveStack
1568
+ visionPerspective: options && "perspective" in options ? options.perspective : perspective,
1569
+ perspectiveStack,
1570
+ scheduledDraftsStack
1617
1571
  }),
1618
1572
  apiVersion: options?.apiVersion || (customApiVersion && isValidApiVersion ? customApiVersion : apiVersion)
1619
1573
  };
@@ -1639,25 +1593,16 @@ function VisionGui(props) {
1639
1593
  setError(err), setQueryInProgress(!1);
1640
1594
  }
1641
1595
  });
1642
- }, $[43] = apiVersion, $[44] = client, $[45] = customApiVersion, $[46] = dataset, $[47] = isValidApiVersion, $[48] = localStorage2, $[49] = params.parsed, $[50] = perspective, $[51] = perspectiveStack, $[52] = query, $[53] = queryInProgress, $[54] = t, $[55] = t19) : t19 = $[55];
1643
- const handleQueryExecution = t19;
1644
- let t20;
1645
- $[56] !== handleQueryExecution || $[57] !== localStorage2 ? (t20 = (newPerspective) => {
1596
+ }, [queryInProgress, query, dataset, params.parsed, t, perspective, perspectiveStack, scheduledDraftsStack, customApiVersion, isValidApiVersion, apiVersion, localStorage2, cancelListenerSubscription, client, cancelQuerySubscription]), setPerspective = useCallback((newPerspective) => {
1646
1597
  newPerspective !== void 0 && !isSupportedPerspective(newPerspective) || (setPerspectiveState(newPerspective), localStorage2.set("perspective", newPerspective), handleQueryExecution({
1647
1598
  perspective: newPerspective
1648
1599
  }));
1649
- }, $[56] = handleQueryExecution, $[57] = localStorage2, $[58] = t20) : t20 = $[58];
1650
- const setPerspective = t20;
1651
- let t21;
1652
- $[59] !== handleQueryExecution || $[60] !== localStorage2 ? (t21 = (evt) => {
1600
+ }, [localStorage2, handleQueryExecution]), handleChangeDataset = useCallback((evt) => {
1653
1601
  const newDataset = evt.target.value;
1654
1602
  localStorage2.set("dataset", newDataset), setDataset(newDataset), handleQueryExecution({
1655
1603
  dataset: newDataset
1656
1604
  });
1657
- }, $[59] = handleQueryExecution, $[60] = localStorage2, $[61] = t21) : t21 = $[61];
1658
- const handleChangeDataset = t21;
1659
- let t22;
1660
- $[62] !== handleQueryExecution || $[63] !== localStorage2 ? (t22 = (evt_0) => {
1605
+ }, [localStorage2, handleQueryExecution]), handleChangeApiVersion = useCallback((evt_0) => {
1661
1606
  const newApiVersion = evt_0.target.value;
1662
1607
  if (newApiVersion?.toLowerCase() === "other") {
1663
1608
  setCustomApiVersion("v"), customApiVersionElementRef.current?.focus();
@@ -1666,29 +1611,17 @@ function VisionGui(props) {
1666
1611
  setApiVersion(newApiVersion), setCustomApiVersion(!1), localStorage2.set("apiVersion", newApiVersion), handleQueryExecution({
1667
1612
  apiVersion: newApiVersion
1668
1613
  });
1669
- }, $[62] = handleQueryExecution, $[63] = localStorage2, $[64] = t22) : t22 = $[64];
1670
- const handleChangeApiVersion = t22;
1671
- let t23;
1672
- $[65] !== handleQueryExecution || $[66] !== localStorage2 ? (t23 = (evt_1) => {
1614
+ }, [localStorage2, handleQueryExecution]), handleCustomApiVersionChange = useCallback((evt_1) => {
1673
1615
  const newCustomApiVersion = evt_1.target.value || "";
1674
1616
  setCustomApiVersion(newCustomApiVersion || "v"), validateApiVersion(newCustomApiVersion) && (setApiVersion(newCustomApiVersion), localStorage2.set("apiVersion", newCustomApiVersion), handleQueryExecution({
1675
1617
  apiVersion: newCustomApiVersion
1676
1618
  }));
1677
- }, $[65] = handleQueryExecution, $[66] = localStorage2, $[67] = t23) : t23 = $[67];
1678
- const handleCustomApiVersionChange = t23;
1679
- let t24;
1680
- $[68] !== setPerspective ? (t24 = (evt_2) => {
1619
+ }, [localStorage2, handleQueryExecution]), handleChangePerspective = useCallback((evt_2) => {
1681
1620
  const newPerspective_0 = evt_2.target.value;
1682
1621
  setPerspective(newPerspective_0 === "default" ? void 0 : newPerspective_0);
1683
- }, $[68] = setPerspective, $[69] = t24) : t24 = $[69];
1684
- const handleChangePerspective = t24;
1685
- let t25;
1686
- $[70] === Symbol.for("react.memo_cache_sentinel") ? (t25 = (evt_3) => {
1622
+ }, [setPerspective]), handleListenerEvent = useCallback((evt_3) => {
1687
1623
  evt_3.type === "mutation" && setListenMutations((prevMutations) => prevMutations.length === 50 ? [evt_3, ...prevMutations.slice(0, 49)] : [evt_3, ...prevMutations]);
1688
- }, $[70] = t25) : t25 = $[70];
1689
- const handleListenerEvent = t25;
1690
- let t26;
1691
- $[71] !== client || $[72] !== listenInProgress || $[73] !== localStorage2 || $[74] !== params.error || $[75] !== params.parsed || $[76] !== params.raw || $[77] !== query ? (t26 = () => {
1624
+ }, []), handleListenExecution = useCallback(() => {
1692
1625
  if (listenInProgress) {
1693
1626
  cancelListenerSubscription(), setListenInProgress(!1);
1694
1627
  return;
@@ -1703,21 +1636,14 @@ function VisionGui(props) {
1703
1636
  setError(err_0), setListenInProgress(!1);
1704
1637
  }
1705
1638
  }));
1706
- }, $[71] = client, $[72] = listenInProgress, $[73] = localStorage2, $[74] = params.error, $[75] = params.parsed, $[76] = params.raw, $[77] = query, $[78] = t26) : t26 = $[78];
1707
- const handleListenExecution = t26;
1708
- let t27;
1709
- $[79] !== localStorage2 ? (t27 = (value) => {
1639
+ }, [listenInProgress, params, query, localStorage2, cancelQuerySubscription, handleListenerEvent, cancelListenerSubscription, client]), handleParamsChange = useCallback((value) => {
1710
1640
  setRawParams(value), localStorage2.set("params", value);
1711
- }, $[79] = localStorage2, $[80] = t27) : t27 = $[80];
1712
- const handleParamsChange = t27;
1713
- let t28;
1714
- $[81] !== apiVersion || $[82] !== dataset || $[83] !== datasets || $[84] !== perspective || $[85] !== toast ? (t28 = (data) => {
1641
+ }, [localStorage2]), getStateFromUrl = useCallback((data) => {
1715
1642
  const match = data.match(sanityUrl);
1716
1643
  if (!match)
1717
1644
  return null;
1718
1645
  const [, usedApiVersion, usedDataset, urlQuery] = match, qs = new URLSearchParams(urlQuery), parts = parseApiQueryString(qs);
1719
- if (!parts)
1720
- return null;
1646
+ if (!parts) return null;
1721
1647
  let newApiVersion_0, newCustomApiVersion_0;
1722
1648
  validateApiVersion(usedApiVersion) && (API_VERSIONS.includes(usedApiVersion) ? (newApiVersion_0 = usedApiVersion, newCustomApiVersion_0 = !1) : newCustomApiVersion_0 = usedApiVersion);
1723
1649
  const newPerspective_1 = isSupportedPerspective(parts.options.perspective) && !isVirtualPerspective(parts.options.perspective) ? parts.options.perspective : void 0;
@@ -1736,10 +1662,7 @@ function VisionGui(props) {
1736
1662
  perspective: newPerspective_1 || perspective,
1737
1663
  url: data
1738
1664
  };
1739
- }, $[81] = apiVersion, $[82] = dataset, $[83] = datasets, $[84] = perspective, $[85] = toast, $[86] = t28) : t28 = $[86];
1740
- const getStateFromUrl = t28;
1741
- let t29;
1742
- $[87] !== handleQueryExecution || $[88] !== localStorage2 ? (t29 = (parsedUrlObj) => {
1665
+ }, [datasets, dataset, apiVersion, perspective, toast]), setStateFromParsedUrl = useCallback((parsedUrlObj) => {
1743
1666
  setDataset(parsedUrlObj.dataset), setQuery(parsedUrlObj.query), setRawParams(parsedUrlObj.rawParams), setApiVersion(parsedUrlObj.apiVersion), parsedUrlObj.customApiVersion && setCustomApiVersion(parsedUrlObj.customApiVersion), setPerspectiveState(parsedUrlObj.perspective), setUrl(parsedUrlObj.url), editorQueryRef.current?.resetEditorContent(parsedUrlObj.query), editorParamsRef.current?.resetEditorContent(parsedUrlObj.rawParams), localStorage2.merge({
1744
1667
  query: parsedUrlObj.query,
1745
1668
  params: parsedUrlObj.rawParams,
@@ -1747,10 +1670,7 @@ function VisionGui(props) {
1747
1670
  apiVersion: parsedUrlObj.customApiVersion || parsedUrlObj.apiVersion,
1748
1671
  perspective: parsedUrlObj.perspective
1749
1672
  }), handleQueryExecution(parsedUrlObj);
1750
- }, $[87] = handleQueryExecution, $[88] = localStorage2, $[89] = t29) : t29 = $[89];
1751
- const setStateFromParsedUrl = t29;
1752
- let t30;
1753
- $[90] !== getStateFromUrl || $[91] !== setStateFromParsedUrl || $[92] !== toast ? (t30 = (evt_4) => {
1673
+ }, [localStorage2, handleQueryExecution]), handlePaste = useCallback((evt_4) => {
1754
1674
  if (!evt_4.clipboardData)
1755
1675
  return;
1756
1676
  const data_0 = evt_4.clipboardData.getData("text/plain");
@@ -1762,124 +1682,75 @@ function VisionGui(props) {
1762
1682
  status: "info",
1763
1683
  title: "Parsed URL to query"
1764
1684
  }));
1765
- }, $[90] = getStateFromUrl, $[91] = setStateFromParsedUrl, $[92] = toast, $[93] = t30) : t30 = $[93];
1766
- const handlePaste = t30;
1767
- let t31;
1768
- $[94] !== handleQueryExecution || $[95] !== params.valid ? (t31 = (event) => {
1685
+ }, [getStateFromUrl, setStateFromParsedUrl, toast]), handleKeyDown = useCallback((event) => {
1769
1686
  const isWithinRoot = visionRootRef.current && nodeContains(visionRootRef.current, event.target);
1770
1687
  isRunHotkey(event) && isWithinRoot && params.valid && (handleQueryExecution(), event.preventDefault(), event.stopPropagation());
1771
- }, $[94] = handleQueryExecution, $[95] = params.valid, $[96] = t31) : t31 = $[96];
1772
- const handleKeyDown = t31;
1773
- let t32, t33;
1774
- $[97] !== handleKeyDown || $[98] !== handlePaste ? (t32 = () => (window.document.addEventListener("paste", handlePaste), window.document.addEventListener("keydown", handleKeyDown), () => {
1688
+ }, [params.valid, handleQueryExecution]);
1689
+ useEffect(() => (window.document.addEventListener("paste", handlePaste), window.document.addEventListener("keydown", handleKeyDown), () => {
1775
1690
  window.document.removeEventListener("paste", handlePaste), window.document.removeEventListener("keydown", handleKeyDown);
1776
- }), t33 = [handleKeyDown, handlePaste], $[97] = handleKeyDown, $[98] = handlePaste, $[99] = t32, $[100] = t33) : (t32 = $[99], t33 = $[100]), useEffect(t32, t33);
1777
- let t34, t35;
1778
- $[101] === Symbol.for("react.memo_cache_sentinel") ? (t34 = () => () => {
1691
+ }), [handleKeyDown, handlePaste]), useEffect(() => () => {
1779
1692
  cancelQuerySubscription(), cancelListenerSubscription();
1780
- }, t35 = [cancelQuerySubscription, cancelListenerSubscription], $[101] = t34, $[102] = t35) : (t34 = $[101], t35 = $[102]), useEffect(t34, t35);
1781
- let t36;
1782
- $[103] !== setPerspective ? (t36 = (stack) => {
1693
+ }, [cancelQuerySubscription, cancelListenerSubscription]);
1694
+ const handleStudioPerspectiveChange = useEffectEvent((stack) => {
1783
1695
  stack.length > 0 && setPerspective("pinnedRelease");
1784
- }, $[103] = setPerspective, $[104] = t36) : t36 = $[104];
1785
- const handleStudioPerspectiveChange = useEffectEvent(t36);
1786
- let t37;
1787
- $[105] !== handleStudioPerspectiveChange || $[106] !== perspectiveStack ? (t37 = () => {
1696
+ });
1697
+ useEffect(() => {
1788
1698
  handleStudioPerspectiveChange(perspectiveStack);
1789
- }, $[105] = handleStudioPerspectiveChange, $[106] = perspectiveStack, $[107] = t37) : t37 = $[107];
1790
- let t38;
1791
- $[108] !== perspectiveStack ? (t38 = [perspectiveStack], $[108] = perspectiveStack, $[109] = t38) : t38 = $[109], useEffect(t37, t38);
1792
- let t39;
1793
- $[110] !== client || $[111] !== perspective || $[112] !== perspectiveStack ? (t39 = (queryString, queryParams) => {
1699
+ }, [perspectiveStack]);
1700
+ const generateUrl = useCallback((queryString, queryParams) => {
1794
1701
  const urlQueryOpts_0 = {
1795
1702
  perspective: getActivePerspective({
1796
1703
  visionPerspective: perspective,
1797
- perspectiveStack
1704
+ perspectiveStack,
1705
+ scheduledDraftsStack
1798
1706
  }) ?? []
1799
1707
  };
1800
1708
  return client.getUrl(client.getDataUrl("query", encodeQueryString(queryString, queryParams, urlQueryOpts_0)));
1801
- }, $[110] = client, $[111] = perspective, $[112] = perspectiveStack, $[113] = t39) : t39 = $[113];
1802
- const generateUrl = t39;
1803
- let t40;
1804
- $[114] !== apiVersion || $[115] !== customApiVersion || $[116] !== dataset || $[117] !== datasets || $[118] !== handleChangeApiVersion || $[119] !== handleChangeDataset || $[120] !== handleChangePerspective || $[121] !== handleCustomApiVersionChange || $[122] !== isValidApiVersion || $[123] !== perspective || $[124] !== url ? (t40 = /* @__PURE__ */ jsx(VisionGuiHeader, { apiVersion, customApiVersion, dataset, datasets, onChangeDataset: handleChangeDataset, onChangeApiVersion: handleChangeApiVersion, customApiVersionElementRef, onCustomApiVersionChange: handleCustomApiVersionChange, isValidApiVersion, onChangePerspective: handleChangePerspective, url, perspective }), $[114] = apiVersion, $[115] = customApiVersion, $[116] = dataset, $[117] = datasets, $[118] = handleChangeApiVersion, $[119] = handleChangeDataset, $[120] = handleChangePerspective, $[121] = handleCustomApiVersionChange, $[122] = isValidApiVersion, $[123] = perspective, $[124] = url, $[125] = t40) : t40 = $[125];
1805
- const t41 = isQueryRecallCollapsed ? window.innerWidth : window.innerWidth - 275, t42 = isNarrowBreakpoint ? "vertical" : "horizontal", t43 = isNarrowBreakpoint ? paneSizeOptions.defaultSize : paneSizeOptions.minSize, t44 = paneSizeOptions.size, t45 = paneSizeOptions.allowResize, t46 = isNarrowBreakpoint ? paneSizeOptions.minSize : 100, t47 = paneSizeOptions.maxSize;
1806
- let t48;
1807
- $[126] !== t ? (t48 = t("query.label"), $[126] = t, $[127] = t48) : t48 = $[127];
1808
- let t49;
1809
- $[128] !== t48 ? (t49 = /* @__PURE__ */ jsx(InputBackgroundContainerLeft, { children: /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(StyledLabel, { muted: !0, children: t48 }) }) }), $[128] = t48, $[129] = t49) : t49 = $[129];
1810
- let t50;
1811
- $[130] !== query ? (t50 = /* @__PURE__ */ jsx(VisionCodeMirror, { initialValue: query, onChange: setQuery, ref: editorQueryRef }), $[130] = query, $[131] = t50) : t50 = $[131];
1812
- let t51;
1813
- $[132] !== t49 || $[133] !== t50 ? (t51 = /* @__PURE__ */ jsx(InputContainer, { display: "flex", "data-testid": "vision-query-editor", children: /* @__PURE__ */ jsxs(Box, { flex: 1, children: [
1814
- t49,
1815
- t50
1816
- ] }) }), $[132] = t49, $[133] = t50, $[134] = t51) : t51 = $[134];
1817
- let t52;
1818
- $[135] !== handleParamsChange || $[136] !== params.error || $[137] !== params.raw || $[138] !== params.valid ? (t52 = /* @__PURE__ */ jsx(ParamsEditor, { value: params.raw, onChange: handleParamsChange, paramsError: params.error, hasValidParams: params.valid, editorRef: editorParamsRef }), $[135] = handleParamsChange, $[136] = params.error, $[137] = params.raw, $[138] = params.valid, $[139] = t52) : t52 = $[139];
1819
- let t53;
1820
- $[140] !== handleListenExecution || $[141] !== handleQueryExecution || $[142] !== listenInProgress || $[143] !== params.valid || $[144] !== queryInProgress ? (t53 = /* @__PURE__ */ jsx(VisionGuiControls, { hasValidParams: params.valid, queryInProgress, listenInProgress, onQueryExecution: handleQueryExecution, onListenExecution: handleListenExecution }), $[140] = handleListenExecution, $[141] = handleQueryExecution, $[142] = listenInProgress, $[143] = params.valid, $[144] = queryInProgress, $[145] = t53) : t53 = $[145];
1821
- let t54;
1822
- $[146] !== t52 || $[147] !== t53 ? (t54 = /* @__PURE__ */ jsxs(InputContainer, { display: "flex", children: [
1823
- t52,
1824
- t53
1825
- ] }), $[146] = t52, $[147] = t53, $[148] = t54) : t54 = $[148];
1826
- let t55;
1827
- $[149] !== paneSizeOptions.allowResize || $[150] !== paneSizeOptions.maxSize || $[151] !== paneSizeOptions.size || $[152] !== t43 || $[153] !== t46 || $[154] !== t51 || $[155] !== t54 ? (t55 = /* @__PURE__ */ jsx(Box, { height: "stretch", flex: 1, children: /* @__PURE__ */ jsxs(SplitPane, { className: "sidebarPanes", split: "horizontal", defaultSize: t43, size: t44, allowResize: t45, minSize: t46, maxSize: t47, primary: "first", children: [
1828
- t51,
1829
- t54
1830
- ] }) }), $[149] = paneSizeOptions.allowResize, $[150] = paneSizeOptions.maxSize, $[151] = paneSizeOptions.size, $[152] = t43, $[153] = t46, $[154] = t51, $[155] = t54, $[156] = t55) : t55 = $[156];
1831
- let t56;
1832
- $[157] !== dataset || $[158] !== e2eTime || $[159] !== error || $[160] !== listenInProgress || $[161] !== listenMutations || $[162] !== queryInProgress || $[163] !== queryResult || $[164] !== queryTime ? (t56 = /* @__PURE__ */ jsx(VisionGuiResult, { error, queryInProgress, queryResult, listenInProgress, listenMutations, dataset, queryTime, e2eTime }), $[157] = dataset, $[158] = e2eTime, $[159] = error, $[160] = listenInProgress, $[161] = listenMutations, $[162] = queryInProgress, $[163] = queryResult, $[164] = queryTime, $[165] = t56) : t56 = $[165];
1833
- let t57;
1834
- $[166] !== t42 || $[167] !== t55 || $[168] !== t56 ? (t57 = /* @__PURE__ */ jsx(Box, { height: "stretch", flex: 1, children: /* @__PURE__ */ jsxs(SplitPane, { className: "sidebarPanes", split: t42, minSize: 300, children: [
1835
- t55,
1836
- t56
1837
- ] }) }), $[166] = t42, $[167] = t55, $[168] = t56, $[169] = t57) : t57 = $[169];
1838
- let t58;
1839
- $[170] === Symbol.for("react.memo_cache_sentinel") ? (t58 = {
1840
- position: "relative",
1841
- height: "100%"
1842
- }, $[170] = t58) : t58 = $[170];
1843
- let t59;
1844
- $[171] === Symbol.for("react.memo_cache_sentinel") ? (t59 = {
1845
- position: "absolute",
1846
- left: -32,
1847
- top: "50%",
1848
- transform: "translateY(-50%)",
1849
- zIndex: 100,
1850
- pointerEvents: "auto"
1851
- }, $[171] = t59) : t59 = $[171];
1852
- let t60;
1853
- $[172] !== isQueryRecallCollapsed ? (t60 = () => setIsQueryRecallCollapsed(!isQueryRecallCollapsed), $[172] = isQueryRecallCollapsed, $[173] = t60) : t60 = $[173];
1854
- let t61;
1855
- $[174] === Symbol.for("react.memo_cache_sentinel") ? (t61 = {
1856
- display: "flex",
1857
- alignItems: "center",
1858
- height: "100%"
1859
- }, $[174] = t61) : t61 = $[174];
1860
- let t62;
1861
- $[175] !== isQueryRecallCollapsed ? (t62 = /* @__PURE__ */ jsx("div", { style: t61, children: isQueryRecallCollapsed ? /* @__PURE__ */ jsx(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx(ChevronRightIcon, {}) }), $[175] = isQueryRecallCollapsed, $[176] = t62) : t62 = $[176];
1862
- let t63;
1863
- $[177] !== t60 || $[178] !== t62 ? (t63 = /* @__PURE__ */ jsx(Button, { mode: "ghost", padding: 2, style: t59, onClick: t60, children: t62 }), $[177] = t60, $[178] = t62, $[179] = t63) : t63 = $[179];
1864
- let t64;
1865
- $[180] !== params.parsed ? (t64 = params.parsed || {}, $[180] = params.parsed, $[181] = t64) : t64 = $[181];
1866
- let t65;
1867
- $[182] !== generateUrl || $[183] !== getStateFromUrl || $[184] !== query || $[185] !== setStateFromParsedUrl || $[186] !== t64 || $[187] !== url ? (t65 = /* @__PURE__ */ jsx(QueryRecall, { url, getStateFromUrl, setStateFromParsedUrl, currentQuery: query, currentParams: t64, generateUrl }), $[182] = generateUrl, $[183] = getStateFromUrl, $[184] = query, $[185] = setStateFromParsedUrl, $[186] = t64, $[187] = url, $[188] = t65) : t65 = $[188];
1868
- let t66;
1869
- $[189] !== t63 || $[190] !== t65 ? (t66 = /* @__PURE__ */ jsxs(Box, { style: t58, children: [
1870
- t63,
1871
- t65
1872
- ] }), $[189] = t63, $[190] = t65, $[191] = t66) : t66 = $[191];
1873
- let t67;
1874
- $[192] !== t41 || $[193] !== t57 || $[194] !== t66 ? (t67 = /* @__PURE__ */ jsx(SplitpaneContainer, { flex: "auto", children: /* @__PURE__ */ jsxs(SplitPane, { minSize: 800, defaultSize: window.innerWidth - 275, size: t41, maxSize: -225, primary: "first", children: [
1875
- t57,
1876
- t66
1877
- ] }) }), $[192] = t41, $[193] = t57, $[194] = t66, $[195] = t67) : t67 = $[195];
1878
- let t68;
1879
- return $[196] !== t40 || $[197] !== t67 ? (t68 = /* @__PURE__ */ jsxs(Root, { direction: "column", height: "fill", ref: visionRootRef, sizing: "border", overflow: "hidden", "data-testid": "vision-root", children: [
1880
- t40,
1881
- t67
1882
- ] }), $[196] = t40, $[197] = t67, $[198] = t68) : t68 = $[198], t68;
1709
+ }, [client, perspective, perspectiveStack, scheduledDraftsStack]);
1710
+ return /* @__PURE__ */ jsxs(Root, { direction: "column", height: "fill", ref: visionRootRef, sizing: "border", overflow: "hidden", "data-testid": "vision-root", children: [
1711
+ /* @__PURE__ */ jsx(VisionGuiHeader, { apiVersion, customApiVersion, dataset, datasets, onChangeDataset: handleChangeDataset, onChangeApiVersion: handleChangeApiVersion, customApiVersionElementRef, onCustomApiVersionChange: handleCustomApiVersionChange, isValidApiVersion, onChangePerspective: handleChangePerspective, url, perspective, isScheduledDraftsEnabled }),
1712
+ /* @__PURE__ */ jsx(SplitpaneContainer, { flex: "auto", children: /* @__PURE__ */ jsxs(SplitPane, { minSize: 800, defaultSize: window.innerWidth - 275, size: isQueryRecallCollapsed ? window.innerWidth : window.innerWidth - 275, maxSize: -225, primary: "first", children: [
1713
+ /* @__PURE__ */ jsx(Box, { height: "stretch", flex: 1, children: /* @__PURE__ */ jsxs(
1714
+ SplitPane,
1715
+ {
1716
+ className: "sidebarPanes",
1717
+ split: isNarrowBreakpoint ? "vertical" : "horizontal",
1718
+ minSize: 300,
1719
+ children: [
1720
+ /* @__PURE__ */ jsx(Box, { height: "stretch", flex: 1, children: /* @__PURE__ */ jsxs(SplitPane, { className: "sidebarPanes", split: "horizontal", defaultSize: isNarrowBreakpoint ? paneSizeOptions.defaultSize : paneSizeOptions.minSize, size: paneSizeOptions.size, allowResize: paneSizeOptions.allowResize, minSize: isNarrowBreakpoint ? paneSizeOptions.minSize : 100, maxSize: paneSizeOptions.maxSize, primary: "first", children: [
1721
+ /* @__PURE__ */ jsx(InputContainer, { display: "flex", "data-testid": "vision-query-editor", children: /* @__PURE__ */ jsxs(Box, { flex: 1, children: [
1722
+ /* @__PURE__ */ jsx(InputBackgroundContainerLeft, { children: /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(StyledLabel, { muted: !0, children: t("query.label") }) }) }),
1723
+ /* @__PURE__ */ jsx(VisionCodeMirror, { initialValue: query, onChange: setQuery, ref: editorQueryRef })
1724
+ ] }) }),
1725
+ /* @__PURE__ */ jsxs(InputContainer, { display: "flex", children: [
1726
+ /* @__PURE__ */ jsx(ParamsEditor, { value: params.raw, onChange: handleParamsChange, paramsError: params.error, hasValidParams: params.valid, editorRef: editorParamsRef }),
1727
+ /* @__PURE__ */ jsx(VisionGuiControls, { hasValidParams: params.valid, queryInProgress, listenInProgress, onQueryExecution: handleQueryExecution, onListenExecution: handleListenExecution })
1728
+ ] })
1729
+ ] }) }),
1730
+ /* @__PURE__ */ jsx(VisionGuiResult, { error, queryInProgress, queryResult, listenInProgress, listenMutations, dataset, queryTime, e2eTime })
1731
+ ]
1732
+ }
1733
+ ) }),
1734
+ /* @__PURE__ */ jsxs(Box, { style: {
1735
+ position: "relative",
1736
+ height: "100%"
1737
+ }, children: [
1738
+ /* @__PURE__ */ jsx(Button, { mode: "ghost", padding: 2, style: {
1739
+ position: "absolute",
1740
+ left: -32,
1741
+ top: "50%",
1742
+ transform: "translateY(-50%)",
1743
+ zIndex: 100,
1744
+ pointerEvents: "auto"
1745
+ }, onClick: () => setIsQueryRecallCollapsed(!isQueryRecallCollapsed), children: /* @__PURE__ */ jsx("div", { style: {
1746
+ display: "flex",
1747
+ alignItems: "center",
1748
+ height: "100%"
1749
+ }, children: isQueryRecallCollapsed ? /* @__PURE__ */ jsx(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx(ChevronRightIcon, {}) }) }),
1750
+ /* @__PURE__ */ jsx(QueryRecall, { url, getStateFromUrl, setStateFromParsedUrl, currentQuery: query, currentParams: params.parsed || {}, generateUrl })
1751
+ ] })
1752
+ ] }) })
1753
+ ] });
1883
1754
  }
1884
1755
  function useDatasets(t0) {
1885
1756
  const $ = c(7), {