v-onboarding 1.2.2 → 2.0.1

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.
@@ -1,4 +1,5 @@
1
- import { ref, onUnmounted, defineComponent, inject, computed, watch, onMounted, withDirectives, openBlock, createElementBlock, createElementVNode, renderSlot, toDisplayString, createCommentVNode, vShow, provide, resolveComponent, createBlock } from "vue";
1
+ import { ref, onMounted, onUnmounted, defineComponent, inject, computed, watch, withDirectives, openBlock, createElementBlock, createElementVNode, renderSlot, toDisplayString, createCommentVNode, vShow, provide, resolveComponent, createBlock } from "vue";
2
+ import { createPopper } from "@popperjs/core";
2
3
  function useGetElement(element) {
3
4
  if (typeof element === "string") {
4
5
  return document.querySelector(element);
@@ -7,22 +8,83 @@ function useGetElement(element) {
7
8
  }
8
9
  return null;
9
10
  }
11
+ const defaultVOnboardingWrapperOptions = {
12
+ popper: {},
13
+ overlay: {
14
+ enabled: true,
15
+ padding: 0,
16
+ borderRadius: 0
17
+ },
18
+ scrollToStep: {
19
+ enabled: true,
20
+ options: {
21
+ behavior: "smooth",
22
+ block: "center",
23
+ inline: "center"
24
+ }
25
+ }
26
+ };
10
27
  function useSvgOverlay() {
28
+ var _a, _b, _c, _d;
11
29
  const path = ref("");
12
30
  const target = ref(null);
31
+ const paddingRef = ref((_b = (_a = defaultVOnboardingWrapperOptions.overlay) == null ? void 0 : _a.padding) != null ? _b : 0);
32
+ const borderRadiusRef = ref((_d = (_c = defaultVOnboardingWrapperOptions.overlay) == null ? void 0 : _c.borderRadius) != null ? _d : 0);
13
33
  const onScroll = () => {
14
- updatePath(target.value);
34
+ updatePath(target.value, {
35
+ padding: paddingRef.value,
36
+ borderRadius: borderRadiusRef.value
37
+ });
15
38
  };
16
- const updatePath = async (element) => {
39
+ const updatePath = async (element, options = defaultVOnboardingWrapperOptions.overlay) => {
40
+ var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l;
17
41
  if (!element)
18
42
  return;
19
43
  const { innerWidth, innerHeight } = window;
20
- const { left: left2, top: top2, width, height } = element.getBoundingClientRect();
21
- path.value = `M${innerWidth},${innerHeight}H0V0H${innerWidth}V${innerHeight}ZM${left2},${top2}a0,0,0,0,0-0,0V${top2 + height}a0,0,0,0,0,0,0H${left2 + width}a0,0,0,0,0,0-0V${top2}a0,0,0,0,0-0-0Z`;
44
+ const { left, top, width, height } = element.getBoundingClientRect();
45
+ const padding = typeof options.padding === "number" ? {
46
+ top: options.padding,
47
+ right: options.padding,
48
+ bottom: options.padding,
49
+ left: options.padding
50
+ } : options.padding;
51
+ const radius = typeof options.borderRadius === "number" ? {
52
+ leftTop: options.borderRadius,
53
+ rightTop: options.borderRadius,
54
+ rightBottom: options.borderRadius,
55
+ leftBottom: options.borderRadius
56
+ } : options.borderRadius;
57
+ const edges = {
58
+ top: top - ((_a2 = padding == null ? void 0 : padding.top) != null ? _a2 : 0),
59
+ right: left + width + ((_b2 = padding == null ? void 0 : padding.right) != null ? _b2 : 0),
60
+ bottom: top + height + ((_c2 = padding == null ? void 0 : padding.bottom) != null ? _c2 : 0),
61
+ left: left - ((_d2 = padding == null ? void 0 : padding.left) != null ? _d2 : 0)
62
+ };
63
+ const pointsPath = {
64
+ leftTop: `M${edges.left + ((_e = radius == null ? void 0 : radius.leftTop) != null ? _e : 0)},${edges.top} Q${edges.left},${edges.top} ${edges.left},${edges.top + ((_f = radius == null ? void 0 : radius.leftTop) != null ? _f : 0)}`,
65
+ rightTop: `V${edges.top + ((_g = radius == null ? void 0 : radius.rightTop) != null ? _g : 0)} Q${edges.right},${edges.top} ${edges.right - ((_h = radius == null ? void 0 : radius.rightTop) != null ? _h : 0)},${edges.top}`,
66
+ rightBottom: `H${edges.right - ((_i = radius == null ? void 0 : radius.rightBottom) != null ? _i : 0)} Q${edges.right},${edges.bottom} ${edges.right},${edges.bottom - ((_j = radius == null ? void 0 : radius.rightBottom) != null ? _j : 0)}`,
67
+ leftBottom: `V${edges.bottom - ((_k = radius == null ? void 0 : radius.leftBottom) != null ? _k : 0)} Q${edges.left},${edges.bottom} ${edges.left + ((_l = radius == null ? void 0 : radius.leftBottom) != null ? _l : 0)},${edges.bottom}`
68
+ };
69
+ path.value = `
70
+ M${innerWidth},${innerHeight}
71
+ H0V0
72
+ H${innerWidth}V${innerHeight}
73
+ Z
74
+ ${pointsPath.leftTop}
75
+ ${pointsPath.leftBottom}
76
+ ${pointsPath.rightBottom}
77
+ ${pointsPath.rightTop}
78
+ Z
79
+ `;
22
80
  target.value = element;
81
+ paddingRef.value = padding;
82
+ borderRadiusRef.value = radius;
83
+ };
84
+ onMounted(() => {
23
85
  window.addEventListener("scroll", onScroll);
24
86
  window.addEventListener("resize", onScroll);
25
- };
87
+ });
26
88
  onUnmounted(() => {
27
89
  window.removeEventListener("scroll", onScroll);
28
90
  window.removeEventListener("resize", onScroll);
@@ -32,1310 +94,6 @@ function useSvgOverlay() {
32
94
  updatePath
33
95
  };
34
96
  }
35
- var top = "top";
36
- var bottom = "bottom";
37
- var right = "right";
38
- var left = "left";
39
- var auto = "auto";
40
- var basePlacements = [top, bottom, right, left];
41
- var start = "start";
42
- var end = "end";
43
- var clippingParents = "clippingParents";
44
- var viewport = "viewport";
45
- var popper = "popper";
46
- var reference = "reference";
47
- var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
48
- return acc.concat([placement + "-" + start, placement + "-" + end]);
49
- }, []);
50
- var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
51
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
52
- }, []);
53
- var beforeRead = "beforeRead";
54
- var read = "read";
55
- var afterRead = "afterRead";
56
- var beforeMain = "beforeMain";
57
- var main = "main";
58
- var afterMain = "afterMain";
59
- var beforeWrite = "beforeWrite";
60
- var write = "write";
61
- var afterWrite = "afterWrite";
62
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
63
- function getNodeName(element) {
64
- return element ? (element.nodeName || "").toLowerCase() : null;
65
- }
66
- function getWindow(node) {
67
- if (node == null) {
68
- return window;
69
- }
70
- if (node.toString() !== "[object Window]") {
71
- var ownerDocument = node.ownerDocument;
72
- return ownerDocument ? ownerDocument.defaultView || window : window;
73
- }
74
- return node;
75
- }
76
- function isElement(node) {
77
- var OwnElement = getWindow(node).Element;
78
- return node instanceof OwnElement || node instanceof Element;
79
- }
80
- function isHTMLElement(node) {
81
- var OwnElement = getWindow(node).HTMLElement;
82
- return node instanceof OwnElement || node instanceof HTMLElement;
83
- }
84
- function isShadowRoot(node) {
85
- if (typeof ShadowRoot === "undefined") {
86
- return false;
87
- }
88
- var OwnElement = getWindow(node).ShadowRoot;
89
- return node instanceof OwnElement || node instanceof ShadowRoot;
90
- }
91
- function applyStyles(_ref) {
92
- var state = _ref.state;
93
- Object.keys(state.elements).forEach(function(name) {
94
- var style = state.styles[name] || {};
95
- var attributes = state.attributes[name] || {};
96
- var element = state.elements[name];
97
- if (!isHTMLElement(element) || !getNodeName(element)) {
98
- return;
99
- }
100
- Object.assign(element.style, style);
101
- Object.keys(attributes).forEach(function(name2) {
102
- var value = attributes[name2];
103
- if (value === false) {
104
- element.removeAttribute(name2);
105
- } else {
106
- element.setAttribute(name2, value === true ? "" : value);
107
- }
108
- });
109
- });
110
- }
111
- function effect$2(_ref2) {
112
- var state = _ref2.state;
113
- var initialStyles = {
114
- popper: {
115
- position: state.options.strategy,
116
- left: "0",
117
- top: "0",
118
- margin: "0"
119
- },
120
- arrow: {
121
- position: "absolute"
122
- },
123
- reference: {}
124
- };
125
- Object.assign(state.elements.popper.style, initialStyles.popper);
126
- state.styles = initialStyles;
127
- if (state.elements.arrow) {
128
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
129
- }
130
- return function() {
131
- Object.keys(state.elements).forEach(function(name) {
132
- var element = state.elements[name];
133
- var attributes = state.attributes[name] || {};
134
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
135
- var style = styleProperties.reduce(function(style2, property) {
136
- style2[property] = "";
137
- return style2;
138
- }, {});
139
- if (!isHTMLElement(element) || !getNodeName(element)) {
140
- return;
141
- }
142
- Object.assign(element.style, style);
143
- Object.keys(attributes).forEach(function(attribute) {
144
- element.removeAttribute(attribute);
145
- });
146
- });
147
- };
148
- }
149
- var applyStyles$1 = {
150
- name: "applyStyles",
151
- enabled: true,
152
- phase: "write",
153
- fn: applyStyles,
154
- effect: effect$2,
155
- requires: ["computeStyles"]
156
- };
157
- function getBasePlacement(placement) {
158
- return placement.split("-")[0];
159
- }
160
- var max = Math.max;
161
- var min = Math.min;
162
- var round = Math.round;
163
- function getBoundingClientRect(element, includeScale) {
164
- if (includeScale === void 0) {
165
- includeScale = false;
166
- }
167
- var rect = element.getBoundingClientRect();
168
- var scaleX = 1;
169
- var scaleY = 1;
170
- if (isHTMLElement(element) && includeScale) {
171
- var offsetHeight = element.offsetHeight;
172
- var offsetWidth = element.offsetWidth;
173
- if (offsetWidth > 0) {
174
- scaleX = round(rect.width) / offsetWidth || 1;
175
- }
176
- if (offsetHeight > 0) {
177
- scaleY = round(rect.height) / offsetHeight || 1;
178
- }
179
- }
180
- return {
181
- width: rect.width / scaleX,
182
- height: rect.height / scaleY,
183
- top: rect.top / scaleY,
184
- right: rect.right / scaleX,
185
- bottom: rect.bottom / scaleY,
186
- left: rect.left / scaleX,
187
- x: rect.left / scaleX,
188
- y: rect.top / scaleY
189
- };
190
- }
191
- function getLayoutRect(element) {
192
- var clientRect = getBoundingClientRect(element);
193
- var width = element.offsetWidth;
194
- var height = element.offsetHeight;
195
- if (Math.abs(clientRect.width - width) <= 1) {
196
- width = clientRect.width;
197
- }
198
- if (Math.abs(clientRect.height - height) <= 1) {
199
- height = clientRect.height;
200
- }
201
- return {
202
- x: element.offsetLeft,
203
- y: element.offsetTop,
204
- width,
205
- height
206
- };
207
- }
208
- function contains(parent, child) {
209
- var rootNode = child.getRootNode && child.getRootNode();
210
- if (parent.contains(child)) {
211
- return true;
212
- } else if (rootNode && isShadowRoot(rootNode)) {
213
- var next = child;
214
- do {
215
- if (next && parent.isSameNode(next)) {
216
- return true;
217
- }
218
- next = next.parentNode || next.host;
219
- } while (next);
220
- }
221
- return false;
222
- }
223
- function getComputedStyle(element) {
224
- return getWindow(element).getComputedStyle(element);
225
- }
226
- function isTableElement(element) {
227
- return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
228
- }
229
- function getDocumentElement(element) {
230
- return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
231
- }
232
- function getParentNode(element) {
233
- if (getNodeName(element) === "html") {
234
- return element;
235
- }
236
- return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
237
- }
238
- function getTrueOffsetParent(element) {
239
- if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
240
- return null;
241
- }
242
- return element.offsetParent;
243
- }
244
- function getContainingBlock(element) {
245
- var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
246
- var isIE = navigator.userAgent.indexOf("Trident") !== -1;
247
- if (isIE && isHTMLElement(element)) {
248
- var elementCss = getComputedStyle(element);
249
- if (elementCss.position === "fixed") {
250
- return null;
251
- }
252
- }
253
- var currentNode = getParentNode(element);
254
- if (isShadowRoot(currentNode)) {
255
- currentNode = currentNode.host;
256
- }
257
- while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
258
- var css = getComputedStyle(currentNode);
259
- if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
260
- return currentNode;
261
- } else {
262
- currentNode = currentNode.parentNode;
263
- }
264
- }
265
- return null;
266
- }
267
- function getOffsetParent(element) {
268
- var window2 = getWindow(element);
269
- var offsetParent = getTrueOffsetParent(element);
270
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
271
- offsetParent = getTrueOffsetParent(offsetParent);
272
- }
273
- if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
274
- return window2;
275
- }
276
- return offsetParent || getContainingBlock(element) || window2;
277
- }
278
- function getMainAxisFromPlacement(placement) {
279
- return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
280
- }
281
- function within(min$1, value, max$1) {
282
- return max(min$1, min(value, max$1));
283
- }
284
- function withinMaxClamp(min2, value, max2) {
285
- var v = within(min2, value, max2);
286
- return v > max2 ? max2 : v;
287
- }
288
- function getFreshSideObject() {
289
- return {
290
- top: 0,
291
- right: 0,
292
- bottom: 0,
293
- left: 0
294
- };
295
- }
296
- function mergePaddingObject(paddingObject) {
297
- return Object.assign({}, getFreshSideObject(), paddingObject);
298
- }
299
- function expandToHashMap(value, keys) {
300
- return keys.reduce(function(hashMap, key) {
301
- hashMap[key] = value;
302
- return hashMap;
303
- }, {});
304
- }
305
- var toPaddingObject = function toPaddingObject2(padding, state) {
306
- padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
307
- placement: state.placement
308
- })) : padding;
309
- return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
310
- };
311
- function arrow(_ref) {
312
- var _state$modifiersData$;
313
- var state = _ref.state, name = _ref.name, options = _ref.options;
314
- var arrowElement = state.elements.arrow;
315
- var popperOffsets2 = state.modifiersData.popperOffsets;
316
- var basePlacement = getBasePlacement(state.placement);
317
- var axis = getMainAxisFromPlacement(basePlacement);
318
- var isVertical = [left, right].indexOf(basePlacement) >= 0;
319
- var len = isVertical ? "height" : "width";
320
- if (!arrowElement || !popperOffsets2) {
321
- return;
322
- }
323
- var paddingObject = toPaddingObject(options.padding, state);
324
- var arrowRect = getLayoutRect(arrowElement);
325
- var minProp = axis === "y" ? top : left;
326
- var maxProp = axis === "y" ? bottom : right;
327
- var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
328
- var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
329
- var arrowOffsetParent = getOffsetParent(arrowElement);
330
- var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
331
- var centerToReference = endDiff / 2 - startDiff / 2;
332
- var min2 = paddingObject[minProp];
333
- var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
334
- var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
335
- var offset2 = within(min2, center, max2);
336
- var axisProp = axis;
337
- state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
338
- }
339
- function effect$1(_ref2) {
340
- var state = _ref2.state, options = _ref2.options;
341
- var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
342
- if (arrowElement == null) {
343
- return;
344
- }
345
- if (typeof arrowElement === "string") {
346
- arrowElement = state.elements.popper.querySelector(arrowElement);
347
- if (!arrowElement) {
348
- return;
349
- }
350
- }
351
- if (!contains(state.elements.popper, arrowElement)) {
352
- return;
353
- }
354
- state.elements.arrow = arrowElement;
355
- }
356
- var arrow$1 = {
357
- name: "arrow",
358
- enabled: true,
359
- phase: "main",
360
- fn: arrow,
361
- effect: effect$1,
362
- requires: ["popperOffsets"],
363
- requiresIfExists: ["preventOverflow"]
364
- };
365
- function getVariation(placement) {
366
- return placement.split("-")[1];
367
- }
368
- var unsetSides = {
369
- top: "auto",
370
- right: "auto",
371
- bottom: "auto",
372
- left: "auto"
373
- };
374
- function roundOffsetsByDPR(_ref) {
375
- var x = _ref.x, y = _ref.y;
376
- var win = window;
377
- var dpr = win.devicePixelRatio || 1;
378
- return {
379
- x: round(x * dpr) / dpr || 0,
380
- y: round(y * dpr) / dpr || 0
381
- };
382
- }
383
- function mapToStyles(_ref2) {
384
- var _Object$assign2;
385
- var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
386
- var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
387
- var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
388
- x,
389
- y
390
- }) : {
391
- x,
392
- y
393
- };
394
- x = _ref3.x;
395
- y = _ref3.y;
396
- var hasX = offsets.hasOwnProperty("x");
397
- var hasY = offsets.hasOwnProperty("y");
398
- var sideX = left;
399
- var sideY = top;
400
- var win = window;
401
- if (adaptive) {
402
- var offsetParent = getOffsetParent(popper2);
403
- var heightProp = "clientHeight";
404
- var widthProp = "clientWidth";
405
- if (offsetParent === getWindow(popper2)) {
406
- offsetParent = getDocumentElement(popper2);
407
- if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
408
- heightProp = "scrollHeight";
409
- widthProp = "scrollWidth";
410
- }
411
- }
412
- offsetParent = offsetParent;
413
- if (placement === top || (placement === left || placement === right) && variation === end) {
414
- sideY = bottom;
415
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
416
- y -= offsetY - popperRect.height;
417
- y *= gpuAcceleration ? 1 : -1;
418
- }
419
- if (placement === left || (placement === top || placement === bottom) && variation === end) {
420
- sideX = right;
421
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
422
- x -= offsetX - popperRect.width;
423
- x *= gpuAcceleration ? 1 : -1;
424
- }
425
- }
426
- var commonStyles = Object.assign({
427
- position
428
- }, adaptive && unsetSides);
429
- var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
430
- x,
431
- y
432
- }) : {
433
- x,
434
- y
435
- };
436
- x = _ref4.x;
437
- y = _ref4.y;
438
- if (gpuAcceleration) {
439
- var _Object$assign;
440
- return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
441
- }
442
- return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
443
- }
444
- function computeStyles(_ref5) {
445
- var state = _ref5.state, options = _ref5.options;
446
- var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
447
- var commonStyles = {
448
- placement: getBasePlacement(state.placement),
449
- variation: getVariation(state.placement),
450
- popper: state.elements.popper,
451
- popperRect: state.rects.popper,
452
- gpuAcceleration,
453
- isFixed: state.options.strategy === "fixed"
454
- };
455
- if (state.modifiersData.popperOffsets != null) {
456
- state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
457
- offsets: state.modifiersData.popperOffsets,
458
- position: state.options.strategy,
459
- adaptive,
460
- roundOffsets
461
- })));
462
- }
463
- if (state.modifiersData.arrow != null) {
464
- state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
465
- offsets: state.modifiersData.arrow,
466
- position: "absolute",
467
- adaptive: false,
468
- roundOffsets
469
- })));
470
- }
471
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
472
- "data-popper-placement": state.placement
473
- });
474
- }
475
- var computeStyles$1 = {
476
- name: "computeStyles",
477
- enabled: true,
478
- phase: "beforeWrite",
479
- fn: computeStyles,
480
- data: {}
481
- };
482
- var passive = {
483
- passive: true
484
- };
485
- function effect(_ref) {
486
- var state = _ref.state, instance = _ref.instance, options = _ref.options;
487
- var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
488
- var window2 = getWindow(state.elements.popper);
489
- var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
490
- if (scroll) {
491
- scrollParents.forEach(function(scrollParent) {
492
- scrollParent.addEventListener("scroll", instance.update, passive);
493
- });
494
- }
495
- if (resize) {
496
- window2.addEventListener("resize", instance.update, passive);
497
- }
498
- return function() {
499
- if (scroll) {
500
- scrollParents.forEach(function(scrollParent) {
501
- scrollParent.removeEventListener("scroll", instance.update, passive);
502
- });
503
- }
504
- if (resize) {
505
- window2.removeEventListener("resize", instance.update, passive);
506
- }
507
- };
508
- }
509
- var eventListeners = {
510
- name: "eventListeners",
511
- enabled: true,
512
- phase: "write",
513
- fn: function fn() {
514
- },
515
- effect,
516
- data: {}
517
- };
518
- var hash$1 = {
519
- left: "right",
520
- right: "left",
521
- bottom: "top",
522
- top: "bottom"
523
- };
524
- function getOppositePlacement(placement) {
525
- return placement.replace(/left|right|bottom|top/g, function(matched) {
526
- return hash$1[matched];
527
- });
528
- }
529
- var hash = {
530
- start: "end",
531
- end: "start"
532
- };
533
- function getOppositeVariationPlacement(placement) {
534
- return placement.replace(/start|end/g, function(matched) {
535
- return hash[matched];
536
- });
537
- }
538
- function getWindowScroll(node) {
539
- var win = getWindow(node);
540
- var scrollLeft = win.pageXOffset;
541
- var scrollTop = win.pageYOffset;
542
- return {
543
- scrollLeft,
544
- scrollTop
545
- };
546
- }
547
- function getWindowScrollBarX(element) {
548
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
549
- }
550
- function getViewportRect(element) {
551
- var win = getWindow(element);
552
- var html = getDocumentElement(element);
553
- var visualViewport = win.visualViewport;
554
- var width = html.clientWidth;
555
- var height = html.clientHeight;
556
- var x = 0;
557
- var y = 0;
558
- if (visualViewport) {
559
- width = visualViewport.width;
560
- height = visualViewport.height;
561
- if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
562
- x = visualViewport.offsetLeft;
563
- y = visualViewport.offsetTop;
564
- }
565
- }
566
- return {
567
- width,
568
- height,
569
- x: x + getWindowScrollBarX(element),
570
- y
571
- };
572
- }
573
- function getDocumentRect(element) {
574
- var _element$ownerDocumen;
575
- var html = getDocumentElement(element);
576
- var winScroll = getWindowScroll(element);
577
- var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
578
- var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
579
- var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
580
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
581
- var y = -winScroll.scrollTop;
582
- if (getComputedStyle(body || html).direction === "rtl") {
583
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
584
- }
585
- return {
586
- width,
587
- height,
588
- x,
589
- y
590
- };
591
- }
592
- function isScrollParent(element) {
593
- var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
594
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
595
- }
596
- function getScrollParent(node) {
597
- if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
598
- return node.ownerDocument.body;
599
- }
600
- if (isHTMLElement(node) && isScrollParent(node)) {
601
- return node;
602
- }
603
- return getScrollParent(getParentNode(node));
604
- }
605
- function listScrollParents(element, list) {
606
- var _element$ownerDocumen;
607
- if (list === void 0) {
608
- list = [];
609
- }
610
- var scrollParent = getScrollParent(element);
611
- var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
612
- var win = getWindow(scrollParent);
613
- var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
614
- var updatedList = list.concat(target);
615
- return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
616
- }
617
- function rectToClientRect(rect) {
618
- return Object.assign({}, rect, {
619
- left: rect.x,
620
- top: rect.y,
621
- right: rect.x + rect.width,
622
- bottom: rect.y + rect.height
623
- });
624
- }
625
- function getInnerBoundingClientRect(element) {
626
- var rect = getBoundingClientRect(element);
627
- rect.top = rect.top + element.clientTop;
628
- rect.left = rect.left + element.clientLeft;
629
- rect.bottom = rect.top + element.clientHeight;
630
- rect.right = rect.left + element.clientWidth;
631
- rect.width = element.clientWidth;
632
- rect.height = element.clientHeight;
633
- rect.x = rect.left;
634
- rect.y = rect.top;
635
- return rect;
636
- }
637
- function getClientRectFromMixedType(element, clippingParent) {
638
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
639
- }
640
- function getClippingParents(element) {
641
- var clippingParents2 = listScrollParents(getParentNode(element));
642
- var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
643
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
644
- if (!isElement(clipperElement)) {
645
- return [];
646
- }
647
- return clippingParents2.filter(function(clippingParent) {
648
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
649
- });
650
- }
651
- function getClippingRect(element, boundary, rootBoundary) {
652
- var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
653
- var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
654
- var firstClippingParent = clippingParents2[0];
655
- var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
656
- var rect = getClientRectFromMixedType(element, clippingParent);
657
- accRect.top = max(rect.top, accRect.top);
658
- accRect.right = min(rect.right, accRect.right);
659
- accRect.bottom = min(rect.bottom, accRect.bottom);
660
- accRect.left = max(rect.left, accRect.left);
661
- return accRect;
662
- }, getClientRectFromMixedType(element, firstClippingParent));
663
- clippingRect.width = clippingRect.right - clippingRect.left;
664
- clippingRect.height = clippingRect.bottom - clippingRect.top;
665
- clippingRect.x = clippingRect.left;
666
- clippingRect.y = clippingRect.top;
667
- return clippingRect;
668
- }
669
- function computeOffsets(_ref) {
670
- var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
671
- var basePlacement = placement ? getBasePlacement(placement) : null;
672
- var variation = placement ? getVariation(placement) : null;
673
- var commonX = reference2.x + reference2.width / 2 - element.width / 2;
674
- var commonY = reference2.y + reference2.height / 2 - element.height / 2;
675
- var offsets;
676
- switch (basePlacement) {
677
- case top:
678
- offsets = {
679
- x: commonX,
680
- y: reference2.y - element.height
681
- };
682
- break;
683
- case bottom:
684
- offsets = {
685
- x: commonX,
686
- y: reference2.y + reference2.height
687
- };
688
- break;
689
- case right:
690
- offsets = {
691
- x: reference2.x + reference2.width,
692
- y: commonY
693
- };
694
- break;
695
- case left:
696
- offsets = {
697
- x: reference2.x - element.width,
698
- y: commonY
699
- };
700
- break;
701
- default:
702
- offsets = {
703
- x: reference2.x,
704
- y: reference2.y
705
- };
706
- }
707
- var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
708
- if (mainAxis != null) {
709
- var len = mainAxis === "y" ? "height" : "width";
710
- switch (variation) {
711
- case start:
712
- offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
713
- break;
714
- case end:
715
- offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
716
- break;
717
- }
718
- }
719
- return offsets;
720
- }
721
- function detectOverflow(state, options) {
722
- if (options === void 0) {
723
- options = {};
724
- }
725
- var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
726
- var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
727
- var altContext = elementContext === popper ? reference : popper;
728
- var popperRect = state.rects.popper;
729
- var element = state.elements[altBoundary ? altContext : elementContext];
730
- var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
731
- var referenceClientRect = getBoundingClientRect(state.elements.reference);
732
- var popperOffsets2 = computeOffsets({
733
- reference: referenceClientRect,
734
- element: popperRect,
735
- strategy: "absolute",
736
- placement
737
- });
738
- var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
739
- var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
740
- var overflowOffsets = {
741
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
742
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
743
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
744
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
745
- };
746
- var offsetData = state.modifiersData.offset;
747
- if (elementContext === popper && offsetData) {
748
- var offset2 = offsetData[placement];
749
- Object.keys(overflowOffsets).forEach(function(key) {
750
- var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
751
- var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
752
- overflowOffsets[key] += offset2[axis] * multiply;
753
- });
754
- }
755
- return overflowOffsets;
756
- }
757
- function computeAutoPlacement(state, options) {
758
- if (options === void 0) {
759
- options = {};
760
- }
761
- var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
762
- var variation = getVariation(placement);
763
- var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
764
- return getVariation(placement2) === variation;
765
- }) : basePlacements;
766
- var allowedPlacements = placements$1.filter(function(placement2) {
767
- return allowedAutoPlacements.indexOf(placement2) >= 0;
768
- });
769
- if (allowedPlacements.length === 0) {
770
- allowedPlacements = placements$1;
771
- }
772
- var overflows = allowedPlacements.reduce(function(acc, placement2) {
773
- acc[placement2] = detectOverflow(state, {
774
- placement: placement2,
775
- boundary,
776
- rootBoundary,
777
- padding
778
- })[getBasePlacement(placement2)];
779
- return acc;
780
- }, {});
781
- return Object.keys(overflows).sort(function(a, b) {
782
- return overflows[a] - overflows[b];
783
- });
784
- }
785
- function getExpandedFallbackPlacements(placement) {
786
- if (getBasePlacement(placement) === auto) {
787
- return [];
788
- }
789
- var oppositePlacement = getOppositePlacement(placement);
790
- return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
791
- }
792
- function flip(_ref) {
793
- var state = _ref.state, options = _ref.options, name = _ref.name;
794
- if (state.modifiersData[name]._skip) {
795
- return;
796
- }
797
- var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
798
- var preferredPlacement = state.options.placement;
799
- var basePlacement = getBasePlacement(preferredPlacement);
800
- var isBasePlacement = basePlacement === preferredPlacement;
801
- var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
802
- var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
803
- return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
804
- placement: placement2,
805
- boundary,
806
- rootBoundary,
807
- padding,
808
- flipVariations,
809
- allowedAutoPlacements
810
- }) : placement2);
811
- }, []);
812
- var referenceRect = state.rects.reference;
813
- var popperRect = state.rects.popper;
814
- var checksMap = /* @__PURE__ */ new Map();
815
- var makeFallbackChecks = true;
816
- var firstFittingPlacement = placements2[0];
817
- for (var i = 0; i < placements2.length; i++) {
818
- var placement = placements2[i];
819
- var _basePlacement = getBasePlacement(placement);
820
- var isStartVariation = getVariation(placement) === start;
821
- var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
822
- var len = isVertical ? "width" : "height";
823
- var overflow = detectOverflow(state, {
824
- placement,
825
- boundary,
826
- rootBoundary,
827
- altBoundary,
828
- padding
829
- });
830
- var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
831
- if (referenceRect[len] > popperRect[len]) {
832
- mainVariationSide = getOppositePlacement(mainVariationSide);
833
- }
834
- var altVariationSide = getOppositePlacement(mainVariationSide);
835
- var checks = [];
836
- if (checkMainAxis) {
837
- checks.push(overflow[_basePlacement] <= 0);
838
- }
839
- if (checkAltAxis) {
840
- checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
841
- }
842
- if (checks.every(function(check) {
843
- return check;
844
- })) {
845
- firstFittingPlacement = placement;
846
- makeFallbackChecks = false;
847
- break;
848
- }
849
- checksMap.set(placement, checks);
850
- }
851
- if (makeFallbackChecks) {
852
- var numberOfChecks = flipVariations ? 3 : 1;
853
- var _loop = function _loop2(_i2) {
854
- var fittingPlacement = placements2.find(function(placement2) {
855
- var checks2 = checksMap.get(placement2);
856
- if (checks2) {
857
- return checks2.slice(0, _i2).every(function(check) {
858
- return check;
859
- });
860
- }
861
- });
862
- if (fittingPlacement) {
863
- firstFittingPlacement = fittingPlacement;
864
- return "break";
865
- }
866
- };
867
- for (var _i = numberOfChecks; _i > 0; _i--) {
868
- var _ret = _loop(_i);
869
- if (_ret === "break")
870
- break;
871
- }
872
- }
873
- if (state.placement !== firstFittingPlacement) {
874
- state.modifiersData[name]._skip = true;
875
- state.placement = firstFittingPlacement;
876
- state.reset = true;
877
- }
878
- }
879
- var flip$1 = {
880
- name: "flip",
881
- enabled: true,
882
- phase: "main",
883
- fn: flip,
884
- requiresIfExists: ["offset"],
885
- data: {
886
- _skip: false
887
- }
888
- };
889
- function getSideOffsets(overflow, rect, preventedOffsets) {
890
- if (preventedOffsets === void 0) {
891
- preventedOffsets = {
892
- x: 0,
893
- y: 0
894
- };
895
- }
896
- return {
897
- top: overflow.top - rect.height - preventedOffsets.y,
898
- right: overflow.right - rect.width + preventedOffsets.x,
899
- bottom: overflow.bottom - rect.height + preventedOffsets.y,
900
- left: overflow.left - rect.width - preventedOffsets.x
901
- };
902
- }
903
- function isAnySideFullyClipped(overflow) {
904
- return [top, right, bottom, left].some(function(side) {
905
- return overflow[side] >= 0;
906
- });
907
- }
908
- function hide(_ref) {
909
- var state = _ref.state, name = _ref.name;
910
- var referenceRect = state.rects.reference;
911
- var popperRect = state.rects.popper;
912
- var preventedOffsets = state.modifiersData.preventOverflow;
913
- var referenceOverflow = detectOverflow(state, {
914
- elementContext: "reference"
915
- });
916
- var popperAltOverflow = detectOverflow(state, {
917
- altBoundary: true
918
- });
919
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
920
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
921
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
922
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
923
- state.modifiersData[name] = {
924
- referenceClippingOffsets,
925
- popperEscapeOffsets,
926
- isReferenceHidden,
927
- hasPopperEscaped
928
- };
929
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
930
- "data-popper-reference-hidden": isReferenceHidden,
931
- "data-popper-escaped": hasPopperEscaped
932
- });
933
- }
934
- var hide$1 = {
935
- name: "hide",
936
- enabled: true,
937
- phase: "main",
938
- requiresIfExists: ["preventOverflow"],
939
- fn: hide
940
- };
941
- function distanceAndSkiddingToXY(placement, rects, offset2) {
942
- var basePlacement = getBasePlacement(placement);
943
- var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
944
- var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
945
- placement
946
- })) : offset2, skidding = _ref[0], distance = _ref[1];
947
- skidding = skidding || 0;
948
- distance = (distance || 0) * invertDistance;
949
- return [left, right].indexOf(basePlacement) >= 0 ? {
950
- x: distance,
951
- y: skidding
952
- } : {
953
- x: skidding,
954
- y: distance
955
- };
956
- }
957
- function offset(_ref2) {
958
- var state = _ref2.state, options = _ref2.options, name = _ref2.name;
959
- var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
960
- var data = placements.reduce(function(acc, placement) {
961
- acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
962
- return acc;
963
- }, {});
964
- var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
965
- if (state.modifiersData.popperOffsets != null) {
966
- state.modifiersData.popperOffsets.x += x;
967
- state.modifiersData.popperOffsets.y += y;
968
- }
969
- state.modifiersData[name] = data;
970
- }
971
- var offset$1 = {
972
- name: "offset",
973
- enabled: true,
974
- phase: "main",
975
- requires: ["popperOffsets"],
976
- fn: offset
977
- };
978
- function popperOffsets(_ref) {
979
- var state = _ref.state, name = _ref.name;
980
- state.modifiersData[name] = computeOffsets({
981
- reference: state.rects.reference,
982
- element: state.rects.popper,
983
- strategy: "absolute",
984
- placement: state.placement
985
- });
986
- }
987
- var popperOffsets$1 = {
988
- name: "popperOffsets",
989
- enabled: true,
990
- phase: "read",
991
- fn: popperOffsets,
992
- data: {}
993
- };
994
- function getAltAxis(axis) {
995
- return axis === "x" ? "y" : "x";
996
- }
997
- function preventOverflow(_ref) {
998
- var state = _ref.state, options = _ref.options, name = _ref.name;
999
- var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1000
- var overflow = detectOverflow(state, {
1001
- boundary,
1002
- rootBoundary,
1003
- padding,
1004
- altBoundary
1005
- });
1006
- var basePlacement = getBasePlacement(state.placement);
1007
- var variation = getVariation(state.placement);
1008
- var isBasePlacement = !variation;
1009
- var mainAxis = getMainAxisFromPlacement(basePlacement);
1010
- var altAxis = getAltAxis(mainAxis);
1011
- var popperOffsets2 = state.modifiersData.popperOffsets;
1012
- var referenceRect = state.rects.reference;
1013
- var popperRect = state.rects.popper;
1014
- var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
1015
- placement: state.placement
1016
- })) : tetherOffset;
1017
- var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
1018
- mainAxis: tetherOffsetValue,
1019
- altAxis: tetherOffsetValue
1020
- } : Object.assign({
1021
- mainAxis: 0,
1022
- altAxis: 0
1023
- }, tetherOffsetValue);
1024
- var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1025
- var data = {
1026
- x: 0,
1027
- y: 0
1028
- };
1029
- if (!popperOffsets2) {
1030
- return;
1031
- }
1032
- if (checkMainAxis) {
1033
- var _offsetModifierState$;
1034
- var mainSide = mainAxis === "y" ? top : left;
1035
- var altSide = mainAxis === "y" ? bottom : right;
1036
- var len = mainAxis === "y" ? "height" : "width";
1037
- var offset2 = popperOffsets2[mainAxis];
1038
- var min$1 = offset2 + overflow[mainSide];
1039
- var max$1 = offset2 - overflow[altSide];
1040
- var additive = tether ? -popperRect[len] / 2 : 0;
1041
- var minLen = variation === start ? referenceRect[len] : popperRect[len];
1042
- var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
1043
- var arrowElement = state.elements.arrow;
1044
- var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1045
- width: 0,
1046
- height: 0
1047
- };
1048
- var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
1049
- var arrowPaddingMin = arrowPaddingObject[mainSide];
1050
- var arrowPaddingMax = arrowPaddingObject[altSide];
1051
- var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1052
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1053
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1054
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1055
- var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1056
- var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1057
- var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
1058
- var tetherMax = offset2 + maxOffset - offsetModifierValue;
1059
- var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
1060
- popperOffsets2[mainAxis] = preventedOffset;
1061
- data[mainAxis] = preventedOffset - offset2;
1062
- }
1063
- if (checkAltAxis) {
1064
- var _offsetModifierState$2;
1065
- var _mainSide = mainAxis === "x" ? top : left;
1066
- var _altSide = mainAxis === "x" ? bottom : right;
1067
- var _offset = popperOffsets2[altAxis];
1068
- var _len = altAxis === "y" ? "height" : "width";
1069
- var _min = _offset + overflow[_mainSide];
1070
- var _max = _offset - overflow[_altSide];
1071
- var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1072
- var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1073
- var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1074
- var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1075
- var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1076
- popperOffsets2[altAxis] = _preventedOffset;
1077
- data[altAxis] = _preventedOffset - _offset;
1078
- }
1079
- state.modifiersData[name] = data;
1080
- }
1081
- var preventOverflow$1 = {
1082
- name: "preventOverflow",
1083
- enabled: true,
1084
- phase: "main",
1085
- fn: preventOverflow,
1086
- requiresIfExists: ["offset"]
1087
- };
1088
- function getHTMLElementScroll(element) {
1089
- return {
1090
- scrollLeft: element.scrollLeft,
1091
- scrollTop: element.scrollTop
1092
- };
1093
- }
1094
- function getNodeScroll(node) {
1095
- if (node === getWindow(node) || !isHTMLElement(node)) {
1096
- return getWindowScroll(node);
1097
- } else {
1098
- return getHTMLElementScroll(node);
1099
- }
1100
- }
1101
- function isElementScaled(element) {
1102
- var rect = element.getBoundingClientRect();
1103
- var scaleX = round(rect.width) / element.offsetWidth || 1;
1104
- var scaleY = round(rect.height) / element.offsetHeight || 1;
1105
- return scaleX !== 1 || scaleY !== 1;
1106
- }
1107
- function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1108
- if (isFixed === void 0) {
1109
- isFixed = false;
1110
- }
1111
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
1112
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1113
- var documentElement = getDocumentElement(offsetParent);
1114
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1115
- var scroll = {
1116
- scrollLeft: 0,
1117
- scrollTop: 0
1118
- };
1119
- var offsets = {
1120
- x: 0,
1121
- y: 0
1122
- };
1123
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1124
- if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
1125
- scroll = getNodeScroll(offsetParent);
1126
- }
1127
- if (isHTMLElement(offsetParent)) {
1128
- offsets = getBoundingClientRect(offsetParent, true);
1129
- offsets.x += offsetParent.clientLeft;
1130
- offsets.y += offsetParent.clientTop;
1131
- } else if (documentElement) {
1132
- offsets.x = getWindowScrollBarX(documentElement);
1133
- }
1134
- }
1135
- return {
1136
- x: rect.left + scroll.scrollLeft - offsets.x,
1137
- y: rect.top + scroll.scrollTop - offsets.y,
1138
- width: rect.width,
1139
- height: rect.height
1140
- };
1141
- }
1142
- function order(modifiers) {
1143
- var map = /* @__PURE__ */ new Map();
1144
- var visited = /* @__PURE__ */ new Set();
1145
- var result = [];
1146
- modifiers.forEach(function(modifier) {
1147
- map.set(modifier.name, modifier);
1148
- });
1149
- function sort(modifier) {
1150
- visited.add(modifier.name);
1151
- var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
1152
- requires.forEach(function(dep) {
1153
- if (!visited.has(dep)) {
1154
- var depModifier = map.get(dep);
1155
- if (depModifier) {
1156
- sort(depModifier);
1157
- }
1158
- }
1159
- });
1160
- result.push(modifier);
1161
- }
1162
- modifiers.forEach(function(modifier) {
1163
- if (!visited.has(modifier.name)) {
1164
- sort(modifier);
1165
- }
1166
- });
1167
- return result;
1168
- }
1169
- function orderModifiers(modifiers) {
1170
- var orderedModifiers = order(modifiers);
1171
- return modifierPhases.reduce(function(acc, phase) {
1172
- return acc.concat(orderedModifiers.filter(function(modifier) {
1173
- return modifier.phase === phase;
1174
- }));
1175
- }, []);
1176
- }
1177
- function debounce(fn2) {
1178
- var pending;
1179
- return function() {
1180
- if (!pending) {
1181
- pending = new Promise(function(resolve) {
1182
- Promise.resolve().then(function() {
1183
- pending = void 0;
1184
- resolve(fn2());
1185
- });
1186
- });
1187
- }
1188
- return pending;
1189
- };
1190
- }
1191
- function mergeByName(modifiers) {
1192
- var merged = modifiers.reduce(function(merged2, current) {
1193
- var existing = merged2[current.name];
1194
- merged2[current.name] = existing ? Object.assign({}, existing, current, {
1195
- options: Object.assign({}, existing.options, current.options),
1196
- data: Object.assign({}, existing.data, current.data)
1197
- }) : current;
1198
- return merged2;
1199
- }, {});
1200
- return Object.keys(merged).map(function(key) {
1201
- return merged[key];
1202
- });
1203
- }
1204
- var DEFAULT_OPTIONS = {
1205
- placement: "bottom",
1206
- modifiers: [],
1207
- strategy: "absolute"
1208
- };
1209
- function areValidElements() {
1210
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1211
- args[_key] = arguments[_key];
1212
- }
1213
- return !args.some(function(element) {
1214
- return !(element && typeof element.getBoundingClientRect === "function");
1215
- });
1216
- }
1217
- function popperGenerator(generatorOptions) {
1218
- if (generatorOptions === void 0) {
1219
- generatorOptions = {};
1220
- }
1221
- var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1222
- return function createPopper2(reference2, popper2, options) {
1223
- if (options === void 0) {
1224
- options = defaultOptions;
1225
- }
1226
- var state = {
1227
- placement: "bottom",
1228
- orderedModifiers: [],
1229
- options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1230
- modifiersData: {},
1231
- elements: {
1232
- reference: reference2,
1233
- popper: popper2
1234
- },
1235
- attributes: {},
1236
- styles: {}
1237
- };
1238
- var effectCleanupFns = [];
1239
- var isDestroyed = false;
1240
- var instance = {
1241
- state,
1242
- setOptions: function setOptions(setOptionsAction) {
1243
- var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
1244
- cleanupModifierEffects();
1245
- state.options = Object.assign({}, defaultOptions, state.options, options2);
1246
- state.scrollParents = {
1247
- reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
1248
- popper: listScrollParents(popper2)
1249
- };
1250
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
1251
- state.orderedModifiers = orderedModifiers.filter(function(m) {
1252
- return m.enabled;
1253
- });
1254
- runModifierEffects();
1255
- return instance.update();
1256
- },
1257
- forceUpdate: function forceUpdate() {
1258
- if (isDestroyed) {
1259
- return;
1260
- }
1261
- var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
1262
- if (!areValidElements(reference3, popper3)) {
1263
- return;
1264
- }
1265
- state.rects = {
1266
- reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
1267
- popper: getLayoutRect(popper3)
1268
- };
1269
- state.reset = false;
1270
- state.placement = state.options.placement;
1271
- state.orderedModifiers.forEach(function(modifier) {
1272
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1273
- });
1274
- for (var index = 0; index < state.orderedModifiers.length; index++) {
1275
- if (state.reset === true) {
1276
- state.reset = false;
1277
- index = -1;
1278
- continue;
1279
- }
1280
- var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
1281
- if (typeof fn2 === "function") {
1282
- state = fn2({
1283
- state,
1284
- options: _options,
1285
- name,
1286
- instance
1287
- }) || state;
1288
- }
1289
- }
1290
- },
1291
- update: debounce(function() {
1292
- return new Promise(function(resolve) {
1293
- instance.forceUpdate();
1294
- resolve(state);
1295
- });
1296
- }),
1297
- destroy: function destroy() {
1298
- cleanupModifierEffects();
1299
- isDestroyed = true;
1300
- }
1301
- };
1302
- if (!areValidElements(reference2, popper2)) {
1303
- return instance;
1304
- }
1305
- instance.setOptions(options).then(function(state2) {
1306
- if (!isDestroyed && options.onFirstUpdate) {
1307
- options.onFirstUpdate(state2);
1308
- }
1309
- });
1310
- function runModifierEffects() {
1311
- state.orderedModifiers.forEach(function(_ref3) {
1312
- var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
1313
- if (typeof effect2 === "function") {
1314
- var cleanupFn = effect2({
1315
- state,
1316
- name,
1317
- instance,
1318
- options: options2
1319
- });
1320
- var noopFn = function noopFn2() {
1321
- };
1322
- effectCleanupFns.push(cleanupFn || noopFn);
1323
- }
1324
- });
1325
- }
1326
- function cleanupModifierEffects() {
1327
- effectCleanupFns.forEach(function(fn2) {
1328
- return fn2();
1329
- });
1330
- effectCleanupFns = [];
1331
- }
1332
- return instance;
1333
- };
1334
- }
1335
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
1336
- var createPopper = /* @__PURE__ */ popperGenerator({
1337
- defaultModifiers
1338
- });
1339
97
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1340
98
  var lodash_merge = { exports: {} };
