{"version":3,"file":"Client.cjs","names":["isRepositoryEndpoint","getRepositoryName","devMsg","getRepositoryEndpoint","PrismicError","#repositoryName","#autoPreviews","#autoPreviewsRequest","#internalGet","NotFoundError","filter","#cachedRepository","#cachedRepositoryExpiration","#request","RepositoryNotFoundError","#throwContentAPIError","#getResolvedRef","buildQueryURL","asLink","#getRef","getPreviewCookie","RefNotFoundError","RefExpiredError","ParsingError","ForbiddenError","PreviewTokenExpiredError","request"],"sources":["../src/Client.ts"],"sourcesContent":["import { type BuildQueryURLArgs, buildQueryURL } from \"./buildQueryURL\"\nimport {\n\tForbiddenError,\n\tNotFoundError,\n\tParsingError,\n\tPreviewTokenExpiredError,\n\tPrismicError,\n\tRefExpiredError,\n\tRefNotFoundError,\n\tRepositoryNotFoundError,\n} from \"./errors\"\nimport { filter } from \"./filter\"\nimport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\"\nimport { getRepositoryName } from \"./getRepositoryName\"\nimport { type LinkResolverFunction, asLink } from \"./helpers/asLink\"\nimport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\"\nimport { devMsg } from \"./lib/devMsg\"\nimport { getPreviewCookie } from \"./lib/getPreviewCookie\"\nimport type { ResponseLike } from \"./lib/request\"\nimport { type AbortSignalLike, type FetchLike, type RequestInitLike, request } from \"./lib/request\"\nimport { throttledWarn } from \"./lib/throttledWarn\"\nimport type { Query } from \"./types/api/query\"\nimport type { Ref } from \"./types/api/ref\"\nimport type { Repository } from \"./types/api/repository\"\nimport type { PrismicDocument } from \"./types/value/document\"\n\nconst MAX_PAGE_SIZE = 100\nconst REPOSITORY_CACHE_TTL = 5000\nconst GET_ALL_QUERY_DELAY = 500\nconst MAX_INVALID_REF_RETRY_ATTEMPTS = 3\n\n/** Extracts a document type with a matching `type` property from a union of document types. */\ntype ExtractDocumentType<\n\tTDocuments extends PrismicDocument,\n\tTDocumentType extends TDocuments[\"type\"],\n> =\n\tExtract<TDocuments, { type: TDocumentType }> extends never\n\t\t? TDocuments\n\t\t: Extract<TDocuments, { type: TDocumentType }>\n\n/**\n * The minimum required properties to treat as an HTTP Request for automatic Prismic preview\n * support.\n */\nexport type HttpRequestLike =\n\t| // Web API Request\n\t  {\n\t\t\theaders?: {\n\t\t\t\tget(name: string): string | null\n\t\t\t}\n\t\t\turl?: string\n\t  }\n\t// Express-style request\n\t| {\n\t\t\theaders?: {\n\t\t\t\tcookie?: string\n\t\t\t}\n\t\t\tquery?: Record<string, unknown>\n\t  }\n\n/**\n * A function that returns a ref string. Used to configure which ref the client queries content\n * from.\n */\ntype GetRef = (\n\tparams?: Pick<BuildQueryURLArgs, \"accessToken\"> & FetchParams,\n) => string | undefined | Promise<string | undefined>\n\n/** Parameters for client methods that use `fetch()`. */\nexport type FetchParams = {\n\t/**\n\t * Options provided to the client's `fetch()` on all network requests. These options will be\n\t * merged with internally required options. They can also be overriden on a per-query basis using\n\t * the query's `fetchOptions` parameter.\n\t */\n\tfetchOptions?: RequestInitLike\n\t/** @deprecated Move to `fetchOptions.signal`: */\n\t// TODO: Remove in v8.\n\tsignal?: AbortSignalLike\n}\n\n/** Prismic client configuration. */\nexport type ClientConfig = {\n\t/**\n\t * The client's Content API endpoint.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdocumentAPIEndpoint?: string\n\t/**\n\t * The secure token used for the Content API.\n\t *\n\t * @see {@link https://prismic.io/docs/fetch-content#content-visibility}\n\t */\n\taccessToken?: string\n\t/**\n\t * The version of the repository's content. It can optionally be a function that returns a ref.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tref?: string | GetRef\n\t/**\n\t * A list of route resolver objects that define how a document's `url` property is resolved.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\troutes?: NonNullable<BuildQueryURLArgs[\"routes\"]>\n\t/**\n\t * The URL used for link or content relationship fields that point to an archived or deleted page.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tbrokenRoute?: NonNullable<BuildQueryURLArgs[\"brokenRoute\"]>\n\t/**\n\t * Default parameters sent with each Content API request. These parameters can be overridden on\n\t * each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdefaultParams?: Omit<\n\t\tBuildQueryURLArgs,\n\t\t\"ref\" | \"integrationFieldsRef\" | \"accessToken\" | \"routes\" | \"brokenRoute\"\n\t>\n\t/**\n\t * The `fetch` function used to make network requests.\n\t *\n\t * @default The global `fetch` function.\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetch?: FetchLike\n\t/**\n\t * The default `fetch` options sent with each Content API request. These parameters can be\n\t * overriden on each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetchOptions?: RequestInitLike\n}\n\n/**\n * Parameters specific to client methods that fetch all documents. These methods start with `getAll`\n * (e.g. `getAllByType`).\n */\ntype GetAllParams = {\n\t/**\n\t * Limit the number of documents queried.\n\t *\n\t * @default No limit.\n\t */\n\tlimit?: number\n}\n\n/**\n * A client for fetching content from a Prismic repository.\n *\n * @see {@link https://prismic.io/docs/fetch-content}\n * @see {@link https://prismic.io/docs/technical-reference/prismicio-client}\n */\nexport class Client<TDocuments extends PrismicDocument = PrismicDocument> {\n\t/**\n\t * The client's Content API endpoint.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdocumentAPIEndpoint: string\n\t/**\n\t * The secure token used for the Content API.\n\t *\n\t * @see {@link https://prismic.io/docs/fetch-content#content-visibility}\n\t */\n\taccessToken?: string\n\t/**\n\t * A list of route resolver objects that define how a document's `url` property is resolved.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\troutes?: NonNullable<BuildQueryURLArgs[\"routes\"]>\n\t/**\n\t * The URL used for link or content relationship fields that point to an archived or deleted page.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tbrokenRoute?: NonNullable<BuildQueryURLArgs[\"brokenRoute\"]>\n\t/**\n\t * Default parameters sent with each Content API request. These parameters can be overridden on\n\t * each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdefaultParams?: Omit<BuildQueryURLArgs, \"ref\" | \"integrationFieldsRef\" | \"accessToken\" | \"routes\">\n\t/**\n\t * The `fetch` function used to make network requests.\n\t *\n\t * @default The global `fetch` function.\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetchFn: FetchLike\n\t/**\n\t * The default `fetch` options sent with each Content API request. These parameters can be\n\t * overriden on each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetchOptions: RequestInitLike\n\n\t#repositoryName: string | undefined\n\n\t#getRef?: GetRef\n\t#autoPreviews = true\n\t#autoPreviewsRequest?: HttpRequestLike\n\n\t#cachedRepository: Repository | undefined\n\t#cachedRepositoryExpiration = 0 // Timestamp\n\n\t/**\n\t * @param repositoryNameOrEndpoint - The Prismic repository name or full Content API endpoint for\n\t *   the repository.\n\t * @param config - Client configuration.\n\t */\n\tconstructor(repositoryNameOrEndpoint: string, config: ClientConfig = {}) {\n\t\tconst {\n\t\t\tdocumentAPIEndpoint,\n\t\t\taccessToken,\n\t\t\tref,\n\t\t\troutes,\n\t\t\tbrokenRoute,\n\t\t\tdefaultParams,\n\t\t\tfetchOptions = {},\n\t\t\tfetch = globalThis.fetch?.bind(globalThis),\n\t\t} = config\n\n\t\tif (isRepositoryEndpoint(repositoryNameOrEndpoint)) {\n\t\t\ttry {\n\t\t\t\tthis.repositoryName = getRepositoryName(repositoryNameOrEndpoint)\n\t\t\t} catch {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[@prismicio/client] A repository name could not be inferred from the provided endpoint (\\`${repositoryNameOrEndpoint}\\`). Some methods will be disabled. Create the client using a repository name to prevent this warning. For more details, see ${devMsg(\"prefer-repository-name\")}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tthis.documentAPIEndpoint = documentAPIEndpoint || repositoryNameOrEndpoint\n\t\t} else {\n\t\t\tthis.repositoryName = repositoryNameOrEndpoint\n\t\t\tthis.documentAPIEndpoint =\n\t\t\t\tdocumentAPIEndpoint || getRepositoryEndpoint(repositoryNameOrEndpoint)\n\t\t}\n\n\t\tif (!fetch) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t\"A valid fetch implementation was not provided. In environments where fetch is not available, a fetch implementation must be provided via a polyfill or the `fetch` option.\",\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\t\tif (typeof fetch !== \"function\") {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`fetch must be a function, but received: ${typeof fetch}`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\tif (!isRepositoryEndpoint(this.documentAPIEndpoint)) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`documentAPIEndpoint is not a valid URL: ${documentAPIEndpoint}`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\t\tif (\n\t\t\tisRepositoryEndpoint(repositoryNameOrEndpoint) &&\n\t\t\tdocumentAPIEndpoint &&\n\t\t\trepositoryNameOrEndpoint !== documentAPIEndpoint\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] Multiple incompatible endpoints were provided. Create the client using a repository name to prevent this error. For more details, see ${devMsg(\"prefer-repository-name\")}`,\n\t\t\t)\n\t\t}\n\t\tif (\n\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\t/\\.prismic\\.io\\/(?!api\\/v2\\/?)/i.test(this.documentAPIEndpoint)\n\t\t) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t\"@prismicio/client only supports Prismic Rest API V2. Please provide only the repository name to the first createClient() parameter or use the getRepositoryEndpoint() helper to generate a valid Rest API V2 endpoint URL.\",\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\t\tif (\n\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\t/\\.prismic\\.io$/i.test(new URL(this.documentAPIEndpoint).hostname) &&\n\t\t\t!/\\.cdn\\.prismic\\.io$/i.test(new URL(this.documentAPIEndpoint).hostname)\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] The client was created with a non-CDN endpoint. Convert it to the CDN endpoint for better performance. For more details, see ${devMsg(\"endpoint-must-use-cdn\")}`,\n\t\t\t)\n\t\t}\n\n\t\tthis.accessToken = accessToken\n\t\tthis.routes = routes\n\t\tthis.brokenRoute = brokenRoute\n\t\tthis.defaultParams = defaultParams\n\t\tthis.fetchOptions = fetchOptions\n\t\tthis.fetchFn = fetch\n\n\t\tthis.graphQLFetch = this.graphQLFetch.bind(this)\n\n\t\tif (ref) {\n\t\t\tthis.queryContentFromRef(ref)\n\t\t}\n\t}\n\n\t/** The Prismic repository's name. */\n\tset repositoryName(value: string) {\n\t\tthis.#repositoryName = value\n\t}\n\t/** The Prismic repository's name. */\n\tget repositoryName(): string {\n\t\tif (!this.#repositoryName) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`A repository name is required for this method but one could not be inferred from the provided API endpoint (\\`${this.documentAPIEndpoint}\\`). To fix this error, provide a repository name when creating the client. For more details, see ${devMsg(\"prefer-repository-name\")}`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\treturn this.#repositoryName\n\t}\n\n\t/** @deprecated Replace with `documentAPIEndpoint`. */\n\t// TODO: Remove in v8.\n\tset endpoint(value: string) {\n\t\tthis.documentAPIEndpoint = value\n\t}\n\t/** @deprecated Replace with `documentAPIEndpoint`. */\n\t// TODO: Remove in v8.\n\tget endpoint(): string {\n\t\treturn this.documentAPIEndpoint\n\t}\n\n\t/**\n\t * Enables the client to automatically query content from a preview session.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.enableAutoPreviews()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviews}\n\t */\n\tenableAutoPreviews(): void {\n\t\tthis.#autoPreviews = true\n\t}\n\n\t/**\n\t * Enables the client to automatically query content from a preview session using an HTTP request\n\t * object.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.enableAutoPreviewsFromReq(req)\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviewsfromreq}\n\t */\n\tenableAutoPreviewsFromReq(request: HttpRequestLike): void {\n\t\tthis.enableAutoPreviews()\n\t\tthis.#autoPreviewsRequest = request\n\t}\n\n\t/**\n\t * Disables the client from automatically querying content from a preview session.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.disableAutoPreviews()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#disableautopreviews}\n\t */\n\tdisableAutoPreviews(): void {\n\t\tthis.#autoPreviews = false\n\t\tthis.#autoPreviewsRequest = undefined\n\t}\n\n\t/**\n\t * Fetches pages based on the `params` argument. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.get({ pageSize: 10 })\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#get}\n\t */\n\tasync get<TDocument extends TDocuments>(\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\tconst response = await this.#internalGet(params)\n\n\t\treturn await response.json()\n\t}\n\n\t/**\n\t * Fetches the first page returned based on the `params` argument.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getFirst()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getfirst}\n\t */\n\tasync getFirst<TDocument extends TDocuments>(\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<TDocument> {\n\t\tconst actualParams = params?.page || params?.pageSize ? params : { ...params, pageSize: 1 }\n\t\tconst response = await this.#internalGet(actualParams)\n\t\tconst { results }: Query<TDocument> = await response.clone().json()\n\n\t\tif (results[0]) {\n\t\t\treturn results[0]\n\t\t}\n\n\t\tthrow new NotFoundError(\"No documents were returned\", response.url, undefined)\n\t}\n\n\t/**\n\t * Fetches all pages based on the `params` argument. This method may make multiple network\n\t * requests to fetch all matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.dangerouslyGetAll()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#dangerouslygetall}\n\t */\n\tasync dangerouslyGetAll<TDocument extends TDocuments>(\n\t\tparams: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams = {},\n\t): Promise<TDocument[]> {\n\t\tconst { limit = Infinity, ...actualParams } = params\n\t\tconst resolvedParams = {\n\t\t\t...actualParams,\n\t\t\tpageSize: Math.min(\n\t\t\t\tlimit,\n\t\t\t\tactualParams.pageSize || this.defaultParams?.pageSize || MAX_PAGE_SIZE,\n\t\t\t),\n\t\t}\n\n\t\tconst documents: TDocument[] = []\n\t\tlet latestResult: Query<TDocument> | undefined\n\n\t\twhile ((!latestResult || latestResult.next_page) && documents.length < limit) {\n\t\t\tconst page = latestResult ? latestResult.page + 1 : undefined\n\n\t\t\tlatestResult = await this.get<TDocument>({ ...resolvedParams, page })\n\t\t\tdocuments.push(...latestResult.results)\n\n\t\t\tif (latestResult.next_page) {\n\t\t\t\tawait new Promise((res) => setTimeout(res, GET_ALL_QUERY_DELAY))\n\t\t\t}\n\t\t}\n\n\t\treturn documents.slice(0, limit)\n\t}\n\n\t/**\n\t * Fetches a page with a specific ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getByID(\"WW4bKScAAMAqmluX\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyid}\n\t */\n\tasync getByID<TDocument extends TDocuments>(\n\t\tid: string,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<TDocument> {\n\t\treturn await this.getFirst<TDocument>(appendFilters(params, filter.at(\"document.id\", id)))\n\t}\n\n\t/**\n\t * Fetches pages with specific IDs. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByIDs([\"WW4bKScAAMAqmluX\", \"U1kTRgEAAC8A5ldS\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyids}\n\t */\n\tasync getByIDs<TDocument extends TDocuments>(\n\t\tids: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.in(\"document.id\", ids)))\n\t}\n\n\t/**\n\t * Fetches pages with specific IDs. This method may make multiple network requests to fetch all\n\t * matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByIDs([\"WW4bKScAAMAqmluX\", \"U1kTRgEAAC8A5ldS\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyids}\n\t */\n\tasync getAllByIDs<TDocument extends TDocuments>(\n\t\tids: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.in(\"document.id\", ids)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches a page with a specific UID and type.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getByUID(\"blog_post\", \"my-first-post\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuid}\n\t */\n\tasync getByUID<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tuid: string,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>> {\n\t\treturn await this.getFirst<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(\n\t\t\t\tparams,\n\t\t\t\tfilter.at(\"document.type\", documentType),\n\t\t\t\tfilter.at(`my.${documentType}.uid`, uid),\n\t\t\t),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with specific UIDs and a specific type. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByUIDs(\"blog_post\", [\"my-first-post\", \"my-second-post\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuids}\n\t */\n\tasync getByUIDs<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tuids: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>> {\n\t\treturn await this.get<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(\n\t\t\t\tparams,\n\t\t\t\tfilter.at(\"document.type\", documentType),\n\t\t\t\tfilter.in(`my.${documentType}.uid`, uids),\n\t\t\t),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with specific UIDs and a specific type. This method may make multiple network\n\t * requests to fetch all matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByUIDs(\"blog_post\", [\"my-first-post\", \"my-second-post\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyuids}\n\t */\n\tasync getAllByUIDs<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tuids: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>[]> {\n\t\treturn await this.dangerouslyGetAll<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(\n\t\t\t\tparams,\n\t\t\t\tfilter.at(\"document.type\", documentType),\n\t\t\t\tfilter.in(`my.${documentType}.uid`, uids),\n\t\t\t),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches a specific single type page.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getSingle(\"settings\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getsingle}\n\t */\n\tasync getSingle<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>> {\n\t\treturn await this.getFirst<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(params, filter.at(\"document.type\", documentType)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with a specific type. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByType(\"blog_post\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytype}\n\t */\n\tasync getByType<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>> {\n\t\treturn await this.get<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(params, filter.at(\"document.type\", documentType)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with a specific type. This method may make multiple network requests to fetch all\n\t * matching documents.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByType(\"blog_post\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytype}\n\t */\n\tasync getAllByType<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>[]> {\n\t\treturn await this.dangerouslyGetAll<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(params, filter.at(\"document.type\", documentType)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with a specific tag. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByTag(\"featured\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytag}\n\t */\n\tasync getByTag<TDocument extends TDocuments>(\n\t\ttag: string,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.any(\"document.tags\", [tag])))\n\t}\n\n\t/**\n\t * Fetches pages with a specific tag. This method may make multiple network requests to fetch all\n\t * matching documents.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByTag(\"featured\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytag}\n\t */\n\tasync getAllByTag<TDocument extends TDocuments>(\n\t\ttag: string,\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.any(\"document.tags\", [tag])),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with every tag from a list of tags. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByEveryTag([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyeverytag}\n\t */\n\tasync getByEveryTag<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.at(\"document.tags\", tags)))\n\t}\n\n\t/**\n\t * Fetches pages with every tag from a list of tags. This method may make multiple network\n\t * requests to fetch all matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByEveryTag([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyeverytag}\n\t */\n\tasync getAllByEveryTag<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.at(\"document.tags\", tags)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with at least one tag from a list of tags. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getBySomeTags([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbysometags}\n\t */\n\tasync getBySomeTags<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.any(\"document.tags\", tags)))\n\t}\n\n\t/**\n\t * Fetches pages with at least one tag from a list of tags. This method may make multiple network\n\t * requests to fetch all matching documents.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllBySomeTags([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbysometags}\n\t */\n\tasync getAllBySomeTags<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.any(\"document.tags\", tags)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches metadata about the client's Prismic repository.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst repository = await client.getRepository()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrepository}\n\t */\n\tasync getRepository(\n\t\tparams?: Pick<BuildQueryURLArgs, \"accessToken\"> & FetchParams,\n\t): Promise<Repository> {\n\t\tif (this.#cachedRepository && this.#cachedRepositoryExpiration > Date.now()) {\n\t\t\treturn this.#cachedRepository\n\t\t}\n\n\t\tconst url = new URL(this.documentAPIEndpoint)\n\n\t\tconst accessToken = params?.accessToken || this.accessToken\n\t\tif (accessToken) {\n\t\t\turl.searchParams.set(\"access_token\", accessToken)\n\t\t}\n\n\t\tconst response = await this.#request(url, params)\n\n\t\tif (response.ok) {\n\t\t\tthis.#cachedRepository = (await response.json()) as Repository\n\t\t\tthis.#cachedRepositoryExpiration = Date.now() + REPOSITORY_CACHE_TTL\n\n\t\t\treturn this.#cachedRepository\n\t\t}\n\n\t\tif (response.status === 404) {\n\t\t\tthrow new RepositoryNotFoundError(\n\t\t\t\t`Prismic repository not found. Check that \"${this.documentAPIEndpoint}\" is pointing to the correct repository.`,\n\t\t\t\turl.toString(),\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\treturn await this.#throwContentAPIError(response, url.toString())\n\t}\n\n\t/**\n\t * Fetches the repository's active refs.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst refs = await client.getRefs()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefs}\n\t */\n\tasync getRefs(params?: FetchParams): Promise<Ref[]> {\n\t\tconst repository = await this.getRepository(params)\n\n\t\treturn repository.refs\n\t}\n\n\t/**\n\t * Fetches a ref by its ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst ref = await client.getRefByID(\"YhE3YhEAACIA4321\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbyid}\n\t */\n\tasync getRefByID(id: string, params?: FetchParams): Promise<Ref> {\n\t\tconst refs = await this.getRefs(params)\n\t\tconst ref = refs.find((ref) => ref.id === id)\n\n\t\tif (!ref) {\n\t\t\tthrow new PrismicError(`Ref with ID \"${id}\" could not be found.`, undefined, undefined)\n\t\t}\n\n\t\treturn ref\n\t}\n\n\t/**\n\t * Fetches a ref by its label. A release ref's label is its name shown in the Page Builder.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst ref = await client.getRefByLabel(\"My Release\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbylabel}\n\t */\n\tasync getRefByLabel(label: string, params?: FetchParams): Promise<Ref> {\n\t\tconst refs = await this.getRefs(params)\n\t\tconst ref = refs.find((ref) => ref.label === label)\n\n\t\tif (!ref) {\n\t\t\tthrow new PrismicError(`Ref with label \"${label}\" could not be found.`, undefined, undefined)\n\t\t}\n\n\t\treturn ref\n\t}\n\n\t/**\n\t * Fetches the repository's master ref.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst masterRef = await client.getMasterRef()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getmasterref}\n\t */\n\tasync getMasterRef(params?: FetchParams): Promise<Ref> {\n\t\tconst refs = await this.getRefs(params)\n\t\tconst ref = refs.find((ref) => ref.isMasterRef)\n\n\t\tif (!ref) {\n\t\t\tthrow new PrismicError(\"Master ref could not be found.\", undefined, undefined)\n\t\t}\n\n\t\treturn ref\n\t}\n\n\t/**\n\t * Fetches the repository's active releases.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst releases = await client.getReleases()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleases}\n\t */\n\tasync getReleases(params?: FetchParams): Promise<Ref[]> {\n\t\tconst refs = await this.getRefs(params)\n\n\t\treturn refs.filter((ref) => !ref.isMasterRef)\n\t}\n\n\t/**\n\t * Fetches a release with a specific ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst release = await client.getReleaseByID(\"YhE3YhEAACIA4321\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebyid}\n\t */\n\tasync getReleaseByID(id: string, params?: FetchParams): Promise<Ref> {\n\t\tconst releases = await this.getReleases(params)\n\t\tconst release = releases.find((ref) => ref.id === id)\n\n\t\tif (!release) {\n\t\t\tthrow new PrismicError(`Release with ID \"${id}\" could not be found.`, undefined, undefined)\n\t\t}\n\n\t\treturn release\n\t}\n\n\t/**\n\t * Fetches a release by its label. A release ref's label is its name shown in the Page Builder.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst release = await client.getReleaseByLabel(\"My Release\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebylabel}\n\t */\n\tasync getReleaseByLabel(label: string, params?: FetchParams): Promise<Ref> {\n\t\tconst releases = await this.getReleases(params)\n\t\tconst release = releases.find((ref) => ref.label === label)\n\n\t\tif (!release) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`Release with label \"${label}\" could not be found.`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\treturn release\n\t}\n\n\t/**\n\t * Fetches the repository's page tags.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst tags = await client.getTags()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#gettags}\n\t */\n\tasync getTags(params?: FetchParams): Promise<string[]> {\n\t\tconst repository = await this.getRepository(params)\n\t\tconst form = repository.forms.tags\n\t\tif (form) {\n\t\t\tconst url = new URL(form.action)\n\t\t\tif (this.accessToken) {\n\t\t\t\turl.searchParams.set(\"access_token\", this.accessToken)\n\t\t\t}\n\n\t\t\tconst response = await this.#request(url, params)\n\t\t\tif (response.ok) {\n\t\t\t\treturn (await response.json()) as string[]\n\t\t\t}\n\t\t}\n\n\t\treturn repository.tags\n\t}\n\n\t/**\n\t * Builds a Content API query URL with a set of parameters.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst url = await client.buildQueryURL({\n\t * \t\tfilters: [filter.at(\"document.type\", \"blog_post\")],\n\t * \t})\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#buildqueryurl}\n\t */\n\tasync buildQueryURL({\n\t\tsignal,\n\t\tfetchOptions,\n\t\t...params\n\t}: Partial<BuildQueryURLArgs> & FetchParams = {}): Promise<string> {\n\t\tconst ref =\n\t\t\tparams.ref ||\n\t\t\t(await this.#getResolvedRef({\n\t\t\t\taccessToken: params.accessToken,\n\t\t\t\tsignal,\n\t\t\t\tfetchOptions,\n\t\t\t}))\n\t\tconst integrationFieldsRef =\n\t\t\tparams.integrationFieldsRef ||\n\t\t\t(\n\t\t\t\tawait this.getRepository({\n\t\t\t\t\taccessToken: params.accessToken,\n\t\t\t\t\tsignal,\n\t\t\t\t\tfetchOptions,\n\t\t\t\t})\n\t\t\t).integrationFieldsRef ||\n\t\t\tundefined\n\n\t\treturn buildQueryURL(this.documentAPIEndpoint, {\n\t\t\t...this.defaultParams,\n\t\t\t...params,\n\t\t\tref,\n\t\t\tintegrationFieldsRef,\n\t\t\troutes: params.routes || this.routes,\n\t\t\tbrokenRoute: params.brokenRoute || this.brokenRoute,\n\t\t\taccessToken: params.accessToken || this.accessToken,\n\t\t})\n\t}\n\n\t/**\n\t * Fetches a previewed page's URL using a preview token and page ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst url = await client.resolvePreviewURL({\n\t * \t\tlinkResolver,\n\t * \t\tdefaultURL: \"/\",\n\t * \t})\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#resolvepreviewurl}\n\t */\n\tasync resolvePreviewURL<LinkResolverReturnType>(\n\t\targs: {\n\t\t\t/** A function converts a document to a URL in your website. */\n\t\t\tlinkResolver?: LinkResolverFunction<LinkResolverReturnType>\n\t\t\t/** A fallback URL used when the document does not have a URL. */\n\t\t\tdefaultURL: string\n\t\t\t/** The preview token for the preview session. */\n\t\t\tpreviewToken?: string\n\t\t\t/** The previewed document's ID. */\n\t\t\tdocumentID?: string\n\t\t} & FetchParams,\n\t): Promise<string> {\n\t\tlet documentID: string | undefined | null = args.documentID\n\t\tlet previewToken: string | undefined | null = args.previewToken\n\n\t\tif (typeof globalThis.location !== \"undefined\") {\n\t\t\tconst searchParams = new URLSearchParams(globalThis.location.search)\n\n\t\t\tdocumentID = documentID || searchParams.get(\"documentId\")\n\t\t\tpreviewToken = previewToken || searchParams.get(\"token\")\n\t\t} else if (this.#autoPreviewsRequest) {\n\t\t\tif (\"query\" in this.#autoPreviewsRequest) {\n\t\t\t\tdocumentID = documentID || (this.#autoPreviewsRequest.query?.documentId as string)\n\t\t\t\tpreviewToken = previewToken || (this.#autoPreviewsRequest.query?.token as string)\n\t\t\t} else if (\"url\" in this.#autoPreviewsRequest && this.#autoPreviewsRequest.url) {\n\t\t\t\t// Including \"missing-host://\" by default\n\t\t\t\t// handles a case where Next.js Route Handlers\n\t\t\t\t// only provide the pathname and search\n\t\t\t\t// parameters in the `url` property\n\t\t\t\t// (e.g. `/api/preview?foo=bar`).\n\t\t\t\tconst searchParams = new URL(this.#autoPreviewsRequest.url, \"missing-host://\").searchParams\n\n\t\t\t\tdocumentID = documentID || searchParams.get(\"documentId\")\n\t\t\t\tpreviewToken = previewToken || searchParams.get(\"token\")\n\t\t\t}\n\t\t}\n\n\t\tif (documentID != null && previewToken != null) {\n\t\t\tconst document = await this.getByID(documentID, {\n\t\t\t\tref: previewToken,\n\t\t\t\tlang: \"*\",\n\t\t\t\tsignal: args.signal,\n\t\t\t\tfetchOptions: args.fetchOptions,\n\t\t\t})\n\n\t\t\tconst url = asLink(document, { linkResolver: args.linkResolver })\n\n\t\t\tif (typeof url === \"string\") {\n\t\t\t\treturn url\n\t\t\t}\n\t\t}\n\n\t\treturn args.defaultURL\n\t}\n\n\t/**\n\t * Configures the client to query the latest published content. This is the client's default mode.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryLatestContent()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querylatestcontent}\n\t */\n\tqueryLatestContent(): void {\n\t\tthis.#getRef = undefined\n\t}\n\n\t/**\n\t * Configures the client to query content from a release with a specific ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryContentFromReleaseByID(\"YhE3YhEAACIA4321\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebyid}\n\t */\n\tqueryContentFromReleaseByID(id: string): void {\n\t\tthis.#getRef = async (params) => {\n\t\t\tconst release = await this.getReleaseByID(id, params)\n\t\t\treturn release.ref\n\t\t}\n\t}\n\n\t/**\n\t * Configures the client to query content from a release with a specific label.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryContentFromReleaseByLabel(\"My Release\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebylabel}\n\t */\n\tqueryContentFromReleaseByLabel(label: string): void {\n\t\tthis.#getRef = async (params) => {\n\t\t\tconst release = await this.getReleaseByLabel(label, params)\n\t\t\treturn release.ref\n\t\t}\n\t}\n\n\t/**\n\t * Configures the client to query content from a specific ref.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryContentFromRef(\"my-ref\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromref}\n\t */\n\tqueryContentFromRef(ref: string | GetRef): void {\n\t\tthis.#getRef = typeof ref === \"string\" ? () => ref : ref\n\t}\n\n\t/**\n\t * A preconfigured `fetch()` function for Prismic's GraphQL API that can be provided to GraphQL\n\t * clients.\n\t *\n\t * @example\n\t * \t```ts\n\t * \timport { createClient, getGraphQLEndpoint } from \"@prismicio/client\"\n\t *\n\t * \tconst client = createClient(\"example-prismic-repo\")\n\t * \tconst graphQLClient = new ApolloClient({\n\t * \tlink: new HttpLink({\n\t * \turi: getGraphQLEndpoint(client.repositoryName),\n\t * \t// Provide `client.graphQLFetch` as the fetch implementation.\n\t * \tfetch: client.graphQLFetch,\n\t * \t// Using GET is required.\n\t * \tuseGETForQueries: true,\n\t * \t}),\n\t * \tcache: new InMemoryCache(),\n\t * \t})\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#graphqlfetch}\n\t */\n\tasync graphQLFetch(\n\t\tinput: RequestInfo,\n\t\tinit?: Omit<RequestInit, \"signal\"> & { signal?: AbortSignalLike },\n\t): Promise<Response> {\n\t\tconst params = {\n\t\t\taccessToken: this.accessToken,\n\t\t\tfetchOptions: this.fetchOptions,\n\t\t}\n\t\tconst repository = await this.getRepository(params)\n\t\tconst ref = await this.#getResolvedRef(params)\n\n\t\tconst headers: NonNullable<RequestInitLike[\"headers\"]> = {}\n\t\theaders[\"prismic-ref\"] = ref\n\t\tif (this.accessToken) {\n\t\t\theaders[\"authorization\"] = `Token ${this.accessToken}`\n\t\t}\n\t\tif (repository.integrationFieldsRef) {\n\t\t\theaders[\"prismic-integration-field-ref\"] = repository.integrationFieldsRef\n\t\t}\n\t\tfor (const [key, value] of Object.entries(init?.headers ?? {})) {\n\t\t\theaders[key.toLowerCase()] = value\n\t\t}\n\n\t\tconst url = new URL(typeof input === \"string\" ? input : input.url)\n\t\tconst query = (url.searchParams.get(\"query\") ?? \"\").replace(\n\t\t\t// Minify the query\n\t\t\t/(\\n| )*( |{|})(\\n| )*/gm,\n\t\t\t(_chars, _spaces, brackets) => brackets,\n\t\t)\n\t\turl.searchParams.set(\"query\", query)\n\t\t// Only used to prevent caching; caches ignore header differences\n\t\turl.searchParams.set(\"ref\", ref)\n\n\t\treturn (await this.fetchFn(url.toString(), {\n\t\t\t...init,\n\t\t\theaders,\n\t\t})) as Response\n\t}\n\n\t/**\n\t * Returns the ref needed to query based on the client's current state. This method may make a\n\t * network request to fetch a ref or resolve the user's ref thunk.\n\t *\n\t * If auto previews are enabled, the preview ref takes priority.\n\t *\n\t * The following strategies are used depending on the client's state:\n\t *\n\t * - If the user called `queryLatestContent`: Use the repository's master ref. The ref is cached for\n\t *   5 seconds. After 5 seconds, a new master ref is fetched.\n\t * - If the user called `queryContentFromReleaseByID`: Use the release's ref. The ref is cached for\n\t *   5 seconds. After 5 seconds, a new ref for the release is fetched.\n\t * - If the user called `queryContentFromReleaseByLabel`: Use the release's ref. The ref is cached\n\t *   for 5 seconds. After 5 seconds, a new ref for the release is fetched.\n\t * - If the user called `queryContentFromRef`: Use the provided ref. Fall back to the master ref if\n\t *   the ref is not a string.\n\t */\n\tasync #getResolvedRef(params?: Pick<BuildQueryURLArgs, \"accessToken\"> & FetchParams) {\n\t\tif (this.#autoPreviews) {\n\t\t\tconst cookies = this.#autoPreviewsRequest?.headers\n\t\t\t\t? \"get\" in this.#autoPreviewsRequest.headers\n\t\t\t\t\t? this.#autoPreviewsRequest.headers.get(\"cookie\")\n\t\t\t\t\t: this.#autoPreviewsRequest.headers.cookie\n\t\t\t\t: globalThis.document?.cookie\n\t\t\tconst previewRef = getPreviewCookie(cookies ?? \"\")\n\t\t\tif (previewRef) {\n\t\t\t\treturn previewRef\n\t\t\t}\n\t\t}\n\n\t\tconst ref = await this.#getRef?.(params)\n\t\tif (ref) {\n\t\t\treturn ref\n\t\t}\n\n\t\tconst masterRef = await this.getMasterRef(params)\n\t\treturn masterRef.ref\n\t}\n\n\t/**\n\t * Performs a low-level Content API request with the given parameters. Automatically retries if an\n\t * invalid ref is used.\n\t */\n\tasync #internalGet(\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t\tattempt = 1,\n\t): Promise<ResponseLike> {\n\t\tconst url = await this.buildQueryURL(params)\n\t\tconst response = await this.#request(new URL(url), params)\n\n\t\tif (response.ok) {\n\t\t\treturn response\n\t\t}\n\n\t\ttry {\n\t\t\treturn await this.#throwContentAPIError(response, url)\n\t\t} catch (error) {\n\t\t\tif (\n\t\t\t\t(error instanceof RefNotFoundError || error instanceof RefExpiredError) &&\n\t\t\t\tattempt < MAX_INVALID_REF_RETRY_ATTEMPTS\n\t\t\t) {\n\t\t\t\t// If no explicit ref is given (i.e. the master ref from\n\t\t\t\t// /api/v2 is used), clear the cached repository value.\n\t\t\t\t// Clearing the cached value prevents other methods from\n\t\t\t\t// using a known-stale ref.\n\t\t\t\tif (!params?.ref) {\n\t\t\t\t\tthis.#cachedRepository = undefined\n\t\t\t\t}\n\n\t\t\t\tconst masterRef = error.message.match(/master ref is: (?<ref>.*)$/i)?.groups?.ref\n\t\t\t\tif (!masterRef) {\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tconst badRef = new URL(url).searchParams.get(\"ref\")\n\t\t\t\tconst issue = error instanceof RefNotFoundError ? \"invalid\" : \"expired\"\n\t\t\t\tthrottledWarn(\n\t\t\t\t\t`[@prismicio/client] The ref (${badRef}) was ${issue}. Now retrying with the latest master ref (${masterRef}). If you were previewing content, the response will not include draft content.`,\n\t\t\t\t)\n\n\t\t\t\treturn await this.#internalGet({ ...params, ref: masterRef }, attempt + 1)\n\t\t\t}\n\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/** Throws an error based on a Content API response. Only call in known-errored states. */\n\tasync #throwContentAPIError(response: ResponseLike, url: string): Promise<never> {\n\t\tswitch (response.status) {\n\t\t\tcase 400: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tthrow new ParsingError(json.message, url, json)\n\t\t\t}\n\t\t\tcase 401: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tthrow new ForbiddenError(json.message, url, json)\n\t\t\t}\n\t\t\tcase 404: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase \"api_notfound_error\": {\n\t\t\t\t\t\tthrow new RefNotFoundError(json.message, url, json)\n\t\t\t\t\t}\n\t\t\t\t\tcase \"api_security_error\": {\n\t\t\t\t\t\tif (/preview token.*expired/i.test(json.message)) {\n\t\t\t\t\t\t\tthrow new PreviewTokenExpiredError(json.message, url, json)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tthrow new NotFoundError(json.message, url, json)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase 410: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tthrow new RefExpiredError(json.message, url, json)\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new PrismicError(undefined, url, await response.text())\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Performs a low-level network request with the client's fetch options. */\n\tasync #request(url: URL, params?: FetchParams): Promise<ResponseLike> {\n\t\treturn await request(\n\t\t\turl,\n\t\t\t{\n\t\t\t\t...this.fetchOptions,\n\t\t\t\t...params?.fetchOptions,\n\t\t\t\theaders: {\n\t\t\t\t\t...this.fetchOptions?.headers,\n\t\t\t\t\t...params?.fetchOptions?.headers,\n\t\t\t\t},\n\t\t\t\tsignal: params?.fetchOptions?.signal || params?.signal || this.fetchOptions?.signal,\n\t\t\t},\n\t\t\tthis.fetchFn,\n\t\t)\n\t}\n}\n\n/** Appends filters to a params object. */\nfunction appendFilters<T extends Pick<BuildQueryURLArgs, \"filters\">>(\n\tparams = {} as T,\n\t...filters: string[]\n): T & { filters: string[] } {\n\treturn { ...params, filters: [...(params.filters ?? []), ...filters] }\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAM,gBAAgB;AACtB,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAC5B,MAAM,iCAAiC;;;;;;;AAmIvC,IAAa,SAAb,MAA0E;;;;;;CAMzE;;;;;;CAMA;;;;;;;CAOA;;;;;;;CAOA;;;;;;;CAOA;;;;;;;CAOA;;;;;;;CAOA;CAEA;CAEA;CACA,gBAAgB;CAChB;CAEA;CACA,8BAA8B;;;;;;CAO9B,YAAY,0BAAkC,SAAuB,EAAE,EAAE;EACxE,MAAM,EACL,qBACA,aACA,KACA,QACA,aACA,eACA,eAAe,EAAE,EACjB,QAAQ,WAAW,OAAO,KAAK,WAAW,KACvC;AAEJ,MAAIA,6BAAAA,qBAAqB,yBAAyB,EAAE;AACnD,OAAI;AACH,SAAK,iBAAiBC,0BAAAA,kBAAkB,yBAAyB;WAC1D;AACP,YAAQ,KACP,6FAA6F,yBAAyB,+HAA+HC,eAAAA,OAAO,yBAAyB,GACrR;;AAEF,QAAK,sBAAsB,uBAAuB;SAC5C;AACN,QAAK,iBAAiB;AACtB,QAAK,sBACJ,uBAAuBC,8BAAAA,sBAAsB,yBAAyB;;AAGxE,MAAI,CAAC,MACJ,OAAM,IAAIC,eAAAA,aACT,8KACA,KAAA,GACA,KAAA,EACA;AAEF,MAAI,OAAO,UAAU,WACpB,OAAM,IAAIA,eAAAA,aACT,2CAA2C,OAAO,SAClD,KAAA,GAC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