@histoire/controls 0.1.5 → 0.2.2

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/index.es.js CHANGED
@@ -17,24 +17,2645 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, ref, computed, watch, openBlock, createElementBlock, withKeys, withModifiers, createElementVNode, normalizeClass, unref, renderSlot, normalizeStyle, createCommentVNode, mergeProps } from "vue";
21
- const _hoisted_1$1 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
22
- const _hoisted_2$1 = {
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, withScopeId, resolveComponent, createElementBlock, normalizeClass, normalizeStyle, withKeys, createElementVNode, Fragment, renderSlot, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h, toDisplayString, withDirectives, createTextVNode, unref, computed, watch, withModifiers, onUnmounted, isRef, vModelText } from "vue";
33
+ function getBasePlacement(placement) {
34
+ return placement.split("-")[0];
35
+ }
36
+ function getAlignment(placement) {
37
+ return placement.split("-")[1];
38
+ }
39
+ function getMainAxisFromPlacement(placement) {
40
+ return ["top", "bottom"].includes(getBasePlacement(placement)) ? "x" : "y";
41
+ }
42
+ function getLengthFromAxis(axis) {
43
+ return axis === "y" ? "height" : "width";
44
+ }
45
+ function computeCoordsFromPlacement(_ref) {
46
+ let {
47
+ reference,
48
+ floating,
49
+ placement
50
+ } = _ref;
51
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
52
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
53
+ let coords;
54
+ switch (getBasePlacement(placement)) {
55
+ case "top":
56
+ coords = {
57
+ x: commonX,
58
+ y: reference.y - floating.height
59
+ };
60
+ break;
61
+ case "bottom":
62
+ coords = {
63
+ x: commonX,
64
+ y: reference.y + reference.height
65
+ };
66
+ break;
67
+ case "right":
68
+ coords = {
69
+ x: reference.x + reference.width,
70
+ y: commonY
71
+ };
72
+ break;
73
+ case "left":
74
+ coords = {
75
+ x: reference.x - floating.width,
76
+ y: commonY
77
+ };
78
+ break;
79
+ default:
80
+ coords = {
81
+ x: reference.x,
82
+ y: reference.y
83
+ };
84
+ }
85
+ const mainAxis = getMainAxisFromPlacement(placement);
86
+ const length = getLengthFromAxis(mainAxis);
87
+ switch (getAlignment(placement)) {
88
+ case "start":
89
+ coords[mainAxis] = coords[mainAxis] - (reference[length] / 2 - floating[length] / 2);
90
+ break;
91
+ case "end":
92
+ coords[mainAxis] = coords[mainAxis] + (reference[length] / 2 - floating[length] / 2);
93
+ break;
94
+ }
95
+ return coords;
96
+ }
97
+ const computePosition$1 = async (reference, floating, config2) => {
98
+ const {
99
+ placement = "bottom",
100
+ strategy = "absolute",
101
+ middleware = [],
102
+ platform: platform2
103
+ } = config2;
104
+ let rects = await platform2.getElementRects({
105
+ reference,
106
+ floating,
107
+ strategy
108
+ });
109
+ let {
110
+ x,
111
+ y
112
+ } = computeCoordsFromPlacement(__spreadProps(__spreadValues({}, rects), {
113
+ placement
114
+ }));
115
+ let statefulPlacement = placement;
116
+ let middlewareData = {};
117
+ for (let i = 0; i < middleware.length; i++) {
118
+ const {
119
+ name,
120
+ fn
121
+ } = middleware[i];
122
+ const {
123
+ x: nextX,
124
+ y: nextY,
125
+ data,
126
+ reset
127
+ } = await fn({
128
+ x,
129
+ y,
130
+ initialPlacement: placement,
131
+ placement: statefulPlacement,
132
+ strategy,
133
+ middlewareData,
134
+ rects,
135
+ platform: platform2,
136
+ elements: {
137
+ reference,
138
+ floating
139
+ }
140
+ });
141
+ x = nextX != null ? nextX : x;
142
+ y = nextY != null ? nextY : y;
143
+ middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
144
+ [name]: data != null ? data : {}
145
+ });
146
+ if (reset) {
147
+ if (typeof reset === "object") {
148
+ if (reset.placement) {
149
+ statefulPlacement = reset.placement;
150
+ }
151
+ if (reset.rects) {
152
+ rects = reset.rects === true ? await platform2.getElementRects({
153
+ reference,
154
+ floating,
155
+ strategy
156
+ }) : reset.rects;
157
+ }
158
+ ({
159
+ x,
160
+ y
161
+ } = computeCoordsFromPlacement(__spreadProps(__spreadValues({}, rects), {
162
+ placement: statefulPlacement
163
+ })));
164
+ }
165
+ i = -1;
166
+ continue;
167
+ }
168
+ }
169
+ return {
170
+ x,
171
+ y,
172
+ placement: statefulPlacement,
173
+ strategy,
174
+ middlewareData
175
+ };
176
+ };
177
+ function expandPaddingObject(padding) {
178
+ return __spreadValues({
179
+ top: 0,
180
+ right: 0,
181
+ bottom: 0,
182
+ left: 0
183
+ }, padding);
184
+ }
185
+ function getSideObjectFromPadding(padding) {
186
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
187
+ top: padding,
188
+ right: padding,
189
+ bottom: padding,
190
+ left: padding
191
+ };
192
+ }
193
+ function rectToClientRect(rect) {
194
+ return __spreadProps(__spreadValues({}, rect), {
195
+ top: rect.y,
196
+ left: rect.x,
197
+ right: rect.x + rect.width,
198
+ bottom: rect.y + rect.height
199
+ });
200
+ }
201
+ async function detectOverflow(middlewareArguments, options) {
202
+ if (options === void 0) {
203
+ options = {};
204
+ }
205
+ const {
206
+ x,
207
+ y,
208
+ platform: platform2,
209
+ rects,
210
+ elements,
211
+ strategy
212
+ } = middlewareArguments;
213
+ const {
214
+ boundary = "clippingParents",
215
+ rootBoundary = "viewport",
216
+ elementContext = "floating",
217
+ altBoundary = false,
218
+ padding = 0
219
+ } = options;
220
+ const paddingObject = getSideObjectFromPadding(padding);
221
+ const altContext = elementContext === "floating" ? "reference" : "floating";
222
+ const element = elements[altBoundary ? altContext : elementContext];
223
+ const clippingClientRect = await platform2.getClippingClientRect({
224
+ element: await platform2.isElement(element) ? element : element.contextElement || await platform2.getDocumentElement({
225
+ element: elements.floating
226
+ }),
227
+ boundary,
228
+ rootBoundary
229
+ });
230
+ const elementClientRect = rectToClientRect(await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
231
+ rect: elementContext === "floating" ? __spreadProps(__spreadValues({}, rects.floating), {
232
+ x,
233
+ y
234
+ }) : rects.reference,
235
+ offsetParent: await platform2.getOffsetParent({
236
+ element: elements.floating
237
+ }),
238
+ strategy
239
+ }));
240
+ return {
241
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
242
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
243
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
244
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
245
+ };
246
+ }
247
+ const min$1 = Math.min;
248
+ const max$1 = Math.max;
249
+ function within(min$1$1, value, max$1$1) {
250
+ return max$1(min$1$1, min$1(value, max$1$1));
251
+ }
252
+ const arrow = (options) => ({
253
+ name: "arrow",
254
+ options,
255
+ async fn(middlewareArguments) {
256
+ const {
257
+ element,
258
+ padding = 0
259
+ } = options != null ? options : {};
260
+ const {
261
+ x,
262
+ y,
263
+ placement,
264
+ rects,
265
+ platform: platform2
266
+ } = middlewareArguments;
267
+ if (element == null) {
268
+ return {};
269
+ }
270
+ const paddingObject = getSideObjectFromPadding(padding);
271
+ const coords = {
272
+ x,
273
+ y
274
+ };
275
+ const basePlacement = getBasePlacement(placement);
276
+ const axis = getMainAxisFromPlacement(basePlacement);
277
+ const length = getLengthFromAxis(axis);
278
+ const arrowDimensions = await platform2.getDimensions({
279
+ element
280
+ });
281
+ const minProp = axis === "y" ? "top" : "left";
282
+ const maxProp = axis === "y" ? "bottom" : "right";
283
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
284
+ const startDiff = coords[axis] - rects.reference[axis];
285
+ const arrowOffsetParent = await platform2.getOffsetParent({
286
+ element
287
+ });
288
+ const clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
289
+ const centerToReference = endDiff / 2 - startDiff / 2;
290
+ const min2 = paddingObject[minProp];
291
+ const max2 = clientSize - arrowDimensions[length] - paddingObject[maxProp];
292
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
293
+ const offset2 = within(min2, center, max2);
294
+ return {
295
+ data: {
296
+ [axis]: offset2,
297
+ centerOffset: center - offset2
298
+ }
299
+ };
300
+ }
301
+ });
302
+ const hash$1 = {
303
+ left: "right",
304
+ right: "left",
305
+ bottom: "top",
306
+ top: "bottom"
307
+ };
308
+ function getOppositePlacement(placement) {
309
+ return placement.replace(/left|right|bottom|top/g, (matched) => hash$1[matched]);
310
+ }
311
+ function getAlignmentSides(placement, rects) {
312
+ const isStart = getAlignment(placement) === "start";
313
+ const mainAxis = getMainAxisFromPlacement(placement);
314
+ const length = getLengthFromAxis(mainAxis);
315
+ let mainAlignmentSide = mainAxis === "x" ? isStart ? "right" : "left" : isStart ? "bottom" : "top";
316
+ if (rects.reference[length] > rects.floating[length]) {
317
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
318
+ }
319
+ return {
320
+ main: mainAlignmentSide,
321
+ cross: getOppositePlacement(mainAlignmentSide)
322
+ };
323
+ }
324
+ const hash = {
325
+ start: "end",
326
+ end: "start"
327
+ };
328
+ function getOppositeAlignmentPlacement(placement) {
329
+ return placement.replace(/start|end/g, (matched) => hash[matched]);
330
+ }
331
+ const basePlacements = ["top", "right", "bottom", "left"];
332
+ const allPlacements = /* @__PURE__ */ basePlacements.reduce((acc, basePlacement) => acc.concat(basePlacement, basePlacement + "-start", basePlacement + "-end"), []);
333
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
334
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getBasePlacement(placement) === placement);
335
+ return allowedPlacementsSortedByAlignment.filter((placement) => {
336
+ if (alignment) {
337
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
338
+ }
339
+ return true;
340
+ });
341
+ }
342
+ const autoPlacement = function(options) {
343
+ if (options === void 0) {
344
+ options = {};
345
+ }
346
+ return {
347
+ name: "autoPlacement",
348
+ options,
349
+ async fn(middlewareArguments) {
350
+ var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _middlewareData$autoP5, _placementsSortedByLe;
351
+ const {
352
+ x,
353
+ y,
354
+ rects,
355
+ middlewareData,
356
+ placement
357
+ } = middlewareArguments;
358
+ const _a = options, {
359
+ alignment = null,
360
+ allowedPlacements = allPlacements,
361
+ autoAlignment = true
362
+ } = _a, detectOverflowOptions = __objRest(_a, [
363
+ "alignment",
364
+ "allowedPlacements",
365
+ "autoAlignment"
366
+ ]);
367
+ if ((_middlewareData$autoP = middlewareData.autoPlacement) != null && _middlewareData$autoP.skip) {
368
+ return {};
369
+ }
370
+ const placements2 = getPlacementList(alignment, autoAlignment, allowedPlacements);
371
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
372
+ const currentIndex = (_middlewareData$autoP2 = (_middlewareData$autoP3 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP3.index) != null ? _middlewareData$autoP2 : 0;
373
+ const currentPlacement = placements2[currentIndex];
374
+ const {
375
+ main,
376
+ cross
377
+ } = getAlignmentSides(currentPlacement, rects);
378
+ if (placement !== currentPlacement) {
379
+ return {
380
+ x,
381
+ y,
382
+ reset: {
383
+ placement: placements2[0]
384
+ }
385
+ };
386
+ }
387
+ const currentOverflows = [overflow[getBasePlacement(currentPlacement)], overflow[main], overflow[cross]];
388
+ const allOverflows = [...(_middlewareData$autoP4 = (_middlewareData$autoP5 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP5.overflows) != null ? _middlewareData$autoP4 : [], {
389
+ placement: currentPlacement,
390
+ overflows: currentOverflows
391
+ }];
392
+ const nextPlacement = placements2[currentIndex + 1];
393
+ if (nextPlacement) {
394
+ return {
395
+ data: {
396
+ index: currentIndex + 1,
397
+ overflows: allOverflows
398
+ },
399
+ reset: {
400
+ placement: nextPlacement
401
+ }
402
+ };
403
+ }
404
+ const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
405
+ const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find((_ref) => {
406
+ let {
407
+ overflows
408
+ } = _ref;
409
+ return overflows.every((overflow2) => overflow2 <= 0);
410
+ })) == null ? void 0 : _placementsSortedByLe.placement;
411
+ return {
412
+ data: {
413
+ skip: true
414
+ },
415
+ reset: {
416
+ placement: placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement
417
+ }
418
+ };
419
+ }
420
+ };
421
+ };
422
+ function getExpandedPlacements(placement) {
423
+ const oppositePlacement = getOppositePlacement(placement);
424
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
425
+ }
426
+ const flip = function(options) {
427
+ if (options === void 0) {
428
+ options = {};
429
+ }
430
+ return {
431
+ name: "flip",
432
+ options,
433
+ async fn(middlewareArguments) {
434
+ var _middlewareData$flip, _middlewareData$flip2;
435
+ const {
436
+ placement,
437
+ middlewareData,
438
+ rects,
439
+ initialPlacement
440
+ } = middlewareArguments;
441
+ if ((_middlewareData$flip = middlewareData.flip) != null && _middlewareData$flip.skip) {
442
+ return {};
443
+ }
444
+ const _a = options, {
445
+ mainAxis: checkMainAxis = true,
446
+ crossAxis: checkCrossAxis = true,
447
+ fallbackPlacements: specifiedFallbackPlacements,
448
+ fallbackStrategy = "bestFit",
449
+ flipAlignment = true
450
+ } = _a, detectOverflowOptions = __objRest(_a, [
451
+ "mainAxis",
452
+ "crossAxis",
453
+ "fallbackPlacements",
454
+ "fallbackStrategy",
455
+ "flipAlignment"
456
+ ]);
457
+ const basePlacement = getBasePlacement(placement);
458
+ const isBasePlacement = basePlacement === initialPlacement;
459
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
460
+ const placements2 = [initialPlacement, ...fallbackPlacements];
461
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
462
+ const overflows = [];
463
+ let overflowsData = ((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.overflows) || [];
464
+ if (checkMainAxis) {
465
+ overflows.push(overflow[basePlacement]);
466
+ }
467
+ if (checkCrossAxis) {
468
+ const {
469
+ main,
470
+ cross
471
+ } = getAlignmentSides(placement, rects);
472
+ overflows.push(overflow[main], overflow[cross]);
473
+ }
474
+ overflowsData = [...overflowsData, {
475
+ placement,
476
+ overflows
477
+ }];
478
+ if (!overflows.every((side) => side <= 0)) {
479
+ var _middlewareData$flip$, _middlewareData$flip3;
480
+ const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip3 = middlewareData.flip) == null ? void 0 : _middlewareData$flip3.index) != null ? _middlewareData$flip$ : 0) + 1;
481
+ const nextPlacement = placements2[nextIndex];
482
+ if (nextPlacement) {
483
+ return {
484
+ data: {
485
+ index: nextIndex,
486
+ overflows: overflowsData
487
+ },
488
+ reset: {
489
+ placement: nextPlacement
490
+ }
491
+ };
492
+ }
493
+ let resetPlacement = "bottom";
494
+ switch (fallbackStrategy) {
495
+ case "bestFit": {
496
+ var _overflowsData$slice$;
497
+ const placement2 = (_overflowsData$slice$ = overflowsData.slice().sort((a, b) => a.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0) - b.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0))[0]) == null ? void 0 : _overflowsData$slice$.placement;
498
+ if (placement2) {
499
+ resetPlacement = placement2;
500
+ }
501
+ break;
502
+ }
503
+ case "initialPlacement":
504
+ resetPlacement = initialPlacement;
505
+ break;
506
+ }
507
+ return {
508
+ data: {
509
+ skip: true
510
+ },
511
+ reset: {
512
+ placement: resetPlacement
513
+ }
514
+ };
515
+ }
516
+ return {};
517
+ }
518
+ };
519
+ };
520
+ function convertValueToCoords(_ref) {
521
+ let {
522
+ placement,
523
+ rects,
524
+ value
525
+ } = _ref;
526
+ const basePlacement = getBasePlacement(placement);
527
+ const multiplier = ["left", "top"].includes(basePlacement) ? -1 : 1;
528
+ const rawValue = typeof value === "function" ? value(__spreadProps(__spreadValues({}, rects), {
529
+ placement
530
+ })) : value;
531
+ const {
532
+ mainAxis,
533
+ crossAxis
534
+ } = typeof rawValue === "number" ? {
535
+ mainAxis: rawValue,
536
+ crossAxis: 0
537
+ } : __spreadValues({
538
+ mainAxis: 0,
539
+ crossAxis: 0
540
+ }, rawValue);
541
+ return getMainAxisFromPlacement(basePlacement) === "x" ? {
542
+ x: crossAxis,
543
+ y: mainAxis * multiplier
544
+ } : {
545
+ x: mainAxis * multiplier,
546
+ y: crossAxis
547
+ };
548
+ }
549
+ const offset = function(value) {
550
+ if (value === void 0) {
551
+ value = 0;
552
+ }
553
+ return {
554
+ name: "offset",
555
+ options: value,
556
+ fn(middlewareArguments) {
557
+ const {
558
+ x,
559
+ y,
560
+ placement,
561
+ rects
562
+ } = middlewareArguments;
563
+ const diffCoords = convertValueToCoords({
564
+ placement,
565
+ rects,
566
+ value
567
+ });
568
+ return {
569
+ x: x + diffCoords.x,
570
+ y: y + diffCoords.y,
571
+ data: diffCoords
572
+ };
573
+ }
574
+ };
575
+ };
576
+ function getCrossAxis(axis) {
577
+ return axis === "x" ? "y" : "x";
578
+ }
579
+ const shift = function(options) {
580
+ if (options === void 0) {
581
+ options = {};
582
+ }
583
+ return {
584
+ name: "shift",
585
+ options,
586
+ async fn(middlewareArguments) {
587
+ const {
588
+ x,
589
+ y,
590
+ placement
591
+ } = middlewareArguments;
592
+ const _a = options, {
593
+ mainAxis: checkMainAxis = true,
594
+ crossAxis: checkCrossAxis = false,
595
+ limiter = {
596
+ fn: (_ref) => {
597
+ let {
598
+ x: x2,
599
+ y: y2
600
+ } = _ref;
601
+ return {
602
+ x: x2,
603
+ y: y2
604
+ };
605
+ }
606
+ }
607
+ } = _a, detectOverflowOptions = __objRest(_a, [
608
+ "mainAxis",
609
+ "crossAxis",
610
+ "limiter"
611
+ ]);
612
+ const coords = {
613
+ x,
614
+ y
615
+ };
616
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
617
+ const mainAxis = getMainAxisFromPlacement(getBasePlacement(placement));
618
+ const crossAxis = getCrossAxis(mainAxis);
619
+ let mainAxisCoord = coords[mainAxis];
620
+ let crossAxisCoord = coords[crossAxis];
621
+ if (checkMainAxis) {
622
+ const minSide = mainAxis === "y" ? "top" : "left";
623
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
624
+ const min2 = mainAxisCoord + overflow[minSide];
625
+ const max2 = mainAxisCoord - overflow[maxSide];
626
+ mainAxisCoord = within(min2, mainAxisCoord, max2);
627
+ }
628
+ if (checkCrossAxis) {
629
+ const minSide = crossAxis === "y" ? "top" : "left";
630
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
631
+ const min2 = crossAxisCoord + overflow[minSide];
632
+ const max2 = crossAxisCoord - overflow[maxSide];
633
+ crossAxisCoord = within(min2, crossAxisCoord, max2);
634
+ }
635
+ const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, middlewareArguments), {
636
+ [mainAxis]: mainAxisCoord,
637
+ [crossAxis]: crossAxisCoord
638
+ }));
639
+ return __spreadProps(__spreadValues({}, limitedCoords), {
640
+ data: {
641
+ x: limitedCoords.x - x,
642
+ y: limitedCoords.y - y
643
+ }
644
+ });
645
+ }
646
+ };
647
+ };
648
+ const size = function(options) {
649
+ if (options === void 0) {
650
+ options = {};
651
+ }
652
+ return {
653
+ name: "size",
654
+ options,
655
+ async fn(middlewareArguments) {
656
+ var _middlewareData$size;
657
+ const {
658
+ placement,
659
+ rects,
660
+ middlewareData
661
+ } = middlewareArguments;
662
+ const _a = options, {
663
+ apply
664
+ } = _a, detectOverflowOptions = __objRest(_a, [
665
+ "apply"
666
+ ]);
667
+ if ((_middlewareData$size = middlewareData.size) != null && _middlewareData$size.skip) {
668
+ return {};
669
+ }
670
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
671
+ const basePlacement = getBasePlacement(placement);
672
+ const isEnd = getAlignment(placement) === "end";
673
+ let heightSide;
674
+ let widthSide;
675
+ if (basePlacement === "top" || basePlacement === "bottom") {
676
+ heightSide = basePlacement;
677
+ widthSide = isEnd ? "left" : "right";
678
+ } else {
679
+ widthSide = basePlacement;
680
+ heightSide = isEnd ? "top" : "bottom";
681
+ }
682
+ const xMin = max$1(overflow.left, 0);
683
+ const xMax = max$1(overflow.right, 0);
684
+ const yMin = max$1(overflow.top, 0);
685
+ const yMax = max$1(overflow.bottom, 0);
686
+ const dimensions = {
687
+ height: rects.floating.height - (["left", "right"].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)) : overflow[heightSide]),
688
+ width: rects.floating.width - (["top", "bottom"].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : overflow[widthSide])
689
+ };
690
+ apply == null ? void 0 : apply(__spreadValues(__spreadValues({}, dimensions), rects));
691
+ return {
692
+ data: {
693
+ skip: true
694
+ },
695
+ reset: {
696
+ rects: true
697
+ }
698
+ };
699
+ }
700
+ };
701
+ };
702
+ function isWindow(value) {
703
+ return (value == null ? void 0 : value.toString()) === "[object Window]";
704
+ }
705
+ function getWindow(node) {
706
+ if (node == null) {
707
+ return window;
708
+ }
709
+ if (!isWindow(node)) {
710
+ const ownerDocument = node.ownerDocument;
711
+ return ownerDocument ? ownerDocument.defaultView || window : window;
712
+ }
713
+ return node;
714
+ }
715
+ function getComputedStyle$1(element) {
716
+ return getWindow(element).getComputedStyle(element);
717
+ }
718
+ function getNodeName(node) {
719
+ return isWindow(node) ? "" : node ? (node.nodeName || "").toLowerCase() : "";
720
+ }
721
+ function isHTMLElement(value) {
722
+ return value instanceof getWindow(value).HTMLElement;
723
+ }
724
+ function isElement(value) {
725
+ return value instanceof getWindow(value).Element;
726
+ }
727
+ function isNode(value) {
728
+ return value instanceof getWindow(value).Node;
729
+ }
730
+ function isShadowRoot(node) {
731
+ const OwnElement = getWindow(node).ShadowRoot;
732
+ return node instanceof OwnElement || node instanceof ShadowRoot;
733
+ }
734
+ function isScrollParent(element) {
735
+ const {
736
+ overflow,
737
+ overflowX,
738
+ overflowY
739
+ } = getComputedStyle$1(element);
740
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
741
+ }
742
+ function isTableElement(element) {
743
+ return ["table", "td", "th"].includes(getNodeName(element));
744
+ }
745
+ function isContainingBlock(element) {
746
+ const isFirefox = navigator.userAgent.toLowerCase().includes("firefox");
747
+ const css = getComputedStyle$1(element);
748
+ return css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].includes(css.willChange) || isFirefox && css.willChange === "filter" || isFirefox && (css.filter ? css.filter !== "none" : false);
749
+ }
750
+ const min = Math.min;
751
+ const max = Math.max;
752
+ const round = Math.round;
753
+ function getBoundingClientRect(element, includeScale) {
754
+ if (includeScale === void 0) {
755
+ includeScale = false;
756
+ }
757
+ const clientRect = element.getBoundingClientRect();
758
+ let scaleX = 1;
759
+ let scaleY = 1;
760
+ if (includeScale && isHTMLElement(element)) {
761
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
762
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
763
+ }
764
+ return {
765
+ width: clientRect.width / scaleX,
766
+ height: clientRect.height / scaleY,
767
+ top: clientRect.top / scaleY,
768
+ right: clientRect.right / scaleX,
769
+ bottom: clientRect.bottom / scaleY,
770
+ left: clientRect.left / scaleX,
771
+ x: clientRect.left / scaleX,
772
+ y: clientRect.top / scaleY
773
+ };
774
+ }
775
+ function getDocumentElement(node) {
776
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
777
+ }
778
+ function getNodeScroll(element) {
779
+ if (isWindow(element)) {
780
+ return {
781
+ scrollLeft: element.pageXOffset,
782
+ scrollTop: element.pageYOffset
783
+ };
784
+ }
785
+ return {
786
+ scrollLeft: element.scrollLeft,
787
+ scrollTop: element.scrollTop
788
+ };
789
+ }
790
+ function getWindowScrollBarX(element) {
791
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
792
+ }
793
+ function isScaled(element) {
794
+ const rect = getBoundingClientRect(element);
795
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
796
+ }
797
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
798
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
799
+ const documentElement = getDocumentElement(offsetParent);
800
+ const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent));
801
+ let scroll = {
802
+ scrollLeft: 0,
803
+ scrollTop: 0
804
+ };
805
+ const offsets = {
806
+ x: 0,
807
+ y: 0
808
+ };
809
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
810
+ if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
811
+ scroll = getNodeScroll(offsetParent);
812
+ }
813
+ if (isHTMLElement(offsetParent)) {
814
+ const offsetRect = getBoundingClientRect(offsetParent, true);
815
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
816
+ offsets.y = offsetRect.y + offsetParent.clientTop;
817
+ } else if (documentElement) {
818
+ offsets.x = getWindowScrollBarX(documentElement);
819
+ }
820
+ }
821
+ return {
822
+ x: rect.left + scroll.scrollLeft - offsets.x,
823
+ y: rect.top + scroll.scrollTop - offsets.y,
824
+ width: rect.width,
825
+ height: rect.height
826
+ };
827
+ }
828
+ function getParentNode(node) {
829
+ if (getNodeName(node) === "html") {
830
+ return node;
831
+ }
832
+ return node.assignedSlot || node.parentNode || (isShadowRoot(node) ? node.host : null) || getDocumentElement(node);
833
+ }
834
+ function getTrueOffsetParent(element) {
835
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
836
+ return null;
837
+ }
838
+ return element.offsetParent;
839
+ }
840
+ function getContainingBlock(element) {
841
+ let currentNode = getParentNode(element);
842
+ while (isHTMLElement(currentNode) && !["html", "body"].includes(getNodeName(currentNode))) {
843
+ if (isContainingBlock(currentNode)) {
844
+ return currentNode;
845
+ } else {
846
+ currentNode = currentNode.parentNode;
847
+ }
848
+ }
849
+ return null;
850
+ }
851
+ function getOffsetParent(element) {
852
+ const window2 = getWindow(element);
853
+ let offsetParent = getTrueOffsetParent(element);
854
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
855
+ offsetParent = getTrueOffsetParent(offsetParent);
856
+ }
857
+ if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
858
+ return window2;
859
+ }
860
+ return offsetParent || getContainingBlock(element) || window2;
861
+ }
862
+ function getDimensions(element) {
863
+ return {
864
+ width: element.offsetWidth,
865
+ height: element.offsetHeight
866
+ };
867
+ }
868
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
869
+ let {
870
+ rect,
871
+ offsetParent,
872
+ strategy
873
+ } = _ref;
874
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
875
+ const documentElement = getDocumentElement(offsetParent);
876
+ if (offsetParent === documentElement) {
877
+ return rect;
878
+ }
879
+ let scroll = {
880
+ scrollLeft: 0,
881
+ scrollTop: 0
882
+ };
883
+ const offsets = {
884
+ x: 0,
885
+ y: 0
886
+ };
887
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
888
+ if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
889
+ scroll = getNodeScroll(offsetParent);
890
+ }
891
+ if (isHTMLElement(offsetParent)) {
892
+ const offsetRect = getBoundingClientRect(offsetParent, true);
893
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
894
+ offsets.y = offsetRect.y + offsetParent.clientTop;
895
+ }
896
+ }
897
+ return __spreadProps(__spreadValues({}, rect), {
898
+ x: rect.x - scroll.scrollLeft + offsets.x,
899
+ y: rect.y - scroll.scrollTop + offsets.y
900
+ });
901
+ }
902
+ function getViewportRect(element) {
903
+ const win = getWindow(element);
904
+ const html = getDocumentElement(element);
905
+ const visualViewport = win.visualViewport;
906
+ let width = html.clientWidth;
907
+ let height = html.clientHeight;
908
+ let x = 0;
909
+ let y = 0;
910
+ if (visualViewport) {
911
+ width = visualViewport.width;
912
+ height = visualViewport.height;
913
+ if (Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < 0.01) {
914
+ x = visualViewport.offsetLeft;
915
+ y = visualViewport.offsetTop;
916
+ }
917
+ }
918
+ return {
919
+ width,
920
+ height,
921
+ x,
922
+ y
923
+ };
924
+ }
925
+ function getDocumentRect(element) {
926
+ var _element$ownerDocumen;
927
+ const html = getDocumentElement(element);
928
+ const scroll = getNodeScroll(element);
929
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
930
+ const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
931
+ const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
932
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
933
+ const y = -scroll.scrollTop;
934
+ if (getComputedStyle$1(body || html).direction === "rtl") {
935
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
936
+ }
937
+ return {
938
+ width,
939
+ height,
940
+ x,
941
+ y
942
+ };
943
+ }
944
+ function getScrollParent(node) {
945
+ if (["html", "body", "#document"].includes(getNodeName(node))) {
946
+ return node.ownerDocument.body;
947
+ }
948
+ if (isHTMLElement(node) && isScrollParent(node)) {
949
+ return node;
950
+ }
951
+ return getScrollParent(getParentNode(node));
952
+ }
953
+ function getScrollParents(node, list) {
954
+ var _node$ownerDocument;
955
+ if (list === void 0) {
956
+ list = [];
957
+ }
958
+ const scrollParent = getScrollParent(node);
959
+ const isBody = scrollParent === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
960
+ const win = getWindow(scrollParent);
961
+ const target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
962
+ const updatedList = list.concat(target);
963
+ return isBody ? updatedList : updatedList.concat(getScrollParents(getParentNode(target)));
964
+ }
965
+ function contains(parent, child) {
966
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
967
+ if (parent.contains(child)) {
968
+ return true;
969
+ } else if (rootNode && isShadowRoot(rootNode)) {
970
+ let next = child;
971
+ do {
972
+ if (next && parent === next) {
973
+ return true;
974
+ }
975
+ next = next.parentNode || next.host;
976
+ } while (next);
977
+ }
978
+ return false;
979
+ }
980
+ function getInnerBoundingClientRect(element) {
981
+ const clientRect = getBoundingClientRect(element);
982
+ const top = clientRect.top + element.clientTop;
983
+ const left = clientRect.left + element.clientLeft;
984
+ return {
985
+ top,
986
+ left,
987
+ x: left,
988
+ y: top,
989
+ right: left + element.clientWidth,
990
+ bottom: top + element.clientHeight,
991
+ width: element.clientWidth,
992
+ height: element.clientHeight
993
+ };
994
+ }
995
+ function getClientRectFromClippingParent(element, clippingParent) {
996
+ if (clippingParent === "viewport") {
997
+ return rectToClientRect(getViewportRect(element));
998
+ }
999
+ if (isElement(clippingParent)) {
1000
+ return getInnerBoundingClientRect(clippingParent);
1001
+ }
1002
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1003
+ }
1004
+ function getClippingParents(element) {
1005
+ const clippingParents = getScrollParents(getParentNode(element));
1006
+ const canEscapeClipping = ["absolute", "fixed"].includes(getComputedStyle$1(element).position);
1007
+ const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1008
+ if (!isElement(clipperElement)) {
1009
+ return [];
1010
+ }
1011
+ return clippingParents.filter((clippingParent) => isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body");
1012
+ }
1013
+ function getClippingClientRect(_ref) {
1014
+ let {
1015
+ element,
1016
+ boundary,
1017
+ rootBoundary
1018
+ } = _ref;
1019
+ const mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
1020
+ const clippingParents = [...mainClippingParents, rootBoundary];
1021
+ const firstClippingParent = clippingParents[0];
1022
+ const clippingRect = clippingParents.reduce((accRect, clippingParent) => {
1023
+ const rect = getClientRectFromClippingParent(element, clippingParent);
1024
+ accRect.top = max(rect.top, accRect.top);
1025
+ accRect.right = min(rect.right, accRect.right);
1026
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1027
+ accRect.left = max(rect.left, accRect.left);
1028
+ return accRect;
1029
+ }, getClientRectFromClippingParent(element, firstClippingParent));
1030
+ clippingRect.width = clippingRect.right - clippingRect.left;
1031
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
1032
+ clippingRect.x = clippingRect.left;
1033
+ clippingRect.y = clippingRect.top;
1034
+ return clippingRect;
1035
+ }
1036
+ const platform = {
1037
+ getElementRects: (_ref) => {
1038
+ let {
1039
+ reference,
1040
+ floating,
1041
+ strategy
1042
+ } = _ref;
1043
+ return {
1044
+ reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1045
+ floating: __spreadProps(__spreadValues({}, getDimensions(floating)), {
1046
+ x: 0,
1047
+ y: 0
1048
+ })
1049
+ };
1050
+ },
1051
+ convertOffsetParentRelativeRectToViewportRelativeRect: (args) => convertOffsetParentRelativeRectToViewportRelativeRect(args),
1052
+ getOffsetParent: (_ref2) => {
1053
+ let {
1054
+ element
1055
+ } = _ref2;
1056
+ return getOffsetParent(element);
1057
+ },
1058
+ isElement: (value) => isElement(value),
1059
+ getDocumentElement: (_ref3) => {
1060
+ let {
1061
+ element
1062
+ } = _ref3;
1063
+ return getDocumentElement(element);
1064
+ },
1065
+ getClippingClientRect: (args) => getClippingClientRect(args),
1066
+ getDimensions: (_ref4) => {
1067
+ let {
1068
+ element
1069
+ } = _ref4;
1070
+ return getDimensions(element);
1071
+ },
1072
+ getClientRects: (_ref5) => {
1073
+ let {
1074
+ element
1075
+ } = _ref5;
1076
+ return element.getClientRects();
1077
+ }
1078
+ };
1079
+ const computePosition = (reference, floating, options) => computePosition$1(reference, floating, __spreadValues({
1080
+ platform
1081
+ }, options));
1082
+ var __defProp2 = Object.defineProperty;
1083
+ var __defProps2 = Object.defineProperties;
1084
+ var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
1085
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
1086
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1087
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
1088
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1089
+ var __spreadValues2 = (a, b) => {
1090
+ for (var prop in b || (b = {}))
1091
+ if (__hasOwnProp2.call(b, prop))
1092
+ __defNormalProp2(a, prop, b[prop]);
1093
+ if (__getOwnPropSymbols2)
1094
+ for (var prop of __getOwnPropSymbols2(b)) {
1095
+ if (__propIsEnum2.call(b, prop))
1096
+ __defNormalProp2(a, prop, b[prop]);
1097
+ }
1098
+ return a;
1099
+ };
1100
+ var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
1101
+ const config = {
1102
+ disabled: false,
1103
+ distance: 5,
1104
+ skidding: 0,
1105
+ container: "body",
1106
+ boundary: void 0,
1107
+ instantMove: false,
1108
+ disposeTimeout: 5e3,
1109
+ popperTriggers: [],
1110
+ strategy: "absolute",
1111
+ preventOverflow: true,
1112
+ flip: true,
1113
+ shift: true,
1114
+ overflowPadding: 0,
1115
+ arrowPadding: 0,
1116
+ arrowOverflow: true,
1117
+ themes: {
1118
+ tooltip: {
1119
+ placement: "top",
1120
+ triggers: ["hover", "focus", "touch"],
1121
+ hideTriggers: (events) => [...events, "click"],
1122
+ delay: {
1123
+ show: 200,
1124
+ hide: 0
1125
+ },
1126
+ handleResize: false,
1127
+ html: false,
1128
+ loadingContent: "..."
1129
+ },
1130
+ dropdown: {
1131
+ placement: "bottom",
1132
+ triggers: ["click"],
1133
+ delay: 0,
1134
+ handleResize: true,
1135
+ autoHide: true
1136
+ },
1137
+ menu: {
1138
+ $extend: "dropdown",
1139
+ triggers: ["hover", "focus"],
1140
+ popperTriggers: ["hover", "focus"],
1141
+ delay: {
1142
+ show: 0,
1143
+ hide: 400
1144
+ }
1145
+ }
1146
+ }
1147
+ };
1148
+ function getDefaultConfig(theme, key) {
1149
+ let themeConfig = config.themes[theme] || {};
1150
+ let value;
1151
+ do {
1152
+ value = themeConfig[key];
1153
+ if (typeof value === "undefined") {
1154
+ if (themeConfig.$extend) {
1155
+ themeConfig = config.themes[themeConfig.$extend] || {};
1156
+ } else {
1157
+ themeConfig = null;
1158
+ value = config[key];
1159
+ }
1160
+ } else {
1161
+ themeConfig = null;
1162
+ }
1163
+ } while (themeConfig);
1164
+ return value;
1165
+ }
1166
+ function getThemeClasses(theme) {
1167
+ const result = [theme];
1168
+ let themeConfig = config.themes[theme] || {};
1169
+ do {
1170
+ if (themeConfig.$extend && !themeConfig.$resetCss) {
1171
+ result.push(themeConfig.$extend);
1172
+ themeConfig = config.themes[themeConfig.$extend] || {};
1173
+ } else {
1174
+ themeConfig = null;
1175
+ }
1176
+ } while (themeConfig);
1177
+ return result.map((c) => `v-popper--theme-${c}`);
1178
+ }
1179
+ let supportsPassive = false;
1180
+ if (typeof window !== "undefined") {
1181
+ supportsPassive = false;
1182
+ try {
1183
+ const opts = Object.defineProperty({}, "passive", {
1184
+ get() {
1185
+ supportsPassive = true;
1186
+ }
1187
+ });
1188
+ window.addEventListener("test", null, opts);
1189
+ } catch (e) {
1190
+ }
1191
+ }
1192
+ let isIOS = false;
1193
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
1194
+ isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
1195
+ }
1196
+ const placements = ["auto", "top", "bottom", "left", "right"].reduce((acc, base) => acc.concat([
1197
+ base,
1198
+ `${base}-start`,
1199
+ `${base}-end`
1200
+ ]), []);
1201
+ const SHOW_EVENT_MAP = {
1202
+ hover: "mouseenter",
1203
+ focus: "focus",
1204
+ click: "click",
1205
+ touch: "touchstart"
1206
+ };
1207
+ const HIDE_EVENT_MAP = {
1208
+ hover: "mouseleave",
1209
+ focus: "blur",
1210
+ click: "click",
1211
+ touch: "touchend"
1212
+ };
1213
+ function removeFromArray(array, item) {
1214
+ const index = array.indexOf(item);
1215
+ if (index !== -1) {
1216
+ array.splice(index, 1);
1217
+ }
1218
+ }
1219
+ function nextFrame() {
1220
+ return new Promise((resolve) => requestAnimationFrame(() => {
1221
+ requestAnimationFrame(resolve);
1222
+ }));
1223
+ }
1224
+ const shownPoppers = [];
1225
+ let hidingPopper = null;
1226
+ let Element = function() {
1227
+ };
1228
+ if (typeof window !== "undefined") {
1229
+ Element = window.Element;
1230
+ }
1231
+ function defaultPropFactory(prop) {
1232
+ return function(props) {
1233
+ return getDefaultConfig(props.theme, prop);
1234
+ };
1235
+ }
1236
+ var PrivatePopper = () => defineComponent({
1237
+ name: "VPopper",
1238
+ props: {
1239
+ theme: {
1240
+ type: String,
1241
+ required: true
1242
+ },
1243
+ targetNodes: {
1244
+ type: Function,
1245
+ required: true
1246
+ },
1247
+ referenceNode: {
1248
+ type: Function,
1249
+ required: true
1250
+ },
1251
+ popperNode: {
1252
+ type: Function,
1253
+ required: true
1254
+ },
1255
+ shown: {
1256
+ type: Boolean,
1257
+ default: false
1258
+ },
1259
+ showGroup: {
1260
+ type: String,
1261
+ default: null
1262
+ },
1263
+ ariaId: {
1264
+ default: null
1265
+ },
1266
+ disabled: {
1267
+ type: Boolean,
1268
+ default: defaultPropFactory("disabled")
1269
+ },
1270
+ positioningDisabled: {
1271
+ type: Boolean,
1272
+ default: defaultPropFactory("positioningDisabled")
1273
+ },
1274
+ placement: {
1275
+ type: String,
1276
+ default: defaultPropFactory("placement"),
1277
+ validator: (value) => placements.includes(value)
1278
+ },
1279
+ delay: {
1280
+ type: [String, Number, Object],
1281
+ default: defaultPropFactory("delay")
1282
+ },
1283
+ distance: {
1284
+ type: [Number, String],
1285
+ default: defaultPropFactory("distance")
1286
+ },
1287
+ skidding: {
1288
+ type: [Number, String],
1289
+ default: defaultPropFactory("skidding")
1290
+ },
1291
+ triggers: {
1292
+ type: Array,
1293
+ default: defaultPropFactory("triggers")
1294
+ },
1295
+ showTriggers: {
1296
+ type: [Array, Function],
1297
+ default: defaultPropFactory("showTriggers")
1298
+ },
1299
+ hideTriggers: {
1300
+ type: [Array, Function],
1301
+ default: defaultPropFactory("hideTriggers")
1302
+ },
1303
+ popperTriggers: {
1304
+ type: Array,
1305
+ default: defaultPropFactory("popperTriggers")
1306
+ },
1307
+ popperShowTriggers: {
1308
+ type: [Array, Function],
1309
+ default: defaultPropFactory("popperShowTriggers")
1310
+ },
1311
+ popperHideTriggers: {
1312
+ type: [Array, Function],
1313
+ default: defaultPropFactory("popperHideTriggers")
1314
+ },
1315
+ container: {
1316
+ type: [String, Object, Element, Boolean],
1317
+ default: defaultPropFactory("container")
1318
+ },
1319
+ boundary: {
1320
+ type: [String, Element],
1321
+ default: defaultPropFactory("boundary")
1322
+ },
1323
+ strategy: {
1324
+ type: String,
1325
+ validator: (value) => ["absolute", "fixed"].includes(value),
1326
+ default: defaultPropFactory("strategy")
1327
+ },
1328
+ autoHide: {
1329
+ type: Boolean,
1330
+ default: defaultPropFactory("autoHide")
1331
+ },
1332
+ handleResize: {
1333
+ type: Boolean,
1334
+ default: defaultPropFactory("handleResize")
1335
+ },
1336
+ instantMove: {
1337
+ type: Boolean,
1338
+ default: defaultPropFactory("instantMove")
1339
+ },
1340
+ eagerMount: {
1341
+ type: Boolean,
1342
+ default: defaultPropFactory("eagerMount")
1343
+ },
1344
+ popperClass: {
1345
+ type: [String, Array, Object],
1346
+ default: defaultPropFactory("popperClass")
1347
+ },
1348
+ computeTransformOrigin: {
1349
+ type: Boolean,
1350
+ default: defaultPropFactory("computeTransformOrigin")
1351
+ },
1352
+ autoMinSize: {
1353
+ type: Boolean,
1354
+ default: defaultPropFactory("autoMinSize")
1355
+ },
1356
+ autoSize: {
1357
+ type: [Boolean, String],
1358
+ default: defaultPropFactory("autoSize")
1359
+ },
1360
+ autoMaxSize: {
1361
+ type: Boolean,
1362
+ default: defaultPropFactory("autoMaxSize")
1363
+ },
1364
+ autoBoundaryMaxSize: {
1365
+ type: Boolean,
1366
+ default: defaultPropFactory("autoBoundaryMaxSize")
1367
+ },
1368
+ preventOverflow: {
1369
+ type: Boolean,
1370
+ default: defaultPropFactory("preventOverflow")
1371
+ },
1372
+ overflowPadding: {
1373
+ type: [Number, String],
1374
+ default: defaultPropFactory("overflowPadding")
1375
+ },
1376
+ arrowPadding: {
1377
+ type: [Number, String],
1378
+ default: defaultPropFactory("arrowPadding")
1379
+ },
1380
+ arrowOverflow: {
1381
+ type: Boolean,
1382
+ default: defaultPropFactory("arrowOverflow")
1383
+ },
1384
+ flip: {
1385
+ type: Boolean,
1386
+ default: defaultPropFactory("flip")
1387
+ },
1388
+ shift: {
1389
+ type: Boolean,
1390
+ default: defaultPropFactory("shift")
1391
+ },
1392
+ shiftCrossAxis: {
1393
+ type: Boolean,
1394
+ default: defaultPropFactory("shiftCrossAxis")
1395
+ }
1396
+ },
1397
+ emits: [
1398
+ "show",
1399
+ "hide",
1400
+ "update:shown",
1401
+ "apply-show",
1402
+ "apply-hide",
1403
+ "close-group",
1404
+ "close-directive",
1405
+ "auto-hide",
1406
+ "resize",
1407
+ "dispose"
1408
+ ],
1409
+ data() {
1410
+ return {
1411
+ isShown: false,
1412
+ isMounted: false,
1413
+ skipTransition: false,
1414
+ classes: {
1415
+ showFrom: false,
1416
+ showTo: false,
1417
+ hideFrom: false,
1418
+ hideTo: true
1419
+ },
1420
+ result: {
1421
+ x: 0,
1422
+ y: 0,
1423
+ placement: "",
1424
+ strategy: this.strategy,
1425
+ arrow: {
1426
+ x: 0,
1427
+ y: 0,
1428
+ centerOffset: 0
1429
+ },
1430
+ transformOrigin: null
1431
+ }
1432
+ };
1433
+ },
1434
+ computed: {
1435
+ popperId() {
1436
+ return this.ariaId != null ? this.ariaId : this.randomId;
1437
+ },
1438
+ shouldMountContent() {
1439
+ return this.eagerMount || this.isMounted;
1440
+ },
1441
+ slotData() {
1442
+ return {
1443
+ popperId: this.popperId,
1444
+ isShown: this.isShown,
1445
+ shouldMountContent: this.shouldMountContent,
1446
+ skipTransition: this.skipTransition,
1447
+ autoHide: this.autoHide,
1448
+ show: this.show,
1449
+ hide: this.hide,
1450
+ handleResize: this.handleResize,
1451
+ onResize: this.onResize,
1452
+ classes: __spreadProps2(__spreadValues2({}, this.classes), {
1453
+ popperClass: this.popperClass
1454
+ }),
1455
+ result: this.positioningDisabled ? null : this.result
1456
+ };
1457
+ }
1458
+ },
1459
+ watch: __spreadValues2(__spreadValues2({
1460
+ shown: "$_autoShowHide",
1461
+ disabled(value) {
1462
+ if (value) {
1463
+ this.dispose();
1464
+ } else {
1465
+ this.init();
1466
+ }
1467
+ },
1468
+ async container() {
1469
+ if (this.isShown) {
1470
+ this.$_ensureTeleport();
1471
+ await this.$_computePosition();
1472
+ }
1473
+ }
1474
+ }, [
1475
+ "triggers",
1476
+ "positioningDisabled"
1477
+ ].reduce((acc, prop) => {
1478
+ acc[prop] = "$_refreshListeners";
1479
+ return acc;
1480
+ }, {})), [
1481
+ "placement",
1482
+ "distance",
1483
+ "skidding",
1484
+ "boundary",
1485
+ "strategy",
1486
+ "overflowPadding",
1487
+ "arrowPadding",
1488
+ "preventOverflow",
1489
+ "shift",
1490
+ "shiftCrossAxis",
1491
+ "flip"
1492
+ ].reduce((acc, prop) => {
1493
+ acc[prop] = "$_computePosition";
1494
+ return acc;
1495
+ }, {})),
1496
+ created() {
1497
+ this.$_isDisposed = true;
1498
+ this.randomId = `popper_${[Math.random(), Date.now()].map((n) => n.toString(36).substring(2, 10)).join("_")}`;
1499
+ if (this.autoMinSize) {
1500
+ console.warn('[floating-vue] `autoMinSize` option is deprecated. Use `autoSize="min"` instead.');
1501
+ }
1502
+ if (this.autoMaxSize) {
1503
+ console.warn("[floating-vue] `autoMaxSize` option is deprecated. Use `autoBoundaryMaxSize` instead.");
1504
+ }
1505
+ },
1506
+ mounted() {
1507
+ this.init();
1508
+ this.$_detachPopperNode();
1509
+ },
1510
+ activated() {
1511
+ this.$_autoShowHide();
1512
+ },
1513
+ deactivated() {
1514
+ this.hide();
1515
+ },
1516
+ beforeUnmount() {
1517
+ this.dispose();
1518
+ },
1519
+ methods: {
1520
+ show({ event = null, skipDelay = false, force = false } = {}) {
1521
+ if (force || !this.disabled) {
1522
+ this.$_scheduleShow(event, skipDelay);
1523
+ this.$emit("show");
1524
+ this.$_showFrameLocked = true;
1525
+ requestAnimationFrame(() => {
1526
+ this.$_showFrameLocked = false;
1527
+ });
1528
+ }
1529
+ this.$emit("update:shown", true);
1530
+ },
1531
+ hide({ event = null, skipDelay = false } = {}) {
1532
+ if (this.$_hideInProgress)
1533
+ return;
1534
+ this.$_scheduleHide(event, skipDelay);
1535
+ this.$emit("hide");
1536
+ this.$emit("update:shown", false);
1537
+ },
1538
+ init() {
1539
+ if (!this.$_isDisposed)
1540
+ return;
1541
+ this.$_isDisposed = false;
1542
+ this.isMounted = false;
1543
+ this.$_events = [];
1544
+ this.$_preventShow = false;
1545
+ this.$_referenceNode = this.referenceNode();
1546
+ this.$_targetNodes = this.targetNodes().filter((e) => e.nodeType === e.ELEMENT_NODE);
1547
+ this.$_popperNode = this.popperNode();
1548
+ this.$_innerNode = this.$_popperNode.querySelector(".v-popper__inner");
1549
+ this.$_arrowNode = this.$_popperNode.querySelector(".v-popper__arrow-container");
1550
+ this.$_swapTargetAttrs("title", "data-original-title");
1551
+ this.$_detachPopperNode();
1552
+ if (this.triggers.length) {
1553
+ this.$_addEventListeners();
1554
+ }
1555
+ if (this.shown) {
1556
+ this.show();
1557
+ }
1558
+ },
1559
+ dispose() {
1560
+ if (this.$_isDisposed)
1561
+ return;
1562
+ this.$_isDisposed = true;
1563
+ this.$_removeEventListeners();
1564
+ this.hide({ skipDelay: true });
1565
+ this.$_detachPopperNode();
1566
+ this.isMounted = false;
1567
+ this.isShown = false;
1568
+ this.$_swapTargetAttrs("data-original-title", "title");
1569
+ this.$emit("dispose");
1570
+ },
1571
+ async onResize() {
1572
+ if (this.isShown) {
1573
+ await this.$_computePosition();
1574
+ this.$emit("resize");
1575
+ }
1576
+ },
1577
+ async $_computePosition() {
1578
+ var _a;
1579
+ if (this.$_isDisposed || this.positioningDisabled)
1580
+ return;
1581
+ const options2 = {
1582
+ strategy: this.strategy,
1583
+ middleware: []
1584
+ };
1585
+ if (this.distance || this.skidding) {
1586
+ options2.middleware.push(offset({
1587
+ mainAxis: this.distance,
1588
+ crossAxis: this.skidding
1589
+ }));
1590
+ }
1591
+ const isPlacementAuto = this.placement.startsWith("auto");
1592
+ if (isPlacementAuto) {
1593
+ options2.middleware.push(autoPlacement({
1594
+ alignment: (_a = this.placement.split("-")[1]) != null ? _a : ""
1595
+ }));
1596
+ } else {
1597
+ options2.placement = this.placement;
1598
+ }
1599
+ if (this.preventOverflow) {
1600
+ if (this.shift) {
1601
+ options2.middleware.push(shift({
1602
+ padding: this.overflowPadding,
1603
+ boundary: this.boundary,
1604
+ crossAxis: this.shiftCrossAxis
1605
+ }));
1606
+ }
1607
+ if (!isPlacementAuto && this.flip) {
1608
+ options2.middleware.push(flip({
1609
+ padding: this.overflowPadding,
1610
+ boundary: this.boundary
1611
+ }));
1612
+ }
1613
+ }
1614
+ options2.middleware.push(arrow({
1615
+ element: this.$_arrowNode,
1616
+ padding: this.arrowPadding
1617
+ }));
1618
+ if (this.arrowOverflow) {
1619
+ options2.middleware.push({
1620
+ name: "arrowOverflow",
1621
+ fn: ({ placement, rects, middlewareData }) => {
1622
+ let overflow;
1623
+ const { centerOffset } = middlewareData.arrow;
1624
+ if (placement.startsWith("top") || placement.startsWith("bottom")) {
1625
+ overflow = Math.abs(centerOffset) > rects.reference.width / 2;
1626
+ } else {
1627
+ overflow = Math.abs(centerOffset) > rects.reference.height / 2;
1628
+ }
1629
+ return {
1630
+ data: {
1631
+ overflow
1632
+ }
1633
+ };
1634
+ }
1635
+ });
1636
+ }
1637
+ if (this.autoMinSize || this.autoSize) {
1638
+ const autoSize = this.autoSize ? this.autoSize : this.autoMinSize ? "min" : null;
1639
+ options2.middleware.push({
1640
+ name: "autoSize",
1641
+ fn: ({ rects, placement, middlewareData }) => {
1642
+ var _a2;
1643
+ if ((_a2 = middlewareData.autoSize) == null ? void 0 : _a2.skip) {
1644
+ return {};
1645
+ }
1646
+ let width;
1647
+ let height;
1648
+ if (placement.startsWith("top") || placement.startsWith("bottom")) {
1649
+ width = rects.reference.width;
1650
+ } else {
1651
+ height = rects.reference.height;
1652
+ }
1653
+ this.$_innerNode.style[autoSize === "min" ? "minWidth" : autoSize === "max" ? "maxWidth" : "width"] = width != null ? `${width}px` : null;
1654
+ this.$_innerNode.style[autoSize === "min" ? "minHeight" : autoSize === "max" ? "maxHeight" : "height"] = height != null ? `${height}px` : null;
1655
+ return {
1656
+ data: {
1657
+ skip: true
1658
+ },
1659
+ reset: {
1660
+ rects: true
1661
+ }
1662
+ };
1663
+ }
1664
+ });
1665
+ }
1666
+ if (this.autoMaxSize || this.autoBoundaryMaxSize) {
1667
+ this.$_innerNode.style.maxWidth = null;
1668
+ this.$_innerNode.style.maxHeight = null;
1669
+ options2.middleware.push(size({
1670
+ boundary: this.boundary,
1671
+ padding: this.overflowPadding,
1672
+ apply: ({ width, height }) => {
1673
+ this.$_innerNode.style.maxWidth = width != null ? `${width}px` : null;
1674
+ this.$_innerNode.style.maxHeight = height != null ? `${height}px` : null;
1675
+ }
1676
+ }));
1677
+ }
1678
+ const data = await computePosition(this.$_referenceNode, this.$_popperNode, options2);
1679
+ Object.assign(this.result, {
1680
+ x: data.x,
1681
+ y: data.y,
1682
+ placement: data.placement,
1683
+ strategy: data.strategy,
1684
+ arrow: __spreadValues2(__spreadValues2({}, data.middlewareData.arrow), data.middlewareData.arrowOverflow)
1685
+ });
1686
+ },
1687
+ $_scheduleShow(event = null, skipDelay = false) {
1688
+ this.$_hideInProgress = false;
1689
+ clearTimeout(this.$_scheduleTimer);
1690
+ if (hidingPopper && this.instantMove && hidingPopper.instantMove) {
1691
+ hidingPopper.$_applyHide(true);
1692
+ this.$_applyShow(true);
1693
+ return;
1694
+ }
1695
+ if (skipDelay) {
1696
+ this.$_applyShow();
1697
+ } else {
1698
+ this.$_scheduleTimer = setTimeout(this.$_applyShow.bind(this), this.$_computeDelay("show"));
1699
+ }
1700
+ },
1701
+ $_scheduleHide(event = null, skipDelay = false) {
1702
+ this.$_hideInProgress = true;
1703
+ clearTimeout(this.$_scheduleTimer);
1704
+ if (this.isShown) {
1705
+ hidingPopper = this;
1706
+ }
1707
+ if (skipDelay) {
1708
+ this.$_applyHide();
1709
+ } else {
1710
+ this.$_scheduleTimer = setTimeout(this.$_applyHide.bind(this), this.$_computeDelay("hide"));
1711
+ }
1712
+ },
1713
+ $_computeDelay(type) {
1714
+ const delay = this.delay;
1715
+ return parseInt(delay && delay[type] || delay || 0);
1716
+ },
1717
+ async $_applyShow(skipTransition = false) {
1718
+ clearTimeout(this.$_disposeTimer);
1719
+ clearTimeout(this.$_scheduleTimer);
1720
+ this.skipTransition = skipTransition;
1721
+ if (this.isShown) {
1722
+ return;
1723
+ }
1724
+ this.$_ensureTeleport();
1725
+ await nextFrame();
1726
+ await this.$_computePosition();
1727
+ await this.$_applyShowEffect();
1728
+ if (!this.positioningDisabled) {
1729
+ this.$_registerEventListeners([
1730
+ ...getScrollParents(this.$_referenceNode),
1731
+ ...getScrollParents(this.$_popperNode)
1732
+ ], "scroll", () => {
1733
+ this.$_computePosition();
1734
+ });
1735
+ }
1736
+ },
1737
+ async $_applyShowEffect() {
1738
+ if (this.$_hideInProgress)
1739
+ return;
1740
+ if (this.computeTransformOrigin) {
1741
+ const bounds = this.$_referenceNode.getBoundingClientRect();
1742
+ const popperWrapper = this.$_popperNode.querySelector(".v-popper__wrapper");
1743
+ const parentBounds = popperWrapper.parentNode.getBoundingClientRect();
1744
+ const x = bounds.x + bounds.width / 2 - (parentBounds.left + popperWrapper.offsetLeft);
1745
+ const y = bounds.y + bounds.height / 2 - (parentBounds.top + popperWrapper.offsetTop);
1746
+ this.result.transformOrigin = `${x}px ${y}px`;
1747
+ }
1748
+ this.isShown = true;
1749
+ this.$_applyAttrsToTarget({
1750
+ "aria-describedby": this.popperId,
1751
+ "data-popper-shown": ""
1752
+ });
1753
+ const showGroup = this.showGroup;
1754
+ if (showGroup) {
1755
+ let popover;
1756
+ for (let i = 0; i < shownPoppers.length; i++) {
1757
+ popover = shownPoppers[i];
1758
+ if (popover.showGroup !== showGroup) {
1759
+ popover.hide();
1760
+ popover.$emit("close-group");
1761
+ }
1762
+ }
1763
+ }
1764
+ shownPoppers.push(this);
1765
+ this.$emit("apply-show");
1766
+ this.classes.showFrom = true;
1767
+ this.classes.showTo = false;
1768
+ this.classes.hideFrom = false;
1769
+ this.classes.hideTo = false;
1770
+ await nextFrame();
1771
+ this.classes.showFrom = false;
1772
+ this.classes.showTo = true;
1773
+ },
1774
+ async $_applyHide(skipTransition = false) {
1775
+ clearTimeout(this.$_scheduleTimer);
1776
+ if (!this.isShown) {
1777
+ return;
1778
+ }
1779
+ this.skipTransition = skipTransition;
1780
+ removeFromArray(shownPoppers, this);
1781
+ if (hidingPopper === this) {
1782
+ hidingPopper = null;
1783
+ }
1784
+ this.isShown = false;
1785
+ this.$_applyAttrsToTarget({
1786
+ "aria-describedby": void 0,
1787
+ "data-popper-shown": void 0
1788
+ });
1789
+ clearTimeout(this.$_disposeTimer);
1790
+ const disposeTime = getDefaultConfig(this.theme, "disposeTimeout");
1791
+ if (disposeTime !== null) {
1792
+ this.$_disposeTimer = setTimeout(() => {
1793
+ if (this.$_popperNode) {
1794
+ this.$_detachPopperNode();
1795
+ this.isMounted = false;
1796
+ }
1797
+ }, disposeTime);
1798
+ }
1799
+ this.$_removeEventListeners("scroll");
1800
+ this.$emit("apply-hide");
1801
+ this.classes.showFrom = false;
1802
+ this.classes.showTo = false;
1803
+ this.classes.hideFrom = true;
1804
+ this.classes.hideTo = false;
1805
+ await nextFrame();
1806
+ this.classes.hideFrom = false;
1807
+ this.classes.hideTo = true;
1808
+ },
1809
+ $_autoShowHide() {
1810
+ if (this.shown) {
1811
+ this.show();
1812
+ } else {
1813
+ this.hide();
1814
+ }
1815
+ },
1816
+ $_ensureTeleport() {
1817
+ if (this.$_isDisposed)
1818
+ return;
1819
+ let container = this.container;
1820
+ if (typeof container === "string") {
1821
+ container = window.document.querySelector(container);
1822
+ } else if (container === false) {
1823
+ container = this.$_targetNodes[0].parentNode;
1824
+ }
1825
+ if (!container) {
1826
+ throw new Error("No container for popover: " + this.container);
1827
+ }
1828
+ container.appendChild(this.$_popperNode);
1829
+ this.isMounted = true;
1830
+ },
1831
+ $_addEventListeners() {
1832
+ const handleShow = (event) => {
1833
+ if (this.isShown && !this.$_hideInProgress) {
1834
+ return;
1835
+ }
1836
+ event.usedByTooltip = true;
1837
+ !this.$_preventShow && this.show({ event });
1838
+ };
1839
+ this.$_registerTriggerListeners(this.$_targetNodes, SHOW_EVENT_MAP, this.triggers, this.showTriggers, handleShow);
1840
+ this.$_registerTriggerListeners([this.$_popperNode], SHOW_EVENT_MAP, this.popperTriggers, this.popperShowTriggers, handleShow);
1841
+ const handleHide = (event) => {
1842
+ if (event.usedByTooltip) {
1843
+ return;
1844
+ }
1845
+ this.hide({ event });
1846
+ };
1847
+ this.$_registerTriggerListeners(this.$_targetNodes, HIDE_EVENT_MAP, this.triggers, this.hideTriggers, handleHide);
1848
+ this.$_registerTriggerListeners([this.$_popperNode], HIDE_EVENT_MAP, this.popperTriggers, this.popperHideTriggers, handleHide);
1849
+ },
1850
+ $_registerEventListeners(targetNodes, eventType, handler) {
1851
+ this.$_events.push({ targetNodes, eventType, handler });
1852
+ targetNodes.forEach((node) => node.addEventListener(eventType, handler, supportsPassive ? {
1853
+ passive: true
1854
+ } : void 0));
1855
+ },
1856
+ $_registerTriggerListeners(targetNodes, eventMap, commonTriggers, customTrigger, handler) {
1857
+ let triggers = commonTriggers;
1858
+ if (customTrigger != null) {
1859
+ triggers = typeof customTrigger === "function" ? customTrigger(triggers) : customTrigger;
1860
+ }
1861
+ triggers.forEach((trigger) => {
1862
+ const eventType = eventMap[trigger];
1863
+ if (eventType) {
1864
+ this.$_registerEventListeners(targetNodes, eventType, handler);
1865
+ }
1866
+ });
1867
+ },
1868
+ $_removeEventListeners(filterEventType) {
1869
+ const newList = [];
1870
+ this.$_events.forEach((listener) => {
1871
+ const { targetNodes, eventType, handler } = listener;
1872
+ if (!filterEventType || filterEventType === eventType) {
1873
+ targetNodes.forEach((node) => node.removeEventListener(eventType, handler));
1874
+ } else {
1875
+ newList.push(listener);
1876
+ }
1877
+ });
1878
+ this.$_events = newList;
1879
+ },
1880
+ $_refreshListeners() {
1881
+ if (!this.$_isDisposed) {
1882
+ this.$_removeEventListeners();
1883
+ this.$_addEventListeners();
1884
+ }
1885
+ },
1886
+ $_handleGlobalClose(event, touch = false) {
1887
+ if (this.$_showFrameLocked)
1888
+ return;
1889
+ this.hide({ event });
1890
+ if (event.closePopover) {
1891
+ this.$emit("close-directive");
1892
+ } else {
1893
+ this.$emit("auto-hide");
1894
+ }
1895
+ if (touch) {
1896
+ this.$_preventShow = true;
1897
+ setTimeout(() => {
1898
+ this.$_preventShow = false;
1899
+ }, 300);
1900
+ }
1901
+ },
1902
+ $_detachPopperNode() {
1903
+ this.$_popperNode.parentNode && this.$_popperNode.parentNode.removeChild(this.$_popperNode);
1904
+ },
1905
+ $_swapTargetAttrs(attrFrom, attrTo) {
1906
+ for (const el of this.$_targetNodes) {
1907
+ const value = el.getAttribute(attrFrom);
1908
+ if (value) {
1909
+ el.removeAttribute(attrFrom);
1910
+ el.setAttribute(attrTo, value);
1911
+ }
1912
+ }
1913
+ },
1914
+ $_applyAttrsToTarget(attrs) {
1915
+ for (const el of this.$_targetNodes) {
1916
+ for (const n in attrs) {
1917
+ const value = attrs[n];
1918
+ if (value == null) {
1919
+ el.removeAttribute(n);
1920
+ } else {
1921
+ el.setAttribute(n, value);
1922
+ }
1923
+ }
1924
+ }
1925
+ }
1926
+ },
1927
+ render() {
1928
+ return this.$slots.default(this.slotData);
1929
+ }
1930
+ });
1931
+ if (typeof document !== "undefined" && typeof window !== "undefined") {
1932
+ if (isIOS) {
1933
+ document.addEventListener("touchstart", handleGlobalMousedown, supportsPassive ? {
1934
+ passive: true,
1935
+ capture: true
1936
+ } : true);
1937
+ document.addEventListener("touchend", handleGlobalTouchend, supportsPassive ? {
1938
+ passive: true,
1939
+ capture: true
1940
+ } : true);
1941
+ } else {
1942
+ window.addEventListener("mousedown", handleGlobalMousedown, true);
1943
+ window.addEventListener("click", handleGlobalClick, true);
1944
+ }
1945
+ window.addEventListener("resize", computePositionAllShownPoppers);
1946
+ }
1947
+ function handleGlobalMousedown(event) {
1948
+ for (let i = 0; i < shownPoppers.length; i++) {
1949
+ const popper = shownPoppers[i];
1950
+ try {
1951
+ const popperContent = popper.popperNode();
1952
+ popper.$_mouseDownContains = popperContent.contains(event.target);
1953
+ } catch (e) {
1954
+ }
1955
+ }
1956
+ }
1957
+ function handleGlobalClick(event) {
1958
+ handleGlobalClose(event);
1959
+ }
1960
+ function handleGlobalTouchend(event) {
1961
+ handleGlobalClose(event, true);
1962
+ }
1963
+ function handleGlobalClose(event, touch = false) {
1964
+ for (let i = 0; i < shownPoppers.length; i++) {
1965
+ const popper = shownPoppers[i];
1966
+ try {
1967
+ const popperContent = popper.popperNode();
1968
+ const contains2 = popper.$_mouseDownContains || popperContent.contains(event.target);
1969
+ requestAnimationFrame(() => {
1970
+ if (event.closeAllPopover || event.closePopover && contains2 || popper.autoHide && !contains2) {
1971
+ popper.$_handleGlobalClose(event, touch);
1972
+ }
1973
+ });
1974
+ } catch (e) {
1975
+ }
1976
+ }
1977
+ }
1978
+ function computePositionAllShownPoppers(event) {
1979
+ for (let i = 0; i < shownPoppers.length; i++) {
1980
+ const popper = shownPoppers[i];
1981
+ popper.$_computePosition(event);
1982
+ }
1983
+ }
1984
+ function getInternetExplorerVersion() {
1985
+ var ua = window.navigator.userAgent;
1986
+ var msie = ua.indexOf("MSIE ");
1987
+ if (msie > 0) {
1988
+ return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)), 10);
1989
+ }
1990
+ var trident = ua.indexOf("Trident/");
1991
+ if (trident > 0) {
1992
+ var rv = ua.indexOf("rv:");
1993
+ return parseInt(ua.substring(rv + 3, ua.indexOf(".", rv)), 10);
1994
+ }
1995
+ var edge = ua.indexOf("Edge/");
1996
+ if (edge > 0) {
1997
+ return parseInt(ua.substring(edge + 5, ua.indexOf(".", edge)), 10);
1998
+ }
1999
+ return -1;
2000
+ }
2001
+ let isIE;
2002
+ function initCompat() {
2003
+ if (!initCompat.init) {
2004
+ initCompat.init = true;
2005
+ isIE = getInternetExplorerVersion() !== -1;
2006
+ }
2007
+ }
2008
+ var script = {
2009
+ name: "ResizeObserver",
2010
+ props: {
2011
+ emitOnMount: {
2012
+ type: Boolean,
2013
+ default: false
2014
+ },
2015
+ ignoreWidth: {
2016
+ type: Boolean,
2017
+ default: false
2018
+ },
2019
+ ignoreHeight: {
2020
+ type: Boolean,
2021
+ default: false
2022
+ }
2023
+ },
2024
+ emits: [
2025
+ "notify"
2026
+ ],
2027
+ mounted() {
2028
+ initCompat();
2029
+ nextTick(() => {
2030
+ this._w = this.$el.offsetWidth;
2031
+ this._h = this.$el.offsetHeight;
2032
+ if (this.emitOnMount) {
2033
+ this.emitSize();
2034
+ }
2035
+ });
2036
+ const object = document.createElement("object");
2037
+ this._resizeObject = object;
2038
+ object.setAttribute("aria-hidden", "true");
2039
+ object.setAttribute("tabindex", -1);
2040
+ object.onload = this.addResizeHandlers;
2041
+ object.type = "text/html";
2042
+ if (isIE) {
2043
+ this.$el.appendChild(object);
2044
+ }
2045
+ object.data = "about:blank";
2046
+ if (!isIE) {
2047
+ this.$el.appendChild(object);
2048
+ }
2049
+ },
2050
+ beforeUnmount() {
2051
+ this.removeResizeHandlers();
2052
+ },
2053
+ methods: {
2054
+ compareAndNotify() {
2055
+ if (!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) {
2056
+ this._w = this.$el.offsetWidth;
2057
+ this._h = this.$el.offsetHeight;
2058
+ this.emitSize();
2059
+ }
2060
+ },
2061
+ emitSize() {
2062
+ this.$emit("notify", {
2063
+ width: this._w,
2064
+ height: this._h
2065
+ });
2066
+ },
2067
+ addResizeHandlers() {
2068
+ this._resizeObject.contentDocument.defaultView.addEventListener("resize", this.compareAndNotify);
2069
+ this.compareAndNotify();
2070
+ },
2071
+ removeResizeHandlers() {
2072
+ if (this._resizeObject && this._resizeObject.onload) {
2073
+ if (!isIE && this._resizeObject.contentDocument) {
2074
+ this._resizeObject.contentDocument.defaultView.removeEventListener("resize", this.compareAndNotify);
2075
+ }
2076
+ this.$el.removeChild(this._resizeObject);
2077
+ this._resizeObject.onload = null;
2078
+ this._resizeObject = null;
2079
+ }
2080
+ }
2081
+ }
2082
+ };
2083
+ const _withId = /* @__PURE__ */ withScopeId("data-v-b329ee4c");
2084
+ pushScopeId("data-v-b329ee4c");
2085
+ const _hoisted_1$2$1 = {
2086
+ class: "resize-observer",
2087
+ tabindex: "-1"
2088
+ };
2089
+ popScopeId();
2090
+ const render = /* @__PURE__ */ _withId((_ctx, _cache, $props, $setup, $data, $options) => {
2091
+ return openBlock(), createBlock("div", _hoisted_1$2$1);
2092
+ });
2093
+ script.render = render;
2094
+ script.__scopeId = "data-v-b329ee4c";
2095
+ script.__file = "src/components/ResizeObserver.vue";
2096
+ var PrivateThemeClass = (prop = "theme") => ({
2097
+ computed: {
2098
+ themeClass() {
2099
+ return getThemeClasses(this[prop]);
2100
+ }
2101
+ }
2102
+ });
2103
+ var _export_sfc = (sfc, props) => {
2104
+ const target = sfc.__vccOpts || sfc;
2105
+ for (const [key, val] of props) {
2106
+ target[key] = val;
2107
+ }
2108
+ return target;
2109
+ };
2110
+ const _sfc_main$5 = defineComponent({
2111
+ name: "VPopperContent",
2112
+ components: {
2113
+ ResizeObserver: script
2114
+ },
2115
+ mixins: [
2116
+ PrivateThemeClass()
2117
+ ],
2118
+ props: {
2119
+ popperId: String,
2120
+ theme: String,
2121
+ shown: Boolean,
2122
+ mounted: Boolean,
2123
+ skipTransition: Boolean,
2124
+ autoHide: Boolean,
2125
+ handleResize: Boolean,
2126
+ classes: Object,
2127
+ result: Object
2128
+ },
2129
+ emits: [
2130
+ "hide",
2131
+ "resize"
2132
+ ],
2133
+ methods: {
2134
+ toPx(value) {
2135
+ if (value != null && !isNaN(value)) {
2136
+ return `${value}px`;
2137
+ }
2138
+ return null;
2139
+ }
2140
+ }
2141
+ });
2142
+ const _hoisted_1$1$1 = ["id", "aria-hidden", "tabindex", "data-popper-placement"];
2143
+ const _hoisted_2$1$1 = {
2144
+ ref: "inner",
2145
+ class: "v-popper__inner"
2146
+ };
2147
+ const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-outer" }, null, -1);
2148
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-inner" }, null, -1);
2149
+ const _hoisted_5 = [
2150
+ _hoisted_3$2,
2151
+ _hoisted_4
2152
+ ];
2153
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
2154
+ const _component_ResizeObserver = resolveComponent("ResizeObserver");
2155
+ return openBlock(), createElementBlock("div", {
2156
+ id: _ctx.popperId,
2157
+ ref: "popover",
2158
+ class: normalizeClass(["v-popper__popper", [
2159
+ _ctx.themeClass,
2160
+ _ctx.classes.popperClass,
2161
+ {
2162
+ "v-popper__popper--shown": _ctx.shown,
2163
+ "v-popper__popper--hidden": !_ctx.shown,
2164
+ "v-popper__popper--show-from": _ctx.classes.showFrom,
2165
+ "v-popper__popper--show-to": _ctx.classes.showTo,
2166
+ "v-popper__popper--hide-from": _ctx.classes.hideFrom,
2167
+ "v-popper__popper--hide-to": _ctx.classes.hideTo,
2168
+ "v-popper__popper--skip-transition": _ctx.skipTransition,
2169
+ "v-popper__popper--arrow-overflow": _ctx.result && _ctx.result.arrow.overflow,
2170
+ "v-popper__popper--no-positioning": !_ctx.result
2171
+ }
2172
+ ]]),
2173
+ style: normalizeStyle(_ctx.result ? {
2174
+ position: _ctx.result.strategy,
2175
+ transform: `translate3d(${Math.round(_ctx.result.x)}px,${Math.round(_ctx.result.y)}px,0)`
2176
+ } : void 0),
2177
+ "aria-hidden": _ctx.shown ? "false" : "true",
2178
+ tabindex: _ctx.autoHide ? 0 : void 0,
2179
+ "data-popper-placement": _ctx.result ? _ctx.result.placement : void 0,
2180
+ onKeyup: _cache[2] || (_cache[2] = withKeys(($event) => _ctx.autoHide && _ctx.$emit("hide"), ["esc"]))
2181
+ }, [
2182
+ createElementVNode("div", {
2183
+ class: "v-popper__backdrop",
2184
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.autoHide && _ctx.$emit("hide"))
2185
+ }),
2186
+ createElementVNode("div", {
2187
+ class: "v-popper__wrapper",
2188
+ style: normalizeStyle(_ctx.result ? {
2189
+ transformOrigin: _ctx.result.transformOrigin
2190
+ } : void 0)
2191
+ }, [
2192
+ createElementVNode("div", _hoisted_2$1$1, [
2193
+ _ctx.mounted ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2194
+ createElementVNode("div", null, [
2195
+ renderSlot(_ctx.$slots, "default")
2196
+ ]),
2197
+ _ctx.handleResize ? (openBlock(), createBlock(_component_ResizeObserver, {
2198
+ key: 0,
2199
+ onNotify: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("resize", $event))
2200
+ })) : createCommentVNode("", true)
2201
+ ], 64)) : createCommentVNode("", true)
2202
+ ], 512),
2203
+ createElementVNode("div", {
2204
+ ref: "arrow",
2205
+ class: "v-popper__arrow-container",
2206
+ style: normalizeStyle(_ctx.result ? {
2207
+ left: _ctx.toPx(_ctx.result.arrow.x),
2208
+ top: _ctx.toPx(_ctx.result.arrow.y)
2209
+ } : void 0)
2210
+ }, _hoisted_5, 4)
2211
+ ], 4)
2212
+ ], 46, _hoisted_1$1$1);
2213
+ }
2214
+ var PrivatePopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$2]]);
2215
+ var PrivatePopperMethods = {
2216
+ methods: {
2217
+ show(...args) {
2218
+ return this.$refs.popper.show(...args);
2219
+ },
2220
+ hide(...args) {
2221
+ return this.$refs.popper.hide(...args);
2222
+ },
2223
+ dispose(...args) {
2224
+ return this.$refs.popper.dispose(...args);
2225
+ },
2226
+ onResize(...args) {
2227
+ return this.$refs.popper.onResize(...args);
2228
+ }
2229
+ }
2230
+ };
2231
+ const _sfc_main$4$1 = defineComponent({
2232
+ name: "VPopperWrapper",
2233
+ components: {
2234
+ Popper: PrivatePopper(),
2235
+ PopperContent: PrivatePopperContent
2236
+ },
2237
+ mixins: [
2238
+ PrivatePopperMethods,
2239
+ PrivateThemeClass("finalTheme")
2240
+ ],
2241
+ inheritAttrs: false,
2242
+ props: {
2243
+ theme: {
2244
+ type: String,
2245
+ default: null
2246
+ }
2247
+ },
2248
+ computed: {
2249
+ finalTheme() {
2250
+ var _a;
2251
+ return (_a = this.theme) != null ? _a : this.$options.vPopperTheme;
2252
+ },
2253
+ popperAttrs() {
2254
+ const result = __spreadValues2({}, this.$attrs);
2255
+ delete result.class;
2256
+ delete result.style;
2257
+ return result;
2258
+ }
2259
+ },
2260
+ methods: {
2261
+ getTargetNodes() {
2262
+ return Array.from(this.$refs.reference.children).filter((node) => node !== this.$refs.popperContent.$el);
2263
+ }
2264
+ }
2265
+ });
2266
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
2267
+ const _component_PopperContent = resolveComponent("PopperContent");
2268
+ const _component_Popper = resolveComponent("Popper");
2269
+ return openBlock(), createBlock(_component_Popper, mergeProps({ ref: "popper" }, _ctx.popperAttrs, {
2270
+ theme: _ctx.finalTheme,
2271
+ "target-nodes": _ctx.getTargetNodes,
2272
+ "reference-node": () => _ctx.$refs.reference,
2273
+ "popper-node": () => _ctx.$refs.popperContent.$el
2274
+ }), {
2275
+ default: withCtx(({
2276
+ popperId,
2277
+ isShown,
2278
+ shouldMountContent,
2279
+ skipTransition,
2280
+ autoHide,
2281
+ show,
2282
+ hide,
2283
+ handleResize,
2284
+ onResize,
2285
+ classes,
2286
+ result
2287
+ }) => [
2288
+ createElementVNode("div", {
2289
+ ref: "reference",
2290
+ class: normalizeClass(["v-popper", [
2291
+ _ctx.$attrs.class,
2292
+ _ctx.themeClass,
2293
+ {
2294
+ "v-popper--shown": isShown
2295
+ }
2296
+ ]]),
2297
+ style: normalizeStyle(_ctx.$attrs.style)
2298
+ }, [
2299
+ renderSlot(_ctx.$slots, "default", {
2300
+ shown: isShown,
2301
+ show,
2302
+ hide
2303
+ }),
2304
+ createVNode(_component_PopperContent, {
2305
+ ref: "popperContent",
2306
+ "popper-id": popperId,
2307
+ theme: _ctx.finalTheme,
2308
+ shown: isShown,
2309
+ mounted: shouldMountContent,
2310
+ "skip-transition": skipTransition,
2311
+ "auto-hide": autoHide,
2312
+ "handle-resize": handleResize,
2313
+ classes,
2314
+ result,
2315
+ onHide: hide,
2316
+ onResize
2317
+ }, {
2318
+ default: withCtx(() => [
2319
+ renderSlot(_ctx.$slots, "popper", {
2320
+ shown: isShown,
2321
+ hide
2322
+ })
2323
+ ]),
2324
+ _: 2
2325
+ }, 1032, ["popper-id", "theme", "shown", "mounted", "skip-transition", "auto-hide", "handle-resize", "classes", "result", "onHide", "onResize"])
2326
+ ], 6)
2327
+ ]),
2328
+ _: 3
2329
+ }, 16, ["theme", "target-nodes", "reference-node", "popper-node"]);
2330
+ }
2331
+ var PrivatePopperWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$4$1, [["render", _sfc_render$1]]);
2332
+ defineComponent(__spreadProps2(__spreadValues2({}, PrivatePopperWrapper), {
2333
+ name: "VDropdown",
2334
+ vPopperTheme: "dropdown"
2335
+ }));
2336
+ defineComponent(__spreadProps2(__spreadValues2({}, PrivatePopperWrapper), {
2337
+ name: "VMenu",
2338
+ vPopperTheme: "menu"
2339
+ }));
2340
+ defineComponent(__spreadProps2(__spreadValues2({}, PrivatePopperWrapper), {
2341
+ name: "VTooltip",
2342
+ vPopperTheme: "tooltip"
2343
+ }));
2344
+ const _sfc_main$6 = defineComponent({
2345
+ name: "VTooltipDirective",
2346
+ components: {
2347
+ Popper: PrivatePopper(),
2348
+ PopperContent: PrivatePopperContent
2349
+ },
2350
+ mixins: [
2351
+ PrivatePopperMethods
2352
+ ],
2353
+ inheritAttrs: false,
2354
+ props: {
2355
+ theme: {
2356
+ type: String,
2357
+ default: "tooltip"
2358
+ },
2359
+ html: {
2360
+ type: Boolean,
2361
+ default: (props) => getDefaultConfig(props.theme, "html")
2362
+ },
2363
+ content: {
2364
+ type: [String, Number, Function],
2365
+ default: null
2366
+ },
2367
+ loadingContent: {
2368
+ type: String,
2369
+ default: (props) => getDefaultConfig(props.theme, "loadingContent")
2370
+ }
2371
+ },
2372
+ data() {
2373
+ return {
2374
+ asyncContent: null
2375
+ };
2376
+ },
2377
+ computed: {
2378
+ isContentAsync() {
2379
+ return typeof this.content === "function";
2380
+ },
2381
+ loading() {
2382
+ return this.isContentAsync && this.asyncContent == null;
2383
+ },
2384
+ finalContent() {
2385
+ if (this.isContentAsync) {
2386
+ return this.loading ? this.loadingContent : this.asyncContent;
2387
+ }
2388
+ return this.content;
2389
+ }
2390
+ },
2391
+ watch: {
2392
+ content: {
2393
+ handler() {
2394
+ this.fetchContent(true);
2395
+ },
2396
+ immediate: true
2397
+ },
2398
+ async finalContent() {
2399
+ await this.$nextTick();
2400
+ this.$refs.popper.onResize();
2401
+ }
2402
+ },
2403
+ created() {
2404
+ this.$_fetchId = 0;
2405
+ },
2406
+ methods: {
2407
+ fetchContent(force) {
2408
+ if (typeof this.content === "function" && this.$_isShown && (force || !this.$_loading && this.asyncContent == null)) {
2409
+ this.asyncContent = null;
2410
+ this.$_loading = true;
2411
+ const fetchId = ++this.$_fetchId;
2412
+ const result = this.content(this);
2413
+ if (result.then) {
2414
+ result.then((res) => this.onResult(fetchId, res));
2415
+ } else {
2416
+ this.onResult(fetchId, result);
2417
+ }
2418
+ }
2419
+ },
2420
+ onResult(fetchId, result) {
2421
+ if (fetchId !== this.$_fetchId)
2422
+ return;
2423
+ this.$_loading = false;
2424
+ this.asyncContent = result;
2425
+ },
2426
+ onShow() {
2427
+ this.$_isShown = true;
2428
+ this.fetchContent();
2429
+ },
2430
+ onHide() {
2431
+ this.$_isShown = false;
2432
+ }
2433
+ }
2434
+ });
2435
+ const _hoisted_1$4 = ["innerHTML"];
2436
+ const _hoisted_2$2 = ["textContent"];
2437
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2438
+ const _component_PopperContent = resolveComponent("PopperContent");
2439
+ const _component_Popper = resolveComponent("Popper");
2440
+ return openBlock(), createBlock(_component_Popper, mergeProps({ ref: "popper" }, _ctx.$attrs, {
2441
+ theme: _ctx.theme,
2442
+ "popper-node": () => _ctx.$refs.popperContent.$el,
2443
+ onApplyShow: _ctx.onShow,
2444
+ onApplyHide: _ctx.onHide
2445
+ }), {
2446
+ default: withCtx(({
2447
+ popperId,
2448
+ isShown,
2449
+ shouldMountContent,
2450
+ skipTransition,
2451
+ autoHide,
2452
+ hide,
2453
+ handleResize,
2454
+ onResize,
2455
+ classes,
2456
+ result
2457
+ }) => [
2458
+ createVNode(_component_PopperContent, {
2459
+ ref: "popperContent",
2460
+ class: normalizeClass({
2461
+ "v-popper--tooltip-loading": _ctx.loading
2462
+ }),
2463
+ "popper-id": popperId,
2464
+ theme: _ctx.theme,
2465
+ shown: isShown,
2466
+ mounted: shouldMountContent,
2467
+ "skip-transition": skipTransition,
2468
+ "auto-hide": autoHide,
2469
+ "handle-resize": handleResize,
2470
+ classes,
2471
+ result,
2472
+ onHide: hide,
2473
+ onResize
2474
+ }, {
2475
+ default: withCtx(() => [
2476
+ _ctx.html ? (openBlock(), createElementBlock("div", {
2477
+ key: 0,
2478
+ innerHTML: _ctx.finalContent
2479
+ }, null, 8, _hoisted_1$4)) : (openBlock(), createElementBlock("div", {
2480
+ key: 1,
2481
+ textContent: toDisplayString(_ctx.finalContent)
2482
+ }, null, 8, _hoisted_2$2))
2483
+ ]),
2484
+ _: 2
2485
+ }, 1032, ["class", "popper-id", "theme", "shown", "mounted", "skip-transition", "auto-hide", "handle-resize", "classes", "result", "onHide", "onResize"])
2486
+ ]),
2487
+ _: 1
2488
+ }, 16, ["theme", "popper-node", "onApplyShow", "onApplyHide"]);
2489
+ }
2490
+ var PrivateTooltipDirective = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render]]);
2491
+ const TARGET_CLASS = "v-popper--has-tooltip";
2492
+ function getPlacement(options2, modifiers) {
2493
+ let result = options2.placement;
2494
+ if (!result && modifiers) {
2495
+ for (const pos of placements) {
2496
+ if (modifiers[pos]) {
2497
+ result = pos;
2498
+ }
2499
+ }
2500
+ }
2501
+ if (!result) {
2502
+ result = getDefaultConfig(options2.theme || "tooltip", "placement");
2503
+ }
2504
+ return result;
2505
+ }
2506
+ function getOptions(el, value, modifiers) {
2507
+ let options2;
2508
+ const type = typeof value;
2509
+ if (type === "string") {
2510
+ options2 = { content: value };
2511
+ } else if (value && type === "object") {
2512
+ options2 = value;
2513
+ } else {
2514
+ options2 = { content: false };
2515
+ }
2516
+ options2.placement = getPlacement(options2, modifiers);
2517
+ options2.targetNodes = () => [el];
2518
+ options2.referenceNode = () => el;
2519
+ return options2;
2520
+ }
2521
+ let directiveApp;
2522
+ let directives;
2523
+ let uid = 0;
2524
+ function ensureDirectiveApp() {
2525
+ if (directiveApp)
2526
+ return;
2527
+ directives = ref([]);
2528
+ directiveApp = createApp({
2529
+ name: "VTooltipDirectiveApp",
2530
+ setup() {
2531
+ return {
2532
+ directives
2533
+ };
2534
+ },
2535
+ render() {
2536
+ return this.directives.map((directive) => {
2537
+ return h(PrivateTooltipDirective, __spreadProps2(__spreadValues2({}, directive.options), {
2538
+ shown: directive.shown.value || directive.options.shown,
2539
+ key: directive.id
2540
+ }));
2541
+ });
2542
+ },
2543
+ devtools: {
2544
+ hide: true
2545
+ }
2546
+ });
2547
+ const mountTarget = document.createElement("div");
2548
+ document.body.appendChild(mountTarget);
2549
+ directiveApp.mount(mountTarget);
2550
+ }
2551
+ function createTooltip(el, value, modifiers) {
2552
+ ensureDirectiveApp();
2553
+ const options2 = ref(getOptions(el, value, modifiers));
2554
+ const shown = ref(false);
2555
+ const item = {
2556
+ id: uid++,
2557
+ options: options2,
2558
+ shown
2559
+ };
2560
+ directives.value.push(item);
2561
+ if (el.classList) {
2562
+ el.classList.add(TARGET_CLASS);
2563
+ }
2564
+ const result = el.$_popper = {
2565
+ options: options2,
2566
+ item,
2567
+ show() {
2568
+ shown.value = true;
2569
+ },
2570
+ hide() {
2571
+ shown.value = false;
2572
+ }
2573
+ };
2574
+ return result;
2575
+ }
2576
+ function destroyTooltip(el) {
2577
+ if (el.$_popper) {
2578
+ const index = directives.value.indexOf(el.$_popper.item);
2579
+ if (index !== -1)
2580
+ directives.value.splice(index, 1);
2581
+ delete el.$_popper;
2582
+ delete el.$_popperOldShown;
2583
+ delete el.$_popperMountTarget;
2584
+ }
2585
+ if (el.classList) {
2586
+ el.classList.remove(TARGET_CLASS);
2587
+ }
2588
+ }
2589
+ function bind(el, { value, oldValue, modifiers }) {
2590
+ const options2 = getOptions(el, value, modifiers);
2591
+ if (!options2.content || getDefaultConfig(options2.theme || "tooltip", "disabled")) {
2592
+ destroyTooltip(el);
2593
+ } else {
2594
+ let directive;
2595
+ if (el.$_popper) {
2596
+ directive = el.$_popper;
2597
+ directive.options.value = options2;
2598
+ } else {
2599
+ directive = createTooltip(el, value, modifiers);
2600
+ }
2601
+ if (typeof value.shown !== "undefined" && value.shown !== el.$_popperOldShown) {
2602
+ el.$_popperOldShown = value.shown;
2603
+ value.shown ? directive.show() : directive.hide();
2604
+ }
2605
+ }
2606
+ }
2607
+ var PrivateVTooltip = {
2608
+ beforeMount: bind,
2609
+ updated: bind,
2610
+ beforeUnmount(el) {
2611
+ destroyTooltip(el);
2612
+ }
2613
+ };
2614
+ const VTooltip = PrivateVTooltip;
2615
+ const _hoisted_1$3 = { class: "htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap" };
2616
+ const _hoisted_2$1 = { class: "htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0" };
2617
+ const _hoisted_3$1 = { class: "htw-block htw-grow" };
2618
+ const __default__$4 = {
2619
+ name: "HstWrapper"
2620
+ };
2621
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
2622
+ props: {
2623
+ title: null
2624
+ },
2625
+ setup(__props) {
2626
+ return (_ctx, _cache) => {
2627
+ return openBlock(), createElementBlock("label", _hoisted_1$3, [
2628
+ withDirectives((openBlock(), createElementBlock("span", _hoisted_2$1, [
2629
+ createTextVNode(toDisplayString(__props.title), 1)
2630
+ ])), [
2631
+ [unref(VTooltip), {
2632
+ content: __props.title,
2633
+ placement: "left",
2634
+ distance: 12
2635
+ }]
2636
+ ]),
2637
+ createElementVNode("span", _hoisted_3$1, [
2638
+ renderSlot(_ctx.$slots, "default")
2639
+ ])
2640
+ ]);
2641
+ };
2642
+ }
2643
+ }));
2644
+ const _hoisted_1$2 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
2645
+ const _hoisted_2 = {
23
2646
  width: "16",
24
2647
  height: "16",
25
2648
  viewBox: "0 0 24 24",
26
2649
  class: "htw-relative htw-z-10"
27
2650
  };
