PageSourceSearch

https://cdn.infourok.ru/assets/ai/controllers/pages/ai/presentatio…resentation-outline-edit-tooltip-3930_qG.js

js infourok.ru collected 2026-09-24 08:51:35 UTC 6,402 bytes, 173 lines download raw bytes

1function _class_call_check(instance, Constructor) {
2    if (!(instance instanceof Constructor)) {
3        throw new TypeError("Cannot call a class as a function");
4    }
5}
6function _defineProperties(target, props) {
7    for(var i = 0; i < props.length; i++){
8        var descriptor = props[i];
9        descriptor.enumerable = descriptor.enumerable || false;
10        descriptor.configurable = true;
11        if ("value" in descriptor) descriptor.writable = true;
12        Object.defineProperty(target, descriptor.key, descriptor);
13    }
14}
15function _create_class(Constructor, protoProps, staticProps) {
16    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17    if (staticProps) _defineProperties(Constructor, staticProps);
18    return Constructor;
19}
20function _define_property(obj, key, value) {
21    if (key in obj) {
22        Object.defineProperty(obj, key, {
23            value: value,
24            enumerable: true,
25            configurable: true,
26            writable: true
27        });
28    } else {
29        obj[key] = value;
30    }
31    return obj;
32}
33import { computePosition, flip, offset, shift } from "@floating-ui/dom";
34export var PresentationOutlineEditTooltip = /*#__PURE__*/ function() {
35    "use strict";
36    function PresentationOutlineEditTooltip(reference, element) {
37        var _this = this;
38        _class_call_check(this, PresentationOutlineEditTooltip);
39        _define_property(this, "reference", void 0);
40        _define_property(this, "element", void 0);
41        _define_property(this, "pointerReference", void 0);
42        _define_property(this, "pointerX", void 0);
43        _define_property(this, "pointerY", void 0);
44        _define_property(this, "isOpen", void 0);
45        _define_property(this, "onEnter", void 0);
46        _define_property(this, "onLeave", void 0);
47        _define_property(this, "onMove", void 0);
48        _define_property(this, "onPointerDown", void 0);
49        _define_property(this, "onScroll", void 0);
50        this.reference = reference;
51        this.element = element;
52        this.pointerX = 0;
53        this.pointerY = 0;
54        this.isOpen = false;
55        this.onEnter = function(event) {
56            if (!_this.canShow()) return;
57            _this.setPointerPosition(event);
58            _this.show();
59        };
60        this.onLeave = function() {
61            _this.hide();
62        };
63        this.onMove = function(event) {
64            if (!_this.canShow()) {
65                _this.hide();
66                return;
67            }
68            _this.setPointerPosition(event);
69            if (_this.isOpen) {
70                _this.updatePosition();
71            } else {
72                _this.show();
73            }
74        };
75        this.onPointerDown = function() {
76            _this.hide();
77        };
78        this.onScroll = function() {
79            _this.hide();
80        };
81        this.pointerReference = {
82            contextElement: reference,
83            getBoundingClientRect: function() {
84                return new DOMRect(_this.pointerX, _this.pointerY);
85            }
86        };
87        this.element.setAttribute("role", "tooltip");
88        this.element.hidden = true;
89        document.body.appendChild(this.element);
90        this.reference.addEventListener("mouseenter", this.onEnter);
91        this.reference.addEventListener("mouseleave", this.onLeave);
92        this.reference.addEventListener("mousemove", this.onMove);
93        this.reference.addEventListener("pointerdown", this.onPointerDown);
94    }
95    _create_class(PresentationOutlineEditTooltip, [
96        {
97            key: "hide",
98            value: function hide() {
99                if (!this.isOpen) return;
100                this.isOpen = false;
101                this.element.hidden = true;
102                document.removeEventListener("scroll", this.onScroll, true);
103                window.removeEventListener("wheel", this.onScroll);
104            }
105        },
106        {
107            key: "destroy",
108            value: function destroy() {
109                this.hide();
110                this.reference.removeEventListener("mouseenter", this.onEnter);
111                this.reference.removeEventListener("mouseleave", this.onLeave);
112                this.reference.removeEventListener("mousemove", this.onMove);
113                this.reference.removeEventListener("pointerdown", this.onPointerDown);
114                this.element.remove();
115            }
116        },
117        {
118            key: "canShow",
119            value: function canShow() {
120                return window.matchMedia("(hover: hover)").matches && this.reference.getAttribute("contenteditable") === "plaintext-only" && document.activeElement !== this.reference;
121            }
122        },
123        {
124            key: "show",
125            value: function show() {
126                if (this.isOpen) return;
127                this.isOpen = true;
128                Object.assign(this.element.style, {
129                    position: "fixed",
130                    top: "-9999px",
131                    left: "0px"
132                });
133                this.element.hidden = false;
134                this.updatePosition();
135                document.addEventListener("scroll", this.onScroll, true);
136                window.addEventListener("wheel", this.onScroll, {
137                    passive: true
138                });
139            }
140        },
141        {
142            key: "setPointerPosition",
143            value: function setPointerPosition(event) {
144                this.pointerX = event.clientX;
145                this.pointerY = event.clientY;
146            }
147        },
148        {
149            key: "updatePosition",
150            value: function updatePosition() {
151                var _this = this;
152                computePosition(this.pointerReference, this.element, {
153                    placement: "top",
154                    strategy: "fixed",
155                    middleware: [
156                        offset(8),
157                        flip(),
158                        shift({
159                            padding: 8
160                        })
161                    ]
162                }).then(function(param) {
163                    var x = param.x, y = param.y;
164                    Object.assign(_this.element.style, {
165                        left: "".concat(x, "px"),
166                        top: "".concat(y, "px")
167                    });
168                });
169            }
170        }
171    ]);
172    return PresentationOutlineEditTooltip;
173}();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.