import { $o as PatchEvent, C as StateTree, Ci as OnPathFocusPayload, Eo as FormFieldGroup, Fi as RenderItemCallback, Ii as RenderPreviewCallback, Ir as SearchFieldDefinitionDictionary, Jr as FormBuilderFilterFieldFn, Mi as RenderBlockCallback, Ni as RenderFieldCallback, Pi as RenderInputCallback, Rr as AuthState, Ti as PortableTextInputProps, Xr as FormBuilderMarkersComponent, as as FormPatch, b as FormState, dc as DiffComponentOptions, f as PatchChannel, gr as SearchOperatorDefinitionDictionary, ki as RenderAnnotationCallback, lr as Template, na as ObjectFormNode, nn as WorkspaceSummary, oa as ArrayOfObjectsItemMember, qa as ReleaseId, qr as FormBuilderCustomMarkersComponent, sr as InitialValueTemplateItem, uc as DiffComponent, vr as SearchFilterDefinitionDictionary, xc as ObjectDiff, y as FormDocumentValue } from "./types-1fG14RfY.js";
import { ComponentType, Dispatch, ElementType, HTMLProps, ReactNode, RefAttributes, SetStateAction } from "react";
import { Observable, Subject } from "rxjs";
import { AssetSource, CrossDatasetType, CurrentUser, InitialValueResolverContext, KeyedObject, ObjectSchemaType, Path, PathSegment, PortableTextBlock, SanityDocument, SanityDocumentLike, Schema, SchemaType, SearchStrategy, User, ValidationMarker, WeakGlobalDocumentReferenceValue } from "@sanity/types";
import { ClientPerspective, CollaborationCommentFieldValue, CollaborationCommentRange, CollaborationCommentReactionShortName, HttpError, SanityClient, SanityDocument as SanityDocument$1, isTimeoutError } from "@sanity/client";
import { PaddingProps } from "ui5";
import { ButtonTone, CardProps } from "@sanity/ui";
import { ScrollToOptions } from "@tanstack/react-virtual";
import { ColorHueKey, ColorTints } from "@sanity/color";
import { IntentParameters, RouterState } from "sanity/router";
import { BrowserHistory, HashHistory, History, MemoryHistory } from "history";
/** @internal */
interface ConnectorContextValue {
  isReviewChangesOpen: boolean;
  onOpenReviewChanges: () => void | undefined;
  onSetFocus: (nextPath: Path) => void | undefined;
  isInteractive?: boolean;
}
/**
 * @hidden
 * @beta */
type DocumentValuePermission = 'read' | 'create' | 'update' | 'history' | 'editHistory';
/** @internal */
interface Grant {
  filter: string;
  permissions: DocumentValuePermission[];
}
/**
 * @hidden
 * @beta */
interface PermissionCheckResult {
  granted: boolean;
  reason: string;
}
/**
 * @hidden
 * @beta */
interface GrantsStore {
  /**
   * Returns an observable of `PermissionCheckResult`
   *
   * This API is returns an observable (vs a promise) so the consumer can react
   * to incoming changes to the user permissions (e.g. for changing _debug_
   * roles).
   *
   * This API also accepts a `null` document in which it should return
   * `granted: true`
   */
  checkDocumentPermission(checkPermissionName: DocumentValuePermission, document: Partial<SanityDocument> | null): Observable<PermissionCheckResult>;
}
/** @internal */
interface EvaluationParams {
  identity?: string;
}
type Loadable$1<T> = {
  data: T | null;
  error: Error | null;
  loading: boolean;
};
/**
 * @beta
 * @hidden
 */
type UserListWithPermissionsHookValue = Loadable$1<UserWithPermission[]> & {
  /** when true, comments has mention feature disabled
   * @internal
   * */
  disabled?: boolean;
};
/**
 * @beta
 * @hidden
 */
interface UserWithPermission extends User {
  granted: boolean;
  projectUserId?: string;
}
/**
 * @beta
 */
interface UserListWithPermissionsOptions {
  documentValue: SanityDocument$1 | null;
  permission: DocumentValuePermission;
}
/**
 * @beta
 * Returns a list of users with the specified permission on the document.
 * If no document is provided it will return all as `granted: true`
 */
declare function useUserListWithPermissions(opts: UserListWithPermissionsOptions): UserListWithPermissionsHookValue;
/**
 * @beta
 * @hidden
 */
interface Loadable<T> {
  data: T | null;
  error: Error | null;
  loading: boolean;
}
/**
 * @beta
 * @hidden
 */
interface CommentUpdateOperationOptions$1 {
  throttled: boolean;
}
/**
 * @beta
 * @hidden
 */
interface CommentOperations$1 {
  create: (comment: CommentCreatePayload$1) => Promise<void>;
  react: (id: string, reaction: CommentReactionOption$1) => Promise<void>;
  remove: (id: string) => Promise<void>;
  update: (id: string, comment: CommentUpdatePayload$1, opts?: CommentUpdateOperationOptions$1) => Promise<void>;
}
/**
 * @beta
 * @hidden
 */
interface CommentThreadItem$1 {
  breadcrumbs: CommentListBreadcrumbs$1;
  commentsCount: number;
  fieldPath: string;
  hasReferencedValue: boolean;
  parentComment: CommentDocument$1;
  replies: CommentDocument$1[];
  threadId: string;
}
/**
 * @beta
 * @hidden
 */
type CommentMessage$1 = PortableTextBlock[] | null;
/**
 * @beta
 * @hidden
 */
type CommentStatus$1 = 'open' | 'resolved';
/**
 * @beta
 * @hidden
 */
interface CommentsTextSelectionItem$1 {
  _key: string;
  text: string;
}
/**
 * @beta
 * @hidden
 */
interface CommentTextSelection$1 {
  type: 'text';
  value: CommentsTextSelectionItem$1[];
}
type CommentPathSelection$1 = CommentTextSelection$1;
/**
 * @beta
 * @hidden
 */
interface CommentPath$1 {
  field: string;
  selection?: CommentPathSelection$1;
}
/**
 * @beta
 * @hidden
 */
interface CommentContext$1 {
  tool: string;
  payload?: Record<string, unknown>;
  notification?: {
    documentTitle: string;
    url?: string;
    workspaceTitle: string;
    workspaceName: string;
    currentThreadLength?: number;
    subscribers?: string[];
  };
  intent?: {
    title: string;
    name: string;
    params: IntentParameters;
  };
}
/**
 * @beta
 * @hidden
 */
type CommentIntentGetter = (comment: {
  id: string;
  type: string;
  path: string;
}) => CommentContext$1['intent'];
interface CommentCreateRetryingState$1 {
  type: 'createRetrying';
}
interface CommentCreateFailedState$1 {
  type: 'createError';
  error: Error;
}
/**
 * @beta
 * @hidden
 * The short names for the comment reactions.
 * We follow the convention for short names outlined in https://projects.iamcal.com/emoji-data/table.htm.
 */
type CommentReactionShortNames$1 = ':-1:' | ':+1:' | ':eyes:' | ':heart:' | ':heavy_plus_sign:' | ':rocket:';
/**
 * @beta
 * @hidden
 */
interface CommentReactionOption$1 {
  shortName: CommentReactionShortNames$1;
  title: string;
}
/**
 * @beta
 * @hidden
 */
interface CommentReactionItem$1 {
  _key: string;
  shortName: CommentReactionShortNames$1;
  userId: string;
  addedAt: string;
  /**
   * This is a local value and is not stored on the server.
   * It is used to track the optimistic state of the reaction.
   */
  _optimisticState?: 'added' | 'removed';
}
/**
 * @beta
 * @hidden
 */
type CommentsType$1 = 'field' | 'task';
/**
 * The state is used to track the state of the comment (e.g. if it failed to be created, etc.)
 * It is a local value and is not stored on the server.
 * When there's no state, the comment is considered to be in a "normal" state (e.g. created successfully).
 *
 * The state value is primarily used to update the UI. That is, to show an error message or retry button.
 */
type CommentState$1 = CommentCreateFailedState$1 | CommentCreateRetryingState$1 | undefined;
/**
 * @beta
 * @hidden
 */
interface CommentDocument$1 {
  _type: 'comment';
  _createdAt: string;
  _id: string;
  _rev: string;
  _state?: CommentState$1;
  authorId: string;
  message: CommentMessage$1;
  threadId: string;
  parentCommentId?: string;
  status: CommentStatus$1;
  lastEditedAt?: string;
  reactions: CommentReactionItem$1[] | null;
  context?: CommentContext$1;
  /**
   * A snapshot value of the content that the comment is related to.
   */
  contentSnapshot?: unknown;
  target: {
    path?: CommentPath$1;
    documentRevisionId?: string;
    documentVersionId?: string;
    documentType: string;
    document: {
      _dataset: string;
      _projectId: string;
      _ref: string;
      _type: 'crossDatasetReference';
      _weak: boolean;
    } | {
      _ref: string;
      _type: 'reference';
      _weak: boolean;
    };
  };
}
/**
 * @beta
 * @hidden
 */
