import { Application, ApplicationBase, DocumentHandle, Installation, InstallationInclude } from "@sanity/sdk";
import React, { PropsWithChildren } from "react";
import { PathChangeMessage } from "@sanity/message-protocol";
import { ApplicationConfig, ApplicationConfig as ApplicationConfig$1, ApplicationConfigAppType, ApplicationConfigAppType as ApplicationConfigAppType$1, ApplicationContext, ApplicationContext as ApplicationContext$1, Capability, CapabilityRecord, ConnectMessageBusOptions, DashboardTopics, EventTopic, EventTopic as EventTopic$1, EventTopicDef, MessageBus, MessageBusAbortOptions, MessageBusClient, MessageBusConnection, MessageBusEmitOptions, MessageBusEmitOptions as MessageBusEmitOptions$1, MessageBusEmitResult, MessageBusEmitResult as MessageBusEmitResult$1, MessageBusError, MessageBusErrorCode, MessageBusHost, MessageBusMessage, MessageBusMeta, MessageBusQueryOptions, MessageBusStateSource, NavigationLocation, NavigationTarget, PayloadOf, PayloadOf as PayloadOf$1, RemoteModuleRef, RemoteModuleRef as RemoteModuleRef$1, ReplyOf, ReplyOf as ReplyOf$1, StateTopic, StateTopic as StateTopic$1, StateTopicDef, TopicData, TopicData as TopicData$1, TopicError, TopicName, TopicResult, Topics, ValueOf, ValueOf as ValueOf$1, capabilities, connectMessageBus } from "@sanity/sdk/dashboard";
import { CurrentUser as CurrentUser$1 } from "@sanity/types";
import { UserOptions } from "@module-federation/runtime/types";
/**
 * Authenticates the SDK with the Sanity Dashboard's session when the app runs
 * inside the dashboard.
 *
 * The dashboard owns the session there: this provider subscribes to the token
 * the dashboard issues, writes each new value into the SDK's auth store (where
 * SDK hooks read it from), and asks the dashboard for a fresh token when a
 * request fails with a 401. Outside the dashboard it renders children
 * unchanged and the app's normal auth flow applies.
 *
 * @remarks
 * `AuthBoundary` mounts this automatically, so most apps never need it
 * directly. Mount it yourself only when your app runs inside the dashboard
 * without `AuthBoundary` — that is, the app renders its own loading and error
 * UI instead of the SDK's login flow — but still uses SDK hooks such as
 * `useQuery`, which need the dashboard's token in the auth store to
 * authenticate their requests.
 *
 * Mount it once, inside the provider that creates the Sanity instance whose
 * store should receive the token.
 *
 * @example
 * ```tsx
 * import {ResourceProvider} from '@sanity/sdk-react'
 * import {TokenRefreshProvider} from '@sanity/sdk-react/dashboard'
 *
 * function EmbeddedApp() {
 *   return (
 *     <ResourceProvider fallback={<Loading />}>
 *       <TokenRefreshProvider>
 *         <App />
 *       </TokenRefreshProvider>
 *     </ResourceProvider>
 *   )
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
declare const DashboardTokenRefreshProvider: React.FC<PropsWithChildren>;
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
/**
 * @public
 * @category Remote Modules
 */
type FederationRemote = {
  name: string;
  entry: string;
};
/**
 * @public
 * @category Remote Modules
 */
type CreateRemoteInstanceOptions = MakeOptional<Pick<UserOptions, 'name' | 'remotes' | 'shared' | 'plugins'>, 'remotes' | 'plugins'>;
/**
 * @public
 * @category Remote Modules
 */
interface RemoteInstance {
  registerRemotes(remotes: FederationRemote[]): void;
  /** Loads and evaluates a remote expose. */
  loadRemote<T>(id: string): Promise<T | null>;
  /** Preloads assets without evaluating them; omit exposes to warm the whole remote. */
  preloadRemote(name: string, exposes?: string[]): Promise<void>;
}
/**
 * Creates a client for registering, loading, and preloading federated modules.
 * @public
 * @category Remote Modules
 */
export declare function createRemoteInstance(options: CreateRemoteInstanceOptions): RemoteInstance;
/**
 * @public
 * @category URLs
 */