28
2651
  const _hoisted_3 = ["stroke-dasharray", "stroke-dashoffset"];
29
- const __default__$1 = {
2652
+ const __default__$3 = {
30
2653
  name: "HstCheckbox"
31
2654
  };
32
- const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
2655
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
33
2656
  props: {
34
- modelValue: {
35
- type: Boolean,
36
- default: false
37
- }
2657
+ modelValue: { type: Boolean },
2658
+ title: null
38
2659
  },
39
2660
  emits: {
40
2661
  "update:modelValue": (newValue) => true
@@ -55,59 +2676,178 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
55
2676
  dasharray.value = (_c = (_b = (_a = path.value).getTotalLength) == null ? void 0 : _b.call(_a)) != null ? _c : 21.21;
56
2677
  });
57
2678
  return (_ctx, _cache) => {
58
- return openBlock(), createElementBlock("div", {
2679
+ return openBlock(), createBlock(_sfc_main$4, {
59
2680
  role: "checkbox",
60
2681
  tabindex: "0",
61
- class: "htw-flex htw-items-center htw-gap-2 htw-select-none htw-px-4 htw-py-3 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700",
2682
+ class: "htw-cursor-pointer htw-items-center",
2683
+ title: __props.title,
62
2684
  onClick: _cache[0] || (_cache[0] = ($event) => toggle()),
63
2685
  onKeydown: [
64
2686
  _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["enter"])),
65
2687
  _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["space"]))
66
2688
  ]
67
- }, [
68
- createElementVNode("div", _hoisted_1$1, [
69
- createElementVNode("div", {
70
- class: normalizeClass(["htw-border group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out", [
71
- __props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-gray-300 dark:htw-border-gray-500 htw-delay-150"
72
- ]])
73
- }, null, 2),
74
- (openBlock(), createElementBlock("svg", _hoisted_2$1, [
75
- createElementVNode("path", {
76
- ref_key: "path",
77
- ref: path,
78
- d: "m 4 12 l 5 5 l 10 -10",
79
- fill: "none",
80
- class: normalizeClass(["htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out", [
81
- animationEnabled.value ? "htw-transition-all" : "htw-transition-none",
82
- {
83
- "htw-delay-150": __props.modelValue
84
- }
85
- ]]),
86
- "stroke-dasharray": dasharray.value,
87
- "stroke-dashoffset": unref(dashoffset)
88
- }, null, 10, _hoisted_3)
89
- ]))
2689
+ }, {
2690
+ default: withCtx(() => [
2691
+ createElementVNode("div", _hoisted_1$2, [
2692
+ createElementVNode("div", {
2693
+ class: normalizeClass(["htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out", [
2694
+ __props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-black/25 dark:htw-border-white/25 htw-delay-150"
2695
+ ]])
2696
+ }, null, 2),
2697
+ (openBlock(), createElementBlock("svg", _hoisted_2, [
2698
+ createElementVNode("path", {
2699
+ ref_key: "path",
2700
+ ref: path,
2701
+ d: "m 4 12 l 5 5 l 10 -10",
2702
+ fill: "none",
2703
+ class: normalizeClass(["htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out", [
2704
+ animationEnabled.value ? "htw-transition-all" : "htw-transition-none",
2705
+ {
2706
+ "htw-delay-150": __props.modelValue
2707
+ }
2708
+ ]]),
2709
+ "stroke-dasharray": dasharray.value,
2710
+ "stroke-dashoffset": unref(dashoffset)
2711
+ }, null, 10, _hoisted_3)
2712
+ ]))
2713
+ ])
90
2714
  ]),
91
- renderSlot(_ctx.$slots, "default")
92
- ], 32);
2715
+ _: 1
2716
+ }, 8, ["title"]);
93
2717
  };
