import type { Mapping, Segment } from "./types.js"; /** * Encode plain text and report it piece by piece: which words the dictionary * replaced, which digits the context rule permuted, and what each piece was * before. Joining every `encoded` gives exactly `encode(text, mapping)` — * `encode` is defined in terms of this function, so the two cannot drift. * * Reach for this whenever something needs to *show* the encoding rather than * just apply it: a live encoder that boxes the swapped tokens, a * "n of m tokens swapped" readout, an x-ray overlay with the originals on * hover. Every one of those is a mis-tokenising bug waiting to happen if it * re-derives the token boundaries itself; the site's own encoders each shipped * a `[A-Za-z]+` loop that silently skipped every digit. */ export declare function encodeSegments(text: string, mapping: Mapping): Segment[]; /** * Encode plain text with the given mapping. Words (Unicode letter runs) are * substituted case-preservingly; swap-eligible digits are permuted per the * font's context rule (F1). Words not in the mapping pass through unchanged. */ export declare function encode(text: string, mapping: Mapping): string; /** * Decode == encode: the word mapping is a bijection (m[m[x]] === x) and the * digit rule is an involution under fixed letter-context, so encoding twice is * the identity. Exposed separately for call-site clarity. */ export declare function decode(text: string, mapping: Mapping): string; //# sourceMappingURL=encode.d.ts.map