@yxy_27/yxyeasy 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1391 @@
1
+ import { getCurrentInstance, onMounted, nextTick, getCurrentScope, onScopeDispose, ref, watch, unref, defineComponent, useAttrs, shallowRef, onUnmounted, openBlock, createElementBlock, createElementVNode } from "vue";
2
+ import * as echarts from "echarts";
3
+ var collectionUtils = { exports: {} };
4
+ var utils$3 = collectionUtils.exports = {};
5
+ utils$3.forEach = function(collection, callback) {
6
+ for (var i = 0; i < collection.length; i++) {
7
+ var result = callback(collection[i]);
8
+ if (result) {
9
+ return result;
10
+ }
11
+ }
12
+ };
13
+ var elementUtils = function(options) {
14
+ var getState2 = options.stateHandler.getState;
15
+ function isDetectable(element) {
16
+ var state = getState2(element);
17
+ return state && !!state.isDetectable;
18
+ }
19
+ function markAsDetectable(element) {
20
+ getState2(element).isDetectable = true;
21
+ }
22
+ function isBusy(element) {
23
+ return !!getState2(element).busy;
24
+ }
25
+ function markBusy(element, busy) {
26
+ getState2(element).busy = !!busy;
27
+ }
28
+ return {
29
+ isDetectable,
30
+ markAsDetectable,
31
+ isBusy,
32
+ markBusy
33
+ };
34
+ };
35
+ var listenerHandler = function(idHandler2) {
36
+ var eventListeners = {};
37
+ function getListeners(element) {
38
+ var id = idHandler2.get(element);
39
+ if (id === void 0) {
40
+ return [];
41
+ }
42
+ return eventListeners[id] || [];
43
+ }
44
+ function addListener(element, listener) {
45
+ var id = idHandler2.get(element);
46
+ if (!eventListeners[id]) {
47
+ eventListeners[id] = [];
48
+ }
49
+ eventListeners[id].push(listener);
50
+ }
51
+ function removeListener(element, listener) {
52
+ var listeners = getListeners(element);
53
+ for (var i = 0, len = listeners.length; i < len; ++i) {
54
+ if (listeners[i] === listener) {
55
+ listeners.splice(i, 1);
56
+ break;
57
+ }
58
+ }
59
+ }
60
+ function removeAllListeners(element) {
61
+ var listeners = getListeners(element);
62
+ if (!listeners) {
63
+ return;
64
+ }
65
+ listeners.length = 0;
66
+ }
67
+ return {
68
+ get: getListeners,
69
+ add: addListener,
70
+ removeListener,
71
+ removeAllListeners
72
+ };
73
+ };
74
+ var idGenerator = function() {
75
+ var idCount = 1;
76
+ function generate() {
77
+ return idCount++;
78
+ }
79
+ return {
80
+ generate
81
+ };
82
+ };
83
+ var idHandler = function(options) {
84
+ var idGenerator2 = options.idGenerator;
85
+ var getState2 = options.stateHandler.getState;
86
+ function getId(element) {
87
+ var state = getState2(element);
88
+ if (state && state.id !== void 0) {
89
+ return state.id;
90
+ }
91
+ return null;
92
+ }
93
+ function setId(element) {
94
+ var state = getState2(element);
95
+ if (!state) {
96
+ throw new Error("setId required the element to have a resize detection state.");
97
+ }
98
+ var id = idGenerator2.generate();
99
+ state.id = id;
100
+ return id;
101
+ }
102
+ return {
103
+ get: getId,
104
+ set: setId
105
+ };
106
+ };
107
+ var reporter = function(quiet) {
108
+ function noop2() {
109
+ }
110
+ var reporter2 = {
111
+ log: noop2,
112
+ warn: noop2,
113
+ error: noop2
114
+ };
115
+ if (!quiet && window.console) {
116
+ var attachFunction = function(reporter3, name) {
117
+ reporter3[name] = function reporterProxy() {
118
+ var f = console[name];
119
+ if (f.apply) {
120
+ f.apply(console, arguments);
121
+ } else {
122
+ for (var i = 0; i < arguments.length; i++) {
123
+ f(arguments[i]);
124
+ }
125
+ }
126
+ };
127
+ };
128
+ attachFunction(reporter2, "log");
129
+ attachFunction(reporter2, "warn");
130
+ attachFunction(reporter2, "error");
131
+ }
132
+ return reporter2;
133
+ };
134
+ var browserDetector$2 = { exports: {} };
135
+ var detector = browserDetector$2.exports = {};
136
+ detector.isIE = function(version) {
137
+ function isAnyIeVersion() {
138
+ var agent = navigator.userAgent.toLowerCase();
139
+ return agent.indexOf("msie") !== -1 || agent.indexOf("trident") !== -1 || agent.indexOf(" edge/") !== -1;
140
+ }
141
+ if (!isAnyIeVersion()) {
142
+ return false;
143
+ }
144
+ if (!version) {
145
+ return true;
146
+ }
147
+ var ieVersion = function() {
148
+ var undef, v = 3, div = document.createElement("div"), all = div.getElementsByTagName("i");
149
+ do {
150
+ div.innerHTML = "<!--[if gt IE " + ++v + "]><i></i><![endif]-->";
151
+ } while (all[0]);
152
+ return v > 4 ? v : undef;
153
+ }();
154
+ return version === ieVersion;
155
+ };
156
+ detector.isLegacyOpera = function() {
157
+ return !!window.opera;
158
+ };
159
+ var utils$2 = { exports: {} };
160
+ var utils$1 = utils$2.exports = {};
161
+ utils$1.getOption = getOption$1;
162
+ function getOption$1(options, name, defaultValue) {
163
+ var value = options[name];
164
+ if ((value === void 0 || value === null) && defaultValue !== void 0) {
165
+ return defaultValue;
166
+ }
167
+ return value;
168
+ }
169
+ var utils = utils$2.exports;
170
+ var batchProcessor = function batchProcessorMaker(options) {
171
+ options = options || {};
172
+ var reporter2 = options.reporter;
173
+ var asyncProcess = utils.getOption(options, "async", true);
174
+ var autoProcess = utils.getOption(options, "auto", true);
175
+ if (autoProcess && !asyncProcess) {
176
+ reporter2 && reporter2.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true.");
177
+ asyncProcess = true;
178
+ }
179
+ var batch = Batch();
180
+ var asyncFrameHandler;
181
+ var isProcessing = false;
182
+ function addFunction(level, fn) {
183
+ if (!isProcessing && autoProcess && asyncProcess && batch.size() === 0) {
184
+ processBatchAsync();
185
+ }
186
+ batch.add(level, fn);
187
+ }
188
+ function processBatch() {
189
+ isProcessing = true;
190
+ while (batch.size()) {
191
+ var processingBatch = batch;
192
+ batch = Batch();
193
+ processingBatch.process();
194
+ }
195
+ isProcessing = false;
196
+ }
197
+ function forceProcessBatch(localAsyncProcess) {
198
+ if (isProcessing) {
199
+ return;
200
+ }
201
+ if (localAsyncProcess === void 0) {
202
+ localAsyncProcess = asyncProcess;
203
+ }
204
+ if (asyncFrameHandler) {
205
+ cancelFrame(asyncFrameHandler);
206
+ asyncFrameHandler = null;
207
+ }
208
+ if (localAsyncProcess) {
209
+ processBatchAsync();
210
+ } else {
211
+ processBatch();
212
+ }
213
+ }
214
+ function processBatchAsync() {
215
+ asyncFrameHandler = requestFrame(processBatch);
216
+ }
217
+ function cancelFrame(listener) {
218
+ var cancel = clearTimeout;
219
+ return cancel(listener);
220
+ }
221
+ function requestFrame(callback) {
222
+ var raf = function(fn) {
223
+ return setTimeout(fn, 0);
224
+ };
225
+ return raf(callback);
226
+ }
227
+ return {
228
+ add: addFunction,
229
+ force: forceProcessBatch
230
+ };
231
+ };
232
+ function Batch() {
233
+ var batch = {};
234
+ var size = 0;
235
+ var topLevel = 0;
236
+ var bottomLevel = 0;
237
+ function add(level, fn) {
238
+ if (!fn) {
239
+ fn = level;
240
+ level = 0;
241
+ }
242
+ if (level > topLevel) {
243
+ topLevel = level;
244
+ } else if (level < bottomLevel) {
245
+ bottomLevel = level;
246
+ }
247
+ if (!batch[level]) {
248
+ batch[level] = [];
249
+ }
250
+ batch[level].push(fn);
251
+ size++;
252
+ }
253
+ function process() {
254
+ for (var level = bottomLevel; level <= topLevel; level++) {
255
+ var fns = batch[level];
256
+ for (var i = 0; i < fns.length; i++) {
257
+ var fn = fns[i];
258
+ fn();
259
+ }
260
+ }
261
+ }
262
+ function getSize() {
263
+ return size;
264
+ }
265
+ return {
266
+ add,
267
+ process,
268
+ size: getSize
269
+ };
270
+ }
271
+ var prop = "_erd";
272
+ function initState(element) {
273
+ element[prop] = {};
274
+ return getState(element);
275
+ }
276
+ function getState(element) {
277
+ return element[prop];
278
+ }
279
+ function cleanState(element) {
280
+ delete element[prop];
281
+ }
282
+ var stateHandler$1 = {
283
+ initState,
284
+ getState,
285
+ cleanState
286
+ };
287
+ var browserDetector$1 = browserDetector$2.exports;
288
+ var object = function(options) {
289
+ options = options || {};
290
+ var reporter2 = options.reporter;
291
+ var batchProcessor2 = options.batchProcessor;
292
+ var getState2 = options.stateHandler.getState;
293
+ if (!reporter2) {
294
+ throw new Error("Missing required dependency: reporter.");
295
+ }
296
+ function addListener(element, listener) {
297
+ function listenerProxy() {
298
+ listener(element);
299
+ }
300
+ if (browserDetector$1.isIE(8)) {
301
+ getState2(element).object = {
302
+ proxy: listenerProxy
303
+ };
304
+ element.attachEvent("onresize", listenerProxy);
305
+ } else {
306
+ var object2 = getObject(element);
307
+ if (!object2) {
308
+ throw new Error("Element is not detectable by this strategy.");
309
+ }
310
+ object2.contentDocument.defaultView.addEventListener("resize", listenerProxy);
311
+ }
312
+ }
313
+ function buildCssTextString(rules) {
314
+ var seperator = options.important ? " !important; " : "; ";
315
+ return (rules.join(seperator) + seperator).trim();
316
+ }
317
+ function makeDetectable(options2, element, callback) {
318
+ if (!callback) {
319
+ callback = element;
320
+ element = options2;
321
+ options2 = null;
322
+ }
323
+ options2 = options2 || {};
324
+ options2.debug;
325
+ function injectObject(element2, callback2) {
326
+ var OBJECT_STYLE = buildCssTextString(["display: block", "position: absolute", "top: 0", "left: 0", "width: 100%", "height: 100%", "border: none", "padding: 0", "margin: 0", "opacity: 0", "z-index: -1000", "pointer-events: none"]);
327
+ var positionCheckPerformed = false;
328
+ var style = window.getComputedStyle(element2);
329
+ var width = element2.offsetWidth;
330
+ var height = element2.offsetHeight;
331
+ getState2(element2).startSize = {
332
+ width,
333
+ height
334
+ };
335
+ function mutateDom() {
336
+ function alterPositionStyles() {
337
+ if (style.position === "static") {
338
+ element2.style.setProperty("position", "relative", options2.important ? "important" : "");
339
+ var removeRelativeStyles = function(reporter3, element3, style2, property) {
340
+ function getNumericalValue(value2) {
341
+ return value2.replace(/[^-\d\.]/g, "");
342
+ }
343
+ var value = style2[property];
344
+ if (value !== "auto" && getNumericalValue(value) !== "0") {
345
+ reporter3.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relative, so the style." + property + " will be set to 0. Element: ", element3);
346
+ element3.style.setProperty(property, "0", options2.important ? "important" : "");
347
+ }
348
+ };
349
+ removeRelativeStyles(reporter2, element2, style, "top");
350
+ removeRelativeStyles(reporter2, element2, style, "right");
351
+ removeRelativeStyles(reporter2, element2, style, "bottom");
352
+ removeRelativeStyles(reporter2, element2, style, "left");
353
+ }
354
+ }
355
+ function onObjectLoad() {
356
+ if (!positionCheckPerformed) {
357
+ alterPositionStyles();
358
+ }
359
+ function getDocument(element3, callback3) {
360
+ if (!element3.contentDocument) {
361
+ var state = getState2(element3);
362
+ if (state.checkForObjectDocumentTimeoutId) {
363
+ window.clearTimeout(state.checkForObjectDocumentTimeoutId);
364
+ }
365
+ state.checkForObjectDocumentTimeoutId = setTimeout(function checkForObjectDocument() {
366
+ state.checkForObjectDocumentTimeoutId = 0;
367
+ getDocument(element3, callback3);
368
+ }, 100);
369
+ return;
370
+ }
371
+ callback3(element3.contentDocument);
372
+ }
373
+ var objectElement = this;
374
+ getDocument(objectElement, function onObjectDocumentReady(objectDocument) {
375
+ callback2(element2);
376
+ });
377
+ }
378
+ if (style.position !== "") {
379
+ alterPositionStyles();
380
+ positionCheckPerformed = true;
381
+ }
382
+ var object2 = document.createElement("object");
383
+ object2.style.cssText = OBJECT_STYLE;
384
+ object2.tabIndex = -1;
385
+ object2.type = "text/html";
386
+ object2.setAttribute("aria-hidden", "true");
387
+ object2.onload = onObjectLoad;
388
+ if (!browserDetector$1.isIE()) {
389
+ object2.data = "about:blank";
390
+ }
391
+ if (!getState2(element2)) {
392
+ return;
393
+ }
394
+ element2.appendChild(object2);
395
+ getState2(element2).object = object2;
396
+ if (browserDetector$1.isIE()) {
397
+ object2.data = "about:blank";
398
+ }
399
+ }
400
+ if (batchProcessor2) {
401
+ batchProcessor2.add(mutateDom);
402
+ } else {
403
+ mutateDom();
404
+ }
405
+ }
406
+ if (browserDetector$1.isIE(8)) {
407
+ callback(element);
408
+ } else {
409
+ injectObject(element, callback);
410
+ }
411
+ }
412
+ function getObject(element) {
413
+ return getState2(element).object;
414
+ }
415
+ function uninstall(element) {
416
+ if (!getState2(element)) {
417
+ return;
418
+ }
419
+ var object2 = getObject(element);
420
+ if (!object2) {
421
+ return;
422
+ }
423
+ if (browserDetector$1.isIE(8)) {
424
+ element.detachEvent("onresize", object2.proxy);
425
+ } else {
426
+ element.removeChild(object2);
427
+ }
428
+ if (getState2(element).checkForObjectDocumentTimeoutId) {
429
+ window.clearTimeout(getState2(element).checkForObjectDocumentTimeoutId);
430
+ }
431
+ delete getState2(element).object;
432
+ }
433
+ return {
434
+ makeDetectable,
435
+ addListener,
436
+ uninstall
437
+ };
438
+ };
439
+ var forEach$1 = collectionUtils.exports.forEach;
440
+ var scroll = function(options) {
441
+ options = options || {};
442
+ var reporter2 = options.reporter;
443
+ var batchProcessor2 = options.batchProcessor;
444
+ var getState2 = options.stateHandler.getState;
445
+ options.stateHandler.hasState;
446
+ var idHandler2 = options.idHandler;
447
+ if (!batchProcessor2) {
448
+ throw new Error("Missing required dependency: batchProcessor");
449
+ }
450
+ if (!reporter2) {
451
+ throw new Error("Missing required dependency: reporter.");
452
+ }
453
+ var scrollbarSizes = getScrollbarSizes();
454
+ var styleId = "erd_scroll_detection_scrollbar_style";
455
+ var detectionContainerClass = "erd_scroll_detection_container";
456
+ function initDocument(targetDocument) {
457
+ injectScrollStyle(targetDocument, styleId, detectionContainerClass);
458
+ }
459
+ initDocument(window.document);
460
+ function buildCssTextString(rules) {
461
+ var seperator = options.important ? " !important; " : "; ";
462
+ return (rules.join(seperator) + seperator).trim();
463
+ }
464
+ function getScrollbarSizes() {
465
+ var width = 500;
466
+ var height = 500;
467
+ var child = document.createElement("div");
468
+ child.style.cssText = buildCssTextString(["position: absolute", "width: " + width * 2 + "px", "height: " + height * 2 + "px", "visibility: hidden", "margin: 0", "padding: 0"]);
469
+ var container = document.createElement("div");
470
+ container.style.cssText = buildCssTextString(["position: absolute", "width: " + width + "px", "height: " + height + "px", "overflow: scroll", "visibility: none", "top: " + -width * 3 + "px", "left: " + -height * 3 + "px", "visibility: hidden", "margin: 0", "padding: 0"]);
471
+ container.appendChild(child);
472
+ document.body.insertBefore(container, document.body.firstChild);
473
+ var widthSize = width - container.clientWidth;
474
+ var heightSize = height - container.clientHeight;
475
+ document.body.removeChild(container);
476
+ return {
477
+ width: widthSize,
478
+ height: heightSize
479
+ };
480
+ }
481
+ function injectScrollStyle(targetDocument, styleId2, containerClass) {
482
+ function injectStyle(style2, method) {
483
+ method = method || function(element) {
484
+ targetDocument.head.appendChild(element);
485
+ };
486
+ var styleElement = targetDocument.createElement("style");
487
+ styleElement.innerHTML = style2;
488
+ styleElement.id = styleId2;
489
+ method(styleElement);
490
+ return styleElement;
491
+ }
492
+ if (!targetDocument.getElementById(styleId2)) {
493
+ var containerAnimationClass = containerClass + "_animation";
494
+ var containerAnimationActiveClass = containerClass + "_animation_active";
495
+ var style = "/* Created by the element-resize-detector library. */\n";
496
+ style += "." + containerClass + " > div::-webkit-scrollbar { " + buildCssTextString(["display: none"]) + " }\n\n";
497
+ style += "." + containerAnimationActiveClass + " { " + buildCssTextString(["-webkit-animation-duration: 0.1s", "animation-duration: 0.1s", "-webkit-animation-name: " + containerAnimationClass, "animation-name: " + containerAnimationClass]) + " }\n";
498
+ style += "@-webkit-keyframes " + containerAnimationClass + " { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }\n";
499
+ style += "@keyframes " + containerAnimationClass + " { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }";
500
+ injectStyle(style);
501
+ }
502
+ }
503
+ function addAnimationClass(element) {
504
+ element.className += " " + detectionContainerClass + "_animation_active";
505
+ }
506
+ function addEvent(el, name, cb) {
507
+ if (el.addEventListener) {
508
+ el.addEventListener(name, cb);
509
+ } else if (el.attachEvent) {
510
+ el.attachEvent("on" + name, cb);
511
+ } else {
512
+ return reporter2.error("[scroll] Don't know how to add event listeners.");
513
+ }
514
+ }
515
+ function removeEvent(el, name, cb) {
516
+ if (el.removeEventListener) {
517
+ el.removeEventListener(name, cb);
518
+ } else if (el.detachEvent) {
519
+ el.detachEvent("on" + name, cb);
520
+ } else {
521
+ return reporter2.error("[scroll] Don't know how to remove event listeners.");
522
+ }
523
+ }
524
+ function getExpandElement(element) {
525
+ return getState2(element).container.childNodes[0].childNodes[0].childNodes[0];
526
+ }
527
+ function getShrinkElement(element) {
528
+ return getState2(element).container.childNodes[0].childNodes[0].childNodes[1];
529
+ }
530
+ function addListener(element, listener) {
531
+ var listeners = getState2(element).listeners;
532
+ if (!listeners.push) {
533
+ throw new Error("Cannot add listener to an element that is not detectable.");
534
+ }
535
+ getState2(element).listeners.push(listener);
536
+ }
537
+ function makeDetectable(options2, element, callback) {
538
+ if (!callback) {
539
+ callback = element;
540
+ element = options2;
541
+ options2 = null;
542
+ }
543
+ options2 = options2 || {};
544
+ function debug() {
545
+ if (options2.debug) {
546
+ var args = Array.prototype.slice.call(arguments);
547
+ args.unshift(idHandler2.get(element), "Scroll: ");
548
+ if (reporter2.log.apply) {
549
+ reporter2.log.apply(null, args);
550
+ } else {
551
+ for (var i = 0; i < args.length; i++) {
552
+ reporter2.log(args[i]);
553
+ }
554
+ }
555
+ }
556
+ }
557
+ function isDetached(element2) {
558
+ function isInDocument(element3) {
559
+ var isInShadowRoot = element3.getRootNode && element3.getRootNode().contains(element3);
560
+ return element3 === element3.ownerDocument.body || element3.ownerDocument.body.contains(element3) || isInShadowRoot;
561
+ }
562
+ if (!isInDocument(element2)) {
563
+ return true;
564
+ }
565
+ if (window.getComputedStyle(element2) === null) {
566
+ return true;
567
+ }
568
+ return false;
569
+ }
570
+ function isUnrendered(element2) {
571
+ var container = getState2(element2).container.childNodes[0];
572
+ var style = window.getComputedStyle(container);
573
+ return !style.width || style.width.indexOf("px") === -1;
574
+ }
575
+ function getStyle() {
576
+ var elementStyle = window.getComputedStyle(element);
577
+ var style = {};
578
+ style.position = elementStyle.position;
579
+ style.width = element.offsetWidth;
580
+ style.height = element.offsetHeight;
581
+ style.top = elementStyle.top;
582
+ style.right = elementStyle.right;
583
+ style.bottom = elementStyle.bottom;
584
+ style.left = elementStyle.left;
585
+ style.widthCSS = elementStyle.width;
586
+ style.heightCSS = elementStyle.height;
587
+ return style;
588
+ }
589
+ function storeStartSize() {
590
+ var style = getStyle();
591
+ getState2(element).startSize = {
592
+ width: style.width,
593
+ height: style.height
594
+ };
595
+ debug("Element start size", getState2(element).startSize);
596
+ }
597
+ function initListeners() {
598
+ getState2(element).listeners = [];
599
+ }
600
+ function storeStyle() {
601
+ debug("storeStyle invoked.");
602
+ if (!getState2(element)) {
603
+ debug("Aborting because element has been uninstalled");
604
+ return;
605
+ }
606
+ var style = getStyle();
607
+ getState2(element).style = style;
608
+ }
609
+ function storeCurrentSize(element2, width, height) {
610
+ getState2(element2).lastWidth = width;
611
+ getState2(element2).lastHeight = height;
612
+ }
613
+ function getExpandChildElement(element2) {
614
+ return getExpandElement(element2).childNodes[0];
615
+ }
616
+ function getWidthOffset() {
617
+ return 2 * scrollbarSizes.width + 1;
618
+ }
619
+ function getHeightOffset() {
620
+ return 2 * scrollbarSizes.height + 1;
621
+ }
622
+ function getExpandWidth(width) {
623
+ return width + 10 + getWidthOffset();
624
+ }
625
+ function getExpandHeight(height) {
626
+ return height + 10 + getHeightOffset();
627
+ }
628
+ function getShrinkWidth(width) {
629
+ return width * 2 + getWidthOffset();
630
+ }
631
+ function getShrinkHeight(height) {
632
+ return height * 2 + getHeightOffset();
633
+ }
634
+ function positionScrollbars(element2, width, height) {
635
+ var expand = getExpandElement(element2);
636
+ var shrink = getShrinkElement(element2);
637
+ var expandWidth = getExpandWidth(width);
638
+ var expandHeight = getExpandHeight(height);
639
+ var shrinkWidth = getShrinkWidth(width);
640
+ var shrinkHeight = getShrinkHeight(height);
641
+ expand.scrollLeft = expandWidth;
642
+ expand.scrollTop = expandHeight;
643
+ shrink.scrollLeft = shrinkWidth;
644
+ shrink.scrollTop = shrinkHeight;
645
+ }
646
+ function injectContainerElement() {
647
+ var container = getState2(element).container;
648
+ if (!container) {
649
+ container = document.createElement("div");
650
+ container.className = detectionContainerClass;
651
+ container.style.cssText = buildCssTextString(["visibility: hidden", "display: inline", "width: 0px", "height: 0px", "z-index: -1", "overflow: hidden", "margin: 0", "padding: 0"]);
652
+ getState2(element).container = container;
653
+ addAnimationClass(container);
654
+ element.appendChild(container);
655
+ var onAnimationStart = function() {
656
+ getState2(element).onRendered && getState2(element).onRendered();
657
+ };
658
+ addEvent(container, "animationstart", onAnimationStart);
659
+ getState2(element).onAnimationStart = onAnimationStart;
660
+ }
661
+ return container;
662
+ }
663
+ function injectScrollElements() {
664
+ function alterPositionStyles() {
665
+ var style = getState2(element).style;
666
+ if (style.position === "static") {
667
+ element.style.setProperty("position", "relative", options2.important ? "important" : "");
668
+ var removeRelativeStyles = function(reporter3, element2, style2, property) {
669
+ function getNumericalValue(value2) {
670
+ return value2.replace(/[^-\d\.]/g, "");
671
+ }
672
+ var value = style2[property];
673
+ if (value !== "auto" && getNumericalValue(value) !== "0") {
674
+ reporter3.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relative, so the style." + property + " will be set to 0. Element: ", element2);
675
+ element2.style[property] = 0;
676
+ }
677
+ };
678
+ removeRelativeStyles(reporter2, element, style, "top");
679
+ removeRelativeStyles(reporter2, element, style, "right");
680
+ removeRelativeStyles(reporter2, element, style, "bottom");
681
+ removeRelativeStyles(reporter2, element, style, "left");
682
+ }
683
+ }
684
+ function getLeftTopBottomRightCssText(left, top, bottom, right) {
685
+ left = !left ? "0" : left + "px";
686
+ top = !top ? "0" : top + "px";
687
+ bottom = !bottom ? "0" : bottom + "px";
688
+ right = !right ? "0" : right + "px";
689
+ return ["left: " + left, "top: " + top, "right: " + right, "bottom: " + bottom];
690
+ }
691
+ debug("Injecting elements");
692
+ if (!getState2(element)) {
693
+ debug("Aborting because element has been uninstalled");
694
+ return;
695
+ }
696
+ alterPositionStyles();
697
+ var rootContainer = getState2(element).container;
698
+ if (!rootContainer) {
699
+ rootContainer = injectContainerElement();
700
+ }
701
+ var scrollbarWidth = scrollbarSizes.width;
702
+ var scrollbarHeight = scrollbarSizes.height;
703
+ var containerContainerStyle = buildCssTextString(["position: absolute", "flex: none", "overflow: hidden", "z-index: -1", "visibility: hidden", "width: 100%", "height: 100%", "left: 0px", "top: 0px"]);
704
+ var containerStyle = buildCssTextString(["position: absolute", "flex: none", "overflow: hidden", "z-index: -1", "visibility: hidden"].concat(getLeftTopBottomRightCssText(-(1 + scrollbarWidth), -(1 + scrollbarHeight), -scrollbarHeight, -scrollbarWidth)));
705
+ var expandStyle = buildCssTextString(["position: absolute", "flex: none", "overflow: scroll", "z-index: -1", "visibility: hidden", "width: 100%", "height: 100%"]);
706
+ var shrinkStyle = buildCssTextString(["position: absolute", "flex: none", "overflow: scroll", "z-index: -1", "visibility: hidden", "width: 100%", "height: 100%"]);
707
+ var expandChildStyle = buildCssTextString(["position: absolute", "left: 0", "top: 0"]);
708
+ var shrinkChildStyle = buildCssTextString(["position: absolute", "width: 200%", "height: 200%"]);
709
+ var containerContainer = document.createElement("div");
710
+ var container = document.createElement("div");
711
+ var expand = document.createElement("div");
712
+ var expandChild = document.createElement("div");
713
+ var shrink = document.createElement("div");
714
+ var shrinkChild = document.createElement("div");
715
+ containerContainer.dir = "ltr";
716
+ containerContainer.style.cssText = containerContainerStyle;
717
+ containerContainer.className = detectionContainerClass;
718
+ container.className = detectionContainerClass;
719
+ container.style.cssText = containerStyle;
720
+ expand.style.cssText = expandStyle;
721
+ expandChild.style.cssText = expandChildStyle;
722
+ shrink.style.cssText = shrinkStyle;
723
+ shrinkChild.style.cssText = shrinkChildStyle;
724
+ expand.appendChild(expandChild);
725
+ shrink.appendChild(shrinkChild);
726
+ container.appendChild(expand);
727
+ container.appendChild(shrink);
728
+ containerContainer.appendChild(container);
729
+ rootContainer.appendChild(containerContainer);
730
+ function onExpandScroll() {
731
+ var state = getState2(element);
732
+ if (state && state.onExpand) {
733
+ state.onExpand();
734
+ } else {
735
+ debug("Aborting expand scroll handler: element has been uninstalled");
736
+ }
737
+ }
738
+ function onShrinkScroll() {
739
+ var state = getState2(element);
740
+ if (state && state.onShrink) {
741
+ state.onShrink();
742
+ } else {
743
+ debug("Aborting shrink scroll handler: element has been uninstalled");
744
+ }
745
+ }
746
+ addEvent(expand, "scroll", onExpandScroll);
747
+ addEvent(shrink, "scroll", onShrinkScroll);
748
+ getState2(element).onExpandScroll = onExpandScroll;
749
+ getState2(element).onShrinkScroll = onShrinkScroll;
750
+ }
751
+ function registerListenersAndPositionElements() {
752
+ function updateChildSizes(element2, width, height) {
753
+ var expandChild = getExpandChildElement(element2);
754
+ var expandWidth = getExpandWidth(width);
755
+ var expandHeight = getExpandHeight(height);
756
+ expandChild.style.setProperty("width", expandWidth + "px", options2.important ? "important" : "");
757
+ expandChild.style.setProperty("height", expandHeight + "px", options2.important ? "important" : "");
758
+ }
759
+ function updateDetectorElements(done) {
760
+ var width = element.offsetWidth;
761
+ var height = element.offsetHeight;
762
+ var sizeChanged = width !== getState2(element).lastWidth || height !== getState2(element).lastHeight;
763
+ debug("Storing current size", width, height);
764
+ storeCurrentSize(element, width, height);
765
+ batchProcessor2.add(0, function performUpdateChildSizes() {
766
+ if (!sizeChanged) {
767
+ return;
768
+ }
769
+ if (!getState2(element)) {
770
+ debug("Aborting because element has been uninstalled");
771
+ return;
772
+ }
773
+ if (!areElementsInjected()) {
774
+ debug("Aborting because element container has not been initialized");
775
+ return;
776
+ }
777
+ if (options2.debug) {
778
+ var w = element.offsetWidth;
779
+ var h = element.offsetHeight;
780
+ if (w !== width || h !== height) {
781
+ reporter2.warn(idHandler2.get(element), "Scroll: Size changed before updating detector elements.");
782
+ }
783
+ }
784
+ updateChildSizes(element, width, height);
785
+ });
786
+ batchProcessor2.add(1, function updateScrollbars() {
787
+ if (!getState2(element)) {
788
+ debug("Aborting because element has been uninstalled");
789
+ return;
790
+ }
791
+ if (!areElementsInjected()) {
792
+ debug("Aborting because element container has not been initialized");
793
+ return;
794
+ }
795
+ positionScrollbars(element, width, height);
796
+ });
797
+ if (sizeChanged && done) {
798
+ batchProcessor2.add(2, function() {
799
+ if (!getState2(element)) {
800
+ debug("Aborting because element has been uninstalled");
801
+ return;
802
+ }
803
+ if (!areElementsInjected()) {
804
+ debug("Aborting because element container has not been initialized");
805
+ return;
806
+ }
807
+ done();
808
+ });
809
+ }
810
+ }
811
+ function areElementsInjected() {
812
+ return !!getState2(element).container;
813
+ }
814
+ function notifyListenersIfNeeded() {
815
+ function isFirstNotify() {
816
+ return getState2(element).lastNotifiedWidth === void 0;
817
+ }
818
+ debug("notifyListenersIfNeeded invoked");
819
+ var state = getState2(element);
820
+ if (isFirstNotify() && state.lastWidth === state.startSize.width && state.lastHeight === state.startSize.height) {
821
+ return debug("Not notifying: Size is the same as the start size, and there has been no notification yet.");
822
+ }
823
+ if (state.lastWidth === state.lastNotifiedWidth && state.lastHeight === state.lastNotifiedHeight) {
824
+ return debug("Not notifying: Size already notified");
825
+ }
826
+ debug("Current size not notified, notifying...");
827
+ state.lastNotifiedWidth = state.lastWidth;
828
+ state.lastNotifiedHeight = state.lastHeight;
829
+ forEach$1(getState2(element).listeners, function(listener) {
830
+ listener(element);
831
+ });
832
+ }
833
+ function handleRender() {
834
+ debug("startanimation triggered.");
835
+ if (isUnrendered(element)) {
836
+ debug("Ignoring since element is still unrendered...");
837
+ return;
838
+ }
839
+ debug("Element rendered.");
840
+ var expand = getExpandElement(element);
841
+ var shrink = getShrinkElement(element);
842
+ if (expand.scrollLeft === 0 || expand.scrollTop === 0 || shrink.scrollLeft === 0 || shrink.scrollTop === 0) {
843
+ debug("Scrollbars out of sync. Updating detector elements...");
844
+ updateDetectorElements(notifyListenersIfNeeded);
845
+ }
846
+ }
847
+ function handleScroll() {
848
+ debug("Scroll detected.");
849
+ if (isUnrendered(element)) {
850
+ debug("Scroll event fired while unrendered. Ignoring...");
851
+ return;
852
+ }
853
+ updateDetectorElements(notifyListenersIfNeeded);
854
+ }
855
+ debug("registerListenersAndPositionElements invoked.");
856
+ if (!getState2(element)) {
857
+ debug("Aborting because element has been uninstalled");
858
+ return;
859
+ }
860
+ getState2(element).onRendered = handleRender;
861
+ getState2(element).onExpand = handleScroll;
862
+ getState2(element).onShrink = handleScroll;
863
+ var style = getState2(element).style;
864
+ updateChildSizes(element, style.width, style.height);
865
+ }
866
+ function finalizeDomMutation() {
867
+ debug("finalizeDomMutation invoked.");
868
+ if (!getState2(element)) {
869
+ debug("Aborting because element has been uninstalled");
870
+ return;
871
+ }
872
+ var style = getState2(element).style;
873
+ storeCurrentSize(element, style.width, style.height);
874
+ positionScrollbars(element, style.width, style.height);
875
+ }
876
+ function ready() {
877
+ callback(element);
878
+ }
879
+ function install2() {
880
+ debug("Installing...");
881
+ initListeners();
882
+ storeStartSize();
883
+ batchProcessor2.add(0, storeStyle);
884
+ batchProcessor2.add(1, injectScrollElements);
885
+ batchProcessor2.add(2, registerListenersAndPositionElements);
886
+ batchProcessor2.add(3, finalizeDomMutation);
887
+ batchProcessor2.add(4, ready);
888
+ }
889
+ debug("Making detectable...");
890
+ if (isDetached(element)) {
891
+ debug("Element is detached");
892
+ injectContainerElement();
893
+ debug("Waiting until element is attached...");
894
+ getState2(element).onRendered = function() {
895
+ debug("Element is now attached");
896
+ install2();
897
+ };
898
+ } else {
899
+ install2();
900
+ }
901
+ }
902
+ function uninstall(element) {
903
+ var state = getState2(element);
904
+ if (!state) {
905
+ return;
906
+ }
907
+ state.onExpandScroll && removeEvent(getExpandElement(element), "scroll", state.onExpandScroll);
908
+ state.onShrinkScroll && removeEvent(getShrinkElement(element), "scroll", state.onShrinkScroll);
909
+ state.onAnimationStart && removeEvent(state.container, "animationstart", state.onAnimationStart);
910
+ state.container && element.removeChild(state.container);
911
+ }
912
+ return {
913
+ makeDetectable,
914
+ addListener,
915
+ uninstall,
916
+ initDocument
917
+ };
918
+ };
919
+ var forEach = collectionUtils.exports.forEach;
920
+ var elementUtilsMaker = elementUtils;
921
+ var listenerHandlerMaker = listenerHandler;
922
+ var idGeneratorMaker = idGenerator;
923
+ var idHandlerMaker = idHandler;
924
+ var reporterMaker = reporter;
925
+ var browserDetector = browserDetector$2.exports;
926
+ var batchProcessorMaker2 = batchProcessor;
927
+ var stateHandler = stateHandler$1;
928
+ var objectStrategyMaker = object;
929
+ var scrollStrategyMaker = scroll;
930
+ function isCollection(obj) {
931
+ return Array.isArray(obj) || obj.length !== void 0;
932
+ }
933
+ function toArray(collection) {
934
+ if (!Array.isArray(collection)) {
935
+ var array = [];
936
+ forEach(collection, function(obj) {
937
+ array.push(obj);
938
+ });
939
+ return array;
940
+ } else {
941
+ return collection;
942
+ }
943
+ }
944
+ function isElement(obj) {
945
+ return obj && obj.nodeType === 1;
946
+ }
947
+ var elementResizeDetector = function(options) {
948
+ options = options || {};
949
+ var idHandler2;
950
+ if (options.idHandler) {
951
+ idHandler2 = {
952
+ get: function(element) {
953
+ return options.idHandler.get(element, true);
954
+ },
955
+ set: options.idHandler.set
956
+ };
957
+ } else {
958
+ var idGenerator2 = idGeneratorMaker();
959
+ var defaultIdHandler = idHandlerMaker({
960
+ idGenerator: idGenerator2,
961
+ stateHandler
962
+ });
963
+ idHandler2 = defaultIdHandler;
964
+ }
965
+ var reporter2 = options.reporter;
966
+ if (!reporter2) {
967
+ var quiet = reporter2 === false;
968
+ reporter2 = reporterMaker(quiet);
969
+ }
970
+ var batchProcessor2 = getOption(options, "batchProcessor", batchProcessorMaker2({ reporter: reporter2 }));
971
+ var globalOptions = {};
972
+ globalOptions.callOnAdd = !!getOption(options, "callOnAdd", true);
973
+ globalOptions.debug = !!getOption(options, "debug", false);
974
+ var eventListenerHandler = listenerHandlerMaker(idHandler2);
975
+ var elementUtils2 = elementUtilsMaker({
976
+ stateHandler
977
+ });
978
+ var detectionStrategy;
979
+ var desiredStrategy = getOption(options, "strategy", "object");
980
+ var importantCssRules = getOption(options, "important", false);
981
+ var strategyOptions = {
982
+ reporter: reporter2,
983
+ batchProcessor: batchProcessor2,
984
+ stateHandler,
985
+ idHandler: idHandler2,
986
+ important: importantCssRules
987
+ };
988
+ if (desiredStrategy === "scroll") {
989
+ if (browserDetector.isLegacyOpera()) {
990
+ reporter2.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy.");
991
+ desiredStrategy = "object";
992
+ } else if (browserDetector.isIE(9)) {
993
+ reporter2.warn("Scroll strategy is not supported on IE9. Changing to object strategy.");
994
+ desiredStrategy = "object";
995
+ }
996
+ }
997
+ if (desiredStrategy === "scroll") {
998
+ detectionStrategy = scrollStrategyMaker(strategyOptions);
999
+ } else if (desiredStrategy === "object") {
1000
+ detectionStrategy = objectStrategyMaker(strategyOptions);
1001
+ } else {
1002
+ throw new Error("Invalid strategy name: " + desiredStrategy);
1003
+ }
1004
+ var onReadyCallbacks = {};
1005
+ function listenTo(options2, elements, listener) {
1006
+ function onResizeCallback(element) {
1007
+ var listeners = eventListenerHandler.get(element);
1008
+ forEach(listeners, function callListenerProxy(listener2) {
1009
+ listener2(element);
1010
+ });
1011
+ }
1012
+ function addListener(callOnAdd2, element, listener2) {
1013
+ eventListenerHandler.add(element, listener2);
1014
+ if (callOnAdd2) {
1015
+ listener2(element);
1016
+ }
1017
+ }
1018
+ if (!listener) {
1019
+ listener = elements;
1020
+ elements = options2;
1021
+ options2 = {};
1022
+ }
1023
+ if (!elements) {
1024
+ throw new Error("At least one element required.");
1025
+ }
1026
+ if (!listener) {
1027
+ throw new Error("Listener required.");
1028
+ }
1029
+ if (isElement(elements)) {
1030
+ elements = [elements];
1031
+ } else if (isCollection(elements)) {
1032
+ elements = toArray(elements);
1033
+ } else {
1034
+ return reporter2.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");
1035
+ }
1036
+ var elementsReady = 0;
1037
+ var callOnAdd = getOption(options2, "callOnAdd", globalOptions.callOnAdd);
1038
+ var onReadyCallback = getOption(options2, "onReady", function noop2() {
1039
+ });
1040
+ var debug = getOption(options2, "debug", globalOptions.debug);
1041
+ forEach(elements, function attachListenerToElement(element) {
1042
+ if (!stateHandler.getState(element)) {
1043
+ stateHandler.initState(element);
1044
+ idHandler2.set(element);
1045
+ }
1046
+ var id = idHandler2.get(element);
1047
+ debug && reporter2.log("Attaching listener to element", id, element);
1048
+ if (!elementUtils2.isDetectable(element)) {
1049
+ debug && reporter2.log(id, "Not detectable.");
1050
+ if (elementUtils2.isBusy(element)) {
1051
+ debug && reporter2.log(id, "System busy making it detectable");
1052
+ addListener(callOnAdd, element, listener);
1053
+ onReadyCallbacks[id] = onReadyCallbacks[id] || [];
1054
+ onReadyCallbacks[id].push(function onReady() {
1055
+ elementsReady++;
1056
+ if (elementsReady === elements.length) {
1057
+ onReadyCallback();
1058
+ }
1059
+ });
1060
+ return;
1061
+ }
1062
+ debug && reporter2.log(id, "Making detectable...");
1063
+ elementUtils2.markBusy(element, true);
1064
+ return detectionStrategy.makeDetectable({ debug, important: importantCssRules }, element, function onElementDetectable(element2) {
1065
+ debug && reporter2.log(id, "onElementDetectable");
1066
+ if (stateHandler.getState(element2)) {
1067
+ elementUtils2.markAsDetectable(element2);
1068
+ elementUtils2.markBusy(element2, false);
1069
+ detectionStrategy.addListener(element2, onResizeCallback);
1070
+ addListener(callOnAdd, element2, listener);
1071
+ var state = stateHandler.getState(element2);
1072
+ if (state && state.startSize) {
1073
+ var width = element2.offsetWidth;
1074
+ var height = element2.offsetHeight;
1075
+ if (state.startSize.width !== width || state.startSize.height !== height) {
1076
+ onResizeCallback(element2);
1077
+ }
1078
+ }
1079
+ if (onReadyCallbacks[id]) {
1080
+ forEach(onReadyCallbacks[id], function(callback) {
1081
+ callback();
1082
+ });
1083
+ }
1084
+ } else {
1085
+ debug && reporter2.log(id, "Element uninstalled before being detectable.");
1086
+ }
1087
+ delete onReadyCallbacks[id];
1088
+ elementsReady++;
1089
+ if (elementsReady === elements.length) {
1090
+ onReadyCallback();
1091
+ }
1092
+ });
1093
+ }
1094
+ debug && reporter2.log(id, "Already detecable, adding listener.");
1095
+ addListener(callOnAdd, element, listener);
1096
+ elementsReady++;
1097
+ });
1098
+ if (elementsReady === elements.length) {
1099
+ onReadyCallback();
1100
+ }
1101
+ }
1102
+ function uninstall(elements) {
1103
+ if (!elements) {
1104
+ return reporter2.error("At least one element is required.");
1105
+ }
1106
+ if (isElement(elements)) {
1107
+ elements = [elements];
1108
+ } else if (isCollection(elements)) {
1109
+ elements = toArray(elements);
1110
+ } else {
1111
+ return reporter2.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");
1112
+ }
1113
+ forEach(elements, function(element) {
1114
+ eventListenerHandler.removeAllListeners(element);
1115
+ detectionStrategy.uninstall(element);
1116
+ stateHandler.cleanState(element);
1117
+ });
1118
+ }
1119
+ function initDocument(targetDocument) {
1120
+ detectionStrategy.initDocument && detectionStrategy.initDocument(targetDocument);
1121
+ }
1122
+ return {
1123
+ listenTo,
1124
+ removeListener: eventListenerHandler.removeListener,
1125
+ removeAllListeners: eventListenerHandler.removeAllListeners,
1126
+ uninstall,
1127
+ initDocument
1128
+ };
1129
+ };
1130
+ function getOption(options, name, defaultValue) {
1131
+ var value = options[name];
1132
+ if ((value === void 0 || value === null) && defaultValue !== void 0) {
1133
+ return defaultValue;
1134
+ }
1135
+ return value;
1136
+ }
1137
+ var _a;
1138
+ const isClient = typeof window !== "undefined";
1139
+ const isString = (val) => typeof val === "string";
1140
+ const noop = () => {
1141
+ };
1142
+ isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
1143
+ function tryOnScopeDispose(fn) {
1144
+ if (getCurrentScope()) {
1145
+ onScopeDispose(fn);
1146
+ return true;
1147
+ }
1148
+ return false;
1149
+ }
1150
+ function tryOnMounted(fn, sync = true) {
1151
+ if (getCurrentInstance())
1152
+ onMounted(fn);
1153
+ else if (sync)
1154
+ fn();
1155
+ else
1156
+ nextTick(fn);
1157
+ }
1158
+ function unrefElement(elRef) {
1159
+ var _a2;
1160
+ const plain = unref(elRef);
1161
+ return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
1162
+ }
1163
+ const defaultWindow = isClient ? window : void 0;
1164
+ isClient ? window.document : void 0;
1165
+ isClient ? window.navigator : void 0;
1166
+ isClient ? window.location : void 0;
1167
+ function useEventListener(...args) {
1168
+ let target;
1169
+ let event;
1170
+ let listener;
1171
+ let options;
1172
+ if (isString(args[0])) {
1173
+ [event, listener, options] = args;
1174
+ target = defaultWindow;
1175
+ } else {
1176
+ [target, event, listener, options] = args;
1177
+ }
1178
+ if (!target)
1179
+ return noop;
1180
+ let cleanup = noop;
1181
+ const stopWatch = watch(() => unrefElement(target), (el) => {
1182
+ cleanup();
1183
+ if (!el)
1184
+ return;
1185
+ el.addEventListener(event, listener, options);
1186
+ cleanup = () => {
1187
+ el.removeEventListener(event, listener, options);
1188
+ cleanup = noop;
1189
+ };
1190
+ }, { immediate: true, flush: "post" });
1191
+ const stop = () => {
1192
+ stopWatch();
1193
+ cleanup();
1194
+ };
1195
+ tryOnScopeDispose(stop);
1196
+ return stop;
1197
+ }
1198
+ const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1199
+ const globalKey = "__vueuse_ssr_handlers__";
1200
+ _global[globalKey] = _global[globalKey] || {};
1201
+ _global[globalKey];
1202
+ var SwipeDirection;
1203
+ (function(SwipeDirection2) {
1204
+ SwipeDirection2["UP"] = "UP";
1205
+ SwipeDirection2["RIGHT"] = "RIGHT";
1206
+ SwipeDirection2["DOWN"] = "DOWN";
1207
+ SwipeDirection2["LEFT"] = "LEFT";
1208
+ SwipeDirection2["NONE"] = "NONE";
1209
+ })(SwipeDirection || (SwipeDirection = {}));
1210
+ function useWindowSize(options = {}) {
1211
+ const {
1212
+ window: window2 = defaultWindow,
1213
+ initialWidth = Infinity,
1214
+ initialHeight = Infinity,
1215
+ listenOrientation = true
1216
+ } = options;
1217
+ const width = ref(initialWidth);
1218
+ const height = ref(initialHeight);
1219
+ const update = () => {
1220
+ if (window2) {
1221
+ width.value = window2.innerWidth;
1222
+ height.value = window2.innerHeight;
1223
+ }
1224
+ };
1225
+ update();
1226
+ tryOnMounted(update);
1227
+ useEventListener("resize", update, { passive: true });
1228
+ if (listenOrientation)
1229
+ useEventListener("orientationchange", update, { passive: true });
1230
+ return { width, height };
1231
+ }
1232
+ var index_vue_vue_type_style_index_0_scoped_true_lang = "";
1233
+ var _export_sfc = (sfc, props) => {
1234
+ const target = sfc.__vccOpts || sfc;
1235
+ for (const [key, val] of props) {
1236
+ target[key] = val;
1237
+ }
1238
+ return target;
1239
+ };
1240
+ const _hoisted_1 = { class: "ChartContent" };
1241
+ const _sfc_main = defineComponent({
1242
+ __name: "index",
1243
+ setup(__props, { expose: __expose }) {
1244
+ const attrs = useAttrs();
1245
+ const chartRef = shallowRef(null);
1246
+ const myChart = shallowRef();
1247
+ const { width, height } = useWindowSize();
1248
+ watch([width, height], (n) => {
1249
+ onResize();
1250
+ });
1251
+ const handleChart = () => {
1252
+ var _a2, _b, _c, _d, _e;
1253
+ myChart.value ? (_a2 = myChart.value) == null ? void 0 : _a2.dispose() : null;
1254
+ myChart.value = echarts.init(
1255
+ chartRef.value,
1256
+ null,
1257
+ attrs == null ? void 0 : attrs.initInfo
1258
+ );
1259
+ (_b = attrs == null ? void 0 : attrs.getSeriesData) == null ? void 0 : _b.call(attrs, attrs == null ? void 0 : attrs.data, myChart.value);
1260
+ myChart.value && attrs.option ? (_c = myChart.value) == null ? void 0 : _c.setOption(attrs.option) : null;
1261
+ onResize();
1262
+ (_d = myChart.value) == null ? void 0 : _d.on("legendselectchanged", (params) => {
1263
+ var _a3;
1264
+ if (attrs == null ? void 0 : attrs.chartEventLegendselectchanged) {
1265
+ const options = attrs == null ? void 0 : attrs.chartEventLegendselectchanged(params);
1266
+ myChart.value && (attrs.option || options) ? (_a3 = myChart.value) == null ? void 0 : _a3.setOption(options || attrs.option) : null;
1267
+ }
1268
+ });
1269
+ (_e = myChart.value) == null ? void 0 : _e.on("click", (params) => {
1270
+ var _a3;
1271
+ if (attrs == null ? void 0 : attrs.chartEventClick) {
1272
+ const options = attrs == null ? void 0 : attrs.chartEventClick(params);
1273
+ myChart.value && (attrs.option || options) ? (_a3 = myChart.value) == null ? void 0 : _a3.setOption(options || attrs.option) : null;
1274
+ }
1275
+ });
1276
+ };
1277
+ const onResize = () => {
1278
+ let elementResize2 = elementResizeDetector({
1279
+ strategy: "scroll",
1280
+ callOnAdd: true
1281
+ });
1282
+ nextTick(() => {
1283
+ chartRef.value ? elementResize2.listenTo(chartRef.value, function(element) {
1284
+ chartRef.value ? echarts == null ? void 0 : echarts.init(chartRef.value).resize() : null;
1285
+ }) : null;
1286
+ });
1287
+ };
1288
+ watch(
1289
+ () => attrs.data,
1290
+ (n) => {
1291
+ if (n || (n == null ? void 0 : n.length)) {
1292
+ if (chartRef.value) {
1293
+ handleChart();
1294
+ }
1295
+ }
1296
+ },
1297
+ {
1298
+ immediate: true,
1299
+ deep: true
1300
+ }
1301
+ );
1302
+ __expose({
1303
+ myChart,
1304
+ onResize
1305
+ });
1306
+ const hasData = () => {
1307
+ var _a2, _b;
1308
+ if ((attrs == null ? void 0 : attrs.data) != null && (attrs == null ? void 0 : attrs.data) != void 0) {
1309
+ if (Array.isArray(attrs == null ? void 0 : attrs.data)) {
1310
+ return (_a2 = attrs == null ? void 0 : attrs.data) == null ? void 0 : _a2.length;
1311
+ } else if (Object.prototype.toString.call(attrs == null ? void 0 : attrs.data) === "[object Object]") {
1312
+ return (_b = Object.keys(attrs == null ? void 0 : attrs.data)) == null ? void 0 : _b.length;
1313
+ }
1314
+ } else {
1315
+ return false;
1316
+ }
1317
+ };
1318
+ onMounted(() => {
1319
+ if (hasData() && chartRef.value) {
1320
+ handleChart();
1321
+ }
1322
+ });
1323
+ onUnmounted(() => {
1324
+ var _a2;
1325
+ myChart.value ? (_a2 = myChart.value) == null ? void 0 : _a2.dispose() : null;
1326
+ });
1327
+ return (_ctx, _cache) => {
1328
+ return openBlock(), createElementBlock("div", _hoisted_1, [
1329
+ createElementVNode("div", {
1330
+ class: "chart",
1331
+ ref_key: "chartRef",
1332
+ ref: chartRef
1333
+ }, null, 512)
1334
+ ]);
1335
+ };
1336
+ }
1337
+ });
1338
+ var YCharts = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9ee3fe2c"]]);
1339
+ YCharts.install = (app) => {
1340
+ app.component("YCharts", YCharts);
1341
+ };
1342
+ const components = [YCharts];
1343
+ const install = (app) => {
1344
+ components.forEach((component) => {
1345
+ if (component.install) {
1346
+ app.use(component);
1347
+ } else if (component.name) {
1348
+ app.component(component.name, component);
1349
+ }
1350
+ });
1351
+ };
1352
+ var index$2 = { install, version: "0.0.1" };
1353
+ var components$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1354
+ __proto__: null,
1355
+ YCharts,
1356
+ "default": index$2
1357
+ }, Symbol.toStringTag, { value: "Module" }));
1358
+ var index$1 = "";
1359
+ function debounce(fn, delay) {
1360
+ let timer = null;
1361
+ return function(...args) {
1362
+ if (timer)
1363
+ clearTimeout(timer);
1364
+ timer = setTimeout(() => {
1365
+ fn.apply(this, args);
1366
+ }, delay);
1367
+ };
1368
+ }
1369
+ function throttle(fn, delay) {
1370
+ let last = 0;
1371
+ return function(...args) {
1372
+ const now = Date.now();
1373
+ if (now - last >= delay) {
1374
+ fn.apply(this, args);
1375
+ last = now;
1376
+ }
1377
+ };
1378
+ }
1379
+ var index = {
1380
+ install: (app) => {
1381
+ Object.values(components$1).forEach((component) => {
1382
+ if (component.install) {
1383
+ app.use(component);
1384
+ } else if (component.name) {
1385
+ app.component(component.name, component);
1386
+ }
1387
+ });
1388
+ }
1389
+ };
1390
+ export { YCharts, debounce, index as default, throttle };
1391
+ //# sourceMappingURL=index.es.js.map