import { _ as ConfirmDeleteDialogContainer, a as form, c as StructureBuilderOptions, d as PaneContainer, f as useDocumentPane, g as DocumentInspectorHeader, h as getTypeNamesFromFilter, i as component, l as createStructureBuilder, n as StructureToolProvider, o as HELP_URL, p as DocumentPaneProviderProps, r as StructureToolProviderProps, s as SerializeError, t as useStructureTool, u as DocumentListPaneProps, v as ConfirmDeleteDialogProps } from "./useStructureTool-BMqRgGG5.js";
import { a as PaneContent, i as DocumentPane, n as usePaneOptions, o as Pane, r as DocumentPaneProviderWrapper, t as ORDER_BY_IDS_PARAM_FIELD } from "./orderByIdsParam-iaL_0rCA.js";
import { $ as DefaultDocumentNodeResolver, $t as FormViewBuilder, A as BaseIntentParams, At as DocumentListOptions, B as CollectionBuilder, Bt as defaultInitialValueTemplateItems, C as StructureToolContextValue, Ct as ListItemSerializeOptions, D as UnresolvedPaneNode, Dt as DocumentList, E as StructureToolPaneActionHandler, Et as UnserializedListItemChild, F as IntentParams, Ft as GenericListBuilder, G as SerializeOptions, Gt as PartialDocumentNode, H as DocumentNode, Ht as menuItemsFromInitialValueTemplateItems, I as defaultIntentChecker, It as GenericListInput, J as ChildObservable, Jt as BaseView, K as SerializePath, Kt as documentFromEditor, L as Builder, Lt as ListDisplayOptions, M as Intent, Mt as BaseGenericList, N as IntentChecker, Nt as BuildableGenericList, Ot as DocumentListBuilder, P as IntentJsonParams, Pt as GenericList, Q as DefaultDocumentNodeContext, Qt as FormView, R as Child, Rt as shallowIntentChecker, S as StructureResolverContext, St as ListItemInput, T as StructureToolOptions, Tt as UnserializedListItem, U as EditorNode, Ut as DocumentBuilder, V as Divider, Vt as maybeSerializeInitialValueTemplateItem, W as Serializable, Wt as DocumentOptions, X as ChildResolverOptions, Xt as ViewBuilder, Y as ChildResolver, Yt as GenericViewBuilder, Z as ItemChild, Zt as maybeSerializeView, _ as RouterPaneSiblingContext, _n as getOrderingMenuItemsForSchemaType, _t as ListItem, a as DocumentFieldMenuActionNode, an as ComponentInput, at as BuildableList, b as StrictVersionLayeringOptions, bt as ListItemCount, c as ListPaneNode, cn as maybeSerializeMenuItemGroup, ct as ListInput, d as PaneMenuItem, dn as MenuItemActionType, dt as DocumentTypeListInput, en as ComponentView, et as StructureBuilder, f as PaneMenuItemGroup, fn as MenuItemBuilder, ft as DocumentListItem, g as RouterPaneSibling, gn as getOrderingMenuItem, gt as isDocumentListItem, h as RouterPaneGroup, hn as SortMenuItem, ht as PartialDocumentListItem, i as CustomComponentPaneNode, in as ComponentBuilder, it as View, j as DEFAULT_INTENT_HANDLER, jt as PartialDocumentList, kt as DocumentListInput, l as PaneListItem, ln as KnownMenuItemParams, lt as SingletonListBuilder, m as PaneNodeResolver, mn as PartialMenuItem, mt as DocumentListItemInput, nn as BuildableComponent, nt as UserComponent, o as DocumentListPaneNode, on as MenuItemGroup, ot as List, p as PaneNode, pn as MenuItemParamsType, pt as DocumentListItemBuilder, q as StructureNode, qt as documentFromEditorWithInitialValue, r as BaseResolvedPaneNode, rn as Component, rt as UserViewComponent, s as DocumentPaneNode, sn as MenuItemGroupBuilder, st as ListBuilder, tn as ComponentViewBuilder, tt as StructureContext, u as PaneListItemDivider, un as MenuItem, ut as DocumentTypeListBuilder, v as RouterPanes, vn as maybeSerializeMenuItem, vt as ListItemBuilder, w as StructureToolFeatures, wt as PartialListItem, x as StructureResolver, xt as ListItemDisplayOptions, y as SerializablePaneNode, yt as ListItemChild, z as Collection, zt as InitialValueTemplateItemBuilder } from "./DocumentPaneContext-CWVXDuPK.js";
import { a as ParameterizedLinkProps, i as PaneRouterContextValue, n as ChildLinkProps, o as ReferenceChildLinkProps, r as EditReferenceOptions, t as BackLinkProps } from "./types-lQwFMubT.js";
import { a as usePaneRouter, i as PaneRouterContext, n as useDocumentTitle, o as PaneLayout, r as StructureLocaleResourceKeys, t as UseDocumentTitle } from "./useDocumentTitle-CYYM3Nm4.js";
import { SelectableTone } from "@sanity/ui";
import { ActionComponent, DecorationMember, DocumentActionDialogProps, DocumentDefinition, PreviewConfig, SanityClient, SanityDocument } from "sanity";
type IncomingReferenceActionsContext = {
  /**
   * The document that is linked to the reference.
   */
  document: SanityDocument;
  getClient: (options: {
    apiVersion: string;
  }) => SanityClient;
};
type IncomingReferenceActionDescription = {
  label: string;
  icon?: React.ElementType;
  tone?: SelectableTone;
  disabled?: boolean;
  onHandle: (() => Promise<void>) | (() => void);
  dialog?: DocumentActionDialogProps | false | null;
};
/**
 * Incoming reference action component definition.
 * Allows users to define actions that will be shown in the IncomingReferences component as part
 * of each reference
 * example:
 * ```ts
 * export const LogReferenceAction: IncomingReferenceAction = ({document, getClient}) => {
 *   return {
 *     label: 'Log reference',
 *     icon: LogIcon,
 *     onHandle: () => console.log(document._id)
 *   }
 * }
 * ```
 *
 * @beta
 */