type CommentPostPayload$1 = Omit<CommentDocument$1, '_rev' | '_updatedAt' | '_createdAt'>;
/**
 * @beta
 * @hidden
 */
interface CommentBaseCreatePayload$1 {
  id?: CommentDocument$1['_id'];
  message: CommentDocument$1['message'];
  parentCommentId: CommentDocument$1['parentCommentId'];
  reactions: CommentDocument$1['reactions'];
  status: CommentDocument$1['status'];
  threadId: CommentDocument$1['threadId'];
  payload?: {
    fieldPath: string;
  };
}
/**
 * @beta
 * @hidden
 */
interface CommentTaskCreatePayload$1 extends CommentBaseCreatePayload$1 {
  type: 'task';
  context: {
    notification: CommentContext$1['notification'];
  };
}
/**
 * @beta
 * @hidden
 */
interface CommentFieldCreatePayload$1 extends CommentBaseCreatePayload$1 {
  type: 'field';
  contentSnapshot?: CommentDocument$1['contentSnapshot'];
  /**
   * The stringified path to the field where the comment was created.
   */
  fieldPath: string;
  selection?: CommentPathSelection$1;
}
/**
 * @beta
 * @hidden
 */
type CommentCreatePayload$1 = CommentTaskCreatePayload$1 | CommentFieldCreatePayload$1;
/**
 * @beta
 * @hidden
 */
type CommentUpdatePayload$1 = Partial<Omit<CommentPostPayload$1, '_id' | '_type'>>;
/**
 * @beta
 * @hidden
 */
interface CommentsListBreadcrumbItem$1 {
  invalid: boolean;
  isArrayItem?: boolean;
  title: string;
}
/**
 * @beta
 * @hidden
 */
type CommentListBreadcrumbs$1 = CommentsListBreadcrumbItem$1[];
/**
 * @beta
 * @hidden
 */
type CommentsUIMode$1 = 'default' | 'upsell';
/**
 * @internal
 */
interface CommentsSelectedPath {
  origin: 'form' | 'inspector' | 'url';
  fieldPath: string | null;
  threadId: string | null;
}
/**
 * @internal
 */
