{"version":3,"file":"vendors-f21642a1.4e202c72d209411713eb.bundle.js","mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://frontend/./node_modules/@codemirror/tooltip/dist/index.js"],"sourcesContent":["import { ViewPlugin, Direction, EditorView, logException } from '@codemirror/view';\nimport { Facet, StateEffect, StateField, MapMode } from '@codemirror/state';\n\nconst ios = typeof navigator != \"undefined\" &&\n    !/Edge\\/(\\d+)/.exec(navigator.userAgent) && /Apple Computer/.test(navigator.vendor) &&\n    (/Mobile\\/\\w+/.test(navigator.userAgent) || navigator.maxTouchPoints > 2);\nconst Outside = \"-10000px\";\nconst tooltipPlugin = ViewPlugin.fromClass(class {\n    constructor(view) {\n        this.view = view;\n        this.inView = true;\n        this.measureReq = { read: this.readMeasure.bind(this), write: this.writeMeasure.bind(this), key: this };\n        this.input = view.state.facet(showTooltip);\n        this.tooltips = this.input.filter(t => t);\n        this.tooltipViews = this.tooltips.map(tp => this.createTooltip(tp));\n    }\n    update(update) {\n        let input = update.state.facet(showTooltip);\n        if (input == this.input) {\n            for (let t of this.tooltipViews)\n                if (t.update)\n                    t.update(update);\n        }\n        else {\n            let tooltips = input.filter(x => x);\n            let views = [];\n            for (let i = 0; i < tooltips.length; i++) {\n                let tip = tooltips[i], known = -1;\n                if (!tip)\n                    continue;\n                for (let i = 0; i < this.tooltips.length; i++) {\n                    let other = this.tooltips[i];\n                    if (other && other.create == tip.create)\n                        known = i;\n                }\n                if (known < 0) {\n                    views[i] = this.createTooltip(tip);\n                }\n                else {\n                    let tooltipView = views[i] = this.tooltipViews[known];\n                    if (tooltipView.update)\n                        tooltipView.update(update);\n                }\n            }\n            for (let t of this.tooltipViews)\n                if (views.indexOf(t) < 0)\n                    t.dom.remove();\n            this.input = input;\n            this.tooltips = tooltips;\n            this.tooltipViews = views;\n            this.maybeMeasure();\n        }\n    }\n    createTooltip(tooltip) {\n        let tooltipView = tooltip.create(this.view);\n        tooltipView.dom.classList.add(\"cm-tooltip\");\n        // FIXME drop this on the next breaking release\n        if (tooltip.class)\n            tooltipView.dom.classList.add(tooltip.class);\n        tooltipView.dom.style.top = Outside;\n        this.view.dom.appendChild(tooltipView.dom);\n        if (tooltipView.mount)\n            tooltipView.mount(this.view);\n        return tooltipView;\n    }\n    destroy() {\n        for (let { dom } of this.tooltipViews)\n            dom.remove();\n    }\n    readMeasure() {\n        return {\n            editor: this.view.dom.getBoundingClientRect(),\n            pos: this.tooltips.map(t => this.view.coordsAtPos(t.pos)),\n            size: this.tooltipViews.map(({ dom }) => dom.getBoundingClientRect()),\n            innerWidth: window.innerWidth,\n            innerHeight: window.innerHeight\n        };\n    }\n    writeMeasure(measured) {\n        let { editor } = measured;\n        for (let i = 0; i < this.tooltipViews.length; i++) {\n            let tooltip = this.tooltips[i], tView = this.tooltipViews[i], { dom } = tView;\n            let pos = measured.pos[i], size = measured.size[i];\n            // Hide tooltips that are outside of the editor.\n            if (!pos || pos.bottom <= editor.top || pos.top >= editor.bottom || pos.right <= editor.left || pos.left >= editor.right) {\n                dom.style.top = Outside;\n                continue;\n            }\n            let width = size.right - size.left, height = size.bottom - size.top;\n            let left = this.view.textDirection == Direction.LTR ? Math.min(pos.left, measured.innerWidth - width)\n                : Math.max(0, pos.left - width);\n            let above = !!tooltip.above;\n            if (!tooltip.strictSide &&\n                (above ? pos.top - (size.bottom - size.top) < 0 : pos.bottom + (size.bottom - size.top) > measured.innerHeight))\n                above = !above;\n            if (ios) {\n                dom.style.top = ((above ? pos.top - height : pos.bottom) - editor.top) + \"px\";\n                dom.style.left = (left - editor.left) + \"px\";\n                dom.style.position = \"absolute\";\n            }\n            else {\n                dom.style.top = (above ? pos.top - height : pos.bottom) + \"px\";\n                dom.style.left = left + \"px\";\n            }\n            dom.classList.toggle(\"cm-tooltip-above\", above);\n            dom.classList.toggle(\"cm-tooltip-below\", !above);\n            if (tView.positioned)\n                tView.positioned();\n        }\n    }\n    maybeMeasure() {\n        if (this.tooltips.length) {\n            if (this.view.inView || this.inView)\n                this.view.requestMeasure(this.measureReq);\n            this.inView = this.view.inView;\n        }\n    }\n}, {\n    eventHandlers: {\n        scroll() { this.maybeMeasure(); }\n    }\n});\nconst baseTheme = EditorView.baseTheme({\n    \".cm-tooltip\": {\n        position: \"fixed\",\n        zIndex: 100\n    },\n    \"&light .cm-tooltip\": {\n        border: \"1px solid #ddd\",\n        backgroundColor: \"#f5f5f5\"\n    },\n    \"&dark .cm-tooltip\": {\n        backgroundColor: \"#333338\",\n        color: \"white\"\n    }\n});\n// FIXME backward-compat shim. Delete on next major version.\n/**\n@internal\n*/\nfunction tooltips() {\n    return [];\n}\n/**\nBehavior by which an extension can provide a tooltip to be shown.\n*/\nconst showTooltip = Facet.define({\n    enables: [tooltipPlugin, baseTheme]\n});\nconst HoverTime = 750, HoverMaxDist = 6;\nclass HoverPlugin {\n    constructor(view, source, field, setHover) {\n        this.view = view;\n        this.source = source;\n        this.field = field;\n        this.setHover = setHover;\n        this.lastMouseMove = null;\n        this.hoverTimeout = -1;\n        this.restartTimeout = -1;\n        this.pending = null;\n        this.checkHover = this.checkHover.bind(this);\n        view.dom.addEventListener(\"mouseleave\", this.mouseleave = this.mouseleave.bind(this));\n        view.dom.addEventListener(\"mousemove\", this.mousemove = this.mousemove.bind(this));\n    }\n    update() {\n        if (this.pending) {\n            this.pending = null;\n            clearTimeout(this.restartTimeout);\n            this.restartTimeout = setTimeout(() => this.startHover(), 20);\n        }\n    }\n    get active() {\n        return this.view.state.field(this.field);\n    }\n    checkHover() {\n        this.hoverTimeout = -1;\n        if (this.active)\n            return;\n        let now = Date.now(), lastMove = this.lastMouseMove;\n        if (now - lastMove.timeStamp < HoverTime)\n            this.hoverTimeout = setTimeout(this.checkHover, HoverTime - (now - lastMove.timeStamp));\n        else\n            this.startHover();\n    }\n    startHover() {\n        var _a;\n        clearTimeout(this.restartTimeout);\n        let lastMove = this.lastMouseMove;\n        let coords = { x: lastMove.clientX, y: lastMove.clientY };\n        let pos = this.view.contentDOM.contains(lastMove.target)\n            ? this.view.posAtCoords(coords) : null;\n        if (pos == null)\n            return;\n        let posCoords = this.view.coordsAtPos(pos);\n        if (posCoords == null || coords.y < posCoords.top || coords.y > posCoords.bottom ||\n            coords.x < posCoords.left - this.view.defaultCharacterWidth ||\n            coords.x > posCoords.right + this.view.defaultCharacterWidth)\n            return;\n        let bidi = this.view.bidiSpans(this.view.state.doc.lineAt(pos)).find(s => s.from <= pos && s.to >= pos);\n        let rtl = bidi && bidi.dir == Direction.RTL ? -1 : 1;\n        let open = this.source(this.view, pos, (coords.x < posCoords.left ? -rtl : rtl));\n        if ((_a = open) === null || _a === void 0 ? void 0 : _a.then) {\n            let pending = this.pending = { pos };\n            open.then(result => {\n                if (this.pending == pending) {\n                    this.pending = null;\n                    if (result)\n                        this.view.dispatch({ effects: this.setHover.of(result) });\n                }\n            }, e => logException(this.view.state, e, \"hover tooltip\"));\n        }\n        else if (open) {\n            this.view.dispatch({ effects: this.setHover.of(open) });\n        }\n    }\n    mousemove(event) {\n        var _a;\n        this.lastMouseMove = event;\n        if (this.hoverTimeout < 0)\n            this.hoverTimeout = setTimeout(this.checkHover, HoverTime);\n        let tooltip = this.active;\n        if (tooltip && !isInTooltip(event.target) || this.pending) {\n            let { pos } = tooltip || this.pending, end = (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.end) !== null && _a !== void 0 ? _a : pos;\n            if ((pos == end ? this.view.posAtCoords({ x: event.clientX, y: event.clientY }) != pos\n                : !isOverRange(this.view, pos, end, event.clientX, event.clientY, HoverMaxDist))) {\n                this.view.dispatch({ effects: this.setHover.of(null) });\n                this.pending = null;\n            }\n        }\n    }\n    mouseleave() {\n        clearTimeout(this.hoverTimeout);\n        this.hoverTimeout = -1;\n        if (this.active)\n            this.view.dispatch({ effects: this.setHover.of(null) });\n    }\n    destroy() {\n        clearTimeout(this.hoverTimeout);\n        this.view.dom.removeEventListener(\"mouseleave\", this.mouseleave);\n        this.view.dom.removeEventListener(\"mousemove\", this.mousemove);\n    }\n}\nfunction isInTooltip(elt) {\n    for (let cur = elt; cur; cur = cur.parentNode)\n        if (cur.nodeType == 1 && cur.classList.contains(\"cm-tooltip\"))\n            return true;\n    return false;\n}\nfunction isOverRange(view, from, to, x, y, margin) {\n    let range = document.createRange();\n    let fromDOM = view.domAtPos(from), toDOM = view.domAtPos(to);\n    range.setEnd(toDOM.node, toDOM.offset);\n    range.setStart(fromDOM.node, fromDOM.offset);\n    let rects = range.getClientRects();\n    range.detach();\n    for (let i = 0; i < rects.length; i++) {\n        let rect = rects[i];\n        let dist = Math.max(rect.top - y, y - rect.bottom, rect.left - x, x - rect.right);\n        if (dist <= margin)\n            return true;\n    }\n    return false;\n}\n/**\nEnable a hover tooltip, which shows up when the pointer hovers\nover ranges of text. The callback is called when the mouse hovers\nover the document text. It should, if there is a tooltip\nassociated with position `pos` return the tooltip description\n(either directly or in a promise). The `side` argument indicates\non which side of the position the pointer is—it will be -1 if the\npointer is before the position, 1 if after the position.\n*/\nfunction hoverTooltip(source, options = {}) {\n    const setHover = StateEffect.define();\n    const hoverState = StateField.define({\n        create() { return null; },\n        update(value, tr) {\n            if (value && (options.hideOnChange && (tr.docChanged || tr.selection)))\n                return null;\n            for (let effect of tr.effects)\n                if (effect.is(setHover))\n                    return effect.value;\n            if (value && tr.docChanged) {\n                let newPos = tr.changes.mapPos(value.pos, -1, MapMode.TrackDel);\n                if (newPos == null)\n                    return null;\n                let copy = Object.assign(Object.create(null), value);\n                copy.pos = newPos;\n                if (value.end != null)\n                    copy.end = tr.changes.mapPos(value.end);\n                return copy;\n            }\n            return value;\n        },\n        provide: f => showTooltip.from(f)\n    });\n    return [\n        hoverState,\n        ViewPlugin.define(view => new HoverPlugin(view, source, hoverState, setHover))\n    ];\n}\n\nexport { hoverTooltip, showTooltip, tooltips };\n"],"names":[],"sourceRoot":""}