1341
99
  (function(module, exports) {
@@ -1423,7 +181,7 @@ var lodash_merge = { exports: {} };
1423
181
  }
1424
182
  }();
1425
183
  var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0, nativeMax = Math.max, nativeNow = Date.now;
1426
- var Map2 = getNative(root, "Map"), nativeCreate = getNative(Object, "create");
184
+ var Map = getNative(root, "Map"), nativeCreate = getNative(Object, "create");
1427
185
  var baseCreate = function() {
1428
186
  function object() {
1429
187
  }
@@ -1540,7 +298,7 @@ var lodash_merge = { exports: {} };
1540
298
  this.size = 0;
1541
299
  this.__data__ = {
1542
300
  "hash": new Hash(),
1543
- "map": new (Map2 || ListCache)(),
301
+ "map": new (Map || ListCache)(),
1544
302
  "string": new Hash()
1545
303
  };
1546
304
  }
@@ -1589,7 +347,7 @@ var lodash_merge = { exports: {} };
1589
347
  var data = this.__data__;
1590
348
  if (data instanceof ListCache) {
1591
349
  var pairs = data.__data__;
1592
- if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
350
+ if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
1593
351
  pairs.push([key, value]);
1594
352
  this.size = ++data.size;
1595
353
  return this;
@@ -1738,8 +496,8 @@ var lodash_merge = { exports: {} };
1738
496
  }
