{"version":3,"file":"embed.cjs","names":[],"sources":["../../../src/types/value/embed.ts"],"sourcesContent":["import type { EmptyObjectField, FieldState } from \"./types\"\n\n/**\n * OEmbed 1.0 possible types.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport const OEmbedType = {\n\tPhoto: \"photo\",\n\tVideo: \"video\",\n\tLink: \"link\",\n\tRich: \"rich\",\n} as const\n\n/**\n * OEmbed response base fields. Those are every mandatory fields an oEmbed response must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\ntype OEmbedBase<TType extends (typeof OEmbedType)[keyof typeof OEmbedType]> = {\n\t/** OEmbed resource type. */\n\ttype: TType\n\n\t/** OEmbed version number, this must be \"1.0\". */\n\tversion: string\n}\n\n/**\n * OEmbed response extra fields. Those are every non-mandatory and unknown fields an oEmbed response\n * can feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type OEmbedExtra = {\n\t/** OEmbed text title, describing the resource. */\n\ttitle?: string | null\n\n\t/** OEmbed resource author/owner name. */\n\tauthor_name?: string | null\n\n\t/** OEmbed resource author/owner URL. */\n\tauthor_url?: string | null\n\n\t/** OEmbed resource provider name. */\n\tprovider_name?: string | null\n\n\t/** OEmbed resource provider URL. */\n\tprovider_url?: string | null\n\n\t/** OEmbed suggested cache lifetime for the resource, in seconds. */\n\tcache_age?: number | null\n\n\t/** OEmbed resource thumbnail URL. */\n\tthumbnail_url?: string | null\n\n\t/** OEmbed resource thumbnail width. */\n\tthumbnail_width?: number | null\n\n\t/** OEmbed resource thumbnail height. */\n\tthumbnail_height?: number | null\n\n\t/**\n\t * Providers may optionally include any parameters not specified in this document (so long as they\n\t * use the same key-value format) and consumers may choose to ignore these. Consumers must ignore\n\t * parameters they do not understand.\n\t *\n\t * @see oEmbed specification: {@link https://oembed.com}\n\t */\n\t[key: string]: unknown | null\n}\n\n/**\n * OEmbed photo type. Those are every mandatory fields an oEmbed photo response must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {\n\t/** OEmbed source URL of the image. */\n\turl: string\n\n\t/** OEmbed width in pixels of the image. */\n\twidth: number\n\n\t/** OEmbed height in pixels of the image. */\n\theight: number\n}\n\n/**\n * OEmbed video type. Those are every mandatory fields an oEmbed video response must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {\n\t/** OEmbed HTML required to embed a video player. */\n\thtml: string\n\n\t/** OEmbed width in pixels required to display the HTML. */\n\twidth: number\n\n\t/** OEmbed height in pixels required to display the HTML. */\n\theight: number\n}\n\n/**\n * OEmbed link type. Those are every mandatory fields an oEmbed link response must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>\n\n/**\n * OEmbed rich type. Those are every mandatory fields an oEmbed rich response must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {\n\t/** OEmbed HTML required to display the resource. */\n\thtml: string\n\n\t/** OEmbed width in pixels required to display the HTML. */\n\twidth: number\n\n\t/** OEmbed height in pixels required to display the HTML. */\n\theight: number\n}\n\n/**\n * Any of the possible types of oEmbed response. Those contains only mandatory fields their\n * respective oEmbed response type must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed\n\n/**\n * An embed field.\n *\n * @typeParam Data - Data provided by the URL's oEmbed provider.\n * @typeParam State - State of the field which determines its shape.\n * @see More details: {@link https://prismic.io/docs/embed}\n */\nexport type EmbedField<\n\tData extends AnyOEmbed = AnyOEmbed & OEmbedExtra,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyObjectField\n\t: Data & {\n\t\t\tembed_url: string\n\t\t\thtml: string | null\n\t\t}\n"],"mappings":";;;;;;AAOA,MAAa,aAAa;CACzB,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;CACN"}