94
2718
  }
95
2719
  }));
96
- const _hoisted_1 = {
97
- key: 0,
98
- class: "htw-text-sm htw-px-2 htw-cursor-text"
2720
+ const _hoisted_1$1 = ["value"];
2721
+ const __default__$2 = {
2722
+ name: "HstText"
99
2723
  };
100
- const _hoisted_2 = ["value"];
2724
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
2725
+ props: {
2726
+ title: null,
2727
+ modelValue: null
2728
+ },
2729
+ emits: {
2730
+ "update:modelValue": (newValue) => true
2731
+ },
2732
+ setup(__props, { emit }) {
2733
+ const input = ref();
2734
+ return (_ctx, _cache) => {
2735
+ return openBlock(), createBlock(_sfc_main$4, {
2736
+ title: __props.title,
2737
+ class: normalizeClass(["htw-cursor-text htw-items-center", _ctx.$attrs.class]),
2738
+ style: normalizeStyle(_ctx.$attrs.style),
2739
+ onClick: _cache[1] || (_cache[1] = ($event) => input.value.focus())
2740
+ }, {
2741
+ default: withCtx(() => [
2742
+ createElementVNode("input", mergeProps({
2743
+ ref_key: "input",
2744
+ ref: input
2745
+ }, __spreadProps(__spreadValues({}, _ctx.$attrs), { class: null, style: null }), {
2746
+ type: "text",
2747
+ value: __props.modelValue,
2748
+ class: "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-px-2 htw-py-1 -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 focus:htw-border-primary-500 dark:focus:htw-border-primary-500 htw-rounded-sm",
2749
+ onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
2750
+ }), null, 16, _hoisted_1$1)
2751
+ ]),
2752
+ _: 1
2753
+ }, 8, ["title", "class", "style"]);
2754
+ };
2755
+ }
2756
+ }));
2757
+ const __default__$1 = {
2758
+ name: "HstNumber",
2759
+ inheritAttrs: false
2760
+ };
2761
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
2762
+ props: {
2763
+ title: null,
2764
+ modelValue: null
2765
+ },
2766
+ emits: {
2767
+ "update:modelValue": (newValue) => true
2768
+ },
2769
+ setup(__props, { emit }) {
2770
+ const props = __props;
2771
+ const numberModel = computed({
2772
+ get: () => props.modelValue,
2773
+ set: (value) => {
2774
+ emit("update:modelValue", value);
2775
+ }
2776
+ });
2777
+ const input = ref();
2778
+ function focusAndSelect() {
2779
+ input.value.focus();
2780
+ input.value.select();
2781
+ }
2782
+ const isDragging = ref(false);
2783
+ let startX;
2784
+ let startValue;
2785
+ function onMouseDown(event) {
2786
+ isDragging.value = true;
2787
+ startX = event.clientX;
2788
+ startValue = numberModel.value;
2789
+ window.addEventListener("mousemove", onMouseMove);
2790
+ window.addEventListener("mouseup", stopDragging);
2791
+ }
2792
+ function onMouseMove(event) {
2793
+ let step = parseFloat(input.value.step);
2794
+ if (isNaN(step)) {
2795
+ step = 1;
2796
+ }
2797
+ numberModel.value = startValue + Math.round((event.clientX - startX) / 10 / step) * step;
2798
+ }
2799
+ function stopDragging() {
2800
+ isDragging.value = false;
2801
+ window.removeEventListener("mousemove", onMouseMove);
2802
+ window.removeEventListener("mouseup", stopDragging);
2803
+ }
2804
+ onUnmounted(() => {
2805
+ stopDragging();
2806
+ });
2807
+ return (_ctx, _cache) => {
2808
+ return openBlock(), createBlock(_sfc_main$4, {
2809
+ class: normalizeClass(["htw-cursor-ew-resize htw-items-center", [
2810
+ _ctx.$attrs.class,
2811
+ { "htw-select-none": isDragging.value }
2812
+ ]]),
2813
+ title: __props.title,
2814
+ style: normalizeStyle(_ctx.$attrs.style),
2815
+ onClick: focusAndSelect,
2816
+ onMousedown: onMouseDown
2817
+ }, {
2818
+ default: withCtx(() => [
2819
+ withDirectives(createElementVNode("input", mergeProps({
2820
+ ref_key: "input",
2821
+ ref: input
2822
+ }, __spreadProps(__spreadValues({}, _ctx.$attrs), { class: null, style: null }), {
2823
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(numberModel) ? numberModel.value = $event : null),
2824
+ type: "number",
2825
+ class: [{
2826
+ "htw-select-none": isDragging.value
2827
+ }, "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-pl-2 htw-py-1 -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 focus:htw-border-primary-500 dark:focus:htw-border-primary-500 htw-rounded-sm htw-cursor-ew-resize"]
2828
+ }), null, 16), [
2829
+ [
2830
+ vModelText,
2831
+ unref(numberModel),
2832
+ void 0,
2833
+ { number: true }
2834
+ ]
2835
+ ])
2836
+ ]),
2837
+ _: 1
2838
+ }, 8, ["title", "class", "style"]);
2839
+ };
2840
+ }
2841
+ }));
2842
+ const _hoisted_1 = ["value"];
101
2843
  const __default__ = {
102
- name: "HstInput",
2844
+ name: "HstTextarea",
103
2845
  inheritAttrs: false
104
2846
  };