interface DashboardUrl {
  url(options?: {
    origin?: string;
  }): string;
  toURL(options: {
    origin: string;
  }): URL;
  toString(): string;
}
/**
 * @public
 * @category URLs
 */
interface EditIntentParameters {
  id: string;
  /** The document schema type, for example `post`. */
  type?: string;
  /** Requests a Studio edit mode, such as `structure` or `presentation`. */
  mode?: 'structure' | 'presentation' | (string & Record<never, never>);
}
/**
 * @public
 * @category URLs
 */
interface CreateIntentParameters {
  template: string;
  type: string;
}
/**
 * @public
 * @category URLs
 */
interface ReleaseIntentParameters {
  id: string;
}
/**
 * @public
 * @category URLs
 */
interface StudioWorkspaceUrl extends DashboardUrl {
  intent(intent: 'edit', parameters: EditIntentParameters): StudioIntentUrl;
  intent(intent: 'create', parameters: CreateIntentParameters): StudioIntentUrl;
  intent(intent: 'release', parameters: ReleaseIntentParameters): StudioIntentUrl;
  path(...path: string[]): DashboardUrl;
  task(taskId: string): DashboardUrl;
}
/**
 * @public
 * @category URLs
 */
interface StudioUrl extends StudioWorkspaceUrl {
  workspace(workspace: string): StudioWorkspaceUrl;
}
/**
 * @public
 * @category URLs
 */
interface StudioIntentUrl extends DashboardUrl {
  perspective(perspective: string): StudioIntentUrl;
  comment(commentId: string): StudioIntentUrl;
  task(taskId: string): DashboardUrl;
}
/**
 * @public
 * @category URLs
 */
interface CoreApplicationUrl extends DashboardUrl {
  path(...path: string[]): DashboardUrl;
}
/**
 * @public
 * @category URLs
 */
interface MediaLibraryUrl extends DashboardUrl {
  asset(assetId: string): DashboardUrl;
  collection(collectionId: string): DashboardUrl;
}
/**
 * @public
 * @category URLs
 */
interface CanvasUrl extends DashboardUrl {
  document(documentId: string): DashboardUrl;
}
/**
 * Base class for immutable URL grammars.
 *
 * @public
 * @category URLs
 */