type IncomingReferenceAction = ActionComponent<IncomingReferenceActionsContext, IncomingReferenceActionDescription>;
interface CrossDatasetIncomingReference {
  type: string;
  title?: string;
  dataset: string;
  preview: PreviewConfig;
  studioUrl?: (document: {
    id: string;
    type?: string;
  }) => string | null;
}
interface IncomingReferenceType {
  type: string;
  dataset?: never;
  title?: string;
}
type IncomingReferencesFilterResolver = (context: {
  document: SanityDocument | undefined;
  getClient: (options: {
    apiVersion: string;
  }) => SanityClient;
}) => string | {
  filter: string;
  filterParams?: Record<string, string>;
} | Promise<{
  filter: string;
  filterParams?: Record<string, string>;
}>;
type IncomingReferencesOptions = {
  name: string;
  title?: string;
  description?: string;
  /**
   * The type of the incoming references.
   */
  types: (IncomingReferenceType | CrossDatasetIncomingReference)[];
  /**
   * The filter query to apply to the incoming references in addition to the type filter.
   * For example: filter all books that are from an specific editorial brand: `editorialBrand == "Random House"`
   * The `_type` filter is applied automatically.
   */
  filter?: string | IncomingReferencesFilterResolver;
  filterParams?: Record<string, string>;
  /**
   * Callback to link a document to a reference.
   *
   * This function is called when a user wants to link an existing document to the current document.
   * It receives two parameters:
   * - The document that will be linked (the target document)
   * - The reference object with all properties needed to establish the link
   *
   * The developer must implement this function to define where and how the reference
   * should be placed within the document structure. The function should return the
   * modified document with the reference properly added.
   *
   * For example:
   *  - We want to link a book to an author:
   * ```ts
   *  onLinkDocument: (document, reference) => {
   *   return {
   *     ...document,
   *     author: reference,
   *   }
   *  }
   * ```
   *
   *
   * @param document - The document to link to the reference.
   * @param reference - The reference to link to the document.
   * @returns The document to link to the reference. If false, the document will not be linked to the reference.
   */
  onLinkDocument?: (document: SanityDocument, reference: {
    _type: 'reference';
    _ref: string;
    _weak?: boolean;
    _strengthenOnPublish?: {
      type: string;
    };
  }) => SanityDocument | false;
  /**
   * Callback to define the actions that will be shown for the incoming reference document.
   *
   * For example:
   * ```ts
   * actions: ({document, client}) => {
   *   return [
   *     {label: 'Unlink document',
   *     icon: TrashIcon,
   *     tone: 'critical',
   *     onClick: async () => {
   *       await client.createOrReplace({...document, _id: getDraftId(document._id), author: undefined})
   *     }
   *   }
   *  ]
   * }
   * ```
   * @param context - The context of the linked document.
   * @returns The actions that will be shown for the linked document.

   */
  actions?: IncomingReferenceAction[];
  /**
   * Whether to allow creation of new references.
   * default: true
   *
   * If false, it will only be possible to link to existing documents, if the `onLinkDocument` callback is provided.
   * If true, it will be possible to create new references to any template of the type.
   * If an array is provided, it will only be possible to create new references that match the template id in the array provided.
   *
   * To define how a creation will be handled, you can use the `initialValue` option in the
   * document type that will be linked.
   *
   * For example:
   * I want to create a new book from an author:
   * In the author we will have the <IncomingReferenceInput /> with the creationAllowed set to true.
   *
   * Then in the book type, we will have the `initialValue` option to define the default values for the new book.
   * This initialValue callback will receive the `reference` object that needs to be linked to the book in the params.
   *
   * ```ts
   * // Book type
   * export default {
   *   type: 'document',
   *   name: 'book',
   *   title: 'Book',
   *   fields: [
   *     {
   *       name: 'author',
   *       type: 'reference',
   *       to: [{type: 'author'}],
   *     },
   *   ],
   *   initialValue: (params) => {
   *    return {
   *      author: params?.reference,
   *    }
   *  }
   * ```
   */
  creationAllowed?: boolean | string[];
};
/**
 * Helper function to define an incoming references decoration.
 *
 * example:
 * ```ts
 * defineType({
 *   name: 'author',
 *   type: 'document',
 *   renderMembers: (members) => {
 *    return [
 *      ...members,
 *      defineIncomingReferenceDecoration({
 *        name: 'incomingReferences',
 *        title: 'Incoming references',
 *        types: [{type: 'author'}],
 *      }),
 *    ]
 *   },
 * })
 * ```
 *
 * @beta
 */