1739
497
  assignMergeValue(object, key, newValue);
1740
498
  }
1741
- function baseRest(func, start2) {
1742
- return setToString(overRest(func, start2, identity), func + "");
499
+ function baseRest(func, start) {
500
+ return setToString(overRest(func, start, identity), func + "");
1743
501
  }
1744
502
  var baseSetToString = !defineProperty ? identity : function(func, string) {
1745
503
  return defineProperty(func, "toString", {
@@ -1888,19 +646,19 @@ var lodash_merge = { exports: {} };
1888
646
  function objectToString(value) {
1889
647
  return nativeObjectToString.call(value);
1890
648
  }
1891
- function overRest(func, start2, transform) {
1892
- start2 = nativeMax(start2 === void 0 ? func.length - 1 : start2, 0);
649
+ function overRest(func, start, transform) {
650
+ start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
1893
651
  return function() {
1894
- var args = arguments, index = -1, length = nativeMax(args.length - start2, 0), array = Array(length);
652
+ var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
1895
653
  while (++index < length) {
1896
- array[index] = args[start2 + index];
654
+ array[index] = args[start + index];
1897
655
  }
1898
656
  index = -1;
1899
- var otherArgs = Array(start2 + 1);
1900
- while (++index < start2) {
657
+ var otherArgs = Array(start + 1);
658
+ while (++index < start) {
1901
659
  otherArgs[index] = args[index];
1902
660
  }
1903
- otherArgs[start2] = transform(array);
661
+ otherArgs[start] = transform(array);
1904
662
  return apply(func, this, otherArgs);
1905
663
  };
1906
664
  }
@@ -2049,7 +807,7 @@ const _sfc_main$1 = defineComponent({
2049
807
  const stepElement = ref(null);
2050
808
  const { updatePath, path } = useSvgOverlay();
2051
809
  const attachElement = () => {
2052
- var _a, _b, _c, _d, _e, _f, _g;
810
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2053
811
  const element = useGetElement((_b = (_a = step == null ? void 0 : step.value) == null ? void 0 : _a.attachTo) == null ? void 0 : _b.element);
2054
812
  if (element && stepElement.value) {
2055
813
  show.value = true;
@@ -2057,8 +815,11 @@ const _sfc_main$1 = defineComponent({
2057
815
  element.scrollIntoView((_f = (_e = mergedOptions.value) == null ? void 0 : _e.scrollToStep) == null ? void 0 : _f.options);
2058
816
  }
2059
817
  createPopper(element, stepElement.value, mergedOptions.value.popper);
2060
- if (!((_g = mergedOptions.value) == null ? void 0 : _g.disableOverlay)) {
2061
- updatePath(element);
818
+ if ((_h = (_g = mergedOptions.value) == null ? void 0 : _g.overlay) == null ? void 0 : _h.enabled) {
819
+ updatePath(element, {
820
+ padding: (_j = (_i = mergedOptions.value) == null ? void 0 : _i.overlay) == null ? void 0 : _j.padding,
821
+ borderRadius: (_l = (_k = mergedOptions.value) == null ? void 0 : _k.overlay) == null ? void 0 : _l.borderRadius
822
+ });
2062
823
  }
2063
824
  setTargetElementClassName(element);
2064
825
  }
@@ -2069,9 +830,9 @@ const _sfc_main$1 = defineComponent({
2069
830
  attachElement();
2070
831
  };
2071
832
  const beforeStepEnd = (stepObj = step.value) => {
2072
- var _a, _b;
833
+ var _a, _b, _c, _d;
2073
834
  (_b = (_a = stepObj == null ? void 0 : stepObj.on) == null ? void 0 : _a.afterStep) == null ? void 0 : _b.call(_a);
2074
- unsetTargetElementClassName();
835
+ unsetTargetElementClassName(useGetElement((_c = stepObj == null ? void 0 : stepObj.attachTo) == null ? void 0 : _c.element), (_d = stepObj.attachTo) == null ? void 0 : _d.classList);
2075
836
  };
2076
837
  const setTargetElementClassName = (element = useGetElement(step.value.attachTo.element)) => {
2077
838
  const classList = step.value.attachTo.classList;
@@ -2079,8 +840,7 @@ const _sfc_main$1 = defineComponent({
2079
840
  return;
2080
841
  element.classList.add(...classList);
2081
842
  };
2082
- const unsetTargetElementClassName = (element = useGetElement(step.value.attachTo.element)) => {
2083
- const classList = step.value.attachTo.classList;
843
+ const unsetTargetElementClassName = (element = useGetElement(step.value.attachTo.element), classList) => {
2084
844
  if (!classList || !element)
2085
845
  return;
2086
846
  element.classList.remove(...classList);
@@ -2172,18 +932,6 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
2172
932
  ]);
2173
933
  }
2174
934
  var VOnboardingStep = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
2175
- const defaultVOnboardingWrapperOptions = {
2176
- popper: {},
2177
- disableOverlay: false,
2178
- scrollToStep: {
2179
- enabled: true,
2180
- options: {
2181
- behavior: "smooth",
2182
- block: "center",
2183
- inline: "center"
2184
- }
2185
- }
2186
- };
2187
935
  const _sfc_main = defineComponent({
2188
936
  name: "VOnboardingWrapper",
2189
937
  components: {
@@ -2221,14 +969,14 @@ const _sfc_main = defineComponent({
2221
969
  const isFinished = computed(() => {
2222
970
  return index.value >= props.steps.length || index.value < 0;
2223
971
  });
2224
- const start2 = () => {
972
+ const start = () => {
2225
973
  setIndex(0);
2226
974
  };
2227
975
  const finish = () => {
2228
976
  setIndex(-1);
2229
977
  };
2230
978
  expose({
2231
- start: start2,
979
+ start,
2232
980
  finish,
2233
981
  goToStep: setIndex
2234
982
  });
@@ -2278,7 +1026,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2278
1026
  }
2279
1027
  var VOnboardingWrapper = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
2280
1028
  function useVOnboarding(wrapperRef) {
2281
- const start2 = () => {
1029
+ const start = () => {
2282
1030
  var _a;
2283
1031
  return (_a = wrapperRef == null ? void 0 : wrapperRef.value) == null ? void 0 : _a.start();
2284
1032
  };
@@ -2291,7 +1039,7 @@ function useVOnboarding(wrapperRef) {
2291
1039
  return (_a = wrapperRef == null ? void 0 : wrapperRef.value) == null ? void 0 : _a.goToStep(newStepNumber);
2292
1040
  };
2293
1041
  return {
2294
- start: start2,
1042
+ start,
2295
1043
  finish,
2296
1044
  goToStep
2297
1045
  };