export declare class UrlBuilder implements DashboardUrl {
  #private;
  /**
   * Creates an immutable URL builder at the supplied URL.
   *
   * @example
   * ```ts
   * const builder = new UrlBuilder(
   *   new URL('/applications/my-app', 'https://dashboard.sanity.io'),
   * )
   *
   * builder.url() // '/applications/my-app'
   * ```
   */
  constructor(url: URL);
  /**
   * Returns a builder with each value appended as one encoded path segment.
   *
   * Route literals and identifiers can be passed together. A slash inside a value stays within
   * that segment instead of creating another route level.
   *
   * @example
   * ```ts
   * class DocumentUrlBuilder extends UrlBuilder {
   *   document(documentId: string) {
   *     return this.append('documents', documentId)
   *   }
   * }
   *
   * const builder = new DocumentUrlBuilder(new URL('https://dashboard.sanity.io'))
   * builder.document('drafts/document-1').url()
   * // '/documents/drafts%2Fdocument-1'
   * ```
   */
  protected append(...segments: string[]): this;
  /**
   * Returns a builder with changes made through the platform `URL` API.
   *
   * This supports URL details outside the path grammar, including search parameters and hashes.
   *
   * @example
   * ```ts
   * class DocumentUrlBuilder extends UrlBuilder {
   *   perspective(name: string) {
   *     return this.edit((url) => url.searchParams.set('perspective', name))
   *   }
   *
   *   panel(panelId: string) {
   *     return this.edit((url) => {
   *       url.hash = `panel/${panelId}`
   *     })
   *   }
   * }
   * ```
   */
  protected edit(update: (url: URL) => void): this;
  /**
   * Returns another builder type rooted at the appended path segments.
   *
   * Use this inside a custom builder method only when its route enters a child grammar with
   * different methods; use `append` when chaining stays on the current grammar.
   *
   * @example
   * ```ts
   * class DocumentUrlBuilder extends UrlBuilder {
   *   perspective(name: string) {
   *     return this.edit((url) => url.searchParams.set('perspective', name))
   *   }
   * }
   *
   * class ApplicationUrlBuilder extends UrlBuilder {
   *   document(documentId: string) {
   *     return this.transitionTo(DocumentUrlBuilder, 'documents', documentId)
   *   }
   * }
   *
   * const builder = new ApplicationUrlBuilder(new URL('https://dashboard.sanity.io'))
   * builder.document('document-1').perspective('published').url()
   * // '/documents/document-1?perspective=published'
   * ```
   */
  protected transitionTo<Builder extends UrlBuilder>(Builder: new (url: URL) => Builder, ...segments: string[]): Builder;
  /**
   * Returns the URL as a relative string by default.
   *
   * Supplying an origin returns an absolute URL string for the same dashboard route.
   *
   * @example
   * ```ts
   * const builder = new UrlBuilder(
   *   new URL('/applications/my-app', 'https://dashboard.sanity.io'),
   * )
   *
   * builder.url() // '/applications/my-app'
   * builder.url({origin: 'https://dashboard.sanity.io'})
   * // 'https://dashboard.sanity.io/applications/my-app'
   * ```
   */
  url(options?: {
    origin?: string;
  }): string;
  /**
   * Returns the URL as a platform `URL` object using the supplied origin.
   *
   * @example
   * ```ts
   * const builder = new UrlBuilder(
   *   new URL('/applications/my-app', 'https://dashboard.sanity.io'),
   * )
   *
   * builder.toURL({origin: 'https://dashboard.sanity.io'}).pathname
   * // '/applications/my-app'
   * ```
   */
  toURL({ origin }: {
    origin: string;
  }): URL;
  /**
   * Returns the same relative URL as {@link UrlBuilder.url}.
   *
   * @example
   * ```ts
   * const builder = new UrlBuilder(
   *   new URL('/applications/my-app', 'https://dashboard.sanity.io'),
   * )
   *
   * `${builder}` // '/applications/my-app'
   * ```
   */
  toString(): string;
}
/**
 * @public
 * @category URLs
 */
interface Urls {
  studios(): DashboardUrl;
  studios(appId: string): StudioUrl;
  applications(): DashboardUrl;
  applications(appId: string): CoreApplicationUrl;
  mediaLibrary(): MediaLibraryUrl;
  canvas(): CanvasUrl;
  home(): DashboardUrl;
  extend<const Builders extends Readonly<Record<string, {
    readonly namespace: string;
    new (url: URL): UrlBuilder;
  }>>>(builders: Builders & Partial<Record<keyof this, never>>): this & { readonly [Name in keyof Builders]: () => InstanceType<Builders[Name]>; };
}
/**
 * @public
 * @category URLs
 */
export declare const urlFor: Urls;
/**
 * @public
 * @category Types
 * @category Agent Actions
 */
interface AgentResourceContextOptions {
  /**
   * The project ID of the current context
   */
  projectId: string;
  /**
   * The dataset of the current context
   */
  dataset: string;
  /**
   * Optional document ID if the user is viewing/editing a specific document
   */
  documentId?: string;
}
/**
 * @public
 * Hook for reporting the resource the user is currently interacting with (for example, which
 * document they're editing) so the Agent can understand their context. The hook reports on mount
 * and again whenever the context changes.
 *
 * The two Dashboard runtimes differ in transport, but the signature is the same:
 * - In an iframe (Comlink), it emits the `dashboard/v1/events/agent/resource/update` event.
 * - In a federated app (message bus), it publishes {@link useApplicationContext}'s
 *   `applications.context.update` topic. Reach for `useApplicationContext` directly in new code.
 *
 * @category Agent Actions
 * @param options - The resource context options containing projectId, dataset, and optional documentId
 *
 * @example
 * ```tsx
 * import {useAgentResourceContext} from '@sanity/sdk-react/dashboard'
 *
 * function MyComponent() {
 *   const documentId = 'my-document-id'
 *
 *   // Automatically updates the Agent's context whenever the document changes
 *   useAgentResourceContext({
 *     projectId: 'my-project',
 *     dataset: 'production',
 *     documentId,
 *   })
 *
 *   return <div>Editing document: {documentId}</div>
 * }
 * ```
 */
