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

    Aktuelle Version vom 5. Februar 2026, 09:34 Uhr

    $(document).ready(function() {
    	mw.loader.using(["oojs-ui", "jquery"]).done(function() {
    		var _create_class = {
    			_class_call_check: function(e, r) {
    	            if (!(e instanceof r))
    	                throw new TypeError("Cannot call a class as a function")
    	        },
    			_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 _define_property = {
    			_define_property: function(e, r, o) {
    	            return r in e ? Object.defineProperty(e, r, {
    	                value: o,
    	                enumerable: !0,
    	                configurable: !0,
    	                writable: !0
    	            }) : e[r] = o,
    	            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),
    		    $(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"),
    		    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 = $("<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);
    	});
    });