export declare function defineIncomingReferenceDecoration(options: IncomingReferencesOptions): DecorationMember;
interface IncomingReferenceCreationParams {
  reference: {
    _type: 'reference';
    _ref: string;
    _weak?: boolean;
    _strengthenOnPublish?: {
      type: string;
    };
  };
  from: {
    fieldName: string;
    type: string;
  };
  __internal_isIncomingReferenceCreation: true;
  [key: string]: unknown;
}
/**
 * Helper function to check if the document is being created from an incoming reference.
 * It will be used in the initialValue callback to determine if the document is being created from an incoming reference.
 *
 * example:
 * ```ts
 * defineType({
 *   name: 'book',
 *   type: 'document',
 *   fields: [...],
 *   initialValue: (params) => {
 *     // If the document is being created from an incoming reference, return the reference
 *     // Otherwise, return undefined
 *     return {
 *       author: isIncomingReferenceCreation(params) ? params.reference : undefined,
 *     }
 *   },
 * })
 * ```
 *
 * @beta
 */
export declare function isIncomingReferenceCreation(initialValue: DocumentDefinition['initialValue']): initialValue is IncomingReferenceCreationParams;
/**
 * The locale namespace for the structure tool
 *
 * @public
 */
export declare const structureLocaleNamespace: 'structure';
/**
 * The structureTool is a studio plugin which adds the “structure tool” – a tool within
 * Sanity Studio in which content editors can drill down to specific documents to edit them.
 * You can configure your Studio's structure tool(s).
 *
 * @public
 * @param options - Options for the structure tool. See {@link StructureToolOptions}
 * @example Minimal example
 * ```ts
 * // sanity.config.ts
 * import { defineConfig } from 'sanity'
 * import { structureTool } from 'sanity/structure'
 *
 * export default defineConfig((
 *  // ...
 *  plugins: [
 *    structureTool() // use defaults
 *  ]
 * })
 * ```
 *
 * @example To customise your structure tool
 * ```ts
 * // sanity.config.ts
 * import { defineConfig } from 'sanity'
 * import { structureTool } from 'sanity/structure'
 * import { FaCar } from 'react-icons'

 * export default defineConfig((
 *	 // ...
 *   plugins: [
 *    structureTool({
 *      name: 'cars',
 *      title: 'Cars',
 *      icon: FaCar,
 *      structure: (S) => S.documentTypeList('car'),
 *      defaultDocumentNode: (S) =>
 *        S.document().views([
 *          S.view.form(),
 *          S.view.component(Preview).title('Preview')
 *        ])
 *    })
 *  ]
 * })
 * ```
 * */