export declare function useAgentResourceContext(options: AgentResourceContextOptions): void;
type DashboardTopicEntry = Extract<NonNullable<ValueOf$1<'applications.list'>>, {
  ok: true;
}>['value'][number];
type DashboardTopicApplication = Extract<DashboardTopicEntry, {
  type: unknown;
}>;
type DashboardApplicationInterface = NonNullable<NonNullable<DashboardTopicApplication['activeDeployment']>['interfaces']>[number];
type ViewInterface = Exclude<DashboardApplicationInterface, {
  type: 'worker';
}>;
/**
 * The shared identity fields attached to each {@link DashboardView.application} and
 * {@link DashboardWebWorker.application}, and the input to module loading. Widens
 * {@link ApplicationBase} so `type` also covers installations.
 * @public
 * @category Types
 * @category Dashboard
 */
type DashboardApplicationBase = Omit<ApplicationBase, 'type'> & {
  readonly type: ApplicationBase['type'] | 'installation';
  /** Served by a CLI dev server rather than a deployment. */
  readonly isLocal: boolean;
};
/**
 * A dashboard view exposed by an application or installation.
 * @public
 * @category Types
 * @category Dashboard
 */
type DashboardView = { [Type in ViewInterface['type']]: Omit<Extract<ViewInterface, {
  type: Type;
}>, 'type'> & {
  readonly application: DashboardApplicationBase;
  readonly module: RemoteModuleRef$1;
  readonly surface: Type extends 'app' ? 'window' : Type;
}; }[ViewInterface['type']];
/**
 * A web worker exposed by an application or installation.
 * @public
 * @category Types
 * @category Dashboard
 */
type DashboardWebWorker = Extract<DashboardApplicationInterface, {
  type: 'worker';
}> & {
  readonly application: DashboardApplicationBase;
  readonly module: RemoteModuleRef$1;
};
/**
 * An installation shaped into the shared application base, with its raw record kept under
 * `installation` for consumers that need the full record.
 * @public
 * @category Types
 * @category Dashboard
 */
type DashboardInstallation = Omit<DashboardApplicationBase, 'type'> & {
  readonly type: 'installation';
  readonly installation: Installation<InstallationInclude>;
};
/**
 * A dashboard entry — an application or an installation — in one consistent shape, with its
 * loadable views and web workers. `type` distinguishes the kinds and `isLocal` marks dev-server
 * applications; render a list without branching.
 * @public
 * @category Types
 * @category Dashboard
 */
type DashboardApplication = (DashboardTopicApplication | DashboardInstallation) & Pick<DashboardApplicationBase, 'isLocal'> & {
  readonly views: DashboardView[];
  readonly webWorkers: DashboardWebWorker[];
};
/**
 * Returns the applications and installations available in the dashboard, in one consistent shape.
 *
 * Suspends until the dashboard publishes its list; a cleared list is empty. Throws a `TopicError`
 * to the nearest error boundary when the dashboard fails to load. Every entry exposes the same base
 * fields plus `views` and `webWorkers`; `type` distinguishes applications (`'studio' | 'coreApp'`)
 * from installations (`'installation'`), which also carry the raw record under `installation`.
 * `isLocal` marks applications served by a CLI dev server.
 *
 * @example
 * ```tsx
 * function Applications() {
 *   const applications = useApplications()
 *   return applications.map((application) => <div key={application.id}>{application.title}</div>)
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useApplications(): DashboardApplication[];
/**
 * Returns a dashboard application by id, or `null` when it is unavailable.
 *
 * Suspends until the dashboard publishes its application list.
 *
 * @example
 * ```tsx
 * function SelectedApplication({id}: {id: string}) {
 *   const application = useApplication(id)
 *   return application ? <h1>{application.title}</h1> : <p>Application unavailable</p>
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useApplication(applicationId: DashboardApplication['id']): DashboardApplication | null;
/**
 * Returns the base path for an application.
 *
 * Suspends until Dashboard publishes the path and throws a `TopicError` when the application is
 * unknown.
 *
 * @example
 * ```tsx
 * function ApplicationBasePath() {
 *   const basePath = useApplicationBasePath()
 *   return <span>{basePath}</span>
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useApplicationBasePath(): TopicData$1<'applications.base-path'>;
/**
 * Selects an application configuration by application id or application type.
 * @public
 * @category Types
 * @category Dashboard
 */
