import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement,type LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type LyraSearchChangeDetail,type LyraTextViewerTargetEventMap}from'../../../internal/text-viewer-target.js';import type{AnchorResultDetail,TextSelectDetail}from'../document-viewer/anchors.js';export interface ParsedEmailAttachment{filename:string;mimeType:string;size:number;content?:Uint8Array;}export interface ParsedEmail{from:string;to:string;subject:string;date:string;bodyHtml:string|null;bodyText:string|null;attachments:ParsedEmailAttachment[];}export interface LyraEmailAttachmentOpenDetail{readonly attachment:Readonly<{filename:string;mimeType:string; /** Immutable binary snapshot. Read bytes with `arrayBuffer()`; no object URL is created. */ content?:Blob;}>;}export interface LyraEmailViewerEventMap extends LyraTextViewerTargetEventMap{'lr-render-error':CustomEvent<{error:unknown;}>;'lr-attachment-open':CustomEvent>;'lr-search-change':CustomEvent;'lr-anchor-result':CustomEvent;'lr-text-select':CustomEvent;}declare class LyraEmailViewerBase extends LyraElement{protected static readonly immutableEventDetails:readonly string[];}declare const LyraEmailViewer_base:Omit &(new(...args:ConstructorParameters)=>InstanceType &import("../../../lyra.js").LyraTextViewerTarget&{renderAnchorLiveRegion():unknown;}); /** * Parses `.eml` messages with the optional `postal-mime` peer and renders * their HTML body only after DOMPurify sanitization and inside a paint-contained surface. * Sanitized HTML uses the passive-document profile: anchors, form controls, and custom elements * are unwrapped to ordinary text/children where safe, remote navigation/resource attributes are * removed, and an `` itself never remains. Images render only inline base64 GIF, JPEG, PNG, or * WebP data; same-document SVG fragment references may remain. * Plain-text messages remain useful without DOMPurify. Attachment rows are real buttons that emit * `lr-attachment-open` with an immutable Blob snapshot of the decoded bytes -- this component * never opens, downloads, or object-URLs the content; a host routes the Blob into e.g. * `URL.createObjectURL(content)` -> `lr-document-viewer` -> * revoke on `lr-close`. `fold-quotes` collapses trailing quoted-reply text/HTML behind a * localized toggle. A missing attachment filename uses the localized * `emailViewerUnnamedAttachment` fallback in both visible and accessible names, resolved while * rendering so a later locale or `strings` change updates an already-parsed message. * A nonempty host `aria-label` makes the host the sole named semantic owner; otherwise the shadow * region owns the explicit-empty, `name`, or localized fallback label. * Fragment anchors perform an exact DOM `id` lookup. Lyra generates no fragment ids for message * headers or plain-text bodies; an HTML message can resolve only an id retained from its sanitized * body. Text-quote anchors remain available across all rendered message text. * * @customElement lr-email-viewer * @event lr-render-error - Fired when fetching or parsing the message fails. * @event lr-attachment-open - An attachment button was activated. Recursively frozen `detail: * { attachment: { filename, mimeType, content?: Blob } }`; read bytes with `arrayBuffer()`. * @event {CustomEvent} lr-search-change - * Fired whenever search state changes. `matchCountExact=false` makes the retained count a lower * bound. Bubbling, composed, and non-cancelable. * @event {CustomEvent} lr-anchor-result - Fired after an `anchor` assignment or * `scrollToAnchor()` call is applied. `detail: { found: boolean }`. Bubbling, composed, and * non-cancelable. * @event {CustomEvent} lr-text-select - Fired after a selection ends inside the * rendered message. `detail: { text: string; anchor: LyraAnchor | null; rects: DOMRect[] }`. * Bubbling, composed, and non-cancelable. * @csspart base - The root container with explicit `aria-busy` loading state. * @csspart headers - Message metadata. * @csspart from-label - The localized sender label. * @csspart from - The sender address. * @csspart to-label - The localized recipient label. * @csspart to - The recipient addresses. * @csspart subject-label - The localized subject label. * @csspart subject - The message subject. * @csspart date-label - The localized date label. * @csspart date - The message date. * @csspart body - The scrollable message body. * @csspart body-html - The sanitized HTML body. * @csspart body-text - The plain-text body. * @csspart attachments - The attachment region. * @csspart attachments-label - The localized attachment heading. * @csspart attachment-list - The attachment list. * @csspart attachment-item - An attachment metadata item. * @csspart attachment-button - An attachment's open button. * @csspart attachment-name - An attachment's filename, inside `attachment-button`. * @csspart attachment-size - An attachment's formatted file size, inside `attachment-button`. * @csspart quoted - A folded quoted-text block (hidden until expanded). * @csspart quote-toggle - The show/hide-quoted-text toggle button. * @csspart error - The error region. * @csspart spinner - The visible tokenized loading treatment and ordinary text label. * @cssprop [--lr-email-viewer-max-height=none] - Maximum block size of `[part="body"]` before it * scrolls internally. The `maxHeight` property sets this token inline on `[part="base"]`. * @status stable * @since 4.0.0 */ export declare class LyraEmailViewer extends LyraEmailViewer_base{static styles:import("lit").CSSResultGroup[]; /** URL to fetch and parse as an RFC 822 message. */ src:string; /** Display name associated with the message. Used as the accessible name * of `[part='base']` when the host has no `aria-label`, and before the * localized `emailViewerLabel` default, matching the `csvViewerLabel`- * style sibling document viewers. Host `aria-label` wins by attribute * presence, including an empty value. */ name:string; /** CSS length that caps the scrollable body. */ /** A CSS `max-height`; invalid values are ignored. */ maxHeight:string; /** Collapses trailing quoted-reply text/HTML behind a localized toggle. `false` (the default) * preserves today's exact body rendering. */ foldQuotes:boolean; /** Shared text search and anchor-target API for message headers/body text. Searching for text * inside a folded quote reveals matching quotes before navigating the active match, using the * same bounded Unicode/whitespace normalization and locale matching as the shared text index. */ search(query:string):Promise;searchNext():Promise;searchPrevious():Promise;clearSearch():void;private fetchState;private textQuoteExpanded;private expandedHtmlQuoteIndices;private generation;private lastLoadSrc;private readonly announcements; /** Memoizes {@link foldHtmlQuotes}'s output so an unrelated re-render (any `@state`/`@property` * write that isn't `bodyHtml` or the expanded-index set -- `name`, an announcement, a locale * broadcast, ...) reuses the last folded string instead of re-parsing and re-walking the whole * sanitized body on every render. Keyed on the two toggle-label strings too: a locale/`.strings` * change alone (no `bodyHtml`/index change) still flips the "Show/Hide quoted text" button text * that {@link foldHtmlQuotes} bakes into the returned markup, so the cache must miss when either * label would render differently. */ private foldedHtmlCache;protected textContentRoot():Element|null;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private load;private failWithLocalizedMessage;private isCurrentLoad;private parse;private formatAddress;private formatAddresses;private formatDate;private renderHeaders;private renderAttachments;private renderTextBody;private onBodyClick; /** Cached wrapper around {@link foldHtmlQuotes} -- see {@link foldedHtmlCache}'s doc comment for * what the cache key covers and why. A cache hit skips the `DOMParser().parseFromString()` + * `QUOTE_SELECTOR` walk + `.innerHTML` re-serialization entirely, which otherwise re-ran on * every render while `fold-quotes` is on, including renders triggered by toggling a single * quote block (a `expandedHtmlQuoteIndices` write re-renders the whole component, not just the * clicked block). */ private getFoldedHtml;private renderBody;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-email-viewer':LyraEmailViewer;}}export{};