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AC,QAAQ,EACnC,QAAQ,CAAC,EAAE,uBAAuB;IAUtC,SAAS,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAE7C,IAAI,UAAU,IAAI,qBAAqB,CAEtC;IAED,SAAS,CAAC,cAAc,EAAE,aAAa,CAAC;IAExC,IAAI,aAAa,IAAI,aAAa,CAEjC;IAED,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAKtC,gBAAgB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,EAAE;IAKzD,cAAc,IAAI,GAAG;IAIrB,eAAe,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG;IAKtC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,8BAA8B,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,uBAAuB,GAAG,UAAU;IASxH,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI;CAOtD","file":"../../src/browser/monaco-diff-editor.d.ts","sourcesContent":["/********************************************************************************\r\n * Copyright (C) 2018 TypeFox and others.\r\n *\r\n * This program and the accompanying materials are made available under the\r\n * terms of the Eclipse Public License v. 2.0 which is available at\r\n * http://www.eclipse.org/legal/epl-2.0.\r\n *\r\n * This Source Code may also be made available under the following Secondary\r\n * Licenses when the conditions for such availability set forth in the Eclipse\r\n * Public License v. 2.0 are satisfied: GNU General Public License, version 2\r\n * with the GNU Classpath Exception which is available at\r\n * https://www.gnu.org/software/classpath/license.html.\r\n *\r\n * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0\r\n ********************************************************************************/\r\n\r\nimport URI from '@tartjs/core/lib/common/uri';\r\nimport {Disposable} from '@tartjs/core/lib/common';\r\nimport {DeltaDecorationParams, DiffNavigator, Dimension} from '@tartjs/editor';\r\nimport {MonacoEditorModel} from './monaco-editor-model';\r\nimport {MonacoEditor, MonacoEditorServices} from './monaco-editor';\r\nimport {MonacoDiffNavigatorFactory} from './monaco-diff-navigator-factory';\r\nimport {DiffUris} from '@tartjs/core/lib/browser/diff-uris';\r\nimport IStandaloneDiffEditor = monaco.editor.IStandaloneDiffEditor;\r\nimport IDiffEditorConstructionOptions = monaco.editor.IDiffEditorConstructionOptions;\r\nimport IDiffNavigatorOptions = monaco.editor.IDiffNavigatorOptions;\r\nimport IEditorOverrideServices = monaco.editor.IEditorOverrideServices;\r\n\r\nexport namespace MonacoDiffEditor {\r\n    export interface IOptions extends MonacoEditor.ICommonOptions, IDiffEditorConstructionOptions, IDiffNavigatorOptions {\r\n    }\r\n}\r\n\r\nexport class MonacoDiffEditor extends MonacoEditor {\r\n    constructor(\r\n        readonly uri: URI,\r\n        readonly node: HTMLElement,\r\n        readonly originalModel: MonacoEditorModel,\r\n        readonly modifiedModel: MonacoEditorModel,\r\n        services: MonacoEditorServices,\r\n        protected readonly diffNavigatorFactory: MonacoDiffNavigatorFactory,\r\n        options?: MonacoDiffEditor.IOptions,\r\n        override?: IEditorOverrideServices,\r\n    ) {\r\n        super(uri, modifiedModel, node, services, options, override);\r\n        this.documents.add(originalModel);\r\n        const original = originalModel.textEditorModel;\r\n        const modified = modifiedModel.textEditorModel;\r\n        this._diffNavigator = diffNavigatorFactory.createdDiffNavigator(this._diffEditor, options);\r\n        this._diffEditor.setModel({original, modified});\r\n    }\r\n\r\n    protected _diffEditor: IStandaloneDiffEditor;\r\n\r\n    get diffEditor(): IStandaloneDiffEditor {\r\n        return this._diffEditor;\r\n    }\r\n\r\n    protected _diffNavigator: DiffNavigator;\r\n\r\n    get diffNavigator(): DiffNavigator {\r\n        return this._diffNavigator;\r\n    }\r\n\r\n    isActionSupported(id: string): boolean {\r\n        const action = this._diffEditor.getSupportedActions().find(a => a.id === id);\r\n        return !!action && action.isSupported() && super.isActionSupported(id);\r\n    }\r\n\r\n    deltaDecorations(params: DeltaDecorationParams): string[] {\r\n        console.warn('`deltaDecorations` should be called on either the original, or the modified editor.');\r\n        return [];\r\n    }\r\n\r\n    getResourceUri(): URI {\r\n        return new URI(this.originalModel.uri);\r\n    }\r\n\r\n    createMoveToUri(resourceUri: URI): URI {\r\n        const [left, right] = DiffUris.decode(this.uri);\r\n        return DiffUris.encode(left.withPath(resourceUri.path), right.withPath(resourceUri.path));\r\n    }\r\n\r\n    protected create(options?: IDiffEditorConstructionOptions, override?: monaco.editor.IEditorOverrideServices): Disposable {\r\n        this._diffEditor = monaco.editor.createDiffEditor(this.node, <IDiffEditorConstructionOptions>{\r\n            ...options,\r\n            fixedOverflowWidgets: true\r\n        }, override);\r\n        this.editor = this._diffEditor.getModifiedEditor();\r\n        return this._diffEditor;\r\n    }\r\n\r\n    protected resize(dimension: Dimension | null): void {\r\n        if (this.node) {\r\n            const layoutSize = this.computeLayoutSize(this.node, dimension);\r\n            this._diffEditor.layout(layoutSize);\r\n        }\r\n    }\r\n\r\n}\r\n"]}