type ApplicationConfigSelector = {
  appId: Application['id'];
  appType?: never;
} | {
  appId?: never;
  appType: ApplicationConfigAppType$1;
};
/**
 * Returns an application configuration by application id or application type, or `null` when
 * none matches.
 *
 * An `appType` query matches the type-level config only (the one without an `appId`), so it is
 * independent of the order the dashboard published configs in. An `appId` query matches that
 * application's config.
 *
 * Suspends until the dashboard publishes its application configs.
 *
 * @example
 * ```tsx
 * function MediaLibraryConfig() {
 *   const config = useApplicationConfig({appType: 'media-library'})
 *   return config ? <span>{config.moduleId}</span> : <p>Not installed</p>
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useApplicationConfig(selector: ApplicationConfigSelector): ApplicationConfig$1 | null;
/**
 * Returns the application configuration modules available in the dashboard.
 *
 * Suspends until the dashboard publishes its application configs; a cleared list is empty.
 *
 * @example
 * ```tsx
 * function Applications() {
 *   const configs = useApplicationConfigs()
 *   return configs.map((config) => <div key={config.moduleId}>{config.appType}</div>)
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useApplicationConfigs(): readonly ApplicationConfig$1[];
/**
 * Publishes what this application is currently showing to the Dashboard message bus, so the host
 * can hold the foreground application's context. Pass `null` when nothing is open.
 *
 * The context is published on mount and whenever it changes, and cleared with `null` on unmount.
 * A change publishes `null` before the new context, as the component has stopped showing the old
 * one. Pass a memoised value: the hook compares by reference, so a new object on every render
 * republishes on every render.
 *
 * The host reads the sending application from `message.meta.appId`, so the payload carries no
 * application ID.
 *
 * @param context - The application context to publish, or `null` to clear it
 *
 * @example
 * ```tsx
 * import {useApplicationContext} from '@sanity/sdk-react/dashboard'
 * import {useMemo} from 'react'
 *
 * function DocumentView({documentId}: {documentId: string}) {
 *   const context = useMemo(
 *     () => ({resource: {id: 'my-project.production', type: 'dataset' as const}, document: {id: documentId}}),
 *     [documentId],
 *   )
 *   useApplicationContext(context)
 *   return <div>Editing {documentId}</div>
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useApplicationContext(context: ApplicationContext$1 | null): void;
/**
 * Returns the id of the application in the foreground, or `null` when Dashboard has none.
 *
 * Suspends until Dashboard publishes the foreground application.
 *
 * @example
 * ```tsx
 * function ForegroundApplication() {
 *   const foregroundId = useApplicationForegroundId()
 *   return <span>{foregroundId ?? 'No foreground application'}</span>
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useApplicationForegroundId(): Application['id'] | null;
/**
 * Returns the session token for the reading connection, or `null` while signed out.
 *
 * Suspends until Dashboard publishes the token.
 *
 * @example
 * ```tsx
 * function AuthToken() {
 *   const token = useAuthToken()
 *   return <span>{token ?? 'Signed out'}</span>
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useAuthToken(): string | null;
/**
 * Returns the capabilities the host provides.
 *
 * A capability is something the host provides; an application reads this record to hide its own
 * implementation of anything the host provides, or to skip publishing to a capability the host
 * does not have. A missing key means the host does not provide that capability.
 *
 * Suspends until the host publishes the record.
 *
 * @example
 * ```tsx
 * function UserMenu() {
 *   const {globalUserMenu} = useCapabilities()
 *   if (globalUserMenu) return null
 *   return <LocalUserMenu />
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useCapabilities(): TopicData$1<'applications.capabilities'>;
/**
 * Returns the signed-in user, or `null` while signed out.
 *
 * Suspends until Dashboard publishes the current user.
 *
 * @example
 * ```tsx
 * function CurrentUser() {
 *   const user = useCurrentUser()
 *   return <span>{user?.name ?? 'Signed out'}</span>
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useCurrentUser(): CurrentUser$1 | null;
/**
 * Emits a dashboard event topic, typed to the topic's payload and reply.
 * @public
 * @category Types
 * @category Dashboard
 */
