/**
* Wire-format decoders for the reverse-projection (`read-current`).
*
* The inverse of `layout/emit` + the compiler's field-value encoding: each
* decoder takes a raw Sitecore field value (a date wire string, an XML blob,
* a pipe-separated GUID list) and reconstructs the typed recipe payload.
* `decodeContentFieldValue` is the dispatcher — it routes one raw value to
* the right per-shape decoder via a `FieldShape`-keyed handler table.
*
* Every decoder is conservative: when the wire value isn't decodable under
* its shape (empty / malformed / handle unrecoverable) it returns
* `undefined`/`null` so the caller drops the field rather than fabricate a
* shape-violating value. See `../read-current.ts` for the lossy contract.
*/
import type { ContentFieldValue } from "../../schema/recipe.js";
import type { FieldShape } from "../../schema/field-types.js";
import { type GuidHandleIndex } from "./helpers.js";
/**
* Decode a Sitecore wire-format datetime (`yyyyMMddTHHmmssZ`) back to an
* ISO 8601 string. Inverse of `toSitecoreDate` in `compile/content-item.ts`:
* `kind: "date"` returns `YYYY-MM-DD`, `"datetime"` returns
* `YYYY-MM-DDTHH:mm:ssZ`. Returns `undefined` when the wire string doesn't
* match the expected shape — the caller drops the field rather than fabricate.
*/
export declare const decodeSitecoreDateToIso: (wire: string, kind: "date" | "datetime") => string | undefined;
/**
* Decode the Page Designs root's `TemplatesMapping` field into a list of
* `{ templateGuid, designGuid }` pairs. Inverse of
* `encodeTemplatesMapping` (`layout/templates-mapping.ts`): the field
* stores `{tplGuid}={designGuid}&…` URL-encoded.
*/
export declare const decodeTemplatesMapping: (raw: string) => Array<{
templateGuid: string;
designGuid: string;
}>;
/**
* Decode an `` blob
* into the image-shape `ContentFieldValue` payload. Returns `undefined`
* when the blob is not a recognisable image element (caller drops the
* field).
*
* The path is read from `mediapath` (media-library form) first, falling
* back to `src` — the attribute Sitecore stores for external-URL images
* and the form both scai encoders emit for fully-qualified URLs (the
* standard-values encoder always did; `encodeImageXml` since the
* external-URL fix). Without the fallback, every external-URL image was
* silently dropped from the reverse projection, so synced copies lost
* images that Pages still showed. Round-trip is stable: an `src=` URL
* decodes into `mediaPath` and re-encodes as `src=` because
* `encodeImageXml` dispatches on the URL shape.
*/
export declare const decodeImageXml: (xml: string) => {
mediaPath: string;
alt?: string;
width?: number;
height?: number;
} | undefined;
/**
* Decode an external General-Link XML blob into the link-external-shape
* payload. Returns `undefined` when the blob is not a `linktype="external"`
* `` element (caller branches to link-internal or drops the field).
*/
export declare const decodeExternalLinkXml: (xml: string) => {
href: string;
text?: string;
target?: string;
title?: string;
} | undefined;
/**
* Decode an internal General-Link XML blob — `linktype="internal"` with an
* `id="{guid}"` pointing at the target item. Returns `undefined` when the
* blob is not an internal link or the target GUID has no marker (handle
* unrecoverable — caller drops the field rather than fabricate).
*/
export declare const decodeInternalLinkXml: (xml: string, guidIndex: GuidHandleIndex) => {
ref: string;
text?: string;
target?: string;
} | undefined;
/**
* Decode one raw Sitecore field value back to a typed `ContentFieldValue`
* dispatched by the field's declared abstract `FieldShape`. Returns `null`
* when the value isn't decodable under that shape (empty / malformed /
* handle unrecoverable) — the caller drops the field rather than emit a
* shape-violating value.
*
* The `FieldShape` taxonomy has `"link"` (the abstract data shape). The
* recipe `ContentFieldValue` discriminates `"link-external"` vs
* `"link-internal"` at the value level — the `link` decoder picks the right
* branch by inspecting the XML's `linktype`. An internal link whose GUID
* has no marker resolves to `null` and is dropped (no fabricated handle).
*/
export declare const decodeContentFieldValue: (raw: string, shape: FieldShape, guidIndex: GuidHandleIndex) => ContentFieldValue | null;