interface CommentsSelectedPathContextValue {
  setSelectedPath: (nextSelectedPath: CommentsSelectedPath | null) => void;
  selectedPath: CommentsSelectedPath | null;
}
/** @internal */
type CommandListElementType = 'input' | 'list';
/** @internal */
type CommandListGetItemDisabledCallback = (virtualIndex: number) => boolean;
/** @internal */
type CommandListGetItemKeyCallback = (virtualIndex: number) => number | string;
/** @internal */
type CommandListGetItemSelectedCallback = (virtualIndex: number) => boolean;
/** @internal */
type CommandListItemContext = {
  activeIndex: number | null;
  disabled?: boolean;
  selected?: boolean;
  virtualIndex: number;
};
/** @internal */
type CommandListRenderItemCallback<T> = (item: T, context: CommandListItemContext) => ReactNode;
/** @internal */
interface CommandListHandle {
  focusInputElement: () => void;
  focusListElement: () => void;
  getTopIndex: () => number;
  scrollToIndex: (index: number) => void;
}
/** @internal */
interface CommandListProps<T = any> extends PaddingProps {
  /** The data attribute to apply to any active virtual list items */
  activeItemDataAttr?: string;
  /** `aria-label` to apply to the virtual list container element */
  ariaLabel: string;
  /** Whether `aria-multiselectable` is enabled on the virtual list container element */
  ariaMultiselectable?: boolean;
  /** Automatically focus the input or virtual list */
  autoFocus?: CommandListElementType;
  /** Whether the virtual list can receive focus */
  canReceiveFocus?: boolean;
  /** Class name to apply to the virtual list container (scroller) element */
  className?: string;
  /** Pixel offset of the virtual list focus ring. Negative values will cause the focus ring to appear inset */
  focusRingOffset?: number;
  /** Force a fixed height for all virtual list children and skip measurement (faster). */
  fixedHeight?: boolean;
  /** Custom function to map disabled items */
  getItemDisabled?: CommandListGetItemDisabledCallback;
  /** Custom function to map virtual list items to custom keys */
  getItemKey?: CommandListGetItemKeyCallback;
  /** Custom function to map selected items */
  getItemSelected?: CommandListGetItemSelectedCallback;
  /** Scroll alignment of the initial active index */
  initialScrollAlign?: ScrollToOptions['align'];
  /** Initial active index on mount */
  initialIndex?: number;
  /** Input element to associate with this virtual list. Associated inputs will receive focus and handle key events */
  inputElement?: HTMLInputElement | null;
  /** Estimated height for each list item */
  itemHeight: number;
  /** Virtual list item values, accessible to all rendered item components */
  items: T[];
  /** Callback fired when the virtual list is within `onEndReachedIndexThreshold` of rendered content */
  onEndReached?: () => void;
  /** Number of items from the end of the virtual list before which `onEndReached` is triggered */
  onEndReachedIndexOffset?: number;
  /** Only show selection state when the virtual list is active (is hovered or has focus) */
  onlyShowSelectionWhenActive?: boolean;
  /** Number of items to render above and below the visible area*/
  overscan?: number;
  /** Rendered component in virtual lists */
  renderItem: CommandListRenderItemCallback<T>;
  /** `data-testid` to apply to outermost container */
  testId?: string;
  /** Allow wraparound keyboard navigation between first and last items */
  wrapAround?: boolean;
}
interface ReleasesMetadata {
  /**
   * The number of documents with the release version as a prefix
   */
  documentCount: number;
  /**
   * The last time a document in the release was edited
   */
  updatedAt: string | null;
}
type ReleasesMetadataMap = Record<string, ReleasesMetadata>;
type MetadataWrapper = {
  data: ReleasesMetadataMap | null;
  error: null;
  loading: boolean;
};
/** @internal */
interface PreviewCardContextValue {
  selected?: boolean;
}
/** @internal */
declare function usePreviewCard(): PreviewCardContextValue;
/** @internal */
declare function PreviewCard(props: CardProps<ElementType> & Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref'> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
/**
 *  This is a workaround for a circular import issue.
 * Calling `styled(PreviewCard)` at program load time triggered a build error with the commonjs bundle because it tried
 * to access the PreviewCard variable/symbol before it was initialized.
 * The workaround is to colocate the styled component with the component itself.
 * @internal
 */
declare const ReferenceInputPreviewCard: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<any, "as" | keyof import("@sanity/ui").CardOwnProps> & import("@sanity/ui").CardOwnProps & {
  as?: ElementType | undefined;
} & Omit<HTMLProps<HTMLDivElement>, "as" | "height" | "ref"> & RefAttributes<HTMLDivElement>> & string & Omit<typeof PreviewCard, keyof import("react").Component<any, {}, any>>;
/**
 * TODO: Rename to `ZOffsetsContextValue`
 *
 * @internal
 */
interface ZIndexContextValue {
  /** Used by: Navbar */
  navbar: number | number[];
  navbarPopover: number | number[];
  navbarDialog: number | number[];
  /** Used by: DefaultPane, DocumentPane */
  pane: number | number[];
  paneHeader: number | number[];
  paneFooter: number | number[];
  paneResizer: number | number[];
  paneDialog: number | number[];
  /** Used by: EditItemFoldOut, Spinner, ConnectorsOverlay, tippy.css, BaseDateTimeInput */
  portal: number | number[];
  /** Used by: Tooltip */
  popover: number | number[];
  /** Used by: `@sanity/google-maps-input` */
  modal: number | number[];
  /** TODO this path does not seem to be correct - fix?  */
  /** Used by: `movingItem` in packages/sanity/src/styles/layout/helpers.css */
  movingItem: number | number[];
  /** Used for shadow behind the navbar search, and behind sidemenu */
  drawershade: number | number[];
  /** Used by: Snackbar */
  drawer: number | number[];
  /** Used for UI that sits on top of the entire application */
  fullscreen: number | number[];
  /** Used for inspector dialog */
  inspectorDialog: number | number[];
  /** Used for toasts */
  toast: number | number[];
  dropdown: number | number[];
  navbarFixed: number | number[];
  fullscreenEdit: number | number[];
  popoverBackground: number | number[];
  tooltip: number | number[];
  modalBackground: number | number[];
  spinner: number | number[];
}
/**
 * Options for delegating a request error to the studio's error UI.
 *
 * @beta
 */
interface RequestErrorReportOptions {
  /**
   * Whether the failed request is safe to re-run. Only set this to `true`
   * when re-running cannot cause harm: the request is idempotent (reads),
   * or it is guaranteed to have been rejected before processing (429s).
   *
   * When `true`, the studio's error dialog offers a "Try again" button
   * that re-runs the request. When `false` (the default), the dialog only
   * offers "Reload Studio" and uses more conservative copy, warning that
   * the last change may or may not have been applied.
   *
   * Note: retry requires a re-runnable request, so it only takes effect
   * with `attempt()` (which has the thunk to re-invoke). The `handle`
   * rejection-handler form cannot re-run the request.
   */
  retryable?: boolean;
}
/**
 * An error claimed by the studio's request-error UI, as rendered by the
 * studio dialog. Mirrors the classification plus the caller's retry
 * assertion.
 *
 * @internal
 */
type RequestErrorClaim = {
  type: 'networkError';
  error: Error;
  retryable: boolean;
} | {
  type: 'serverError';
  error: HttpError;
  retryable: boolean;
} | {
  type: 'rateLimited';
  error: HttpError;
  retryAfterSeconds?: number;
  retryable: boolean;
} | {
  type: 'unauthorized';
  error: HttpError;
  projectId?: string;
};
/**
 * Call-site API for delegating unrecoverable request errors to the
 * studio's built-in error UI (dialogs, verified forced logout).
 *
 * The studio never intercepts your requests — errors only reach this
 * channel when you hand them over. Handle what you can locally (inline
 * errors, toasts, fallbacks); delegate what you can't.
 *
 * Two shapes, both feeding the same dialog:
 *
 * ```ts
 * const {attempt, handle} = useStudioErrorHandler()
 *
 * // 1. Thunk wrapper — the dialog's "Try again" re-invokes the thunk.
 * //    The thunk may return a promise or a (single-shot) observable:
 * const user = await attempt(() => client.request({url: '/users/me'}), {
 *   retryable: true,
 * })
 *
 * // 2. Promise rejection handler — fire-and-surface, no retry:
 * client.create(doc).catch(handle)
 * ```
 *
 * Unclaimable errors (4xx other than 429, parse errors, ...) are
 * re-thrown unchanged, so downstream `.catch` / `catchError` handlers
 * still see them. 401s are claimed only when the API explicitly tags them
 * as an invalid session (`SIO-401-AEX` expired, `SIO-401-ANF` not found), in
 * which case a forced logout follows; untagged resource-level 401s are
 * re-thrown to the caller.
 *
 * @beta
 */
interface StudioErrorHandler {
  /**
   * Promise rejection handler — use directly in `.catch(handle)`.
   * Claimable errors surface the studio dialog and leave the promise
   * pending (the request is in limbo until the user reloads);
   * unclaimable errors are re-thrown to the next `.catch`:
   *
   * ```ts
   * client
   *   .create(doc)
   *   .catch(handle)
   *   .catch((err) => {
   *     // caller-domain errors (validation, permissions, 404, ...)
   *   })
   * ```
   */
  handle(err: unknown): Promise<never>;
  /**
   * Runs `thunk` and delegates claimable failures to the studio dialog.
   * With `retryable: true`, the dialog's "Try again" re-invokes the thunk;
   * the returned promise resolves with the first successful attempt.
   * Unclaimable failures reject the returned promise.
   *
   * The thunk receives the attempt number (starting at 1), useful for
   * logging or cache-busting. It may return a promise or an observable —
   * an observable is drained to its last emitted value (single-shot
   * request observables emit once and complete, so this is their value).
   *
   * The observable MUST be finite. `attempt` waits for completion, so a
   * long-lived or multicast source (`client.listen()`, a `Subject`) would
   * never resolve and would leak its subscription for the life of the
   * returned promise. An observable that completes without emitting
   * rejects with rxjs's `EmptyError`. Pass request-style observables only.
   *
   * Promises are eager, so the thunk must CREATE the request when called
   * — retry works by invoking it again for a fresh request:
   *
   * ```ts
   * // ✓ each invocation issues a new request
   * attempt(() => client.fetch(query), {retryable: true})
   *
   * // ✗ the request already happened; retry re-awaits the same
   * //   settled rejection and the dialog just reappears
   * const promise = client.fetch(query)
   * attempt(() => promise, {retryable: true})
   * ```
   */
  attempt<T>(thunk: (attemptNumber: number) => PromiseLike<T> | Observable<T>, options?: RequestErrorReportOptions): Promise<T>;
}
/**
 * The full channel, as owned by `WorkspacesProvider`: the reporter
 * surface plus the state stream and retry trigger the dialog needs.
 *
 * @internal
 */
interface RequestErrorChannel extends StudioErrorHandler {
  /** Currently active claim (undefined → no dialog). */
  claim$: Observable<RequestErrorClaim | undefined>;
  /** Re-runs all parked retryable requests and clears the claim. */
  retry(): void;
}
/**
 * @internal
 */
interface PathSegmentWithType {
  segment: number | string;
  type: string;
}
/**
 * @internal
 */
type PathWithTypes = PathSegmentWithType[];
type DivergenceStatus = 'unresolved' | 'resolved';
type SnapshotType = 'subjectHead' | 'upstreamHead' | 'upstreamAtFork';
type SnapshotsByType = Record<SnapshotType, undefined | {
  value: unknown;
  /**
   * If the node is a direct descendant of an array, `parentArray` can be used to access all of
   * the parent array's descendants. This is used to determine the movement of array nodes.
   */
  parentArray?: KeyedObject[] | unknown[];
  /**
   * If the node is a direct descendant of an object, this can be used to determine the parent
   * object's type. This is used to determine objects whose type has changed.
   */
  parentObjectType?: string;
  /**
   * The node's path as an array, enriched with the content type found at each segment.
   */
  pathWithTypes: PathWithTypes;
}>;
/**
 * @internal
 */
type DivergenceEffect = 'unset' | 'set' | 'insert' | 'move' | 'changeObjectType';
/**
 * @internal
 */
type BaseDivergence = {
  snapshots: SnapshotsByType;
  documentType: string;
  /**
   * Whether the divergence is addressable.
   *
   * Divergences that occur at leaf primitive nodes are addressable. Addressable divergences can be
   * marked as resolved.
   */
  isAddressable: boolean;
  /**
   * The type of operation that occurred upstream to cause the divergence.
   */
  effect?: DivergenceEffect;
  /**
   * The upstream document id.
   */
  documentId: string;
  /**
   * The subject document id.
   */
  subjectId: string;
  /**
   * The upstream revision that caused the divergence.
   */
  sinceRevisionId: string;
  /**
   * Whether the divergence has been resolved or not.
   */
  status: DivergenceStatus;
  /**
   * The stringified path to the divergence in the document.
   *
   * TODO: It'd be more efficient to provide this as an array to avoid repeatedly converting it to
   *       and from a string.
   */
  path: string;
};
/**
 * @internal
 */
type Divergence = BaseDivergence & ({
  effect: Exclude<DivergenceEffect, 'move'>;
} | {
  effect: Extract<DivergenceEffect, 'move'>;
  /**
   * The position of the item in the upstream array.
   */
  upstreamPosition: number;
  /**
   * The distance the item has moved in the upstream array since the last consistent state.
   */
  delta: number;
} | {
  effect: Extract<DivergenceEffect, 'insert'>;
  /**
   * The position at which the item was inserted inro the upstream array.
   */
  position: number;
} | {
  effect?: undefined;
  delta?: never;
  position?: never;
});
type DivergenceAtPath = [path: string, context: Divergence];
interface CollatedDocumentDivergencesState {
  state: 'pending' | 'ready';
  upstreamId: string | undefined;
  divergences: Record<string, Divergence>;
}
/**
 * A divergence that has been transposed onto a schema type and that can be
 * reached in the document editor.
 *
 * @internal
 */
type ReachableDivergence = Divergence & {
  /**
   * A composite divergence occurs when there is a divergence in a leaf node,
   * but it does not make sense to report it directly.
   *
   * A good example is when a divergence occurs in a reference field. It's not
   * useful to report the `_ref` id change directly, nor does it integrate
   * well with the document editor. Instead, the divergence is reported on the
   * reference field itself.
   *
   * Composite divergences are identified by checking whether they descend a
   * node that has a dedicated diff component.
   */
  isComposite: boolean;
  /**
   * All of the divergences this reachable divergence is composed of.
   *
   * To perform an action (e.g. ignore or copy from upstream) on a composite
   * divergence, the action must be performed on all descendant divergences.
   */
  divergences: DivergenceAtPath[];
  diffComponent?: DiffComponent | DiffComponentOptions;
  schemaType: SchemaType;
};
/**
 * @internal
 */
type ReachableDivergenceAtPath = [path: string, divergence: ReachableDivergence];
/**
 * @internal
 */
interface DivergenceNavigatorState {
  focusedDivergence: string | undefined;
  previousDivergence: string | undefined;
  nextDivergence: string | undefined;
  state: CollatedDocumentDivergencesState['state'];
  upstreamId: string | undefined;
  /**
   * For iterating ancestors when copying changes from upstream.
   */
  allDivergences: DivergenceAtPath[];
  /**
   * For paging through all reachable divergences in the document.
   */
  divergences: ReachableDivergenceAtPath[];
  /**
   * For showing a summary of divergences occurring node-by-node, and allowing
   * the editor to focus the first divergence inside a node.
   */
  divergencesByNode: Record<string, number>;
}
/**
 * @internal
 */
interface DivergenceNavigator {
  /**
   * Focus the divergence at the provided path.
   */
  focusDivergence: (path: string) => void;
  /**
   * Blur the divergence at the provided path.
   */
  blurDivergence: (path: string) => void;
  /**
   * Blur the current focused divergence.
   */
  blurFocusedDivergence: () => void;
  /**
   * The current state.
   */
  state: DivergenceNavigatorState;
}
interface DivergenceNavigatorContext {
  divergences: Observable<CollatedDocumentDivergencesState>;
  schemaType: ObjectSchemaType;
  formState: Pick<FormState, 'groups' | '_allMembers' | 'value'>;
}
/**
 * Transpose a set of divergences onto the provided schema type, and create the
 * state and functions necessary to render and navigate them.
 *
 * @internal
 */
declare function useDivergenceNavigator({ divergences, schemaType, formState }: DivergenceNavigatorContext): DivergenceNavigator;
/** @internal */
type ConsentStatus = 'loading' | 'granted' | 'denied';
/** @internal */
interface FeedbackContextValue {
  telemetryConsent: ConsentStatus;
  userName: string | undefined;
  userEmail: string | undefined;
  tags: Record<string, TagValue>;
}
/** @internal */
type Sentiment = 'happy' | 'neutral' | 'unhappy';
/** Tags that are always sent regardless of where the dialog is used. */
interface BaseFeedbackTags {
  userAgent: string;
  screenDensity: string;
  screenHeight: string;
  screenWidth: string;
  innerHeight: string;
  innerWidth: string;
  studioVersion: string;
  reactVersion: string;
  environment: string;
  projectId: string;
  projectName: string;
  orgId: string;
  orgName: string;
  planTier: string;
  sessionId: string;
  userId: string;
  plugins: string;
  pluginsCount: number;
}
/** Tags that update as the user navigates. */
interface DynamicFeedbackTags {
  activeTool: string;
  activeWorkspace: string;
  activeProjectId: string;
  activeDataset: string;
  url: string;
}
/** Matches Sentry's accepted tag value types. */
type TagValue = string | number | boolean;
/** The full feedback payload sent to Sentry. */
interface FeedbackPayload {
  /**
   * Sentry DSN to send feedback to.
   * Format: `https://[key]@[host]/[project-id]`
   */
  dsn: string;
  /**
   * Tracks the tag schema for this feedback source. Bump when tags or meaningful changes are made.
   * Similar to version in telemetry consent.
   */
  feedbackVersion: string;
  /**
   * The user's telemetry consent status.
   * When not 'granted', PII (name, email, userId) is stripped and IP is anonymised.
   */
  telemetryConsent: ConsentStatus;
  /**
   * The name of the user sending feedback.
   */
  name?: string;
  /**
   * The email of the user sending feedback.
   */
  email?: string;
  /**
   * The message the user is sending feedback.
   * It's mandatory as without it, Sentry will ignore the feedback upon receiving it.
   * (Mandatory Sentry field)
   */
  message: string;
  /**
   * The source of the feedback.
   * Identifies where this feedback was triggered from (e.g. 'studio-help-menu').
   */
  source: string;
  /**
   * The tags to send with the feedback.
   */
  tags: Record<string, TagValue>;
  /**
   * The attachments to send with the feedback.
   */
  attachments?: {
    filename: string;
    data: Uint8Array;
  }[];
}
/** @internal */
type HexColor = string;
/** @internal */
type UserColorHue = string;
/** @internal */
type UserId = string;
/** @internal */
interface UserColor {
  name: ColorHueKey;
  background: HexColor;
  border: HexColor;
  text: HexColor;
  tints: ColorTints;
}
/** @internal */
interface UserColorManager {
  get: (userId: UserId | null) => UserColor;
  listen: (userId: UserId) => Observable<UserColor>;
}
/** @internal */
type DocumentChangeContextInstance = {
  documentId: string;
  schemaType: SchemaType;
  rootDiff: ObjectDiff | null;
  isComparingCurrent: boolean;
  FieldWrapper: ComponentType<{
    path: Path;
    children: ReactNode;
    hasRevertHover: boolean;
  }>;
  value: Partial<SanityDocument>;
  /**
   * When comparing two values it decides if it shows the original "from" value in the Diff components.
   * Useful for the DocumentDiff in releases when showing the diff for a new document.
   */
  showFromValue: boolean;
};
/**
 * @internal
 * @hidden
 */
interface FormValueContextValue {
  value: FormDocumentValue | undefined;
}
/**
 *
 * @internal
 * @hidden
 */
declare function FormValueProvider(props: {
  value: FormDocumentValue | undefined;
  children: ReactNode;
}): import("react").JSX.Element;
/**
 * React hook that returns the value of the field specified by a path, or the whole
 * document when called without one.
 * @public
 *
 * @param path - An array notation with segments that are either strings representing field names, index integers for arrays with simple values, or objects with a _key for arrays containing objects. Defaults to the document root.
 *
 * @returns The value of the field specified by the path, or the whole document if no path is given
 *
 * @example Using the `useFormValue` hook
 * ```ts
 * function MyComponent() {
 *    // get the whole document
 *    const document = useFormValue()
 *    // get value of field 'name' in object 'author'
 *    const authorName = useFormValue(['author', 'name'])
 *    // get value of the second item in array 'tags' of type 'string'
 *    const secondTag = useFormValue(['tags', 1])
 *    // get value of the reference with the matching key in an array of references
 *    const specificBook = useFormValue([ 'bibliography', {_key: '<key>'} ])
 *   // ... do something with the form values ...
 * }
 * ```
 */
declare function useFormValue(path?: Path): unknown;
/** @internal */
interface PortableTextMemberItem {
  kind: 'annotation' | 'textBlock' | 'objectBlock' | 'inlineObject';
  key: string;
  member: ArrayOfObjectsItemMember;
  node: ObjectFormNode;
  input?: ReactNode;
}
/**
 * Input component for editing block content
 * ({@link https://github.com/portabletext/portabletext | Portable Text}) in the Sanity Studio.
 *
 * Supports multi-user real-time block content editing on larger documents.
 *
 * This component can be configured and customized extensively.
 * {@link https://www.sanity.io/docs/customizing-the-portable-text-editor | Go to the documentation for more details}.
 *
 * @public
 * @param props - {@link PortableTextInputProps} component props.
 */
declare function PortableTextInput(props: PortableTextInputProps): ReactNode;
/**
 * `EditorProvider` doesn't have a `readOnly` prop. Instead, this custom PTE
 * plugin listens for the prop change and sends a `toggle readOnly` event to
 * the editor.
 *
 * @internal
 */
declare function UpdateReadOnlyPlugin(props: {
  readOnly: boolean;
}): null;
/**
 * A parse error reported by a primitive input that holds malformed text it
 * cannot commit (e.g. a date input whose value does not match `dateFormat`).
 *
 * @internal
 */
interface ParseError {
  message: string;
}
/**
 * Overlay input-reported parse errors onto a validation array.
 *
 * While an input is unparseable, the value committed to the document is still
 * `undefined`, so the validator output for that path is misleading "required"
 * noise. For every path present in `parseErrors`, we drop the existing error
 * markers at that path and emit a single error marker carrying the parse
 * message. Markers at other paths and non-error markers at the same path
 * (warning, info) are preserved.
 *
 * The `parseErrors` map is keyed by `@sanity/util/paths` `toString(path)`.
 *
 * @internal
 */
declare function mergeParseErrors(validation: ValidationMarker[], parseErrors: Record<string, ParseError>): ValidationMarker[];
/** @internal */
interface FormCallbacksValue {
  transformPatches?: (patches: FormPatch[]) => FormPatch[];
  onChange: (patchEvent: PatchEvent) => void;
  onPathFocus: (path: Path, payload?: OnPathFocusPayload) => void;
  onPathBlur: (path: Path) => void;
  onPathOpen: (path: Path) => void;
  onSetPathCollapsed: (path: Path, collapsed: boolean) => void;
  onSetFieldSetCollapsed: (path: Path, collapsed: boolean) => void;
  onFieldGroupSelect: (path: Path, fieldGroupName: string) => void;
}
/** @internal */
declare const FormCallbacksProvider: import("react").MemoExoticComponent<(props: FormCallbacksValue & {
  children: ReactNode;
}) => import("react").JSX.Element>;
/** @internal */
declare function useFormCallbacks(): FormCallbacksValue;
/** @internal */
type LoadingTuple<T> = [T, boolean];
/** @internal */
type ReactHook<TArgs, TResult> = (args: TArgs) => TResult;
/** @internal */
declare function createHookFromObservableFactory<T, TArg = void>(observableFactory: (arg: TArg) => Observable<T>, initialValue: T): ReactHook<TArg, LoadingTuple<T>>;
/** @internal */
declare function createHookFromObservableFactory<T, TArg = void>(observableFactory: (arg: TArg) => Observable<T>, initialValue?: T): ReactHook<TArg, LoadingTuple<T | undefined>>;
/** @internal */
type PartialExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>;
/** @internal */
interface TemplatePermissionsResult<TInitialValue = Record<string, unknown>> extends PermissionCheckResult, InitialValueTemplateItem {
  granted: boolean;
  reason: string;
  resolvedInitialValue: TInitialValue;
  subtitle?: string;
  template: Template;
}
/** @internal */
interface TemplatePermissionsOptions {
  grantsStore: GrantsStore;
  schema: Schema;
  templates: Template[];
  templateItems: InitialValueTemplateItem[];
  context: InitialValueResolverContext;
}
/**
 * The observable version of `useTemplatePermissions`
 *
 * @internal
 */
declare function getTemplatePermissions({ grantsStore, templateItems, templates, schema, context }: TemplatePermissionsOptions): Observable<Array<TemplatePermissionsResult>>;
/**
 * Takes in an array of initial template values and returns an object of
 * `TemplatePermissionsResult` keyed by the IDs of the initial template values
 * given.
 *
 * The `TemplatePermissionsResult` is an object that contains a `granted`
 * boolean per key and can be used to determine if a user has the ability to
 * create documents using the given initial value template items.
 *
 * For each initial template value item, the corresponding template is found and
 * resolved against the parameters in each the initial template value item. The
 * resolved value is then run through the document-value permissions. If there
 * are any matching grants for the resolved initial template value, the
 * `TemplatePermissionsResult` will include `granted: true`.
 *
 * @internal
 */
declare const useTemplatePermissionsFromHookFactory: ReactHook<TemplatePermissionsOptions, LoadingTuple<TemplatePermissionsResult<Record<string, unknown>>[] | undefined>>;
/** @internal */
declare function useTemplatePermissions({ templateItems, ...rest }: PartialExcept<TemplatePermissionsOptions, 'templateItems'>): ReturnType<typeof useTemplatePermissionsFromHookFactory>;
/** @internal */
interface TemplateOption {
  id: string;
  params?: Record<string, string | number | boolean>;
}
/**
 * @internal
 */
interface EditReferenceOptions {
  id: string;
  type: string;
  parentRefPath: Path;
  template: TemplateOption;
  version?: ReleaseId;
}
/** @internal */
interface EditReferenceLinkComponentProps {
  documentId: string;
  documentType: string;
  parentRefPath: Path;
  template?: TemplateOption;
  children: ReactNode;
}
/**
 * @internal
 */
interface ReferenceInputOptions {
  /**
   * Represents the highlighted path if ths current document has a related open
   * child (e.g. reference in place).
   */
  activePath?: {
    path: Path;
    state: 'selected' | 'pressed' | 'none';
  };
  /**
   * A specialized `EditReferenceLinkComponent` component that takes in the needed props to open a
   * referenced document to the right
   */
  EditReferenceLinkComponent?: ComponentType<Omit<HTMLProps<'a'>, 'children'> & EditReferenceLinkComponentProps>;
  initialValueTemplateItems?: TemplatePermissionsResult[];
  /**
   * Similar to `EditReferenceChildLink` expect without the wrapping component
   */
  onEditReference?: (options: EditReferenceOptions) => void;
  /**
   * Prevent creation of documents from reference fields.
   */
  disableNew?: boolean;
}
/**
 * @internal
 */
declare function useReferenceInputOptions(): ReferenceInputOptions;
/**
 * @internal
 */
declare function ReferenceInputOptionsProvider(props: ReferenceInputOptions & {
  children: ReactNode;
}): import("react").JSX.Element;
/**
 * @internal
 */
interface EnhancedObjectDialogContextValue {
  /**
   * A boolean indicating whether tree editing is enabled
   */
  enabled: boolean;
  /**
   * A boolean indicating whether legacy editing is enabled - meaning that it will use the old modal based editing experience
   */
  legacyEditing: boolean;
}
/**
 * @internal
 * @deprecated This hook is no longer used and will be removed in a future release as we make the enhanced object dialog the default.
 */
declare function useEnhancedObjectDialog(): EnhancedObjectDialogContextValue;
/**
 * @beta
 * @hidden
 */
interface CommentsContextValue {
  documentId: string;
  documentType: string;
  getComment: (id: string) => CommentDocument$1 | undefined;
  getCommentLink?: (id: string) => string;
  selectedCommentId?: string | undefined;
  onClearSelectedComment?: () => void;
  isCreatingDataset: boolean;
  isCommentsOpen?: boolean;
  onCommentsOpen?: () => void;
  isConnecting?: boolean;
  onPathOpen?: (path: Path) => void;
  comments: {
    data: {
      open: CommentThreadItem$1[];
      resolved: CommentThreadItem$1[];
    };
    error: Error | null;
    loading: boolean;
  };
  operation: {
    create: CommentOperations$1['create'];
    remove: CommentOperations$1['remove'];
    update: CommentOperations$1['update'];
    react: CommentOperations$1['react'];
  };
  mentionOptions: UserListWithPermissionsHookValue;
  status: CommentStatus$1;
  setStatus: (status: CommentStatus$1) => void;
}
/**
 * `'default'` when the plan has the comments feature, `'upsell'` when it does not, `null` when
 * the feature check failed.
 * @internal
 */
type CommentsMode = CommentsUIMode$1 | null;
/**
 * @beta
 * @hidden
 */
interface CommentUpdateOperationOptions {
  throttled: boolean;
}
/**
 * @beta
 * @hidden
 */
interface CommentOperations {
  create: (comment: CommentCreatePayload) => Promise<void>;
  react: (id: string, reaction: CommentReactionOption) => Promise<void>;
  remove: (id: string) => Promise<void>;
  update: (id: string, comment: CommentUpdatePayload, opts?: CommentUpdateOperationOptions) => Promise<void>;
  /**
   * Re-anchors an inline comment after its text has moved.
   * Non-null `range` requires `fieldValue` (editor PT covering the range).
   */
  updateRange: (id: string, payload: CommentUpdateRangePayload) => Promise<void>;
}
/**
 * @beta
 * @hidden
 */
interface CommentThreadItem {
  breadcrumbs: CommentListBreadcrumbs;
  commentsCount: number;
  fieldPath: string;
  hasReferencedValue: boolean;
  parentComment: CommentDocument;
  replies: CommentDocument[];
  threadId: string;
}
/**
 * @beta
 * @hidden
 */
type CommentMessage = PortableTextBlock[] | null;
/**
 * @beta
 * @hidden
 */
type CommentStatus = 'open' | 'resolved';
/**
 * @beta
 * @hidden
 */
interface CommentsTextSelectionItem {
  _key: string;
  text: string;
}
/**
 * @beta
 * @hidden
 */
interface CommentTextSelection {
  type: 'text';
  value: CommentsTextSelectionItem[];
}
type CommentPathSelection = CommentTextSelection;
/**
 * @beta
 * @hidden
 */
interface CommentPath {
  field: string;
  selection?: CommentPathSelection;
}
/**
 * @beta
 * @hidden
 */
interface CommentContext {
  tool: string;
  payload?: Record<string, unknown>;
  notification?: {
    documentTitle: string;
    url?: string;
    workspaceTitle: string;
    workspaceName: string;
    currentThreadLength?: number;
    subscribers?: string[];
  };
  intent?: {
    title: string;
    name: string;
    params: IntentParameters;
  };
}
interface CommentCreateRetryingState {
  type: 'createRetrying';
}
interface CommentCreateFailedState {
  type: 'createError';
  error: Error;
}
/**
 * @beta
 * @hidden
 * The short names for the comment reactions.
 * We follow the convention for short names outlined in https://projects.iamcal.com/emoji-data/table.htm.
 */
type CommentReactionShortNames = CollaborationCommentReactionShortName;
/**
 * @beta
 * @hidden
 */
interface CommentReactionOption {
  shortName: CommentReactionShortNames;
  title: string;
}
/**
 * @beta
 * @hidden
 */
interface CommentReactionItem {
  _key: string;
  shortName: CommentReactionShortNames;
  userId: string;
  addedAt: string;
  /**
   * This is a local value and is not stored on the server.
   * It is used to track the optimistic state of the reaction.
   */
  _optimisticState?: 'added' | 'removed';
}
/**
 * @beta
 * @hidden
 */
type CommentsType = 'field' | 'task';
/**
 * `updateRange` payload. Non-null `range` requires editor PT as `fieldValue`.
 * `optimisticUpdate` is applied to the local comment while the request is in
 * flight; the listener echo replaces it with the server-resolved state.
 */
type CommentUpdateRangePayload = {
  range: CollaborationCommentRange;
  fieldValue: CollaborationCommentFieldValue;
  optimisticUpdate: CommentUpdatePayload;
} | {
  range: null;
  optimisticUpdate: CommentUpdatePayload;
};
/**
 * The state is used to track the state of the comment (e.g. if it failed to be created, etc.)
 * It is a local value and is not stored on the server.
 * When there's no state, the comment is considered to be in a "normal" state (e.g. created successfully).
 *
 * The state value is primarily used to update the UI. That is, to show an error message or retry button.
 */
type CommentState = CommentCreateFailedState | CommentCreateRetryingState | undefined;
/**
 * Comment document as stored by the Comments API (`sanity.comment`).
 *
 * @beta
 * @hidden
 */
interface CommentDocument {
  _type: 'sanity.comment';
  _createdAt: string;
  _id: string;
  _rev: string;
  /**
   * System metadata. Author is stored in `_system.createdBy`.
   */
  _system: {
    createdBy: string;
  };
  /**
   * Local-only state used to track optimistic UI updates (e.g. create retrying/failed).
   * Not stored on the server.
   */
  _state?: CommentState;
  message: CommentMessage;
  threadId: string;
  parentCommentId?: string;
  status: CommentStatus;
  lastEditedAt?: string;
  reactions: CommentReactionItem[] | null;
  context?: CommentContext;
  /**
   * A snapshot value of the content that the comment is related to.
   */
  contentSnapshot?: unknown;
  target: {
    path?: CommentPath;
    documentRevisionId?: string;
    /**
     * The exact document ID the comment was created against (e.g. a draft or version ID).
     */
    sourceDocumentId: string;
    documentType: string;
    /**
     * Global document reference. `_ref` format: `resourceType:resourceId:publishedDocumentId`
     */
    document: WeakGlobalDocumentReferenceValue;
  };
}
/**
 * @beta
 * @hidden
 */
type CommentPostPayload = Omit<CommentDocument, '_rev' | '_updatedAt' | '_createdAt'>;
/**
 * @beta
 * @hidden
 */
interface CommentBaseCreatePayload {
  id?: CommentDocument['_id'];
  message: CommentDocument['message'];
  parentCommentId: CommentDocument['parentCommentId'];
  reactions: CommentDocument['reactions'];
  status: CommentDocument['status'];
  threadId: CommentDocument['threadId'];
  payload?: {
    fieldPath: string;
  };
}
/**
 * @beta
 * @hidden
 */
interface CommentTaskCreatePayload extends CommentBaseCreatePayload {
  type: 'task';
  context: {
    notification: CommentContext['notification'];
  };
}
/**
 * @beta
 * @hidden
 */
type CommentFieldCreatePayload = CommentBaseCreatePayload & {
  type: 'field';
  contentSnapshot?: CommentDocument['contentSnapshot'];
  /**
   * The stringified path to the field where the comment was created.
   */
  fieldPath: string;
  /**
   * Text selection markers (used for UI rendering).
   */
  selection?: CommentPathSelection;
} & ({
  /** Comments API range for an inline selection */
  range: CollaborationCommentRange;
  /** Editor Portable Text covering `range` */
  fieldValue: CollaborationCommentFieldValue;
} | {
  range?: undefined;
  fieldValue?: undefined;
});
/**
 * @beta
 * @hidden
 */
type CommentCreatePayload = CommentTaskCreatePayload | CommentFieldCreatePayload;
/**
 * @beta
 * @hidden
 */
type CommentUpdatePayload = Partial<Omit<CommentPostPayload, '_id' | '_type'>>;
/**
 * @beta
 * @hidden
 */
interface CommentsListBreadcrumbItem {
  invalid: boolean;
  isArrayItem?: boolean;
  title: string;
}
/**
 * @beta
 * @hidden
 */
type CommentListBreadcrumbs = CommentsListBreadcrumbItem[];
/**
 * @beta
 * @hidden
 */
type CommentsUIMode = 'default' | 'upsell';
/**
 *
 * @hidden
 * @beta
 */
interface FormBuilderContextValue {
  /**
   * @deprecated INTERNAL USE ONLY
   * @internal
   */
  __internal: {
    components: {
      CustomMarkers: FormBuilderCustomMarkersComponent;
      Markers: FormBuilderMarkersComponent;
    };
    file: {
      assetSources: AssetSource[];
      directUploads: boolean;
    };
    filterField: FormBuilderFilterFieldFn;
    image: {
      assetSources: AssetSource[];
      directUploads: boolean;
    };
    patchChannel: PatchChannel;
    inspectOpen?: boolean;
  };
  autoFocus?: boolean;
  changesOpen?: boolean;
  collapsedFieldSets: StateTree<boolean> | undefined;
  collapsedPaths: StateTree<boolean> | undefined;
  focusPath: Path;
  focused?: boolean;
  groups: FormFieldGroup[];
  id: string;
  readOnly?: boolean;
  renderAnnotation?: RenderAnnotationCallback;
  renderBlock?: RenderBlockCallback;
  renderField: RenderFieldCallback;
  renderInlineBlock?: RenderBlockCallback;
  renderInput: RenderInputCallback;
  renderItem: RenderItemCallback;
  renderPreview: RenderPreviewCallback;
  schemaType: ObjectSchemaType;
}
type ScheduleAction = 'publish' | 'unpublish';
type ScheduleState = 'cancelled' | 'scheduled' | 'succeeded';
type ScheduleSort = 'createdAt' | 'executeAt';
interface Schedule {
  author: string;
  action: ScheduleAction;
  createdAt: string;
  dataset: string;
  description: string;
  documents: {
    documentId: string;
    documentType?: string;
  }[];
  executeAt: string | null;
  executedAt?: string;
  id: string;
  name: string;
  projectId: string;
  state: ScheduleState;
  stateReason: string;
}
interface ScheduleFormData {
  date: string;
}
/**
 * @internal
 */
interface SchedulesContextValue {
  activeSchedules: Schedule[];
  schedules: Schedule[];
  schedulesByDate: (date: Date) => Schedule[];
  scheduleState?: ScheduleState;
  selectedDate?: Date;
  setSortBy: (sortBy: ScheduleSort) => void;
  sortBy?: ScheduleSort;
}
/**
 * @internal
 */
interface SearchTerms<Type extends SchemaType | CrossDatasetType = SchemaType> {
  filter?: string;
  params?: Record<string, unknown>;
  query: string;
  types: Type[];
}
/**
 * @internal
 */
interface SearchStory {
  path: string;
  score: number;
  why: string;
}
/**
 * @internal
 */
interface SearchHit {
  hit: SanityDocumentLike;
}
/**
 * @internal
 */
interface WeightedHit extends SearchHit {
  resultIndex: number;
  score: number;
  stories: SearchStory[];
}
/**
 * @internal
 */
interface SearchFactoryOptions {
  maxDepth?: number;
  filter?: string;
  params?: Record<string, unknown>;
  tag?: string;
  unique?: boolean;
  strategy?: SearchStrategy;
  perspective?: ClientPerspective;
  /**
   * The selected editing variant as a bare variant id. When set, documents are searched as seen
   * through that variant, on top of `perspective`.
   */
  variant?: string;
}
/**
 * @internal
 */
interface WeightedSearchResults {
  type: 'weighted';
  hits: WeightedHit[];
  nextCursor?: never;
}
/**
 * @internal
 */
interface Groq2024SearchResults {
  type: 'groq2024';
  hits: SearchHit[];
  nextCursor?: string;
}
/**
 * @internal
 */
type SearchStrategyFactory<TResult extends WeightedSearchResults | Groq2024SearchResults> = (types: (SchemaType | CrossDatasetType)[], client: SanityClient, commonOpts: SearchFactoryOptions) => (searchTerms: string | SearchTerms, searchOpts?: SearchOptions) => Observable<TResult>;
/**
 * @internal
 */
type SearchOptions = {
  maxDepth?: number;
  comments?: string[];
  skipSortByScore?: boolean;
  sort?: SearchSort[];
  cursor?: string;
  limit?: number;
  perspective?: ClientPerspective;
  /**
   * The selected editing variant as a bare variant id. When set, documents are searched as seen
   * through that variant, on top of `perspective`.
   */
  variant?: string;
  isCrossDataset?: boolean;
  queryType?: 'prefixLast' | 'prefixNone';
};
/**
 * @internal
 */
type SortDirection = 'asc' | 'desc';
/**
 * @internal
 */
type SearchSort = {
  direction: SortDirection;
  /**
   * The path/expression as authored by the developer (e.g.
   * `arrayOfReferences[0].favoriteBooks[0].title`). Used for stable
   * serialization (settings storage, listen-query SWR keys, etc.).
   * The projected value in result data is addressed via
   * `result.orderings[projectionIndex]`.
   */
  field: string;
  /**
   * The schema type that this sort `field` is authored against. The
   * search strategy uses this to resolve the GROQ expression for
   * `field` (e.g. inserting `->` for reference traversals).
   *
   * Required when `field` traverses references, accesses arrays,
   * or otherwise depends on schema-aware compilation. Optional for
   * trivial fields like `_id` / `_createdAt` / `title`, where the
   * `field` value works as a literal GROQ expression.
   */
  schemaType?: SchemaType | CrossDatasetType;
  /**
   * Index into the `orderings` projection array at which this
   * entry's value lives in the result. The projected value is
   * available at `result.orderings[projectionIndex]`.
   *
   * Populated by the search strategy after `compileSortExpression`
   * runs — not a caller-facing input. Direct callers of the search
   * strategy should leave this unset.
   */
  projectionIndex?: number;
  mapWith?: string;
  /**
   * Controls whether null/undefined values appear first or last in the sort order.
   *
   * Defaults match PostgreSQL behavior:
   * - `'desc'` direction → nulls first
   * - `'asc'` direction → nulls last
   *
   * **Note:** Overriding the default may have performance implications for document types
   * with lots of documents.
   */
  nulls?: 'first' | 'last';
};
/**
 * A subset of the History API is used, and explicitly declared so it's possible to write a custom
 * history implementation that can be used to integrate the router in a variety of parent routers.
 * @internal
 */
type RequiredHistory = Pick<History, 'listen' | 'location' | 'push' | 'replace'>;
/**
 * The history context is either one of the implementations from the `history` package, or a custom one that only implements
 * the subset of the History API that is used by the router, documented in `RequiredHistory`.
 * @internal
 */
type RouterHistory = BrowserHistory | MemoryHistory | HashHistory | RequiredHistory;
/** @internal */
interface ActiveWorkspaceMatcherContextValue {
  activeWorkspace: WorkspaceSummary;
  setActiveWorkspace: (workspaceName: string) => void;
}
type WorkspaceAuthStates = Record<string, AuthState | undefined>;
/** @internal */
type WorkspacesContextValue = WorkspaceSummary[];
/**
 * @beta
 * @hidden
 */
interface AddonDatasetContextValue {
  /**
   * Addon dataset client, currently called `comments` dataset.
   */
  client: SanityClient | null;
  isCreatingDataset: boolean;
  /**
   * Function to create the addon dataset if it does not exist.
   */
  createAddonDataset: () => Promise<SanityClient | null>;
  ready: boolean;
  error: Error | null;
}
/**
 * @internal
 */
interface SearchFilter {
  fieldId?: string;
  filterName: string;
  operatorType: string;
  value?: any;
}
/**
 * @internal
 */
interface SearchOrdering {
  customMeasurementLabel?: string;
  ignoreScore?: boolean;
  sort?: SearchSort;
  /**
   * i18n key for title
   */
  titleKey: `search.ordering.${string}-label`;
}
type RecentSearch = SearchTerms & {
  __recent: {
    index: number;
    timestamp: number;
  };
  filters?: SearchFilter[];
};
interface PaginationState {
  cursor: string | null;
  nextCursor: string | null;
}
type SearchReducerState = PaginationState & {
  currentUser: CurrentUser | null;
  debug: boolean;
  definitions: SearchDefinitions;
  documentTypesNarrowed: string[];
  filters: SearchFilter[];
  filtersVisible: boolean;
  fullscreen?: boolean;
  lastAddedFilter?: SearchFilter | null;
  lastActiveIndex: number;
  ordering: SearchOrdering;
  result: SearchResult;
  terms: RecentSearch | SearchTerms;
  strategy?: SearchStrategy;
  disabledDocumentIds?: string[];
  canDisableAction?: boolean;
};
interface SearchDefinitions {
  fields: SearchFieldDefinitionDictionary;
  filters: SearchFilterDefinitionDictionary;
  operators: SearchOperatorDefinitionDictionary;
}
interface SearchResult {
  error: Error | null;
  hasLocal: boolean;
  hits: SearchHit[];
  loaded: boolean;
  loading: boolean;
}
type FiltersVisibleSet = {
  type: 'FILTERS_VISIBLE_SET';
  visible: boolean;
};
type LastActiveIndexSet = {
  type: 'LAST_ACTIVE_INDEX_SET';
  index: number;
};
type PageIncrement = {
  type: 'PAGE_INCREMENT';
};
type OrderingReset = {
  type: 'ORDERING_RESET';
};
type OrderingSet = {
  ordering: SearchOrdering;
  type: 'ORDERING_SET';
};
type SearchClear = {
  type: 'SEARCH_CLEAR';
};
type SearchRequestComplete = {
  type: 'SEARCH_REQUEST_COMPLETE';
  hits: SearchHit[];
  nextCursor: string | undefined;
};
type SearchRequestError = {
  type: 'SEARCH_REQUEST_ERROR';
  error: Error;
};
type SearchRequestStart = {
  type: 'SEARCH_REQUEST_START';
};
type TermsFiltersAdd = {
  filter: SearchFilter;
  type: 'TERMS_FILTERS_ADD';
};
type TermsFiltersClear = {
  type: 'TERMS_FILTERS_CLEAR';
};
type TermsFiltersRemove = {
  filterKey: string;
  type: 'TERMS_FILTERS_REMOVE';
};
type TermsFiltersSetOperator = {
  filterKey: string;
  operatorType: string;
  type: 'TERMS_FILTERS_SET_OPERATOR';
};
type TermsFiltersSetValue = {
  filterKey: string;
  type: 'TERMS_FILTERS_SET_VALUE';
  value?: any;
};
type TermsQuerySet = {
  type: 'TERMS_QUERY_SET';
  query: string;
};
type TermsSet = {
  type: 'TERMS_SET';
  filters?: SearchFilter[];
  terms: SearchTerms;
};
type TermsTypeAdd = {
  type: 'TERMS_TYPE_ADD';
  schemaType: SchemaType;
};
type TermsTypeRemove = {
  type: 'TERMS_TYPE_REMOVE';
  schemaType: SchemaType;
};
type TermsTypesClear = {
  type: 'TERMS_TYPES_CLEAR';
};
type SearchAction = FiltersVisibleSet | LastActiveIndexSet | OrderingReset | OrderingSet | PageIncrement | SearchClear | SearchRequestComplete | SearchRequestError | SearchRequestStart | TermsFiltersAdd | TermsFiltersClear | TermsFiltersSetOperator | TermsFiltersRemove | TermsFiltersSetValue | TermsQuerySet | TermsSet | TermsTypeAdd | TermsTypeRemove | TermsTypesClear;
/**
 * @internal
 */
interface SearchContextValue {
  dispatch: Dispatch<SearchAction>;
  onClose: (() => void) | null;
  searchCommandList: CommandListHandle | null;
  setSearchCommandList: Dispatch<SetStateAction<CommandListHandle | null>>;
  setOnClose: (onClose: () => void) => void;
  state: SearchReducerState;
}
/** @internal */
declare function isUnauthorizedError(err: unknown): err is HttpError;
/**
 * Whether a 401 positively signals an invalid session (see
 * {@link INVALID_SESSION_ERROR_CODES}). A 401 *without* one of these codes is
 * a resource-level denial (e.g. an authenticated user lacking a grant —
 * some endpoints answer those with 401, not 403) and must stay
 * caller-domain rather than force a logout; grant denials only happen with
 * a valid session, so they never carry these codes.
 *
 * @internal
 */
declare function isInvalidSessionError(err: unknown): err is HttpError;
/**
 * The API's machine-readable `errorCode` from a client error response body
 * (e.g. `SIO-401-AEX` for an expired session), or `undefined` if absent. The
 * `ClientError` exposes the parsed body on `response.body` (typed `unknown`);
 * fall back to the stringified `responseBody` since older error shapes only
 * carry that.
 *
 * @internal
 */
declare function getApiErrorCode(err: unknown): string | undefined;
/** @internal */
declare function isNetworkError(error: unknown): error is Error;
/**
 * Read the Retry-After header off a ClientError, if present. Per RFC 7231,
 * it's either a non-negative delta-seconds integer or an HTTP date.
 *
 * @internal
 */
declare function parseRetryAfter(err: HttpError): number | undefined;
/**
 * Infrastructure-level error variants the studio's request-error UI knows
 * how to render. Everything else (4xx other than 429, parse errors, etc.)
 * is caller-domain and is never claimed by the studio.
 *
 * @internal
 */
type RequestErrorClassification = {
  type: 'networkError';
  error: Error;
} | {
  type: 'serverError';
  error: HttpError;
} | {
  type: 'rateLimited';
  error: HttpError;
  retryAfterSeconds?: number;
};
/**
 * Classify an error as an infrastructure-level request failure, or return
 * `null` when the error is caller-domain (validation errors, permission
 * denials, conflicts, 404s, ...) and should stay with the caller.
 *
 * Note: 401 is intentionally NOT classified here — whether a 401 means
 * "invalid session" (studio concern) or "this resource refuses you"
 * (caller concern) is decided by the API's explicit error code, which the
 * channel checks separately (see {@link isInvalidSessionError}).
 *
 * @internal
 */
declare function classifyRequestError(err: unknown): RequestErrorClassification | null;
/**
 * A workspace-level configuration error: the project or dataset the
 * studio is pointed at doesn't exist. Unlike the infrastructure errors
 * above, these are not transient and not recoverable by retry — the user
 * has to fix `projectId`/`dataset` in their config (or create the missing
 * resource). The studio surfaces these as a full-screen takeover rather
 * than the retry/reload dialog.
 *
 * Which variant we can report depends on what the failing endpoint tells
 * us. Only the project/dataset management API carries a structured
 * discriminator; the generic `/data` 404 can't tell missing-project from
 * missing-dataset apart, so it isn't classified as a config error at all
 * (see {@link classifyConfigError}).
 *
 * @internal
 */
type ConfigErrorClassification = {
  type: 'projectNotFound';
} | {
  type: 'datasetNotFound';
};
/**
 * Classify a 404 as a studio-configuration error — the project or dataset
 * the studio points at doesn't exist — using only structured response
 * fields (never message text, which isn't stable across endpoints).
 *
 * Recognized structured signals:
 *  - `attributes.type === 'project'` → `projectNotFound`
 *    (project management API)
 *  - `error === 'Dataset not found'` → `datasetNotFound`
 *    (dataset management API; a discrete error code, not free-form text)
 *
 * A 404 without one of these structured signals returns `null` and stays
 * caller-domain — including the generic `/data` 404s, which carry no
 * discriminator and so can't be safely attributed to a missing project or
 * dataset. This classifier only reports what the *response* proves.
 *
 * @internal
 */
declare function classifyConfigError(err: unknown): ConfigErrorClassification | null;
/**
 * Whether an error originates from a Sanity client request — i.e. one a
 * plugin/customization could have delegated to the studio's error UI via
 * `useStudioErrorHandler()` rather than letting it reach an error
 * boundary. Used to surface a dev-only "did you mean to opt in?" tip.
 *
 * @internal
 */
declare function isClientRequestError(err: unknown): boolean;
declare const audienceRoles: readonly ['administrator', 'editor', 'viewer', 'contributor', 'developer', 'custom'];
type AudienceRole = (typeof audienceRoles)[number];
interface StudioAnnouncementDocument {
  _id: string;
  _type: 'productAnnouncement';
  _rev: string;
  _createdAt: string;
  _updatedAt: string;
  title: string;
  name: string;
  body: PortableTextBlock[];
  announcementType: 'whats-new';
  publishedDate: string;
  expiryDate?: string;
  audience: 'everyone' | 'specific-version' | 'greater-than-or-equal-version' | 'less-than-or-equal-version';
  audienceRole?: AudienceRole[] | undefined;
  studioVersion?: string;
  preHeader: string;
}
interface StudioAnnouncementsContextValue {
  studioAnnouncements: StudioAnnouncementDocument[];
  unseenAnnouncements: StudioAnnouncementDocument[];
  onDialogOpen: (mode: DialogMode) => void;
}
type DialogMode = 'card' | 'help_menu';
/** @internal */
interface NavbarContextValue {
  onSearchFullscreenOpenChange: (open: boolean) => void;
  onSearchOpenChange: (open: boolean) => void;
  searchFullscreenOpen: boolean;
  searchFullscreenPortalEl: HTMLElement | null;
  searchOpen: boolean;
}
/**
 * The Studio Layout component is the root component of the Sanity Studio UI.
 * It renders the navbar, the active tool, and the search modal as well as the error boundary.
 *
 * @public
 * @returns A Studio Layout element that renders the navbar, the active tool, and the search modal as well as the error boundary
 * @remarks This component should be used as a child component to the StudioProvider
 * @example Rendering a Studio Layout
 * ```ts
 * <StudioProvider
 *  basePath={basePath}
 *  config={config}
 *  onSchemeChange={onSchemeChange}
 *  scheme={scheme}
 *  unstable_history={unstable_history}
 *  unstable_noAuthBoundary={unstable_noAuthBoundary}
 * >
 *   <StudioLayout />
 *</StudioProvider>
 * ```
 */
declare function StudioLayout(): import("react").JSX.Element;
interface UpsellDialogActionsInfo {
  feature: 'comments' | 'scheduled_publishing' | 'ai_assist' | 'tasks';
  type: 'modal' | 'inspector';
}
/** @internal */
interface UpsellDialogViewedInfo extends UpsellDialogActionsInfo {
  source: 'field_action' | 'document_toolbar' | 'document_action' | 'navbar' | 'link' | 'pte';
}
/**
 * @internal
 */
declare const UpsellDialogViewed: import("@sanity/telemetry").DefinedTelemetryLog<UpsellDialogViewedInfo>;
/**
 * @internal
 */
declare const UpsellDialogDismissed: import("@sanity/telemetry").DefinedTelemetryLog<UpsellDialogActionsInfo>;
/**
 * @internal
 */
declare const UpsellDialogUpgradeCtaClicked: import("@sanity/telemetry").DefinedTelemetryLog<UpsellDialogActionsInfo>;
/**
 * @internal
 */
declare const UpsellDialogLearnMoreCtaClicked: import("@sanity/telemetry").DefinedTelemetryLog<UpsellDialogActionsInfo>;
/** @internal */
interface VisibleWorkspacesContextValue {
  visibleWorkspaces: WorkspaceSummary[];
  workspaceAuthStates: WorkspaceAuthStates;
}
/** @internal */
declare function VisibleWorkspacesProvider({ children }: {
  children: ReactNode;
}): import("react").JSX.Element;
export { ReferenceInputOptions as $, CommandListItemContext as $t, Groq2024SearchResults as A, UserListWithPermissionsOptions as An, DynamicFeedbackTags as At, CommentDocument as B, RequestErrorReportOptions as Bt, isUnauthorizedError as C, CommentUpdatePayload$1 as Cn, DocumentChangeContextInstance as Ct, WorkspaceAuthStates as D, CommentsUIMode$1 as Dn, UserColorManager as Dt, WorkspacesContextValue as E, CommentsType$1 as En, UserColorHue as Et, SearchTerms as F, Grant as Fn, ConsentStatus as Ft, CommentsType as G, ReferenceInputPreviewCard as Gt, CommentOperations as H, ZIndexContextValue as Ht, WeightedSearchResults as I, GrantsStore as In, DivergenceNavigator as It, CommentsContextValue as J, CommandListElementType as Jt, CommentsUIMode as K, usePreviewCard as Kt, SchedulesContextValue as L, PermissionCheckResult as Ln, useDivergenceNavigator as Lt, SearchOptions as M, useUserListWithPermissions as Mn, FeedbackPayload as Mt, SearchSort as N, DocumentValuePermission as Nn, Sentiment as Nt, ActiveWorkspaceMatcherContextValue as O, Loadable as On, UserId as Ot, SearchStrategyFactory as P, EvaluationParams as Pn, TagValue as Pt, EditReferenceOptions as Q, CommandListHandle as Qt, ScheduleFormData as R, ConnectorContextValue as Rn, RequestErrorChannel as Rt, isInvalidSessionError as S, CommentUpdateOperationOptions$1 as Sn, useFormValue as St, AddonDatasetContextValue as T, CommentsTextSelectionItem$1 as Tn, UserColor as Tt, CommentStatus as U, PreviewCard as Ut, CommentMessage as V, StudioErrorHandler as Vt, CommentThreadItem as W, PreviewCardContextValue as Wt, useEnhancedObjectDialog as X, CommandListGetItemKeyCallback as Xt, EnhancedObjectDialogContextValue as Y, CommandListGetItemDisabledCallback as Yt, EditReferenceLinkComponentProps as Z, CommandListGetItemSelectedCallback as Zt, isClientRequestError as _, CommentReactionShortNames$1 as _n, PortableTextInput as _t, UpsellDialogUpgradeCtaClicked as a, CommentContext$1 as an, getTemplatePermissions as at, parseRetryAfter as b, CommentTextSelection$1 as bn, FormValueContextValue as bt, NavbarContextValue as c, CommentFieldCreatePayload$1 as cn, PartialExcept as ct, StudioAnnouncementDocument as d, CommentMessage$1 as dn, createHookFromObservableFactory as dt, CommandListProps as en, ReferenceInputOptionsProvider as et, StudioAnnouncementsContextValue as f, CommentOperations$1 as fn, FormCallbacksProvider as ft, classifyRequestError as g, CommentReactionOption$1 as gn, mergeParseErrors as gt, classifyConfigError as h, CommentReactionItem$1 as hn, ParseError as ht, UpsellDialogLearnMoreCtaClicked as i, CommentBaseCreatePayload$1 as in, TemplatePermissionsResult as it, SearchFactoryOptions as j, UserWithPermission as jn, FeedbackContextValue as jt, RouterHistory as k, UserListWithPermissionsHookValue as kn, BaseFeedbackTags as kt, StudioLayout as l, CommentIntentGetter as ln, LoadingTuple as lt, RequestErrorClassification as m, CommentPostPayload$1 as mn, useFormCallbacks as mt, VisibleWorkspacesProvider as n, CommentsSelectedPath as nn, useReferenceInputOptions as nt, UpsellDialogViewed as o, CommentCreatePayload$1 as on, useTemplatePermissions as ot, ConfigErrorClassification as p, CommentPath$1 as pn, FormCallbacksValue as pt, CommentsMode as q, MetadataWrapper as qt, UpsellDialogDismissed as r, CommentsSelectedPathContextValue as rn, TemplatePermissionsOptions as rt, UpsellDialogViewedInfo as s, CommentDocument$1 as sn, useTemplatePermissionsFromHookFactory as st, VisibleWorkspacesContextValue as t, CommandListRenderItemCallback as tn, TemplateOption as tt, DialogMode as u, CommentListBreadcrumbs$1 as un, ReactHook as ut, isNetworkError as v, CommentStatus$1 as vn, PortableTextMemberItem as vt, SearchContextValue as w, CommentsListBreadcrumbItem$1 as wn, HexColor as wt, getApiErrorCode as x, CommentThreadItem$1 as xn, FormValueProvider as xt, isTimeoutError as y, CommentTaskCreatePayload$1 as yn, UpdateReadOnlyPlugin as yt, FormBuilderContextValue as z, RequestErrorClaim as zt };
//# sourceMappingURL=VisibleWorkspacesProvider-B6w6Mtxv.d.ts.map