type TopicEmitter<K extends EventTopic$1> = (...args: PayloadOf$1<K> extends void ? [payload?: void, options?: MessageBusEmitOptions$1] : [payload: PayloadOf$1<K>, options?: MessageBusEmitOptions$1]) => MessageBusEmitResult$1<ReplyOf$1<K>>;
/**
 * Returns a stable function that emits a dashboard event topic.
 *
 * The event is sent immediately. Ignore the lazy result for fire-and-forget delivery, await it
 * inside `useTransition` to track a reply, or read it with React `use` to suspend. A reply
 * that fails (`NO_RESPONDER`, `TIMEOUT`, `ABORTED`) rejects the result; when read with `use`
 * that reaches the nearest error boundary, so pair the `Suspense` with one.
 *
 * @example Fire and forget
 * ```tsx
 * function ExpandPanel() {
 *   const setPanelMode = useEmit('panels.mode.set')
 *   return (
 *     <button onClick={() => setPanelMode({name: 'favorites', mode: 'full'})}>
 *       Expand
 *     </button>
 *   )
 * }
 * ```
 *
 * @example Await a reply with Suspense
 * ```tsx
 * function Session({request}: {request: MessageBusEmitResult<string>}) {
 *   use(request)
 *   return <p>Ready</p>
 * }
 *
 * function SessionAccordion() {
 *   const refreshToken = useEmit('auth.token.refresh')
 *   const [request, setRequest] = useState<MessageBusEmitResult<string> | null>(null)
 *
 *   return (
 *     <details
 *       onToggle={(event) => setRequest(event.currentTarget.open ? refreshToken() : null)}
 *     >
 *       <summary>Session</summary>
 *       <ErrorBoundary fallback={<p>Could not refresh</p>}>
 *         <Suspense fallback={<p>Refreshing...</p>}>
 *           {request && <Session request={request} />}
 *         </Suspense>
 *       </ErrorBoundary>
 *     </details>
 *   )
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useEmit<K extends EventTopic$1>(topic: K): TopicEmitter<K>;
/**
 * A navigation the Dashboard asks the app to perform, or that the app reports to the Dashboard.
 * `path` is relative to the app's own route, with no leading slash (`'documents/abc'`), and may
 * carry a query string and hash.
 * @public
 * @category Types
 * @category Dashboard
 */
type DashboardNavigation = PathChangeMessage['data'];
/**
 * Reports an in-app navigation to the Dashboard so the browser URL and the Dashboard's own
 * router follow the app. `type` defaults to `'push'` and only applies in the federated runtime;
 * see {@link useNavigate}.
 *
 * `scope` defaults to `'in-app'`, where `path` is relative to the app's route. With
 * `'dashboard'`, `path` is a Dashboard URL from {@link urlFor} and is navigated to as-is; only
 * the federated runtime supports it.
 * @public
 * @category Types
 * @category Dashboard
 */
