interface UserSettings {
    builtInExtensions: string[];
    showErrorMessages: boolean;
    pierceShadowRoot: boolean;
    adaptStyleMap: boolean;
    createElementMap: boolean;
}

interface UserResourceSettings extends UserSettings {
    preloadImages: boolean;
    preloadFonts: boolean;
    preloadLocalFonts: boolean;
    preloadCustomElements: boolean;
    outputEmptyCopyDirectory: boolean;
    outputDocumentHandler: string | string[];
    outputArchiveFormat: string;
    outputArchiveName: string;
    outputArchiveCache: boolean;
    outputSummaryModal: boolean | string;
    formatUUID?: string;
    formatDictionary?: string;
    outputTasks?: ObjectMap<TaskCommand | TaskCommand[]>;
    outputWatch?: ObjectMap<WatchValue>;
    outputConfigName?: string;
    observePort?: number;
    observeSecurePort?: number;
    observeExpires?: string;
    broadcastPort?: number;
    broadcastSecurePort?: number;
}

interface UserResourceSettingsUI extends UserResourceSettings {
    enabledSVG: boolean;
    supportNegativeLeftTop: boolean;
    showAttributes: boolean | AnyObject;
    showComments: boolean | CssStyleAttr[] | { include?: ShowCommentsInclude } & ObjectMap<CssStyleAttr[]>;
    insertSpaces: number;
    outputDirectory: string;
    outputDocumentEditing: boolean;
    outputDocumentCSS: CssStyleAttr[];
    defaultIntlLocales?: ResourceIntlLocales;
    convertEntities?: Array<"numeric" | "codepoints" | "characters" | AnyObject>;
    useShapeGeometryBox?: boolean;
    framesPerSecond?: number;
    resolutionScreenWidth?: number;
    resolutionScreenHeight?: number;
}

interface ControllerSettings {
    adoptedStyleSheet?: string;
    mimeType: {
        font: MIMEOrAll;
        image: MIMEOrAll;
        audio: MIMEOrAll;
        video: MIMEOrAll;
    };
}

interface ControllerSettingsUI<T = ControllerSettingsDirectoryUI> extends ControllerSettings {
    layout: ControllerSettingsLayoutUI;
    directory: T;
    style: ControllerSettingsStyleUI;
    unsupported: ControllerSettingsUnsupportedUI;
    deviations: ControllerSettingsDeviationsUI;
    baseStyle?: ControllerSettingsBaseStyleUI;
    floatPrecision: number;
}

interface ControllerSettingsLayoutUI {
    fileExtension: string;
    baseTemplate?: string;
    innerXmlTags?: string[];
}

interface ControllerSettingsDirectoryUI {
    layout: string;
    string: string;
    font: string;
    image: string;
    video: string;
    audio: string;
}

interface ControllerSettingsStyleUI {
    anchorFontColor: string;
    /** @deprecated inputFontSize | buttonFontSize | textareaFontSize | selectFontSize */
    formFontSize: string;
    inputBorderColor: string;
    inputBorderWidth: string;
    inputBorderStyle: string;
    inputDisabledBorderColor: string;
    inputBackgroundColor?: string;
    inputDisabledBackgroundColor?: string;
    inputFileBackgroundColor?: string;
    inputFileDisabledBackgroundColor?: string;
    buttonBorderColor: string;
    buttonBorderWidth: string;
    buttonBorderStyle: string;
    buttonPaddingVertical: string;
    buttonPaddingHorizontal: string;
    buttonDisabledBorderColor: string;
    buttonBackgroundColor?: string;
    buttonDisabledBackgroundColor?: string;
    hrBorderColor: string;
    rangeForegroundColor: string;
    rangeBackgroundColor: string;
    rangeBackgroundCenterHeight: number;
    meterForegroundColor: string;
    meterBackgroundColor: string;
    progressForegroundColor: string;
    progressBackgroundColor: string;
    targetTextBackgroundColor?: string;
    inputFontSize?: string;
    buttonFontSize?: string;
    textareaFontSize?: string;
    selectFontSize?: string;
    h1FontSize?: string;
    h2FontSize?: string;
    h3FontSize?: string;
    h4FontSize?: string;
    h5FontSize?: string;
    h6FontSize?: string;
    rtFontSize?: string;
    iframeBorderColor?: string;
    iframeBorderWidth?: string;
    iframeBorderStyle?: string;
    inputPlaceholderColor?: string;
}

interface ControllerSettingsBaseStyleUI {
    math?: CssStyleMap;
}

interface ControllerSettingsUnsupportedUI {
    cascade: string[];
    excluded: string[];
    tagName: string[];
    layer?: string[];
}

interface ControllerSettingsDeviationsUI {
    textMarginBoundarySize: number;
}

interface ExtensionDependency {
    name: string;
    leading?: boolean;
    trailing?: boolean;
}

interface ExtensionResult<T> {
    output?: NodeTemplate<T>;
    parent?: T;
    outerParent?: T;
    parentAs?: T;
    renderAs?: T;
    outputAs?: NodeTemplate<T>;
    complete?: boolean;
    next?: boolean;
    include?: boolean;
    subscribe?: boolean;
    remove?: boolean;
}

interface NodeTemplate<T> {
    type: number;
    node: T;
    parent?: T;
}

interface NodeXmlTemplate<T> extends NodeTemplate<T> {
    controlName: string;
    attributes?: string;
}

interface NodeIncludeTemplate<T> extends NodeTemplate<T> {
    content: string;
}

interface LayoutType {
    containerType: number;
    alignmentType: number;
}

interface LayoutRoot<T> extends PathInfo {
    node: T;
    renderTemplates: NodeTemplate<T>[];
    filename: string;
    systemDefined?: boolean;
    documentBase?: boolean;
}

/** @deprecated AppProjectUI */
interface FinalizeDataExtensionUI<T> {
    projectId: string;
    resourceId: number;
    rendered: T[];
    documentRoot: LayoutRoot<T>[];
    layouts: LayoutAsset[];
    requireFormat?: boolean;
}

interface FinalizedElement {
    id: string;
    documentId: string;
    bounds: BoxRectDimension;
    css: CssStyleMap;
    outerWrapperIds?: string[];
}

interface ShowCommentsInclude {
    tagName?: boolean | string[];
    attributes?: boolean | string[];
    dataset?: boolean;
    bounds?: boolean;
}