export declare const structureTool: import("sanity").Plugin<void | StructureToolOptions>;
export { type BackLinkProps, type BaseGenericList, type BaseIntentParams, type BaseResolvedPaneNode, type BaseView, type BuildableComponent, type BuildableGenericList, type BuildableList, type Builder, type Child, type ChildLinkProps, type ChildObservable, type ChildResolver, type ChildResolverOptions, type Collection, type CollectionBuilder, type Component, ComponentBuilder, type ComponentInput, type ComponentView, ComponentViewBuilder, ConfirmDeleteDialogContainer as ConfirmDeleteDialog, type ConfirmDeleteDialogProps, type CustomComponentPaneNode, DEFAULT_INTENT_HANDLER, type DefaultDocumentNodeContext, type DefaultDocumentNodeResolver, type Divider, DocumentBuilder, type DocumentFieldMenuActionNode, DocumentInspectorHeader, type DocumentList, DocumentListBuilder, type DocumentListInput, type DocumentListItem, DocumentListItemBuilder, type DocumentListItemInput, type DocumentListOptions, PaneContainer as DocumentListPane, type DocumentListPaneNode, type DocumentListPaneProps, type DocumentNode, type DocumentOptions, DocumentPane, type DocumentPaneNode, DocumentPaneProviderWrapper as DocumentPaneProvider, type DocumentPaneProviderProps, DocumentTypeListBuilder, type DocumentTypeListInput, type EditReferenceOptions, type EditorNode, type FormView, FormViewBuilder, type GenericList, GenericListBuilder, type GenericListInput, GenericViewBuilder, HELP_URL, type IncomingReferenceAction, type IncomingReferencesOptions, InitialValueTemplateItemBuilder, type Intent, type IntentChecker, type IntentJsonParams, type IntentParams, type ItemChild, type KnownMenuItemParams, type List, ListBuilder, type ListDisplayOptions, type ListInput, type ListItem, ListItemBuilder, type ListItemChild, type ListItemCount, type ListItemDisplayOptions, type ListItemInput, type ListItemSerializeOptions, type ListPaneNode, type MenuItem, type MenuItem as StructureToolMenuItem, type MenuItemActionType, MenuItemBuilder, type MenuItemGroup, MenuItemGroupBuilder, type MenuItemParamsType, ORDER_BY_IDS_PARAM_FIELD, Pane, PaneContent, PaneLayout, type PaneListItem, type PaneListItemDivider, type PaneMenuItem, type PaneMenuItemGroup, type PaneNode, type PaneNodeResolver, PaneRouterContext, type PaneRouterContextValue, type ParameterizedLinkProps, type PartialDocumentList, type PartialDocumentListItem, type PartialDocumentNode, type PartialListItem, type PartialMenuItem, type ReferenceChildLinkProps, type RouterPaneGroup, type RouterPaneSibling, type RouterPaneSiblingContext, type RouterPanes, type Serializable, type SerializablePaneNode, SerializeError, type SerializeOptions, type SerializePath, type SingletonListBuilder, type SortMenuItem, type StrictVersionLayeringOptions, type StructureBuilder, type StructureBuilderOptions, type StructureContext, type StructureLocaleResourceKeys, type StructureNode, type StructureResolver, type StructureResolverContext, type StructureToolContextValue, type StructureToolFeatures, type StructureToolOptions, type StructureToolPaneActionHandler, StructureToolProvider, type StructureToolProviderProps, type UnresolvedPaneNode, type UnserializedListItem, type UnserializedListItemChild, type UseDocumentTitle, type UserComponent, type UserViewComponent, type View, type ViewBuilder, component, createStructureBuilder, defaultInitialValueTemplateItems, defaultIntentChecker, documentFromEditor, documentFromEditorWithInitialValue, form, getOrderingMenuItem, getOrderingMenuItemsForSchemaType, getTypeNamesFromFilter, isDocumentListItem, maybeSerializeInitialValueTemplateItem, maybeSerializeMenuItem, maybeSerializeMenuItemGroup, maybeSerializeView, menuItemsFromInitialValueTemplateItems, shallowIntentChecker, useDocumentPane, useDocumentTitle, usePaneOptions, usePaneRouter, useStructureTool };
//# sourceMappingURL=structure.d.ts.map