type NavigateToDashboardPath = (options: {
  path: string;
  type?: 'push' | 'replace';
  scope?: 'in-app' | 'dashboard';
}) => void;
/**
 * @public
 *
 * A helper hook designed to be injected into routing components for apps within the Dashboard.
 * It keeps the app's router and the Dashboard in two-way sync: `navigateFn` receives the
 * navigations the Dashboard asks the app to perform, and the returned function reports the app's
 * own in-app navigations back to the Dashboard so the browser URL and the Dashboard's router
 * follow along.
 *
 * An in-app navigation the app reports is not echoed back through `navigateFn`. A
 * dashboard-scoped one that lands in this app is, because the app's router has not moved. The
 * returned function is referentially stable.
 *
 * The two Dashboard runtimes differ:
 * - In an iframe (Comlink), inbound `type` may be `'push'`, `'replace'` or `'pop'`. Reporting is
 *   optional because the bridge already forwards the iframe's own `pushState`; a reported `type`
 *   is ignored and the host applies the URL as a `replace`. Dashboard-scoped reports are dropped
 *   with a console warning.
 * - In a federated app (message bus), inbound `type` is `'push'` or `'replace'`; `'pop'` is never
 *   sent. Reporting is required because the app's router does not reach the host, and `type` is
 *   honoured. Until the Dashboard publishes the app's base path, in-app reports are dropped with
 *   a console warning.
 *
 * @param navigateFn - Function to handle navigation; should accept:
 * - `path`: a string, which will be a relative path (for example, 'my-route')
 * - `type`: 'push', 'replace', or 'pop', which will be the type of navigation to perform
 *
 * Optional. Omit it when the app only sends the user somewhere and has no router of its own;
 * inbound navigations are then ignored. An app with its own router must pass it, or the router
 * stops following the Dashboard's back and forward navigation and links into the app.
 * @returns A function the app calls to report its own in-app navigations to the Dashboard.
 *
 * @example
 * ```tsx
 * import {useNavigate} from '@sanity/sdk-react/dashboard'
 * import {useEffect} from 'react'
 * import {useLocation, useNavigate as useRouterNavigate} from 'react-router'
 *
 * function DashboardNavigationSync() {
 *   const routerNavigate = useRouterNavigate()
 *   const {pathname, search, hash} = useLocation()
 *   const navigate = useNavigate(({path, type}) => {
 *     routerNavigate(path, {replace: type === 'replace'})
 *   })
 *   useEffect(() => {
 *     navigate({path: `${pathname.slice(1)}${search}${hash}`})
 *   }, [navigate, pathname, search, hash])
 *   return null
 * }
 * ```
 * @category Dashboard
 */
export declare function useNavigate(navigateFn?: (options: DashboardNavigation) => void): NavigateToDashboardPath;
/**
 * @public
 * @category Types
 * @category Documents
 */
interface NavigateToStudioResult {
  navigateToStudioDocument: () => void;
}
/**
 * @public
 *
 * Hook that provides a function to navigate to a given document in its parent Studio.
 *
 * Uses the `projectId` and `dataset` properties of the {@link DocumentHandle} you provide to resolve the correct Studio.
 * This will only work if you have deployed a studio with a workspace with this `projectId` / `dataset` combination.
 *
 * Works in both Dashboard runtimes: it sends the navigation over the Comlink connection in the
 * iframe runtime and over the message bus in the federated runtime.
 *
 * @remarks If you write your own Document Handle to pass to this hook (as opposed to a Document Handle generated by another hook),
 * it must include values for `documentId`, `documentType`, `projectId`, and `dataset`.
 *
 * @category Documents
 * @param documentHandle - The document handle for the document to navigate to
 * @param preferredStudioUrl - The preferred studio url to navigate to if you have multiple
 * studios with the same projectId and dataset
 * @returns An object containing:
 * - `navigateToStudioDocument` - Function that when called will navigate to the studio document
 *
 * @example
 * ```tsx
 * import {type DocumentHandle} from '@sanity/sdk-react'
 * import {useNavigateToStudioDocument} from '@sanity/sdk-react/dashboard'
 * import {Button} from '@sanity/ui'
 * import {Suspense} from 'react'
 *
 * function NavigateButton({documentHandle}: {documentHandle: DocumentHandle}) {
 *   const {navigateToStudioDocument} = useNavigateToStudioDocument(documentHandle)
 *   return (
 *     <Button
 *       onClick={navigateToStudioDocument}
 *       text="Navigate to Studio Document"
 *     />
 *   )
 * }
 *
 * // Wrap the component with Suspense since the hook may suspend
 * function MyDocumentAction({documentHandle}: {documentHandle: DocumentHandle}) {
 *   return (
 *     <Suspense fallback={<Button text="Loading..." disabled />}>
 *       <NavigateButton documentHandle={documentHandle} />
 *     </Suspense>
 *   )
 * }
 * ```
 */
export declare function useNavigateToStudioDocument(documentHandle: DocumentHandle, preferredStudioUrl?: string): NavigateToStudioResult;
/**
 * @public
 *
 * A React hook that retrieves the dashboard organization ID that is currently selected in the Sanity Dashboard.
 *
 * Works in both Dashboard runtimes: it reads the `organizations.current` message bus topic when a
 * host has installed the bus, and falls back to the Comlink connection otherwise.
 *
 * @example
 * ```tsx
 * function DashboardComponent() {
 *   const orgId = useOrganizationId()
 *
 *   if (!orgId) return null
 *
 *   return <div>Organization ID: {String(orgId)}</div>
 * }
 * ```
 *
 * @category Dashboard
 * @returns The dashboard organization ID (string | undefined)
 */
