webmarker-js 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1,308 +1,1055 @@
1
- var $8zHUo$floatinguidom = require("@floating-ui/dom");
1
+ var WebMarker = (() => {
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __export = (target, all) => {
24
+ for (var name in all)
25
+ __defProp(target, name, { get: all[name], enumerable: true });
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+ var __async = (__this, __arguments, generator) => {
37
+ return new Promise((resolve, reject) => {
38
+ var fulfilled = (value) => {
39
+ try {
40
+ step(generator.next(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ };
45
+ var rejected = (value) => {
46
+ try {
47
+ step(generator.throw(value));
48
+ } catch (e) {
49
+ reject(e);
50
+ }
51
+ };
52
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
53
+ step((generator = generator.apply(__this, __arguments)).next());
54
+ });
55
+ };
2
56
 
57
+ // src/index.ts
58
+ var src_exports = {};
59
+ __export(src_exports, {
60
+ isMarked: () => isMarked,
61
+ mark: () => mark,
62
+ unmark: () => unmark
63
+ });
3
64
 
4
- function $parcel$export(e, n, v, s) {
5
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
- }
65
+ // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
66
+ var min = Math.min;
67
+ var max = Math.max;
68
+ var round = Math.round;
69
+ var floor = Math.floor;
70
+ var createCoords = (v) => ({
71
+ x: v,
72
+ y: v
73
+ });
74
+ function getSide(placement) {
75
+ return placement.split("-")[0];
76
+ }
77
+ function getAlignment(placement) {
78
+ return placement.split("-")[1];
79
+ }
80
+ function getOppositeAxis(axis) {
81
+ return axis === "x" ? "y" : "x";
82
+ }
83
+ function getAxisLength(axis) {
84
+ return axis === "y" ? "height" : "width";
85
+ }
86
+ function getSideAxis(placement) {
87
+ return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
88
+ }
89
+ function getAlignmentAxis(placement) {
90
+ return getOppositeAxis(getSideAxis(placement));
91
+ }
92
+ function rectToClientRect(rect) {
93
+ const {
94
+ x,
95
+ y,
96
+ width,
97
+ height
98
+ } = rect;
99
+ return {
100
+ width,
101
+ height,
102
+ top: y,
103
+ left: x,
104
+ right: x + width,
105
+ bottom: y + height,
106
+ x,
107
+ y
108
+ };
109
+ }
7
110
 
8
- $parcel$export(module.exports, "mark", () => $fd046e7a82b9f872$export$bf7f2fce5c1cf636);
9
- $parcel$export(module.exports, "unmark", () => $fd046e7a82b9f872$export$3522532a010241a0);
10
- $parcel$export(module.exports, "isMarked", () => $fd046e7a82b9f872$export$3b489baf08eae67a);
111
+ // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
112
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
113
+ let {
114
+ reference,
115
+ floating
116
+ } = _ref;
117
+ const sideAxis = getSideAxis(placement);
118
+ const alignmentAxis = getAlignmentAxis(placement);
119
+ const alignLength = getAxisLength(alignmentAxis);
120
+ const side = getSide(placement);
121
+ const isVertical = sideAxis === "y";
122
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
123
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
124
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
125
+ let coords;
126
+ switch (side) {
127
+ case "top":
128
+ coords = {
129
+ x: commonX,
130
+ y: reference.y - floating.height
131
+ };
132
+ break;
133
+ case "bottom":
134
+ coords = {
135
+ x: commonX,
136
+ y: reference.y + reference.height
137
+ };
138
+ break;
139
+ case "right":
140
+ coords = {
141
+ x: reference.x + reference.width,
142
+ y: commonY
143
+ };
144
+ break;
145
+ case "left":
146
+ coords = {
147
+ x: reference.x - floating.width,
148
+ y: commonY
149
+ };
150
+ break;
151
+ default:
152
+ coords = {
153
+ x: reference.x,
154
+ y: reference.y
155
+ };
156
+ }
157
+ switch (getAlignment(placement)) {
158
+ case "start":
159
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
160
+ break;
161
+ case "end":
162
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
163
+ break;
164
+ }
165
+ return coords;
166
+ }
167
+ var computePosition = (reference, floating, config) => __async(void 0, null, function* () {
168
+ const {
169
+ placement = "bottom",
170
+ strategy = "absolute",
171
+ middleware = [],
172
+ platform: platform2
173
+ } = config;
174
+ const validMiddleware = middleware.filter(Boolean);
175
+ const rtl = yield platform2.isRTL == null ? void 0 : platform2.isRTL(floating);
176
+ let rects = yield platform2.getElementRects({
177
+ reference,
178
+ floating,
179
+ strategy
180
+ });
181
+ let {
182
+ x,
183
+ y
184
+ } = computeCoordsFromPlacement(rects, placement, rtl);
185
+ let statefulPlacement = placement;
186
+ let middlewareData = {};
187
+ let resetCount = 0;
188
+ for (let i = 0; i < validMiddleware.length; i++) {
189
+ const {
190
+ name,
191
+ fn
192
+ } = validMiddleware[i];
193
+ const {
194
+ x: nextX,
195
+ y: nextY,
196
+ data,
197
+ reset
198
+ } = yield fn({
199
+ x,
200
+ y,
201
+ initialPlacement: placement,
202
+ placement: statefulPlacement,
203
+ strategy,
204
+ middlewareData,
205
+ rects,
206
+ platform: platform2,
207
+ elements: {
208
+ reference,
209
+ floating
210
+ }
211
+ });
212
+ x = nextX != null ? nextX : x;
213
+ y = nextY != null ? nextY : y;
214
+ middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
215
+ [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
216
+ });
217
+ if (reset && resetCount <= 50) {
218
+ resetCount++;
219
+ if (typeof reset === "object") {
220
+ if (reset.placement) {
221
+ statefulPlacement = reset.placement;
222
+ }
223
+ if (reset.rects) {
224
+ rects = reset.rects === true ? yield platform2.getElementRects({
225
+ reference,
226
+ floating,
227
+ strategy
228
+ }) : reset.rects;
229
+ }
230
+ ({
231
+ x,
232
+ y
233
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
234
+ }
235
+ i = -1;
236
+ }
237
+ }
238
+ return {
239
+ x,
240
+ y,
241
+ placement: statefulPlacement,
242
+ strategy,
243
+ middlewareData
244
+ };
245
+ });
11
246
 
12
- var $fd046e7a82b9f872$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
13
- function adopt(value) {
14
- return value instanceof P ? value : new P(function(resolve) {
15
- resolve(value);
16
- });
247
+ // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
248
+ function getNodeName(node) {
249
+ if (isNode(node)) {
250
+ return (node.nodeName || "").toLowerCase();
251
+ }
252
+ return "#document";
253
+ }
254
+ function getWindow(node) {
255
+ var _node$ownerDocument;
256
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
257
+ }
258
+ function getDocumentElement(node) {
259
+ var _ref;
260
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
261
+ }
262
+ function isNode(value) {
263
+ return value instanceof Node || value instanceof getWindow(value).Node;
264
+ }
265
+ function isElement(value) {
266
+ return value instanceof Element || value instanceof getWindow(value).Element;
267
+ }
268
+ function isHTMLElement(value) {
269
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
270
+ }
271
+ function isShadowRoot(value) {
272
+ if (typeof ShadowRoot === "undefined") {
273
+ return false;
274
+ }
275
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
276
+ }
277
+ function isOverflowElement(element) {
278
+ const {
279
+ overflow,
280
+ overflowX,
281
+ overflowY,
282
+ display
283
+ } = getComputedStyle(element);
284
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
285
+ }
286
+ function isTableElement(element) {
287
+ return ["table", "td", "th"].includes(getNodeName(element));
288
+ }
289
+ function isContainingBlock(element) {
290
+ const webkit = isWebKit();
291
+ const css = getComputedStyle(element);
292
+ return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
293
+ }
294
+ function getContainingBlock(element) {
295
+ let currentNode = getParentNode(element);
296
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
297
+ if (isContainingBlock(currentNode)) {
298
+ return currentNode;
299
+ }
300
+ currentNode = getParentNode(currentNode);
17
301
  }
18
- return new (P || (P = Promise))(function(resolve, reject) {
19
- function fulfilled(value) {
20
- try {
21
- step(generator.next(value));
22
- } catch (e) {
23
- reject(e);
24
- }
302
+ return null;
303
+ }
304
+ function isWebKit() {
305
+ if (typeof CSS === "undefined" || !CSS.supports) return false;
306
+ return CSS.supports("-webkit-backdrop-filter", "none");
307
+ }
308
+ function isLastTraversableNode(node) {
309
+ return ["html", "body", "#document"].includes(getNodeName(node));
310
+ }
311
+ function getComputedStyle(element) {
312
+ return getWindow(element).getComputedStyle(element);
313
+ }
314
+ function getNodeScroll(element) {
315
+ if (isElement(element)) {
316
+ return {
317
+ scrollLeft: element.scrollLeft,
318
+ scrollTop: element.scrollTop
319
+ };
320
+ }
321
+ return {
322
+ scrollLeft: element.pageXOffset,
323
+ scrollTop: element.pageYOffset
324
+ };
325
+ }
326
+ function getParentNode(node) {
327
+ if (getNodeName(node) === "html") {
328
+ return node;
329
+ }
330
+ const result = (
331
+ // Step into the shadow DOM of the parent of a slotted node.
332
+ node.assignedSlot || // DOM Element detected.
333
+ node.parentNode || // ShadowRoot detected.
334
+ isShadowRoot(node) && node.host || // Fallback.
335
+ getDocumentElement(node)
336
+ );
337
+ return isShadowRoot(result) ? result.host : result;
338
+ }
339
+ function getNearestOverflowAncestor(node) {
340
+ const parentNode = getParentNode(node);
341
+ if (isLastTraversableNode(parentNode)) {
342
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
343
+ }
344
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
345
+ return parentNode;
346
+ }
347
+ return getNearestOverflowAncestor(parentNode);
348
+ }
349
+ function getOverflowAncestors(node, list, traverseIframes) {
350
+ var _node$ownerDocument2;
351
+ if (list === void 0) {
352
+ list = [];
353
+ }
354
+ if (traverseIframes === void 0) {
355
+ traverseIframes = true;
356
+ }
357
+ const scrollableAncestor = getNearestOverflowAncestor(node);
358
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
359
+ const win = getWindow(scrollableAncestor);
360
+ if (isBody) {
361
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
362
+ }
363
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
364
+ }
365
+
366
+ // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
367
+ function getCssDimensions(element) {
368
+ const css = getComputedStyle(element);
369
+ let width = parseFloat(css.width) || 0;
370
+ let height = parseFloat(css.height) || 0;
371
+ const hasOffset = isHTMLElement(element);
372
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
373
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
374
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
375
+ if (shouldFallback) {
376
+ width = offsetWidth;
377
+ height = offsetHeight;
378
+ }
379
+ return {
380
+ width,
381
+ height,
382
+ $: shouldFallback
383
+ };
384
+ }
385
+ function unwrapElement(element) {
386
+ return !isElement(element) ? element.contextElement : element;
387
+ }
388
+ function getScale(element) {
389
+ const domElement = unwrapElement(element);
390
+ if (!isHTMLElement(domElement)) {
391
+ return createCoords(1);
392
+ }
393
+ const rect = domElement.getBoundingClientRect();
394
+ const {
395
+ width,
396
+ height,
397
+ $
398
+ } = getCssDimensions(domElement);
399
+ let x = ($ ? round(rect.width) : rect.width) / width;
400
+ let y = ($ ? round(rect.height) : rect.height) / height;
401
+ if (!x || !Number.isFinite(x)) {
402
+ x = 1;
403
+ }
404
+ if (!y || !Number.isFinite(y)) {
405
+ y = 1;
406
+ }
407
+ return {
408
+ x,
409
+ y
410
+ };
411
+ }
412
+ var noOffsets = /* @__PURE__ */ createCoords(0);
413
+ function getVisualOffsets(element) {
414
+ const win = getWindow(element);
415
+ if (!isWebKit() || !win.visualViewport) {
416
+ return noOffsets;
417
+ }
418
+ return {
419
+ x: win.visualViewport.offsetLeft,
420
+ y: win.visualViewport.offsetTop
421
+ };
422
+ }
423
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
424
+ if (isFixed === void 0) {
425
+ isFixed = false;
426
+ }
427
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
428
+ return false;
429
+ }
430
+ return isFixed;
431
+ }
432
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
433
+ if (includeScale === void 0) {
434
+ includeScale = false;
435
+ }
436
+ if (isFixedStrategy === void 0) {
437
+ isFixedStrategy = false;
438
+ }
439
+ const clientRect = element.getBoundingClientRect();
440
+ const domElement = unwrapElement(element);
441
+ let scale = createCoords(1);
442
+ if (includeScale) {
443
+ if (offsetParent) {
444
+ if (isElement(offsetParent)) {
445
+ scale = getScale(offsetParent);
25
446
  }
26
- function rejected(value) {
27
- try {
28
- step(generator["throw"](value));
29
- } catch (e) {
30
- reject(e);
31
- }
447
+ } else {
448
+ scale = getScale(element);
449
+ }
450
+ }
451
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
452
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
453
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
454
+ let width = clientRect.width / scale.x;
455
+ let height = clientRect.height / scale.y;
456
+ if (domElement) {
457
+ const win = getWindow(domElement);
458
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
459
+ let currentWin = win;
460
+ let currentIFrame = currentWin.frameElement;
461
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
462
+ const iframeScale = getScale(currentIFrame);
463
+ const iframeRect = currentIFrame.getBoundingClientRect();
464
+ const css = getComputedStyle(currentIFrame);
465
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
466
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
467
+ x *= iframeScale.x;
468
+ y *= iframeScale.y;
469
+ width *= iframeScale.x;
470
+ height *= iframeScale.y;
471
+ x += left;
472
+ y += top;
473
+ currentWin = getWindow(currentIFrame);
474
+ currentIFrame = currentWin.frameElement;
475
+ }
476
+ }
477
+ return rectToClientRect({
478
+ width,
479
+ height,
480
+ x,
481
+ y
482
+ });
483
+ }
484
+ var topLayerSelectors = [":popover-open", ":modal"];
485
+ function isTopLayer(element) {
486
+ return topLayerSelectors.some((selector) => {
487
+ try {
488
+ return element.matches(selector);
489
+ } catch (e) {
490
+ return false;
491
+ }
492
+ });
493
+ }
494
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
495
+ let {
496
+ elements,
497
+ rect,
498
+ offsetParent,
499
+ strategy
500
+ } = _ref;
501
+ const isFixed = strategy === "fixed";
502
+ const documentElement = getDocumentElement(offsetParent);
503
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
504
+ if (offsetParent === documentElement || topLayer && isFixed) {
505
+ return rect;
506
+ }
507
+ let scroll = {
508
+ scrollLeft: 0,
509
+ scrollTop: 0
510
+ };
511
+ let scale = createCoords(1);
512
+ const offsets = createCoords(0);
513
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
514
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
515
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
516
+ scroll = getNodeScroll(offsetParent);
517
+ }
518
+ if (isHTMLElement(offsetParent)) {
519
+ const offsetRect = getBoundingClientRect(offsetParent);
520
+ scale = getScale(offsetParent);
521
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
522
+ offsets.y = offsetRect.y + offsetParent.clientTop;
523
+ }
524
+ }
525
+ return {
526
+ width: rect.width * scale.x,
527
+ height: rect.height * scale.y,
528
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
529
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
530
+ };
531
+ }
532
+ function getClientRects(element) {
533
+ return Array.from(element.getClientRects());
534
+ }
535
+ function getWindowScrollBarX(element) {
536
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
537
+ }
538
+ function getDocumentRect(element) {
539
+ const html = getDocumentElement(element);
540
+ const scroll = getNodeScroll(element);
541
+ const body = element.ownerDocument.body;
542
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
543
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
544
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
545
+ const y = -scroll.scrollTop;
546
+ if (getComputedStyle(body).direction === "rtl") {
547
+ x += max(html.clientWidth, body.clientWidth) - width;
548
+ }
549
+ return {
550
+ width,
551
+ height,
552
+ x,
553
+ y
554
+ };
555
+ }
556
+ function getViewportRect(element, strategy) {
557
+ const win = getWindow(element);
558
+ const html = getDocumentElement(element);
559
+ const visualViewport = win.visualViewport;
560
+ let width = html.clientWidth;
561
+ let height = html.clientHeight;
562
+ let x = 0;
563
+ let y = 0;
564
+ if (visualViewport) {
565
+ width = visualViewport.width;
566
+ height = visualViewport.height;
567
+ const visualViewportBased = isWebKit();
568
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
569
+ x = visualViewport.offsetLeft;
570
+ y = visualViewport.offsetTop;
571
+ }
572
+ }
573
+ return {
574
+ width,
575
+ height,
576
+ x,
577
+ y
578
+ };
579
+ }
580
+ function getInnerBoundingClientRect(element, strategy) {
581
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
582
+ const top = clientRect.top + element.clientTop;
583
+ const left = clientRect.left + element.clientLeft;
584
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
585
+ const width = element.clientWidth * scale.x;
586
+ const height = element.clientHeight * scale.y;
587
+ const x = left * scale.x;
588
+ const y = top * scale.y;
589
+ return {
590
+ width,
591
+ height,
592
+ x,
593
+ y
594
+ };
595
+ }
596
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
597
+ let rect;
598
+ if (clippingAncestor === "viewport") {
599
+ rect = getViewportRect(element, strategy);
600
+ } else if (clippingAncestor === "document") {
601
+ rect = getDocumentRect(getDocumentElement(element));
602
+ } else if (isElement(clippingAncestor)) {
603
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
604
+ } else {
605
+ const visualOffsets = getVisualOffsets(element);
606
+ rect = __spreadProps(__spreadValues({}, clippingAncestor), {
607
+ x: clippingAncestor.x - visualOffsets.x,
608
+ y: clippingAncestor.y - visualOffsets.y
609
+ });
610
+ }
611
+ return rectToClientRect(rect);
612
+ }
613
+ function hasFixedPositionAncestor(element, stopNode) {
614
+ const parentNode = getParentNode(element);
615
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
616
+ return false;
617
+ }
618
+ return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
619
+ }
620
+ function getClippingElementAncestors(element, cache) {
621
+ const cachedResult = cache.get(element);
622
+ if (cachedResult) {
623
+ return cachedResult;
624
+ }
625
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
626
+ let currentContainingBlockComputedStyle = null;
627
+ const elementIsFixed = getComputedStyle(element).position === "fixed";
628
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
629
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
630
+ const computedStyle = getComputedStyle(currentNode);
631
+ const currentNodeIsContaining = isContainingBlock(currentNode);
632
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
633
+ currentContainingBlockComputedStyle = null;
634
+ }
635
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
636
+ if (shouldDropCurrentNode) {
637
+ result = result.filter((ancestor) => ancestor !== currentNode);
638
+ } else {
639
+ currentContainingBlockComputedStyle = computedStyle;
640
+ }
641
+ currentNode = getParentNode(currentNode);
642
+ }
643
+ cache.set(element, result);
644
+ return result;
645
+ }
646
+ function getClippingRect(_ref) {
647
+ let {
648
+ element,
649
+ boundary,
650
+ rootBoundary,
651
+ strategy
652
+ } = _ref;
653
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
654
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
655
+ const firstClippingAncestor = clippingAncestors[0];
656
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
657
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
658
+ accRect.top = max(rect.top, accRect.top);
659
+ accRect.right = min(rect.right, accRect.right);
660
+ accRect.bottom = min(rect.bottom, accRect.bottom);
661
+ accRect.left = max(rect.left, accRect.left);
662
+ return accRect;
663
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
664
+ return {
665
+ width: clippingRect.right - clippingRect.left,
666
+ height: clippingRect.bottom - clippingRect.top,
667
+ x: clippingRect.left,
668
+ y: clippingRect.top
669
+ };
670
+ }
671
+ function getDimensions(element) {
672
+ const {
673
+ width,
674
+ height
675
+ } = getCssDimensions(element);
676
+ return {
677
+ width,
678
+ height
679
+ };
680
+ }
681
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
682
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
683
+ const documentElement = getDocumentElement(offsetParent);
684
+ const isFixed = strategy === "fixed";
685
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
686
+ let scroll = {
687
+ scrollLeft: 0,
688
+ scrollTop: 0
689
+ };
690
+ const offsets = createCoords(0);
691
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
692
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
693
+ scroll = getNodeScroll(offsetParent);
694
+ }
695
+ if (isOffsetParentAnElement) {
696
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
697
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
698
+ offsets.y = offsetRect.y + offsetParent.clientTop;
699
+ } else if (documentElement) {
700
+ offsets.x = getWindowScrollBarX(documentElement);
701
+ }
702
+ }
703
+ const x = rect.left + scroll.scrollLeft - offsets.x;
704
+ const y = rect.top + scroll.scrollTop - offsets.y;
705
+ return {
706
+ x,
707
+ y,
708
+ width: rect.width,
709
+ height: rect.height
710
+ };
711
+ }
712
+ function isStaticPositioned(element) {
713
+ return getComputedStyle(element).position === "static";
714
+ }
715
+ function getTrueOffsetParent(element, polyfill) {
716
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
717
+ return null;
718
+ }
719
+ if (polyfill) {
720
+ return polyfill(element);
721
+ }
722
+ return element.offsetParent;
723
+ }
724
+ function getOffsetParent(element, polyfill) {
725
+ const win = getWindow(element);
726
+ if (isTopLayer(element)) {
727
+ return win;
728
+ }
729
+ if (!isHTMLElement(element)) {
730
+ let svgOffsetParent = getParentNode(element);
731
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
732
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
733
+ return svgOffsetParent;
32
734
  }
33
- function step(result) {
34
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
735
+ svgOffsetParent = getParentNode(svgOffsetParent);
736
+ }
737
+ return win;
738
+ }
739
+ let offsetParent = getTrueOffsetParent(element, polyfill);
740
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
741
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
742
+ }
743
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
744
+ return win;
745
+ }
746
+ return offsetParent || getContainingBlock(element) || win;
747
+ }
748
+ var getElementRects = function(data) {
749
+ return __async(this, null, function* () {
750
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
751
+ const getDimensionsFn = this.getDimensions;
752
+ const floatingDimensions = yield getDimensionsFn(data.floating);
753
+ return {
754
+ reference: getRectRelativeToOffsetParent(data.reference, yield getOffsetParentFn(data.floating), data.strategy),
755
+ floating: {
756
+ x: 0,
757
+ y: 0,
758
+ width: floatingDimensions.width,
759
+ height: floatingDimensions.height
35
760
  }
36
- step((generator = generator.apply(thisArg, _arguments || [])).next());
761
+ };
37
762
  });
38
- };
39
- var $fd046e7a82b9f872$var$__generator = undefined && undefined.__generator || function(thisArg, body) {
40
- var _ = {
41
- label: 0,
42
- sent: function() {
43
- if (t[0] & 1) throw t[1];
44
- return t[1];
45
- },
46
- trys: [],
47
- ops: []
48
- }, f, y, t, g;
49
- return g = {
50
- next: verb(0),
51
- "throw": verb(1),
52
- "return": verb(2)
53
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
54
- return this;
55
- }), g;
56
- function verb(n) {
57
- return function(v) {
58
- return step([
59
- n,
60
- v
61
- ]);
62
- };
763
+ };
764
+ function isRTL(element) {
765
+ return getComputedStyle(element).direction === "rtl";
766
+ }
767
+ var platform = {
768
+ convertOffsetParentRelativeRectToViewportRelativeRect,
769
+ getDocumentElement,
770
+ getClippingRect,
771
+ getOffsetParent,
772
+ getElementRects,
773
+ getClientRects,
774
+ getDimensions,
775
+ getScale,
776
+ isElement,
777
+ isRTL
778
+ };
779
+ function observeMove(element, onMove) {
780
+ let io = null;
781
+ let timeoutId;
782
+ const root = getDocumentElement(element);
783
+ function cleanup() {
784
+ var _io;
785
+ clearTimeout(timeoutId);
786
+ (_io = io) == null || _io.disconnect();
787
+ io = null;
63
788
  }
64
- function step(op) {
65
- if (f) throw new TypeError("Generator is already executing.");
66
- while(g && (g = 0, op[0] && (_ = 0)), _)try {
67
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
68
- if (y = 0, t) op = [
69
- op[0] & 2,
70
- t.value
71
- ];
72
- switch(op[0]){
73
- case 0:
74
- case 1:
75
- t = op;
76
- break;
77
- case 4:
78
- _.label++;
79
- return {
80
- value: op[1],
81
- done: false
82
- };
83
- case 5:
84
- _.label++;
85
- y = op[1];
86
- op = [
87
- 0
88
- ];
89
- continue;
90
- case 7:
91
- op = _.ops.pop();
92
- _.trys.pop();
93
- continue;
94
- default:
95
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
96
- _ = 0;
97
- continue;
98
- }
99
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
100
- _.label = op[1];
101
- break;
102
- }
103
- if (op[0] === 6 && _.label < t[1]) {
104
- _.label = t[1];
105
- t = op;
106
- break;
107
- }
108
- if (t && _.label < t[2]) {
109
- _.label = t[2];
110
- _.ops.push(op);
111
- break;
112
- }
113
- if (t[2]) _.ops.pop();
114
- _.trys.pop();
115
- continue;
116
- }
117
- op = body.call(thisArg, _);
118
- } catch (e) {
119
- op = [
120
- 6,
121
- e
122
- ];
123
- y = 0;
124
- } finally{
125
- f = t = 0;
789
+ function refresh(skip, threshold) {
790
+ if (skip === void 0) {
791
+ skip = false;
792
+ }
793
+ if (threshold === void 0) {
794
+ threshold = 1;
795
+ }
796
+ cleanup();
797
+ const {
798
+ left,
799
+ top,
800
+ width,
801
+ height
802
+ } = element.getBoundingClientRect();
803
+ if (!skip) {
804
+ onMove();
805
+ }
806
+ if (!width || !height) {
807
+ return;
808
+ }
809
+ const insetTop = floor(top);
810
+ const insetRight = floor(root.clientWidth - (left + width));
811
+ const insetBottom = floor(root.clientHeight - (top + height));
812
+ const insetLeft = floor(left);
813
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
814
+ const options = {
815
+ rootMargin,
816
+ threshold: max(0, min(1, threshold)) || 1
817
+ };
818
+ let isFirstUpdate = true;
819
+ function handleObserve(entries) {
820
+ const ratio = entries[0].intersectionRatio;
821
+ if (ratio !== threshold) {
822
+ if (!isFirstUpdate) {
823
+ return refresh();
824
+ }
825
+ if (!ratio) {
826
+ timeoutId = setTimeout(() => {
827
+ refresh(false, 1e-7);
828
+ }, 1e3);
829
+ } else {
830
+ refresh(false, ratio);
831
+ }
126
832
  }
127
- if (op[0] & 5) throw op[1];
128
- return {
129
- value: op[0] ? op[1] : void 0,
130
- done: true
131
- };
833
+ isFirstUpdate = false;
834
+ }
835
+ try {
836
+ io = new IntersectionObserver(handleObserve, __spreadProps(__spreadValues({}, options), {
837
+ // Handle <iframe>s
838
+ root: root.ownerDocument
839
+ }));
840
+ } catch (e) {
841
+ io = new IntersectionObserver(handleObserve, options);
842
+ }
843
+ io.observe(element);
132
844
  }
133
- };
134
- var $fd046e7a82b9f872$var$cleanupFns = [];
135
- function $fd046e7a82b9f872$export$bf7f2fce5c1cf636() {
136
- return $fd046e7a82b9f872$var$__awaiter(this, arguments, Promise, function(options) {
137
- var _a, selector, _b, markStyle, _c, markPlacement, _d, maskStyle, _e, showMasks, _f, labelGenerator, _g, containerElement, _h, viewPortOnly, elements, markedElements;
138
- var _this = this;
139
- if (options === void 0) options = {};
140
- return $fd046e7a82b9f872$var$__generator(this, function(_j) {
141
- switch(_j.label){
142
- case 0:
143
- _a = options.selector, selector = _a === void 0 ? "button, input, a, select, textarea" : _a, _b = options.markStyle, markStyle = _b === void 0 ? {
144
- backgroundColor: "red",
145
- color: "white",
146
- padding: "2px 4px",
147
- fontSize: "12px",
148
- fontWeight: "bold"
149
- } : _b, _c = options.markPlacement, markPlacement = _c === void 0 ? "top-start" : _c, _d = options.maskStyle, maskStyle = _d === void 0 ? {
150
- outline: "2px dashed red",
151
- backgroundColor: "transparent"
152
- } : _d, _e = options.showMasks, showMasks = _e === void 0 ? true : _e, _f = options.labelGenerator, labelGenerator = _f === void 0 ? function(_, index) {
153
- return index.toString();
154
- } : _f, _g = options.containerElement, containerElement = _g === void 0 ? document.body : _g, _h = options.viewPortOnly, viewPortOnly = _h === void 0 ? false : _h;
155
- elements = Array.from(containerElement.querySelectorAll(selector)).filter(function(el) {
156
- return !viewPortOnly || el.getBoundingClientRect().top < window.innerHeight;
157
- });
158
- markedElements = new Map();
159
- return [
160
- 4 /*yield*/ ,
161
- Promise.all(elements.map(function(element, index) {
162
- return $fd046e7a82b9f872$var$__awaiter(_this, void 0, void 0, function() {
163
- var label, markElement, maskElement;
164
- return $fd046e7a82b9f872$var$__generator(this, function(_a) {
165
- label = labelGenerator(element, index);
166
- markElement = $fd046e7a82b9f872$var$createMark(element, markStyle, label, markPlacement);
167
- maskElement = showMasks ? $fd046e7a82b9f872$var$createMask(element, maskStyle, label) : undefined;
168
- markedElements.set(label, {
169
- element: element,
170
- markElement: markElement,
171
- maskElement: maskElement
172
- });
173
- element.setAttribute("data-webmarkeredby", "webmarker-".concat(label));
174
- return [
175
- 2 /*return*/
176
- ];
177
- });
178
- });
179
- }))
180
- ];
181
- case 1:
182
- _j.sent();
183
- document.documentElement.dataset.webmarkered = "true";
184
- return [
185
- 2 /*return*/ ,
186
- markedElements
187
- ];
188
- }
189
- });
845
+ refresh(true);
846
+ return cleanup;
847
+ }
848
+ function autoUpdate(reference, floating, update, options) {
849
+ if (options === void 0) {
850
+ options = {};
851
+ }
852
+ const {
853
+ ancestorScroll = true,
854
+ ancestorResize = true,
855
+ elementResize = typeof ResizeObserver === "function",
856
+ layoutShift = typeof IntersectionObserver === "function",
857
+ animationFrame = false
858
+ } = options;
859
+ const referenceEl = unwrapElement(reference);
860
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
861
+ ancestors.forEach((ancestor) => {
862
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
863
+ passive: true
864
+ });
865
+ ancestorResize && ancestor.addEventListener("resize", update);
866
+ });
867
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
868
+ let reobserveFrame = -1;
869
+ let resizeObserver = null;
870
+ if (elementResize) {
871
+ resizeObserver = new ResizeObserver((_ref) => {
872
+ let [firstEntry] = _ref;
873
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
874
+ resizeObserver.unobserve(floating);
875
+ cancelAnimationFrame(reobserveFrame);
876
+ reobserveFrame = requestAnimationFrame(() => {
877
+ var _resizeObserver;
878
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
879
+ });
880
+ }
881
+ update();
882
+ });
883
+ if (referenceEl && !animationFrame) {
884
+ resizeObserver.observe(referenceEl);
885
+ }
886
+ resizeObserver.observe(floating);
887
+ }
888
+ let frameId;
889
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
890
+ if (animationFrame) {
891
+ frameLoop();
892
+ }
893
+ function frameLoop() {
894
+ const nextRefRect = getBoundingClientRect(reference);
895
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
896
+ update();
897
+ }
898
+ prevRefRect = nextRefRect;
899
+ frameId = requestAnimationFrame(frameLoop);
900
+ }
901
+ update();
902
+ return () => {
903
+ var _resizeObserver2;
904
+ ancestors.forEach((ancestor) => {
905
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
906
+ ancestorResize && ancestor.removeEventListener("resize", update);
907
+ });
908
+ cleanupIo == null || cleanupIo();
909
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
910
+ resizeObserver = null;
911
+ if (animationFrame) {
912
+ cancelAnimationFrame(frameId);
913
+ }
914
+ };
915
+ }
916
+ var computePosition2 = (reference, floating, options) => {
917
+ const cache = /* @__PURE__ */ new Map();
918
+ const mergedOptions = __spreadValues({
919
+ platform
920
+ }, options);
921
+ const platformWithCache = __spreadProps(__spreadValues({}, mergedOptions.platform), {
922
+ _c: cache
190
923
  });
191
- }
192
- function $fd046e7a82b9f872$var$createMark(element, style, label, markPlacement) {
193
- if (markPlacement === void 0) markPlacement = "top-start";
194
- var markElement = document.createElement("div");
924
+ return computePosition(reference, floating, __spreadProps(__spreadValues({}, mergedOptions), {
925
+ platform: platformWithCache
926
+ }));
927
+ };
928
+
929
+ // src/index.ts
930
+ var cleanupFns = [];
931
+ function mark() {
932
+ return __async(this, arguments, function* (options = {}) {
933
+ const {
934
+ selector = "button, input, a, select, textarea",
935
+ markStyle = {
936
+ backgroundColor: "red",
937
+ color: "white",
938
+ padding: "2px 4px",
939
+ fontSize: "12px",
940
+ fontWeight: "bold"
941
+ },
942
+ markPlacement = "top-start",
943
+ maskStyle = {
944
+ outline: "2px dashed red",
945
+ backgroundColor: "transparent"
946
+ },
947
+ showMasks = true,
948
+ labelGenerator = (_, index) => index.toString(),
949
+ containerElement = document.body,
950
+ viewPortOnly = false
951
+ } = options;
952
+ const elements = Array.from(
953
+ containerElement.querySelectorAll(selector)
954
+ ).filter(
955
+ (el) => !viewPortOnly || el.getBoundingClientRect().top < window.innerHeight
956
+ );
957
+ const markedElements = {};
958
+ yield Promise.all(
959
+ elements.map((element, index) => __async(this, null, function* () {
960
+ const label = labelGenerator(element, index);
961
+ const markElement = createMark(element, markStyle, label, markPlacement);
962
+ const maskElement = showMasks ? createMask(element, maskStyle, label) : void 0;
963
+ markedElements[label] = { element, markElement, maskElement };
964
+ element.setAttribute("data-webmarkeredby", `webmarker-${label}`);
965
+ }))
966
+ );
967
+ document.documentElement.dataset.webmarkered = "true";
968
+ return markedElements;
969
+ });
970
+ }
971
+ function createMark(element, style, label, markPlacement = "top-start") {
972
+ const markElement = document.createElement("div");
195
973
  markElement.className = "webmarker";
196
- markElement.id = "webmarker-".concat(label);
974
+ markElement.id = `webmarker-${label}`;
197
975
  markElement.textContent = label;
198
976
  document.body.appendChild(markElement);
199
- $fd046e7a82b9f872$var$positionMark(markElement, element, markPlacement);
200
- $fd046e7a82b9f872$var$applyStyle(markElement, {
977
+ positionMark(markElement, element, markPlacement);
978
+ applyStyle(
979
+ markElement,
980
+ {
201
981
  zIndex: "999999999",
202
982
  position: "absolute",
203
983
  pointerEvents: "none"
204
- }, typeof style === "function" ? style(element) : style);
984
+ },
985
+ typeof style === "function" ? style(element) : style
986
+ );
205
987
  return markElement;
206
- }
207
- function $fd046e7a82b9f872$var$createMask(element, style, label) {
208
- var maskElement = document.createElement("div");
988
+ }
989
+ function createMask(element, style, label) {
990
+ const maskElement = document.createElement("div");
209
991
  maskElement.className = "webmarkermask";
210
- maskElement.id = "webmarkermask-".concat(label);
992
+ maskElement.id = `webmarkermask-${label}`;
211
993
  document.body.appendChild(maskElement);
212
- $fd046e7a82b9f872$var$positionMask(maskElement, element);
213
- $fd046e7a82b9f872$var$applyStyle(maskElement, {
994
+ positionMask(maskElement, element);
995
+ applyStyle(
996
+ maskElement,
997
+ {
214
998
  zIndex: "999999999",
215
999
  position: "absolute",
216
1000
  pointerEvents: "none"
217
- }, typeof style === "function" ? style(element) : style);
1001
+ },
1002
+ typeof style === "function" ? style(element) : style
1003
+ );
218
1004
  return maskElement;
219
- }
220
- function $fd046e7a82b9f872$var$positionMark(markElement, element, markPlacement) {
1005
+ }
1006
+ function positionMark(markElement, element, markPlacement) {
221
1007
  function updatePosition() {
222
- return $fd046e7a82b9f872$var$__awaiter(this, void 0, void 0, function() {
223
- var _a, x, y;
224
- return $fd046e7a82b9f872$var$__generator(this, function(_b) {
225
- switch(_b.label){
226
- case 0:
227
- return [
228
- 4 /*yield*/ ,
229
- (0, $8zHUo$floatinguidom.computePosition)(element, markElement, {
230
- placement: markPlacement
231
- })
232
- ];
233
- case 1:
234
- _a = _b.sent(), x = _a.x, y = _a.y;
235
- Object.assign(markElement.style, {
236
- left: "".concat(x, "px"),
237
- top: "".concat(y, "px")
238
- });
239
- return [
240
- 2 /*return*/
241
- ];
242
- }
243
- });
1008
+ return __async(this, null, function* () {
1009
+ const { x, y } = yield computePosition2(element, markElement, {
1010
+ placement: markPlacement
244
1011
  });
1012
+ Object.assign(markElement.style, {
1013
+ left: `${x}px`,
1014
+ top: `${y}px`
1015
+ });
1016
+ });
245
1017
  }
246
- $fd046e7a82b9f872$var$cleanupFns.push((0, $8zHUo$floatinguidom.autoUpdate)(element, markElement, updatePosition));
247
- }
248
- function $fd046e7a82b9f872$var$positionMask(mask, element) {
249
- return $fd046e7a82b9f872$var$__awaiter(this, void 0, void 0, function() {
250
- function updatePosition() {
251
- return $fd046e7a82b9f872$var$__awaiter(this, void 0, void 0, function() {
252
- var _a, maskX, maskY;
253
- return $fd046e7a82b9f872$var$__generator(this, function(_b) {
254
- switch(_b.label){
255
- case 0:
256
- return [
257
- 4 /*yield*/ ,
258
- (0, $8zHUo$floatinguidom.computePosition)(element, mask, {
259
- placement: "top-start"
260
- })
261
- ];
262
- case 1:
263
- _a = _b.sent(), maskX = _a.x, maskY = _a.y;
264
- Object.assign(mask.style, {
265
- left: "".concat(maskX, "px"),
266
- top: "".concat(maskY + height, "px"),
267
- width: "".concat(width, "px"),
268
- height: "".concat(height, "px")
269
- });
270
- return [
271
- 2 /*return*/
272
- ];
273
- }
274
- });
275
- });
276
- }
277
- var _a, width, height;
278
- return $fd046e7a82b9f872$var$__generator(this, function(_b) {
279
- _a = element.getBoundingClientRect(), width = _a.width, height = _a.height;
280
- $fd046e7a82b9f872$var$cleanupFns.push((0, $8zHUo$floatinguidom.autoUpdate)(element, mask, updatePosition));
281
- return [
282
- 2 /*return*/
283
- ];
1018
+ cleanupFns.push(autoUpdate(element, markElement, updatePosition));
1019
+ }
1020
+ function positionMask(mask, element) {
1021
+ return __async(this, null, function* () {
1022
+ const { width, height } = element.getBoundingClientRect();
1023
+ function updatePosition() {
1024
+ return __async(this, null, function* () {
1025
+ const { x: maskX, y: maskY } = yield computePosition2(element, mask, {
1026
+ placement: "top-start"
1027
+ });
1028
+ Object.assign(mask.style, {
1029
+ left: `${maskX}px`,
1030
+ top: `${maskY + height}px`,
1031
+ width: `${width}px`,
1032
+ height: `${height}px`
1033
+ });
284
1034
  });
1035
+ }
1036
+ cleanupFns.push(autoUpdate(element, mask, updatePosition));
285
1037
  });
286
- }
287
- function $fd046e7a82b9f872$var$applyStyle(element, defaultStyle, customStyle) {
1038
+ }
1039
+ function applyStyle(element, defaultStyle, customStyle) {
288
1040
  Object.assign(element.style, defaultStyle, customStyle);
289
- }
290
- function $fd046e7a82b9f872$export$3522532a010241a0() {
291
- document.querySelectorAll(".webmarker, .webmarkermask").forEach(function(el) {
292
- return el.remove();
293
- });
1041
+ }
1042
+ function unmark() {
1043
+ document.querySelectorAll(".webmarker, .webmarkermask").forEach((el) => el.remove());
294
1044
  document.documentElement.removeAttribute("data-webmarkered");
295
- $fd046e7a82b9f872$var$cleanupFns.forEach(function(fn) {
296
- return fn();
297
- });
298
- $fd046e7a82b9f872$var$cleanupFns = [];
299
- }
300
- function $fd046e7a82b9f872$export$3b489baf08eae67a() {
1045
+ cleanupFns.forEach((fn) => fn());
1046
+ cleanupFns = [];
1047
+ }
1048
+ function isMarked() {
301
1049
  return document.documentElement.hasAttribute("data-webmarkered");
302
- }
303
- window["mark"] = $fd046e7a82b9f872$export$bf7f2fce5c1cf636;
304
- window["unmark"] = $fd046e7a82b9f872$export$3522532a010241a0;
305
- window["isMarked"] = $fd046e7a82b9f872$export$3b489baf08eae67a;
306
-
307
-
308
- //# sourceMappingURL=main.js.map
1050
+ }
1051
+ window["mark"] = mark;
1052
+ window["unmark"] = unmark;
1053
+ window["isMarked"] = isMarked;
1054
+ return __toCommonJS(src_exports);
1055
+ })();