import { Editor } from '../../../core/Editor.js';
import { ContentControlTarget } from '../../../../../../../document-api/src/index.js';
interface SdtPrElement {
    name: string;
    type?: string;
    attributes?: Record<string, unknown>;
    elements?: SdtPrElement[];
    [key: string]: unknown;
}
/** Find a child element by name within sdtPr.elements. */
export declare function findSdtPrChild(sdtPr: SdtPrElement | undefined, childName: string): SdtPrElement | undefined;
/** Get the attributes object of a named sdtPr child element. */
export declare function getSdtPrChildAttrs(sdtPr: SdtPrElement | undefined, childName: string): Record<string, unknown> | undefined;
/**
 * Clone sdtPr and upsert a child element by name.
 * If a child with the given name exists, it is replaced. Otherwise it is appended.
 * Returns the new sdtPr object (immutable update).
 */
declare function upsertSdtPrChild(sdtPr: SdtPrElement, childName: string, replacement: SdtPrElement): SdtPrElement;
/**
 * Clone sdtPr and remove a child element by name.
 * Returns the new sdtPr object (immutable update).
 */
declare function removeSdtPrChild(sdtPr: SdtPrElement, childName: string): SdtPrElement;
/**
 * Apply an attribute patch to an SDT node.
 *
 * Uses `tr.setNodeAttribute` per key, which emits PM AttrSteps. AttrSteps
 * have no `from`/`to` range and are explicitly skipped by the structured-
 * content lock plugin's `filterTransaction`, so this path can mutate
 * metadata (id, tag, alias, lockMode, controlType, sdtPr, appearance, ...)
 * on `sdtLocked` and `sdtContentLocked` controls without tripping the
 * wrapper-damage check.
 *
 * The previous implementation delegated to `editor.commands.updateStructuredContentById`,
 * which dispatches `tr.replaceWith(pos, pos + node.nodeSize, ...)`. That
 * step's range covered the entire SDT, which the lock plugin read as
 * wrapper damage and silently filtered for locked controls — producing
 * false-success mutations.
 *
 * Returns true if a matching SDT was found and the transaction dispatched,
 * false if no SDT matched the given id or the editor cannot dispatch.
 */
export declare function applyAttrsUpdate(editor: Editor, nodeId: string, attrsPatch: Record<string, unknown>): boolean;
/**
 * Resolve the current sdtPr, apply an updater that mutates a named child
 * element, then write the entire sdtPr back via attrs update.
 *
 * The `updater` receives the current child element (or undefined) and returns
 * the replacement element. Return `null` to remove the child.
 */
export declare function updateSdtPrChild(editor: Editor, target: ContentControlTarget, childName: string, updater: (child: SdtPrElement | undefined) => SdtPrElement | null): boolean;
/**
 * Convenience: set an attribute on a named sdtPr child element.
 * Creates the child element if it doesn't exist.
 */
export declare function updateSdtPrChildAttr(editor: Editor, target: ContentControlTarget, childName: string, attrName: string, value: string): boolean;
/**
 * Convenience: remove an attribute from a named sdtPr child element.
 */
export declare function removeSdtPrChildAttr(editor: Editor, target: ContentControlTarget, childName: string, attrName: string): boolean;
/**
 * Convenience: find or create a sub-element within a sdtPr child,
 * then set an attribute on it. Commonly used for nested structures like
 * w:date > w:dateFormat, w14:checkbox > w14:checked, etc.
 */
export declare function updateSdtPrSubElementAttr(editor: Editor, target: ContentControlTarget, childName: string, subName: string, attrName: string, value: string): boolean;
/**
 * Convenience: remove a sub-element from a sdtPr child by name.
 */
export declare function removeSdtPrSubElement(editor: Editor, target: ContentControlTarget, childName: string, subName: string): boolean;
/**
 * Convenience: replace all sub-elements within a sdtPr child.
 * Useful for updating choice list items or checkbox symbol pairs.
 */
export declare function replaceSdtPrSubElements(editor: Editor, target: ContentControlTarget, childName: string, elements: SdtPrElement[]): boolean;
export { upsertSdtPrChild, removeSdtPrChild, type SdtPrElement };
//# sourceMappingURL=sdt-properties-write.d.ts.map