export declare function useOrganizationId(): string | undefined;
/**
 * Returns a remote client shared by hooks using the same Sanity instance.
 * The first call creates the client; later calls reuse it.
 * @public
 * @category Dashboard
 */
export declare const useRemoteClient: () => RemoteInstance;
/**
 * Returns the current value of a dashboard state topic and follows later updates.
 *
 * The hook suspends until the topic publishes its first value, using the message bus query
 * deadline. A topic declared with `TopicResult` resolves to its successful value; a
 * failed result throws a `TopicError` to the nearest error boundary.
 *
 * @example
 * ```tsx
 * function ForegroundApplication() {
 *   const foregroundId = useTopic('applications.foreground')
 *   return <span>{foregroundId ?? 'No application in the foreground'}</span>
 * }
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare const useTopic: <K extends StateTopic$1>(topic: K) => TopicData$1<K>;
/**
 * Sets the browser's document title, automatically including the app's name
 * from the manifest.
 *
 * This follows the same convention as Sanity Studio workspaces, where the
 * workspace name is always present in the title:
 *
 * - With a view title: `<viewTitle> | <appTitle>`
 * - Without a view title: `<appTitle>`
 *
 * The Sanity dashboard appends `| Sanity` to produce the final browser tab title.
 *
 * Works in both Dashboard runtimes: it manages the document title over the Comlink connection, and
 * no-ops under the message bus, where the Dashboard host owns the title.
 *
 * @param viewTitle - An optional view-specific title to prepend to the app title.
 *
 * @example
 * ```tsx
 * import {useWindowTitle} from '@sanity/sdk-react/dashboard'
 *
 * function MoviesList() {
 *   useWindowTitle('Movies')
 *   return <div>...</div>
 * }
 *
 * // Browser tab: "Movies | My App | Sanity"
 * ```
 *
 * @example
 * ```tsx
 * // Call without arguments to show just the app title
 * function AppRoot() {
 *   useWindowTitle()
 *   return <Outlet />
 * }
 *
 * // Browser tab: "My App | Sanity"
 * ```
 *
 * @public
 * @category Dashboard
 */
export declare function useWindowTitle(viewTitle?: string): void;
export { type AgentResourceContextOptions, type ApplicationConfig, type ApplicationConfigAppType, type ApplicationConfigSelector, type ApplicationContext, type CanvasUrl, type Capability, type CapabilityRecord, type ConnectMessageBusOptions, type CoreApplicationUrl, type CreateIntentParameters, type CreateRemoteInstanceOptions, type DashboardApplication, type DashboardApplicationBase, type DashboardInstallation, type DashboardNavigation, type DashboardTopics, type DashboardUrl, type DashboardView, type DashboardWebWorker, type EditIntentParameters, type EventTopic, type EventTopicDef, type FederationRemote, type MediaLibraryUrl, type MessageBus, type MessageBusAbortOptions, type MessageBusClient, type MessageBusConnection, type MessageBusEmitOptions, type MessageBusEmitResult, MessageBusError, type MessageBusErrorCode, type MessageBusHost, type MessageBusMessage, type MessageBusMeta, type MessageBusQueryOptions, type MessageBusStateSource, type NavigateToDashboardPath, type NavigateToStudioResult, type NavigationLocation, type NavigationTarget, type PayloadOf, type ReleaseIntentParameters, type RemoteInstance, type RemoteModuleRef, type ReplyOf, type StateTopic, type StateTopicDef, type StudioIntentUrl, type StudioUrl, type StudioWorkspaceUrl, DashboardTokenRefreshProvider as TokenRefreshProvider, type TopicData, type TopicEmitter, TopicError, type TopicName, type TopicResult, type Topics, type Urls, type ValueOf, capabilities, connectMessageBus };
//# sourceMappingURL=dashboard.d.ts.map