×
Einen neuen Artikel erstellen
Schreibe den Seitennamen hierhin:
Wir haben derzeit 9.351 Artikel auf VAULTPEDIA. Gib deinen Artikelnamen oberhalb von oder klicke auf einen der unten stehenden Titel und beginne zu schreiben! ein



    VAULTPEDIA
    9.351Artikel

    Benutzer:Eckserah/cosmos.js: Unterschied zwischen den Versionen

    VAULTPEDIA.DE ist seit dem 02.02.2026 öffentlich zugänglich.

    Da es sich um ein frisch migriertes Wiki handelt, können vereinzelt noch Datenbank-, Seiten- oder Designfehler auftreten.

    Tritt unserem Discord bei, um Fehler zu melden oder direkt mit dem Team in Kontakt zu treten.

    Keine Bearbeitungszusammenfassung
    Keine Bearbeitungszusammenfassung
    Zeile 1: Zeile 1:
    var _create_class = {
    $(document).ready(function() {
    _defineProperties: function(e, r) {
    mw.loader.ready("oojs-ui", function() {
        for (var a = 0; a < r.length; a++) {
    var _create_class = {
            var c = r[a];
    _defineProperties: function(e, r) {
            c.enumerable = c.enumerable || !1,
        for (var a = 0; a < r.length; a++) {
            c.configurable = !0,
            var c = r[a];
            "value"in c && (c.writable = !0),
            c.enumerable = c.enumerable || !1,
            Object.defineProperty(e, c.key, c)
            c.configurable = !0,
        }
            "value"in c && (c.writable = !0),
    },
            Object.defineProperty(e, c.key, c)
    _create_class: function(e, r, a) {
        }
        return r && this._defineProperties(e.prototype, r),
    },
        a && this._defineProperties(e, a),
    _create_class: function(e, r, a) {
        e
        return r && this._defineProperties(e.prototype, r),
    }
        a && this._defineProperties(e, a),
    };
        e
    var SET_LINK_SUGGESTIONS = "SET_LINK_SUGGESTIONS"
    }
      , CLOSE_LINK_SUGGESTIONS = "CLOSE_LINK_SUGGESTIONS"
    };
      , HIGHLIGHTED_SUGGESTION_CHANGED = "HIGHLIGHTED_SUGGESTION_CHANGED";
    var SET_LINK_SUGGESTIONS = "SET_LINK_SUGGESTIONS"
    function LinkSuggestModel(e) {
      , CLOSE_LINK_SUGGESTIONS = "CLOSE_LINK_SUGGESTIONS"
        OO.EventEmitter.call(this),
      , HIGHLIGHTED_SUGGESTION_CHANGED = "HIGHLIGHTED_SUGGESTION_CHANGED";
        this.isCodeMirrorActive = e,
    function LinkSuggestModel(e) {
        this.linkSuggestions = [],
        OO.EventEmitter.call(this),
        this.query = {},
        this.isCodeMirrorActive = e,
        this.highlightedSuggestionIndex = -1
        this.linkSuggestions = [],
    }
        this.query = {},
    OO.initClass(LinkSuggestModel),
        this.highlightedSuggestionIndex = -1
    OO.mixinClass(LinkSuggestModel, OO.EventEmitter),
    }
    LinkSuggestModel.prototype.setCodeMirrorActive = function(e) {
    OO.initClass(LinkSuggestModel),
        this.isCodeMirrorActive = e
    OO.mixinClass(LinkSuggestModel, OO.EventEmitter),
    }
    LinkSuggestModel.prototype.setCodeMirrorActive = function(e) {
    ,
        this.isCodeMirrorActive = e
    LinkSuggestModel.prototype.setLinkSuggestQuery = function(e, t) {
    }
        this.query = e,
    ,
        this.linkSuggestions = t,
    LinkSuggestModel.prototype.setLinkSuggestQuery = function(e, t) {
        this.highlightedSuggestionIndex = -1,
        this.query = e,
        this.emit(SET_LINK_SUGGESTIONS)
        this.linkSuggestions = t,
    }
        this.highlightedSuggestionIndex = -1,
    ,
        this.emit(SET_LINK_SUGGESTIONS)
    LinkSuggestModel.prototype.highlightNextSuggestion = function() {
    }
        this.highlightedSuggestionIndex === this.linkSuggestions.length - 1 ? this.highlightedSuggestionIndex = -1 : this.highlightedSuggestionIndex++,
    ,
        this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
    LinkSuggestModel.prototype.highlightNextSuggestion = function() {
    }
        this.highlightedSuggestionIndex === this.linkSuggestions.length - 1 ? this.highlightedSuggestionIndex = -1 : this.highlightedSuggestionIndex++,
    ,
        this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
    LinkSuggestModel.prototype.highlightPreviousSuggestion = function() {
    }
        -1 === this.highlightedSuggestionIndex ? this.highlightedSuggestionIndex = this.linkSuggestions.length - 1 : this.highlightedSuggestionIndex--,
    ,
        this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
    LinkSuggestModel.prototype.highlightPreviousSuggestion = function() {
    }
        -1 === this.highlightedSuggestionIndex ? this.highlightedSuggestionIndex = this.linkSuggestions.length - 1 : this.highlightedSuggestionIndex--,
    ,
        this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
    LinkSuggestModel.prototype.closeLinkSuggestions = function() {
    }
        this.highlightedSuggestionIndex = -1,
    ,
        this.linkSuggestions = [],
    LinkSuggestModel.prototype.closeLinkSuggestions = function() {
        this.emit(CLOSE_LINK_SUGGESTIONS)
        this.highlightedSuggestionIndex = -1,
    }
        this.linkSuggestions = [],
    ;
        this.emit(CLOSE_LINK_SUGGESTIONS)
    var LinkSuggestController = function() {
    }
        function e(t, i, o, n) {
    ;
            var r = this;
    var LinkSuggestController = function() {
            _create_class._class_call_check(this, e),
        function e(t, i, o, n) {
            _define_property._define_property(this, "debouncedPerformLinkSuggestQuery", OO.ui.debounce(this.performLinkSuggestQuery.bind(this), 300)),
            var r = this;
            _define_property._define_property(this, "handleKeydown", (function(e) {
            _create_class._class_call_check(this, e),
                var t = e.key
            _define_property._define_property(this, "debouncedPerformLinkSuggestQuery", OO.ui.debounce(this.performLinkSuggestQuery.bind(this), 300)),
                  , i = r.model
            _define_property._define_property(this, "handleKeydown", (function(e) {
                  , o = i.linkSuggestions
                var t = e.key
                  , n = i.highlightedSuggestionIndex
                  , i = r.model
                  , s = i.query.originalContent;
                  , o = i.linkSuggestions
                if (!!o.length) {
                  , n = i.highlightedSuggestionIndex
                    if ("ArrowDown" === t)
                  , s = i.query.originalContent;
                        return e.preventDefault(),
                if (!!o.length) {
                        r.model.highlightNextSuggestion(),
                    if ("ArrowDown" === t)
                        !0;
                        return e.preventDefault(),
                    if ("ArrowUp" === t)
                        r.model.highlightNextSuggestion(),
                        return e.preventDefault(),
                        !0;
                        r.model.highlightPreviousSuggestion(),
                    if ("ArrowUp" === t)
                        !0;
                        return e.preventDefault(),
                    if ("Enter" === t && -1 !== n) {
                        r.model.highlightPreviousSuggestion(),
                        e.preventDefault();
                        !0;
                        var a = o[n]
                    if ("Enter" === t && -1 !== n) {
                          , d = index$1.getContentForSuggestions({
                        e.preventDefault();
                            suggestion: a,
                        var a = o[n]
                            originalContent: s
                          , d = index$1.getContentForSuggestions({
                        }).textToInsert;
                            suggestion: a,
                        return r.applyLinkSuggest(d),
                            originalContent: s
                        !0
                        }).textToInsert;
                    }
                        return r.applyLinkSuggest(d),
                    if ("Esc" === t || "Escape" === t)
                        !0
                        return e.preventDefault(),
                    }
                        r.model.closeLinkSuggestions(),
                    if ("Esc" === t || "Escape" === t)
                        !0
                        return e.preventDefault(),
                }
                        r.model.closeLinkSuggestions(),
                r.debouncedPerformLinkSuggestQuery()
                        !0
            }
                }
            )),
                r.debouncedPerformLinkSuggestQuery()
            this.model = t,
            }
            this.$textbox = i,
            )),
            this.api = o,
            this.model = t,
            this.pageLanguageHasWordBreaks = n
            this.$textbox = i,
        }
            this.api = o,
        return _create_class._create_class(e, [{
            this.pageLanguageHasWordBreaks = n
            key: "applyLinkSuggest",
        }
            value: function(e) {
        return _create_class._create_class(e, [{
                var t = this.model.query
            key: "applyLinkSuggest",
                  , i = t.startOffset
            value: function(e) {
                  , o = t.wasTemplateTransclusion
                var t = this.model.query
                  , n = this.$textbox.textSelection("getCaretPosition")
                  , i = t.startOffset
                  , r = o ? "}}" : "]]"
                  , o = t.wasTemplateTransclusion
                  , s = 1 + i + e.length + r.length;
                  , n = this.$textbox.textSelection("getCaretPosition")
                this.$textbox.textSelection("setSelection", {
                  , r = o ? "}}" : "]]"
                    start: 1 + i,
                  , s = 1 + i + e.length + r.length;
                    end: n
                this.$textbox.textSelection("setSelection", {
                }).textSelection("replaceSelection", e + r).textSelection("setSelection", {
                    start: 1 + i,
                    start: s,
                    end: n
                    end: s
                }).textSelection("replaceSelection", e + r).textSelection("setSelection", {
                }),
                    start: s,
                this.model.closeLinkSuggestions()
                    end: s
            }
                }),
        }, {
                this.model.closeLinkSuggestions()
            key: "performLinkSuggestQuery",
            }
            value: function() {
        }, {
                var e = this
            key: "performLinkSuggestQuery",
                  , t = this.$textbox.textSelection("getContents")
            value: function() {
                  , i = this.$textbox.textSelection("getCaretPosition")
                var e = this
                  , o = this.pageLanguageHasWordBreaks ? 4 : 1
                  , t = this.$textbox.textSelection("getContents")
                  , n = index$1.getLinkSuggestQueryFromText(t, i, o);
                  , i = this.$textbox.textSelection("getCaretPosition")
                if (!n || n.content.length < o || n.content.includes("|"))
                  , o = this.pageLanguageHasWordBreaks ? 4 : 1
                    this.model.closeLinkSuggestions();
                  , n = index$1.getLinkSuggestQueryFromText(t, i, o);
                else {
                if (!n || n.content.length < o || n.content.includes("|"))
                    var r = n.content.includes("|");
                    this.model.closeLinkSuggestions();
                    this.api.get({
                else {
                        action: "linksuggest",
                    var r = n.content.includes("|");
                        get: "suggestions",
                    this.api.get({
                        query: n.content
                        action: "linksuggest",
                    }).then((function(t) {
                        get: "suggestions",
                        var i = t.linksuggest.result.suggestions;
                        query: n.content
                        i.length && !r ? e.model.setLinkSuggestQuery(n, i) : e.model.closeLinkSuggestions()
                    }).then((function(t) {
                    }
                        var i = t.linksuggest.result.suggestions;
                    ))
                        i.length && !r ? e.model.setLinkSuggestQuery(n, i) : e.model.closeLinkSuggestions()
                }
                    }
            }
                    ))
        }, {
                }
            key: "setLinkSuggestEventHandlers",
            }
            value: function() {
        }, {
                var e = this
            key: "setLinkSuggestEventHandlers",
                  , t = this.model.isCodeMirrorActive;
            value: function() {
                this.model.closeLinkSuggestions(),
                var e = this
                t ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(t) {
                  , t = this.model.isCodeMirrorActive;
                    var i = t("ext.CodeMirror.v6.lib")
                this.model.closeLinkSuggestions(),
                      , o = i.EditorView
                t ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(t) {
                      , n = i.StateEffect
                    var i = t("ext.CodeMirror.v6.lib")
                      , r = i.Prec;
                      , o = i.EditorView
                    e.$textbox.off("keydown.linksuggest");
                      , n = i.StateEffect
                    var s = o.domEventHandlers({
                      , r = i.Prec;
                        keydown: function(t, i) {
                    e.$textbox.off("keydown.linksuggest");
                            return e.handleKeydown(t)
                    var s = o.domEventHandlers({
                        }
                        keydown: function(t, i) {
                    });
                            return e.handleKeydown(t)
                    mw.hook("ext.CodeMirror.ready").add((function(e, t) {
                        }
                        t.view.dispatch({
                    });
                            effects: n.appendConfig.of(r.high(s))
                    mw.hook("ext.CodeMirror.ready").add((function(e, t) {
                        })
                        t.view.dispatch({
                    }
                            effects: n.appendConfig.of(r.high(s))
                    ))
                        })
                }
                    }
                )) : this.addLinkSuggestWithoutSyntaxHighlighting()
                    ))
            }
                }
        }, {
                )) : this.addLinkSuggestWithoutSyntaxHighlighting()
            key: "addLinkSuggestWithoutSyntaxHighlighting",
            }
            value: function() {
        }, {
                this.$textbox.on("keydown.linksuggest", this.handleKeydown)
            key: "addLinkSuggestWithoutSyntaxHighlighting",
            }
            value: function() {
        }, {
                this.$textbox.on("keydown.linksuggest", this.handleKeydown)
            key: "updateCodeMirrorState",
            }
            value: function(e) {
        }, {
                var t = this;
            key: "updateCodeMirrorState",
                this.model.setCodeMirrorActive(e),
            value: function(e) {
                setTimeout((function() {
                var t = this;
                    return t.setLinkSuggestEventHandlers()
                this.model.setCodeMirrorActive(e),
                }
                setTimeout((function() {
                ))
                    return t.setLinkSuggestEventHandlers()
            }
                }
        }]),
                ))
        e
            }
    }();
        }]),
    function LinkSuggestPopupWidget(e, t, i, o) {
        e
        var n;
    }();
        this.model = e,
    function LinkSuggestPopupWidget(e, t, i, o) {
        this.controller = t,
        var n;
        this.$textbox = i,
        this.model = e,
        this.codeMirrorInstance = null,
        this.controller = t,
        this.$caretCoordinateCalculator = o,
        this.$textbox = i,
        this.textboxLineHeight = i.css("line-height"),
        this.codeMirrorInstance = null,
        this.debouncedUpdatePosition = OO.ui.debounce(this.updatePosition.bind(this), 300),
        this.$caretCoordinateCalculator = o,
        this.model.connect(this, (n = {},
        this.textboxLineHeight = i.css("line-height"),
        _define_property._define_property(n, SET_LINK_SUGGESTIONS, "onLinkSuggestionsSet"),
        this.debouncedUpdatePosition = OO.ui.debounce(this.updatePosition.bind(this), 300),
        _define_property._define_property(n, CLOSE_LINK_SUGGESTIONS, "onCloseLinkSuggestions"),
        this.model.connect(this, (n = {},
        _define_property._define_property(n, HIGHLIGHTED_SUGGESTION_CHANGED, "onHighlightedSuggestionChanged"),
        _define_property._define_property(n, SET_LINK_SUGGESTIONS, "onLinkSuggestionsSet"),
        n)),
        _define_property._define_property(n, CLOSE_LINK_SUGGESTIONS, "onCloseLinkSuggestions"),
        this.selectWidget = new OO.ui.SelectWidget,
        _define_property._define_property(n, HIGHLIGHTED_SUGGESTION_CHANGED, "onHighlightedSuggestionChanged"),
        this.selectWidget.connect(this, {
        n)),
            choose: "onSuggestionSelected"
        this.selectWidget = new OO.ui.SelectWidget,
        }),
        this.selectWidget.connect(this, {
        LinkSuggestPopupWidget.super.call(this, {
            choose: "onSuggestionSelected"
            $content: this.selectWidget.$element,
        }),
            padded: !1,
        LinkSuggestPopupWidget.super.call(this, {
            autoFlip: !1,
            $content: this.selectWidget.$element,
            hideWhenOutOfView: !1
            padded: !1,
        }),
            autoFlip: !1,
        this.$element.addClass("wikiEditor-ui-linkSuggest"),
            hideWhenOutOfView: !1
        this.$popup.addClass("wikiEditor-ui-linkSuggest-popup"),
        }),
        this.toggle(!1),
        this.$element.addClass("wikiEditor-ui-linkSuggest"),
        this.$textbox.on("scroll", this.debouncedUpdatePosition),
        this.$popup.addClass("wikiEditor-ui-linkSuggest-popup"),
        jquery.$(document).on("scroll", this.debouncedUpdatePosition)
        this.toggle(!1),
    }
        this.$textbox.on("scroll", this.debouncedUpdatePosition),
    function WikiEditorModeSwitchPopupButtonWidget(e) {
        jquery.$(document).on("scroll", this.debouncedUpdatePosition)
        var t = new OO.ui.ButtonWidget({
    }
            framed: !1,
    function WikiEditorModeSwitchPopupButtonWidget(e) {
            label: mw.msg("visualeditor-mweditmodeve-tool-current"),
        var t = new OO.ui.ButtonWidget({
            icon: "eye"
            framed: !1,
        });
            label: mw.msg("visualeditor-mweditmodeve-tool-current"),
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
            icon: "eye"
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
        });
        t.on("click", e),
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
        t.connect(this, {
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
            click: "hidePopup"
        t.on("click", e),
        }),
        t.connect(this, {
        WikiEditorModeSwitchPopupButtonWidget.super.call(this, {
            click: "hidePopup"
            framed: !1,
        }),
            indicator: "down",
        WikiEditorModeSwitchPopupButtonWidget.super.call(this, {
            popup: {
            framed: !1,
                containerPadding: 0,
            indicator: "down",
                $content: t.$element,
            popup: {
                width: null
                containerPadding: 0,
            },
                $content: t.$element,
            icon: "wikiText",
                width: null
            label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
            },
        }),
            icon: "wikiText",
        this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
            label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
        this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
        }),
        this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
        this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
        this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
        this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
    }
        this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
    function CodeEditorModeSwitchPopupButtonWidget(e) {
        this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
        var t = new OO.ui.ButtonWidget({
    }
            framed: !1,
    function CodeEditorModeSwitchPopupButtonWidget(e) {
            label: mw.msg("visualeditor-mweditmodeve-tool-current"),
        var t = new OO.ui.ButtonWidget({
            icon: "eye",
            framed: !1,
            href: e.href
            label: mw.msg("visualeditor-mweditmodeve-tool-current"),
        });
            icon: "eye",
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
            href: e.href
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member");
        });
        var i = new OO.ui.ButtonWidget({
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
            framed: !1,
        t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member");
            label: mw.msg("visualeditor-mweditmodesource-tool-current"),
        var i = new OO.ui.ButtonWidget({
            icon: "wikiText"
            framed: !1,
        });
            label: mw.msg("visualeditor-mweditmodesource-tool-current"),
        i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-sourceSwitch"),
            icon: "wikiText"
        i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
        });
        i.setDisabled(!0);
        i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-sourceSwitch"),
        var o = t.$element.add(i.$element);
        i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
        CodeEditorModeSwitchPopupButtonWidget.super.call(this, {
        i.setDisabled(!0);
            framed: !1,
        var o = t.$element.add(i.$element);
            indicator: "down",
        CodeEditorModeSwitchPopupButtonWidget.super.call(this, {
            popup: {
            framed: !1,
                containerPadding: 0,
            indicator: "down",
                $content: o,
            popup: {
                width: null
                containerPadding: 0,
            },
                $content: o,
            icon: "wikiText",
                width: null
            label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
            },
        }),
            icon: "wikiText",
        this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
            label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
        this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
        }),
        this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
        this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
        this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
        this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
    }
        this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
    function initLinkSuggest(e) {
        this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
        var t = !mw.user.options.get("disablelinksuggest")
    }
          , i = "wikitext" === mw.config.get("wgPageContentModel");
    function initLinkSuggest(e) {
        if (t && i) {
        var t = !mw.user.options.get("disablelinksuggest")
            var o = mw.user.options.get("usecodemirror") > 0
          , i = "wikitext" === mw.config.get("wgPageContentModel");
              , n = mw.config.get("wgPageLanguageHasWordBreaks")
        if (t && i) {
              , r = new mw.Api
            var o = mw.user.options.get("usecodemirror") > 0
              , s = new LinkSuggestModel(o)
              , n = mw.config.get("wgPageLanguageHasWordBreaks")
              , a = new LinkSuggestController(s,e,r,n)
              , r = new mw.Api
              , d = $("<div />").css({
              , s = new LinkSuggestModel(o)
                position: "absolute",
              , a = new LinkSuggestController(s,e,r,n)
                top: "-2000px",
              , d = $("<div />").css({
                left: "-2000px",
                position: "absolute",
                visibility: "hidden",
                top: "-2000px",
                "white-space": "pre-wrap",
                left: "-2000px",
                "font-family": e.css("font-family"),
                visibility: "hidden",
                "font-size": e.css("font-size"),
                "white-space": "pre-wrap",
                "line-height": e.css("line-height")
                "font-family": e.css("font-family"),
            }).appendTo(document.body)
                "font-size": e.css("font-size"),
              , u = new LinkSuggestPopupWidget(s,a,e,d);
                "line-height": e.css("line-height")
            $(".wikiEditor-ui-text").prepend(u.$element),
            }).appendTo(document.body)
            mw.hook("ext.CodeMirror.switch").add((function(e) {
              , u = new LinkSuggestPopupWidget(s,a,e,d);
                a.updateCodeMirrorState(e),
            $(".wikiEditor-ui-text").prepend(u.$element),
                u.setCodeMirrorInstance(e)
            mw.hook("ext.CodeMirror.switch").add((function(e) {
            }
                a.updateCodeMirrorState(e),
            )),
                u.setCodeMirrorInstance(e)
            setTimeout((function() {
            }
                return a.addLinkSuggestWithoutSyntaxHighlighting()
            )),
            }
            setTimeout((function() {
            ))
                return a.addLinkSuggestWithoutSyntaxHighlighting()
        }
            }
    }
            ))
    function postSetupInit() {
        }
        $(".mw-indicators").prependTo("#wikiPreview .mw-parser-output"),
    }
        $(".page-footer__categories").appendTo("#wikiPreview .mw-parser-output"),
    function postSetupInit() {
        setTimeout(wikiEditorTracking),
        $(".mw-indicators").prependTo("#wikiPreview .mw-parser-output"),
        mw.hook("ext.CodeMirror.initialize").add((function(e) {
        $(".page-footer__categories").appendTo("#wikiPreview .mw-parser-output"),
            "submit" === mw.config.get("wgAction") && window.scrollTo({
        setTimeout(wikiEditorTracking),
                top: 0
        mw.hook("ext.CodeMirror.initialize").add((function(e) {
            })
            "submit" === mw.config.get("wgAction") && window.scrollTo({
        }
                top: 0
        ))
            })
    }
        }
    OO.inheritClass(LinkSuggestPopupWidget, OO.ui.PopupWidget),
        ))
    LinkSuggestPopupWidget.prototype.onLinkSuggestionsSet = function() {
    }
        var e = this.model
    OO.inheritClass(LinkSuggestPopupWidget, OO.ui.PopupWidget),
          , t = e.linkSuggestions
    LinkSuggestPopupWidget.prototype.onLinkSuggestionsSet = function() {
          , i = e.query.originalContent;
        var e = this.model
        if (t.length) {
          , t = e.linkSuggestions
            this.selectWidget.clearItems();
          , i = e.query.originalContent;
            var o = t.map((function(e) {
        if (t.length) {
                var t = index$1.getContentForSuggestions({
            this.selectWidget.clearItems();
                    suggestion: e,
            var o = t.map((function(e) {
                    originalContent: i
                var t = index$1.getContentForSuggestions({
                })
                    suggestion: e,
                  , o = t.textToInsert
                    originalContent: i
                  , n = t.textToDisplay
                })
                  , r = new OO.ui.OptionWidget({
                  , o = t.textToInsert
                    data: o,
                  , n = t.textToDisplay
                    label: n
                  , r = new OO.ui.OptionWidget({
                });
                    data: o,
                return r.$element.addClass("wikiEditor-ui-linkSuggest-suggestion"),
                    label: n
                r
                });
            }
                return r.$element.addClass("wikiEditor-ui-linkSuggest-suggestion"),
            ));
                r
            this.selectWidget.addItems(o),
            }
            this.toggle(!0),
            ));
            this.updatePosition(),
            this.selectWidget.addItems(o),
            this.model.isCodeMirrorActive && (this.toggle(!1),
            this.toggle(!0),
            this.toggleClipping(!1),
            this.updatePosition(),
            this.position(),
            this.model.isCodeMirrorActive && (this.toggle(!1),
            this.toggleClipping(!0),
            this.toggleClipping(!1),
            this.toggle(!0)),
            this.position(),
            this.updatePositionIfOutsideOfViewport()
            this.toggleClipping(!0),
        } else
            this.toggle(!0)),
            this.toggle(!1)
            this.updatePositionIfOutsideOfViewport()
    }
        } else
    ,
            this.toggle(!1)
    LinkSuggestPopupWidget.prototype.onCloseLinkSuggestions = function() {
    }
        this.toggle(!1),
    ,
        this.$element.addClass("oo-ui-element-hidden"),
    LinkSuggestPopupWidget.prototype.onCloseLinkSuggestions = function() {
        this.selectWidget.clearItems()
        this.toggle(!1),
    }
        this.$element.addClass("oo-ui-element-hidden"),
    ,
        this.selectWidget.clearItems()
    LinkSuggestPopupWidget.prototype.computePosition = function() {
    }
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
    ,
        LinkSuggestPopupWidget.super.prototype.computePosition.call(this),
    LinkSuggestPopupWidget.prototype.computePosition = function() {
        this.$anchor.css({
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
            left: 12
        LinkSuggestPopupWidget.super.prototype.computePosition.call(this),
        });
        this.$anchor.css({
        var t = null != e ? e : this.getCaretPosition()
            left: 12
          , i = t.top
        });
          , o = t.left;
        var t = null != e ? e : this.getCaretPosition()
        return {
          , i = t.top
            position: "fixed",
          , o = t.left;
            top: "".concat(i, "px"),
        return {
            left: "".concat(o, "px"),
            position: "fixed",
            "margin-top": this.textboxLineHeight
            top: "".concat(i, "px"),
        }
            left: "".concat(o, "px"),
    }
            "margin-top": this.textboxLineHeight
    ,
        }
    LinkSuggestPopupWidget.prototype.getCaretPosition = function() {
    }
        var e = this.model
    ,
          , t = e.isCodeMirrorActive
    LinkSuggestPopupWidget.prototype.getCaretPosition = function() {
          , i = e.query.startOffset;
        var e = this.model
        if (t) {
          , t = e.isCodeMirrorActive
            var o = this.codeMirrorInstance.view.state.selection.main.head;
          , i = e.query.startOffset;
            return this.codeMirrorInstance.view.coordsAtPos(o)
        if (t) {
        }
            var o = this.codeMirrorInstance.view.state.selection.main.head;
        var n = this.$textbox.textSelection("getContents")
            return this.codeMirrorInstance.view.coordsAtPos(o)
          , r = this.$textbox.textSelection("getCaretPosition")
        }
          , s = jquery.$("<span />").text(n.substring(i, r));
        var n = this.$textbox.textSelection("getContents")
        this.$caretCoordinateCalculator.width(this.$textbox[0].scrollWidth).text(n.substring(0, i)).append(s);
          , r = this.$textbox.textSelection("getCaretPosition")
        var a = this.$textbox.offset()
          , s = jquery.$("<span />").text(n.substring(i, r));
          , d = a.top
        this.$caretCoordinateCalculator.width(this.$textbox[0].scrollWidth).text(n.substring(0, i)).append(s);
          , u = a.left
        var a = this.$textbox.offset()
          , c = s.position()
          , d = a.top
          , l = c.top
          , u = a.left
          , g = c.left
          , c = s.position()
          , p = s.width()
          , l = c.top
          , h = this.$textbox.scrollTop()
          , g = c.left
          , m = this.$textbox.scrollLeft();
          , p = s.width()
        return {
          , h = this.$textbox.scrollTop()
            top: d + l - h - window.scrollY,
          , m = this.$textbox.scrollLeft();
            left: u + g + p - m - window.scrollX
        return {
        }
            top: d + l - h - window.scrollY,
    }
            left: u + g + p - m - window.scrollX
    ,
        }
    LinkSuggestPopupWidget.prototype.updatePosition = function() {
    }
        var e = this.getCaretPosition();
    ,
        if (this.toggleClipping(!1),
    LinkSuggestPopupWidget.prototype.updatePosition = function() {
        this.position(),
        var e = this.getCaretPosition();
        this.toggleClipping(!0),
        if (this.toggleClipping(!1),
        this.selectWidget.items.length) {
        this.position(),
            var t, i;
        this.toggleClipping(!0),
            this.$element.css(this.computePosition(e));
        this.selectWidget.items.length) {
            var o = null !== (i = null === (t = this.codeMirrorInstance) || void 0 === t ? void 0 : t.view.dom.getBoundingClientRect()) && void 0 !== i ? i : this.$textbox[0].getBoundingClientRect()
            var t, i;
              , n = e.top >= o.top && e.top <= o.bottom;
            this.$element.css(this.computePosition(e));
            this.toggle(n)
            var o = null !== (i = null === (t = this.codeMirrorInstance) || void 0 === t ? void 0 : t.view.dom.getBoundingClientRect()) && void 0 !== i ? i : this.$textbox[0].getBoundingClientRect()
        }
              , n = e.top >= o.top && e.top <= o.bottom;
    }
            this.toggle(n)
    ,
        }
    LinkSuggestPopupWidget.prototype.setCodeMirrorInstance = function(e) {
    }
        var t = this;
    ,
        e ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(e) {
    LinkSuggestPopupWidget.prototype.setCodeMirrorInstance = function(e) {
            var i = e("ext.CodeMirror.v6.lib")
        var t = this;
              , o = i.EditorView
        e ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(e) {
              , n = i.StateEffect;
            var i = e("ext.CodeMirror.v6.lib")
            t.$textbox.off("keydown.linksuggest");
              , o = i.EditorView
            var r = o.domEventHandlers({
              , n = i.StateEffect;
                scroll: function(e, i) {
            t.$textbox.off("keydown.linksuggest");
                    return t.debouncedUpdatePosition()
            var r = o.domEventHandlers({
                }
                scroll: function(e, i) {
            });
                    return t.debouncedUpdatePosition()
            mw.hook("ext.CodeMirror.ready").add((function(e, i) {
                }
                t.codeMirrorInstance = i,
            });
                t.codeMirrorInstance.view.dispatch({
            mw.hook("ext.CodeMirror.ready").add((function(e, i) {
                    effects: n.appendConfig.of(r)
                t.codeMirrorInstance = i,
                })
                t.codeMirrorInstance.view.dispatch({
            }
                    effects: n.appendConfig.of(r)
            ))
                })
        }
            }
        )) : this.codeMirrorInstance = null
            ))
    }
        }
    ,
        )) : this.codeMirrorInstance = null
    LinkSuggestPopupWidget.prototype.onHighlightedSuggestionChanged = function() {
    }
        var e = this.model.highlightedSuggestionIndex;
    ,
        if (-1 === e)
    LinkSuggestPopupWidget.prototype.onHighlightedSuggestionChanged = function() {
            this.selectWidget.highlightItem();
        var e = this.model.highlightedSuggestionIndex;
        else {
        if (-1 === e)
            var t = this.selectWidget.items[e];
            this.selectWidget.highlightItem();
            this.selectWidget.highlightItem(t)
        else {
        }
            var t = this.selectWidget.items[e];
    }
            this.selectWidget.highlightItem(t)
    ,
        }
    LinkSuggestPopupWidget.prototype.onSuggestionSelected = function(e) {
    }
        var t = e.getData();
    ,
        this.controller.applyLinkSuggest(t)
    LinkSuggestPopupWidget.prototype.onSuggestionSelected = function(e) {
    }
        var t = e.getData();
    ,
        this.controller.applyLinkSuggest(t)
    LinkSuggestPopupWidget.prototype.updatePositionIfOutsideOfViewport = function() {
    }
        var e = this.$element.get(0).getBoundingClientRect()
    ,
          , t = e.left
    LinkSuggestPopupWidget.prototype.updatePositionIfOutsideOfViewport = function() {
          , i = e.right
        var e = this.$element.get(0).getBoundingClientRect()
          , o = e.width;
          , t = e.left
        window.innerWidth < i && (this.$anchor.css({
          , i = e.right
            left: "auto",
          , o = e.width;
            right: 12
        window.innerWidth < i && (this.$anchor.css({
        }),
            left: "auto",
        this.$element.css({
            right: 12
            left: t - o
        }),
        }))
        this.$element.css({
    }
            left: t - o
    ,
        }))
    OO.inheritClass(WikiEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    }
    WikiEditorModeSwitchPopupButtonWidget.prototype.hidePopup = function() {
    ,
        this.getPopup().toggle(!1)
    OO.inheritClass(WikiEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    }
    WikiEditorModeSwitchPopupButtonWidget.prototype.hidePopup = function() {
    ,
        this.getPopup().toggle(!1)
    OO.inheritClass(CodeEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    }
    mw.hook("wikiEditor.toolbarReady").add(initLinkSuggest).add(postSetupInit);
    ,
    OO.inheritClass(CodeEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    mw.hook("wikiEditor.toolbarReady").add(initLinkSuggest).add(postSetupInit);
    });
    });

    Version vom 5. Februar 2026, 09:25 Uhr

    $(document).ready(function() {
    	mw.loader.ready("oojs-ui", function() {
    		var _create_class = {
    			_defineProperties: function(e, r) {
    			    for (var a = 0; a < r.length; a++) {
    			        var c = r[a];
    			        c.enumerable = c.enumerable || !1,
    			        c.configurable = !0,
    			        "value"in c && (c.writable = !0),
    			        Object.defineProperty(e, c.key, c)
    			    }
    			},
    			 _create_class: function(e, r, a) {
    			    return r && this._defineProperties(e.prototype, r),
    			    a && this._defineProperties(e, a),
    			    e
    			}
    		};
    		var SET_LINK_SUGGESTIONS = "SET_LINK_SUGGESTIONS"
    		  , CLOSE_LINK_SUGGESTIONS = "CLOSE_LINK_SUGGESTIONS"
    		  , HIGHLIGHTED_SUGGESTION_CHANGED = "HIGHLIGHTED_SUGGESTION_CHANGED";
    		function LinkSuggestModel(e) {
    		    OO.EventEmitter.call(this),
    		    this.isCodeMirrorActive = e,
    		    this.linkSuggestions = [],
    		    this.query = {},
    		    this.highlightedSuggestionIndex = -1
    		}
    		OO.initClass(LinkSuggestModel),
    		OO.mixinClass(LinkSuggestModel, OO.EventEmitter),
    		LinkSuggestModel.prototype.setCodeMirrorActive = function(e) {
    		    this.isCodeMirrorActive = e
    		}
    		,
    		LinkSuggestModel.prototype.setLinkSuggestQuery = function(e, t) {
    		    this.query = e,
    		    this.linkSuggestions = t,
    		    this.highlightedSuggestionIndex = -1,
    		    this.emit(SET_LINK_SUGGESTIONS)
    		}
    		,
    		LinkSuggestModel.prototype.highlightNextSuggestion = function() {
    		    this.highlightedSuggestionIndex === this.linkSuggestions.length - 1 ? this.highlightedSuggestionIndex = -1 : this.highlightedSuggestionIndex++,
    		    this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
    		}
    		,
    		LinkSuggestModel.prototype.highlightPreviousSuggestion = function() {
    		    -1 === this.highlightedSuggestionIndex ? this.highlightedSuggestionIndex = this.linkSuggestions.length - 1 : this.highlightedSuggestionIndex--,
    		    this.emit(HIGHLIGHTED_SUGGESTION_CHANGED)
    		}
    		,
    		LinkSuggestModel.prototype.closeLinkSuggestions = function() {
    		    this.highlightedSuggestionIndex = -1,
    		    this.linkSuggestions = [],
    		    this.emit(CLOSE_LINK_SUGGESTIONS)
    		}
    		;
    		var LinkSuggestController = function() {
    		    function e(t, i, o, n) {
    		        var r = this;
    		        _create_class._class_call_check(this, e),
    		        _define_property._define_property(this, "debouncedPerformLinkSuggestQuery", OO.ui.debounce(this.performLinkSuggestQuery.bind(this), 300)),
    		        _define_property._define_property(this, "handleKeydown", (function(e) {
    		            var t = e.key
    		              , i = r.model
    		              , o = i.linkSuggestions
    		              , n = i.highlightedSuggestionIndex
    		              , s = i.query.originalContent;
    		            if (!!o.length) {
    		                if ("ArrowDown" === t)
    		                    return e.preventDefault(),
    		                    r.model.highlightNextSuggestion(),
    		                    !0;
    		                if ("ArrowUp" === t)
    		                    return e.preventDefault(),
    		                    r.model.highlightPreviousSuggestion(),
    		                    !0;
    		                if ("Enter" === t && -1 !== n) {
    		                    e.preventDefault();
    		                    var a = o[n]
    		                      , d = index$1.getContentForSuggestions({
    		                        suggestion: a,
    		                        originalContent: s
    		                    }).textToInsert;
    		                    return r.applyLinkSuggest(d),
    		                    !0
    		                }
    		                if ("Esc" === t || "Escape" === t)
    		                    return e.preventDefault(),
    		                    r.model.closeLinkSuggestions(),
    		                    !0
    		            }
    		            r.debouncedPerformLinkSuggestQuery()
    		        }
    		        )),
    		        this.model = t,
    		        this.$textbox = i,
    		        this.api = o,
    		        this.pageLanguageHasWordBreaks = n
    		    }
    		    return _create_class._create_class(e, [{
    		        key: "applyLinkSuggest",
    		        value: function(e) {
    		            var t = this.model.query
    		              , i = t.startOffset
    		              , o = t.wasTemplateTransclusion
    		              , n = this.$textbox.textSelection("getCaretPosition")
    		              , r = o ? "}}" : "]]"
    		              , s = 1 + i + e.length + r.length;
    		            this.$textbox.textSelection("setSelection", {
    		                start: 1 + i,
    		                end: n
    		            }).textSelection("replaceSelection", e + r).textSelection("setSelection", {
    		                start: s,
    		                end: s
    		            }),
    		            this.model.closeLinkSuggestions()
    		        }
    		    }, {
    		        key: "performLinkSuggestQuery",
    		        value: function() {
    		            var e = this
    		              , t = this.$textbox.textSelection("getContents")
    		              , i = this.$textbox.textSelection("getCaretPosition")
    		              , o = this.pageLanguageHasWordBreaks ? 4 : 1
    		              , n = index$1.getLinkSuggestQueryFromText(t, i, o);
    		            if (!n || n.content.length < o || n.content.includes("|"))
    		                this.model.closeLinkSuggestions();
    		            else {
    		                var r = n.content.includes("|");
    		                this.api.get({
    		                    action: "linksuggest",
    		                    get: "suggestions",
    		                    query: n.content
    		                }).then((function(t) {
    		                    var i = t.linksuggest.result.suggestions;
    		                    i.length && !r ? e.model.setLinkSuggestQuery(n, i) : e.model.closeLinkSuggestions()
    		                }
    		                ))
    		            }
    		        }
    		    }, {
    		        key: "setLinkSuggestEventHandlers",
    		        value: function() {
    		            var e = this
    		              , t = this.model.isCodeMirrorActive;
    		            this.model.closeLinkSuggestions(),
    		            t ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(t) {
    		                var i = t("ext.CodeMirror.v6.lib")
    		                  , o = i.EditorView
    		                  , n = i.StateEffect
    		                  , r = i.Prec;
    		                e.$textbox.off("keydown.linksuggest");
    		                var s = o.domEventHandlers({
    		                    keydown: function(t, i) {
    		                        return e.handleKeydown(t)
    		                    }
    		                });
    		                mw.hook("ext.CodeMirror.ready").add((function(e, t) {
    		                    t.view.dispatch({
    		                        effects: n.appendConfig.of(r.high(s))
    		                    })
    		                }
    		                ))
    		            }
    		            )) : this.addLinkSuggestWithoutSyntaxHighlighting()
    		        }
    		    }, {
    		        key: "addLinkSuggestWithoutSyntaxHighlighting",
    		        value: function() {
    		            this.$textbox.on("keydown.linksuggest", this.handleKeydown)
    		        }
    		    }, {
    		        key: "updateCodeMirrorState",
    		        value: function(e) {
    		            var t = this;
    		            this.model.setCodeMirrorActive(e),
    		            setTimeout((function() {
    		                return t.setLinkSuggestEventHandlers()
    		            }
    		            ))
    		        }
    		    }]),
    		    e
    		}();
    		function LinkSuggestPopupWidget(e, t, i, o) {
    		    var n;
    		    this.model = e,
    		    this.controller = t,
    		    this.$textbox = i,
    		    this.codeMirrorInstance = null,
    		    this.$caretCoordinateCalculator = o,
    		    this.textboxLineHeight = i.css("line-height"),
    		    this.debouncedUpdatePosition = OO.ui.debounce(this.updatePosition.bind(this), 300),
    		    this.model.connect(this, (n = {},
    		    _define_property._define_property(n, SET_LINK_SUGGESTIONS, "onLinkSuggestionsSet"),
    		    _define_property._define_property(n, CLOSE_LINK_SUGGESTIONS, "onCloseLinkSuggestions"),
    		    _define_property._define_property(n, HIGHLIGHTED_SUGGESTION_CHANGED, "onHighlightedSuggestionChanged"),
    		    n)),
    		    this.selectWidget = new OO.ui.SelectWidget,
    		    this.selectWidget.connect(this, {
    		        choose: "onSuggestionSelected"
    		    }),
    		    LinkSuggestPopupWidget.super.call(this, {
    		        $content: this.selectWidget.$element,
    		        padded: !1,
    		        autoFlip: !1,
    		        hideWhenOutOfView: !1
    		    }),
    		    this.$element.addClass("wikiEditor-ui-linkSuggest"),
    		    this.$popup.addClass("wikiEditor-ui-linkSuggest-popup"),
    		    this.toggle(!1),
    		    this.$textbox.on("scroll", this.debouncedUpdatePosition),
    		    jquery.$(document).on("scroll", this.debouncedUpdatePosition)
    		}
    		function WikiEditorModeSwitchPopupButtonWidget(e) {
    		    var t = new OO.ui.ButtonWidget({
    		        framed: !1,
    		        label: mw.msg("visualeditor-mweditmodeve-tool-current"),
    		        icon: "eye"
    		    });
    		    t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
    		    t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
    		    t.on("click", e),
    		    t.connect(this, {
    		        click: "hidePopup"
    		    }),
    		    WikiEditorModeSwitchPopupButtonWidget.super.call(this, {
    		        framed: !1,
    		        indicator: "down",
    		        popup: {
    		            containerPadding: 0,
    		            $content: t.$element,
    		            width: null
    		        },
    		        icon: "wikiText",
    		        label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
    		    }),
    		    this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
    		    this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
    		    this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
    		    this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
    		}
    		function CodeEditorModeSwitchPopupButtonWidget(e) {
    		    var t = new OO.ui.ButtonWidget({
    		        framed: !1,
    		        label: mw.msg("visualeditor-mweditmodeve-tool-current"),
    		        icon: "eye",
    		        href: e.href
    		    });
    		    t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-visualSwitch"),
    		    t.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member");
    		    var i = new OO.ui.ButtonWidget({
    		        framed: !1,
    		        label: mw.msg("visualeditor-mweditmodesource-tool-current"),
    		        icon: "wikiText"
    		    });
    		    i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-sourceSwitch"),
    		    i.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-member"),
    		    i.setDisabled(!0);
    		    var o = t.$element.add(i.$element);
    		    CodeEditorModeSwitchPopupButtonWidget.super.call(this, {
    		        framed: !1,
    		        indicator: "down",
    		        popup: {
    		            containerPadding: 0,
    		            $content: o,
    		            width: null
    		        },
    		        icon: "wikiText",
    		        label: mw.msg("visual-editor-fandom-switch-dropdown-mode-source-label")
    		    }),
    		    this.$element.addClass("ve-ui-modeSwitchPopupButtonWidget ve-ui-modeSwitchPopupButtonWidget-fd ve-header-action-item"),
    		    this.$button.attr("id", "ve-ui-modeSwitchPopupButtonWidget-button"),
    		    this.$button.addClass("ve-ui-modeSwitchPopupButtonWidget-button"),
    		    this.popup.$popup.addClass("ve-ui-modeSwitchPopupButtonWidget-popup")
    		}
    		function initLinkSuggest(e) {
    		    var t = !mw.user.options.get("disablelinksuggest")
    		      , i = "wikitext" === mw.config.get("wgPageContentModel");
    		    if (t && i) {
    		        var o = mw.user.options.get("usecodemirror") > 0
    		          , n = mw.config.get("wgPageLanguageHasWordBreaks")
    		          , r = new mw.Api
    		          , s = new LinkSuggestModel(o)
    		          , a = new LinkSuggestController(s,e,r,n)
    		          , d = $("<div />").css({
    		            position: "absolute",
    		            top: "-2000px",
    		            left: "-2000px",
    		            visibility: "hidden",
    		            "white-space": "pre-wrap",
    		            "font-family": e.css("font-family"),
    		            "font-size": e.css("font-size"),
    		            "line-height": e.css("line-height")
    		        }).appendTo(document.body)
    		          , u = new LinkSuggestPopupWidget(s,a,e,d);
    		        $(".wikiEditor-ui-text").prepend(u.$element),
    		        mw.hook("ext.CodeMirror.switch").add((function(e) {
    		            a.updateCodeMirrorState(e),
    		            u.setCodeMirrorInstance(e)
    		        }
    		        )),
    		        setTimeout((function() {
    		            return a.addLinkSuggestWithoutSyntaxHighlighting()
    		        }
    		        ))
    		    }
    		}
    		function postSetupInit() {
    		    $(".mw-indicators").prependTo("#wikiPreview .mw-parser-output"),
    		    $(".page-footer__categories").appendTo("#wikiPreview .mw-parser-output"),
    		    setTimeout(wikiEditorTracking),
    		    mw.hook("ext.CodeMirror.initialize").add((function(e) {
    		        "submit" === mw.config.get("wgAction") && window.scrollTo({
    		            top: 0
    		        })
    		    }
    		    ))
    		}
    		OO.inheritClass(LinkSuggestPopupWidget, OO.ui.PopupWidget),
    		LinkSuggestPopupWidget.prototype.onLinkSuggestionsSet = function() {
    		    var e = this.model
    		      , t = e.linkSuggestions
    		      , i = e.query.originalContent;
    		    if (t.length) {
    		        this.selectWidget.clearItems();
    		        var o = t.map((function(e) {
    		            var t = index$1.getContentForSuggestions({
    		                suggestion: e,
    		                originalContent: i
    		            })
    		              , o = t.textToInsert
    		              , n = t.textToDisplay
    		              , r = new OO.ui.OptionWidget({
    		                data: o,
    		                label: n
    		            });
    		            return r.$element.addClass("wikiEditor-ui-linkSuggest-suggestion"),
    		            r
    		        }
    		        ));
    		        this.selectWidget.addItems(o),
    		        this.toggle(!0),
    		        this.updatePosition(),
    		        this.model.isCodeMirrorActive && (this.toggle(!1),
    		        this.toggleClipping(!1),
    		        this.position(),
    		        this.toggleClipping(!0),
    		        this.toggle(!0)),
    		        this.updatePositionIfOutsideOfViewport()
    		    } else
    		        this.toggle(!1)
    		}
    		,
    		LinkSuggestPopupWidget.prototype.onCloseLinkSuggestions = function() {
    		    this.toggle(!1),
    		    this.$element.addClass("oo-ui-element-hidden"),
    		    this.selectWidget.clearItems()
    		}
    		,
    		LinkSuggestPopupWidget.prototype.computePosition = function() {
    		    var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
    		    LinkSuggestPopupWidget.super.prototype.computePosition.call(this),
    		    this.$anchor.css({
    		        left: 12
    		    });
    		    var t = null != e ? e : this.getCaretPosition()
    		      , i = t.top
    		      , o = t.left;
    		    return {
    		        position: "fixed",
    		        top: "".concat(i, "px"),
    		        left: "".concat(o, "px"),
    		        "margin-top": this.textboxLineHeight
    		    }
    		}
    		,
    		LinkSuggestPopupWidget.prototype.getCaretPosition = function() {
    		    var e = this.model
    		      , t = e.isCodeMirrorActive
    		      , i = e.query.startOffset;
    		    if (t) {
    		        var o = this.codeMirrorInstance.view.state.selection.main.head;
    		        return this.codeMirrorInstance.view.coordsAtPos(o)
    		    }
    		    var n = this.$textbox.textSelection("getContents")
    		      , r = this.$textbox.textSelection("getCaretPosition")
    		      , s = jquery.$("<span />").text(n.substring(i, r));
    		    this.$caretCoordinateCalculator.width(this.$textbox[0].scrollWidth).text(n.substring(0, i)).append(s);
    		    var a = this.$textbox.offset()
    		      , d = a.top
    		      , u = a.left
    		      , c = s.position()
    		      , l = c.top
    		      , g = c.left
    		      , p = s.width()
    		      , h = this.$textbox.scrollTop()
    		      , m = this.$textbox.scrollLeft();
    		    return {
    		        top: d + l - h - window.scrollY,
    		        left: u + g + p - m - window.scrollX
    		    }
    		}
    		,
    		LinkSuggestPopupWidget.prototype.updatePosition = function() {
    		    var e = this.getCaretPosition();
    		    if (this.toggleClipping(!1),
    		    this.position(),
    		    this.toggleClipping(!0),
    		    this.selectWidget.items.length) {
    		        var t, i;
    		        this.$element.css(this.computePosition(e));
    		        var o = null !== (i = null === (t = this.codeMirrorInstance) || void 0 === t ? void 0 : t.view.dom.getBoundingClientRect()) && void 0 !== i ? i : this.$textbox[0].getBoundingClientRect()
    		          , n = e.top >= o.top && e.top <= o.bottom;
    		        this.toggle(n)
    		    }
    		}
    		,
    		LinkSuggestPopupWidget.prototype.setCodeMirrorInstance = function(e) {
    		    var t = this;
    		    e ? mw.loader.using(["ext.CodeMirror.v6", "ext.CodeMirror.v6.mode.mediawiki"], (function(e) {
    		        var i = e("ext.CodeMirror.v6.lib")
    		          , o = i.EditorView
    		          , n = i.StateEffect;
    		        t.$textbox.off("keydown.linksuggest");
    		        var r = o.domEventHandlers({
    		            scroll: function(e, i) {
    		                return t.debouncedUpdatePosition()
    		            }
    		        });
    		        mw.hook("ext.CodeMirror.ready").add((function(e, i) {
    		            t.codeMirrorInstance = i,
    		            t.codeMirrorInstance.view.dispatch({
    		                effects: n.appendConfig.of(r)
    		            })
    		        }
    		        ))
    		    }
    		    )) : this.codeMirrorInstance = null
    		}
    		,
    		LinkSuggestPopupWidget.prototype.onHighlightedSuggestionChanged = function() {
    		    var e = this.model.highlightedSuggestionIndex;
    		    if (-1 === e)
    		        this.selectWidget.highlightItem();
    		    else {
    		        var t = this.selectWidget.items[e];
    		        this.selectWidget.highlightItem(t)
    		    }
    		}
    		,
    		LinkSuggestPopupWidget.prototype.onSuggestionSelected = function(e) {
    		    var t = e.getData();
    		    this.controller.applyLinkSuggest(t)
    		}
    		,
    		LinkSuggestPopupWidget.prototype.updatePositionIfOutsideOfViewport = function() {
    		    var e = this.$element.get(0).getBoundingClientRect()
    		      , t = e.left
    		      , i = e.right
    		      , o = e.width;
    		    window.innerWidth < i && (this.$anchor.css({
    		        left: "auto",
    		        right: 12
    		    }),
    		    this.$element.css({
    		        left: t - o
    		    }))
    		}
    		,
    		OO.inheritClass(WikiEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    		WikiEditorModeSwitchPopupButtonWidget.prototype.hidePopup = function() {
    		    this.getPopup().toggle(!1)
    		}
    		,
    		OO.inheritClass(CodeEditorModeSwitchPopupButtonWidget, OO.ui.PopupButtonWidget),
    		mw.hook("wikiEditor.toolbarReady").add(initLinkSuggest).add(postSetupInit);
    	});
    });