import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraClipboardWriteFailure,type LyraClipboardWriteSuccess}from'../../../internal/clipboard.js';import{type ShikiLanguageInput}from'../../conversation/code-block/code-loader.js';export interface LyraDiffViewEventMap{'lr-copy':CustomEvent;'lr-error':CustomEvent;'lr-copy-error':CustomEvent;} /** The internal diff rendering layout -- `'unified'` (the default) is one interleaved column, * `'split'` is two side-by-side columns derived from the same `LyraDiffOp[]`. */ export type LyraDiffViewLayout='unified'|'split'; /** * `` — a real two-string line diff (Hirschberg LCS alignment), rendered as * interleaved unified-diff output -- not diff-flavored syntax highlighting over an * already-formatted string (`lr-code-block`'s `language="diff"` only lexically colors a string * the consumer already unified-diffed; it has no two-string-compare entry point). First-party * invention (no Web Awesome equivalent). * * @customElement lr-diff-view * @event lr-copy - Fired after clipboard writing fulfills. The frozen shared outcome detail is * `{ ok: true, text }`, where `text` is the full unified diff. * @event lr-error - The clipboard write failed. A bubbling, composed, non-cancelable event with * no detail. * @event lr-copy-error - The clipboard write failed. The frozen shared outcome detail is * `{ ok: false, text, reason, error }`, where * `reason` is `'unsupported' | 'denied' | 'failed'`. * @csspart base - The root wrapper. * @csspart line - A single line. Carries `data-type="equal"|"add"|"remove"|"empty"|"fold"` * (`"empty"` is an unbalanced-replace placeholder cell in `layout="split"` and never carries a * `+`/`-` prefix; `"fold"` is the collapsed-unchanged-lines marker `contextLines` produces). * @csspart copy-button - The copy affordance, only rendered while `copyable`. * @csspart limit - The localized fallback rendered when either input exceeds `maxLines`. * @csspart side - One column in `layout="split"` (`data-side="old"|"new"`). * @cssprop [--lr-diff-view-max-height=none] - Cap on `[part="base"]`'s block size, past which the * view scrolls internally. The `maxHeight` property sets this token inline on `[part="base"]`. * @cssprop [--lr-diff-view-font=var(--lr-font-mono)] - Font family used for the diff lines. * @cssprop [--lr-diff-view-add-background=var(--lr-color-success-quiet)] - Added-line background. * @cssprop [--lr-diff-view-add-color=var(--lr-color-success)] - Added-line text color. * @cssprop [--lr-diff-view-remove-background=var(--lr-color-danger-quiet)] - Removed-line background. * @cssprop [--lr-diff-view-remove-color=var(--lr-color-danger)] - Removed-line text color. * @cssprop [--lr-diff-view-fold-background=var(--lr-color-surface-raised)] - Fold-marker background. * @cssprop [--lr-diff-view-fold-color=var(--lr-color-text-quiet)] - Fold-marker text color. * @status stable * @since 4.0.0 */ export declare class LyraDiffView extends LyraElement{static styles:import("lit").CSSResultGroup[]; /** The "before" text. Default `''` renders an all-additions diff of `newText`. */ oldText:string; /** The "after" text. Default `''` renders an all-removals diff of `oldText`. */ newText:string; /** Shows a copy-to-clipboard button for the full unified-diff text. `false` (the default) * renders no button. */ copyable:boolean; /** A CSS length (e.g. `"20rem"`); once set, the view scrolls internally past this height * instead of growing the page. Invalid values are ignored. */ maxHeight:string; /** `'unified'` (the default) renders today's single interleaved `
`; `'split'` renders two
*  side-by-side columns derived from the same `LyraDiffOp[]` (see `pairOpsForSplit()`).
*  Unsupported attributes and untyped writes normalize to reflected `unified`. */
private _layout;get layout():LyraDiffViewLayout;set layout(next:LyraDiffViewLayout);
/** A shiki-recognized language id. Highlighting activates only when this has a matching entry in
*  `languages` -- there is deliberately no default full-table `lr-code-block`-style fallback, so
*  this component never reaches shiki's ~200-language dynamic-import table. */
language:string;
/** Grammar definitions this instance can highlight, same shape as `lr-code-block-core`'s own
*  `languages`. */
languages?:Readonly>;
/** How many unchanged lines to keep visible immediately before/after each change. Default
*  `undefined` renders every line unconditionally, exactly like before this property existed. Set
*  to a finite number `>= 0` to collapse a longer run of unchanged lines behind a single fold
*  marker reporting how many lines it hides -- the same context-window convention unified diffs
*  and `git diff`'s `-U` use. A negative or non-finite value is treated as unset (no folding). */
contextLines?:number;
/** Maximum lines accepted on either input side before rendering a bounded fallback. Defaults
*  to `5000`. `Infinity` relaxes this line-count limit; aggregate text and comparison work
*  remain bounded. */
maxLines:number;private copyStatus;private diffTooLarge;
/** Copy outcomes announce through a light-DOM sink because live regions inside shadow roots are
* not consistently exposed by assistive technology. */
private copyAnnouncementSink?;private highlightedOldLines;private highlightedNewLines;private highlightToken;private loadHighlighterCore;private copyTimer?;
/** Invalidates clipboard outcomes when another activation, source change, disconnect, or
* adoption makes the pending write obsolete. */
private copyGeneration;
/** Canonical scalar text and grammar-map inputs. Every later diff/highlight read uses these
* admitted values instead of re-reading caller-owned public properties. */
private oldTextSnapshot;private newTextSnapshot;private languageSnapshot;private languagesSnapshot?;private diffOps;protected willUpdate(changed:PropertyValues):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private cancelCopyTimer;private resetCopyFeedback;private syncHighlight;
/** Tokenizes `text` as one document (so multi-line tokens survive) and splits shiki's own
*  rendered `.line` spans back into a per-source-line HTML array, normalized to exactly
*  `splitLines(text).length` entries -- shiki's own trailing-newline handling can otherwise be
*  off by one relative to a plain split. MUST use the same `splitLines` as the diff at
*  `willUpdate` above: if this counted lines differently (e.g. plain `split('\n')` while the diff
*  normalizes CRLF), every CRLF document would misindex `highlightedOldLines`/`-NewLines`. */
private tokenizeLines;
/** Computes which `equal` ops a fold marker should hide, keyed by object identity (not array
*  index) so the same result works for both `renderUnified()`'s flat op sequence and
*  `renderSplit()`'s `pairOpsForSplit()` rows -- an equal op's `LyraDiffOp` object is the exact same
*  reference in both places. `foldBefore` maps the first visible op *after* a hidden run to how
*  many lines that run hid (the marker renders immediately before that op); a run hidden all the
*  way to the end of the diff has no "next op" to key off, so its count surfaces separately as
*  `trailingFold`. Only maximal `equal` runs are ever folded -- `add`/`remove` ops are always
*  visible. A run that is both the very first and very last thing in the diff (i.e. `oldText` and
*  `newText` are identical) is never folded: there is no adjacent change to give context around. */
private computeFolds;private foldMarker;private get unifiedText();private isCurrentCopy;private showCopyStatus;private copy;private onCopyClick;private renderUnified;private renderSplit;private renderSplitCell;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-diff-view':LyraDiffView;}}