105
2847
  const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
106
2848
  props: {
107
- modelValue: {
108
- type: [String, Number],
109
- default: ""
110
- }
2849
+ title: null,
2850
+ modelValue: null
111
2851
  },
112
2852
  emits: {
113
2853
  "update:modelValue": (newValue) => true
@@ -115,30 +2855,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
115
2855
  setup(__props, { emit }) {
116
2856
  const input = ref();
117
2857
  return (_ctx, _cache) => {
118
- return openBlock(), createElementBlock("div", {
119
- class: normalizeClass(["htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700 htw-cursor-text", _ctx.$attrs.class]),
2858
+ return openBlock(), createBlock(_sfc_main$4, {
2859
+ title: __props.title,
2860
+ class: normalizeClass(["htw-cursor-text", _ctx.$attrs.class]),
120
2861
  style: normalizeStyle(_ctx.$attrs.style),
121
2862
  onClick: _cache[1] || (_cache[1] = ($event) => input.value.focus())
122
- }, [
123
- _ctx.$slots.default ? (openBlock(), createElementBlock("label", _hoisted_1, [
124
- renderSlot(_ctx.$slots, "default")
125
- ])) : createCommentVNode("", true),
126
- createElementVNode("input", mergeProps({
127
- ref_key: "input",
128
- ref: input
129
- }, __spreadProps(__spreadValues({}, _ctx.$attrs), { style: null, class: null }), {
130
- value: __props.modelValue,
131
- class: "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-px-2 htw-py-0 htw-border htw-border-gray-300 dark:htw-border-gray-500 focus:htw-border-primary-500 dark:focus:htw-border-primary-500 htw-rounded-sm",
132
- onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
133
- }), null, 16, _hoisted_2)
134
- ], 6);
2863
+ }, {
2864
+ default: withCtx(() => [
2865
+ createElementVNode("textarea", mergeProps({
2866
+ ref_key: "input",
2867
+ ref: input
2868
+ }, __spreadProps(__spreadValues({}, _ctx.$attrs), { class: null, style: null }), {
2869
+ value: __props.modelValue,
2870
+ class: "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-px-2 htw-py-1 -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 focus:htw-border-primary-500 dark:focus:htw-border-primary-500 htw-rounded-sm htw-box-border htw-resize-y htw-min-h-[26px]",
2871
+ onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
2872
+ }), null, 16, _hoisted_1)
2873
+ ]),
2874
+ _: 1
2875
+ }, 8, ["title", "class", "style"]);
135
2876
  };
136
2877
  }
137
2878
  }));
138
- const HstCheckbox = _sfc_main$1;
139
- const HstInput = _sfc_main;
2879
+ const HstCheckbox = _sfc_main$3;
2880
+ const HstText = _sfc_main$2;
2881
+ const HstNumber = _sfc_main$1;
2882
+ const HstTextarea = _sfc_main;
140
2883
  function registerVueComponents(app) {
141
- app.component("HstCheckbox", _sfc_main$1);
142
- app.component("HstInput", _sfc_main);
2884
+ app.component("HstCheckbox", _sfc_main$3);
2885
+ app.component("HstText", _sfc_main$2);
2886
+ app.component("HstNumber", _sfc_main$1);
2887
+ app.component("HstTextarea", _sfc_main);
143
2888
  }
144
- export { HstCheckbox, HstInput, registerVueComponents };
2889
+ export { HstCheckbox, HstNumber, HstText, HstTextarea, registerVueComponents };