application

本地存储预览

  1. // ==UserScript==
  2. // @name application
  3. // @namespace npm/vite-plugin-monkey
  4. // @version 1.0.1
  5. // @author monkey
  6. // @description 本地存储预览
  7. // @license MIT
  8. // @icon https://www.qianxin.com/favicon.ico
  9. // @match *://*/*
  10. // @require https://cdn.jsdelivr.net/npm/vue@3.4.31/dist/vue.global.prod.js
  11. // @grant GM_setClipboard
  12. // ==/UserScript==
  13.  
  14. (o=>{const t=document.createElement("style");t.dataset.source="vite-plugin-monkey",t.innerText=o,document.head.appendChild(t)})('@font-face{font-family:iconfont;src:url(//at.alicdn.com/t/c/font_4622934_otm49hwnffj.woff2?t=1727177061564) format("woff2"),url(//at.alicdn.com/t/c/font_4622934_otm49hwnffj.woff?t=1727177061564) format("woff"),url(//at.alicdn.com/t/c/font_4622934_otm49hwnffj.ttf?t=1727177061564) format("truetype")}.iconfont{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-data:before{content:"\\e63d"}.icon-yanfagongshi:before{content:"\\e603"}.icon-fuzhi:before{content:"\\ec7a"}.group-btn-data-wrapper[data-v-062ced24]{position:fixed;right:16px;top:50%}');
  15.  
  16. (function(vue) {
  17. "use strict";
  18. const style = "";
  19. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  20. const handleEvent = (event) => {
  21. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  22. if (checkForDefaultPrevented === false || !shouldPrevent) {
  23. return oursHandler == null ? void 0 : oursHandler(event);
  24. }
  25. };
  26. return handleEvent;
  27. };
  28. var _a;
  29. const isClient = typeof window !== "undefined";
  30. const isString$1 = (val) => typeof val === "string";
  31. const noop = () => {
  32. };
  33. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  34. function resolveUnref(r) {
  35. return typeof r === "function" ? r() : vue.unref(r);
  36. }
  37. function identity$1(arg) {
  38. return arg;
  39. }
  40. function tryOnScopeDispose(fn2) {
  41. if (vue.getCurrentScope()) {
  42. vue.onScopeDispose(fn2);
  43. return true;
  44. }
  45. return false;
  46. }
  47. function tryOnMounted(fn2, sync = true) {
  48. if (vue.getCurrentInstance())
  49. vue.onMounted(fn2);
  50. else if (sync)
  51. fn2();
  52. else
  53. vue.nextTick(fn2);
  54. }
  55. function useTimeoutFn(cb, interval, options = {}) {
  56. const {
  57. immediate = true
  58. } = options;
  59. const isPending = vue.ref(false);
  60. let timer = null;
  61. function clear() {
  62. if (timer) {
  63. clearTimeout(timer);
  64. timer = null;
  65. }
  66. }
  67. function stop() {
  68. isPending.value = false;
  69. clear();
  70. }
  71. function start(...args) {
  72. clear();
  73. isPending.value = true;
  74. timer = setTimeout(() => {
  75. isPending.value = false;
  76. timer = null;
  77. cb(...args);
  78. }, resolveUnref(interval));
  79. }
  80. if (immediate) {
  81. isPending.value = true;
  82. if (isClient)
  83. start();
  84. }
  85. tryOnScopeDispose(stop);
  86. return {
  87. isPending: vue.readonly(isPending),
  88. start,
  89. stop
  90. };
  91. }
  92. function unrefElement(elRef) {
  93. var _a2;
  94. const plain = resolveUnref(elRef);
  95. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  96. }
  97. const defaultWindow = isClient ? window : void 0;
  98. function useEventListener(...args) {
  99. let target;
  100. let events;
  101. let listeners;
  102. let options;
  103. if (isString$1(args[0]) || Array.isArray(args[0])) {
  104. [events, listeners, options] = args;
  105. target = defaultWindow;
  106. } else {
  107. [target, events, listeners, options] = args;
  108. }
  109. if (!target)
  110. return noop;
  111. if (!Array.isArray(events))
  112. events = [events];
  113. if (!Array.isArray(listeners))
  114. listeners = [listeners];
  115. const cleanups = [];
  116. const cleanup = () => {
  117. cleanups.forEach((fn2) => fn2());
  118. cleanups.length = 0;
  119. };
  120. const register = (el, event, listener, options2) => {
  121. el.addEventListener(event, listener, options2);
  122. return () => el.removeEventListener(event, listener, options2);
  123. };
  124. const stopWatch = vue.watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
  125. cleanup();
  126. if (!el)
  127. return;
  128. cleanups.push(...events.flatMap((event) => {
  129. return listeners.map((listener) => register(el, event, listener, options2));
  130. }));
  131. }, { immediate: true, flush: "post" });
  132. const stop = () => {
  133. stopWatch();
  134. cleanup();
  135. };
  136. tryOnScopeDispose(stop);
  137. return stop;
  138. }
  139. let _iOSWorkaround = false;
  140. function onClickOutside(target, handler, options = {}) {
  141. const { window: window2 = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
  142. if (!window2)
  143. return;
  144. if (isIOS && !_iOSWorkaround) {
  145. _iOSWorkaround = true;
  146. Array.from(window2.document.body.children).forEach((el) => el.addEventListener("click", noop));
  147. }
  148. let shouldListen = true;
  149. const shouldIgnore = (event) => {
  150. return ignore.some((target2) => {
  151. if (typeof target2 === "string") {
  152. return Array.from(window2.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));
  153. } else {
  154. const el = unrefElement(target2);
  155. return el && (event.target === el || event.composedPath().includes(el));
  156. }
  157. });
  158. };
  159. const listener = (event) => {
  160. const el = unrefElement(target);
  161. if (!el || el === event.target || event.composedPath().includes(el))
  162. return;
  163. if (event.detail === 0)
  164. shouldListen = !shouldIgnore(event);
  165. if (!shouldListen) {
  166. shouldListen = true;
  167. return;
  168. }
  169. handler(event);
  170. };
  171. const cleanup = [
  172. useEventListener(window2, "click", listener, { passive: true, capture }),
  173. useEventListener(window2, "pointerdown", (e) => {
  174. const el = unrefElement(target);
  175. if (el)
  176. shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
  177. }, { passive: true }),
  178. detectIframe && useEventListener(window2, "blur", (event) => {
  179. var _a2;
  180. const el = unrefElement(target);
  181. if (((_a2 = window2.document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window2.document.activeElement)))
  182. handler(event);
  183. })
  184. ].filter(Boolean);
  185. const stop = () => cleanup.forEach((fn2) => fn2());
  186. return stop;
  187. }
  188. function useSupported(callback, sync = false) {
  189. const isSupported = vue.ref();
  190. const update = () => isSupported.value = Boolean(callback());
  191. update();
  192. tryOnMounted(update, sync);
  193. return isSupported;
  194. }
  195. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  196. const globalKey = "__vueuse_ssr_handlers__";
  197. _global[globalKey] = _global[globalKey] || {};
  198. _global[globalKey];
  199. var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
  200. var __hasOwnProp$g = Object.prototype.hasOwnProperty;
  201. var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
  202. var __objRest$2 = (source, exclude) => {
  203. var target = {};
  204. for (var prop in source)
  205. if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
  206. target[prop] = source[prop];
  207. if (source != null && __getOwnPropSymbols$g)
  208. for (var prop of __getOwnPropSymbols$g(source)) {
  209. if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
  210. target[prop] = source[prop];
  211. }
  212. return target;
  213. };
  214. function useResizeObserver(target, callback, options = {}) {
  215. const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  216. let observer;
  217. const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
  218. const cleanup = () => {
  219. if (observer) {
  220. observer.disconnect();
  221. observer = void 0;
  222. }
  223. };
  224. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  225. cleanup();
  226. if (isSupported.value && window2 && el) {
  227. observer = new ResizeObserver(callback);
  228. observer.observe(el, observerOptions);
  229. }
  230. }, { immediate: true, flush: "post" });
  231. const stop = () => {
  232. cleanup();
  233. stopWatch();
  234. };
  235. tryOnScopeDispose(stop);
  236. return {
  237. isSupported,
  238. stop
  239. };
  240. }
  241. var SwipeDirection;
  242. (function(SwipeDirection2) {
  243. SwipeDirection2["UP"] = "UP";
  244. SwipeDirection2["RIGHT"] = "RIGHT";
  245. SwipeDirection2["DOWN"] = "DOWN";
  246. SwipeDirection2["LEFT"] = "LEFT";
  247. SwipeDirection2["NONE"] = "NONE";
  248. })(SwipeDirection || (SwipeDirection = {}));
  249. var __defProp = Object.defineProperty;
  250. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  251. var __hasOwnProp = Object.prototype.hasOwnProperty;
  252. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  253. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  254. var __spreadValues = (a2, b2) => {
  255. for (var prop in b2 || (b2 = {}))
  256. if (__hasOwnProp.call(b2, prop))
  257. __defNormalProp(a2, prop, b2[prop]);
  258. if (__getOwnPropSymbols)
  259. for (var prop of __getOwnPropSymbols(b2)) {
  260. if (__propIsEnum.call(b2, prop))
  261. __defNormalProp(a2, prop, b2[prop]);
  262. }
  263. return a2;
  264. };
  265. const _TransitionPresets = {
  266. easeInSine: [0.12, 0, 0.39, 0],
  267. easeOutSine: [0.61, 1, 0.88, 1],
  268. easeInOutSine: [0.37, 0, 0.63, 1],
  269. easeInQuad: [0.11, 0, 0.5, 0],
  270. easeOutQuad: [0.5, 1, 0.89, 1],
  271. easeInOutQuad: [0.45, 0, 0.55, 1],
  272. easeInCubic: [0.32, 0, 0.67, 0],
  273. easeOutCubic: [0.33, 1, 0.68, 1],
  274. easeInOutCubic: [0.65, 0, 0.35, 1],
  275. easeInQuart: [0.5, 0, 0.75, 0],
  276. easeOutQuart: [0.25, 1, 0.5, 1],
  277. easeInOutQuart: [0.76, 0, 0.24, 1],
  278. easeInQuint: [0.64, 0, 0.78, 0],
  279. easeOutQuint: [0.22, 1, 0.36, 1],
  280. easeInOutQuint: [0.83, 0, 0.17, 1],
  281. easeInExpo: [0.7, 0, 0.84, 0],
  282. easeOutExpo: [0.16, 1, 0.3, 1],
  283. easeInOutExpo: [0.87, 0, 0.13, 1],
  284. easeInCirc: [0.55, 0, 1, 0.45],
  285. easeOutCirc: [0, 0.55, 0.45, 1],
  286. easeInOutCirc: [0.85, 0, 0.15, 1],
  287. easeInBack: [0.36, 0, 0.66, -0.56],
  288. easeOutBack: [0.34, 1.56, 0.64, 1],
  289. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  290. };
  291. __spreadValues({
  292. linear: identity$1
  293. }, _TransitionPresets);
  294. /**
  295. * @vue/shared v3.4.31
  296. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  297. * @license MIT
  298. **/
  299. const NOOP = () => {
  300. };
  301. const hasOwnProperty$c = Object.prototype.hasOwnProperty;
  302. const hasOwn = (val, key) => hasOwnProperty$c.call(val, key);
  303. const isArray$2 = Array.isArray;
  304. const isFunction$1 = (val) => typeof val === "function";
  305. const isString = (val) => typeof val === "string";
  306. const isObject$1 = (val) => val !== null && typeof val === "object";
  307. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  308. const freeGlobal$1 = freeGlobal;
  309. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  310. var root = freeGlobal$1 || freeSelf || Function("return this")();
  311. const root$1 = root;
  312. var Symbol$1 = root$1.Symbol;
  313. const Symbol$2 = Symbol$1;
  314. var objectProto$e = Object.prototype;
  315. var hasOwnProperty$b = objectProto$e.hasOwnProperty;
  316. var nativeObjectToString$1 = objectProto$e.toString;
  317. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  318. function getRawTag(value) {
  319. var isOwn = hasOwnProperty$b.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  320. try {
  321. value[symToStringTag$1] = void 0;
  322. var unmasked = true;
  323. } catch (e) {
  324. }
  325. var result = nativeObjectToString$1.call(value);
  326. if (unmasked) {
  327. if (isOwn) {
  328. value[symToStringTag$1] = tag;
  329. } else {
  330. delete value[symToStringTag$1];
  331. }
  332. }
  333. return result;
  334. }
  335. var objectProto$d = Object.prototype;
  336. var nativeObjectToString = objectProto$d.toString;
  337. function objectToString(value) {
  338. return nativeObjectToString.call(value);
  339. }
  340. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  341. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  342. function baseGetTag(value) {
  343. if (value == null) {
  344. return value === void 0 ? undefinedTag : nullTag;
  345. }
  346. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  347. }
  348. function isObjectLike(value) {
  349. return value != null && typeof value == "object";
  350. }
  351. var symbolTag$1 = "[object Symbol]";
  352. function isSymbol(value) {
  353. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$1;
  354. }
  355. function arrayMap(array, iteratee) {
  356. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  357. while (++index < length) {
  358. result[index] = iteratee(array[index], index, array);
  359. }
  360. return result;
  361. }
  362. var isArray = Array.isArray;
  363. const isArray$1 = isArray;
  364. var INFINITY$1 = 1 / 0;
  365. var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
  366. function baseToString(value) {
  367. if (typeof value == "string") {
  368. return value;
  369. }
  370. if (isArray$1(value)) {
  371. return arrayMap(value, baseToString) + "";
  372. }
  373. if (isSymbol(value)) {
  374. return symbolToString ? symbolToString.call(value) : "";
  375. }
  376. var result = value + "";
  377. return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
  378. }
  379. var reWhitespace = /\s/;
  380. function trimmedEndIndex(string) {
  381. var index = string.length;
  382. while (index-- && reWhitespace.test(string.charAt(index))) {
  383. }
  384. return index;
  385. }
  386. var reTrimStart = /^\s+/;
  387. function baseTrim(string) {
  388. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
  389. }
  390. function isObject(value) {
  391. var type = typeof value;
  392. return value != null && (type == "object" || type == "function");
  393. }
  394. var NAN = 0 / 0;
  395. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  396. var reIsBinary = /^0b[01]+$/i;
  397. var reIsOctal = /^0o[0-7]+$/i;
  398. var freeParseInt = parseInt;
  399. function toNumber(value) {
  400. if (typeof value == "number") {
  401. return value;
  402. }
  403. if (isSymbol(value)) {
  404. return NAN;
  405. }
  406. if (isObject(value)) {
  407. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  408. value = isObject(other) ? other + "" : other;
  409. }
  410. if (typeof value != "string") {
  411. return value === 0 ? value : +value;
  412. }
  413. value = baseTrim(value);
  414. var isBinary = reIsBinary.test(value);
  415. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  416. }
  417. function identity(value) {
  418. return value;
  419. }
  420. var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  421. function isFunction(value) {
  422. if (!isObject(value)) {
  423. return false;
  424. }
  425. var tag = baseGetTag(value);
  426. return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
  427. }
  428. var coreJsData = root$1["__core-js_shared__"];
  429. const coreJsData$1 = coreJsData;
  430. var maskSrcKey = function() {
  431. var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  432. return uid ? "Symbol(src)_1." + uid : "";
  433. }();
  434. function isMasked(func) {
  435. return !!maskSrcKey && maskSrcKey in func;
  436. }
  437. var funcProto$2 = Function.prototype;
  438. var funcToString$2 = funcProto$2.toString;
  439. function toSource(func) {
  440. if (func != null) {
  441. try {
  442. return funcToString$2.call(func);
  443. } catch (e) {
  444. }
  445. try {
  446. return func + "";
  447. } catch (e) {
  448. }
  449. }
  450. return "";
  451. }
  452. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  453. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  454. var funcProto$1 = Function.prototype, objectProto$c = Object.prototype;
  455. var funcToString$1 = funcProto$1.toString;
  456. var hasOwnProperty$a = objectProto$c.hasOwnProperty;
  457. var reIsNative = RegExp(
  458. "^" + funcToString$1.call(hasOwnProperty$a).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  459. );
  460. function baseIsNative(value) {
  461. if (!isObject(value) || isMasked(value)) {
  462. return false;
  463. }
  464. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  465. return pattern.test(toSource(value));
  466. }
  467. function getValue(object, key) {
  468. return object == null ? void 0 : object[key];
  469. }
  470. function getNative(object, key) {
  471. var value = getValue(object, key);
  472. return baseIsNative(value) ? value : void 0;
  473. }
  474. var WeakMap = getNative(root$1, "WeakMap");
  475. const WeakMap$1 = WeakMap;
  476. var objectCreate = Object.create;
  477. var baseCreate = function() {
  478. function object() {
  479. }
  480. return function(proto) {
  481. if (!isObject(proto)) {
  482. return {};
  483. }
  484. if (objectCreate) {
  485. return objectCreate(proto);
  486. }
  487. object.prototype = proto;
  488. var result = new object();
  489. object.prototype = void 0;
  490. return result;
  491. };
  492. }();
  493. const baseCreate$1 = baseCreate;
  494. function apply(func, thisArg, args) {
  495. switch (args.length) {
  496. case 0:
  497. return func.call(thisArg);
  498. case 1:
  499. return func.call(thisArg, args[0]);
  500. case 2:
  501. return func.call(thisArg, args[0], args[1]);
  502. case 3:
  503. return func.call(thisArg, args[0], args[1], args[2]);
  504. }
  505. return func.apply(thisArg, args);
  506. }
  507. function copyArray(source, array) {
  508. var index = -1, length = source.length;
  509. array || (array = Array(length));
  510. while (++index < length) {
  511. array[index] = source[index];
  512. }
  513. return array;
  514. }
  515. var HOT_COUNT = 800, HOT_SPAN = 16;
  516. var nativeNow = Date.now;
  517. function shortOut(func) {
  518. var count = 0, lastCalled = 0;
  519. return function() {
  520. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  521. lastCalled = stamp;
  522. if (remaining > 0) {
  523. if (++count >= HOT_COUNT) {
  524. return arguments[0];
  525. }
  526. } else {
  527. count = 0;
  528. }
  529. return func.apply(void 0, arguments);
  530. };
  531. }
  532. function constant(value) {
  533. return function() {
  534. return value;
  535. };
  536. }
  537. var defineProperty = function() {
  538. try {
  539. var func = getNative(Object, "defineProperty");
  540. func({}, "", {});
  541. return func;
  542. } catch (e) {
  543. }
  544. }();
  545. const defineProperty$1 = defineProperty;
  546. var baseSetToString = !defineProperty$1 ? identity : function(func, string) {
  547. return defineProperty$1(func, "toString", {
  548. "configurable": true,
  549. "enumerable": false,
  550. "value": constant(string),
  551. "writable": true
  552. });
  553. };
  554. const baseSetToString$1 = baseSetToString;
  555. var setToString = shortOut(baseSetToString$1);
  556. const setToString$1 = setToString;
  557. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  558. var reIsUint = /^(?:0|[1-9]\d*)$/;
  559. function isIndex(value, length) {
  560. var type = typeof value;
  561. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  562. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  563. }
  564. function baseAssignValue(object, key, value) {
  565. if (key == "__proto__" && defineProperty$1) {
  566. defineProperty$1(object, key, {
  567. "configurable": true,
  568. "enumerable": true,
  569. "value": value,
  570. "writable": true
  571. });
  572. } else {
  573. object[key] = value;
  574. }
  575. }
  576. function eq(value, other) {
  577. return value === other || value !== value && other !== other;
  578. }
  579. var objectProto$b = Object.prototype;
  580. var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
  581. function assignValue(object, key, value) {
  582. var objValue = object[key];
  583. if (!(hasOwnProperty$9.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  584. baseAssignValue(object, key, value);
  585. }
  586. }
  587. function copyObject(source, props, object, customizer) {
  588. var isNew = !object;
  589. object || (object = {});
  590. var index = -1, length = props.length;
  591. while (++index < length) {
  592. var key = props[index];
  593. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  594. if (newValue === void 0) {
  595. newValue = source[key];
  596. }
  597. if (isNew) {
  598. baseAssignValue(object, key, newValue);
  599. } else {
  600. assignValue(object, key, newValue);
  601. }
  602. }
  603. return object;
  604. }
  605. var nativeMax$1 = Math.max;
  606. function overRest(func, start, transform) {
  607. start = nativeMax$1(start === void 0 ? func.length - 1 : start, 0);
  608. return function() {
  609. var args = arguments, index = -1, length = nativeMax$1(args.length - start, 0), array = Array(length);
  610. while (++index < length) {
  611. array[index] = args[start + index];
  612. }
  613. index = -1;
  614. var otherArgs = Array(start + 1);
  615. while (++index < start) {
  616. otherArgs[index] = args[index];
  617. }
  618. otherArgs[start] = transform(array);
  619. return apply(func, this, otherArgs);
  620. };
  621. }
  622. function baseRest(func, start) {
  623. return setToString$1(overRest(func, start, identity), func + "");
  624. }
  625. var MAX_SAFE_INTEGER = 9007199254740991;
  626. function isLength(value) {
  627. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  628. }
  629. function isArrayLike(value) {
  630. return value != null && isLength(value.length) && !isFunction(value);
  631. }
  632. function isIterateeCall(value, index, object) {
  633. if (!isObject(object)) {
  634. return false;
  635. }
  636. var type = typeof index;
  637. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  638. return eq(object[index], value);
  639. }
  640. return false;
  641. }
  642. function createAssigner(assigner) {
  643. return baseRest(function(object, sources) {
  644. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  645. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  646. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  647. customizer = length < 3 ? void 0 : customizer;
  648. length = 1;
  649. }
  650. object = Object(object);
  651. while (++index < length) {
  652. var source = sources[index];
  653. if (source) {
  654. assigner(object, source, index, customizer);
  655. }
  656. }
  657. return object;
  658. });
  659. }
  660. var objectProto$a = Object.prototype;
  661. function isPrototype(value) {
  662. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$a;
  663. return value === proto;
  664. }
  665. function baseTimes(n, iteratee) {
  666. var index = -1, result = Array(n);
  667. while (++index < n) {
  668. result[index] = iteratee(index);
  669. }
  670. return result;
  671. }
  672. var argsTag$2 = "[object Arguments]";
  673. function baseIsArguments(value) {
  674. return isObjectLike(value) && baseGetTag(value) == argsTag$2;
  675. }
  676. var objectProto$9 = Object.prototype;
  677. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  678. var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
  679. var isArguments = baseIsArguments(function() {
  680. return arguments;
  681. }()) ? baseIsArguments : function(value) {
  682. return isObjectLike(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  683. };
  684. const isArguments$1 = isArguments;
  685. function stubFalse() {
  686. return false;
  687. }
  688. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  689. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  690. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  691. var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
  692. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  693. var isBuffer = nativeIsBuffer || stubFalse;
  694. const isBuffer$1 = isBuffer;
  695. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", weakMapTag$1 = "[object WeakMap]";
  696. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  697. var typedArrayTags = {};
  698. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
  699. typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
  700. function baseIsTypedArray(value) {
  701. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  702. }
  703. function baseUnary(func) {
  704. return function(value) {
  705. return func(value);
  706. };
  707. }
  708. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  709. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  710. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  711. var freeProcess = moduleExports$1 && freeGlobal$1.process;
  712. var nodeUtil = function() {
  713. try {
  714. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  715. if (types) {
  716. return types;
  717. }
  718. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  719. } catch (e) {
  720. }
  721. }();
  722. const nodeUtil$1 = nodeUtil;
  723. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  724. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  725. const isTypedArray$1 = isTypedArray;
  726. var objectProto$8 = Object.prototype;
  727. var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
  728. function arrayLikeKeys(value, inherited) {
  729. var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  730. for (var key in value) {
  731. if ((inherited || hasOwnProperty$7.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  732. result.push(key);
  733. }
  734. }
  735. return result;
  736. }
  737. function overArg(func, transform) {
  738. return function(arg) {
  739. return func(transform(arg));
  740. };
  741. }
  742. var nativeKeys = overArg(Object.keys, Object);
  743. const nativeKeys$1 = nativeKeys;
  744. var objectProto$7 = Object.prototype;
  745. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  746. function baseKeys(object) {
  747. if (!isPrototype(object)) {
  748. return nativeKeys$1(object);
  749. }
  750. var result = [];
  751. for (var key in Object(object)) {
  752. if (hasOwnProperty$6.call(object, key) && key != "constructor") {
  753. result.push(key);
  754. }
  755. }
  756. return result;
  757. }
  758. function keys(object) {
  759. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  760. }
  761. function nativeKeysIn(object) {
  762. var result = [];
  763. if (object != null) {
  764. for (var key in Object(object)) {
  765. result.push(key);
  766. }
  767. }
  768. return result;
  769. }
  770. var objectProto$6 = Object.prototype;
  771. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  772. function baseKeysIn(object) {
  773. if (!isObject(object)) {
  774. return nativeKeysIn(object);
  775. }
  776. var isProto = isPrototype(object), result = [];
  777. for (var key in object) {
  778. if (!(key == "constructor" && (isProto || !hasOwnProperty$5.call(object, key)))) {
  779. result.push(key);
  780. }
  781. }
  782. return result;
  783. }
  784. function keysIn(object) {
  785. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  786. }
  787. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  788. function isKey(value, object) {
  789. if (isArray$1(value)) {
  790. return false;
  791. }
  792. var type = typeof value;
  793. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  794. return true;
  795. }
  796. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  797. }
  798. var nativeCreate = getNative(Object, "create");
  799. const nativeCreate$1 = nativeCreate;
  800. function hashClear() {
  801. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  802. this.size = 0;
  803. }
  804. function hashDelete(key) {
  805. var result = this.has(key) && delete this.__data__[key];
  806. this.size -= result ? 1 : 0;
  807. return result;
  808. }
  809. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  810. var objectProto$5 = Object.prototype;
  811. var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
  812. function hashGet(key) {
  813. var data = this.__data__;
  814. if (nativeCreate$1) {
  815. var result = data[key];
  816. return result === HASH_UNDEFINED$2 ? void 0 : result;
  817. }
  818. return hasOwnProperty$4.call(data, key) ? data[key] : void 0;
  819. }
  820. var objectProto$4 = Object.prototype;
  821. var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
  822. function hashHas(key) {
  823. var data = this.__data__;
  824. return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$3.call(data, key);
  825. }
  826. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  827. function hashSet(key, value) {
  828. var data = this.__data__;
  829. this.size += this.has(key) ? 0 : 1;
  830. data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  831. return this;
  832. }
  833. function Hash(entries) {
  834. var index = -1, length = entries == null ? 0 : entries.length;
  835. this.clear();
  836. while (++index < length) {
  837. var entry = entries[index];
  838. this.set(entry[0], entry[1]);
  839. }
  840. }
  841. Hash.prototype.clear = hashClear;
  842. Hash.prototype["delete"] = hashDelete;
  843. Hash.prototype.get = hashGet;
  844. Hash.prototype.has = hashHas;
  845. Hash.prototype.set = hashSet;
  846. function listCacheClear() {
  847. this.__data__ = [];
  848. this.size = 0;
  849. }
  850. function assocIndexOf(array, key) {
  851. var length = array.length;
  852. while (length--) {
  853. if (eq(array[length][0], key)) {
  854. return length;
  855. }
  856. }
  857. return -1;
  858. }
  859. var arrayProto = Array.prototype;
  860. var splice = arrayProto.splice;
  861. function listCacheDelete(key) {
  862. var data = this.__data__, index = assocIndexOf(data, key);
  863. if (index < 0) {
  864. return false;
  865. }
  866. var lastIndex = data.length - 1;
  867. if (index == lastIndex) {
  868. data.pop();
  869. } else {
  870. splice.call(data, index, 1);
  871. }
  872. --this.size;
  873. return true;
  874. }
  875. function listCacheGet(key) {
  876. var data = this.__data__, index = assocIndexOf(data, key);
  877. return index < 0 ? void 0 : data[index][1];
  878. }
  879. function listCacheHas(key) {
  880. return assocIndexOf(this.__data__, key) > -1;
  881. }
  882. function listCacheSet(key, value) {
  883. var data = this.__data__, index = assocIndexOf(data, key);
  884. if (index < 0) {
  885. ++this.size;
  886. data.push([key, value]);
  887. } else {
  888. data[index][1] = value;
  889. }
  890. return this;
  891. }
  892. function ListCache(entries) {
  893. var index = -1, length = entries == null ? 0 : entries.length;
  894. this.clear();
  895. while (++index < length) {
  896. var entry = entries[index];
  897. this.set(entry[0], entry[1]);
  898. }
  899. }
  900. ListCache.prototype.clear = listCacheClear;
  901. ListCache.prototype["delete"] = listCacheDelete;
  902. ListCache.prototype.get = listCacheGet;
  903. ListCache.prototype.has = listCacheHas;
  904. ListCache.prototype.set = listCacheSet;
  905. var Map$1 = getNative(root$1, "Map");
  906. const Map$2 = Map$1;
  907. function mapCacheClear() {
  908. this.size = 0;
  909. this.__data__ = {
  910. "hash": new Hash(),
  911. "map": new (Map$2 || ListCache)(),
  912. "string": new Hash()
  913. };
  914. }
  915. function isKeyable(value) {
  916. var type = typeof value;
  917. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  918. }
  919. function getMapData(map2, key) {
  920. var data = map2.__data__;
  921. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  922. }
  923. function mapCacheDelete(key) {
  924. var result = getMapData(this, key)["delete"](key);
  925. this.size -= result ? 1 : 0;
  926. return result;
  927. }
  928. function mapCacheGet(key) {
  929. return getMapData(this, key).get(key);
  930. }
  931. function mapCacheHas(key) {
  932. return getMapData(this, key).has(key);
  933. }
  934. function mapCacheSet(key, value) {
  935. var data = getMapData(this, key), size = data.size;
  936. data.set(key, value);
  937. this.size += data.size == size ? 0 : 1;
  938. return this;
  939. }
  940. function MapCache(entries) {
  941. var index = -1, length = entries == null ? 0 : entries.length;
  942. this.clear();
  943. while (++index < length) {
  944. var entry = entries[index];
  945. this.set(entry[0], entry[1]);
  946. }
  947. }
  948. MapCache.prototype.clear = mapCacheClear;
  949. MapCache.prototype["delete"] = mapCacheDelete;
  950. MapCache.prototype.get = mapCacheGet;
  951. MapCache.prototype.has = mapCacheHas;
  952. MapCache.prototype.set = mapCacheSet;
  953. var FUNC_ERROR_TEXT$1 = "Expected a function";
  954. function memoize(func, resolver) {
  955. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  956. throw new TypeError(FUNC_ERROR_TEXT$1);
  957. }
  958. var memoized = function() {
  959. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  960. if (cache.has(key)) {
  961. return cache.get(key);
  962. }
  963. var result = func.apply(this, args);
  964. memoized.cache = cache.set(key, result) || cache;
  965. return result;
  966. };
  967. memoized.cache = new (memoize.Cache || MapCache)();
  968. return memoized;
  969. }
  970. memoize.Cache = MapCache;
  971. var MAX_MEMOIZE_SIZE = 500;
  972. function memoizeCapped(func) {
  973. var result = memoize(func, function(key) {
  974. if (cache.size === MAX_MEMOIZE_SIZE) {
  975. cache.clear();
  976. }
  977. return key;
  978. });
  979. var cache = result.cache;
  980. return result;
  981. }
  982. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  983. var reEscapeChar = /\\(\\)?/g;
  984. var stringToPath = memoizeCapped(function(string) {
  985. var result = [];
  986. if (string.charCodeAt(0) === 46) {
  987. result.push("");
  988. }
  989. string.replace(rePropName, function(match, number, quote, subString) {
  990. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  991. });
  992. return result;
  993. });
  994. const stringToPath$1 = stringToPath;
  995. function toString(value) {
  996. return value == null ? "" : baseToString(value);
  997. }
  998. function castPath(value, object) {
  999. if (isArray$1(value)) {
  1000. return value;
  1001. }
  1002. return isKey(value, object) ? [value] : stringToPath$1(toString(value));
  1003. }
  1004. var INFINITY = 1 / 0;
  1005. function toKey(value) {
  1006. if (typeof value == "string" || isSymbol(value)) {
  1007. return value;
  1008. }
  1009. var result = value + "";
  1010. return result == "0" && 1 / value == -INFINITY ? "-0" : result;
  1011. }
  1012. function baseGet(object, path) {
  1013. path = castPath(path, object);
  1014. var index = 0, length = path.length;
  1015. while (object != null && index < length) {
  1016. object = object[toKey(path[index++])];
  1017. }
  1018. return index && index == length ? object : void 0;
  1019. }
  1020. function get(object, path, defaultValue) {
  1021. var result = object == null ? void 0 : baseGet(object, path);
  1022. return result === void 0 ? defaultValue : result;
  1023. }
  1024. function arrayPush(array, values) {
  1025. var index = -1, length = values.length, offset = array.length;
  1026. while (++index < length) {
  1027. array[offset + index] = values[index];
  1028. }
  1029. return array;
  1030. }
  1031. var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0;
  1032. function isFlattenable(value) {
  1033. return isArray$1(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  1034. }
  1035. function baseFlatten(array, depth, predicate, isStrict, result) {
  1036. var index = -1, length = array.length;
  1037. predicate || (predicate = isFlattenable);
  1038. result || (result = []);
  1039. while (++index < length) {
  1040. var value = array[index];
  1041. if (depth > 0 && predicate(value)) {
  1042. if (depth > 1) {
  1043. baseFlatten(value, depth - 1, predicate, isStrict, result);
  1044. } else {
  1045. arrayPush(result, value);
  1046. }
  1047. } else if (!isStrict) {
  1048. result[result.length] = value;
  1049. }
  1050. }
  1051. return result;
  1052. }
  1053. function flatten(array) {
  1054. var length = array == null ? 0 : array.length;
  1055. return length ? baseFlatten(array, 1) : [];
  1056. }
  1057. function flatRest(func) {
  1058. return setToString$1(overRest(func, void 0, flatten), func + "");
  1059. }
  1060. var getPrototype = overArg(Object.getPrototypeOf, Object);
  1061. const getPrototype$1 = getPrototype;
  1062. var objectTag$2 = "[object Object]";
  1063. var funcProto = Function.prototype, objectProto$3 = Object.prototype;
  1064. var funcToString = funcProto.toString;
  1065. var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
  1066. var objectCtorString = funcToString.call(Object);
  1067. function isPlainObject(value) {
  1068. if (!isObjectLike(value) || baseGetTag(value) != objectTag$2) {
  1069. return false;
  1070. }
  1071. var proto = getPrototype$1(value);
  1072. if (proto === null) {
  1073. return true;
  1074. }
  1075. var Ctor = hasOwnProperty$2.call(proto, "constructor") && proto.constructor;
  1076. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  1077. }
  1078. function stackClear() {
  1079. this.__data__ = new ListCache();
  1080. this.size = 0;
  1081. }
  1082. function stackDelete(key) {
  1083. var data = this.__data__, result = data["delete"](key);
  1084. this.size = data.size;
  1085. return result;
  1086. }
  1087. function stackGet(key) {
  1088. return this.__data__.get(key);
  1089. }
  1090. function stackHas(key) {
  1091. return this.__data__.has(key);
  1092. }
  1093. var LARGE_ARRAY_SIZE = 200;
  1094. function stackSet(key, value) {
  1095. var data = this.__data__;
  1096. if (data instanceof ListCache) {
  1097. var pairs = data.__data__;
  1098. if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
  1099. pairs.push([key, value]);
  1100. this.size = ++data.size;
  1101. return this;
  1102. }
  1103. data = this.__data__ = new MapCache(pairs);
  1104. }
  1105. data.set(key, value);
  1106. this.size = data.size;
  1107. return this;
  1108. }
  1109. function Stack(entries) {
  1110. var data = this.__data__ = new ListCache(entries);
  1111. this.size = data.size;
  1112. }
  1113. Stack.prototype.clear = stackClear;
  1114. Stack.prototype["delete"] = stackDelete;
  1115. Stack.prototype.get = stackGet;
  1116. Stack.prototype.has = stackHas;
  1117. Stack.prototype.set = stackSet;
  1118. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  1119. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  1120. var moduleExports = freeModule && freeModule.exports === freeExports;
  1121. var Buffer = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  1122. function cloneBuffer(buffer, isDeep) {
  1123. if (isDeep) {
  1124. return buffer.slice();
  1125. }
  1126. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  1127. buffer.copy(result);
  1128. return result;
  1129. }
  1130. function arrayFilter(array, predicate) {
  1131. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  1132. while (++index < length) {
  1133. var value = array[index];
  1134. if (predicate(value, index, array)) {
  1135. result[resIndex++] = value;
  1136. }
  1137. }
  1138. return result;
  1139. }
  1140. function stubArray() {
  1141. return [];
  1142. }
  1143. var objectProto$2 = Object.prototype;
  1144. var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
  1145. var nativeGetSymbols = Object.getOwnPropertySymbols;
  1146. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  1147. if (object == null) {
  1148. return [];
  1149. }
  1150. object = Object(object);
  1151. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  1152. return propertyIsEnumerable.call(object, symbol);
  1153. });
  1154. };
  1155. const getSymbols$1 = getSymbols;
  1156. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  1157. var result = keysFunc(object);
  1158. return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
  1159. }
  1160. function getAllKeys(object) {
  1161. return baseGetAllKeys(object, keys, getSymbols$1);
  1162. }
  1163. var DataView = getNative(root$1, "DataView");
  1164. const DataView$1 = DataView;
  1165. var Promise$1 = getNative(root$1, "Promise");
  1166. const Promise$2 = Promise$1;
  1167. var Set$1 = getNative(root$1, "Set");
  1168. const Set$2 = Set$1;
  1169. var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
  1170. var dataViewTag$1 = "[object DataView]";
  1171. var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$1);
  1172. var getTag = baseGetTag;
  1173. if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$1 || Map$2 && getTag(new Map$2()) != mapTag$1 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$1 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag) {
  1174. getTag = function(value) {
  1175. var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  1176. if (ctorString) {
  1177. switch (ctorString) {
  1178. case dataViewCtorString:
  1179. return dataViewTag$1;
  1180. case mapCtorString:
  1181. return mapTag$1;
  1182. case promiseCtorString:
  1183. return promiseTag;
  1184. case setCtorString:
  1185. return setTag$1;
  1186. case weakMapCtorString:
  1187. return weakMapTag;
  1188. }
  1189. }
  1190. return result;
  1191. };
  1192. }
  1193. const getTag$1 = getTag;
  1194. var Uint8Array = root$1.Uint8Array;
  1195. const Uint8Array$1 = Uint8Array;
  1196. function cloneArrayBuffer(arrayBuffer) {
  1197. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  1198. new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  1199. return result;
  1200. }
  1201. function cloneTypedArray(typedArray, isDeep) {
  1202. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  1203. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  1204. }
  1205. function initCloneObject(object) {
  1206. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate$1(getPrototype$1(object)) : {};
  1207. }
  1208. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  1209. function setCacheAdd(value) {
  1210. this.__data__.set(value, HASH_UNDEFINED);
  1211. return this;
  1212. }
  1213. function setCacheHas(value) {
  1214. return this.__data__.has(value);
  1215. }
  1216. function SetCache(values) {
  1217. var index = -1, length = values == null ? 0 : values.length;
  1218. this.__data__ = new MapCache();
  1219. while (++index < length) {
  1220. this.add(values[index]);
  1221. }
  1222. }
  1223. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  1224. SetCache.prototype.has = setCacheHas;
  1225. function arraySome(array, predicate) {
  1226. var index = -1, length = array == null ? 0 : array.length;
  1227. while (++index < length) {
  1228. if (predicate(array[index], index, array)) {
  1229. return true;
  1230. }
  1231. }
  1232. return false;
  1233. }
  1234. function cacheHas(cache, key) {
  1235. return cache.has(key);
  1236. }
  1237. var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
  1238. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  1239. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  1240. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  1241. return false;
  1242. }
  1243. var arrStacked = stack.get(array);
  1244. var othStacked = stack.get(other);
  1245. if (arrStacked && othStacked) {
  1246. return arrStacked == other && othStacked == array;
  1247. }
  1248. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  1249. stack.set(array, other);
  1250. stack.set(other, array);
  1251. while (++index < arrLength) {
  1252. var arrValue = array[index], othValue = other[index];
  1253. if (customizer) {
  1254. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  1255. }
  1256. if (compared !== void 0) {
  1257. if (compared) {
  1258. continue;
  1259. }
  1260. result = false;
  1261. break;
  1262. }
  1263. if (seen) {
  1264. if (!arraySome(other, function(othValue2, othIndex) {
  1265. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  1266. return seen.push(othIndex);
  1267. }
  1268. })) {
  1269. result = false;
  1270. break;
  1271. }
  1272. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  1273. result = false;
  1274. break;
  1275. }
  1276. }
  1277. stack["delete"](array);
  1278. stack["delete"](other);
  1279. return result;
  1280. }
  1281. function mapToArray(map2) {
  1282. var index = -1, result = Array(map2.size);
  1283. map2.forEach(function(value, key) {
  1284. result[++index] = [key, value];
  1285. });
  1286. return result;
  1287. }
  1288. function setToArray(set2) {
  1289. var index = -1, result = Array(set2.size);
  1290. set2.forEach(function(value) {
  1291. result[++index] = value;
  1292. });
  1293. return result;
  1294. }
  1295. var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
  1296. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  1297. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  1298. var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  1299. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  1300. switch (tag) {
  1301. case dataViewTag:
  1302. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  1303. return false;
  1304. }
  1305. object = object.buffer;
  1306. other = other.buffer;
  1307. case arrayBufferTag:
  1308. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
  1309. return false;
  1310. }
  1311. return true;
  1312. case boolTag:
  1313. case dateTag:
  1314. case numberTag:
  1315. return eq(+object, +other);
  1316. case errorTag:
  1317. return object.name == other.name && object.message == other.message;
  1318. case regexpTag:
  1319. case stringTag:
  1320. return object == other + "";
  1321. case mapTag:
  1322. var convert = mapToArray;
  1323. case setTag:
  1324. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  1325. convert || (convert = setToArray);
  1326. if (object.size != other.size && !isPartial) {
  1327. return false;
  1328. }
  1329. var stacked = stack.get(object);
  1330. if (stacked) {
  1331. return stacked == other;
  1332. }
  1333. bitmask |= COMPARE_UNORDERED_FLAG$2;
  1334. stack.set(object, other);
  1335. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  1336. stack["delete"](object);
  1337. return result;
  1338. case symbolTag:
  1339. if (symbolValueOf) {
  1340. return symbolValueOf.call(object) == symbolValueOf.call(other);
  1341. }
  1342. }
  1343. return false;
  1344. }
  1345. var COMPARE_PARTIAL_FLAG$3 = 1;
  1346. var objectProto$1 = Object.prototype;
  1347. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  1348. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  1349. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  1350. if (objLength != othLength && !isPartial) {
  1351. return false;
  1352. }
  1353. var index = objLength;
  1354. while (index--) {
  1355. var key = objProps[index];
  1356. if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
  1357. return false;
  1358. }
  1359. }
  1360. var objStacked = stack.get(object);
  1361. var othStacked = stack.get(other);
  1362. if (objStacked && othStacked) {
  1363. return objStacked == other && othStacked == object;
  1364. }
  1365. var result = true;
  1366. stack.set(object, other);
  1367. stack.set(other, object);
  1368. var skipCtor = isPartial;
  1369. while (++index < objLength) {
  1370. key = objProps[index];
  1371. var objValue = object[key], othValue = other[key];
  1372. if (customizer) {
  1373. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  1374. }
  1375. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  1376. result = false;
  1377. break;
  1378. }
  1379. skipCtor || (skipCtor = key == "constructor");
  1380. }
  1381. if (result && !skipCtor) {
  1382. var objCtor = object.constructor, othCtor = other.constructor;
  1383. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  1384. result = false;
  1385. }
  1386. }
  1387. stack["delete"](object);
  1388. stack["delete"](other);
  1389. return result;
  1390. }
  1391. var COMPARE_PARTIAL_FLAG$2 = 1;
  1392. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  1393. var objectProto = Object.prototype;
  1394. var hasOwnProperty = objectProto.hasOwnProperty;
  1395. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  1396. var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  1397. objTag = objTag == argsTag ? objectTag : objTag;
  1398. othTag = othTag == argsTag ? objectTag : othTag;
  1399. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  1400. if (isSameTag && isBuffer$1(object)) {
  1401. if (!isBuffer$1(other)) {
  1402. return false;
  1403. }
  1404. objIsArr = true;
  1405. objIsObj = false;
  1406. }
  1407. if (isSameTag && !objIsObj) {
  1408. stack || (stack = new Stack());
  1409. return objIsArr || isTypedArray$1(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  1410. }
  1411. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  1412. var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
  1413. if (objIsWrapped || othIsWrapped) {
  1414. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  1415. stack || (stack = new Stack());
  1416. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  1417. }
  1418. }
  1419. if (!isSameTag) {
  1420. return false;
  1421. }
  1422. stack || (stack = new Stack());
  1423. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  1424. }
  1425. function baseIsEqual(value, other, bitmask, customizer, stack) {
  1426. if (value === other) {
  1427. return true;
  1428. }
  1429. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  1430. return value !== value && other !== other;
  1431. }
  1432. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  1433. }
  1434. var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  1435. function baseIsMatch(object, source, matchData, customizer) {
  1436. var index = matchData.length, length = index, noCustomizer = !customizer;
  1437. if (object == null) {
  1438. return !length;
  1439. }
  1440. object = Object(object);
  1441. while (index--) {
  1442. var data = matchData[index];
  1443. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  1444. return false;
  1445. }
  1446. }
  1447. while (++index < length) {
  1448. data = matchData[index];
  1449. var key = data[0], objValue = object[key], srcValue = data[1];
  1450. if (noCustomizer && data[2]) {
  1451. if (objValue === void 0 && !(key in object)) {
  1452. return false;
  1453. }
  1454. } else {
  1455. var stack = new Stack();
  1456. if (customizer) {
  1457. var result = customizer(objValue, srcValue, key, object, source, stack);
  1458. }
  1459. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  1460. return false;
  1461. }
  1462. }
  1463. }
  1464. return true;
  1465. }
  1466. function isStrictComparable(value) {
  1467. return value === value && !isObject(value);
  1468. }
  1469. function getMatchData(object) {
  1470. var result = keys(object), length = result.length;
  1471. while (length--) {
  1472. var key = result[length], value = object[key];
  1473. result[length] = [key, value, isStrictComparable(value)];
  1474. }
  1475. return result;
  1476. }
  1477. function matchesStrictComparable(key, srcValue) {
  1478. return function(object) {
  1479. if (object == null) {
  1480. return false;
  1481. }
  1482. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  1483. };
  1484. }
  1485. function baseMatches(source) {
  1486. var matchData = getMatchData(source);
  1487. if (matchData.length == 1 && matchData[0][2]) {
  1488. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  1489. }
  1490. return function(object) {
  1491. return object === source || baseIsMatch(object, source, matchData);
  1492. };
  1493. }
  1494. function baseHasIn(object, key) {
  1495. return object != null && key in Object(object);
  1496. }
  1497. function hasPath(object, path, hasFunc) {
  1498. path = castPath(path, object);
  1499. var index = -1, length = path.length, result = false;
  1500. while (++index < length) {
  1501. var key = toKey(path[index]);
  1502. if (!(result = object != null && hasFunc(object, key))) {
  1503. break;
  1504. }
  1505. object = object[key];
  1506. }
  1507. if (result || ++index != length) {
  1508. return result;
  1509. }
  1510. length = object == null ? 0 : object.length;
  1511. return !!length && isLength(length) && isIndex(key, length) && (isArray$1(object) || isArguments$1(object));
  1512. }
  1513. function hasIn(object, path) {
  1514. return object != null && hasPath(object, path, baseHasIn);
  1515. }
  1516. var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
  1517. function baseMatchesProperty(path, srcValue) {
  1518. if (isKey(path) && isStrictComparable(srcValue)) {
  1519. return matchesStrictComparable(toKey(path), srcValue);
  1520. }
  1521. return function(object) {
  1522. var objValue = get(object, path);
  1523. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  1524. };
  1525. }
  1526. function baseProperty(key) {
  1527. return function(object) {
  1528. return object == null ? void 0 : object[key];
  1529. };
  1530. }
  1531. function basePropertyDeep(path) {
  1532. return function(object) {
  1533. return baseGet(object, path);
  1534. };
  1535. }
  1536. function property(path) {
  1537. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  1538. }
  1539. function baseIteratee(value) {
  1540. if (typeof value == "function") {
  1541. return value;
  1542. }
  1543. if (value == null) {
  1544. return identity;
  1545. }
  1546. if (typeof value == "object") {
  1547. return isArray$1(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  1548. }
  1549. return property(value);
  1550. }
  1551. function createBaseFor(fromRight) {
  1552. return function(object, iteratee, keysFunc) {
  1553. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  1554. while (length--) {
  1555. var key = props[fromRight ? length : ++index];
  1556. if (iteratee(iterable[key], key, iterable) === false) {
  1557. break;
  1558. }
  1559. }
  1560. return object;
  1561. };
  1562. }
  1563. var baseFor = createBaseFor();
  1564. const baseFor$1 = baseFor;
  1565. function baseForOwn(object, iteratee) {
  1566. return object && baseFor$1(object, iteratee, keys);
  1567. }
  1568. function createBaseEach(eachFunc, fromRight) {
  1569. return function(collection, iteratee) {
  1570. if (collection == null) {
  1571. return collection;
  1572. }
  1573. if (!isArrayLike(collection)) {
  1574. return eachFunc(collection, iteratee);
  1575. }
  1576. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  1577. while (fromRight ? index-- : ++index < length) {
  1578. if (iteratee(iterable[index], index, iterable) === false) {
  1579. break;
  1580. }
  1581. }
  1582. return collection;
  1583. };
  1584. }
  1585. var baseEach = createBaseEach(baseForOwn);
  1586. const baseEach$1 = baseEach;
  1587. var now = function() {
  1588. return root$1.Date.now();
  1589. };
  1590. const now$1 = now;
  1591. var FUNC_ERROR_TEXT = "Expected a function";
  1592. var nativeMax = Math.max, nativeMin = Math.min;
  1593. function debounce(func, wait, options) {
  1594. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  1595. if (typeof func != "function") {
  1596. throw new TypeError(FUNC_ERROR_TEXT);
  1597. }
  1598. wait = toNumber(wait) || 0;
  1599. if (isObject(options)) {
  1600. leading = !!options.leading;
  1601. maxing = "maxWait" in options;
  1602. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  1603. trailing = "trailing" in options ? !!options.trailing : trailing;
  1604. }
  1605. function invokeFunc(time) {
  1606. var args = lastArgs, thisArg = lastThis;
  1607. lastArgs = lastThis = void 0;
  1608. lastInvokeTime = time;
  1609. result = func.apply(thisArg, args);
  1610. return result;
  1611. }
  1612. function leadingEdge(time) {
  1613. lastInvokeTime = time;
  1614. timerId = setTimeout(timerExpired, wait);
  1615. return leading ? invokeFunc(time) : result;
  1616. }
  1617. function remainingWait(time) {
  1618. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  1619. return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  1620. }
  1621. function shouldInvoke(time) {
  1622. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  1623. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  1624. }
  1625. function timerExpired() {
  1626. var time = now$1();
  1627. if (shouldInvoke(time)) {
  1628. return trailingEdge(time);
  1629. }
  1630. timerId = setTimeout(timerExpired, remainingWait(time));
  1631. }
  1632. function trailingEdge(time) {
  1633. timerId = void 0;
  1634. if (trailing && lastArgs) {
  1635. return invokeFunc(time);
  1636. }
  1637. lastArgs = lastThis = void 0;
  1638. return result;
  1639. }
  1640. function cancel() {
  1641. if (timerId !== void 0) {
  1642. clearTimeout(timerId);
  1643. }
  1644. lastInvokeTime = 0;
  1645. lastArgs = lastCallTime = lastThis = timerId = void 0;
  1646. }
  1647. function flush() {
  1648. return timerId === void 0 ? result : trailingEdge(now$1());
  1649. }
  1650. function debounced() {
  1651. var time = now$1(), isInvoking = shouldInvoke(time);
  1652. lastArgs = arguments;
  1653. lastThis = this;
  1654. lastCallTime = time;
  1655. if (isInvoking) {
  1656. if (timerId === void 0) {
  1657. return leadingEdge(lastCallTime);
  1658. }
  1659. if (maxing) {
  1660. clearTimeout(timerId);
  1661. timerId = setTimeout(timerExpired, wait);
  1662. return invokeFunc(lastCallTime);
  1663. }
  1664. }
  1665. if (timerId === void 0) {
  1666. timerId = setTimeout(timerExpired, wait);
  1667. }
  1668. return result;
  1669. }
  1670. debounced.cancel = cancel;
  1671. debounced.flush = flush;
  1672. return debounced;
  1673. }
  1674. function assignMergeValue(object, key, value) {
  1675. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  1676. baseAssignValue(object, key, value);
  1677. }
  1678. }
  1679. function isArrayLikeObject(value) {
  1680. return isObjectLike(value) && isArrayLike(value);
  1681. }
  1682. function safeGet(object, key) {
  1683. if (key === "constructor" && typeof object[key] === "function") {
  1684. return;
  1685. }
  1686. if (key == "__proto__") {
  1687. return;
  1688. }
  1689. return object[key];
  1690. }
  1691. function toPlainObject(value) {
  1692. return copyObject(value, keysIn(value));
  1693. }
  1694. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  1695. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  1696. if (stacked) {
  1697. assignMergeValue(object, key, stacked);
  1698. return;
  1699. }
  1700. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  1701. var isCommon = newValue === void 0;
  1702. if (isCommon) {
  1703. var isArr = isArray$1(srcValue), isBuff = !isArr && isBuffer$1(srcValue), isTyped = !isArr && !isBuff && isTypedArray$1(srcValue);
  1704. newValue = srcValue;
  1705. if (isArr || isBuff || isTyped) {
  1706. if (isArray$1(objValue)) {
  1707. newValue = objValue;
  1708. } else if (isArrayLikeObject(objValue)) {
  1709. newValue = copyArray(objValue);
  1710. } else if (isBuff) {
  1711. isCommon = false;
  1712. newValue = cloneBuffer(srcValue, true);
  1713. } else if (isTyped) {
  1714. isCommon = false;
  1715. newValue = cloneTypedArray(srcValue, true);
  1716. } else {
  1717. newValue = [];
  1718. }
  1719. } else if (isPlainObject(srcValue) || isArguments$1(srcValue)) {
  1720. newValue = objValue;
  1721. if (isArguments$1(objValue)) {
  1722. newValue = toPlainObject(objValue);
  1723. } else if (!isObject(objValue) || isFunction(objValue)) {
  1724. newValue = initCloneObject(srcValue);
  1725. }
  1726. } else {
  1727. isCommon = false;
  1728. }
  1729. }
  1730. if (isCommon) {
  1731. stack.set(srcValue, newValue);
  1732. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  1733. stack["delete"](srcValue);
  1734. }
  1735. assignMergeValue(object, key, newValue);
  1736. }
  1737. function baseMerge(object, source, srcIndex, customizer, stack) {
  1738. if (object === source) {
  1739. return;
  1740. }
  1741. baseFor$1(source, function(srcValue, key) {
  1742. stack || (stack = new Stack());
  1743. if (isObject(srcValue)) {
  1744. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  1745. } else {
  1746. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  1747. if (newValue === void 0) {
  1748. newValue = srcValue;
  1749. }
  1750. assignMergeValue(object, key, newValue);
  1751. }
  1752. }, keysIn);
  1753. }
  1754. function baseMap(collection, iteratee) {
  1755. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  1756. baseEach$1(collection, function(value, key, collection2) {
  1757. result[++index] = iteratee(value, key, collection2);
  1758. });
  1759. return result;
  1760. }
  1761. function map(collection, iteratee) {
  1762. var func = isArray$1(collection) ? arrayMap : baseMap;
  1763. return func(collection, baseIteratee(iteratee));
  1764. }
  1765. function flatMap(collection, iteratee) {
  1766. return baseFlatten(map(collection, iteratee), 1);
  1767. }
  1768. function fromPairs(pairs) {
  1769. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  1770. while (++index < length) {
  1771. var pair = pairs[index];
  1772. result[pair[0]] = pair[1];
  1773. }
  1774. return result;
  1775. }
  1776. function isEqual(value, other) {
  1777. return baseIsEqual(value, other);
  1778. }
  1779. function isNil(value) {
  1780. return value == null;
  1781. }
  1782. function isUndefined$1(value) {
  1783. return value === void 0;
  1784. }
  1785. var merge = createAssigner(function(object, source, srcIndex) {
  1786. baseMerge(object, source, srcIndex);
  1787. });
  1788. const merge$1 = merge;
  1789. function baseSet(object, path, value, customizer) {
  1790. if (!isObject(object)) {
  1791. return object;
  1792. }
  1793. path = castPath(path, object);
  1794. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  1795. while (nested != null && ++index < length) {
  1796. var key = toKey(path[index]), newValue = value;
  1797. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  1798. return object;
  1799. }
  1800. if (index != lastIndex) {
  1801. var objValue = nested[key];
  1802. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  1803. if (newValue === void 0) {
  1804. newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  1805. }
  1806. }
  1807. assignValue(nested, key, newValue);
  1808. nested = nested[key];
  1809. }
  1810. return object;
  1811. }
  1812. function basePickBy(object, paths, predicate) {
  1813. var index = -1, length = paths.length, result = {};
  1814. while (++index < length) {
  1815. var path = paths[index], value = baseGet(object, path);
  1816. if (predicate(value, path)) {
  1817. baseSet(result, castPath(path, object), value);
  1818. }
  1819. }
  1820. return result;
  1821. }
  1822. function basePick(object, paths) {
  1823. return basePickBy(object, paths, function(value, path) {
  1824. return hasIn(object, path);
  1825. });
  1826. }
  1827. var pick = flatRest(function(object, paths) {
  1828. return object == null ? {} : basePick(object, paths);
  1829. });
  1830. const pick$1 = pick;
  1831. function set(object, path, value) {
  1832. return object == null ? object : baseSet(object, path, value);
  1833. }
  1834. const isUndefined = (val) => val === void 0;
  1835. const isBoolean = (val) => typeof val === "boolean";
  1836. const isNumber = (val) => typeof val === "number";
  1837. const isElement = (e) => {
  1838. if (typeof Element === "undefined")
  1839. return false;
  1840. return e instanceof Element;
  1841. };
  1842. const isPropAbsent = (prop) => {
  1843. return isNil(prop);
  1844. };
  1845. const isStringNumber = (val) => {
  1846. if (!isString(val)) {
  1847. return false;
  1848. }
  1849. return !Number.isNaN(Number(val));
  1850. };
  1851. const rAF = (fn2) => isClient ? window.requestAnimationFrame(fn2) : setTimeout(fn2, 16);
  1852. const keysOf = (arr) => Object.keys(arr);
  1853. const getProp = (obj, path, defaultValue) => {
  1854. return {
  1855. get value() {
  1856. return get(obj, path, defaultValue);
  1857. },
  1858. set value(val) {
  1859. set(obj, path, val);
  1860. }
  1861. };
  1862. };
  1863. class ElementPlusError extends Error {
  1864. constructor(m2) {
  1865. super(m2);
  1866. this.name = "ElementPlusError";
  1867. }
  1868. }
  1869. function throwError(scope, m2) {
  1870. throw new ElementPlusError(`[${scope}] ${m2}`);
  1871. }
  1872. function debugWarn(scope, message2) {
  1873. }
  1874. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  1875. const hasClass = (el, cls) => {
  1876. if (!el || !cls)
  1877. return false;
  1878. if (cls.includes(" "))
  1879. throw new Error("className should not contain space.");
  1880. return el.classList.contains(cls);
  1881. };
  1882. const addClass = (el, cls) => {
  1883. if (!el || !cls.trim())
  1884. return;
  1885. el.classList.add(...classNameToArray(cls));
  1886. };
  1887. const removeClass = (el, cls) => {
  1888. if (!el || !cls.trim())
  1889. return;
  1890. el.classList.remove(...classNameToArray(cls));
  1891. };
  1892. function addUnit(value, defaultUnit = "px") {
  1893. if (!value)
  1894. return "";
  1895. if (isNumber(value) || isStringNumber(value)) {
  1896. return `${value}${defaultUnit}`;
  1897. } else if (isString(value)) {
  1898. return value;
  1899. }
  1900. }
  1901. /*! Element Plus Icons Vue v2.3.1 */
  1902. var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  1903. name: "ArrowDown",
  1904. __name: "arrow-down",
  1905. setup(__props) {
  1906. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  1907. xmlns: "http://www.w3.org/2000/svg",
  1908. viewBox: "0 0 1024 1024"
  1909. }, [
  1910. vue.createElementVNode("path", {
  1911. fill: "currentColor",
  1912. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  1913. })
  1914. ]));
  1915. }
  1916. });
  1917. var arrow_down_default = arrow_down_vue_vue_type_script_setup_true_lang_default;
  1918. var arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  1919. name: "ArrowRight",
  1920. __name: "arrow-right",
  1921. setup(__props) {
  1922. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  1923. xmlns: "http://www.w3.org/2000/svg",
  1924. viewBox: "0 0 1024 1024"
  1925. }, [
  1926. vue.createElementVNode("path", {
  1927. fill: "currentColor",
  1928. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  1929. })
  1930. ]));
  1931. }
  1932. });
  1933. var arrow_right_default = arrow_right_vue_vue_type_script_setup_true_lang_default;
  1934. var arrow_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  1935. name: "ArrowUp",
  1936. __name: "arrow-up",
  1937. setup(__props) {
  1938. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  1939. xmlns: "http://www.w3.org/2000/svg",
  1940. viewBox: "0 0 1024 1024"
  1941. }, [
  1942. vue.createElementVNode("path", {
  1943. fill: "currentColor",
  1944. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"
  1945. })
  1946. ]));
  1947. }
  1948. });
  1949. var arrow_up_default = arrow_up_vue_vue_type_script_setup_true_lang_default;
  1950. var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  1951. name: "CircleCloseFilled",
  1952. __name: "circle-close-filled",
  1953. setup(__props) {
  1954. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  1955. xmlns: "http://www.w3.org/2000/svg",
  1956. viewBox: "0 0 1024 1024"
  1957. }, [
  1958. vue.createElementVNode("path", {
  1959. fill: "currentColor",
  1960. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
  1961. })
  1962. ]));
  1963. }
  1964. });
  1965. var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
  1966. var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  1967. name: "Close",
  1968. __name: "close",
  1969. setup(__props) {
  1970. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  1971. xmlns: "http://www.w3.org/2000/svg",
  1972. viewBox: "0 0 1024 1024"
  1973. }, [
  1974. vue.createElementVNode("path", {
  1975. fill: "currentColor",
  1976. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  1977. })
  1978. ]));
  1979. }
  1980. });
  1981. var close_default = close_vue_vue_type_script_setup_true_lang_default;
  1982. var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  1983. name: "InfoFilled",
  1984. __name: "info-filled",
  1985. setup(__props) {
  1986. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  1987. xmlns: "http://www.w3.org/2000/svg",
  1988. viewBox: "0 0 1024 1024"
  1989. }, [
  1990. vue.createElementVNode("path", {
  1991. fill: "currentColor",
  1992. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
  1993. })
  1994. ]));
  1995. }
  1996. });
  1997. var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
  1998. var loading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  1999. name: "Loading",
  2000. __name: "loading",
  2001. setup(__props) {
  2002. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  2003. xmlns: "http://www.w3.org/2000/svg",
  2004. viewBox: "0 0 1024 1024"
  2005. }, [
  2006. vue.createElementVNode("path", {
  2007. fill: "currentColor",
  2008. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  2009. })
  2010. ]));
  2011. }
  2012. });
  2013. var loading_default = loading_vue_vue_type_script_setup_true_lang_default;
  2014. var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  2015. name: "SuccessFilled",
  2016. __name: "success-filled",
  2017. setup(__props) {
  2018. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  2019. xmlns: "http://www.w3.org/2000/svg",
  2020. viewBox: "0 0 1024 1024"
  2021. }, [
  2022. vue.createElementVNode("path", {
  2023. fill: "currentColor",
  2024. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  2025. })
  2026. ]));
  2027. }
  2028. });
  2029. var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
  2030. var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  2031. name: "WarningFilled",
  2032. __name: "warning-filled",
  2033. setup(__props) {
  2034. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  2035. xmlns: "http://www.w3.org/2000/svg",
  2036. viewBox: "0 0 1024 1024"
  2037. }, [
  2038. vue.createElementVNode("path", {
  2039. fill: "currentColor",
  2040. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
  2041. })
  2042. ]));
  2043. }
  2044. });
  2045. var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
  2046. const epPropKey = "__epPropKey";
  2047. const definePropType = (val) => val;
  2048. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  2049. const buildProp = (prop, key) => {
  2050. if (!isObject$1(prop) || isEpProp(prop))
  2051. return prop;
  2052. const { values, required, default: defaultValue, type, validator } = prop;
  2053. const _validator = values || validator ? (val) => {
  2054. let valid = false;
  2055. let allowedValues = [];
  2056. if (values) {
  2057. allowedValues = Array.from(values);
  2058. if (hasOwn(prop, "default")) {
  2059. allowedValues.push(defaultValue);
  2060. }
  2061. valid || (valid = allowedValues.includes(val));
  2062. }
  2063. if (validator)
  2064. valid || (valid = validator(val));
  2065. if (!valid && allowedValues.length > 0) {
  2066. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  2067. vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  2068. }
  2069. return valid;
  2070. } : void 0;
  2071. const epProp = {
  2072. type,
  2073. required: !!required,
  2074. validator: _validator,
  2075. [epPropKey]: true
  2076. };
  2077. if (hasOwn(prop, "default"))
  2078. epProp.default = defaultValue;
  2079. return epProp;
  2080. };
  2081. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  2082. key,
  2083. buildProp(option, key)
  2084. ]));
  2085. const iconPropType = definePropType([
  2086. String,
  2087. Object,
  2088. Function
  2089. ]);
  2090. const TypeComponents = {
  2091. Close: close_default,
  2092. SuccessFilled: success_filled_default,
  2093. InfoFilled: info_filled_default,
  2094. WarningFilled: warning_filled_default,
  2095. CircleCloseFilled: circle_close_filled_default
  2096. };
  2097. const TypeComponentsMap = {
  2098. success: success_filled_default,
  2099. warning: warning_filled_default,
  2100. error: circle_close_filled_default,
  2101. info: info_filled_default
  2102. };
  2103. const withInstall = (main, extra) => {
  2104. main.install = (app) => {
  2105. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  2106. app.component(comp.name, comp);
  2107. }
  2108. };
  2109. if (extra) {
  2110. for (const [key, comp] of Object.entries(extra)) {
  2111. main[key] = comp;
  2112. }
  2113. }
  2114. return main;
  2115. };
  2116. const withInstallFunction = (fn2, name) => {
  2117. fn2.install = (app) => {
  2118. fn2._context = app._context;
  2119. app.config.globalProperties[name] = fn2;
  2120. };
  2121. return fn2;
  2122. };
  2123. const withInstallDirective = (directive, name) => {
  2124. directive.install = (app) => {
  2125. app.directive(name, directive);
  2126. };
  2127. return directive;
  2128. };
  2129. const withNoopInstall = (component) => {
  2130. component.install = NOOP;
  2131. return component;
  2132. };
  2133. const EVENT_CODE = {
  2134. tab: "Tab",
  2135. enter: "Enter",
  2136. space: "Space",
  2137. left: "ArrowLeft",
  2138. up: "ArrowUp",
  2139. right: "ArrowRight",
  2140. down: "ArrowDown",
  2141. esc: "Escape",
  2142. delete: "Delete",
  2143. backspace: "Backspace",
  2144. numpadEnter: "NumpadEnter",
  2145. pageUp: "PageUp",
  2146. pageDown: "PageDown",
  2147. home: "Home",
  2148. end: "End"
  2149. };
  2150. const UPDATE_MODEL_EVENT = "update:modelValue";
  2151. const componentSizes = ["", "default", "small", "large"];
  2152. const mutable = (val) => val;
  2153. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  2154. vue.watch(() => vue.unref(condition), (val) => {
  2155. }, {
  2156. immediate: true
  2157. });
  2158. };
  2159. var English = {
  2160. name: "en",
  2161. el: {
  2162. breadcrumb: {
  2163. label: "Breadcrumb"
  2164. },
  2165. colorpicker: {
  2166. confirm: "OK",
  2167. clear: "Clear",
  2168. defaultLabel: "color picker",
  2169. description: "current color is {color}. press enter to select a new color."
  2170. },
  2171. datepicker: {
  2172. now: "Now",
  2173. today: "Today",
  2174. cancel: "Cancel",
  2175. clear: "Clear",
  2176. confirm: "OK",
  2177. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  2178. monthTablePrompt: "Use the arrow keys and enter to select the month",
  2179. yearTablePrompt: "Use the arrow keys and enter to select the year",
  2180. selectedDate: "Selected date",
  2181. selectDate: "Select date",
  2182. selectTime: "Select time",
  2183. startDate: "Start Date",
  2184. startTime: "Start Time",
  2185. endDate: "End Date",
  2186. endTime: "End Time",
  2187. prevYear: "Previous Year",
  2188. nextYear: "Next Year",
  2189. prevMonth: "Previous Month",
  2190. nextMonth: "Next Month",
  2191. year: "",
  2192. month1: "January",
  2193. month2: "February",
  2194. month3: "March",
  2195. month4: "April",
  2196. month5: "May",
  2197. month6: "June",
  2198. month7: "July",
  2199. month8: "August",
  2200. month9: "September",
  2201. month10: "October",
  2202. month11: "November",
  2203. month12: "December",
  2204. week: "week",
  2205. weeks: {
  2206. sun: "Sun",
  2207. mon: "Mon",
  2208. tue: "Tue",
  2209. wed: "Wed",
  2210. thu: "Thu",
  2211. fri: "Fri",
  2212. sat: "Sat"
  2213. },
  2214. weeksFull: {
  2215. sun: "Sunday",
  2216. mon: "Monday",
  2217. tue: "Tuesday",
  2218. wed: "Wednesday",
  2219. thu: "Thursday",
  2220. fri: "Friday",
  2221. sat: "Saturday"
  2222. },
  2223. months: {
  2224. jan: "Jan",
  2225. feb: "Feb",
  2226. mar: "Mar",
  2227. apr: "Apr",
  2228. may: "May",
  2229. jun: "Jun",
  2230. jul: "Jul",
  2231. aug: "Aug",
  2232. sep: "Sep",
  2233. oct: "Oct",
  2234. nov: "Nov",
  2235. dec: "Dec"
  2236. }
  2237. },
  2238. inputNumber: {
  2239. decrease: "decrease number",
  2240. increase: "increase number"
  2241. },
  2242. select: {
  2243. loading: "Loading",
  2244. noMatch: "No matching data",
  2245. noData: "No data",
  2246. placeholder: "Select"
  2247. },
  2248. dropdown: {
  2249. toggleDropdown: "Toggle Dropdown"
  2250. },
  2251. cascader: {
  2252. noMatch: "No matching data",
  2253. loading: "Loading",
  2254. placeholder: "Select",
  2255. noData: "No data"
  2256. },
  2257. pagination: {
  2258. goto: "Go to",
  2259. pagesize: "/page",
  2260. total: "Total {total}",
  2261. pageClassifier: "",
  2262. page: "Page",
  2263. prev: "Go to previous page",
  2264. next: "Go to next page",
  2265. currentPage: "page {pager}",
  2266. prevPages: "Previous {pager} pages",
  2267. nextPages: "Next {pager} pages",
  2268. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  2269. },
  2270. dialog: {
  2271. close: "Close this dialog"
  2272. },
  2273. drawer: {
  2274. close: "Close this dialog"
  2275. },
  2276. messagebox: {
  2277. title: "Message",
  2278. confirm: "OK",
  2279. cancel: "Cancel",
  2280. error: "Illegal input",
  2281. close: "Close this dialog"
  2282. },
  2283. upload: {
  2284. deleteTip: "press delete to remove",
  2285. delete: "Delete",
  2286. preview: "Preview",
  2287. continue: "Continue"
  2288. },
  2289. slider: {
  2290. defaultLabel: "slider between {min} and {max}",
  2291. defaultRangeStartLabel: "pick start value",
  2292. defaultRangeEndLabel: "pick end value"
  2293. },
  2294. table: {
  2295. emptyText: "No Data",
  2296. confirmFilter: "Confirm",
  2297. resetFilter: "Reset",
  2298. clearFilter: "All",
  2299. sumText: "Sum"
  2300. },
  2301. tour: {
  2302. next: "Next",
  2303. previous: "Previous",
  2304. finish: "Finish"
  2305. },
  2306. tree: {
  2307. emptyText: "No Data"
  2308. },
  2309. transfer: {
  2310. noMatch: "No matching data",
  2311. noData: "No data",
  2312. titles: ["List 1", "List 2"],
  2313. filterPlaceholder: "Enter keyword",
  2314. noCheckedFormat: "{total} items",
  2315. hasCheckedFormat: "{checked}/{total} checked"
  2316. },
  2317. image: {
  2318. error: "FAILED"
  2319. },
  2320. pageHeader: {
  2321. title: "Back"
  2322. },
  2323. popconfirm: {
  2324. confirmButtonText: "Yes",
  2325. cancelButtonText: "No"
  2326. },
  2327. carousel: {
  2328. leftArrow: "Carousel arrow left",
  2329. rightArrow: "Carousel arrow right",
  2330. indicator: "Carousel switch to index {index}"
  2331. }
  2332. }
  2333. };
  2334. const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
  2335. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_2, key) => {
  2336. var _a2;
  2337. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  2338. });
  2339. const buildLocaleContext = (locale) => {
  2340. const lang = vue.computed(() => vue.unref(locale).name);
  2341. const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
  2342. return {
  2343. lang,
  2344. locale: localeRef,
  2345. t: buildTranslator(locale)
  2346. };
  2347. };
  2348. const localeContextKey = Symbol("localeContextKey");
  2349. const useLocale = (localeOverrides) => {
  2350. const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
  2351. return buildLocaleContext(vue.computed(() => locale.value || English));
  2352. };
  2353. const defaultNamespace = "el";
  2354. const statePrefix = "is-";
  2355. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  2356. let cls = `${namespace}-${block}`;
  2357. if (blockSuffix) {
  2358. cls += `-${blockSuffix}`;
  2359. }
  2360. if (element) {
  2361. cls += `__${element}`;
  2362. }
  2363. if (modifier) {
  2364. cls += `--${modifier}`;
  2365. }
  2366. return cls;
  2367. };
  2368. const namespaceContextKey = Symbol("namespaceContextKey");
  2369. const useGetDerivedNamespace = (namespaceOverrides) => {
  2370. const derivedNamespace = namespaceOverrides || (vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref(defaultNamespace)) : vue.ref(defaultNamespace));
  2371. const namespace = vue.computed(() => {
  2372. return vue.unref(derivedNamespace) || defaultNamespace;
  2373. });
  2374. return namespace;
  2375. };
  2376. const useNamespace = (block, namespaceOverrides) => {
  2377. const namespace = useGetDerivedNamespace(namespaceOverrides);
  2378. const b2 = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  2379. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  2380. const m2 = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  2381. const be2 = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  2382. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  2383. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  2384. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  2385. const is = (name, ...args) => {
  2386. const state = args.length >= 1 ? args[0] : true;
  2387. return name && state ? `${statePrefix}${name}` : "";
  2388. };
  2389. const cssVar = (object) => {
  2390. const styles = {};
  2391. for (const key in object) {
  2392. if (object[key]) {
  2393. styles[`--${namespace.value}-${key}`] = object[key];
  2394. }
  2395. }
  2396. return styles;
  2397. };
  2398. const cssVarBlock = (object) => {
  2399. const styles = {};
  2400. for (const key in object) {
  2401. if (object[key]) {
  2402. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  2403. }
  2404. }
  2405. return styles;
  2406. };
  2407. const cssVarName = (name) => `--${namespace.value}-${name}`;
  2408. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  2409. return {
  2410. namespace,
  2411. b: b2,
  2412. e,
  2413. m: m2,
  2414. be: be2,
  2415. em,
  2416. bm,
  2417. bem,
  2418. is,
  2419. cssVar,
  2420. cssVarName,
  2421. cssVarBlock,
  2422. cssVarBlockName
  2423. };
  2424. };
  2425. const _prop = buildProp({
  2426. type: definePropType(Boolean),
  2427. default: null
  2428. });
  2429. const _event = buildProp({
  2430. type: definePropType(Function)
  2431. });
  2432. const createModelToggleComposable = (name) => {
  2433. const updateEventKey = `update:${name}`;
  2434. const updateEventKeyRaw2 = `onUpdate:${name}`;
  2435. const useModelToggleEmits2 = [updateEventKey];
  2436. const useModelToggleProps2 = {
  2437. [name]: _prop,
  2438. [updateEventKeyRaw2]: _event
  2439. };
  2440. const useModelToggle2 = ({
  2441. indicator,
  2442. toggleReason,
  2443. shouldHideWhenRouteChanges,
  2444. shouldProceed,
  2445. onShow,
  2446. onHide
  2447. }) => {
  2448. const instance = vue.getCurrentInstance();
  2449. const { emit } = instance;
  2450. const props = instance.props;
  2451. const hasUpdateHandler = vue.computed(() => isFunction$1(props[updateEventKeyRaw2]));
  2452. const isModelBindingAbsent = vue.computed(() => props[name] === null);
  2453. const doShow = (event) => {
  2454. if (indicator.value === true) {
  2455. return;
  2456. }
  2457. indicator.value = true;
  2458. if (toggleReason) {
  2459. toggleReason.value = event;
  2460. }
  2461. if (isFunction$1(onShow)) {
  2462. onShow(event);
  2463. }
  2464. };
  2465. const doHide = (event) => {
  2466. if (indicator.value === false) {
  2467. return;
  2468. }
  2469. indicator.value = false;
  2470. if (toggleReason) {
  2471. toggleReason.value = event;
  2472. }
  2473. if (isFunction$1(onHide)) {
  2474. onHide(event);
  2475. }
  2476. };
  2477. const show = (event) => {
  2478. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  2479. return;
  2480. const shouldEmit = hasUpdateHandler.value && isClient;
  2481. if (shouldEmit) {
  2482. emit(updateEventKey, true);
  2483. }
  2484. if (isModelBindingAbsent.value || !shouldEmit) {
  2485. doShow(event);
  2486. }
  2487. };
  2488. const hide = (event) => {
  2489. if (props.disabled === true || !isClient)
  2490. return;
  2491. const shouldEmit = hasUpdateHandler.value && isClient;
  2492. if (shouldEmit) {
  2493. emit(updateEventKey, false);
  2494. }
  2495. if (isModelBindingAbsent.value || !shouldEmit) {
  2496. doHide(event);
  2497. }
  2498. };
  2499. const onChange = (val) => {
  2500. if (!isBoolean(val))
  2501. return;
  2502. if (props.disabled && val) {
  2503. if (hasUpdateHandler.value) {
  2504. emit(updateEventKey, false);
  2505. }
  2506. } else if (indicator.value !== val) {
  2507. if (val) {
  2508. doShow();
  2509. } else {
  2510. doHide();
  2511. }
  2512. }
  2513. };
  2514. const toggle = () => {
  2515. if (indicator.value) {
  2516. hide();
  2517. } else {
  2518. show();
  2519. }
  2520. };
  2521. vue.watch(() => props[name], onChange);
  2522. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  2523. vue.watch(() => ({
  2524. ...instance.proxy.$route
  2525. }), () => {
  2526. if (shouldHideWhenRouteChanges.value && indicator.value) {
  2527. hide();
  2528. }
  2529. });
  2530. }
  2531. vue.onMounted(() => {
  2532. onChange(props[name]);
  2533. });
  2534. return {
  2535. hide,
  2536. show,
  2537. toggle,
  2538. hasUpdateHandler
  2539. };
  2540. };
  2541. return {
  2542. useModelToggle: useModelToggle2,
  2543. useModelToggleProps: useModelToggleProps2,
  2544. useModelToggleEmits: useModelToggleEmits2
  2545. };
  2546. };
  2547. const useProp = (name) => {
  2548. const vm = vue.getCurrentInstance();
  2549. return vue.computed(() => {
  2550. var _a2, _b;
  2551. return (_b = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b[name];
  2552. });
  2553. };
  2554. var E$1 = "top", R = "bottom", W = "right", P$1 = "left", me = "auto", G = [E$1, R, W, P$1], U$1 = "start", J = "end", Xe = "clippingParents", je = "viewport", K = "popper", Ye = "reference", De = G.reduce(function(t, e) {
  2555. return t.concat([e + "-" + U$1, e + "-" + J]);
  2556. }, []), Ee = [].concat(G, [me]).reduce(function(t, e) {
  2557. return t.concat([e, e + "-" + U$1, e + "-" + J]);
  2558. }, []), Ge = "beforeRead", Je = "read", Ke = "afterRead", Qe = "beforeMain", Ze = "main", et = "afterMain", tt = "beforeWrite", nt = "write", rt = "afterWrite", ot = [Ge, Je, Ke, Qe, Ze, et, tt, nt, rt];
  2559. function C(t) {
  2560. return t ? (t.nodeName || "").toLowerCase() : null;
  2561. }
  2562. function H(t) {
  2563. if (t == null)
  2564. return window;
  2565. if (t.toString() !== "[object Window]") {
  2566. var e = t.ownerDocument;
  2567. return e && e.defaultView || window;
  2568. }
  2569. return t;
  2570. }
  2571. function Q(t) {
  2572. var e = H(t).Element;
  2573. return t instanceof e || t instanceof Element;
  2574. }
  2575. function B(t) {
  2576. var e = H(t).HTMLElement;
  2577. return t instanceof e || t instanceof HTMLElement;
  2578. }
  2579. function Pe(t) {
  2580. if (typeof ShadowRoot == "undefined")
  2581. return false;
  2582. var e = H(t).ShadowRoot;
  2583. return t instanceof e || t instanceof ShadowRoot;
  2584. }
  2585. function Mt(t) {
  2586. var e = t.state;
  2587. Object.keys(e.elements).forEach(function(n) {
  2588. var r = e.styles[n] || {}, o2 = e.attributes[n] || {}, i = e.elements[n];
  2589. !B(i) || !C(i) || (Object.assign(i.style, r), Object.keys(o2).forEach(function(a2) {
  2590. var s2 = o2[a2];
  2591. s2 === false ? i.removeAttribute(a2) : i.setAttribute(a2, s2 === true ? "" : s2);
  2592. }));
  2593. });
  2594. }
  2595. function Rt(t) {
  2596. var e = t.state, n = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
  2597. return Object.assign(e.elements.popper.style, n.popper), e.styles = n, e.elements.arrow && Object.assign(e.elements.arrow.style, n.arrow), function() {
  2598. Object.keys(e.elements).forEach(function(r) {
  2599. var o2 = e.elements[r], i = e.attributes[r] || {}, a2 = Object.keys(e.styles.hasOwnProperty(r) ? e.styles[r] : n[r]), s2 = a2.reduce(function(f2, c2) {
  2600. return f2[c2] = "", f2;
  2601. }, {});
  2602. !B(o2) || !C(o2) || (Object.assign(o2.style, s2), Object.keys(i).forEach(function(f2) {
  2603. o2.removeAttribute(f2);
  2604. }));
  2605. });
  2606. };
  2607. }
  2608. var Ae = { name: "applyStyles", enabled: true, phase: "write", fn: Mt, effect: Rt, requires: ["computeStyles"] };
  2609. function q(t) {
  2610. return t.split("-")[0];
  2611. }
  2612. var X$1 = Math.max, ve = Math.min, Z = Math.round;
  2613. function ee(t, e) {
  2614. e === void 0 && (e = false);
  2615. var n = t.getBoundingClientRect(), r = 1, o2 = 1;
  2616. if (B(t) && e) {
  2617. var i = t.offsetHeight, a2 = t.offsetWidth;
  2618. a2 > 0 && (r = Z(n.width) / a2 || 1), i > 0 && (o2 = Z(n.height) / i || 1);
  2619. }
  2620. return { width: n.width / r, height: n.height / o2, top: n.top / o2, right: n.right / r, bottom: n.bottom / o2, left: n.left / r, x: n.left / r, y: n.top / o2 };
  2621. }
  2622. function ke(t) {
  2623. var e = ee(t), n = t.offsetWidth, r = t.offsetHeight;
  2624. return Math.abs(e.width - n) <= 1 && (n = e.width), Math.abs(e.height - r) <= 1 && (r = e.height), { x: t.offsetLeft, y: t.offsetTop, width: n, height: r };
  2625. }
  2626. function it(t, e) {
  2627. var n = e.getRootNode && e.getRootNode();
  2628. if (t.contains(e))
  2629. return true;
  2630. if (n && Pe(n)) {
  2631. var r = e;
  2632. do {
  2633. if (r && t.isSameNode(r))
  2634. return true;
  2635. r = r.parentNode || r.host;
  2636. } while (r);
  2637. }
  2638. return false;
  2639. }
  2640. function N$1(t) {
  2641. return H(t).getComputedStyle(t);
  2642. }
  2643. function Wt(t) {
  2644. return ["table", "td", "th"].indexOf(C(t)) >= 0;
  2645. }
  2646. function I$1(t) {
  2647. return ((Q(t) ? t.ownerDocument : t.document) || window.document).documentElement;
  2648. }
  2649. function ge(t) {
  2650. return C(t) === "html" ? t : t.assignedSlot || t.parentNode || (Pe(t) ? t.host : null) || I$1(t);
  2651. }
  2652. function at(t) {
  2653. return !B(t) || N$1(t).position === "fixed" ? null : t.offsetParent;
  2654. }
  2655. function Bt(t) {
  2656. var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, n = navigator.userAgent.indexOf("Trident") !== -1;
  2657. if (n && B(t)) {
  2658. var r = N$1(t);
  2659. if (r.position === "fixed")
  2660. return null;
  2661. }
  2662. var o2 = ge(t);
  2663. for (Pe(o2) && (o2 = o2.host); B(o2) && ["html", "body"].indexOf(C(o2)) < 0; ) {
  2664. var i = N$1(o2);
  2665. if (i.transform !== "none" || i.perspective !== "none" || i.contain === "paint" || ["transform", "perspective"].indexOf(i.willChange) !== -1 || e && i.willChange === "filter" || e && i.filter && i.filter !== "none")
  2666. return o2;
  2667. o2 = o2.parentNode;
  2668. }
  2669. return null;
  2670. }
  2671. function se(t) {
  2672. for (var e = H(t), n = at(t); n && Wt(n) && N$1(n).position === "static"; )
  2673. n = at(n);
  2674. return n && (C(n) === "html" || C(n) === "body" && N$1(n).position === "static") ? e : n || Bt(t) || e;
  2675. }
  2676. function Le(t) {
  2677. return ["top", "bottom"].indexOf(t) >= 0 ? "x" : "y";
  2678. }
  2679. function fe(t, e, n) {
  2680. return X$1(t, ve(e, n));
  2681. }
  2682. function St(t, e, n) {
  2683. var r = fe(t, e, n);
  2684. return r > n ? n : r;
  2685. }
  2686. function st() {
  2687. return { top: 0, right: 0, bottom: 0, left: 0 };
  2688. }
  2689. function ft(t) {
  2690. return Object.assign({}, st(), t);
  2691. }
  2692. function ct(t, e) {
  2693. return e.reduce(function(n, r) {
  2694. return n[r] = t, n;
  2695. }, {});
  2696. }
  2697. var Tt = function(t, e) {
  2698. return t = typeof t == "function" ? t(Object.assign({}, e.rects, { placement: e.placement })) : t, ft(typeof t != "number" ? t : ct(t, G));
  2699. };
  2700. function Ht(t) {
  2701. var e, n = t.state, r = t.name, o2 = t.options, i = n.elements.arrow, a2 = n.modifiersData.popperOffsets, s2 = q(n.placement), f2 = Le(s2), c2 = [P$1, W].indexOf(s2) >= 0, u2 = c2 ? "height" : "width";
  2702. if (!(!i || !a2)) {
  2703. var m2 = Tt(o2.padding, n), v2 = ke(i), l2 = f2 === "y" ? E$1 : P$1, h2 = f2 === "y" ? R : W, p2 = n.rects.reference[u2] + n.rects.reference[f2] - a2[f2] - n.rects.popper[u2], g = a2[f2] - n.rects.reference[f2], x2 = se(i), y = x2 ? f2 === "y" ? x2.clientHeight || 0 : x2.clientWidth || 0 : 0, $ = p2 / 2 - g / 2, d2 = m2[l2], b2 = y - v2[u2] - m2[h2], w2 = y / 2 - v2[u2] / 2 + $, O2 = fe(d2, w2, b2), j = f2;
  2704. n.modifiersData[r] = (e = {}, e[j] = O2, e.centerOffset = O2 - w2, e);
  2705. }
  2706. }
  2707. function Ct(t) {
  2708. var e = t.state, n = t.options, r = n.element, o2 = r === void 0 ? "[data-popper-arrow]" : r;
  2709. o2 != null && (typeof o2 == "string" && (o2 = e.elements.popper.querySelector(o2), !o2) || !it(e.elements.popper, o2) || (e.elements.arrow = o2));
  2710. }
  2711. var pt = { name: "arrow", enabled: true, phase: "main", fn: Ht, effect: Ct, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
  2712. function te(t) {
  2713. return t.split("-")[1];
  2714. }
  2715. var qt = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
  2716. function Vt(t) {
  2717. var e = t.x, n = t.y, r = window, o2 = r.devicePixelRatio || 1;
  2718. return { x: Z(e * o2) / o2 || 0, y: Z(n * o2) / o2 || 0 };
  2719. }
  2720. function ut(t) {
  2721. var e, n = t.popper, r = t.popperRect, o2 = t.placement, i = t.variation, a2 = t.offsets, s2 = t.position, f2 = t.gpuAcceleration, c2 = t.adaptive, u2 = t.roundOffsets, m2 = t.isFixed, v2 = a2.x, l2 = v2 === void 0 ? 0 : v2, h2 = a2.y, p2 = h2 === void 0 ? 0 : h2, g = typeof u2 == "function" ? u2({ x: l2, y: p2 }) : { x: l2, y: p2 };
  2722. l2 = g.x, p2 = g.y;
  2723. var x2 = a2.hasOwnProperty("x"), y = a2.hasOwnProperty("y"), $ = P$1, d2 = E$1, b2 = window;
  2724. if (c2) {
  2725. var w2 = se(n), O2 = "clientHeight", j = "clientWidth";
  2726. if (w2 === H(n) && (w2 = I$1(n), N$1(w2).position !== "static" && s2 === "absolute" && (O2 = "scrollHeight", j = "scrollWidth")), w2 = w2, o2 === E$1 || (o2 === P$1 || o2 === W) && i === J) {
  2727. d2 = R;
  2728. var A2 = m2 && w2 === b2 && b2.visualViewport ? b2.visualViewport.height : w2[O2];
  2729. p2 -= A2 - r.height, p2 *= f2 ? 1 : -1;
  2730. }
  2731. if (o2 === P$1 || (o2 === E$1 || o2 === R) && i === J) {
  2732. $ = W;
  2733. var k = m2 && w2 === b2 && b2.visualViewport ? b2.visualViewport.width : w2[j];
  2734. l2 -= k - r.width, l2 *= f2 ? 1 : -1;
  2735. }
  2736. }
  2737. var D2 = Object.assign({ position: s2 }, c2 && qt), S2 = u2 === true ? Vt({ x: l2, y: p2 }) : { x: l2, y: p2 };
  2738. if (l2 = S2.x, p2 = S2.y, f2) {
  2739. var L;
  2740. return Object.assign({}, D2, (L = {}, L[d2] = y ? "0" : "", L[$] = x2 ? "0" : "", L.transform = (b2.devicePixelRatio || 1) <= 1 ? "translate(" + l2 + "px, " + p2 + "px)" : "translate3d(" + l2 + "px, " + p2 + "px, 0)", L));
  2741. }
  2742. return Object.assign({}, D2, (e = {}, e[d2] = y ? p2 + "px" : "", e[$] = x2 ? l2 + "px" : "", e.transform = "", e));
  2743. }
  2744. function Nt(t) {
  2745. var e = t.state, n = t.options, r = n.gpuAcceleration, o2 = r === void 0 ? true : r, i = n.adaptive, a2 = i === void 0 ? true : i, s2 = n.roundOffsets, f2 = s2 === void 0 ? true : s2, c2 = { placement: q(e.placement), variation: te(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: o2, isFixed: e.options.strategy === "fixed" };
  2746. e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, ut(Object.assign({}, c2, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: a2, roundOffsets: f2 })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, ut(Object.assign({}, c2, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: f2 })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
  2747. }
  2748. var Me = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Nt, data: {} }, ye = { passive: true };
  2749. function It(t) {
  2750. var e = t.state, n = t.instance, r = t.options, o2 = r.scroll, i = o2 === void 0 ? true : o2, a2 = r.resize, s2 = a2 === void 0 ? true : a2, f2 = H(e.elements.popper), c2 = [].concat(e.scrollParents.reference, e.scrollParents.popper);
  2751. return i && c2.forEach(function(u2) {
  2752. u2.addEventListener("scroll", n.update, ye);
  2753. }), s2 && f2.addEventListener("resize", n.update, ye), function() {
  2754. i && c2.forEach(function(u2) {
  2755. u2.removeEventListener("scroll", n.update, ye);
  2756. }), s2 && f2.removeEventListener("resize", n.update, ye);
  2757. };
  2758. }
  2759. var Re = { name: "eventListeners", enabled: true, phase: "write", fn: function() {
  2760. }, effect: It, data: {} }, _t = { left: "right", right: "left", bottom: "top", top: "bottom" };
  2761. function be(t) {
  2762. return t.replace(/left|right|bottom|top/g, function(e) {
  2763. return _t[e];
  2764. });
  2765. }
  2766. var zt = { start: "end", end: "start" };
  2767. function lt(t) {
  2768. return t.replace(/start|end/g, function(e) {
  2769. return zt[e];
  2770. });
  2771. }
  2772. function We(t) {
  2773. var e = H(t), n = e.pageXOffset, r = e.pageYOffset;
  2774. return { scrollLeft: n, scrollTop: r };
  2775. }
  2776. function Be(t) {
  2777. return ee(I$1(t)).left + We(t).scrollLeft;
  2778. }
  2779. function Ft(t) {
  2780. var e = H(t), n = I$1(t), r = e.visualViewport, o2 = n.clientWidth, i = n.clientHeight, a2 = 0, s2 = 0;
  2781. return r && (o2 = r.width, i = r.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (a2 = r.offsetLeft, s2 = r.offsetTop)), { width: o2, height: i, x: a2 + Be(t), y: s2 };
  2782. }
  2783. function Ut(t) {
  2784. var e, n = I$1(t), r = We(t), o2 = (e = t.ownerDocument) == null ? void 0 : e.body, i = X$1(n.scrollWidth, n.clientWidth, o2 ? o2.scrollWidth : 0, o2 ? o2.clientWidth : 0), a2 = X$1(n.scrollHeight, n.clientHeight, o2 ? o2.scrollHeight : 0, o2 ? o2.clientHeight : 0), s2 = -r.scrollLeft + Be(t), f2 = -r.scrollTop;
  2785. return N$1(o2 || n).direction === "rtl" && (s2 += X$1(n.clientWidth, o2 ? o2.clientWidth : 0) - i), { width: i, height: a2, x: s2, y: f2 };
  2786. }
  2787. function Se(t) {
  2788. var e = N$1(t), n = e.overflow, r = e.overflowX, o2 = e.overflowY;
  2789. return /auto|scroll|overlay|hidden/.test(n + o2 + r);
  2790. }
  2791. function dt(t) {
  2792. return ["html", "body", "#document"].indexOf(C(t)) >= 0 ? t.ownerDocument.body : B(t) && Se(t) ? t : dt(ge(t));
  2793. }
  2794. function ce(t, e) {
  2795. var n;
  2796. e === void 0 && (e = []);
  2797. var r = dt(t), o2 = r === ((n = t.ownerDocument) == null ? void 0 : n.body), i = H(r), a2 = o2 ? [i].concat(i.visualViewport || [], Se(r) ? r : []) : r, s2 = e.concat(a2);
  2798. return o2 ? s2 : s2.concat(ce(ge(a2)));
  2799. }
  2800. function Te(t) {
  2801. return Object.assign({}, t, { left: t.x, top: t.y, right: t.x + t.width, bottom: t.y + t.height });
  2802. }
  2803. function Xt(t) {
  2804. var e = ee(t);
  2805. return e.top = e.top + t.clientTop, e.left = e.left + t.clientLeft, e.bottom = e.top + t.clientHeight, e.right = e.left + t.clientWidth, e.width = t.clientWidth, e.height = t.clientHeight, e.x = e.left, e.y = e.top, e;
  2806. }
  2807. function ht(t, e) {
  2808. return e === je ? Te(Ft(t)) : Q(e) ? Xt(e) : Te(Ut(I$1(t)));
  2809. }
  2810. function Yt(t) {
  2811. var e = ce(ge(t)), n = ["absolute", "fixed"].indexOf(N$1(t).position) >= 0, r = n && B(t) ? se(t) : t;
  2812. return Q(r) ? e.filter(function(o2) {
  2813. return Q(o2) && it(o2, r) && C(o2) !== "body";
  2814. }) : [];
  2815. }
  2816. function Gt(t, e, n) {
  2817. var r = e === "clippingParents" ? Yt(t) : [].concat(e), o2 = [].concat(r, [n]), i = o2[0], a2 = o2.reduce(function(s2, f2) {
  2818. var c2 = ht(t, f2);
  2819. return s2.top = X$1(c2.top, s2.top), s2.right = ve(c2.right, s2.right), s2.bottom = ve(c2.bottom, s2.bottom), s2.left = X$1(c2.left, s2.left), s2;
  2820. }, ht(t, i));
  2821. return a2.width = a2.right - a2.left, a2.height = a2.bottom - a2.top, a2.x = a2.left, a2.y = a2.top, a2;
  2822. }
  2823. function mt(t) {
  2824. var e = t.reference, n = t.element, r = t.placement, o2 = r ? q(r) : null, i = r ? te(r) : null, a2 = e.x + e.width / 2 - n.width / 2, s2 = e.y + e.height / 2 - n.height / 2, f2;
  2825. switch (o2) {
  2826. case E$1:
  2827. f2 = { x: a2, y: e.y - n.height };
  2828. break;
  2829. case R:
  2830. f2 = { x: a2, y: e.y + e.height };
  2831. break;
  2832. case W:
  2833. f2 = { x: e.x + e.width, y: s2 };
  2834. break;
  2835. case P$1:
  2836. f2 = { x: e.x - n.width, y: s2 };
  2837. break;
  2838. default:
  2839. f2 = { x: e.x, y: e.y };
  2840. }
  2841. var c2 = o2 ? Le(o2) : null;
  2842. if (c2 != null) {
  2843. var u2 = c2 === "y" ? "height" : "width";
  2844. switch (i) {
  2845. case U$1:
  2846. f2[c2] = f2[c2] - (e[u2] / 2 - n[u2] / 2);
  2847. break;
  2848. case J:
  2849. f2[c2] = f2[c2] + (e[u2] / 2 - n[u2] / 2);
  2850. break;
  2851. }
  2852. }
  2853. return f2;
  2854. }
  2855. function ne(t, e) {
  2856. e === void 0 && (e = {});
  2857. var n = e, r = n.placement, o2 = r === void 0 ? t.placement : r, i = n.boundary, a2 = i === void 0 ? Xe : i, s2 = n.rootBoundary, f2 = s2 === void 0 ? je : s2, c2 = n.elementContext, u2 = c2 === void 0 ? K : c2, m2 = n.altBoundary, v2 = m2 === void 0 ? false : m2, l2 = n.padding, h2 = l2 === void 0 ? 0 : l2, p2 = ft(typeof h2 != "number" ? h2 : ct(h2, G)), g = u2 === K ? Ye : K, x2 = t.rects.popper, y = t.elements[v2 ? g : u2], $ = Gt(Q(y) ? y : y.contextElement || I$1(t.elements.popper), a2, f2), d2 = ee(t.elements.reference), b2 = mt({ reference: d2, element: x2, strategy: "absolute", placement: o2 }), w2 = Te(Object.assign({}, x2, b2)), O2 = u2 === K ? w2 : d2, j = { top: $.top - O2.top + p2.top, bottom: O2.bottom - $.bottom + p2.bottom, left: $.left - O2.left + p2.left, right: O2.right - $.right + p2.right }, A2 = t.modifiersData.offset;
  2858. if (u2 === K && A2) {
  2859. var k = A2[o2];
  2860. Object.keys(j).forEach(function(D2) {
  2861. var S2 = [W, R].indexOf(D2) >= 0 ? 1 : -1, L = [E$1, R].indexOf(D2) >= 0 ? "y" : "x";
  2862. j[D2] += k[L] * S2;
  2863. });
  2864. }
  2865. return j;
  2866. }
  2867. function Jt(t, e) {
  2868. e === void 0 && (e = {});
  2869. var n = e, r = n.placement, o2 = n.boundary, i = n.rootBoundary, a2 = n.padding, s2 = n.flipVariations, f2 = n.allowedAutoPlacements, c2 = f2 === void 0 ? Ee : f2, u2 = te(r), m2 = u2 ? s2 ? De : De.filter(function(h2) {
  2870. return te(h2) === u2;
  2871. }) : G, v2 = m2.filter(function(h2) {
  2872. return c2.indexOf(h2) >= 0;
  2873. });
  2874. v2.length === 0 && (v2 = m2);
  2875. var l2 = v2.reduce(function(h2, p2) {
  2876. return h2[p2] = ne(t, { placement: p2, boundary: o2, rootBoundary: i, padding: a2 })[q(p2)], h2;
  2877. }, {});
  2878. return Object.keys(l2).sort(function(h2, p2) {
  2879. return l2[h2] - l2[p2];
  2880. });
  2881. }
  2882. function Kt(t) {
  2883. if (q(t) === me)
  2884. return [];
  2885. var e = be(t);
  2886. return [lt(t), e, lt(e)];
  2887. }
  2888. function Qt(t) {
  2889. var e = t.state, n = t.options, r = t.name;
  2890. if (!e.modifiersData[r]._skip) {
  2891. for (var o2 = n.mainAxis, i = o2 === void 0 ? true : o2, a2 = n.altAxis, s2 = a2 === void 0 ? true : a2, f2 = n.fallbackPlacements, c2 = n.padding, u2 = n.boundary, m2 = n.rootBoundary, v2 = n.altBoundary, l2 = n.flipVariations, h2 = l2 === void 0 ? true : l2, p2 = n.allowedAutoPlacements, g = e.options.placement, x2 = q(g), y = x2 === g, $ = f2 || (y || !h2 ? [be(g)] : Kt(g)), d2 = [g].concat($).reduce(function(z, V) {
  2892. return z.concat(q(V) === me ? Jt(e, { placement: V, boundary: u2, rootBoundary: m2, padding: c2, flipVariations: h2, allowedAutoPlacements: p2 }) : V);
  2893. }, []), b2 = e.rects.reference, w2 = e.rects.popper, O2 = /* @__PURE__ */ new Map(), j = true, A2 = d2[0], k = 0; k < d2.length; k++) {
  2894. var D2 = d2[k], S2 = q(D2), L = te(D2) === U$1, re = [E$1, R].indexOf(S2) >= 0, oe = re ? "width" : "height", M2 = ne(e, { placement: D2, boundary: u2, rootBoundary: m2, altBoundary: v2, padding: c2 }), T2 = re ? L ? W : P$1 : L ? R : E$1;
  2895. b2[oe] > w2[oe] && (T2 = be(T2));
  2896. var pe = be(T2), _2 = [];
  2897. if (i && _2.push(M2[S2] <= 0), s2 && _2.push(M2[T2] <= 0, M2[pe] <= 0), _2.every(function(z) {
  2898. return z;
  2899. })) {
  2900. A2 = D2, j = false;
  2901. break;
  2902. }
  2903. O2.set(D2, _2);
  2904. }
  2905. if (j)
  2906. for (var ue = h2 ? 3 : 1, xe = function(z) {
  2907. var V = d2.find(function(de) {
  2908. var ae = O2.get(de);
  2909. if (ae)
  2910. return ae.slice(0, z).every(function(Y2) {
  2911. return Y2;
  2912. });
  2913. });
  2914. if (V)
  2915. return A2 = V, "break";
  2916. }, ie = ue; ie > 0; ie--) {
  2917. var le = xe(ie);
  2918. if (le === "break")
  2919. break;
  2920. }
  2921. e.placement !== A2 && (e.modifiersData[r]._skip = true, e.placement = A2, e.reset = true);
  2922. }
  2923. }
  2924. var vt = { name: "flip", enabled: true, phase: "main", fn: Qt, requiresIfExists: ["offset"], data: { _skip: false } };
  2925. function gt(t, e, n) {
  2926. return n === void 0 && (n = { x: 0, y: 0 }), { top: t.top - e.height - n.y, right: t.right - e.width + n.x, bottom: t.bottom - e.height + n.y, left: t.left - e.width - n.x };
  2927. }
  2928. function yt(t) {
  2929. return [E$1, W, R, P$1].some(function(e) {
  2930. return t[e] >= 0;
  2931. });
  2932. }
  2933. function Zt(t) {
  2934. var e = t.state, n = t.name, r = e.rects.reference, o2 = e.rects.popper, i = e.modifiersData.preventOverflow, a2 = ne(e, { elementContext: "reference" }), s2 = ne(e, { altBoundary: true }), f2 = gt(a2, r), c2 = gt(s2, o2, i), u2 = yt(f2), m2 = yt(c2);
  2935. e.modifiersData[n] = { referenceClippingOffsets: f2, popperEscapeOffsets: c2, isReferenceHidden: u2, hasPopperEscaped: m2 }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": u2, "data-popper-escaped": m2 });
  2936. }
  2937. var bt = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: Zt };
  2938. function en(t, e, n) {
  2939. var r = q(t), o2 = [P$1, E$1].indexOf(r) >= 0 ? -1 : 1, i = typeof n == "function" ? n(Object.assign({}, e, { placement: t })) : n, a2 = i[0], s2 = i[1];
  2940. return a2 = a2 || 0, s2 = (s2 || 0) * o2, [P$1, W].indexOf(r) >= 0 ? { x: s2, y: a2 } : { x: a2, y: s2 };
  2941. }
  2942. function tn(t) {
  2943. var e = t.state, n = t.options, r = t.name, o2 = n.offset, i = o2 === void 0 ? [0, 0] : o2, a2 = Ee.reduce(function(u2, m2) {
  2944. return u2[m2] = en(m2, e.rects, i), u2;
  2945. }, {}), s2 = a2[e.placement], f2 = s2.x, c2 = s2.y;
  2946. e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += f2, e.modifiersData.popperOffsets.y += c2), e.modifiersData[r] = a2;
  2947. }
  2948. var wt = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: tn };
  2949. function nn(t) {
  2950. var e = t.state, n = t.name;
  2951. e.modifiersData[n] = mt({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
  2952. }
  2953. var He = { name: "popperOffsets", enabled: true, phase: "read", fn: nn, data: {} };
  2954. function rn(t) {
  2955. return t === "x" ? "y" : "x";
  2956. }
  2957. function on(t) {
  2958. var e = t.state, n = t.options, r = t.name, o2 = n.mainAxis, i = o2 === void 0 ? true : o2, a2 = n.altAxis, s2 = a2 === void 0 ? false : a2, f2 = n.boundary, c2 = n.rootBoundary, u2 = n.altBoundary, m2 = n.padding, v2 = n.tether, l2 = v2 === void 0 ? true : v2, h2 = n.tetherOffset, p2 = h2 === void 0 ? 0 : h2, g = ne(e, { boundary: f2, rootBoundary: c2, padding: m2, altBoundary: u2 }), x2 = q(e.placement), y = te(e.placement), $ = !y, d2 = Le(x2), b2 = rn(d2), w2 = e.modifiersData.popperOffsets, O2 = e.rects.reference, j = e.rects.popper, A2 = typeof p2 == "function" ? p2(Object.assign({}, e.rects, { placement: e.placement })) : p2, k = typeof A2 == "number" ? { mainAxis: A2, altAxis: A2 } : Object.assign({ mainAxis: 0, altAxis: 0 }, A2), D2 = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, S2 = { x: 0, y: 0 };
  2959. if (w2) {
  2960. if (i) {
  2961. var L, re = d2 === "y" ? E$1 : P$1, oe = d2 === "y" ? R : W, M2 = d2 === "y" ? "height" : "width", T2 = w2[d2], pe = T2 + g[re], _2 = T2 - g[oe], ue = l2 ? -j[M2] / 2 : 0, xe = y === U$1 ? O2[M2] : j[M2], ie = y === U$1 ? -j[M2] : -O2[M2], le = e.elements.arrow, z = l2 && le ? ke(le) : { width: 0, height: 0 }, V = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : st(), de = V[re], ae = V[oe], Y2 = fe(0, O2[M2], z[M2]), jt = $ ? O2[M2] / 2 - ue - Y2 - de - k.mainAxis : xe - Y2 - de - k.mainAxis, Dt = $ ? -O2[M2] / 2 + ue + Y2 + ae + k.mainAxis : ie + Y2 + ae + k.mainAxis, Oe = e.elements.arrow && se(e.elements.arrow), Et = Oe ? d2 === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Ce = (L = D2 == null ? void 0 : D2[d2]) != null ? L : 0, Pt = T2 + jt - Ce - Et, At = T2 + Dt - Ce, qe = fe(l2 ? ve(pe, Pt) : pe, T2, l2 ? X$1(_2, At) : _2);
  2962. w2[d2] = qe, S2[d2] = qe - T2;
  2963. }
  2964. if (s2) {
  2965. var Ve, kt = d2 === "x" ? E$1 : P$1, Lt = d2 === "x" ? R : W, F2 = w2[b2], he = b2 === "y" ? "height" : "width", Ne = F2 + g[kt], Ie = F2 - g[Lt], $e = [E$1, P$1].indexOf(x2) !== -1, _e = (Ve = D2 == null ? void 0 : D2[b2]) != null ? Ve : 0, ze = $e ? Ne : F2 - O2[he] - j[he] - _e + k.altAxis, Fe = $e ? F2 + O2[he] + j[he] - _e - k.altAxis : Ie, Ue = l2 && $e ? St(ze, F2, Fe) : fe(l2 ? ze : Ne, F2, l2 ? Fe : Ie);
  2966. w2[b2] = Ue, S2[b2] = Ue - F2;
  2967. }
  2968. e.modifiersData[r] = S2;
  2969. }
  2970. }
  2971. var xt = { name: "preventOverflow", enabled: true, phase: "main", fn: on, requiresIfExists: ["offset"] };
  2972. function an(t) {
  2973. return { scrollLeft: t.scrollLeft, scrollTop: t.scrollTop };
  2974. }
  2975. function sn(t) {
  2976. return t === H(t) || !B(t) ? We(t) : an(t);
  2977. }
  2978. function fn(t) {
  2979. var e = t.getBoundingClientRect(), n = Z(e.width) / t.offsetWidth || 1, r = Z(e.height) / t.offsetHeight || 1;
  2980. return n !== 1 || r !== 1;
  2981. }
  2982. function cn(t, e, n) {
  2983. n === void 0 && (n = false);
  2984. var r = B(e), o2 = B(e) && fn(e), i = I$1(e), a2 = ee(t, o2), s2 = { scrollLeft: 0, scrollTop: 0 }, f2 = { x: 0, y: 0 };
  2985. return (r || !r && !n) && ((C(e) !== "body" || Se(i)) && (s2 = sn(e)), B(e) ? (f2 = ee(e, true), f2.x += e.clientLeft, f2.y += e.clientTop) : i && (f2.x = Be(i))), { x: a2.left + s2.scrollLeft - f2.x, y: a2.top + s2.scrollTop - f2.y, width: a2.width, height: a2.height };
  2986. }
  2987. function pn(t) {
  2988. var e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [];
  2989. t.forEach(function(i) {
  2990. e.set(i.name, i);
  2991. });
  2992. function o2(i) {
  2993. n.add(i.name);
  2994. var a2 = [].concat(i.requires || [], i.requiresIfExists || []);
  2995. a2.forEach(function(s2) {
  2996. if (!n.has(s2)) {
  2997. var f2 = e.get(s2);
  2998. f2 && o2(f2);
  2999. }
  3000. }), r.push(i);
  3001. }
  3002. return t.forEach(function(i) {
  3003. n.has(i.name) || o2(i);
  3004. }), r;
  3005. }
  3006. function un(t) {
  3007. var e = pn(t);
  3008. return ot.reduce(function(n, r) {
  3009. return n.concat(e.filter(function(o2) {
  3010. return o2.phase === r;
  3011. }));
  3012. }, []);
  3013. }
  3014. function ln(t) {
  3015. var e;
  3016. return function() {
  3017. return e || (e = new Promise(function(n) {
  3018. Promise.resolve().then(function() {
  3019. e = void 0, n(t());
  3020. });
  3021. })), e;
  3022. };
  3023. }
  3024. function dn(t) {
  3025. var e = t.reduce(function(n, r) {
  3026. var o2 = n[r.name];
  3027. return n[r.name] = o2 ? Object.assign({}, o2, r, { options: Object.assign({}, o2.options, r.options), data: Object.assign({}, o2.data, r.data) }) : r, n;
  3028. }, {});
  3029. return Object.keys(e).map(function(n) {
  3030. return e[n];
  3031. });
  3032. }
  3033. var Ot = { placement: "bottom", modifiers: [], strategy: "absolute" };
  3034. function $t() {
  3035. for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
  3036. e[n] = arguments[n];
  3037. return !e.some(function(r) {
  3038. return !(r && typeof r.getBoundingClientRect == "function");
  3039. });
  3040. }
  3041. function we(t) {
  3042. t === void 0 && (t = {});
  3043. var e = t, n = e.defaultModifiers, r = n === void 0 ? [] : n, o2 = e.defaultOptions, i = o2 === void 0 ? Ot : o2;
  3044. return function(a2, s2, f2) {
  3045. f2 === void 0 && (f2 = i);
  3046. var c2 = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Ot, i), modifiersData: {}, elements: { reference: a2, popper: s2 }, attributes: {}, styles: {} }, u2 = [], m2 = false, v2 = { state: c2, setOptions: function(p2) {
  3047. var g = typeof p2 == "function" ? p2(c2.options) : p2;
  3048. h2(), c2.options = Object.assign({}, i, c2.options, g), c2.scrollParents = { reference: Q(a2) ? ce(a2) : a2.contextElement ? ce(a2.contextElement) : [], popper: ce(s2) };
  3049. var x2 = un(dn([].concat(r, c2.options.modifiers)));
  3050. return c2.orderedModifiers = x2.filter(function(y) {
  3051. return y.enabled;
  3052. }), l2(), v2.update();
  3053. }, forceUpdate: function() {
  3054. if (!m2) {
  3055. var p2 = c2.elements, g = p2.reference, x2 = p2.popper;
  3056. if ($t(g, x2)) {
  3057. c2.rects = { reference: cn(g, se(x2), c2.options.strategy === "fixed"), popper: ke(x2) }, c2.reset = false, c2.placement = c2.options.placement, c2.orderedModifiers.forEach(function(j) {
  3058. return c2.modifiersData[j.name] = Object.assign({}, j.data);
  3059. });
  3060. for (var y = 0; y < c2.orderedModifiers.length; y++) {
  3061. if (c2.reset === true) {
  3062. c2.reset = false, y = -1;
  3063. continue;
  3064. }
  3065. var $ = c2.orderedModifiers[y], d2 = $.fn, b2 = $.options, w2 = b2 === void 0 ? {} : b2, O2 = $.name;
  3066. typeof d2 == "function" && (c2 = d2({ state: c2, options: w2, name: O2, instance: v2 }) || c2);
  3067. }
  3068. }
  3069. }
  3070. }, update: ln(function() {
  3071. return new Promise(function(p2) {
  3072. v2.forceUpdate(), p2(c2);
  3073. });
  3074. }), destroy: function() {
  3075. h2(), m2 = true;
  3076. } };
  3077. if (!$t(a2, s2))
  3078. return v2;
  3079. v2.setOptions(f2).then(function(p2) {
  3080. !m2 && f2.onFirstUpdate && f2.onFirstUpdate(p2);
  3081. });
  3082. function l2() {
  3083. c2.orderedModifiers.forEach(function(p2) {
  3084. var g = p2.name, x2 = p2.options, y = x2 === void 0 ? {} : x2, $ = p2.effect;
  3085. if (typeof $ == "function") {
  3086. var d2 = $({ state: c2, name: g, instance: v2, options: y }), b2 = function() {
  3087. };
  3088. u2.push(d2 || b2);
  3089. }
  3090. });
  3091. }
  3092. function h2() {
  3093. u2.forEach(function(p2) {
  3094. return p2();
  3095. }), u2 = [];
  3096. }
  3097. return v2;
  3098. };
  3099. }
  3100. we();
  3101. var mn = [Re, He, Me, Ae];
  3102. we({ defaultModifiers: mn });
  3103. var gn = [Re, He, Me, Ae, wt, vt, xt, pt, bt], yn = we({ defaultModifiers: gn });
  3104. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  3105. const stateUpdater = {
  3106. name: "updateState",
  3107. enabled: true,
  3108. phase: "write",
  3109. fn: ({ state }) => {
  3110. const derivedState = deriveState(state);
  3111. Object.assign(states.value, derivedState);
  3112. },
  3113. requires: ["computeStyles"]
  3114. };
  3115. const options = vue.computed(() => {
  3116. const { onFirstUpdate, placement, strategy, modifiers } = vue.unref(opts);
  3117. return {
  3118. onFirstUpdate,
  3119. placement: placement || "bottom",
  3120. strategy: strategy || "absolute",
  3121. modifiers: [
  3122. ...modifiers || [],
  3123. stateUpdater,
  3124. { name: "applyStyles", enabled: false }
  3125. ]
  3126. };
  3127. });
  3128. const instanceRef = vue.shallowRef();
  3129. const states = vue.ref({
  3130. styles: {
  3131. popper: {
  3132. position: vue.unref(options).strategy,
  3133. left: "0",
  3134. top: "0"
  3135. },
  3136. arrow: {
  3137. position: "absolute"
  3138. }
  3139. },
  3140. attributes: {}
  3141. });
  3142. const destroy = () => {
  3143. if (!instanceRef.value)
  3144. return;
  3145. instanceRef.value.destroy();
  3146. instanceRef.value = void 0;
  3147. };
  3148. vue.watch(options, (newOptions) => {
  3149. const instance = vue.unref(instanceRef);
  3150. if (instance) {
  3151. instance.setOptions(newOptions);
  3152. }
  3153. }, {
  3154. deep: true
  3155. });
  3156. vue.watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  3157. destroy();
  3158. if (!referenceElement || !popperElement)
  3159. return;
  3160. instanceRef.value = yn(referenceElement, popperElement, vue.unref(options));
  3161. });
  3162. vue.onBeforeUnmount(() => {
  3163. destroy();
  3164. });
  3165. return {
  3166. state: vue.computed(() => {
  3167. var _a2;
  3168. return { ...((_a2 = vue.unref(instanceRef)) == null ? void 0 : _a2.state) || {} };
  3169. }),
  3170. styles: vue.computed(() => vue.unref(states).styles),
  3171. attributes: vue.computed(() => vue.unref(states).attributes),
  3172. update: () => {
  3173. var _a2;
  3174. return (_a2 = vue.unref(instanceRef)) == null ? void 0 : _a2.update();
  3175. },
  3176. forceUpdate: () => {
  3177. var _a2;
  3178. return (_a2 = vue.unref(instanceRef)) == null ? void 0 : _a2.forceUpdate();
  3179. },
  3180. instanceRef: vue.computed(() => vue.unref(instanceRef))
  3181. };
  3182. };
  3183. function deriveState(state) {
  3184. const elements = Object.keys(state.elements);
  3185. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  3186. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  3187. return {
  3188. styles,
  3189. attributes
  3190. };
  3191. }
  3192. function useTimeout() {
  3193. let timeoutHandle;
  3194. const registerTimeout = (fn2, delay) => {
  3195. cancelTimeout();
  3196. timeoutHandle = window.setTimeout(fn2, delay);
  3197. };
  3198. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  3199. tryOnScopeDispose(() => cancelTimeout());
  3200. return {
  3201. registerTimeout,
  3202. cancelTimeout
  3203. };
  3204. }
  3205. const defaultIdInjection = {
  3206. prefix: Math.floor(Math.random() * 1e4),
  3207. current: 0
  3208. };
  3209. const ID_INJECTION_KEY = Symbol("elIdInjection");
  3210. const useIdInjection = () => {
  3211. return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  3212. };
  3213. const useId = (deterministicId) => {
  3214. const idInjection = useIdInjection();
  3215. const namespace = useGetDerivedNamespace();
  3216. const idRef = vue.computed(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  3217. return idRef;
  3218. };
  3219. let registeredEscapeHandlers = [];
  3220. const cachedHandler = (e) => {
  3221. const event = e;
  3222. if (event.key === EVENT_CODE.esc) {
  3223. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  3224. }
  3225. };
  3226. const useEscapeKeydown = (handler) => {
  3227. vue.onMounted(() => {
  3228. if (registeredEscapeHandlers.length === 0) {
  3229. document.addEventListener("keydown", cachedHandler);
  3230. }
  3231. if (isClient)
  3232. registeredEscapeHandlers.push(handler);
  3233. });
  3234. vue.onBeforeUnmount(() => {
  3235. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  3236. if (registeredEscapeHandlers.length === 0) {
  3237. if (isClient)
  3238. document.removeEventListener("keydown", cachedHandler);
  3239. }
  3240. });
  3241. };
  3242. let cachedContainer;
  3243. const usePopperContainerId = () => {
  3244. const namespace = useGetDerivedNamespace();
  3245. const idInjection = useIdInjection();
  3246. const id = vue.computed(() => {
  3247. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  3248. });
  3249. const selector = vue.computed(() => `#${id.value}`);
  3250. return {
  3251. id,
  3252. selector
  3253. };
  3254. };
  3255. const createContainer = (id) => {
  3256. const container = document.createElement("div");
  3257. container.id = id;
  3258. document.body.appendChild(container);
  3259. return container;
  3260. };
  3261. const usePopperContainer = () => {
  3262. const { id, selector } = usePopperContainerId();
  3263. vue.onBeforeMount(() => {
  3264. if (!isClient)
  3265. return;
  3266. if (!cachedContainer && !document.body.querySelector(selector.value)) {
  3267. cachedContainer = createContainer(id.value);
  3268. }
  3269. });
  3270. return {
  3271. id,
  3272. selector
  3273. };
  3274. };
  3275. const useDelayedToggleProps = buildProps({
  3276. showAfter: {
  3277. type: Number,
  3278. default: 0
  3279. },
  3280. hideAfter: {
  3281. type: Number,
  3282. default: 200
  3283. },
  3284. autoClose: {
  3285. type: Number,
  3286. default: 0
  3287. }
  3288. });
  3289. const useDelayedToggle = ({
  3290. showAfter,
  3291. hideAfter,
  3292. autoClose,
  3293. open,
  3294. close
  3295. }) => {
  3296. const { registerTimeout } = useTimeout();
  3297. const {
  3298. registerTimeout: registerTimeoutForAutoClose,
  3299. cancelTimeout: cancelTimeoutForAutoClose
  3300. } = useTimeout();
  3301. const onOpen = (event) => {
  3302. registerTimeout(() => {
  3303. open(event);
  3304. const _autoClose = vue.unref(autoClose);
  3305. if (isNumber(_autoClose) && _autoClose > 0) {
  3306. registerTimeoutForAutoClose(() => {
  3307. close(event);
  3308. }, _autoClose);
  3309. }
  3310. }, vue.unref(showAfter));
  3311. };
  3312. const onClose = (event) => {
  3313. cancelTimeoutForAutoClose();
  3314. registerTimeout(() => {
  3315. close(event);
  3316. }, vue.unref(hideAfter));
  3317. };
  3318. return {
  3319. onOpen,
  3320. onClose
  3321. };
  3322. };
  3323. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  3324. const useForwardRef = (forwardRef) => {
  3325. const setForwardRef = (el) => {
  3326. forwardRef.value = el;
  3327. };
  3328. vue.provide(FORWARD_REF_INJECTION_KEY, {
  3329. setForwardRef
  3330. });
  3331. };
  3332. const useForwardRefDirective = (setForwardRef) => {
  3333. return {
  3334. mounted(el) {
  3335. setForwardRef(el);
  3336. },
  3337. updated(el) {
  3338. setForwardRef(el);
  3339. },
  3340. unmounted() {
  3341. setForwardRef(null);
  3342. }
  3343. };
  3344. };
  3345. const initial = {
  3346. current: 0
  3347. };
  3348. const zIndex = vue.ref(0);
  3349. const defaultInitialZIndex = 2e3;
  3350. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  3351. const zIndexContextKey = Symbol("zIndexContextKey");
  3352. const useZIndex = (zIndexOverrides) => {
  3353. const increasingInjection = vue.getCurrentInstance() ? vue.inject(ZINDEX_INJECTION_KEY, initial) : initial;
  3354. const zIndexInjection = zIndexOverrides || (vue.getCurrentInstance() ? vue.inject(zIndexContextKey, void 0) : void 0);
  3355. const initialZIndex = vue.computed(() => {
  3356. const zIndexFromInjection = vue.unref(zIndexInjection);
  3357. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  3358. });
  3359. const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
  3360. const nextZIndex = () => {
  3361. increasingInjection.current++;
  3362. zIndex.value = increasingInjection.current;
  3363. return currentZIndex.value;
  3364. };
  3365. if (!isClient && !vue.inject(ZINDEX_INJECTION_KEY))
  3366. ;
  3367. return {
  3368. initialZIndex,
  3369. currentZIndex,
  3370. nextZIndex
  3371. };
  3372. };
  3373. const useSizeProp = buildProp({
  3374. type: String,
  3375. values: componentSizes,
  3376. required: false
  3377. });
  3378. const SIZE_INJECTION_KEY = Symbol("size");
  3379. const useGlobalSize = () => {
  3380. const injectedSize = vue.inject(SIZE_INJECTION_KEY, {});
  3381. return vue.computed(() => {
  3382. return vue.unref(injectedSize.size) || "";
  3383. });
  3384. };
  3385. const useEmptyValuesProps = buildProps({
  3386. emptyValues: Array,
  3387. valueOnClear: {
  3388. type: [String, Number, Boolean, Function],
  3389. default: void 0,
  3390. validator: (val) => isFunction$1(val) ? !val() : !val
  3391. }
  3392. });
  3393. const ariaProps = buildProps({
  3394. ariaLabel: String,
  3395. ariaOrientation: {
  3396. type: String,
  3397. values: ["horizontal", "vertical", "undefined"]
  3398. },
  3399. ariaControls: String
  3400. });
  3401. const useAriaProps = (arias) => {
  3402. return pick$1(ariaProps, arias);
  3403. };
  3404. const configProviderContextKey = Symbol();
  3405. const globalConfig = vue.ref();
  3406. function useGlobalConfig(key, defaultValue = void 0) {
  3407. const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
  3408. if (key) {
  3409. return vue.computed(() => {
  3410. var _a2, _b;
  3411. return (_b = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b : defaultValue;
  3412. });
  3413. } else {
  3414. return config;
  3415. }
  3416. }
  3417. function useGlobalComponentSettings(block, sizeFallback) {
  3418. const config = useGlobalConfig();
  3419. const ns = useNamespace(block, vue.computed(() => {
  3420. var _a2;
  3421. return ((_a2 = config.value) == null ? void 0 : _a2.namespace) || defaultNamespace;
  3422. }));
  3423. const locale = useLocale(vue.computed(() => {
  3424. var _a2;
  3425. return (_a2 = config.value) == null ? void 0 : _a2.locale;
  3426. }));
  3427. const zIndex2 = useZIndex(vue.computed(() => {
  3428. var _a2;
  3429. return ((_a2 = config.value) == null ? void 0 : _a2.zIndex) || defaultInitialZIndex;
  3430. }));
  3431. const size = vue.computed(() => {
  3432. var _a2;
  3433. return vue.unref(sizeFallback) || ((_a2 = config.value) == null ? void 0 : _a2.size) || "";
  3434. });
  3435. provideGlobalConfig(vue.computed(() => vue.unref(config) || {}));
  3436. return {
  3437. ns,
  3438. locale,
  3439. zIndex: zIndex2,
  3440. size
  3441. };
  3442. }
  3443. const provideGlobalConfig = (config, app, global2 = false) => {
  3444. var _a2;
  3445. const inSetup = !!vue.getCurrentInstance();
  3446. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  3447. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? vue.provide : void 0;
  3448. if (!provideFn) {
  3449. return;
  3450. }
  3451. const context = vue.computed(() => {
  3452. const cfg = vue.unref(config);
  3453. if (!(oldConfig == null ? void 0 : oldConfig.value))
  3454. return cfg;
  3455. return mergeConfig(oldConfig.value, cfg);
  3456. });
  3457. provideFn(configProviderContextKey, context);
  3458. provideFn(localeContextKey, vue.computed(() => context.value.locale));
  3459. provideFn(namespaceContextKey, vue.computed(() => context.value.namespace));
  3460. provideFn(zIndexContextKey, vue.computed(() => context.value.zIndex));
  3461. provideFn(SIZE_INJECTION_KEY, {
  3462. size: vue.computed(() => context.value.size || "")
  3463. });
  3464. if (global2 || !globalConfig.value) {
  3465. globalConfig.value = context.value;
  3466. }
  3467. return context;
  3468. };
  3469. const mergeConfig = (a2, b2) => {
  3470. const keys2 = [.../* @__PURE__ */ new Set([...keysOf(a2), ...keysOf(b2)])];
  3471. const obj = {};
  3472. for (const key of keys2) {
  3473. obj[key] = b2[key] !== void 0 ? b2[key] : a2[key];
  3474. }
  3475. return obj;
  3476. };
  3477. const configProviderProps = buildProps({
  3478. a11y: {
  3479. type: Boolean,
  3480. default: true
  3481. },
  3482. locale: {
  3483. type: definePropType(Object)
  3484. },
  3485. size: useSizeProp,
  3486. button: {
  3487. type: definePropType(Object)
  3488. },
  3489. experimentalFeatures: {
  3490. type: definePropType(Object)
  3491. },
  3492. keyboardNavigation: {
  3493. type: Boolean,
  3494. default: true
  3495. },
  3496. message: {
  3497. type: definePropType(Object)
  3498. },
  3499. zIndex: Number,
  3500. namespace: {
  3501. type: String,
  3502. default: "el"
  3503. },
  3504. ...useEmptyValuesProps
  3505. });
  3506. const messageConfig = {};
  3507. vue.defineComponent({
  3508. name: "ElConfigProvider",
  3509. props: configProviderProps,
  3510. setup(props, { slots }) {
  3511. vue.watch(() => props.message, (val) => {
  3512. Object.assign(messageConfig, val != null ? val : {});
  3513. }, { immediate: true, deep: true });
  3514. const config = provideGlobalConfig(props);
  3515. return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  3516. }
  3517. });
  3518. var _export_sfc$1 = (sfc, props) => {
  3519. const target = sfc.__vccOpts || sfc;
  3520. for (const [key, val] of props) {
  3521. target[key] = val;
  3522. }
  3523. return target;
  3524. };
  3525. const iconProps = buildProps({
  3526. size: {
  3527. type: definePropType([Number, String])
  3528. },
  3529. color: {
  3530. type: String
  3531. }
  3532. });
  3533. const __default__$g = vue.defineComponent({
  3534. name: "ElIcon",
  3535. inheritAttrs: false
  3536. });
  3537. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  3538. ...__default__$g,
  3539. props: iconProps,
  3540. setup(__props) {
  3541. const props = __props;
  3542. const ns = useNamespace("icon");
  3543. const style2 = vue.computed(() => {
  3544. const { size, color } = props;
  3545. if (!size && !color)
  3546. return {};
  3547. return {
  3548. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  3549. "--color": color
  3550. };
  3551. });
  3552. return (_ctx, _cache) => {
  3553. return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
  3554. class: vue.unref(ns).b(),
  3555. style: vue.unref(style2)
  3556. }, _ctx.$attrs), [
  3557. vue.renderSlot(_ctx.$slots, "default")
  3558. ], 16);
  3559. };
  3560. }
  3561. });
  3562. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["__file", "icon.vue"]]);
  3563. const ElIcon = withInstall(Icon);
  3564. const formContextKey = Symbol("formContextKey");
  3565. const formItemContextKey = Symbol("formItemContextKey");
  3566. const useFormSize = (fallback, ignore = {}) => {
  3567. const emptyRef = vue.ref(void 0);
  3568. const size = ignore.prop ? emptyRef : useProp("size");
  3569. const globalConfig2 = ignore.global ? emptyRef : useGlobalSize();
  3570. const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0);
  3571. const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0);
  3572. return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  3573. };
  3574. const useFormDisabled = (fallback) => {
  3575. const disabled = useProp("disabled");
  3576. const form = vue.inject(formContextKey, void 0);
  3577. return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  3578. };
  3579. const useFormItem = () => {
  3580. const form = vue.inject(formContextKey, void 0);
  3581. const formItem = vue.inject(formItemContextKey, void 0);
  3582. return {
  3583. form,
  3584. formItem
  3585. };
  3586. };
  3587. const useFormItemInputId = (props, {
  3588. formItemContext,
  3589. disableIdGeneration,
  3590. disableIdManagement
  3591. }) => {
  3592. if (!disableIdGeneration) {
  3593. disableIdGeneration = vue.ref(false);
  3594. }
  3595. if (!disableIdManagement) {
  3596. disableIdManagement = vue.ref(false);
  3597. }
  3598. const inputId = vue.ref();
  3599. let idUnwatch = void 0;
  3600. const isLabeledByFormItem = vue.computed(() => {
  3601. var _a2;
  3602. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a2 = formItemContext.inputIds) == null ? void 0 : _a2.length) <= 1);
  3603. });
  3604. vue.onMounted(() => {
  3605. idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  3606. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  3607. if (newId !== inputId.value) {
  3608. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  3609. inputId.value && formItemContext.removeInputId(inputId.value);
  3610. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  3611. formItemContext.addInputId(newId);
  3612. }
  3613. }
  3614. inputId.value = newId;
  3615. }
  3616. }, { immediate: true });
  3617. });
  3618. vue.onUnmounted(() => {
  3619. idUnwatch && idUnwatch();
  3620. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  3621. inputId.value && formItemContext.removeInputId(inputId.value);
  3622. }
  3623. });
  3624. return {
  3625. isLabeledByFormItem,
  3626. inputId
  3627. };
  3628. };
  3629. const GAP = 4;
  3630. const BAR_MAP = {
  3631. vertical: {
  3632. offset: "offsetHeight",
  3633. scroll: "scrollTop",
  3634. scrollSize: "scrollHeight",
  3635. size: "height",
  3636. key: "vertical",
  3637. axis: "Y",
  3638. client: "clientY",
  3639. direction: "top"
  3640. },
  3641. horizontal: {
  3642. offset: "offsetWidth",
  3643. scroll: "scrollLeft",
  3644. scrollSize: "scrollWidth",
  3645. size: "width",
  3646. key: "horizontal",
  3647. axis: "X",
  3648. client: "clientX",
  3649. direction: "left"
  3650. }
  3651. };
  3652. const renderThumbStyle = ({
  3653. move,
  3654. size,
  3655. bar
  3656. }) => ({
  3657. [bar.size]: size,
  3658. transform: `translate${bar.axis}(${move}%)`
  3659. });
  3660. const scrollbarContextKey = Symbol("scrollbarContextKey");
  3661. const thumbProps = buildProps({
  3662. vertical: Boolean,
  3663. size: String,
  3664. move: Number,
  3665. ratio: {
  3666. type: Number,
  3667. required: true
  3668. },
  3669. always: Boolean
  3670. });
  3671. const COMPONENT_NAME$1 = "Thumb";
  3672. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  3673. __name: "thumb",
  3674. props: thumbProps,
  3675. setup(__props) {
  3676. const props = __props;
  3677. const scrollbar = vue.inject(scrollbarContextKey);
  3678. const ns = useNamespace("scrollbar");
  3679. if (!scrollbar)
  3680. throwError(COMPONENT_NAME$1, "can not inject scrollbar context");
  3681. const instance = vue.ref();
  3682. const thumb = vue.ref();
  3683. const thumbState = vue.ref({});
  3684. const visible = vue.ref(false);
  3685. let cursorDown = false;
  3686. let cursorLeave = false;
  3687. let originalOnSelectStart = isClient ? document.onselectstart : null;
  3688. const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  3689. const thumbStyle = vue.computed(() => renderThumbStyle({
  3690. size: props.size,
  3691. move: props.move,
  3692. bar: bar.value
  3693. }));
  3694. const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  3695. const clickThumbHandler = (e) => {
  3696. var _a2;
  3697. e.stopPropagation();
  3698. if (e.ctrlKey || [1, 2].includes(e.button))
  3699. return;
  3700. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  3701. startDrag(e);
  3702. const el = e.currentTarget;
  3703. if (!el)
  3704. return;
  3705. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  3706. };
  3707. const clickTrackHandler = (e) => {
  3708. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  3709. return;
  3710. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  3711. const thumbHalf = thumb.value[bar.value.offset] / 2;
  3712. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  3713. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  3714. };
  3715. const startDrag = (e) => {
  3716. e.stopImmediatePropagation();
  3717. cursorDown = true;
  3718. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  3719. document.addEventListener("mouseup", mouseUpDocumentHandler);
  3720. originalOnSelectStart = document.onselectstart;
  3721. document.onselectstart = () => false;
  3722. };
  3723. const mouseMoveDocumentHandler = (e) => {
  3724. if (!instance.value || !thumb.value)
  3725. return;
  3726. if (cursorDown === false)
  3727. return;
  3728. const prevPage = thumbState.value[bar.value.axis];
  3729. if (!prevPage)
  3730. return;
  3731. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  3732. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  3733. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  3734. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  3735. };
  3736. const mouseUpDocumentHandler = () => {
  3737. cursorDown = false;
  3738. thumbState.value[bar.value.axis] = 0;
  3739. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  3740. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  3741. restoreOnselectstart();
  3742. if (cursorLeave)
  3743. visible.value = false;
  3744. };
  3745. const mouseMoveScrollbarHandler = () => {
  3746. cursorLeave = false;
  3747. visible.value = !!props.size;
  3748. };
  3749. const mouseLeaveScrollbarHandler = () => {
  3750. cursorLeave = true;
  3751. visible.value = cursorDown;
  3752. };
  3753. vue.onBeforeUnmount(() => {
  3754. restoreOnselectstart();
  3755. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  3756. });
  3757. const restoreOnselectstart = () => {
  3758. if (document.onselectstart !== originalOnSelectStart)
  3759. document.onselectstart = originalOnSelectStart;
  3760. };
  3761. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  3762. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  3763. return (_ctx, _cache) => {
  3764. return vue.openBlock(), vue.createBlock(vue.Transition, {
  3765. name: vue.unref(ns).b("fade"),
  3766. persisted: ""
  3767. }, {
  3768. default: vue.withCtx(() => [
  3769. vue.withDirectives(vue.createElementVNode("div", {
  3770. ref_key: "instance",
  3771. ref: instance,
  3772. class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]),
  3773. onMousedown: clickTrackHandler
  3774. }, [
  3775. vue.createElementVNode("div", {
  3776. ref_key: "thumb",
  3777. ref: thumb,
  3778. class: vue.normalizeClass(vue.unref(ns).e("thumb")),
  3779. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  3780. onMousedown: clickThumbHandler
  3781. }, null, 38)
  3782. ], 34), [
  3783. [vue.vShow, _ctx.always || visible.value]
  3784. ])
  3785. ]),
  3786. _: 1
  3787. }, 8, ["name"]);
  3788. };
  3789. }
  3790. });
  3791. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["__file", "thumb.vue"]]);
  3792. const barProps = buildProps({
  3793. always: {
  3794. type: Boolean,
  3795. default: true
  3796. },
  3797. minSize: {
  3798. type: Number,
  3799. required: true
  3800. }
  3801. });
  3802. const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
  3803. __name: "bar",
  3804. props: barProps,
  3805. setup(__props, { expose }) {
  3806. const props = __props;
  3807. const scrollbar = vue.inject(scrollbarContextKey);
  3808. const moveX = vue.ref(0);
  3809. const moveY = vue.ref(0);
  3810. const sizeWidth = vue.ref("");
  3811. const sizeHeight = vue.ref("");
  3812. const ratioY = vue.ref(1);
  3813. const ratioX = vue.ref(1);
  3814. const handleScroll = (wrap) => {
  3815. if (wrap) {
  3816. const offsetHeight = wrap.offsetHeight - GAP;
  3817. const offsetWidth = wrap.offsetWidth - GAP;
  3818. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  3819. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  3820. }
  3821. };
  3822. const update = () => {
  3823. const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
  3824. if (!wrap)
  3825. return;
  3826. const offsetHeight = wrap.offsetHeight - GAP;
  3827. const offsetWidth = wrap.offsetWidth - GAP;
  3828. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  3829. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  3830. const height = Math.max(originalHeight, props.minSize);
  3831. const width = Math.max(originalWidth, props.minSize);
  3832. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  3833. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  3834. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  3835. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  3836. };
  3837. expose({
  3838. handleScroll,
  3839. update
  3840. });
  3841. return (_ctx, _cache) => {
  3842. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  3843. vue.createVNode(Thumb, {
  3844. move: moveX.value,
  3845. ratio: ratioX.value,
  3846. size: sizeWidth.value,
  3847. always: _ctx.always
  3848. }, null, 8, ["move", "ratio", "size", "always"]),
  3849. vue.createVNode(Thumb, {
  3850. move: moveY.value,
  3851. ratio: ratioY.value,
  3852. size: sizeHeight.value,
  3853. vertical: "",
  3854. always: _ctx.always
  3855. }, null, 8, ["move", "ratio", "size", "always"])
  3856. ], 64);
  3857. };
  3858. }
  3859. });
  3860. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__file", "bar.vue"]]);
  3861. const scrollbarProps = buildProps({
  3862. height: {
  3863. type: [String, Number],
  3864. default: ""
  3865. },
  3866. maxHeight: {
  3867. type: [String, Number],
  3868. default: ""
  3869. },
  3870. native: {
  3871. type: Boolean,
  3872. default: false
  3873. },
  3874. wrapStyle: {
  3875. type: definePropType([String, Object, Array]),
  3876. default: ""
  3877. },
  3878. wrapClass: {
  3879. type: [String, Array],
  3880. default: ""
  3881. },
  3882. viewClass: {
  3883. type: [String, Array],
  3884. default: ""
  3885. },
  3886. viewStyle: {
  3887. type: [String, Array, Object],
  3888. default: ""
  3889. },
  3890. noresize: Boolean,
  3891. tag: {
  3892. type: String,
  3893. default: "div"
  3894. },
  3895. always: Boolean,
  3896. minSize: {
  3897. type: Number,
  3898. default: 20
  3899. },
  3900. id: String,
  3901. role: String,
  3902. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  3903. });
  3904. const scrollbarEmits = {
  3905. scroll: ({
  3906. scrollTop,
  3907. scrollLeft
  3908. }) => [scrollTop, scrollLeft].every(isNumber)
  3909. };
  3910. const COMPONENT_NAME = "ElScrollbar";
  3911. const __default__$f = vue.defineComponent({
  3912. name: COMPONENT_NAME
  3913. });
  3914. const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
  3915. ...__default__$f,
  3916. props: scrollbarProps,
  3917. emits: scrollbarEmits,
  3918. setup(__props, { expose, emit }) {
  3919. const props = __props;
  3920. const ns = useNamespace("scrollbar");
  3921. let stopResizeObserver = void 0;
  3922. let stopResizeListener = void 0;
  3923. const scrollbarRef = vue.ref();
  3924. const wrapRef = vue.ref();
  3925. const resizeRef = vue.ref();
  3926. const barRef = vue.ref();
  3927. const wrapStyle = vue.computed(() => {
  3928. const style2 = {};
  3929. if (props.height)
  3930. style2.height = addUnit(props.height);
  3931. if (props.maxHeight)
  3932. style2.maxHeight = addUnit(props.maxHeight);
  3933. return [props.wrapStyle, style2];
  3934. });
  3935. const wrapKls = vue.computed(() => {
  3936. return [
  3937. props.wrapClass,
  3938. ns.e("wrap"),
  3939. { [ns.em("wrap", "hidden-default")]: !props.native }
  3940. ];
  3941. });
  3942. const resizeKls = vue.computed(() => {
  3943. return [ns.e("view"), props.viewClass];
  3944. });
  3945. const handleScroll = () => {
  3946. var _a2;
  3947. if (wrapRef.value) {
  3948. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  3949. emit("scroll", {
  3950. scrollTop: wrapRef.value.scrollTop,
  3951. scrollLeft: wrapRef.value.scrollLeft
  3952. });
  3953. }
  3954. };
  3955. function scrollTo(arg1, arg2) {
  3956. if (isObject$1(arg1)) {
  3957. wrapRef.value.scrollTo(arg1);
  3958. } else if (isNumber(arg1) && isNumber(arg2)) {
  3959. wrapRef.value.scrollTo(arg1, arg2);
  3960. }
  3961. }
  3962. const setScrollTop = (value) => {
  3963. if (!isNumber(value)) {
  3964. return;
  3965. }
  3966. wrapRef.value.scrollTop = value;
  3967. };
  3968. const setScrollLeft = (value) => {
  3969. if (!isNumber(value)) {
  3970. return;
  3971. }
  3972. wrapRef.value.scrollLeft = value;
  3973. };
  3974. const update = () => {
  3975. var _a2;
  3976. (_a2 = barRef.value) == null ? void 0 : _a2.update();
  3977. };
  3978. vue.watch(() => props.noresize, (noresize) => {
  3979. if (noresize) {
  3980. stopResizeObserver == null ? void 0 : stopResizeObserver();
  3981. stopResizeListener == null ? void 0 : stopResizeListener();
  3982. } else {
  3983. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  3984. stopResizeListener = useEventListener("resize", update);
  3985. }
  3986. }, { immediate: true });
  3987. vue.watch(() => [props.maxHeight, props.height], () => {
  3988. if (!props.native)
  3989. vue.nextTick(() => {
  3990. var _a2;
  3991. update();
  3992. if (wrapRef.value) {
  3993. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  3994. }
  3995. });
  3996. });
  3997. vue.provide(scrollbarContextKey, vue.reactive({
  3998. scrollbarElement: scrollbarRef,
  3999. wrapElement: wrapRef
  4000. }));
  4001. vue.onMounted(() => {
  4002. if (!props.native)
  4003. vue.nextTick(() => {
  4004. update();
  4005. });
  4006. });
  4007. vue.onUpdated(() => update());
  4008. expose({
  4009. wrapRef,
  4010. update,
  4011. scrollTo,
  4012. setScrollTop,
  4013. setScrollLeft,
  4014. handleScroll
  4015. });
  4016. return (_ctx, _cache) => {
  4017. return vue.openBlock(), vue.createElementBlock("div", {
  4018. ref_key: "scrollbarRef",
  4019. ref: scrollbarRef,
  4020. class: vue.normalizeClass(vue.unref(ns).b())
  4021. }, [
  4022. vue.createElementVNode("div", {
  4023. ref_key: "wrapRef",
  4024. ref: wrapRef,
  4025. class: vue.normalizeClass(vue.unref(wrapKls)),
  4026. style: vue.normalizeStyle(vue.unref(wrapStyle)),
  4027. onScroll: handleScroll
  4028. }, [
  4029. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  4030. id: _ctx.id,
  4031. ref_key: "resizeRef",
  4032. ref: resizeRef,
  4033. class: vue.normalizeClass(vue.unref(resizeKls)),
  4034. style: vue.normalizeStyle(_ctx.viewStyle),
  4035. role: _ctx.role,
  4036. "aria-label": _ctx.ariaLabel,
  4037. "aria-orientation": _ctx.ariaOrientation
  4038. }, {
  4039. default: vue.withCtx(() => [
  4040. vue.renderSlot(_ctx.$slots, "default")
  4041. ]),
  4042. _: 3
  4043. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  4044. ], 38),
  4045. !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, {
  4046. key: 0,
  4047. ref_key: "barRef",
  4048. ref: barRef,
  4049. always: _ctx.always,
  4050. "min-size": _ctx.minSize
  4051. }, null, 8, ["always", "min-size"])) : vue.createCommentVNode("v-if", true)
  4052. ], 2);
  4053. };
  4054. }
  4055. });
  4056. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__file", "scrollbar.vue"]]);
  4057. const ElScrollbar = withInstall(Scrollbar);
  4058. const POPPER_INJECTION_KEY = Symbol("popper");
  4059. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  4060. const roleTypes = [
  4061. "dialog",
  4062. "grid",
  4063. "group",
  4064. "listbox",
  4065. "menu",
  4066. "navigation",
  4067. "tooltip",
  4068. "tree"
  4069. ];
  4070. const popperProps = buildProps({
  4071. role: {
  4072. type: String,
  4073. values: roleTypes,
  4074. default: "tooltip"
  4075. }
  4076. });
  4077. const __default__$e = vue.defineComponent({
  4078. name: "ElPopper",
  4079. inheritAttrs: false
  4080. });
  4081. const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
  4082. ...__default__$e,
  4083. props: popperProps,
  4084. setup(__props, { expose }) {
  4085. const props = __props;
  4086. const triggerRef = vue.ref();
  4087. const popperInstanceRef = vue.ref();
  4088. const contentRef = vue.ref();
  4089. const referenceRef = vue.ref();
  4090. const role = vue.computed(() => props.role);
  4091. const popperProvides = {
  4092. triggerRef,
  4093. popperInstanceRef,
  4094. contentRef,
  4095. referenceRef,
  4096. role
  4097. };
  4098. expose(popperProvides);
  4099. vue.provide(POPPER_INJECTION_KEY, popperProvides);
  4100. return (_ctx, _cache) => {
  4101. return vue.renderSlot(_ctx.$slots, "default");
  4102. };
  4103. }
  4104. });
  4105. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__file", "popper.vue"]]);
  4106. const popperArrowProps = buildProps({
  4107. arrowOffset: {
  4108. type: Number,
  4109. default: 5
  4110. }
  4111. });
  4112. const __default__$d = vue.defineComponent({
  4113. name: "ElPopperArrow",
  4114. inheritAttrs: false
  4115. });
  4116. const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
  4117. ...__default__$d,
  4118. props: popperArrowProps,
  4119. setup(__props, { expose }) {
  4120. const props = __props;
  4121. const ns = useNamespace("popper");
  4122. const { arrowOffset, arrowRef, arrowStyle } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  4123. vue.watch(() => props.arrowOffset, (val) => {
  4124. arrowOffset.value = val;
  4125. });
  4126. vue.onBeforeUnmount(() => {
  4127. arrowRef.value = void 0;
  4128. });
  4129. expose({
  4130. arrowRef
  4131. });
  4132. return (_ctx, _cache) => {
  4133. return vue.openBlock(), vue.createElementBlock("span", {
  4134. ref_key: "arrowRef",
  4135. ref: arrowRef,
  4136. class: vue.normalizeClass(vue.unref(ns).e("arrow")),
  4137. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  4138. "data-popper-arrow": ""
  4139. }, null, 6);
  4140. };
  4141. }
  4142. });
  4143. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "arrow.vue"]]);
  4144. const NAME = "ElOnlyChild";
  4145. const OnlyChild = vue.defineComponent({
  4146. name: NAME,
  4147. setup(_2, {
  4148. slots,
  4149. attrs
  4150. }) {
  4151. var _a2;
  4152. const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY);
  4153. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  4154. return () => {
  4155. var _a22;
  4156. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  4157. if (!defaultSlot)
  4158. return null;
  4159. if (defaultSlot.length > 1) {
  4160. return null;
  4161. }
  4162. const firstLegitNode = findFirstLegitChild(defaultSlot);
  4163. if (!firstLegitNode) {
  4164. return null;
  4165. }
  4166. return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  4167. };
  4168. }
  4169. });
  4170. function findFirstLegitChild(node) {
  4171. if (!node)
  4172. return null;
  4173. const children = node;
  4174. for (const child of children) {
  4175. if (isObject$1(child)) {
  4176. switch (child.type) {
  4177. case vue.Comment:
  4178. continue;
  4179. case vue.Text:
  4180. case "svg":
  4181. return wrapTextContent(child);
  4182. case vue.Fragment:
  4183. return findFirstLegitChild(child.children);
  4184. default:
  4185. return child;
  4186. }
  4187. }
  4188. return wrapTextContent(child);
  4189. }
  4190. return null;
  4191. }
  4192. function wrapTextContent(s2) {
  4193. const ns = useNamespace("only-child");
  4194. return vue.createVNode("span", {
  4195. "class": ns.e("content")
  4196. }, [s2]);
  4197. }
  4198. const popperTriggerProps = buildProps({
  4199. virtualRef: {
  4200. type: definePropType(Object)
  4201. },
  4202. virtualTriggering: Boolean,
  4203. onMouseenter: {
  4204. type: definePropType(Function)
  4205. },
  4206. onMouseleave: {
  4207. type: definePropType(Function)
  4208. },
  4209. onClick: {
  4210. type: definePropType(Function)
  4211. },
  4212. onKeydown: {
  4213. type: definePropType(Function)
  4214. },
  4215. onFocus: {
  4216. type: definePropType(Function)
  4217. },
  4218. onBlur: {
  4219. type: definePropType(Function)
  4220. },
  4221. onContextmenu: {
  4222. type: definePropType(Function)
  4223. },
  4224. id: String,
  4225. open: Boolean
  4226. });
  4227. const __default__$c = vue.defineComponent({
  4228. name: "ElPopperTrigger",
  4229. inheritAttrs: false
  4230. });
  4231. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  4232. ...__default__$c,
  4233. props: popperTriggerProps,
  4234. setup(__props, { expose }) {
  4235. const props = __props;
  4236. const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0);
  4237. useForwardRef(triggerRef);
  4238. const ariaControls = vue.computed(() => {
  4239. return ariaHaspopup.value ? props.id : void 0;
  4240. });
  4241. const ariaDescribedby = vue.computed(() => {
  4242. if (role && role.value === "tooltip") {
  4243. return props.open && props.id ? props.id : void 0;
  4244. }
  4245. return void 0;
  4246. });
  4247. const ariaHaspopup = vue.computed(() => {
  4248. if (role && role.value !== "tooltip") {
  4249. return role.value;
  4250. }
  4251. return void 0;
  4252. });
  4253. const ariaExpanded = vue.computed(() => {
  4254. return ariaHaspopup.value ? `${props.open}` : void 0;
  4255. });
  4256. let virtualTriggerAriaStopWatch = void 0;
  4257. vue.onMounted(() => {
  4258. vue.watch(() => props.virtualRef, (virtualEl) => {
  4259. if (virtualEl) {
  4260. triggerRef.value = unrefElement(virtualEl);
  4261. }
  4262. }, {
  4263. immediate: true
  4264. });
  4265. vue.watch(triggerRef, (el, prevEl) => {
  4266. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  4267. virtualTriggerAriaStopWatch = void 0;
  4268. if (isElement(el)) {
  4269. [
  4270. "onMouseenter",
  4271. "onMouseleave",
  4272. "onClick",
  4273. "onKeydown",
  4274. "onFocus",
  4275. "onBlur",
  4276. "onContextmenu"
  4277. ].forEach((eventName) => {
  4278. var _a2;
  4279. const handler = props[eventName];
  4280. if (handler) {
  4281. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  4282. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  4283. }
  4284. });
  4285. virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  4286. [
  4287. "aria-controls",
  4288. "aria-describedby",
  4289. "aria-haspopup",
  4290. "aria-expanded"
  4291. ].forEach((key, idx) => {
  4292. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  4293. });
  4294. }, { immediate: true });
  4295. }
  4296. if (isElement(prevEl)) {
  4297. [
  4298. "aria-controls",
  4299. "aria-describedby",
  4300. "aria-haspopup",
  4301. "aria-expanded"
  4302. ].forEach((key) => prevEl.removeAttribute(key));
  4303. }
  4304. }, {
  4305. immediate: true
  4306. });
  4307. });
  4308. vue.onBeforeUnmount(() => {
  4309. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  4310. virtualTriggerAriaStopWatch = void 0;
  4311. });
  4312. expose({
  4313. triggerRef
  4314. });
  4315. return (_ctx, _cache) => {
  4316. return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
  4317. "aria-controls": vue.unref(ariaControls),
  4318. "aria-describedby": vue.unref(ariaDescribedby),
  4319. "aria-expanded": vue.unref(ariaExpanded),
  4320. "aria-haspopup": vue.unref(ariaHaspopup)
  4321. }), {
  4322. default: vue.withCtx(() => [
  4323. vue.renderSlot(_ctx.$slots, "default")
  4324. ]),
  4325. _: 3
  4326. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
  4327. };
  4328. }
  4329. });
  4330. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__file", "trigger.vue"]]);
  4331. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  4332. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  4333. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  4334. const FOCUS_AFTER_TRAPPED_OPTS = {
  4335. cancelable: true,
  4336. bubbles: false
  4337. };
  4338. const FOCUSOUT_PREVENTED_OPTS = {
  4339. cancelable: true,
  4340. bubbles: false
  4341. };
  4342. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  4343. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  4344. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  4345. const focusReason = vue.ref();
  4346. const lastUserFocusTimestamp = vue.ref(0);
  4347. const lastAutomatedFocusTimestamp = vue.ref(0);
  4348. let focusReasonUserCount = 0;
  4349. const obtainAllFocusableElements = (element) => {
  4350. const nodes = [];
  4351. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  4352. acceptNode: (node) => {
  4353. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  4354. if (node.disabled || node.hidden || isHiddenInput)
  4355. return NodeFilter.FILTER_SKIP;
  4356. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  4357. }
  4358. });
  4359. while (walker.nextNode())
  4360. nodes.push(walker.currentNode);
  4361. return nodes;
  4362. };
  4363. const getVisibleElement = (elements, container) => {
  4364. for (const element of elements) {
  4365. if (!isHidden(element, container))
  4366. return element;
  4367. }
  4368. };
  4369. const isHidden = (element, container) => {
  4370. if (getComputedStyle(element).visibility === "hidden")
  4371. return true;
  4372. while (element) {
  4373. if (container && element === container)
  4374. return false;
  4375. if (getComputedStyle(element).display === "none")
  4376. return true;
  4377. element = element.parentElement;
  4378. }
  4379. return false;
  4380. };
  4381. const getEdges = (container) => {
  4382. const focusable = obtainAllFocusableElements(container);
  4383. const first = getVisibleElement(focusable, container);
  4384. const last = getVisibleElement(focusable.reverse(), container);
  4385. return [first, last];
  4386. };
  4387. const isSelectable = (element) => {
  4388. return element instanceof HTMLInputElement && "select" in element;
  4389. };
  4390. const tryFocus = (element, shouldSelect) => {
  4391. if (element && element.focus) {
  4392. const prevFocusedElement = document.activeElement;
  4393. element.focus({ preventScroll: true });
  4394. lastAutomatedFocusTimestamp.value = window.performance.now();
  4395. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  4396. element.select();
  4397. }
  4398. }
  4399. };
  4400. function removeFromStack(list, item) {
  4401. const copy = [...list];
  4402. const idx = list.indexOf(item);
  4403. if (idx !== -1) {
  4404. copy.splice(idx, 1);
  4405. }
  4406. return copy;
  4407. }
  4408. const createFocusableStack = () => {
  4409. let stack = [];
  4410. const push = (layer) => {
  4411. const currentLayer = stack[0];
  4412. if (currentLayer && layer !== currentLayer) {
  4413. currentLayer.pause();
  4414. }
  4415. stack = removeFromStack(stack, layer);
  4416. stack.unshift(layer);
  4417. };
  4418. const remove = (layer) => {
  4419. var _a2, _b;
  4420. stack = removeFromStack(stack, layer);
  4421. (_b = (_a2 = stack[0]) == null ? void 0 : _a2.resume) == null ? void 0 : _b.call(_a2);
  4422. };
  4423. return {
  4424. push,
  4425. remove
  4426. };
  4427. };
  4428. const focusFirstDescendant = (elements, shouldSelect = false) => {
  4429. const prevFocusedElement = document.activeElement;
  4430. for (const element of elements) {
  4431. tryFocus(element, shouldSelect);
  4432. if (document.activeElement !== prevFocusedElement)
  4433. return;
  4434. }
  4435. };
  4436. const focusableStack = createFocusableStack();
  4437. const isFocusCausedByUserEvent = () => {
  4438. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  4439. };
  4440. const notifyFocusReasonPointer = () => {
  4441. focusReason.value = "pointer";
  4442. lastUserFocusTimestamp.value = window.performance.now();
  4443. };
  4444. const notifyFocusReasonKeydown = () => {
  4445. focusReason.value = "keyboard";
  4446. lastUserFocusTimestamp.value = window.performance.now();
  4447. };
  4448. const useFocusReason = () => {
  4449. vue.onMounted(() => {
  4450. if (focusReasonUserCount === 0) {
  4451. document.addEventListener("mousedown", notifyFocusReasonPointer);
  4452. document.addEventListener("touchstart", notifyFocusReasonPointer);
  4453. document.addEventListener("keydown", notifyFocusReasonKeydown);
  4454. }
  4455. focusReasonUserCount++;
  4456. });
  4457. vue.onBeforeUnmount(() => {
  4458. focusReasonUserCount--;
  4459. if (focusReasonUserCount <= 0) {
  4460. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  4461. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  4462. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  4463. }
  4464. });
  4465. return {
  4466. focusReason,
  4467. lastUserFocusTimestamp,
  4468. lastAutomatedFocusTimestamp
  4469. };
  4470. };
  4471. const createFocusOutPreventedEvent = (detail) => {
  4472. return new CustomEvent(FOCUSOUT_PREVENTED, {
  4473. ...FOCUSOUT_PREVENTED_OPTS,
  4474. detail
  4475. });
  4476. };
  4477. const _sfc_main$h = vue.defineComponent({
  4478. name: "ElFocusTrap",
  4479. inheritAttrs: false,
  4480. props: {
  4481. loop: Boolean,
  4482. trapped: Boolean,
  4483. focusTrapEl: Object,
  4484. focusStartEl: {
  4485. type: [Object, String],
  4486. default: "first"
  4487. }
  4488. },
  4489. emits: [
  4490. ON_TRAP_FOCUS_EVT,
  4491. ON_RELEASE_FOCUS_EVT,
  4492. "focusin",
  4493. "focusout",
  4494. "focusout-prevented",
  4495. "release-requested"
  4496. ],
  4497. setup(props, { emit }) {
  4498. const forwardRef = vue.ref();
  4499. let lastFocusBeforeTrapped;
  4500. let lastFocusAfterTrapped;
  4501. const { focusReason: focusReason2 } = useFocusReason();
  4502. useEscapeKeydown((event) => {
  4503. if (props.trapped && !focusLayer.paused) {
  4504. emit("release-requested", event);
  4505. }
  4506. });
  4507. const focusLayer = {
  4508. paused: false,
  4509. pause() {
  4510. this.paused = true;
  4511. },
  4512. resume() {
  4513. this.paused = false;
  4514. }
  4515. };
  4516. const onKeydown = (e) => {
  4517. if (!props.loop && !props.trapped)
  4518. return;
  4519. if (focusLayer.paused)
  4520. return;
  4521. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  4522. const { loop } = props;
  4523. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  4524. const currentFocusingEl = document.activeElement;
  4525. if (isTabbing && currentFocusingEl) {
  4526. const container = currentTarget;
  4527. const [first, last] = getEdges(container);
  4528. const isTabbable = first && last;
  4529. if (!isTabbable) {
  4530. if (currentFocusingEl === container) {
  4531. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  4532. focusReason: focusReason2.value
  4533. });
  4534. emit("focusout-prevented", focusoutPreventedEvent);
  4535. if (!focusoutPreventedEvent.defaultPrevented) {
  4536. e.preventDefault();
  4537. }
  4538. }
  4539. } else {
  4540. if (!shiftKey && currentFocusingEl === last) {
  4541. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  4542. focusReason: focusReason2.value
  4543. });
  4544. emit("focusout-prevented", focusoutPreventedEvent);
  4545. if (!focusoutPreventedEvent.defaultPrevented) {
  4546. e.preventDefault();
  4547. if (loop)
  4548. tryFocus(first, true);
  4549. }
  4550. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  4551. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  4552. focusReason: focusReason2.value
  4553. });
  4554. emit("focusout-prevented", focusoutPreventedEvent);
  4555. if (!focusoutPreventedEvent.defaultPrevented) {
  4556. e.preventDefault();
  4557. if (loop)
  4558. tryFocus(last, true);
  4559. }
  4560. }
  4561. }
  4562. }
  4563. };
  4564. vue.provide(FOCUS_TRAP_INJECTION_KEY, {
  4565. focusTrapRef: forwardRef,
  4566. onKeydown
  4567. });
  4568. vue.watch(() => props.focusTrapEl, (focusTrapEl) => {
  4569. if (focusTrapEl) {
  4570. forwardRef.value = focusTrapEl;
  4571. }
  4572. }, { immediate: true });
  4573. vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  4574. if (forwardRef2) {
  4575. forwardRef2.addEventListener("keydown", onKeydown);
  4576. forwardRef2.addEventListener("focusin", onFocusIn);
  4577. forwardRef2.addEventListener("focusout", onFocusOut);
  4578. }
  4579. if (oldForwardRef) {
  4580. oldForwardRef.removeEventListener("keydown", onKeydown);
  4581. oldForwardRef.removeEventListener("focusin", onFocusIn);
  4582. oldForwardRef.removeEventListener("focusout", onFocusOut);
  4583. }
  4584. });
  4585. const trapOnFocus = (e) => {
  4586. emit(ON_TRAP_FOCUS_EVT, e);
  4587. };
  4588. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  4589. const onFocusIn = (e) => {
  4590. const trapContainer = vue.unref(forwardRef);
  4591. if (!trapContainer)
  4592. return;
  4593. const target = e.target;
  4594. const relatedTarget = e.relatedTarget;
  4595. const isFocusedInTrap = target && trapContainer.contains(target);
  4596. if (!props.trapped) {
  4597. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  4598. if (!isPrevFocusedInTrap) {
  4599. lastFocusBeforeTrapped = relatedTarget;
  4600. }
  4601. }
  4602. if (isFocusedInTrap)
  4603. emit("focusin", e);
  4604. if (focusLayer.paused)
  4605. return;
  4606. if (props.trapped) {
  4607. if (isFocusedInTrap) {
  4608. lastFocusAfterTrapped = target;
  4609. } else {
  4610. tryFocus(lastFocusAfterTrapped, true);
  4611. }
  4612. }
  4613. };
  4614. const onFocusOut = (e) => {
  4615. const trapContainer = vue.unref(forwardRef);
  4616. if (focusLayer.paused || !trapContainer)
  4617. return;
  4618. if (props.trapped) {
  4619. const relatedTarget = e.relatedTarget;
  4620. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  4621. setTimeout(() => {
  4622. if (!focusLayer.paused && props.trapped) {
  4623. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  4624. focusReason: focusReason2.value
  4625. });
  4626. emit("focusout-prevented", focusoutPreventedEvent);
  4627. if (!focusoutPreventedEvent.defaultPrevented) {
  4628. tryFocus(lastFocusAfterTrapped, true);
  4629. }
  4630. }
  4631. }, 0);
  4632. }
  4633. } else {
  4634. const target = e.target;
  4635. const isFocusedInTrap = target && trapContainer.contains(target);
  4636. if (!isFocusedInTrap)
  4637. emit("focusout", e);
  4638. }
  4639. };
  4640. async function startTrap() {
  4641. await vue.nextTick();
  4642. const trapContainer = vue.unref(forwardRef);
  4643. if (trapContainer) {
  4644. focusableStack.push(focusLayer);
  4645. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  4646. lastFocusBeforeTrapped = prevFocusedElement;
  4647. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  4648. if (!isPrevFocusContained) {
  4649. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  4650. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  4651. trapContainer.dispatchEvent(focusEvent);
  4652. if (!focusEvent.defaultPrevented) {
  4653. vue.nextTick(() => {
  4654. let focusStartEl = props.focusStartEl;
  4655. if (!isString(focusStartEl)) {
  4656. tryFocus(focusStartEl);
  4657. if (document.activeElement !== focusStartEl) {
  4658. focusStartEl = "first";
  4659. }
  4660. }
  4661. if (focusStartEl === "first") {
  4662. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  4663. }
  4664. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  4665. tryFocus(trapContainer);
  4666. }
  4667. });
  4668. }
  4669. }
  4670. }
  4671. }
  4672. function stopTrap() {
  4673. const trapContainer = vue.unref(forwardRef);
  4674. if (trapContainer) {
  4675. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  4676. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  4677. ...FOCUS_AFTER_TRAPPED_OPTS,
  4678. detail: {
  4679. focusReason: focusReason2.value
  4680. }
  4681. });
  4682. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  4683. trapContainer.dispatchEvent(releasedEvent);
  4684. if (!releasedEvent.defaultPrevented && (focusReason2.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  4685. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  4686. }
  4687. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  4688. focusableStack.remove(focusLayer);
  4689. }
  4690. }
  4691. vue.onMounted(() => {
  4692. if (props.trapped) {
  4693. startTrap();
  4694. }
  4695. vue.watch(() => props.trapped, (trapped) => {
  4696. if (trapped) {
  4697. startTrap();
  4698. } else {
  4699. stopTrap();
  4700. }
  4701. });
  4702. });
  4703. vue.onBeforeUnmount(() => {
  4704. if (props.trapped) {
  4705. stopTrap();
  4706. }
  4707. });
  4708. return {
  4709. onKeydown
  4710. };
  4711. }
  4712. });
  4713. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  4714. return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  4715. }
  4716. var ElFocusTrap = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["render", _sfc_render$4], ["__file", "focus-trap.vue"]]);
  4717. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  4718. const popperCoreConfigProps = buildProps({
  4719. boundariesPadding: {
  4720. type: Number,
  4721. default: 0
  4722. },
  4723. fallbackPlacements: {
  4724. type: definePropType(Array),
  4725. default: void 0
  4726. },
  4727. gpuAcceleration: {
  4728. type: Boolean,
  4729. default: true
  4730. },
  4731. offset: {
  4732. type: Number,
  4733. default: 12
  4734. },
  4735. placement: {
  4736. type: String,
  4737. values: Ee,
  4738. default: "bottom"
  4739. },
  4740. popperOptions: {
  4741. type: definePropType(Object),
  4742. default: () => ({})
  4743. },
  4744. strategy: {
  4745. type: String,
  4746. values: POSITIONING_STRATEGIES,
  4747. default: "absolute"
  4748. }
  4749. });
  4750. const popperContentProps = buildProps({
  4751. ...popperCoreConfigProps,
  4752. id: String,
  4753. style: {
  4754. type: definePropType([String, Array, Object])
  4755. },
  4756. className: {
  4757. type: definePropType([String, Array, Object])
  4758. },
  4759. effect: {
  4760. type: String,
  4761. default: "dark"
  4762. },
  4763. visible: Boolean,
  4764. enterable: {
  4765. type: Boolean,
  4766. default: true
  4767. },
  4768. pure: Boolean,
  4769. focusOnShow: {
  4770. type: Boolean,
  4771. default: false
  4772. },
  4773. trapping: {
  4774. type: Boolean,
  4775. default: false
  4776. },
  4777. popperClass: {
  4778. type: definePropType([String, Array, Object])
  4779. },
  4780. popperStyle: {
  4781. type: definePropType([String, Array, Object])
  4782. },
  4783. referenceEl: {
  4784. type: definePropType(Object)
  4785. },
  4786. triggerTargetEl: {
  4787. type: definePropType(Object)
  4788. },
  4789. stopPopperMouseEvent: {
  4790. type: Boolean,
  4791. default: true
  4792. },
  4793. virtualTriggering: Boolean,
  4794. zIndex: Number,
  4795. ...useAriaProps(["ariaLabel"])
  4796. });
  4797. const popperContentEmits = {
  4798. mouseenter: (evt) => evt instanceof MouseEvent,
  4799. mouseleave: (evt) => evt instanceof MouseEvent,
  4800. focus: () => true,
  4801. blur: () => true,
  4802. close: () => true
  4803. };
  4804. const buildPopperOptions = (props, modifiers = []) => {
  4805. const { placement, strategy, popperOptions } = props;
  4806. const options = {
  4807. placement,
  4808. strategy,
  4809. ...popperOptions,
  4810. modifiers: [...genModifiers(props), ...modifiers]
  4811. };
  4812. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  4813. return options;
  4814. };
  4815. const unwrapMeasurableEl = ($el) => {
  4816. if (!isClient)
  4817. return;
  4818. return unrefElement($el);
  4819. };
  4820. function genModifiers(options) {
  4821. const { offset, gpuAcceleration, fallbackPlacements } = options;
  4822. return [
  4823. {
  4824. name: "offset",
  4825. options: {
  4826. offset: [0, offset != null ? offset : 12]
  4827. }
  4828. },
  4829. {
  4830. name: "preventOverflow",
  4831. options: {
  4832. padding: {
  4833. top: 2,
  4834. bottom: 2,
  4835. left: 5,
  4836. right: 5
  4837. }
  4838. }
  4839. },
  4840. {
  4841. name: "flip",
  4842. options: {
  4843. padding: 5,
  4844. fallbackPlacements
  4845. }
  4846. },
  4847. {
  4848. name: "computeStyles",
  4849. options: {
  4850. gpuAcceleration
  4851. }
  4852. }
  4853. ];
  4854. }
  4855. function deriveExtraModifiers(options, modifiers) {
  4856. if (modifiers) {
  4857. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  4858. }
  4859. }
  4860. const DEFAULT_ARROW_OFFSET = 0;
  4861. const usePopperContent = (props) => {
  4862. const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0);
  4863. const arrowRef = vue.ref();
  4864. const arrowOffset = vue.ref();
  4865. const eventListenerModifier = vue.computed(() => {
  4866. return {
  4867. name: "eventListeners",
  4868. enabled: !!props.visible
  4869. };
  4870. });
  4871. const arrowModifier = vue.computed(() => {
  4872. var _a2;
  4873. const arrowEl = vue.unref(arrowRef);
  4874. const offset = (_a2 = vue.unref(arrowOffset)) != null ? _a2 : DEFAULT_ARROW_OFFSET;
  4875. return {
  4876. name: "arrow",
  4877. enabled: !isUndefined$1(arrowEl),
  4878. options: {
  4879. element: arrowEl,
  4880. padding: offset
  4881. }
  4882. };
  4883. });
  4884. const options = vue.computed(() => {
  4885. return {
  4886. onFirstUpdate: () => {
  4887. update();
  4888. },
  4889. ...buildPopperOptions(props, [
  4890. vue.unref(arrowModifier),
  4891. vue.unref(eventListenerModifier)
  4892. ])
  4893. };
  4894. });
  4895. const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef));
  4896. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  4897. vue.watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  4898. vue.onMounted(() => {
  4899. vue.watch(() => {
  4900. var _a2;
  4901. return (_a2 = vue.unref(computedReference)) == null ? void 0 : _a2.getBoundingClientRect();
  4902. }, () => {
  4903. update();
  4904. });
  4905. });
  4906. return {
  4907. attributes,
  4908. arrowRef,
  4909. contentRef,
  4910. instanceRef,
  4911. state,
  4912. styles,
  4913. role,
  4914. forceUpdate,
  4915. update
  4916. };
  4917. };
  4918. const usePopperContentDOM = (props, {
  4919. attributes,
  4920. styles,
  4921. role
  4922. }) => {
  4923. const { nextZIndex } = useZIndex();
  4924. const ns = useNamespace("popper");
  4925. const contentAttrs = vue.computed(() => vue.unref(attributes).popper);
  4926. const contentZIndex = vue.ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  4927. const contentClass = vue.computed(() => [
  4928. ns.b(),
  4929. ns.is("pure", props.pure),
  4930. ns.is(props.effect),
  4931. props.popperClass
  4932. ]);
  4933. const contentStyle = vue.computed(() => {
  4934. return [
  4935. { zIndex: vue.unref(contentZIndex) },
  4936. vue.unref(styles).popper,
  4937. props.popperStyle || {}
  4938. ];
  4939. });
  4940. const ariaModal = vue.computed(() => role.value === "dialog" ? "false" : void 0);
  4941. const arrowStyle = vue.computed(() => vue.unref(styles).arrow || {});
  4942. const updateZIndex = () => {
  4943. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  4944. };
  4945. return {
  4946. ariaModal,
  4947. arrowStyle,
  4948. contentAttrs,
  4949. contentClass,
  4950. contentStyle,
  4951. contentZIndex,
  4952. updateZIndex
  4953. };
  4954. };
  4955. const usePopperContentFocusTrap = (props, emit) => {
  4956. const trapped = vue.ref(false);
  4957. const focusStartRef = vue.ref();
  4958. const onFocusAfterTrapped = () => {
  4959. emit("focus");
  4960. };
  4961. const onFocusAfterReleased = (event) => {
  4962. var _a2;
  4963. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) !== "pointer") {
  4964. focusStartRef.value = "first";
  4965. emit("blur");
  4966. }
  4967. };
  4968. const onFocusInTrap = (event) => {
  4969. if (props.visible && !trapped.value) {
  4970. if (event.target) {
  4971. focusStartRef.value = event.target;
  4972. }
  4973. trapped.value = true;
  4974. }
  4975. };
  4976. const onFocusoutPrevented = (event) => {
  4977. if (!props.trapping) {
  4978. if (event.detail.focusReason === "pointer") {
  4979. event.preventDefault();
  4980. }
  4981. trapped.value = false;
  4982. }
  4983. };
  4984. const onReleaseRequested = () => {
  4985. trapped.value = false;
  4986. emit("close");
  4987. };
  4988. return {
  4989. focusStartRef,
  4990. trapped,
  4991. onFocusAfterReleased,
  4992. onFocusAfterTrapped,
  4993. onFocusInTrap,
  4994. onFocusoutPrevented,
  4995. onReleaseRequested
  4996. };
  4997. };
  4998. const __default__$b = vue.defineComponent({
  4999. name: "ElPopperContent"
  5000. });
  5001. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  5002. ...__default__$b,
  5003. props: popperContentProps,
  5004. emits: popperContentEmits,
  5005. setup(__props, { expose, emit }) {
  5006. const props = __props;
  5007. const {
  5008. focusStartRef,
  5009. trapped,
  5010. onFocusAfterReleased,
  5011. onFocusAfterTrapped,
  5012. onFocusInTrap,
  5013. onFocusoutPrevented,
  5014. onReleaseRequested
  5015. } = usePopperContentFocusTrap(props, emit);
  5016. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  5017. const {
  5018. ariaModal,
  5019. arrowStyle,
  5020. contentAttrs,
  5021. contentClass,
  5022. contentStyle,
  5023. updateZIndex
  5024. } = usePopperContentDOM(props, {
  5025. styles,
  5026. attributes,
  5027. role
  5028. });
  5029. const formItemContext = vue.inject(formItemContextKey, void 0);
  5030. const arrowOffset = vue.ref();
  5031. vue.provide(POPPER_CONTENT_INJECTION_KEY, {
  5032. arrowStyle,
  5033. arrowRef,
  5034. arrowOffset
  5035. });
  5036. if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
  5037. vue.provide(formItemContextKey, {
  5038. ...formItemContext,
  5039. addInputId: NOOP,
  5040. removeInputId: NOOP
  5041. });
  5042. }
  5043. let triggerTargetAriaStopWatch = void 0;
  5044. const updatePopper = (shouldUpdateZIndex = true) => {
  5045. update();
  5046. shouldUpdateZIndex && updateZIndex();
  5047. };
  5048. const togglePopperAlive = () => {
  5049. updatePopper(false);
  5050. if (props.visible && props.focusOnShow) {
  5051. trapped.value = true;
  5052. } else if (props.visible === false) {
  5053. trapped.value = false;
  5054. }
  5055. };
  5056. vue.onMounted(() => {
  5057. vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  5058. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  5059. triggerTargetAriaStopWatch = void 0;
  5060. const el = vue.unref(triggerTargetEl || contentRef.value);
  5061. const prevEl = vue.unref(prevTriggerTargetEl || contentRef.value);
  5062. if (isElement(el)) {
  5063. triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  5064. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  5065. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  5066. });
  5067. }, { immediate: true });
  5068. }
  5069. if (prevEl !== el && isElement(prevEl)) {
  5070. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  5071. prevEl.removeAttribute(key);
  5072. });
  5073. }
  5074. }, { immediate: true });
  5075. vue.watch(() => props.visible, togglePopperAlive, { immediate: true });
  5076. });
  5077. vue.onBeforeUnmount(() => {
  5078. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  5079. triggerTargetAriaStopWatch = void 0;
  5080. });
  5081. expose({
  5082. popperContentRef: contentRef,
  5083. popperInstanceRef: instanceRef,
  5084. updatePopper,
  5085. contentStyle
  5086. });
  5087. return (_ctx, _cache) => {
  5088. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  5089. ref_key: "contentRef",
  5090. ref: contentRef
  5091. }, vue.unref(contentAttrs), {
  5092. style: vue.unref(contentStyle),
  5093. class: vue.unref(contentClass),
  5094. tabindex: "-1",
  5095. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  5096. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  5097. }), [
  5098. vue.createVNode(vue.unref(ElFocusTrap), {
  5099. trapped: vue.unref(trapped),
  5100. "trap-on-focus-in": true,
  5101. "focus-trap-el": vue.unref(contentRef),
  5102. "focus-start-el": vue.unref(focusStartRef),
  5103. onFocusAfterTrapped: vue.unref(onFocusAfterTrapped),
  5104. onFocusAfterReleased: vue.unref(onFocusAfterReleased),
  5105. onFocusin: vue.unref(onFocusInTrap),
  5106. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  5107. onReleaseRequested: vue.unref(onReleaseRequested)
  5108. }, {
  5109. default: vue.withCtx(() => [
  5110. vue.renderSlot(_ctx.$slots, "default")
  5111. ]),
  5112. _: 3
  5113. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  5114. ], 16);
  5115. };
  5116. }
  5117. });
  5118. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["__file", "content.vue"]]);
  5119. const ElPopper = withInstall(Popper);
  5120. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  5121. const useTooltipContentProps = buildProps({
  5122. ...useDelayedToggleProps,
  5123. ...popperContentProps,
  5124. appendTo: {
  5125. type: definePropType([String, Object])
  5126. },
  5127. content: {
  5128. type: String,
  5129. default: ""
  5130. },
  5131. rawContent: {
  5132. type: Boolean,
  5133. default: false
  5134. },
  5135. persistent: Boolean,
  5136. visible: {
  5137. type: definePropType(Boolean),
  5138. default: null
  5139. },
  5140. transition: String,
  5141. teleported: {
  5142. type: Boolean,
  5143. default: true
  5144. },
  5145. disabled: Boolean,
  5146. ...useAriaProps(["ariaLabel"])
  5147. });
  5148. const useTooltipTriggerProps = buildProps({
  5149. ...popperTriggerProps,
  5150. disabled: Boolean,
  5151. trigger: {
  5152. type: definePropType([String, Array]),
  5153. default: "hover"
  5154. },
  5155. triggerKeys: {
  5156. type: definePropType(Array),
  5157. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  5158. }
  5159. });
  5160. const {
  5161. useModelToggleProps: useTooltipModelToggleProps,
  5162. useModelToggleEmits: useTooltipModelToggleEmits,
  5163. useModelToggle: useTooltipModelToggle
  5164. } = createModelToggleComposable("visible");
  5165. const useTooltipProps = buildProps({
  5166. ...popperProps,
  5167. ...useTooltipModelToggleProps,
  5168. ...useTooltipContentProps,
  5169. ...useTooltipTriggerProps,
  5170. ...popperArrowProps,
  5171. showArrow: {
  5172. type: Boolean,
  5173. default: true
  5174. }
  5175. });
  5176. const tooltipEmits = [
  5177. ...useTooltipModelToggleEmits,
  5178. "before-show",
  5179. "before-hide",
  5180. "show",
  5181. "hide",
  5182. "open",
  5183. "close"
  5184. ];
  5185. const isTriggerType = (trigger, type) => {
  5186. if (isArray$2(trigger)) {
  5187. return trigger.includes(type);
  5188. }
  5189. return trigger === type;
  5190. };
  5191. const whenTrigger = (trigger, type, handler) => {
  5192. return (e) => {
  5193. isTriggerType(vue.unref(trigger), type) && handler(e);
  5194. };
  5195. };
  5196. const __default__$a = vue.defineComponent({
  5197. name: "ElTooltipTrigger"
  5198. });
  5199. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  5200. ...__default__$a,
  5201. props: useTooltipTriggerProps,
  5202. setup(__props, { expose }) {
  5203. const props = __props;
  5204. const ns = useNamespace("tooltip");
  5205. const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  5206. const triggerRef = vue.ref(null);
  5207. const stopWhenControlledOrDisabled = () => {
  5208. if (vue.unref(controlled) || props.disabled) {
  5209. return true;
  5210. }
  5211. };
  5212. const trigger = vue.toRef(props, "trigger");
  5213. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  5214. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  5215. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  5216. if (e.button === 0) {
  5217. onToggle(e);
  5218. }
  5219. }));
  5220. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  5221. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  5222. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  5223. e.preventDefault();
  5224. onToggle(e);
  5225. }));
  5226. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  5227. const { code } = e;
  5228. if (props.triggerKeys.includes(code)) {
  5229. e.preventDefault();
  5230. onToggle(e);
  5231. }
  5232. });
  5233. expose({
  5234. triggerRef
  5235. });
  5236. return (_ctx, _cache) => {
  5237. return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), {
  5238. id: vue.unref(id),
  5239. "virtual-ref": _ctx.virtualRef,
  5240. open: vue.unref(open),
  5241. "virtual-triggering": _ctx.virtualTriggering,
  5242. class: vue.normalizeClass(vue.unref(ns).e("trigger")),
  5243. onBlur: vue.unref(onBlur),
  5244. onClick: vue.unref(onClick),
  5245. onContextmenu: vue.unref(onContextMenu),
  5246. onFocus: vue.unref(onFocus),
  5247. onMouseenter: vue.unref(onMouseenter),
  5248. onMouseleave: vue.unref(onMouseleave),
  5249. onKeydown: vue.unref(onKeydown)
  5250. }, {
  5251. default: vue.withCtx(() => [
  5252. vue.renderSlot(_ctx.$slots, "default")
  5253. ]),
  5254. _: 3
  5255. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  5256. };
  5257. }
  5258. });
  5259. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__file", "trigger.vue"]]);
  5260. const __default__$9 = vue.defineComponent({
  5261. name: "ElTooltipContent",
  5262. inheritAttrs: false
  5263. });
  5264. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  5265. ...__default__$9,
  5266. props: useTooltipContentProps,
  5267. setup(__props, { expose }) {
  5268. const props = __props;
  5269. const { selector } = usePopperContainerId();
  5270. const ns = useNamespace("tooltip");
  5271. const contentRef = vue.ref(null);
  5272. const destroyed = vue.ref(false);
  5273. const {
  5274. controlled,
  5275. id,
  5276. open,
  5277. trigger,
  5278. onClose,
  5279. onOpen,
  5280. onShow,
  5281. onHide,
  5282. onBeforeShow,
  5283. onBeforeHide
  5284. } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  5285. const transitionClass = vue.computed(() => {
  5286. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  5287. });
  5288. const persistentRef = vue.computed(() => {
  5289. return props.persistent;
  5290. });
  5291. vue.onBeforeUnmount(() => {
  5292. destroyed.value = true;
  5293. });
  5294. const shouldRender = vue.computed(() => {
  5295. return vue.unref(persistentRef) ? true : vue.unref(open);
  5296. });
  5297. const shouldShow = vue.computed(() => {
  5298. return props.disabled ? false : vue.unref(open);
  5299. });
  5300. const appendTo = vue.computed(() => {
  5301. return props.appendTo || selector.value;
  5302. });
  5303. const contentStyle = vue.computed(() => {
  5304. var _a2;
  5305. return (_a2 = props.style) != null ? _a2 : {};
  5306. });
  5307. const ariaHidden = vue.computed(() => !vue.unref(open));
  5308. const onTransitionLeave = () => {
  5309. onHide();
  5310. };
  5311. const stopWhenControlled = () => {
  5312. if (vue.unref(controlled))
  5313. return true;
  5314. };
  5315. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  5316. if (props.enterable && vue.unref(trigger) === "hover") {
  5317. onOpen();
  5318. }
  5319. });
  5320. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  5321. if (vue.unref(trigger) === "hover") {
  5322. onClose();
  5323. }
  5324. });
  5325. const onBeforeEnter = () => {
  5326. var _a2, _b;
  5327. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  5328. onBeforeShow == null ? void 0 : onBeforeShow();
  5329. };
  5330. const onBeforeLeave = () => {
  5331. onBeforeHide == null ? void 0 : onBeforeHide();
  5332. };
  5333. const onAfterShow = () => {
  5334. onShow();
  5335. stopHandle = onClickOutside(vue.computed(() => {
  5336. var _a2;
  5337. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  5338. }), () => {
  5339. if (vue.unref(controlled))
  5340. return;
  5341. const $trigger = vue.unref(trigger);
  5342. if ($trigger !== "hover") {
  5343. onClose();
  5344. }
  5345. });
  5346. };
  5347. const onBlur = () => {
  5348. if (!props.virtualTriggering) {
  5349. onClose();
  5350. }
  5351. };
  5352. let stopHandle;
  5353. vue.watch(() => vue.unref(open), (val) => {
  5354. if (!val) {
  5355. stopHandle == null ? void 0 : stopHandle();
  5356. }
  5357. }, {
  5358. flush: "post"
  5359. });
  5360. vue.watch(() => props.content, () => {
  5361. var _a2, _b;
  5362. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  5363. });
  5364. expose({
  5365. contentRef
  5366. });
  5367. return (_ctx, _cache) => {
  5368. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  5369. disabled: !_ctx.teleported,
  5370. to: vue.unref(appendTo)
  5371. }, [
  5372. vue.createVNode(vue.Transition, {
  5373. name: vue.unref(transitionClass),
  5374. onAfterLeave: onTransitionLeave,
  5375. onBeforeEnter,
  5376. onAfterEnter: onAfterShow,
  5377. onBeforeLeave
  5378. }, {
  5379. default: vue.withCtx(() => [
  5380. vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElPopperContent), vue.mergeProps({
  5381. key: 0,
  5382. id: vue.unref(id),
  5383. ref_key: "contentRef",
  5384. ref: contentRef
  5385. }, _ctx.$attrs, {
  5386. "aria-label": _ctx.ariaLabel,
  5387. "aria-hidden": vue.unref(ariaHidden),
  5388. "boundaries-padding": _ctx.boundariesPadding,
  5389. "fallback-placements": _ctx.fallbackPlacements,
  5390. "gpu-acceleration": _ctx.gpuAcceleration,
  5391. offset: _ctx.offset,
  5392. placement: _ctx.placement,
  5393. "popper-options": _ctx.popperOptions,
  5394. strategy: _ctx.strategy,
  5395. effect: _ctx.effect,
  5396. enterable: _ctx.enterable,
  5397. pure: _ctx.pure,
  5398. "popper-class": _ctx.popperClass,
  5399. "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
  5400. "reference-el": _ctx.referenceEl,
  5401. "trigger-target-el": _ctx.triggerTargetEl,
  5402. visible: vue.unref(shouldShow),
  5403. "z-index": _ctx.zIndex,
  5404. onMouseenter: vue.unref(onContentEnter),
  5405. onMouseleave: vue.unref(onContentLeave),
  5406. onBlur,
  5407. onClose: vue.unref(onClose)
  5408. }), {
  5409. default: vue.withCtx(() => [
  5410. !destroyed.value ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  5411. ]),
  5412. _: 3
  5413. }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
  5414. [vue.vShow, vue.unref(shouldShow)]
  5415. ]) : vue.createCommentVNode("v-if", true)
  5416. ]),
  5417. _: 3
  5418. }, 8, ["name"])
  5419. ], 8, ["disabled", "to"]);
  5420. };
  5421. }
  5422. });
  5423. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["__file", "content.vue"]]);
  5424. const _hoisted_1$7 = ["innerHTML"];
  5425. const _hoisted_2$6 = { key: 1 };
  5426. const __default__$8 = vue.defineComponent({
  5427. name: "ElTooltip"
  5428. });
  5429. const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
  5430. ...__default__$8,
  5431. props: useTooltipProps,
  5432. emits: tooltipEmits,
  5433. setup(__props, { expose, emit }) {
  5434. const props = __props;
  5435. usePopperContainer();
  5436. const id = useId();
  5437. const popperRef = vue.ref();
  5438. const contentRef = vue.ref();
  5439. const updatePopper = () => {
  5440. var _a2;
  5441. const popperComponent = vue.unref(popperRef);
  5442. if (popperComponent) {
  5443. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  5444. }
  5445. };
  5446. const open = vue.ref(false);
  5447. const toggleReason = vue.ref();
  5448. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  5449. indicator: open,
  5450. toggleReason
  5451. });
  5452. const { onOpen, onClose } = useDelayedToggle({
  5453. showAfter: vue.toRef(props, "showAfter"),
  5454. hideAfter: vue.toRef(props, "hideAfter"),
  5455. autoClose: vue.toRef(props, "autoClose"),
  5456. open: show,
  5457. close: hide
  5458. });
  5459. const controlled = vue.computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  5460. vue.provide(TOOLTIP_INJECTION_KEY, {
  5461. controlled,
  5462. id,
  5463. open: vue.readonly(open),
  5464. trigger: vue.toRef(props, "trigger"),
  5465. onOpen: (event) => {
  5466. onOpen(event);
  5467. },
  5468. onClose: (event) => {
  5469. onClose(event);
  5470. },
  5471. onToggle: (event) => {
  5472. if (vue.unref(open)) {
  5473. onClose(event);
  5474. } else {
  5475. onOpen(event);
  5476. }
  5477. },
  5478. onShow: () => {
  5479. emit("show", toggleReason.value);
  5480. },
  5481. onHide: () => {
  5482. emit("hide", toggleReason.value);
  5483. },
  5484. onBeforeShow: () => {
  5485. emit("before-show", toggleReason.value);
  5486. },
  5487. onBeforeHide: () => {
  5488. emit("before-hide", toggleReason.value);
  5489. },
  5490. updatePopper
  5491. });
  5492. vue.watch(() => props.disabled, (disabled) => {
  5493. if (disabled && open.value) {
  5494. open.value = false;
  5495. }
  5496. });
  5497. const isFocusInsideContent = (event) => {
  5498. var _a2, _b;
  5499. const popperContent = (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.contentRef) == null ? void 0 : _b.popperContentRef;
  5500. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  5501. return popperContent && popperContent.contains(activeElement);
  5502. };
  5503. vue.onDeactivated(() => open.value && hide());
  5504. expose({
  5505. popperRef,
  5506. contentRef,
  5507. isFocusInsideContent,
  5508. updatePopper,
  5509. onOpen,
  5510. onClose,
  5511. hide
  5512. });
  5513. return (_ctx, _cache) => {
  5514. return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), {
  5515. ref_key: "popperRef",
  5516. ref: popperRef,
  5517. role: _ctx.role
  5518. }, {
  5519. default: vue.withCtx(() => [
  5520. vue.createVNode(ElTooltipTrigger, {
  5521. disabled: _ctx.disabled,
  5522. trigger: _ctx.trigger,
  5523. "trigger-keys": _ctx.triggerKeys,
  5524. "virtual-ref": _ctx.virtualRef,
  5525. "virtual-triggering": _ctx.virtualTriggering
  5526. }, {
  5527. default: vue.withCtx(() => [
  5528. _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  5529. ]),
  5530. _: 3
  5531. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  5532. vue.createVNode(ElTooltipContent, {
  5533. ref_key: "contentRef",
  5534. ref: contentRef,
  5535. "aria-label": _ctx.ariaLabel,
  5536. "boundaries-padding": _ctx.boundariesPadding,
  5537. content: _ctx.content,
  5538. disabled: _ctx.disabled,
  5539. effect: _ctx.effect,
  5540. enterable: _ctx.enterable,
  5541. "fallback-placements": _ctx.fallbackPlacements,
  5542. "hide-after": _ctx.hideAfter,
  5543. "gpu-acceleration": _ctx.gpuAcceleration,
  5544. offset: _ctx.offset,
  5545. persistent: _ctx.persistent,
  5546. "popper-class": _ctx.popperClass,
  5547. "popper-style": _ctx.popperStyle,
  5548. placement: _ctx.placement,
  5549. "popper-options": _ctx.popperOptions,
  5550. pure: _ctx.pure,
  5551. "raw-content": _ctx.rawContent,
  5552. "reference-el": _ctx.referenceEl,
  5553. "trigger-target-el": _ctx.triggerTargetEl,
  5554. "show-after": _ctx.showAfter,
  5555. strategy: _ctx.strategy,
  5556. teleported: _ctx.teleported,
  5557. transition: _ctx.transition,
  5558. "virtual-triggering": _ctx.virtualTriggering,
  5559. "z-index": _ctx.zIndex,
  5560. "append-to": _ctx.appendTo
  5561. }, {
  5562. default: vue.withCtx(() => [
  5563. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  5564. _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", {
  5565. key: 0,
  5566. innerHTML: _ctx.content
  5567. }, null, 8, _hoisted_1$7)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$6, vue.toDisplayString(_ctx.content), 1))
  5568. ]),
  5569. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), {
  5570. key: 0,
  5571. "arrow-offset": _ctx.arrowOffset
  5572. }, null, 8, ["arrow-offset"])) : vue.createCommentVNode("v-if", true)
  5573. ]),
  5574. _: 3
  5575. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
  5576. ]),
  5577. _: 3
  5578. }, 8, ["role"]);
  5579. };
  5580. }
  5581. });
  5582. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["__file", "tooltip.vue"]]);
  5583. const ElTooltip = withInstall(Tooltip);
  5584. const badgeProps = buildProps({
  5585. value: {
  5586. type: [String, Number],
  5587. default: ""
  5588. },
  5589. max: {
  5590. type: Number,
  5591. default: 99
  5592. },
  5593. isDot: Boolean,
  5594. hidden: Boolean,
  5595. type: {
  5596. type: String,
  5597. values: ["primary", "success", "warning", "info", "danger"],
  5598. default: "danger"
  5599. },
  5600. showZero: {
  5601. type: Boolean,
  5602. default: true
  5603. },
  5604. color: String,
  5605. dotStyle: {
  5606. type: definePropType([String, Object, Array])
  5607. },
  5608. badgeStyle: {
  5609. type: definePropType([String, Object, Array])
  5610. },
  5611. offset: {
  5612. type: definePropType(Array),
  5613. default: [0, 0]
  5614. },
  5615. dotClass: {
  5616. type: String
  5617. },
  5618. badgeClass: {
  5619. type: String
  5620. }
  5621. });
  5622. const _hoisted_1$6 = ["textContent"];
  5623. const __default__$7 = vue.defineComponent({
  5624. name: "ElBadge"
  5625. });
  5626. const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
  5627. ...__default__$7,
  5628. props: badgeProps,
  5629. setup(__props, { expose }) {
  5630. const props = __props;
  5631. const ns = useNamespace("badge");
  5632. const content = vue.computed(() => {
  5633. if (props.isDot)
  5634. return "";
  5635. if (isNumber(props.value) && isNumber(props.max)) {
  5636. if (props.max < props.value) {
  5637. return `${props.max}+`;
  5638. }
  5639. return props.value === 0 && !props.showZero ? "" : `${props.value}`;
  5640. }
  5641. return `${props.value}`;
  5642. });
  5643. const style2 = vue.computed(() => {
  5644. var _a2, _b, _c, _d, _e, _f;
  5645. return [
  5646. {
  5647. backgroundColor: props.color,
  5648. marginRight: addUnit(-((_b = (_a2 = props.offset) == null ? void 0 : _a2[0]) != null ? _b : 0)),
  5649. marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
  5650. },
  5651. (_e = props.dotStyle) != null ? _e : {},
  5652. (_f = props.badgeStyle) != null ? _f : {}
  5653. ];
  5654. });
  5655. useDeprecated({
  5656. from: "dot-style",
  5657. replacement: "badge-style",
  5658. version: "2.8.0",
  5659. scope: "el-badge",
  5660. ref: "https://element-plus.org/en-US/component/badge.html"
  5661. }, vue.computed(() => !!props.dotStyle));
  5662. useDeprecated({
  5663. from: "dot-class",
  5664. replacement: "badge-class",
  5665. version: "2.8.0",
  5666. scope: "el-badge",
  5667. ref: "https://element-plus.org/en-US/component/badge.html"
  5668. }, vue.computed(() => !!props.dotClass));
  5669. expose({
  5670. content
  5671. });
  5672. return (_ctx, _cache) => {
  5673. return vue.openBlock(), vue.createElementBlock("div", {
  5674. class: vue.normalizeClass(vue.unref(ns).b())
  5675. }, [
  5676. vue.renderSlot(_ctx.$slots, "default"),
  5677. vue.createVNode(vue.Transition, {
  5678. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  5679. persisted: ""
  5680. }, {
  5681. default: vue.withCtx(() => [
  5682. vue.withDirectives(vue.createElementVNode("sup", {
  5683. class: vue.normalizeClass([
  5684. vue.unref(ns).e("content"),
  5685. vue.unref(ns).em("content", _ctx.type),
  5686. vue.unref(ns).is("fixed", !!_ctx.$slots.default),
  5687. vue.unref(ns).is("dot", _ctx.isDot),
  5688. _ctx.dotClass,
  5689. _ctx.badgeClass
  5690. ]),
  5691. style: vue.normalizeStyle(vue.unref(style2)),
  5692. textContent: vue.toDisplayString(vue.unref(content))
  5693. }, null, 14, _hoisted_1$6), [
  5694. [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot)]
  5695. ])
  5696. ]),
  5697. _: 1
  5698. }, 8, ["name"])
  5699. ], 2);
  5700. };
  5701. }
  5702. });
  5703. var Badge = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "badge.vue"]]);
  5704. const ElBadge = withInstall(Badge);
  5705. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  5706. const useButton = (props, emit) => {
  5707. useDeprecated({
  5708. from: "type.text",
  5709. replacement: "link",
  5710. version: "3.0.0",
  5711. scope: "props",
  5712. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  5713. }, vue.computed(() => props.type === "text"));
  5714. const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0);
  5715. const globalConfig2 = useGlobalConfig("button");
  5716. const { form } = useFormItem();
  5717. const _size = useFormSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  5718. const _disabled = useFormDisabled();
  5719. const _ref = vue.ref();
  5720. const slots = vue.useSlots();
  5721. const _type = vue.computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  5722. const autoInsertSpace = vue.computed(() => {
  5723. var _a2, _b, _c;
  5724. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  5725. });
  5726. const _props = vue.computed(() => {
  5727. if (props.tag === "button") {
  5728. return {
  5729. ariaDisabled: _disabled.value || props.loading,
  5730. disabled: _disabled.value || props.loading,
  5731. autofocus: props.autofocus,
  5732. type: props.nativeType
  5733. };
  5734. }
  5735. return {};
  5736. });
  5737. const shouldAddSpace = vue.computed(() => {
  5738. var _a2;
  5739. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  5740. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  5741. const slot = defaultSlot[0];
  5742. if ((slot == null ? void 0 : slot.type) === vue.Text) {
  5743. const text = slot.children;
  5744. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  5745. }
  5746. }
  5747. return false;
  5748. });
  5749. const handleClick = (evt) => {
  5750. if (props.nativeType === "reset") {
  5751. form == null ? void 0 : form.resetFields();
  5752. }
  5753. emit("click", evt);
  5754. };
  5755. return {
  5756. _disabled,
  5757. _size,
  5758. _type,
  5759. _ref,
  5760. _props,
  5761. shouldAddSpace,
  5762. handleClick
  5763. };
  5764. };
  5765. const buttonTypes = [
  5766. "default",
  5767. "primary",
  5768. "success",
  5769. "warning",
  5770. "info",
  5771. "danger",
  5772. "text",
  5773. ""
  5774. ];
  5775. const buttonNativeTypes = ["button", "submit", "reset"];
  5776. const buttonProps = buildProps({
  5777. size: useSizeProp,
  5778. disabled: Boolean,
  5779. type: {
  5780. type: String,
  5781. values: buttonTypes,
  5782. default: ""
  5783. },
  5784. icon: {
  5785. type: iconPropType
  5786. },
  5787. nativeType: {
  5788. type: String,
  5789. values: buttonNativeTypes,
  5790. default: "button"
  5791. },
  5792. loading: Boolean,
  5793. loadingIcon: {
  5794. type: iconPropType,
  5795. default: () => loading_default
  5796. },
  5797. plain: Boolean,
  5798. text: Boolean,
  5799. link: Boolean,
  5800. bg: Boolean,
  5801. autofocus: Boolean,
  5802. round: Boolean,
  5803. circle: Boolean,
  5804. color: String,
  5805. dark: Boolean,
  5806. autoInsertSpace: {
  5807. type: Boolean,
  5808. default: void 0
  5809. },
  5810. tag: {
  5811. type: definePropType([String, Object]),
  5812. default: "button"
  5813. }
  5814. });
  5815. const buttonEmits = {
  5816. click: (evt) => evt instanceof MouseEvent
  5817. };
  5818. function bound01(n, max) {
  5819. if (isOnePointZero(n)) {
  5820. n = "100%";
  5821. }
  5822. var isPercent = isPercentage(n);
  5823. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  5824. if (isPercent) {
  5825. n = parseInt(String(n * max), 10) / 100;
  5826. }
  5827. if (Math.abs(n - max) < 1e-6) {
  5828. return 1;
  5829. }
  5830. if (max === 360) {
  5831. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  5832. } else {
  5833. n = n % max / parseFloat(String(max));
  5834. }
  5835. return n;
  5836. }
  5837. function clamp01(val) {
  5838. return Math.min(1, Math.max(0, val));
  5839. }
  5840. function isOnePointZero(n) {
  5841. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  5842. }
  5843. function isPercentage(n) {
  5844. return typeof n === "string" && n.indexOf("%") !== -1;
  5845. }
  5846. function boundAlpha(a2) {
  5847. a2 = parseFloat(a2);
  5848. if (isNaN(a2) || a2 < 0 || a2 > 1) {
  5849. a2 = 1;
  5850. }
  5851. return a2;
  5852. }
  5853. function convertToPercentage(n) {
  5854. if (n <= 1) {
  5855. return "".concat(Number(n) * 100, "%");
  5856. }
  5857. return n;
  5858. }
  5859. function pad2(c2) {
  5860. return c2.length === 1 ? "0" + c2 : String(c2);
  5861. }
  5862. function rgbToRgb(r, g, b2) {
  5863. return {
  5864. r: bound01(r, 255) * 255,
  5865. g: bound01(g, 255) * 255,
  5866. b: bound01(b2, 255) * 255
  5867. };
  5868. }
  5869. function rgbToHsl(r, g, b2) {
  5870. r = bound01(r, 255);
  5871. g = bound01(g, 255);
  5872. b2 = bound01(b2, 255);
  5873. var max = Math.max(r, g, b2);
  5874. var min = Math.min(r, g, b2);
  5875. var h2 = 0;
  5876. var s2 = 0;
  5877. var l2 = (max + min) / 2;
  5878. if (max === min) {
  5879. s2 = 0;
  5880. h2 = 0;
  5881. } else {
  5882. var d2 = max - min;
  5883. s2 = l2 > 0.5 ? d2 / (2 - max - min) : d2 / (max + min);
  5884. switch (max) {
  5885. case r:
  5886. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  5887. break;
  5888. case g:
  5889. h2 = (b2 - r) / d2 + 2;
  5890. break;
  5891. case b2:
  5892. h2 = (r - g) / d2 + 4;
  5893. break;
  5894. }
  5895. h2 /= 6;
  5896. }
  5897. return { h: h2, s: s2, l: l2 };
  5898. }
  5899. function hue2rgb(p2, q2, t) {
  5900. if (t < 0) {
  5901. t += 1;
  5902. }
  5903. if (t > 1) {
  5904. t -= 1;
  5905. }
  5906. if (t < 1 / 6) {
  5907. return p2 + (q2 - p2) * (6 * t);
  5908. }
  5909. if (t < 1 / 2) {
  5910. return q2;
  5911. }
  5912. if (t < 2 / 3) {
  5913. return p2 + (q2 - p2) * (2 / 3 - t) * 6;
  5914. }
  5915. return p2;
  5916. }
  5917. function hslToRgb(h2, s2, l2) {
  5918. var r;
  5919. var g;
  5920. var b2;
  5921. h2 = bound01(h2, 360);
  5922. s2 = bound01(s2, 100);
  5923. l2 = bound01(l2, 100);
  5924. if (s2 === 0) {
  5925. g = l2;
  5926. b2 = l2;
  5927. r = l2;
  5928. } else {
  5929. var q2 = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
  5930. var p2 = 2 * l2 - q2;
  5931. r = hue2rgb(p2, q2, h2 + 1 / 3);
  5932. g = hue2rgb(p2, q2, h2);
  5933. b2 = hue2rgb(p2, q2, h2 - 1 / 3);
  5934. }
  5935. return { r: r * 255, g: g * 255, b: b2 * 255 };
  5936. }
  5937. function rgbToHsv(r, g, b2) {
  5938. r = bound01(r, 255);
  5939. g = bound01(g, 255);
  5940. b2 = bound01(b2, 255);
  5941. var max = Math.max(r, g, b2);
  5942. var min = Math.min(r, g, b2);
  5943. var h2 = 0;
  5944. var v2 = max;
  5945. var d2 = max - min;
  5946. var s2 = max === 0 ? 0 : d2 / max;
  5947. if (max === min) {
  5948. h2 = 0;
  5949. } else {
  5950. switch (max) {
  5951. case r:
  5952. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  5953. break;
  5954. case g:
  5955. h2 = (b2 - r) / d2 + 2;
  5956. break;
  5957. case b2:
  5958. h2 = (r - g) / d2 + 4;
  5959. break;
  5960. }
  5961. h2 /= 6;
  5962. }
  5963. return { h: h2, s: s2, v: v2 };
  5964. }
  5965. function hsvToRgb(h2, s2, v2) {
  5966. h2 = bound01(h2, 360) * 6;
  5967. s2 = bound01(s2, 100);
  5968. v2 = bound01(v2, 100);
  5969. var i = Math.floor(h2);
  5970. var f2 = h2 - i;
  5971. var p2 = v2 * (1 - s2);
  5972. var q2 = v2 * (1 - f2 * s2);
  5973. var t = v2 * (1 - (1 - f2) * s2);
  5974. var mod = i % 6;
  5975. var r = [v2, q2, p2, p2, t, v2][mod];
  5976. var g = [t, v2, v2, q2, p2, p2][mod];
  5977. var b2 = [p2, p2, t, v2, v2, q2][mod];
  5978. return { r: r * 255, g: g * 255, b: b2 * 255 };
  5979. }
  5980. function rgbToHex(r, g, b2, allow3Char) {
  5981. var hex = [
  5982. pad2(Math.round(r).toString(16)),
  5983. pad2(Math.round(g).toString(16)),
  5984. pad2(Math.round(b2).toString(16))
  5985. ];
  5986. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  5987. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  5988. }
  5989. return hex.join("");
  5990. }
  5991. function rgbaToHex(r, g, b2, a2, allow4Char) {
  5992. var hex = [
  5993. pad2(Math.round(r).toString(16)),
  5994. pad2(Math.round(g).toString(16)),
  5995. pad2(Math.round(b2).toString(16)),
  5996. pad2(convertDecimalToHex(a2))
  5997. ];
  5998. if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
  5999. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  6000. }
  6001. return hex.join("");
  6002. }
  6003. function convertDecimalToHex(d2) {
  6004. return Math.round(parseFloat(d2) * 255).toString(16);
  6005. }
  6006. function convertHexToDecimal(h2) {
  6007. return parseIntFromHex(h2) / 255;
  6008. }
  6009. function parseIntFromHex(val) {
  6010. return parseInt(val, 16);
  6011. }
  6012. function numberInputToObject(color) {
  6013. return {
  6014. r: color >> 16,
  6015. g: (color & 65280) >> 8,
  6016. b: color & 255
  6017. };
  6018. }
  6019. var names = {
  6020. aliceblue: "#f0f8ff",
  6021. antiquewhite: "#faebd7",
  6022. aqua: "#00ffff",
  6023. aquamarine: "#7fffd4",
  6024. azure: "#f0ffff",
  6025. beige: "#f5f5dc",
  6026. bisque: "#ffe4c4",
  6027. black: "#000000",
  6028. blanchedalmond: "#ffebcd",
  6029. blue: "#0000ff",
  6030. blueviolet: "#8a2be2",
  6031. brown: "#a52a2a",
  6032. burlywood: "#deb887",
  6033. cadetblue: "#5f9ea0",
  6034. chartreuse: "#7fff00",
  6035. chocolate: "#d2691e",
  6036. coral: "#ff7f50",
  6037. cornflowerblue: "#6495ed",
  6038. cornsilk: "#fff8dc",
  6039. crimson: "#dc143c",
  6040. cyan: "#00ffff",
  6041. darkblue: "#00008b",
  6042. darkcyan: "#008b8b",
  6043. darkgoldenrod: "#b8860b",
  6044. darkgray: "#a9a9a9",
  6045. darkgreen: "#006400",
  6046. darkgrey: "#a9a9a9",
  6047. darkkhaki: "#bdb76b",
  6048. darkmagenta: "#8b008b",
  6049. darkolivegreen: "#556b2f",
  6050. darkorange: "#ff8c00",
  6051. darkorchid: "#9932cc",
  6052. darkred: "#8b0000",
  6053. darksalmon: "#e9967a",
  6054. darkseagreen: "#8fbc8f",
  6055. darkslateblue: "#483d8b",
  6056. darkslategray: "#2f4f4f",
  6057. darkslategrey: "#2f4f4f",
  6058. darkturquoise: "#00ced1",
  6059. darkviolet: "#9400d3",
  6060. deeppink: "#ff1493",
  6061. deepskyblue: "#00bfff",
  6062. dimgray: "#696969",
  6063. dimgrey: "#696969",
  6064. dodgerblue: "#1e90ff",
  6065. firebrick: "#b22222",
  6066. floralwhite: "#fffaf0",
  6067. forestgreen: "#228b22",
  6068. fuchsia: "#ff00ff",
  6069. gainsboro: "#dcdcdc",
  6070. ghostwhite: "#f8f8ff",
  6071. goldenrod: "#daa520",
  6072. gold: "#ffd700",
  6073. gray: "#808080",
  6074. green: "#008000",
  6075. greenyellow: "#adff2f",
  6076. grey: "#808080",
  6077. honeydew: "#f0fff0",
  6078. hotpink: "#ff69b4",
  6079. indianred: "#cd5c5c",
  6080. indigo: "#4b0082",
  6081. ivory: "#fffff0",
  6082. khaki: "#f0e68c",
  6083. lavenderblush: "#fff0f5",
  6084. lavender: "#e6e6fa",
  6085. lawngreen: "#7cfc00",
  6086. lemonchiffon: "#fffacd",
  6087. lightblue: "#add8e6",
  6088. lightcoral: "#f08080",
  6089. lightcyan: "#e0ffff",
  6090. lightgoldenrodyellow: "#fafad2",
  6091. lightgray: "#d3d3d3",
  6092. lightgreen: "#90ee90",
  6093. lightgrey: "#d3d3d3",
  6094. lightpink: "#ffb6c1",
  6095. lightsalmon: "#ffa07a",
  6096. lightseagreen: "#20b2aa",
  6097. lightskyblue: "#87cefa",
  6098. lightslategray: "#778899",
  6099. lightslategrey: "#778899",
  6100. lightsteelblue: "#b0c4de",
  6101. lightyellow: "#ffffe0",
  6102. lime: "#00ff00",
  6103. limegreen: "#32cd32",
  6104. linen: "#faf0e6",
  6105. magenta: "#ff00ff",
  6106. maroon: "#800000",
  6107. mediumaquamarine: "#66cdaa",
  6108. mediumblue: "#0000cd",
  6109. mediumorchid: "#ba55d3",
  6110. mediumpurple: "#9370db",
  6111. mediumseagreen: "#3cb371",
  6112. mediumslateblue: "#7b68ee",
  6113. mediumspringgreen: "#00fa9a",
  6114. mediumturquoise: "#48d1cc",
  6115. mediumvioletred: "#c71585",
  6116. midnightblue: "#191970",
  6117. mintcream: "#f5fffa",
  6118. mistyrose: "#ffe4e1",
  6119. moccasin: "#ffe4b5",
  6120. navajowhite: "#ffdead",
  6121. navy: "#000080",
  6122. oldlace: "#fdf5e6",
  6123. olive: "#808000",
  6124. olivedrab: "#6b8e23",
  6125. orange: "#ffa500",
  6126. orangered: "#ff4500",
  6127. orchid: "#da70d6",
  6128. palegoldenrod: "#eee8aa",
  6129. palegreen: "#98fb98",
  6130. paleturquoise: "#afeeee",
  6131. palevioletred: "#db7093",
  6132. papayawhip: "#ffefd5",
  6133. peachpuff: "#ffdab9",
  6134. peru: "#cd853f",
  6135. pink: "#ffc0cb",
  6136. plum: "#dda0dd",
  6137. powderblue: "#b0e0e6",
  6138. purple: "#800080",
  6139. rebeccapurple: "#663399",
  6140. red: "#ff0000",
  6141. rosybrown: "#bc8f8f",
  6142. royalblue: "#4169e1",
  6143. saddlebrown: "#8b4513",
  6144. salmon: "#fa8072",
  6145. sandybrown: "#f4a460",
  6146. seagreen: "#2e8b57",
  6147. seashell: "#fff5ee",
  6148. sienna: "#a0522d",
  6149. silver: "#c0c0c0",
  6150. skyblue: "#87ceeb",
  6151. slateblue: "#6a5acd",
  6152. slategray: "#708090",
  6153. slategrey: "#708090",
  6154. snow: "#fffafa",
  6155. springgreen: "#00ff7f",
  6156. steelblue: "#4682b4",
  6157. tan: "#d2b48c",
  6158. teal: "#008080",
  6159. thistle: "#d8bfd8",
  6160. tomato: "#ff6347",
  6161. turquoise: "#40e0d0",
  6162. violet: "#ee82ee",
  6163. wheat: "#f5deb3",
  6164. white: "#ffffff",
  6165. whitesmoke: "#f5f5f5",
  6166. yellow: "#ffff00",
  6167. yellowgreen: "#9acd32"
  6168. };
  6169. function inputToRGB(color) {
  6170. var rgb = { r: 0, g: 0, b: 0 };
  6171. var a2 = 1;
  6172. var s2 = null;
  6173. var v2 = null;
  6174. var l2 = null;
  6175. var ok = false;
  6176. var format = false;
  6177. if (typeof color === "string") {
  6178. color = stringInputToObject(color);
  6179. }
  6180. if (typeof color === "object") {
  6181. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  6182. rgb = rgbToRgb(color.r, color.g, color.b);
  6183. ok = true;
  6184. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  6185. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  6186. s2 = convertToPercentage(color.s);
  6187. v2 = convertToPercentage(color.v);
  6188. rgb = hsvToRgb(color.h, s2, v2);
  6189. ok = true;
  6190. format = "hsv";
  6191. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  6192. s2 = convertToPercentage(color.s);
  6193. l2 = convertToPercentage(color.l);
  6194. rgb = hslToRgb(color.h, s2, l2);
  6195. ok = true;
  6196. format = "hsl";
  6197. }
  6198. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  6199. a2 = color.a;
  6200. }
  6201. }
  6202. a2 = boundAlpha(a2);
  6203. return {
  6204. ok,
  6205. format: color.format || format,
  6206. r: Math.min(255, Math.max(rgb.r, 0)),
  6207. g: Math.min(255, Math.max(rgb.g, 0)),
  6208. b: Math.min(255, Math.max(rgb.b, 0)),
  6209. a: a2
  6210. };
  6211. }
  6212. var CSS_INTEGER = "[-\\+]?\\d+%?";
  6213. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  6214. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  6215. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  6216. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  6217. var matchers = {
  6218. CSS_UNIT: new RegExp(CSS_UNIT),
  6219. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  6220. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  6221. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  6222. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  6223. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  6224. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  6225. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  6226. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  6227. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  6228. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  6229. };
  6230. function stringInputToObject(color) {
  6231. color = color.trim().toLowerCase();
  6232. if (color.length === 0) {
  6233. return false;
  6234. }
  6235. var named = false;
  6236. if (names[color]) {
  6237. color = names[color];
  6238. named = true;
  6239. } else if (color === "transparent") {
  6240. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  6241. }
  6242. var match = matchers.rgb.exec(color);
  6243. if (match) {
  6244. return { r: match[1], g: match[2], b: match[3] };
  6245. }
  6246. match = matchers.rgba.exec(color);
  6247. if (match) {
  6248. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  6249. }
  6250. match = matchers.hsl.exec(color);
  6251. if (match) {
  6252. return { h: match[1], s: match[2], l: match[3] };
  6253. }
  6254. match = matchers.hsla.exec(color);
  6255. if (match) {
  6256. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  6257. }
  6258. match = matchers.hsv.exec(color);
  6259. if (match) {
  6260. return { h: match[1], s: match[2], v: match[3] };
  6261. }
  6262. match = matchers.hsva.exec(color);
  6263. if (match) {
  6264. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  6265. }
  6266. match = matchers.hex8.exec(color);
  6267. if (match) {
  6268. return {
  6269. r: parseIntFromHex(match[1]),
  6270. g: parseIntFromHex(match[2]),
  6271. b: parseIntFromHex(match[3]),
  6272. a: convertHexToDecimal(match[4]),
  6273. format: named ? "name" : "hex8"
  6274. };
  6275. }
  6276. match = matchers.hex6.exec(color);
  6277. if (match) {
  6278. return {
  6279. r: parseIntFromHex(match[1]),
  6280. g: parseIntFromHex(match[2]),
  6281. b: parseIntFromHex(match[3]),
  6282. format: named ? "name" : "hex"
  6283. };
  6284. }
  6285. match = matchers.hex4.exec(color);
  6286. if (match) {
  6287. return {
  6288. r: parseIntFromHex(match[1] + match[1]),
  6289. g: parseIntFromHex(match[2] + match[2]),
  6290. b: parseIntFromHex(match[3] + match[3]),
  6291. a: convertHexToDecimal(match[4] + match[4]),
  6292. format: named ? "name" : "hex8"
  6293. };
  6294. }
  6295. match = matchers.hex3.exec(color);
  6296. if (match) {
  6297. return {
  6298. r: parseIntFromHex(match[1] + match[1]),
  6299. g: parseIntFromHex(match[2] + match[2]),
  6300. b: parseIntFromHex(match[3] + match[3]),
  6301. format: named ? "name" : "hex"
  6302. };
  6303. }
  6304. return false;
  6305. }
  6306. function isValidCSSUnit(color) {
  6307. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  6308. }
  6309. var TinyColor = function() {
  6310. function TinyColor2(color, opts) {
  6311. if (color === void 0) {
  6312. color = "";
  6313. }
  6314. if (opts === void 0) {
  6315. opts = {};
  6316. }
  6317. var _a2;
  6318. if (color instanceof TinyColor2) {
  6319. return color;
  6320. }
  6321. if (typeof color === "number") {
  6322. color = numberInputToObject(color);
  6323. }
  6324. this.originalInput = color;
  6325. var rgb = inputToRGB(color);
  6326. this.originalInput = color;
  6327. this.r = rgb.r;
  6328. this.g = rgb.g;
  6329. this.b = rgb.b;
  6330. this.a = rgb.a;
  6331. this.roundA = Math.round(100 * this.a) / 100;
  6332. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  6333. this.gradientType = opts.gradientType;
  6334. if (this.r < 1) {
  6335. this.r = Math.round(this.r);
  6336. }
  6337. if (this.g < 1) {
  6338. this.g = Math.round(this.g);
  6339. }
  6340. if (this.b < 1) {
  6341. this.b = Math.round(this.b);
  6342. }
  6343. this.isValid = rgb.ok;
  6344. }
  6345. TinyColor2.prototype.isDark = function() {
  6346. return this.getBrightness() < 128;
  6347. };
  6348. TinyColor2.prototype.isLight = function() {
  6349. return !this.isDark();
  6350. };
  6351. TinyColor2.prototype.getBrightness = function() {
  6352. var rgb = this.toRgb();
  6353. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  6354. };
  6355. TinyColor2.prototype.getLuminance = function() {
  6356. var rgb = this.toRgb();
  6357. var R2;
  6358. var G2;
  6359. var B2;
  6360. var RsRGB = rgb.r / 255;
  6361. var GsRGB = rgb.g / 255;
  6362. var BsRGB = rgb.b / 255;
  6363. if (RsRGB <= 0.03928) {
  6364. R2 = RsRGB / 12.92;
  6365. } else {
  6366. R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  6367. }
  6368. if (GsRGB <= 0.03928) {
  6369. G2 = GsRGB / 12.92;
  6370. } else {
  6371. G2 = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  6372. }
  6373. if (BsRGB <= 0.03928) {
  6374. B2 = BsRGB / 12.92;
  6375. } else {
  6376. B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  6377. }
  6378. return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
  6379. };
  6380. TinyColor2.prototype.getAlpha = function() {
  6381. return this.a;
  6382. };
  6383. TinyColor2.prototype.setAlpha = function(alpha) {
  6384. this.a = boundAlpha(alpha);
  6385. this.roundA = Math.round(100 * this.a) / 100;
  6386. return this;
  6387. };
  6388. TinyColor2.prototype.isMonochrome = function() {
  6389. var s2 = this.toHsl().s;
  6390. return s2 === 0;
  6391. };
  6392. TinyColor2.prototype.toHsv = function() {
  6393. var hsv = rgbToHsv(this.r, this.g, this.b);
  6394. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  6395. };
  6396. TinyColor2.prototype.toHsvString = function() {
  6397. var hsv = rgbToHsv(this.r, this.g, this.b);
  6398. var h2 = Math.round(hsv.h * 360);
  6399. var s2 = Math.round(hsv.s * 100);
  6400. var v2 = Math.round(hsv.v * 100);
  6401. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
  6402. };
  6403. TinyColor2.prototype.toHsl = function() {
  6404. var hsl = rgbToHsl(this.r, this.g, this.b);
  6405. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  6406. };
  6407. TinyColor2.prototype.toHslString = function() {
  6408. var hsl = rgbToHsl(this.r, this.g, this.b);
  6409. var h2 = Math.round(hsl.h * 360);
  6410. var s2 = Math.round(hsl.s * 100);
  6411. var l2 = Math.round(hsl.l * 100);
  6412. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
  6413. };
  6414. TinyColor2.prototype.toHex = function(allow3Char) {
  6415. if (allow3Char === void 0) {
  6416. allow3Char = false;
  6417. }
  6418. return rgbToHex(this.r, this.g, this.b, allow3Char);
  6419. };
  6420. TinyColor2.prototype.toHexString = function(allow3Char) {
  6421. if (allow3Char === void 0) {
  6422. allow3Char = false;
  6423. }
  6424. return "#" + this.toHex(allow3Char);
  6425. };
  6426. TinyColor2.prototype.toHex8 = function(allow4Char) {
  6427. if (allow4Char === void 0) {
  6428. allow4Char = false;
  6429. }
  6430. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  6431. };
  6432. TinyColor2.prototype.toHex8String = function(allow4Char) {
  6433. if (allow4Char === void 0) {
  6434. allow4Char = false;
  6435. }
  6436. return "#" + this.toHex8(allow4Char);
  6437. };
  6438. TinyColor2.prototype.toHexShortString = function(allowShortChar) {
  6439. if (allowShortChar === void 0) {
  6440. allowShortChar = false;
  6441. }
  6442. return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
  6443. };
  6444. TinyColor2.prototype.toRgb = function() {
  6445. return {
  6446. r: Math.round(this.r),
  6447. g: Math.round(this.g),
  6448. b: Math.round(this.b),
  6449. a: this.a
  6450. };
  6451. };
  6452. TinyColor2.prototype.toRgbString = function() {
  6453. var r = Math.round(this.r);
  6454. var g = Math.round(this.g);
  6455. var b2 = Math.round(this.b);
  6456. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b2, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b2, ", ").concat(this.roundA, ")");
  6457. };
  6458. TinyColor2.prototype.toPercentageRgb = function() {
  6459. var fmt = function(x2) {
  6460. return "".concat(Math.round(bound01(x2, 255) * 100), "%");
  6461. };
  6462. return {
  6463. r: fmt(this.r),
  6464. g: fmt(this.g),
  6465. b: fmt(this.b),
  6466. a: this.a
  6467. };
  6468. };
  6469. TinyColor2.prototype.toPercentageRgbString = function() {
  6470. var rnd = function(x2) {
  6471. return Math.round(bound01(x2, 255) * 100);
  6472. };
  6473. return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
  6474. };
  6475. TinyColor2.prototype.toName = function() {
  6476. if (this.a === 0) {
  6477. return "transparent";
  6478. }
  6479. if (this.a < 1) {
  6480. return false;
  6481. }
  6482. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  6483. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  6484. var _b = _a2[_i], key = _b[0], value = _b[1];
  6485. if (hex === value) {
  6486. return key;
  6487. }
  6488. }
  6489. return false;
  6490. };
  6491. TinyColor2.prototype.toString = function(format) {
  6492. var formatSet = Boolean(format);
  6493. format = format !== null && format !== void 0 ? format : this.format;
  6494. var formattedString = false;
  6495. var hasAlpha = this.a < 1 && this.a >= 0;
  6496. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  6497. if (needsAlphaFormat) {
  6498. if (format === "name" && this.a === 0) {
  6499. return this.toName();
  6500. }
  6501. return this.toRgbString();
  6502. }
  6503. if (format === "rgb") {
  6504. formattedString = this.toRgbString();
  6505. }
  6506. if (format === "prgb") {
  6507. formattedString = this.toPercentageRgbString();
  6508. }
  6509. if (format === "hex" || format === "hex6") {
  6510. formattedString = this.toHexString();
  6511. }
  6512. if (format === "hex3") {
  6513. formattedString = this.toHexString(true);
  6514. }
  6515. if (format === "hex4") {
  6516. formattedString = this.toHex8String(true);
  6517. }
  6518. if (format === "hex8") {
  6519. formattedString = this.toHex8String();
  6520. }
  6521. if (format === "name") {
  6522. formattedString = this.toName();
  6523. }
  6524. if (format === "hsl") {
  6525. formattedString = this.toHslString();
  6526. }
  6527. if (format === "hsv") {
  6528. formattedString = this.toHsvString();
  6529. }
  6530. return formattedString || this.toHexString();
  6531. };
  6532. TinyColor2.prototype.toNumber = function() {
  6533. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  6534. };
  6535. TinyColor2.prototype.clone = function() {
  6536. return new TinyColor2(this.toString());
  6537. };
  6538. TinyColor2.prototype.lighten = function(amount) {
  6539. if (amount === void 0) {
  6540. amount = 10;
  6541. }
  6542. var hsl = this.toHsl();
  6543. hsl.l += amount / 100;
  6544. hsl.l = clamp01(hsl.l);
  6545. return new TinyColor2(hsl);
  6546. };
  6547. TinyColor2.prototype.brighten = function(amount) {
  6548. if (amount === void 0) {
  6549. amount = 10;
  6550. }
  6551. var rgb = this.toRgb();
  6552. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  6553. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  6554. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  6555. return new TinyColor2(rgb);
  6556. };
  6557. TinyColor2.prototype.darken = function(amount) {
  6558. if (amount === void 0) {
  6559. amount = 10;
  6560. }
  6561. var hsl = this.toHsl();
  6562. hsl.l -= amount / 100;
  6563. hsl.l = clamp01(hsl.l);
  6564. return new TinyColor2(hsl);
  6565. };
  6566. TinyColor2.prototype.tint = function(amount) {
  6567. if (amount === void 0) {
  6568. amount = 10;
  6569. }
  6570. return this.mix("white", amount);
  6571. };
  6572. TinyColor2.prototype.shade = function(amount) {
  6573. if (amount === void 0) {
  6574. amount = 10;
  6575. }
  6576. return this.mix("black", amount);
  6577. };
  6578. TinyColor2.prototype.desaturate = function(amount) {
  6579. if (amount === void 0) {
  6580. amount = 10;
  6581. }
  6582. var hsl = this.toHsl();
  6583. hsl.s -= amount / 100;
  6584. hsl.s = clamp01(hsl.s);
  6585. return new TinyColor2(hsl);
  6586. };
  6587. TinyColor2.prototype.saturate = function(amount) {
  6588. if (amount === void 0) {
  6589. amount = 10;
  6590. }
  6591. var hsl = this.toHsl();
  6592. hsl.s += amount / 100;
  6593. hsl.s = clamp01(hsl.s);
  6594. return new TinyColor2(hsl);
  6595. };
  6596. TinyColor2.prototype.greyscale = function() {
  6597. return this.desaturate(100);
  6598. };
  6599. TinyColor2.prototype.spin = function(amount) {
  6600. var hsl = this.toHsl();
  6601. var hue = (hsl.h + amount) % 360;
  6602. hsl.h = hue < 0 ? 360 + hue : hue;
  6603. return new TinyColor2(hsl);
  6604. };
  6605. TinyColor2.prototype.mix = function(color, amount) {
  6606. if (amount === void 0) {
  6607. amount = 50;
  6608. }
  6609. var rgb1 = this.toRgb();
  6610. var rgb2 = new TinyColor2(color).toRgb();
  6611. var p2 = amount / 100;
  6612. var rgba = {
  6613. r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
  6614. g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
  6615. b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
  6616. a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  6617. };
  6618. return new TinyColor2(rgba);
  6619. };
  6620. TinyColor2.prototype.analogous = function(results, slices) {
  6621. if (results === void 0) {
  6622. results = 6;
  6623. }
  6624. if (slices === void 0) {
  6625. slices = 30;
  6626. }
  6627. var hsl = this.toHsl();
  6628. var part = 360 / slices;
  6629. var ret = [this];
  6630. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  6631. hsl.h = (hsl.h + part) % 360;
  6632. ret.push(new TinyColor2(hsl));
  6633. }
  6634. return ret;
  6635. };
  6636. TinyColor2.prototype.complement = function() {
  6637. var hsl = this.toHsl();
  6638. hsl.h = (hsl.h + 180) % 360;
  6639. return new TinyColor2(hsl);
  6640. };
  6641. TinyColor2.prototype.monochromatic = function(results) {
  6642. if (results === void 0) {
  6643. results = 6;
  6644. }
  6645. var hsv = this.toHsv();
  6646. var h2 = hsv.h;
  6647. var s2 = hsv.s;
  6648. var v2 = hsv.v;
  6649. var res = [];
  6650. var modification = 1 / results;
  6651. while (results--) {
  6652. res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
  6653. v2 = (v2 + modification) % 1;
  6654. }
  6655. return res;
  6656. };
  6657. TinyColor2.prototype.splitcomplement = function() {
  6658. var hsl = this.toHsl();
  6659. var h2 = hsl.h;
  6660. return [
  6661. this,
  6662. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  6663. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  6664. ];
  6665. };
  6666. TinyColor2.prototype.onBackground = function(background) {
  6667. var fg = this.toRgb();
  6668. var bg = new TinyColor2(background).toRgb();
  6669. var alpha = fg.a + bg.a * (1 - fg.a);
  6670. return new TinyColor2({
  6671. r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
  6672. g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
  6673. b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
  6674. a: alpha
  6675. });
  6676. };
  6677. TinyColor2.prototype.triad = function() {
  6678. return this.polyad(3);
  6679. };
  6680. TinyColor2.prototype.tetrad = function() {
  6681. return this.polyad(4);
  6682. };
  6683. TinyColor2.prototype.polyad = function(n) {
  6684. var hsl = this.toHsl();
  6685. var h2 = hsl.h;
  6686. var result = [this];
  6687. var increment = 360 / n;
  6688. for (var i = 1; i < n; i++) {
  6689. result.push(new TinyColor2({ h: (h2 + i * increment) % 360, s: hsl.s, l: hsl.l }));
  6690. }
  6691. return result;
  6692. };
  6693. TinyColor2.prototype.equals = function(color) {
  6694. return this.toRgbString() === new TinyColor2(color).toRgbString();
  6695. };
  6696. return TinyColor2;
  6697. }();
  6698. function darken(color, amount = 20) {
  6699. return color.mix("#141414", amount).toString();
  6700. }
  6701. function useButtonCustomStyle(props) {
  6702. const _disabled = useFormDisabled();
  6703. const ns = useNamespace("button");
  6704. return vue.computed(() => {
  6705. let styles = {};
  6706. const buttonColor = props.color;
  6707. if (buttonColor) {
  6708. const color = new TinyColor(buttonColor);
  6709. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  6710. if (props.plain) {
  6711. styles = ns.cssVarBlock({
  6712. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  6713. "text-color": buttonColor,
  6714. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  6715. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  6716. "hover-bg-color": buttonColor,
  6717. "hover-border-color": buttonColor,
  6718. "active-bg-color": activeBgColor,
  6719. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  6720. "active-border-color": activeBgColor
  6721. });
  6722. if (_disabled.value) {
  6723. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  6724. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  6725. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  6726. }
  6727. } else {
  6728. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  6729. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  6730. styles = ns.cssVarBlock({
  6731. "bg-color": buttonColor,
  6732. "text-color": textColor,
  6733. "border-color": buttonColor,
  6734. "hover-bg-color": hoverBgColor,
  6735. "hover-text-color": textColor,
  6736. "hover-border-color": hoverBgColor,
  6737. "active-bg-color": activeBgColor,
  6738. "active-border-color": activeBgColor
  6739. });
  6740. if (_disabled.value) {
  6741. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  6742. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  6743. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  6744. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  6745. }
  6746. }
  6747. }
  6748. return styles;
  6749. });
  6750. }
  6751. const __default__$6 = vue.defineComponent({
  6752. name: "ElButton"
  6753. });
  6754. const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
  6755. ...__default__$6,
  6756. props: buttonProps,
  6757. emits: buttonEmits,
  6758. setup(__props, { expose, emit }) {
  6759. const props = __props;
  6760. const buttonStyle = useButtonCustomStyle(props);
  6761. const ns = useNamespace("button");
  6762. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  6763. const buttonKls = vue.computed(() => [
  6764. ns.b(),
  6765. ns.m(_type.value),
  6766. ns.m(_size.value),
  6767. ns.is("disabled", _disabled.value),
  6768. ns.is("loading", props.loading),
  6769. ns.is("plain", props.plain),
  6770. ns.is("round", props.round),
  6771. ns.is("circle", props.circle),
  6772. ns.is("text", props.text),
  6773. ns.is("link", props.link),
  6774. ns.is("has-bg", props.bg)
  6775. ]);
  6776. expose({
  6777. ref: _ref,
  6778. size: _size,
  6779. type: _type,
  6780. disabled: _disabled,
  6781. shouldAddSpace
  6782. });
  6783. return (_ctx, _cache) => {
  6784. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), vue.mergeProps({
  6785. ref_key: "_ref",
  6786. ref: _ref
  6787. }, vue.unref(_props), {
  6788. class: vue.unref(buttonKls),
  6789. style: vue.unref(buttonStyle),
  6790. onClick: vue.unref(handleClick)
  6791. }), {
  6792. default: vue.withCtx(() => [
  6793. _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  6794. _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  6795. key: 1,
  6796. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  6797. }, {
  6798. default: vue.withCtx(() => [
  6799. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon)))
  6800. ]),
  6801. _: 1
  6802. }, 8, ["class"]))
  6803. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  6804. default: vue.withCtx(() => [
  6805. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })
  6806. ]),
  6807. _: 3
  6808. })) : vue.createCommentVNode("v-if", true),
  6809. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  6810. key: 2,
  6811. class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
  6812. }, [
  6813. vue.renderSlot(_ctx.$slots, "default")
  6814. ], 2)) : vue.createCommentVNode("v-if", true)
  6815. ]),
  6816. _: 3
  6817. }, 16, ["class", "style", "onClick"]);
  6818. };
  6819. }
  6820. });
  6821. var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "button.vue"]]);
  6822. const buttonGroupProps = {
  6823. size: buttonProps.size,
  6824. type: buttonProps.type
  6825. };
  6826. const __default__$5 = vue.defineComponent({
  6827. name: "ElButtonGroup"
  6828. });
  6829. const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
  6830. ...__default__$5,
  6831. props: buttonGroupProps,
  6832. setup(__props) {
  6833. const props = __props;
  6834. vue.provide(buttonGroupContextKey, vue.reactive({
  6835. size: vue.toRef(props, "size"),
  6836. type: vue.toRef(props, "type")
  6837. }));
  6838. const ns = useNamespace("button");
  6839. return (_ctx, _cache) => {
  6840. return vue.openBlock(), vue.createElementBlock("div", {
  6841. class: vue.normalizeClass(`${vue.unref(ns).b("group")}`)
  6842. }, [
  6843. vue.renderSlot(_ctx.$slots, "default")
  6844. ], 2);
  6845. };
  6846. }
  6847. });
  6848. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "button-group.vue"]]);
  6849. const ElButton = withInstall(Button, {
  6850. ButtonGroup
  6851. });
  6852. withNoopInstall(ButtonGroup);
  6853. const nodeList = /* @__PURE__ */ new Map();
  6854. let startClick;
  6855. if (isClient) {
  6856. document.addEventListener("mousedown", (e) => startClick = e);
  6857. document.addEventListener("mouseup", (e) => {
  6858. for (const handlers of nodeList.values()) {
  6859. for (const { documentHandler } of handlers) {
  6860. documentHandler(e, startClick);
  6861. }
  6862. }
  6863. });
  6864. }
  6865. function createDocumentHandler(el, binding) {
  6866. let excludes = [];
  6867. if (Array.isArray(binding.arg)) {
  6868. excludes = binding.arg;
  6869. } else if (isElement(binding.arg)) {
  6870. excludes.push(binding.arg);
  6871. }
  6872. return function(mouseup, mousedown) {
  6873. const popperRef = binding.instance.popperRef;
  6874. const mouseUpTarget = mouseup.target;
  6875. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  6876. const isBound = !binding || !binding.instance;
  6877. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  6878. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  6879. const isSelf = el === mouseUpTarget;
  6880. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  6881. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  6882. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  6883. return;
  6884. }
  6885. binding.value(mouseup, mousedown);
  6886. };
  6887. }
  6888. const ClickOutside = {
  6889. beforeMount(el, binding) {
  6890. if (!nodeList.has(el)) {
  6891. nodeList.set(el, []);
  6892. }
  6893. nodeList.get(el).push({
  6894. documentHandler: createDocumentHandler(el, binding),
  6895. bindingFn: binding.value
  6896. });
  6897. },
  6898. updated(el, binding) {
  6899. if (!nodeList.has(el)) {
  6900. nodeList.set(el, []);
  6901. }
  6902. const handlers = nodeList.get(el);
  6903. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  6904. const newHandler = {
  6905. documentHandler: createDocumentHandler(el, binding),
  6906. bindingFn: binding.value
  6907. };
  6908. if (oldHandlerIndex >= 0) {
  6909. handlers.splice(oldHandlerIndex, 1, newHandler);
  6910. } else {
  6911. handlers.push(newHandler);
  6912. }
  6913. },
  6914. unmounted(el) {
  6915. nodeList.delete(el);
  6916. }
  6917. };
  6918. var v = false, o, f, s, u, d, N, l, p, m, w, D, x, E, M, F;
  6919. function a() {
  6920. if (!v) {
  6921. v = true;
  6922. var e = navigator.userAgent, n = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e), i = /(Mac OS X)|(Windows)|(Linux)/.exec(e);
  6923. if (x = /\b(iPhone|iP[ao]d)/.exec(e), E = /\b(iP[ao]d)/.exec(e), w = /Android/i.exec(e), M = /FBAN\/\w+;/i.exec(e), F = /Mobile/i.exec(e), D = !!/Win64/.exec(e), n) {
  6924. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  6925. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  6926. N = r ? parseFloat(r[1]) + 4 : o, f = n[2] ? parseFloat(n[2]) : NaN, s = n[3] ? parseFloat(n[3]) : NaN, u = n[4] ? parseFloat(n[4]) : NaN, u ? (n = /(?:Chrome\/(\d+\.\d+))/.exec(e), d = n && n[1] ? parseFloat(n[1]) : NaN) : d = NaN;
  6927. } else
  6928. o = f = s = d = u = NaN;
  6929. if (i) {
  6930. if (i[1]) {
  6931. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  6932. l = t ? parseFloat(t[1].replace("_", ".")) : true;
  6933. } else
  6934. l = false;
  6935. p = !!i[2], m = !!i[3];
  6936. } else
  6937. l = p = m = false;
  6938. }
  6939. }
  6940. var _ = { ie: function() {
  6941. return a() || o;
  6942. }, ieCompatibilityMode: function() {
  6943. return a() || N > o;
  6944. }, ie64: function() {
  6945. return _.ie() && D;
  6946. }, firefox: function() {
  6947. return a() || f;
  6948. }, opera: function() {
  6949. return a() || s;
  6950. }, webkit: function() {
  6951. return a() || u;
  6952. }, safari: function() {
  6953. return _.webkit();
  6954. }, chrome: function() {
  6955. return a() || d;
  6956. }, windows: function() {
  6957. return a() || p;
  6958. }, osx: function() {
  6959. return a() || l;
  6960. }, linux: function() {
  6961. return a() || m;
  6962. }, iphone: function() {
  6963. return a() || x;
  6964. }, mobile: function() {
  6965. return a() || x || E || w || F;
  6966. }, nativeApp: function() {
  6967. return a() || M;
  6968. }, android: function() {
  6969. return a() || w;
  6970. }, ipad: function() {
  6971. return a() || E;
  6972. } }, A = _;
  6973. var c = !!(typeof window < "u" && window.document && window.document.createElement), U = { canUseDOM: c, canUseWorkers: typeof Worker < "u", canUseEventListeners: c && !!(window.addEventListener || window.attachEvent), canUseViewport: c && !!window.screen, isInWorker: !c }, h = U;
  6974. var X;
  6975. h.canUseDOM && (X = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true);
  6976. function S(e, n) {
  6977. if (!h.canUseDOM || n && !("addEventListener" in document))
  6978. return false;
  6979. var i = "on" + e, r = i in document;
  6980. if (!r) {
  6981. var t = document.createElement("div");
  6982. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  6983. }
  6984. return !r && X && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  6985. }
  6986. var b = S;
  6987. var O = 10, I = 40, P = 800;
  6988. function T(e) {
  6989. var n = 0, i = 0, r = 0, t = 0;
  6990. return "detail" in e && (i = e.detail), "wheelDelta" in e && (i = -e.wheelDelta / 120), "wheelDeltaY" in e && (i = -e.wheelDeltaY / 120), "wheelDeltaX" in e && (n = -e.wheelDeltaX / 120), "axis" in e && e.axis === e.HORIZONTAL_AXIS && (n = i, i = 0), r = n * O, t = i * O, "deltaY" in e && (t = e.deltaY), "deltaX" in e && (r = e.deltaX), (r || t) && e.deltaMode && (e.deltaMode == 1 ? (r *= I, t *= I) : (r *= P, t *= P)), r && !n && (n = r < 1 ? -1 : 1), t && !i && (i = t < 1 ? -1 : 1), { spinX: n, spinY: i, pixelX: r, pixelY: t };
  6991. }
  6992. T.getEventType = function() {
  6993. return A.firefox() ? "DOMMouseScroll" : b("wheel") ? "wheel" : "mousewheel";
  6994. };
  6995. var Y = T;
  6996. /**
  6997. * Checks if an event is supported in the current execution environment.
  6998. *
  6999. * NOTE: This will not work correctly for non-generic events such as `change`,
  7000. * `reset`, `load`, `error`, and `select`.
  7001. *
  7002. * Borrows from Modernizr.
  7003. *
  7004. * @param {string} eventNameSuffix Event name, e.g. "click".
  7005. * @param {?boolean} capture Check if the capture phase is supported.
  7006. * @return {boolean} True if the event is supported.
  7007. * @internal
  7008. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  7009. */
  7010. const mousewheel = function(element, callback) {
  7011. if (element && element.addEventListener) {
  7012. const fn2 = function(event) {
  7013. const normalized = Y(event);
  7014. callback && Reflect.apply(callback, this, [event, normalized]);
  7015. };
  7016. element.addEventListener("wheel", fn2, { passive: true });
  7017. }
  7018. };
  7019. const Mousewheel = {
  7020. beforeMount(el, binding) {
  7021. mousewheel(el, binding.value);
  7022. }
  7023. };
  7024. const checkboxProps = {
  7025. modelValue: {
  7026. type: [Number, String, Boolean],
  7027. default: void 0
  7028. },
  7029. label: {
  7030. type: [String, Boolean, Number, Object],
  7031. default: void 0
  7032. },
  7033. value: {
  7034. type: [String, Boolean, Number, Object],
  7035. default: void 0
  7036. },
  7037. indeterminate: Boolean,
  7038. disabled: Boolean,
  7039. checked: Boolean,
  7040. name: {
  7041. type: String,
  7042. default: void 0
  7043. },
  7044. trueValue: {
  7045. type: [String, Number],
  7046. default: void 0
  7047. },
  7048. falseValue: {
  7049. type: [String, Number],
  7050. default: void 0
  7051. },
  7052. trueLabel: {
  7053. type: [String, Number],
  7054. default: void 0
  7055. },
  7056. falseLabel: {
  7057. type: [String, Number],
  7058. default: void 0
  7059. },
  7060. id: {
  7061. type: String,
  7062. default: void 0
  7063. },
  7064. controls: {
  7065. type: String,
  7066. default: void 0
  7067. },
  7068. border: Boolean,
  7069. size: useSizeProp,
  7070. tabindex: [String, Number],
  7071. validateEvent: {
  7072. type: Boolean,
  7073. default: true
  7074. },
  7075. ...useAriaProps(["ariaControls"])
  7076. };
  7077. const checkboxEmits = {
  7078. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  7079. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  7080. };
  7081. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  7082. const useCheckboxDisabled = ({
  7083. model,
  7084. isChecked
  7085. }) => {
  7086. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  7087. const isLimitDisabled = vue.computed(() => {
  7088. var _a2, _b;
  7089. const max = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a2.value;
  7090. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  7091. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  7092. });
  7093. const isDisabled = useFormDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  7094. return {
  7095. isDisabled,
  7096. isLimitDisabled
  7097. };
  7098. };
  7099. const useCheckboxEvent = (props, {
  7100. model,
  7101. isLimitExceeded,
  7102. hasOwnLabel,
  7103. isDisabled,
  7104. isLabeledByFormItem
  7105. }) => {
  7106. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  7107. const { formItem } = useFormItem();
  7108. const { emit } = vue.getCurrentInstance();
  7109. function getLabeledValue(value) {
  7110. var _a2, _b, _c, _d;
  7111. return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a2 = props.trueValue) != null ? _a2 : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
  7112. }
  7113. function emitChangeEvent(checked, e) {
  7114. emit("change", getLabeledValue(checked), e);
  7115. }
  7116. function handleChange(e) {
  7117. if (isLimitExceeded.value)
  7118. return;
  7119. const target = e.target;
  7120. emit("change", getLabeledValue(target.checked), e);
  7121. }
  7122. async function onClickRoot(e) {
  7123. if (isLimitExceeded.value)
  7124. return;
  7125. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  7126. const eventTargets = e.composedPath();
  7127. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  7128. if (!hasLabel) {
  7129. model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
  7130. await vue.nextTick();
  7131. emitChangeEvent(model.value, e);
  7132. }
  7133. }
  7134. }
  7135. const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  7136. vue.watch(() => props.modelValue, () => {
  7137. if (validateEvent.value) {
  7138. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  7139. }
  7140. });
  7141. return {
  7142. handleChange,
  7143. onClickRoot
  7144. };
  7145. };
  7146. const useCheckboxModel = (props) => {
  7147. const selfModel = vue.ref(false);
  7148. const { emit } = vue.getCurrentInstance();
  7149. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  7150. const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false);
  7151. const isLimitExceeded = vue.ref(false);
  7152. const model = vue.computed({
  7153. get() {
  7154. var _a2, _b;
  7155. return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  7156. },
  7157. set(val) {
  7158. var _a2, _b;
  7159. if (isGroup.value && isArray$2(val)) {
  7160. isLimitExceeded.value = ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a2.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
  7161. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  7162. } else {
  7163. emit(UPDATE_MODEL_EVENT, val);
  7164. selfModel.value = val;
  7165. }
  7166. }
  7167. });
  7168. return {
  7169. model,
  7170. isGroup,
  7171. isLimitExceeded
  7172. };
  7173. };
  7174. const useCheckboxStatus = (props, slots, { model }) => {
  7175. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  7176. const isFocused = vue.ref(false);
  7177. const actualValue = vue.computed(() => {
  7178. if (!isPropAbsent(props.value)) {
  7179. return props.value;
  7180. }
  7181. return props.label;
  7182. });
  7183. const isChecked = vue.computed(() => {
  7184. const value = model.value;
  7185. if (isBoolean(value)) {
  7186. return value;
  7187. } else if (isArray$2(value)) {
  7188. if (isObject$1(actualValue.value)) {
  7189. return value.map(vue.toRaw).some((o2) => isEqual(o2, actualValue.value));
  7190. } else {
  7191. return value.map(vue.toRaw).includes(actualValue.value);
  7192. }
  7193. } else if (value !== null && value !== void 0) {
  7194. return value === props.trueValue || value === props.trueLabel;
  7195. } else {
  7196. return !!value;
  7197. }
  7198. });
  7199. const checkboxButtonSize = useFormSize(vue.computed(() => {
  7200. var _a2;
  7201. return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
  7202. }), {
  7203. prop: true
  7204. });
  7205. const checkboxSize = useFormSize(vue.computed(() => {
  7206. var _a2;
  7207. return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
  7208. }));
  7209. const hasOwnLabel = vue.computed(() => {
  7210. return !!slots.default || !isPropAbsent(actualValue.value);
  7211. });
  7212. return {
  7213. checkboxButtonSize,
  7214. isChecked,
  7215. isFocused,
  7216. checkboxSize,
  7217. hasOwnLabel,
  7218. actualValue
  7219. };
  7220. };
  7221. const useCheckbox = (props, slots) => {
  7222. const { formItem: elFormItem } = useFormItem();
  7223. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  7224. const {
  7225. isFocused,
  7226. isChecked,
  7227. checkboxButtonSize,
  7228. checkboxSize,
  7229. hasOwnLabel,
  7230. actualValue
  7231. } = useCheckboxStatus(props, slots, { model });
  7232. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  7233. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  7234. formItemContext: elFormItem,
  7235. disableIdGeneration: hasOwnLabel,
  7236. disableIdManagement: isGroup
  7237. });
  7238. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  7239. model,
  7240. isLimitExceeded,
  7241. hasOwnLabel,
  7242. isDisabled,
  7243. isLabeledByFormItem
  7244. });
  7245. const setStoreValue = () => {
  7246. function addToStore() {
  7247. var _a2, _b;
  7248. if (isArray$2(model.value) && !model.value.includes(actualValue.value)) {
  7249. model.value.push(actualValue.value);
  7250. } else {
  7251. model.value = (_b = (_a2 = props.trueValue) != null ? _a2 : props.trueLabel) != null ? _b : true;
  7252. }
  7253. }
  7254. props.checked && addToStore();
  7255. };
  7256. setStoreValue();
  7257. useDeprecated({
  7258. from: "controls",
  7259. replacement: "aria-controls",
  7260. version: "2.8.0",
  7261. scope: "el-checkbox",
  7262. ref: "https://element-plus.org/en-US/component/checkbox.html"
  7263. }, vue.computed(() => !!props.controls));
  7264. useDeprecated({
  7265. from: "label act as value",
  7266. replacement: "value",
  7267. version: "3.0.0",
  7268. scope: "el-checkbox",
  7269. ref: "https://element-plus.org/en-US/component/checkbox.html"
  7270. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  7271. useDeprecated({
  7272. from: "true-label",
  7273. replacement: "true-value",
  7274. version: "3.0.0",
  7275. scope: "el-checkbox",
  7276. ref: "https://element-plus.org/en-US/component/checkbox.html"
  7277. }, vue.computed(() => !!props.trueLabel));
  7278. useDeprecated({
  7279. from: "false-label",
  7280. replacement: "false-value",
  7281. version: "3.0.0",
  7282. scope: "el-checkbox",
  7283. ref: "https://element-plus.org/en-US/component/checkbox.html"
  7284. }, vue.computed(() => !!props.falseLabel));
  7285. return {
  7286. inputId,
  7287. isLabeledByFormItem,
  7288. isChecked,
  7289. isDisabled,
  7290. isFocused,
  7291. checkboxButtonSize,
  7292. checkboxSize,
  7293. hasOwnLabel,
  7294. model,
  7295. actualValue,
  7296. handleChange,
  7297. onClickRoot
  7298. };
  7299. };
  7300. const _hoisted_1$5 = ["id", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value"];
  7301. const _hoisted_2$5 = ["id", "indeterminate", "disabled", "value", "name", "tabindex"];
  7302. const __default__$4 = vue.defineComponent({
  7303. name: "ElCheckbox"
  7304. });
  7305. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  7306. ...__default__$4,
  7307. props: checkboxProps,
  7308. emits: checkboxEmits,
  7309. setup(__props) {
  7310. const props = __props;
  7311. const slots = vue.useSlots();
  7312. const {
  7313. inputId,
  7314. isLabeledByFormItem,
  7315. isChecked,
  7316. isDisabled,
  7317. isFocused,
  7318. checkboxSize,
  7319. hasOwnLabel,
  7320. model,
  7321. actualValue,
  7322. handleChange,
  7323. onClickRoot
  7324. } = useCheckbox(props, slots);
  7325. const ns = useNamespace("checkbox");
  7326. const compKls = vue.computed(() => {
  7327. return [
  7328. ns.b(),
  7329. ns.m(checkboxSize.value),
  7330. ns.is("disabled", isDisabled.value),
  7331. ns.is("bordered", props.border),
  7332. ns.is("checked", isChecked.value)
  7333. ];
  7334. });
  7335. const spanKls = vue.computed(() => {
  7336. return [
  7337. ns.e("input"),
  7338. ns.is("disabled", isDisabled.value),
  7339. ns.is("checked", isChecked.value),
  7340. ns.is("indeterminate", props.indeterminate),
  7341. ns.is("focus", isFocused.value)
  7342. ];
  7343. });
  7344. return (_ctx, _cache) => {
  7345. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), {
  7346. class: vue.normalizeClass(vue.unref(compKls)),
  7347. "aria-controls": _ctx.indeterminate ? _ctx.controls || _ctx.ariaControls : null,
  7348. onClick: vue.unref(onClickRoot)
  7349. }, {
  7350. default: vue.withCtx(() => {
  7351. var _a2, _b;
  7352. return [
  7353. vue.createElementVNode("span", {
  7354. class: vue.normalizeClass(vue.unref(spanKls))
  7355. }, [
  7356. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  7357. key: 0,
  7358. id: vue.unref(inputId),
  7359. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  7360. class: vue.normalizeClass(vue.unref(ns).e("original")),
  7361. type: "checkbox",
  7362. indeterminate: _ctx.indeterminate,
  7363. name: _ctx.name,
  7364. tabindex: _ctx.tabindex,
  7365. disabled: vue.unref(isDisabled),
  7366. "true-value": (_a2 = _ctx.trueValue) != null ? _a2 : _ctx.trueLabel,
  7367. "false-value": (_b = _ctx.falseValue) != null ? _b : _ctx.falseLabel,
  7368. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  7369. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  7370. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  7371. onClick: _cache[4] || (_cache[4] = vue.withModifiers(() => {
  7372. }, ["stop"]))
  7373. }, null, 42, _hoisted_1$5)), [
  7374. [vue.vModelCheckbox, vue.unref(model)]
  7375. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  7376. key: 1,
  7377. id: vue.unref(inputId),
  7378. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(model) ? model.value = $event : null),
  7379. class: vue.normalizeClass(vue.unref(ns).e("original")),
  7380. type: "checkbox",
  7381. indeterminate: _ctx.indeterminate,
  7382. disabled: vue.unref(isDisabled),
  7383. value: vue.unref(actualValue),
  7384. name: _ctx.name,
  7385. tabindex: _ctx.tabindex,
  7386. onChange: _cache[6] || (_cache[6] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  7387. onFocus: _cache[7] || (_cache[7] = ($event) => isFocused.value = true),
  7388. onBlur: _cache[8] || (_cache[8] = ($event) => isFocused.value = false),
  7389. onClick: _cache[9] || (_cache[9] = vue.withModifiers(() => {
  7390. }, ["stop"]))
  7391. }, null, 42, _hoisted_2$5)), [
  7392. [vue.vModelCheckbox, vue.unref(model)]
  7393. ]),
  7394. vue.createElementVNode("span", {
  7395. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  7396. }, null, 2)
  7397. ], 2),
  7398. vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
  7399. key: 0,
  7400. class: vue.normalizeClass(vue.unref(ns).e("label"))
  7401. }, [
  7402. vue.renderSlot(_ctx.$slots, "default"),
  7403. !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  7404. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  7405. ], 64)) : vue.createCommentVNode("v-if", true)
  7406. ], 2)) : vue.createCommentVNode("v-if", true)
  7407. ];
  7408. }),
  7409. _: 3
  7410. }, 8, ["class", "aria-controls", "onClick"]);
  7411. };
  7412. }
  7413. });
  7414. var Checkbox = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "checkbox.vue"]]);
  7415. const _hoisted_1$4 = ["name", "tabindex", "disabled", "true-value", "false-value"];
  7416. const _hoisted_2$4 = ["name", "tabindex", "disabled", "value"];
  7417. const __default__$3 = vue.defineComponent({
  7418. name: "ElCheckboxButton"
  7419. });
  7420. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  7421. ...__default__$3,
  7422. props: checkboxProps,
  7423. emits: checkboxEmits,
  7424. setup(__props) {
  7425. const props = __props;
  7426. const slots = vue.useSlots();
  7427. const {
  7428. isFocused,
  7429. isChecked,
  7430. isDisabled,
  7431. checkboxButtonSize,
  7432. model,
  7433. actualValue,
  7434. handleChange
  7435. } = useCheckbox(props, slots);
  7436. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  7437. const ns = useNamespace("checkbox");
  7438. const activeStyle = vue.computed(() => {
  7439. var _a2, _b, _c, _d;
  7440. const fillValue = (_b = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b : "";
  7441. return {
  7442. backgroundColor: fillValue,
  7443. borderColor: fillValue,
  7444. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  7445. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  7446. };
  7447. });
  7448. const labelKls = vue.computed(() => {
  7449. return [
  7450. ns.b("button"),
  7451. ns.bm("button", checkboxButtonSize.value),
  7452. ns.is("disabled", isDisabled.value),
  7453. ns.is("checked", isChecked.value),
  7454. ns.is("focus", isFocused.value)
  7455. ];
  7456. });
  7457. return (_ctx, _cache) => {
  7458. var _a2, _b;
  7459. return vue.openBlock(), vue.createElementBlock("label", {
  7460. class: vue.normalizeClass(vue.unref(labelKls))
  7461. }, [
  7462. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  7463. key: 0,
  7464. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  7465. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  7466. type: "checkbox",
  7467. name: _ctx.name,
  7468. tabindex: _ctx.tabindex,
  7469. disabled: vue.unref(isDisabled),
  7470. "true-value": (_a2 = _ctx.trueValue) != null ? _a2 : _ctx.trueLabel,
  7471. "false-value": (_b = _ctx.falseValue) != null ? _b : _ctx.falseLabel,
  7472. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  7473. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  7474. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  7475. onClick: _cache[4] || (_cache[4] = vue.withModifiers(() => {
  7476. }, ["stop"]))
  7477. }, null, 42, _hoisted_1$4)), [
  7478. [vue.vModelCheckbox, vue.unref(model)]
  7479. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  7480. key: 1,
  7481. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(model) ? model.value = $event : null),
  7482. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  7483. type: "checkbox",
  7484. name: _ctx.name,
  7485. tabindex: _ctx.tabindex,
  7486. disabled: vue.unref(isDisabled),
  7487. value: vue.unref(actualValue),
  7488. onChange: _cache[6] || (_cache[6] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  7489. onFocus: _cache[7] || (_cache[7] = ($event) => isFocused.value = true),
  7490. onBlur: _cache[8] || (_cache[8] = ($event) => isFocused.value = false),
  7491. onClick: _cache[9] || (_cache[9] = vue.withModifiers(() => {
  7492. }, ["stop"]))
  7493. }, null, 42, _hoisted_2$4)), [
  7494. [vue.vModelCheckbox, vue.unref(model)]
  7495. ]),
  7496. _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
  7497. key: 2,
  7498. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  7499. style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0)
  7500. }, [
  7501. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  7502. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  7503. ])
  7504. ], 6)) : vue.createCommentVNode("v-if", true)
  7505. ], 2);
  7506. };
  7507. }
  7508. });
  7509. var CheckboxButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__file", "checkbox-button.vue"]]);
  7510. const checkboxGroupProps = buildProps({
  7511. modelValue: {
  7512. type: definePropType(Array),
  7513. default: () => []
  7514. },
  7515. disabled: Boolean,
  7516. min: Number,
  7517. max: Number,
  7518. size: useSizeProp,
  7519. label: String,
  7520. fill: String,
  7521. textColor: String,
  7522. tag: {
  7523. type: String,
  7524. default: "div"
  7525. },
  7526. validateEvent: {
  7527. type: Boolean,
  7528. default: true
  7529. },
  7530. ...useAriaProps(["ariaLabel"])
  7531. });
  7532. const checkboxGroupEmits = {
  7533. [UPDATE_MODEL_EVENT]: (val) => isArray$2(val),
  7534. change: (val) => isArray$2(val)
  7535. };
  7536. const __default__$2 = vue.defineComponent({
  7537. name: "ElCheckboxGroup"
  7538. });
  7539. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  7540. ...__default__$2,
  7541. props: checkboxGroupProps,
  7542. emits: checkboxGroupEmits,
  7543. setup(__props, { emit }) {
  7544. const props = __props;
  7545. const ns = useNamespace("checkbox");
  7546. const { formItem } = useFormItem();
  7547. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  7548. formItemContext: formItem
  7549. });
  7550. const changeEvent = async (value) => {
  7551. emit(UPDATE_MODEL_EVENT, value);
  7552. await vue.nextTick();
  7553. emit("change", value);
  7554. };
  7555. const modelValue = vue.computed({
  7556. get() {
  7557. return props.modelValue;
  7558. },
  7559. set(val) {
  7560. changeEvent(val);
  7561. }
  7562. });
  7563. vue.provide(checkboxGroupContextKey, {
  7564. ...pick$1(vue.toRefs(props), [
  7565. "size",
  7566. "min",
  7567. "max",
  7568. "disabled",
  7569. "validateEvent",
  7570. "fill",
  7571. "textColor"
  7572. ]),
  7573. modelValue,
  7574. changeEvent
  7575. });
  7576. useDeprecated({
  7577. from: "label",
  7578. replacement: "aria-label",
  7579. version: "2.8.0",
  7580. scope: "el-checkbox-group",
  7581. ref: "https://element-plus.org/en-US/component/checkbox.html"
  7582. }, vue.computed(() => !!props.label));
  7583. vue.watch(() => props.modelValue, () => {
  7584. if (props.validateEvent) {
  7585. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  7586. }
  7587. });
  7588. return (_ctx, _cache) => {
  7589. var _a2;
  7590. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  7591. id: vue.unref(groupId),
  7592. class: vue.normalizeClass(vue.unref(ns).b("group")),
  7593. role: "group",
  7594. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || _ctx.ariaLabel || "checkbox-group" : void 0,
  7595. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a2 = vue.unref(formItem)) == null ? void 0 : _a2.labelId : void 0
  7596. }, {
  7597. default: vue.withCtx(() => [
  7598. vue.renderSlot(_ctx.$slots, "default")
  7599. ]),
  7600. _: 3
  7601. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  7602. };
  7603. }
  7604. });
  7605. var CheckboxGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__file", "checkbox-group.vue"]]);
  7606. const ElCheckbox = withInstall(Checkbox, {
  7607. CheckboxButton,
  7608. CheckboxGroup
  7609. });
  7610. withNoopInstall(CheckboxButton);
  7611. withNoopInstall(CheckboxGroup);
  7612. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  7613. inheritAttrs: false
  7614. });
  7615. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  7616. return vue.renderSlot(_ctx.$slots, "default");
  7617. }
  7618. var Collection = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$3], ["__file", "collection.vue"]]);
  7619. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  7620. name: "ElCollectionItem",
  7621. inheritAttrs: false
  7622. });
  7623. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  7624. return vue.renderSlot(_ctx.$slots, "default");
  7625. }
  7626. var CollectionItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["render", _sfc_render$2], ["__file", "collection-item.vue"]]);
  7627. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  7628. const createCollectionWithScope = (name) => {
  7629. const COLLECTION_NAME = `El${name}Collection`;
  7630. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  7631. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  7632. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  7633. const ElCollection = {
  7634. ...Collection,
  7635. name: COLLECTION_NAME,
  7636. setup() {
  7637. const collectionRef = vue.ref(null);
  7638. const itemMap = /* @__PURE__ */ new Map();
  7639. const getItems = () => {
  7640. const collectionEl = vue.unref(collectionRef);
  7641. if (!collectionEl)
  7642. return [];
  7643. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  7644. const items = [...itemMap.values()];
  7645. return items.sort((a2, b2) => orderedNodes.indexOf(a2.ref) - orderedNodes.indexOf(b2.ref));
  7646. };
  7647. vue.provide(COLLECTION_INJECTION_KEY, {
  7648. itemMap,
  7649. getItems,
  7650. collectionRef
  7651. });
  7652. }
  7653. };
  7654. const ElCollectionItem = {
  7655. ...CollectionItem,
  7656. name: COLLECTION_ITEM_NAME,
  7657. setup(_2, { attrs }) {
  7658. const collectionItemRef = vue.ref(null);
  7659. const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  7660. vue.provide(COLLECTION_ITEM_INJECTION_KEY, {
  7661. collectionItemRef
  7662. });
  7663. vue.onMounted(() => {
  7664. const collectionItemEl = vue.unref(collectionItemRef);
  7665. if (collectionItemEl) {
  7666. collectionInjection.itemMap.set(collectionItemEl, {
  7667. ref: collectionItemEl,
  7668. ...attrs
  7669. });
  7670. }
  7671. });
  7672. vue.onBeforeUnmount(() => {
  7673. const collectionItemEl = vue.unref(collectionItemRef);
  7674. collectionInjection.itemMap.delete(collectionItemEl);
  7675. });
  7676. }
  7677. };
  7678. return {
  7679. COLLECTION_INJECTION_KEY,
  7680. COLLECTION_ITEM_INJECTION_KEY,
  7681. ElCollection,
  7682. ElCollectionItem
  7683. };
  7684. };
  7685. const dropdownProps = buildProps({
  7686. trigger: useTooltipTriggerProps.trigger,
  7687. effect: {
  7688. ...useTooltipContentProps.effect,
  7689. default: "light"
  7690. },
  7691. type: {
  7692. type: definePropType(String)
  7693. },
  7694. placement: {
  7695. type: definePropType(String),
  7696. default: "bottom"
  7697. },
  7698. popperOptions: {
  7699. type: definePropType(Object),
  7700. default: () => ({})
  7701. },
  7702. id: String,
  7703. size: {
  7704. type: String,
  7705. default: ""
  7706. },
  7707. splitButton: Boolean,
  7708. hideOnClick: {
  7709. type: Boolean,
  7710. default: true
  7711. },
  7712. loop: {
  7713. type: Boolean,
  7714. default: true
  7715. },
  7716. showTimeout: {
  7717. type: Number,
  7718. default: 150
  7719. },
  7720. hideTimeout: {
  7721. type: Number,
  7722. default: 150
  7723. },
  7724. tabindex: {
  7725. type: definePropType([Number, String]),
  7726. default: 0
  7727. },
  7728. maxHeight: {
  7729. type: definePropType([Number, String]),
  7730. default: ""
  7731. },
  7732. popperClass: {
  7733. type: String,
  7734. default: ""
  7735. },
  7736. disabled: {
  7737. type: Boolean,
  7738. default: false
  7739. },
  7740. role: {
  7741. type: String,
  7742. default: "menu"
  7743. },
  7744. buttonProps: {
  7745. type: definePropType(Object)
  7746. },
  7747. teleported: useTooltipContentProps.teleported
  7748. });
  7749. buildProps({
  7750. command: {
  7751. type: [Object, String, Number],
  7752. default: () => ({})
  7753. },
  7754. disabled: Boolean,
  7755. divided: Boolean,
  7756. textValue: String,
  7757. icon: {
  7758. type: iconPropType
  7759. }
  7760. });
  7761. buildProps({
  7762. onKeydown: { type: definePropType(Function) }
  7763. });
  7764. [
  7765. EVENT_CODE.down,
  7766. EVENT_CODE.pageDown,
  7767. EVENT_CODE.home
  7768. ];
  7769. [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  7770. createCollectionWithScope("Dropdown");
  7771. const popoverProps = buildProps({
  7772. trigger: useTooltipTriggerProps.trigger,
  7773. placement: dropdownProps.placement,
  7774. disabled: useTooltipTriggerProps.disabled,
  7775. visible: useTooltipContentProps.visible,
  7776. transition: useTooltipContentProps.transition,
  7777. popperOptions: dropdownProps.popperOptions,
  7778. tabindex: dropdownProps.tabindex,
  7779. content: useTooltipContentProps.content,
  7780. popperStyle: useTooltipContentProps.popperStyle,
  7781. popperClass: useTooltipContentProps.popperClass,
  7782. enterable: {
  7783. ...useTooltipContentProps.enterable,
  7784. default: true
  7785. },
  7786. effect: {
  7787. ...useTooltipContentProps.effect,
  7788. default: "light"
  7789. },
  7790. teleported: useTooltipContentProps.teleported,
  7791. title: String,
  7792. width: {
  7793. type: [String, Number],
  7794. default: 150
  7795. },
  7796. offset: {
  7797. type: Number,
  7798. default: void 0
  7799. },
  7800. showAfter: {
  7801. type: Number,
  7802. default: 0
  7803. },
  7804. hideAfter: {
  7805. type: Number,
  7806. default: 200
  7807. },
  7808. autoClose: {
  7809. type: Number,
  7810. default: 0
  7811. },
  7812. showArrow: {
  7813. type: Boolean,
  7814. default: true
  7815. },
  7816. persistent: {
  7817. type: Boolean,
  7818. default: true
  7819. },
  7820. "onUpdate:visible": {
  7821. type: Function
  7822. }
  7823. });
  7824. const popoverEmits = {
  7825. "update:visible": (value) => isBoolean(value),
  7826. "before-enter": () => true,
  7827. "before-leave": () => true,
  7828. "after-enter": () => true,
  7829. "after-leave": () => true
  7830. };
  7831. const updateEventKeyRaw = `onUpdate:visible`;
  7832. const __default__$1 = vue.defineComponent({
  7833. name: "ElPopover"
  7834. });
  7835. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  7836. ...__default__$1,
  7837. props: popoverProps,
  7838. emits: popoverEmits,
  7839. setup(__props, { expose, emit }) {
  7840. const props = __props;
  7841. const onUpdateVisible = vue.computed(() => {
  7842. return props[updateEventKeyRaw];
  7843. });
  7844. const ns = useNamespace("popover");
  7845. const tooltipRef = vue.ref();
  7846. const popperRef = vue.computed(() => {
  7847. var _a2;
  7848. return (_a2 = vue.unref(tooltipRef)) == null ? void 0 : _a2.popperRef;
  7849. });
  7850. const style2 = vue.computed(() => {
  7851. return [
  7852. {
  7853. width: addUnit(props.width)
  7854. },
  7855. props.popperStyle
  7856. ];
  7857. });
  7858. const kls = vue.computed(() => {
  7859. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  7860. });
  7861. const gpuAcceleration = vue.computed(() => {
  7862. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  7863. });
  7864. const hide = () => {
  7865. var _a2;
  7866. (_a2 = tooltipRef.value) == null ? void 0 : _a2.hide();
  7867. };
  7868. const beforeEnter = () => {
  7869. emit("before-enter");
  7870. };
  7871. const beforeLeave = () => {
  7872. emit("before-leave");
  7873. };
  7874. const afterEnter = () => {
  7875. emit("after-enter");
  7876. };
  7877. const afterLeave = () => {
  7878. emit("update:visible", false);
  7879. emit("after-leave");
  7880. };
  7881. expose({
  7882. popperRef,
  7883. hide
  7884. });
  7885. return (_ctx, _cache) => {
  7886. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  7887. ref_key: "tooltipRef",
  7888. ref: tooltipRef
  7889. }, _ctx.$attrs, {
  7890. trigger: _ctx.trigger,
  7891. placement: _ctx.placement,
  7892. disabled: _ctx.disabled,
  7893. visible: _ctx.visible,
  7894. transition: _ctx.transition,
  7895. "popper-options": _ctx.popperOptions,
  7896. tabindex: _ctx.tabindex,
  7897. content: _ctx.content,
  7898. offset: _ctx.offset,
  7899. "show-after": _ctx.showAfter,
  7900. "hide-after": _ctx.hideAfter,
  7901. "auto-close": _ctx.autoClose,
  7902. "show-arrow": _ctx.showArrow,
  7903. "aria-label": _ctx.title,
  7904. effect: _ctx.effect,
  7905. enterable: _ctx.enterable,
  7906. "popper-class": vue.unref(kls),
  7907. "popper-style": vue.unref(style2),
  7908. teleported: _ctx.teleported,
  7909. persistent: _ctx.persistent,
  7910. "gpu-acceleration": vue.unref(gpuAcceleration),
  7911. "onUpdate:visible": vue.unref(onUpdateVisible),
  7912. onBeforeShow: beforeEnter,
  7913. onBeforeHide: beforeLeave,
  7914. onShow: afterEnter,
  7915. onHide: afterLeave
  7916. }), {
  7917. content: vue.withCtx(() => [
  7918. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  7919. key: 0,
  7920. class: vue.normalizeClass(vue.unref(ns).e("title")),
  7921. role: "title"
  7922. }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true),
  7923. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  7924. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  7925. ])
  7926. ]),
  7927. default: vue.withCtx(() => [
  7928. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  7929. ]),
  7930. _: 3
  7931. }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]);
  7932. };
  7933. }
  7934. });
  7935. var Popover = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["__file", "popover.vue"]]);
  7936. const attachEvents = (el, binding) => {
  7937. const popperComponent = binding.arg || binding.value;
  7938. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  7939. if (popover) {
  7940. popover.triggerRef = el;
  7941. }
  7942. };
  7943. var PopoverDirective = {
  7944. mounted(el, binding) {
  7945. attachEvents(el, binding);
  7946. },
  7947. updated(el, binding) {
  7948. attachEvents(el, binding);
  7949. }
  7950. };
  7951. const VPopover = "popover";
  7952. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  7953. const ElPopover = withInstall(Popover, {
  7954. directive: ElPopoverDirective
  7955. });
  7956. const getCell = function(event) {
  7957. var _a2;
  7958. return (_a2 = event.target) == null ? void 0 : _a2.closest("td");
  7959. };
  7960. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  7961. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  7962. return array;
  7963. }
  7964. if (typeof reverse === "string") {
  7965. reverse = reverse === "descending" ? -1 : 1;
  7966. } else {
  7967. reverse = reverse && reverse < 0 ? -1 : 1;
  7968. }
  7969. const getKey = sortMethod ? null : function(value, index) {
  7970. if (sortBy) {
  7971. if (!Array.isArray(sortBy)) {
  7972. sortBy = [sortBy];
  7973. }
  7974. return sortBy.map((by) => {
  7975. if (typeof by === "string") {
  7976. return get(value, by);
  7977. } else {
  7978. return by(value, index, array);
  7979. }
  7980. });
  7981. }
  7982. if (sortKey !== "$key") {
  7983. if (isObject$1(value) && "$value" in value)
  7984. value = value.$value;
  7985. }
  7986. return [isObject$1(value) ? get(value, sortKey) : value];
  7987. };
  7988. const compare = function(a2, b2) {
  7989. if (sortMethod) {
  7990. return sortMethod(a2.value, b2.value);
  7991. }
  7992. for (let i = 0, len = a2.key.length; i < len; i++) {
  7993. if (a2.key[i] < b2.key[i]) {
  7994. return -1;
  7995. }
  7996. if (a2.key[i] > b2.key[i]) {
  7997. return 1;
  7998. }
  7999. }
  8000. return 0;
  8001. };
  8002. return array.map((value, index) => {
  8003. return {
  8004. value,
  8005. index,
  8006. key: getKey ? getKey(value, index) : null
  8007. };
  8008. }).sort((a2, b2) => {
  8009. let order = compare(a2, b2);
  8010. if (!order) {
  8011. order = a2.index - b2.index;
  8012. }
  8013. return order * +reverse;
  8014. }).map((item) => item.value);
  8015. };
  8016. const getColumnById = function(table, columnId) {
  8017. let column = null;
  8018. table.columns.forEach((item) => {
  8019. if (item.id === columnId) {
  8020. column = item;
  8021. }
  8022. });
  8023. return column;
  8024. };
  8025. const getColumnByKey = function(table, columnKey) {
  8026. let column = null;
  8027. for (let i = 0; i < table.columns.length; i++) {
  8028. const item = table.columns[i];
  8029. if (item.columnKey === columnKey) {
  8030. column = item;
  8031. break;
  8032. }
  8033. }
  8034. if (!column)
  8035. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  8036. return column;
  8037. };
  8038. const getColumnByCell = function(table, cell, namespace) {
  8039. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  8040. if (matches) {
  8041. return getColumnById(table, matches[0]);
  8042. }
  8043. return null;
  8044. };
  8045. const getRowIdentity = (row, rowKey) => {
  8046. if (!row)
  8047. throw new Error("Row is required when get row identity");
  8048. if (typeof rowKey === "string") {
  8049. if (!rowKey.includes(".")) {
  8050. return `${row[rowKey]}`;
  8051. }
  8052. const key = rowKey.split(".");
  8053. let current = row;
  8054. for (const element of key) {
  8055. current = current[element];
  8056. }
  8057. return `${current}`;
  8058. } else if (typeof rowKey === "function") {
  8059. return rowKey.call(null, row);
  8060. }
  8061. };
  8062. const getKeysMap = function(array, rowKey) {
  8063. const arrayMap2 = {};
  8064. (array || []).forEach((row, index) => {
  8065. arrayMap2[getRowIdentity(row, rowKey)] = { row, index };
  8066. });
  8067. return arrayMap2;
  8068. };
  8069. function mergeOptions(defaults, config) {
  8070. const options = {};
  8071. let key;
  8072. for (key in defaults) {
  8073. options[key] = defaults[key];
  8074. }
  8075. for (key in config) {
  8076. if (hasOwn(config, key)) {
  8077. const value = config[key];
  8078. if (typeof value !== "undefined") {
  8079. options[key] = value;
  8080. }
  8081. }
  8082. }
  8083. return options;
  8084. }
  8085. function parseWidth(width) {
  8086. if (width === "")
  8087. return width;
  8088. if (width !== void 0) {
  8089. width = Number.parseInt(width, 10);
  8090. if (Number.isNaN(width)) {
  8091. width = "";
  8092. }
  8093. }
  8094. return width;
  8095. }
  8096. function parseMinWidth(minWidth) {
  8097. if (minWidth === "")
  8098. return minWidth;
  8099. if (minWidth !== void 0) {
  8100. minWidth = parseWidth(minWidth);
  8101. if (Number.isNaN(minWidth)) {
  8102. minWidth = 80;
  8103. }
  8104. }
  8105. return minWidth;
  8106. }
  8107. function parseHeight(height) {
  8108. if (typeof height === "number") {
  8109. return height;
  8110. }
  8111. if (typeof height === "string") {
  8112. if (/^\d+(?:px)?$/.test(height)) {
  8113. return Number.parseInt(height, 10);
  8114. } else {
  8115. return height;
  8116. }
  8117. }
  8118. return null;
  8119. }
  8120. function compose(...funcs) {
  8121. if (funcs.length === 0) {
  8122. return (arg) => arg;
  8123. }
  8124. if (funcs.length === 1) {
  8125. return funcs[0];
  8126. }
  8127. return funcs.reduce((a2, b2) => (...args) => a2(b2(...args)));
  8128. }
  8129. function toggleRowStatus(statusArr, row, newVal) {
  8130. let changed = false;
  8131. const index = statusArr.indexOf(row);
  8132. const included = index !== -1;
  8133. const toggleStatus = (type) => {
  8134. if (type === "add") {
  8135. statusArr.push(row);
  8136. } else {
  8137. statusArr.splice(index, 1);
  8138. }
  8139. changed = true;
  8140. if (isArray$2(row.children)) {
  8141. row.children.forEach((item) => {
  8142. toggleRowStatus(statusArr, item, newVal != null ? newVal : !included);
  8143. });
  8144. }
  8145. };
  8146. if (isBoolean(newVal)) {
  8147. if (newVal && !included) {
  8148. toggleStatus("add");
  8149. } else if (!newVal && included) {
  8150. toggleStatus("remove");
  8151. }
  8152. } else {
  8153. included ? toggleStatus("remove") : toggleStatus("add");
  8154. }
  8155. return changed;
  8156. }
  8157. function walkTreeNode(root2, cb, childrenKey = "children", lazyKey = "hasChildren") {
  8158. const isNil2 = (array) => !(Array.isArray(array) && array.length);
  8159. function _walker(parent, children, level) {
  8160. cb(parent, children, level);
  8161. children.forEach((item) => {
  8162. if (item[lazyKey]) {
  8163. cb(item, null, level + 1);
  8164. return;
  8165. }
  8166. const children2 = item[childrenKey];
  8167. if (!isNil2(children2)) {
  8168. _walker(item, children2, level + 1);
  8169. }
  8170. });
  8171. }
  8172. root2.forEach((item) => {
  8173. if (item[lazyKey]) {
  8174. cb(item, null, 0);
  8175. return;
  8176. }
  8177. const children = item[childrenKey];
  8178. if (!isNil2(children)) {
  8179. _walker(item, children, 0);
  8180. }
  8181. });
  8182. }
  8183. let removePopper = null;
  8184. function createTablePopper(props, popperContent, trigger, table) {
  8185. if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
  8186. return;
  8187. }
  8188. removePopper == null ? void 0 : removePopper();
  8189. const parentNode = table == null ? void 0 : table.refs.tableWrapper;
  8190. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  8191. const popperOptions = {
  8192. strategy: "fixed",
  8193. ...props.popperOptions
  8194. };
  8195. const vm = vue.createVNode(ElTooltip, {
  8196. content: popperContent,
  8197. virtualTriggering: true,
  8198. virtualRef: trigger,
  8199. appendTo: parentNode,
  8200. placement: "top",
  8201. transition: "none",
  8202. offset: 0,
  8203. hideAfter: 0,
  8204. ...props,
  8205. popperOptions,
  8206. onHide: () => {
  8207. removePopper == null ? void 0 : removePopper();
  8208. }
  8209. });
  8210. vm.appContext = { ...table.appContext, ...table };
  8211. const container = document.createElement("div");
  8212. vue.render(vm, container);
  8213. vm.component.exposed.onOpen();
  8214. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  8215. removePopper = () => {
  8216. vue.render(null, container);
  8217. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  8218. removePopper = null;
  8219. };
  8220. removePopper.trigger = trigger;
  8221. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  8222. }
  8223. function getCurrentColumns(column) {
  8224. if (column.children) {
  8225. return flatMap(column.children, getCurrentColumns);
  8226. } else {
  8227. return [column];
  8228. }
  8229. }
  8230. function getColSpan(colSpan, column) {
  8231. return colSpan + column.colSpan;
  8232. }
  8233. const isFixedColumn = (index, fixed, store, realColumns) => {
  8234. let start = 0;
  8235. let after = index;
  8236. const columns = store.states.columns.value;
  8237. if (realColumns) {
  8238. const curColumns = getCurrentColumns(realColumns[index]);
  8239. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  8240. start = preColumns.reduce(getColSpan, 0);
  8241. after = start + curColumns.reduce(getColSpan, 0) - 1;
  8242. } else {
  8243. start = index;
  8244. }
  8245. let fixedLayout;
  8246. switch (fixed) {
  8247. case "left":
  8248. if (after < store.states.fixedLeafColumnsLength.value) {
  8249. fixedLayout = "left";
  8250. }
  8251. break;
  8252. case "right":
  8253. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  8254. fixedLayout = "right";
  8255. }
  8256. break;
  8257. default:
  8258. if (after < store.states.fixedLeafColumnsLength.value) {
  8259. fixedLayout = "left";
  8260. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  8261. fixedLayout = "right";
  8262. }
  8263. }
  8264. return fixedLayout ? {
  8265. direction: fixedLayout,
  8266. start,
  8267. after
  8268. } : {};
  8269. };
  8270. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  8271. const classes = [];
  8272. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  8273. if (direction) {
  8274. const isLeft = direction === "left";
  8275. classes.push(`${namespace}-fixed-column--${direction}`);
  8276. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  8277. classes.push("is-last-column");
  8278. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  8279. classes.push("is-first-column");
  8280. }
  8281. }
  8282. return classes;
  8283. };
  8284. function getOffset(offset, column) {
  8285. return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  8286. }
  8287. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  8288. const {
  8289. direction,
  8290. start = 0,
  8291. after = 0
  8292. } = isFixedColumn(index, fixed, store, realColumns);
  8293. if (!direction) {
  8294. return;
  8295. }
  8296. const styles = {};
  8297. const isLeft = direction === "left";
  8298. const columns = store.states.columns.value;
  8299. if (isLeft) {
  8300. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  8301. } else {
  8302. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  8303. }
  8304. return styles;
  8305. };
  8306. const ensurePosition = (style2, key) => {
  8307. if (!style2)
  8308. return;
  8309. if (!Number.isNaN(style2[key])) {
  8310. style2[key] = `${style2[key]}px`;
  8311. }
  8312. };
  8313. function useExpand(watcherData) {
  8314. const instance = vue.getCurrentInstance();
  8315. const defaultExpandAll = vue.ref(false);
  8316. const expandRows = vue.ref([]);
  8317. const updateExpandRows = () => {
  8318. const data = watcherData.data.value || [];
  8319. const rowKey = watcherData.rowKey.value;
  8320. if (defaultExpandAll.value) {
  8321. expandRows.value = data.slice();
  8322. } else if (rowKey) {
  8323. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  8324. expandRows.value = data.reduce((prev, row) => {
  8325. const rowId = getRowIdentity(row, rowKey);
  8326. const rowInfo = expandRowsMap[rowId];
  8327. if (rowInfo) {
  8328. prev.push(row);
  8329. }
  8330. return prev;
  8331. }, []);
  8332. } else {
  8333. expandRows.value = [];
  8334. }
  8335. };
  8336. const toggleRowExpansion = (row, expanded) => {
  8337. const changed = toggleRowStatus(expandRows.value, row, expanded);
  8338. if (changed) {
  8339. instance.emit("expand-change", row, expandRows.value.slice());
  8340. }
  8341. };
  8342. const setExpandRowKeys = (rowKeys) => {
  8343. instance.store.assertRowKey();
  8344. const data = watcherData.data.value || [];
  8345. const rowKey = watcherData.rowKey.value;
  8346. const keysMap = getKeysMap(data, rowKey);
  8347. expandRows.value = rowKeys.reduce((prev, cur) => {
  8348. const info = keysMap[cur];
  8349. if (info) {
  8350. prev.push(info.row);
  8351. }
  8352. return prev;
  8353. }, []);
  8354. };
  8355. const isRowExpanded = (row) => {
  8356. const rowKey = watcherData.rowKey.value;
  8357. if (rowKey) {
  8358. const expandMap = getKeysMap(expandRows.value, rowKey);
  8359. return !!expandMap[getRowIdentity(row, rowKey)];
  8360. }
  8361. return expandRows.value.includes(row);
  8362. };
  8363. return {
  8364. updateExpandRows,
  8365. toggleRowExpansion,
  8366. setExpandRowKeys,
  8367. isRowExpanded,
  8368. states: {
  8369. expandRows,
  8370. defaultExpandAll
  8371. }
  8372. };
  8373. }
  8374. function useCurrent(watcherData) {
  8375. const instance = vue.getCurrentInstance();
  8376. const _currentRowKey = vue.ref(null);
  8377. const currentRow = vue.ref(null);
  8378. const setCurrentRowKey = (key) => {
  8379. instance.store.assertRowKey();
  8380. _currentRowKey.value = key;
  8381. setCurrentRowByKey(key);
  8382. };
  8383. const restoreCurrentRowKey = () => {
  8384. _currentRowKey.value = null;
  8385. };
  8386. const setCurrentRowByKey = (key) => {
  8387. const { data, rowKey } = watcherData;
  8388. let _currentRow = null;
  8389. if (rowKey.value) {
  8390. _currentRow = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  8391. }
  8392. currentRow.value = _currentRow;
  8393. instance.emit("current-change", currentRow.value, null);
  8394. };
  8395. const updateCurrentRow = (_currentRow) => {
  8396. const oldCurrentRow = currentRow.value;
  8397. if (_currentRow && _currentRow !== oldCurrentRow) {
  8398. currentRow.value = _currentRow;
  8399. instance.emit("current-change", currentRow.value, oldCurrentRow);
  8400. return;
  8401. }
  8402. if (!_currentRow && oldCurrentRow) {
  8403. currentRow.value = null;
  8404. instance.emit("current-change", null, oldCurrentRow);
  8405. }
  8406. };
  8407. const updateCurrentRowData = () => {
  8408. const rowKey = watcherData.rowKey.value;
  8409. const data = watcherData.data.value || [];
  8410. const oldCurrentRow = currentRow.value;
  8411. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  8412. if (rowKey) {
  8413. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  8414. setCurrentRowByKey(currentRowKey);
  8415. } else {
  8416. currentRow.value = null;
  8417. }
  8418. if (currentRow.value === null) {
  8419. instance.emit("current-change", null, oldCurrentRow);
  8420. }
  8421. } else if (_currentRowKey.value) {
  8422. setCurrentRowByKey(_currentRowKey.value);
  8423. restoreCurrentRowKey();
  8424. }
  8425. };
  8426. return {
  8427. setCurrentRowKey,
  8428. restoreCurrentRowKey,
  8429. setCurrentRowByKey,
  8430. updateCurrentRow,
  8431. updateCurrentRowData,
  8432. states: {
  8433. _currentRowKey,
  8434. currentRow
  8435. }
  8436. };
  8437. }
  8438. function useTree(watcherData) {
  8439. const expandRowKeys = vue.ref([]);
  8440. const treeData = vue.ref({});
  8441. const indent = vue.ref(16);
  8442. const lazy = vue.ref(false);
  8443. const lazyTreeNodeMap = vue.ref({});
  8444. const lazyColumnIdentifier = vue.ref("hasChildren");
  8445. const childrenColumnName = vue.ref("children");
  8446. const instance = vue.getCurrentInstance();
  8447. const normalizedData = vue.computed(() => {
  8448. if (!watcherData.rowKey.value)
  8449. return {};
  8450. const data = watcherData.data.value || [];
  8451. return normalize(data);
  8452. });
  8453. const normalizedLazyNode = vue.computed(() => {
  8454. const rowKey = watcherData.rowKey.value;
  8455. const keys2 = Object.keys(lazyTreeNodeMap.value);
  8456. const res = {};
  8457. if (!keys2.length)
  8458. return res;
  8459. keys2.forEach((key) => {
  8460. if (lazyTreeNodeMap.value[key].length) {
  8461. const item = { children: [] };
  8462. lazyTreeNodeMap.value[key].forEach((row) => {
  8463. const currentRowKey = getRowIdentity(row, rowKey);
  8464. item.children.push(currentRowKey);
  8465. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  8466. res[currentRowKey] = { children: [] };
  8467. }
  8468. });
  8469. res[key] = item;
  8470. }
  8471. });
  8472. return res;
  8473. });
  8474. const normalize = (data) => {
  8475. const rowKey = watcherData.rowKey.value;
  8476. const res = {};
  8477. walkTreeNode(data, (parent, children, level) => {
  8478. const parentId = getRowIdentity(parent, rowKey);
  8479. if (Array.isArray(children)) {
  8480. res[parentId] = {
  8481. children: children.map((row) => getRowIdentity(row, rowKey)),
  8482. level
  8483. };
  8484. } else if (lazy.value) {
  8485. res[parentId] = {
  8486. children: [],
  8487. lazy: true,
  8488. level
  8489. };
  8490. }
  8491. }, childrenColumnName.value, lazyColumnIdentifier.value);
  8492. return res;
  8493. };
  8494. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a2) => (_a2 = instance.store) == null ? void 0 : _a2.states.defaultExpandAll.value)()) => {
  8495. var _a2;
  8496. const nested = normalizedData.value;
  8497. const normalizedLazyNode_ = normalizedLazyNode.value;
  8498. const keys2 = Object.keys(nested);
  8499. const newTreeData = {};
  8500. if (keys2.length) {
  8501. const oldTreeData = vue.unref(treeData);
  8502. const rootLazyRowKeys = [];
  8503. const getExpanded = (oldValue, key) => {
  8504. if (ifChangeExpandRowKeys) {
  8505. if (expandRowKeys.value) {
  8506. return ifExpandAll || expandRowKeys.value.includes(key);
  8507. } else {
  8508. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  8509. }
  8510. } else {
  8511. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  8512. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  8513. }
  8514. };
  8515. keys2.forEach((key) => {
  8516. const oldValue = oldTreeData[key];
  8517. const newValue = { ...nested[key] };
  8518. newValue.expanded = getExpanded(oldValue, key);
  8519. if (newValue.lazy) {
  8520. const { loaded = false, loading = false } = oldValue || {};
  8521. newValue.loaded = !!loaded;
  8522. newValue.loading = !!loading;
  8523. rootLazyRowKeys.push(key);
  8524. }
  8525. newTreeData[key] = newValue;
  8526. });
  8527. const lazyKeys = Object.keys(normalizedLazyNode_);
  8528. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  8529. lazyKeys.forEach((key) => {
  8530. const oldValue = oldTreeData[key];
  8531. const lazyNodeChildren = normalizedLazyNode_[key].children;
  8532. if (rootLazyRowKeys.includes(key)) {
  8533. if (newTreeData[key].children.length !== 0) {
  8534. throw new Error("[ElTable]children must be an empty array.");
  8535. }
  8536. newTreeData[key].children = lazyNodeChildren;
  8537. } else {
  8538. const { loaded = false, loading = false } = oldValue || {};
  8539. newTreeData[key] = {
  8540. lazy: true,
  8541. loaded: !!loaded,
  8542. loading: !!loading,
  8543. expanded: getExpanded(oldValue, key),
  8544. children: lazyNodeChildren,
  8545. level: ""
  8546. };
  8547. }
  8548. });
  8549. }
  8550. }
  8551. treeData.value = newTreeData;
  8552. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  8553. };
  8554. vue.watch(() => expandRowKeys.value, () => {
  8555. updateTreeData(true);
  8556. });
  8557. vue.watch(() => normalizedData.value, () => {
  8558. updateTreeData();
  8559. });
  8560. vue.watch(() => normalizedLazyNode.value, () => {
  8561. updateTreeData();
  8562. });
  8563. const updateTreeExpandKeys = (value) => {
  8564. expandRowKeys.value = value;
  8565. updateTreeData();
  8566. };
  8567. const toggleTreeExpansion = (row, expanded) => {
  8568. instance.store.assertRowKey();
  8569. const rowKey = watcherData.rowKey.value;
  8570. const id = getRowIdentity(row, rowKey);
  8571. const data = id && treeData.value[id];
  8572. if (id && data && "expanded" in data) {
  8573. const oldExpanded = data.expanded;
  8574. expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
  8575. treeData.value[id].expanded = expanded;
  8576. if (oldExpanded !== expanded) {
  8577. instance.emit("expand-change", row, expanded);
  8578. }
  8579. instance.store.updateTableScrollY();
  8580. }
  8581. };
  8582. const loadOrToggle = (row) => {
  8583. instance.store.assertRowKey();
  8584. const rowKey = watcherData.rowKey.value;
  8585. const id = getRowIdentity(row, rowKey);
  8586. const data = treeData.value[id];
  8587. if (lazy.value && data && "loaded" in data && !data.loaded) {
  8588. loadData(row, id, data);
  8589. } else {
  8590. toggleTreeExpansion(row, void 0);
  8591. }
  8592. };
  8593. const loadData = (row, key, treeNode) => {
  8594. const { load } = instance.props;
  8595. if (load && !treeData.value[key].loaded) {
  8596. treeData.value[key].loading = true;
  8597. load(row, treeNode, (data) => {
  8598. if (!Array.isArray(data)) {
  8599. throw new TypeError("[ElTable] data must be an array");
  8600. }
  8601. treeData.value[key].loading = false;
  8602. treeData.value[key].loaded = true;
  8603. treeData.value[key].expanded = true;
  8604. if (data.length) {
  8605. lazyTreeNodeMap.value[key] = data;
  8606. }
  8607. instance.emit("expand-change", row, true);
  8608. });
  8609. }
  8610. };
  8611. return {
  8612. loadData,
  8613. loadOrToggle,
  8614. toggleTreeExpansion,
  8615. updateTreeExpandKeys,
  8616. updateTreeData,
  8617. normalize,
  8618. states: {
  8619. expandRowKeys,
  8620. treeData,
  8621. indent,
  8622. lazy,
  8623. lazyTreeNodeMap,
  8624. lazyColumnIdentifier,
  8625. childrenColumnName
  8626. }
  8627. };
  8628. }
  8629. const sortData = (data, states) => {
  8630. const sortingColumn = states.sortingColumn;
  8631. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  8632. return data;
  8633. }
  8634. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  8635. };
  8636. const doFlattenColumns = (columns) => {
  8637. const result = [];
  8638. columns.forEach((column) => {
  8639. if (column.children && column.children.length > 0) {
  8640. result.push.apply(result, doFlattenColumns(column.children));
  8641. } else {
  8642. result.push(column);
  8643. }
  8644. });
  8645. return result;
  8646. };
  8647. function useWatcher$1() {
  8648. var _a2;
  8649. const instance = vue.getCurrentInstance();
  8650. const { size: tableSize } = vue.toRefs((_a2 = instance.proxy) == null ? void 0 : _a2.$props);
  8651. const rowKey = vue.ref(null);
  8652. const data = vue.ref([]);
  8653. const _data = vue.ref([]);
  8654. const isComplex = vue.ref(false);
  8655. const _columns = vue.ref([]);
  8656. const originColumns = vue.ref([]);
  8657. const columns = vue.ref([]);
  8658. const fixedColumns = vue.ref([]);
  8659. const rightFixedColumns = vue.ref([]);
  8660. const leafColumns = vue.ref([]);
  8661. const fixedLeafColumns = vue.ref([]);
  8662. const rightFixedLeafColumns = vue.ref([]);
  8663. const updateOrderFns = [];
  8664. const leafColumnsLength = vue.ref(0);
  8665. const fixedLeafColumnsLength = vue.ref(0);
  8666. const rightFixedLeafColumnsLength = vue.ref(0);
  8667. const isAllSelected = vue.ref(false);
  8668. const selection = vue.ref([]);
  8669. const reserveSelection = vue.ref(false);
  8670. const selectOnIndeterminate = vue.ref(false);
  8671. const selectable = vue.ref(null);
  8672. const filters = vue.ref({});
  8673. const filteredData = vue.ref(null);
  8674. const sortingColumn = vue.ref(null);
  8675. const sortProp = vue.ref(null);
  8676. const sortOrder = vue.ref(null);
  8677. const hoverRow = vue.ref(null);
  8678. vue.watch(data, () => instance.state && scheduleLayout(false), {
  8679. deep: true
  8680. });
  8681. const assertRowKey = () => {
  8682. if (!rowKey.value)
  8683. throw new Error("[ElTable] prop row-key is required");
  8684. };
  8685. const updateChildFixed = (column) => {
  8686. var _a22;
  8687. (_a22 = column.children) == null ? void 0 : _a22.forEach((childColumn) => {
  8688. childColumn.fixed = column.fixed;
  8689. updateChildFixed(childColumn);
  8690. });
  8691. };
  8692. const updateColumns = () => {
  8693. _columns.value.forEach((column) => {
  8694. updateChildFixed(column);
  8695. });
  8696. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  8697. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  8698. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  8699. _columns.value[0].fixed = true;
  8700. fixedColumns.value.unshift(_columns.value[0]);
  8701. }
  8702. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  8703. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  8704. const leafColumns2 = doFlattenColumns(notFixedColumns);
  8705. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  8706. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  8707. leafColumnsLength.value = leafColumns2.length;
  8708. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  8709. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  8710. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  8711. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  8712. };
  8713. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  8714. if (needUpdateColumns) {
  8715. updateColumns();
  8716. }
  8717. if (immediate) {
  8718. instance.state.doLayout();
  8719. } else {
  8720. instance.state.debouncedUpdateLayout();
  8721. }
  8722. };
  8723. const isSelected = (row) => {
  8724. return selection.value.includes(row);
  8725. };
  8726. const clearSelection = () => {
  8727. isAllSelected.value = false;
  8728. const oldSelection = selection.value;
  8729. selection.value = [];
  8730. if (oldSelection.length) {
  8731. instance.emit("selection-change", []);
  8732. }
  8733. };
  8734. const cleanSelection = () => {
  8735. let deleted;
  8736. if (rowKey.value) {
  8737. deleted = [];
  8738. const selectedMap = getKeysMap(selection.value, rowKey.value);
  8739. const dataMap = getKeysMap(data.value, rowKey.value);
  8740. for (const key in selectedMap) {
  8741. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  8742. deleted.push(selectedMap[key].row);
  8743. }
  8744. }
  8745. } else {
  8746. deleted = selection.value.filter((item) => !data.value.includes(item));
  8747. }
  8748. if (deleted.length) {
  8749. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  8750. selection.value = newSelection;
  8751. instance.emit("selection-change", newSelection.slice());
  8752. }
  8753. };
  8754. const getSelectionRows = () => {
  8755. return (selection.value || []).slice();
  8756. };
  8757. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  8758. const changed = toggleRowStatus(selection.value, row, selected);
  8759. if (changed) {
  8760. const newSelection = (selection.value || []).slice();
  8761. if (emitChange) {
  8762. instance.emit("select", newSelection, row);
  8763. }
  8764. instance.emit("selection-change", newSelection);
  8765. }
  8766. };
  8767. const _toggleAllSelection = () => {
  8768. var _a22, _b;
  8769. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  8770. isAllSelected.value = value;
  8771. let selectionChanged = false;
  8772. let childrenCount = 0;
  8773. const rowKey2 = (_b = (_a22 = instance == null ? void 0 : instance.store) == null ? void 0 : _a22.states) == null ? void 0 : _b.rowKey.value;
  8774. data.value.forEach((row, index) => {
  8775. const rowIndex = index + childrenCount;
  8776. if (selectable.value) {
  8777. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  8778. selectionChanged = true;
  8779. }
  8780. } else {
  8781. if (toggleRowStatus(selection.value, row, value)) {
  8782. selectionChanged = true;
  8783. }
  8784. }
  8785. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  8786. });
  8787. if (selectionChanged) {
  8788. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  8789. }
  8790. instance.emit("select-all", (selection.value || []).slice());
  8791. };
  8792. const updateSelectionByRowKey = () => {
  8793. const selectedMap = getKeysMap(selection.value, rowKey.value);
  8794. data.value.forEach((row) => {
  8795. const rowId = getRowIdentity(row, rowKey.value);
  8796. const rowInfo = selectedMap[rowId];
  8797. if (rowInfo) {
  8798. selection.value[rowInfo.index] = row;
  8799. }
  8800. });
  8801. };
  8802. const updateAllSelected = () => {
  8803. var _a22, _b, _c;
  8804. if (((_a22 = data.value) == null ? void 0 : _a22.length) === 0) {
  8805. isAllSelected.value = false;
  8806. return;
  8807. }
  8808. let selectedMap;
  8809. if (rowKey.value) {
  8810. selectedMap = getKeysMap(selection.value, rowKey.value);
  8811. }
  8812. const isSelected2 = function(row) {
  8813. if (selectedMap) {
  8814. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  8815. } else {
  8816. return selection.value.includes(row);
  8817. }
  8818. };
  8819. let isAllSelected_ = true;
  8820. let selectedCount = 0;
  8821. let childrenCount = 0;
  8822. for (let i = 0, j = (data.value || []).length; i < j; i++) {
  8823. const keyProp = (_c = (_b = instance == null ? void 0 : instance.store) == null ? void 0 : _b.states) == null ? void 0 : _c.rowKey.value;
  8824. const rowIndex = i + childrenCount;
  8825. const item = data.value[i];
  8826. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  8827. if (!isSelected2(item)) {
  8828. if (!selectable.value || isRowSelectable) {
  8829. isAllSelected_ = false;
  8830. break;
  8831. }
  8832. } else {
  8833. selectedCount++;
  8834. }
  8835. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  8836. }
  8837. if (selectedCount === 0)
  8838. isAllSelected_ = false;
  8839. isAllSelected.value = isAllSelected_;
  8840. };
  8841. const getChildrenCount = (rowKey2) => {
  8842. var _a22;
  8843. if (!instance || !instance.store)
  8844. return 0;
  8845. const { treeData } = instance.store.states;
  8846. let count = 0;
  8847. const children = (_a22 = treeData.value[rowKey2]) == null ? void 0 : _a22.children;
  8848. if (children) {
  8849. count += children.length;
  8850. children.forEach((childKey) => {
  8851. count += getChildrenCount(childKey);
  8852. });
  8853. }
  8854. return count;
  8855. };
  8856. const updateFilters = (columns2, values) => {
  8857. if (!Array.isArray(columns2)) {
  8858. columns2 = [columns2];
  8859. }
  8860. const filters_ = {};
  8861. columns2.forEach((col) => {
  8862. filters.value[col.id] = values;
  8863. filters_[col.columnKey || col.id] = values;
  8864. });
  8865. return filters_;
  8866. };
  8867. const updateSort = (column, prop, order) => {
  8868. if (sortingColumn.value && sortingColumn.value !== column) {
  8869. sortingColumn.value.order = null;
  8870. }
  8871. sortingColumn.value = column;
  8872. sortProp.value = prop;
  8873. sortOrder.value = order;
  8874. };
  8875. const execFilter = () => {
  8876. let sourceData = vue.unref(_data);
  8877. Object.keys(filters.value).forEach((columnId) => {
  8878. const values = filters.value[columnId];
  8879. if (!values || values.length === 0)
  8880. return;
  8881. const column = getColumnById({
  8882. columns: columns.value
  8883. }, columnId);
  8884. if (column && column.filterMethod) {
  8885. sourceData = sourceData.filter((row) => {
  8886. return values.some((value) => column.filterMethod.call(null, value, row, column));
  8887. });
  8888. }
  8889. });
  8890. filteredData.value = sourceData;
  8891. };
  8892. const execSort = () => {
  8893. data.value = sortData(filteredData.value, {
  8894. sortingColumn: sortingColumn.value,
  8895. sortProp: sortProp.value,
  8896. sortOrder: sortOrder.value
  8897. });
  8898. };
  8899. const execQuery = (ignore = void 0) => {
  8900. if (!(ignore && ignore.filter)) {
  8901. execFilter();
  8902. }
  8903. execSort();
  8904. };
  8905. const clearFilter = (columnKeys) => {
  8906. const { tableHeaderRef } = instance.refs;
  8907. if (!tableHeaderRef)
  8908. return;
  8909. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  8910. const keys2 = Object.keys(panels);
  8911. if (!keys2.length)
  8912. return;
  8913. if (typeof columnKeys === "string") {
  8914. columnKeys = [columnKeys];
  8915. }
  8916. if (Array.isArray(columnKeys)) {
  8917. const columns_ = columnKeys.map((key) => getColumnByKey({
  8918. columns: columns.value
  8919. }, key));
  8920. keys2.forEach((key) => {
  8921. const column = columns_.find((col) => col.id === key);
  8922. if (column) {
  8923. column.filteredValue = [];
  8924. }
  8925. });
  8926. instance.store.commit("filterChange", {
  8927. column: columns_,
  8928. values: [],
  8929. silent: true,
  8930. multi: true
  8931. });
  8932. } else {
  8933. keys2.forEach((key) => {
  8934. const column = columns.value.find((col) => col.id === key);
  8935. if (column) {
  8936. column.filteredValue = [];
  8937. }
  8938. });
  8939. filters.value = {};
  8940. instance.store.commit("filterChange", {
  8941. column: {},
  8942. values: [],
  8943. silent: true
  8944. });
  8945. }
  8946. };
  8947. const clearSort = () => {
  8948. if (!sortingColumn.value)
  8949. return;
  8950. updateSort(null, null, null);
  8951. instance.store.commit("changeSortCondition", {
  8952. silent: true
  8953. });
  8954. };
  8955. const {
  8956. setExpandRowKeys,
  8957. toggleRowExpansion,
  8958. updateExpandRows,
  8959. states: expandStates,
  8960. isRowExpanded
  8961. } = useExpand({
  8962. data,
  8963. rowKey
  8964. });
  8965. const {
  8966. updateTreeExpandKeys,
  8967. toggleTreeExpansion,
  8968. updateTreeData,
  8969. loadOrToggle,
  8970. states: treeStates
  8971. } = useTree({
  8972. data,
  8973. rowKey
  8974. });
  8975. const {
  8976. updateCurrentRowData,
  8977. updateCurrentRow,
  8978. setCurrentRowKey,
  8979. states: currentData
  8980. } = useCurrent({
  8981. data,
  8982. rowKey
  8983. });
  8984. const setExpandRowKeysAdapter = (val) => {
  8985. setExpandRowKeys(val);
  8986. updateTreeExpandKeys(val);
  8987. };
  8988. const toggleRowExpansionAdapter = (row, expanded) => {
  8989. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  8990. if (hasExpandColumn) {
  8991. toggleRowExpansion(row, expanded);
  8992. } else {
  8993. toggleTreeExpansion(row, expanded);
  8994. }
  8995. };
  8996. return {
  8997. assertRowKey,
  8998. updateColumns,
  8999. scheduleLayout,
  9000. isSelected,
  9001. clearSelection,
  9002. cleanSelection,
  9003. getSelectionRows,
  9004. toggleRowSelection,
  9005. _toggleAllSelection,
  9006. toggleAllSelection: null,
  9007. updateSelectionByRowKey,
  9008. updateAllSelected,
  9009. updateFilters,
  9010. updateCurrentRow,
  9011. updateSort,
  9012. execFilter,
  9013. execSort,
  9014. execQuery,
  9015. clearFilter,
  9016. clearSort,
  9017. toggleRowExpansion,
  9018. setExpandRowKeysAdapter,
  9019. setCurrentRowKey,
  9020. toggleRowExpansionAdapter,
  9021. isRowExpanded,
  9022. updateExpandRows,
  9023. updateCurrentRowData,
  9024. loadOrToggle,
  9025. updateTreeData,
  9026. states: {
  9027. tableSize,
  9028. rowKey,
  9029. data,
  9030. _data,
  9031. isComplex,
  9032. _columns,
  9033. originColumns,
  9034. columns,
  9035. fixedColumns,
  9036. rightFixedColumns,
  9037. leafColumns,
  9038. fixedLeafColumns,
  9039. rightFixedLeafColumns,
  9040. updateOrderFns,
  9041. leafColumnsLength,
  9042. fixedLeafColumnsLength,
  9043. rightFixedLeafColumnsLength,
  9044. isAllSelected,
  9045. selection,
  9046. reserveSelection,
  9047. selectOnIndeterminate,
  9048. selectable,
  9049. filters,
  9050. filteredData,
  9051. sortingColumn,
  9052. sortProp,
  9053. sortOrder,
  9054. hoverRow,
  9055. ...expandStates,
  9056. ...treeStates,
  9057. ...currentData
  9058. }
  9059. };
  9060. }
  9061. function replaceColumn(array, column) {
  9062. return array.map((item) => {
  9063. var _a2;
  9064. if (item.id === column.id) {
  9065. return column;
  9066. } else if ((_a2 = item.children) == null ? void 0 : _a2.length) {
  9067. item.children = replaceColumn(item.children, column);
  9068. }
  9069. return item;
  9070. });
  9071. }
  9072. function sortColumn(array) {
  9073. array.forEach((item) => {
  9074. var _a2, _b;
  9075. item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
  9076. if ((_b = item.children) == null ? void 0 : _b.length) {
  9077. sortColumn(item.children);
  9078. }
  9079. });
  9080. array.sort((cur, pre) => cur.no - pre.no);
  9081. }
  9082. function useStore() {
  9083. const instance = vue.getCurrentInstance();
  9084. const watcher = useWatcher$1();
  9085. const ns = useNamespace("table");
  9086. const mutations = {
  9087. setData(states, data) {
  9088. const dataInstanceChanged = vue.unref(states._data) !== data;
  9089. states.data.value = data;
  9090. states._data.value = data;
  9091. instance.store.execQuery();
  9092. instance.store.updateCurrentRowData();
  9093. instance.store.updateExpandRows();
  9094. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  9095. if (vue.unref(states.reserveSelection)) {
  9096. instance.store.assertRowKey();
  9097. instance.store.updateSelectionByRowKey();
  9098. } else {
  9099. if (dataInstanceChanged) {
  9100. instance.store.clearSelection();
  9101. } else {
  9102. instance.store.cleanSelection();
  9103. }
  9104. }
  9105. instance.store.updateAllSelected();
  9106. if (instance.$ready) {
  9107. instance.store.scheduleLayout();
  9108. }
  9109. },
  9110. insertColumn(states, column, parent, updateColumnOrder) {
  9111. const array = vue.unref(states._columns);
  9112. let newColumns = [];
  9113. if (!parent) {
  9114. array.push(column);
  9115. newColumns = array;
  9116. } else {
  9117. if (parent && !parent.children) {
  9118. parent.children = [];
  9119. }
  9120. parent.children.push(column);
  9121. newColumns = replaceColumn(array, parent);
  9122. }
  9123. sortColumn(newColumns);
  9124. states._columns.value = newColumns;
  9125. states.updateOrderFns.push(updateColumnOrder);
  9126. if (column.type === "selection") {
  9127. states.selectable.value = column.selectable;
  9128. states.reserveSelection.value = column.reserveSelection;
  9129. }
  9130. if (instance.$ready) {
  9131. instance.store.updateColumns();
  9132. instance.store.scheduleLayout();
  9133. }
  9134. },
  9135. updateColumnOrder(states, column) {
  9136. var _a2;
  9137. const newColumnIndex = (_a2 = column.getColumnIndex) == null ? void 0 : _a2.call(column);
  9138. if (newColumnIndex === column.no)
  9139. return;
  9140. sortColumn(states._columns.value);
  9141. if (instance.$ready) {
  9142. instance.store.updateColumns();
  9143. }
  9144. },
  9145. removeColumn(states, column, parent, updateColumnOrder) {
  9146. const array = vue.unref(states._columns) || [];
  9147. if (parent) {
  9148. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  9149. vue.nextTick(() => {
  9150. var _a2;
  9151. if (((_a2 = parent.children) == null ? void 0 : _a2.length) === 0) {
  9152. delete parent.children;
  9153. }
  9154. });
  9155. states._columns.value = replaceColumn(array, parent);
  9156. } else {
  9157. const index = array.indexOf(column);
  9158. if (index > -1) {
  9159. array.splice(index, 1);
  9160. states._columns.value = array;
  9161. }
  9162. }
  9163. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  9164. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  9165. if (instance.$ready) {
  9166. instance.store.updateColumns();
  9167. instance.store.scheduleLayout();
  9168. }
  9169. },
  9170. sort(states, options) {
  9171. const { prop, order, init } = options;
  9172. if (prop) {
  9173. const column = vue.unref(states.columns).find((column2) => column2.property === prop);
  9174. if (column) {
  9175. column.order = order;
  9176. instance.store.updateSort(column, prop, order);
  9177. instance.store.commit("changeSortCondition", { init });
  9178. }
  9179. }
  9180. },
  9181. changeSortCondition(states, options) {
  9182. const { sortingColumn, sortProp, sortOrder } = states;
  9183. const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder);
  9184. if (orderValue === null) {
  9185. states.sortingColumn.value = null;
  9186. states.sortProp.value = null;
  9187. }
  9188. const ignore = { filter: true };
  9189. instance.store.execQuery(ignore);
  9190. if (!options || !(options.silent || options.init)) {
  9191. instance.emit("sort-change", {
  9192. column: columnValue,
  9193. prop: propValue,
  9194. order: orderValue
  9195. });
  9196. }
  9197. instance.store.updateTableScrollY();
  9198. },
  9199. filterChange(_states, options) {
  9200. const { column, values, silent } = options;
  9201. const newFilters = instance.store.updateFilters(column, values);
  9202. instance.store.execQuery();
  9203. if (!silent) {
  9204. instance.emit("filter-change", newFilters);
  9205. }
  9206. instance.store.updateTableScrollY();
  9207. },
  9208. toggleAllSelection() {
  9209. instance.store.toggleAllSelection();
  9210. },
  9211. rowSelectedChanged(_states, row) {
  9212. instance.store.toggleRowSelection(row);
  9213. instance.store.updateAllSelected();
  9214. },
  9215. setHoverRow(states, row) {
  9216. states.hoverRow.value = row;
  9217. },
  9218. setCurrentRow(_states, row) {
  9219. instance.store.updateCurrentRow(row);
  9220. }
  9221. };
  9222. const commit = function(name, ...args) {
  9223. const mutations2 = instance.store.mutations;
  9224. if (mutations2[name]) {
  9225. mutations2[name].apply(instance, [instance.store.states].concat(args));
  9226. } else {
  9227. throw new Error(`Action not found: ${name}`);
  9228. }
  9229. };
  9230. const updateTableScrollY = function() {
  9231. vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  9232. };
  9233. return {
  9234. ns,
  9235. ...watcher,
  9236. mutations,
  9237. commit,
  9238. updateTableScrollY
  9239. };
  9240. }
  9241. const InitialStateMap = {
  9242. rowKey: "rowKey",
  9243. defaultExpandAll: "defaultExpandAll",
  9244. selectOnIndeterminate: "selectOnIndeterminate",
  9245. indent: "indent",
  9246. lazy: "lazy",
  9247. data: "data",
  9248. ["treeProps.hasChildren"]: {
  9249. key: "lazyColumnIdentifier",
  9250. default: "hasChildren"
  9251. },
  9252. ["treeProps.children"]: {
  9253. key: "childrenColumnName",
  9254. default: "children"
  9255. }
  9256. };
  9257. function createStore(table, props) {
  9258. if (!table) {
  9259. throw new Error("Table is required.");
  9260. }
  9261. const store = useStore();
  9262. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  9263. Object.keys(InitialStateMap).forEach((key) => {
  9264. handleValue(getArrKeysValue(props, key), key, store);
  9265. });
  9266. proxyTableProps(store, props);
  9267. return store;
  9268. }
  9269. function proxyTableProps(store, props) {
  9270. Object.keys(InitialStateMap).forEach((key) => {
  9271. vue.watch(() => getArrKeysValue(props, key), (value) => {
  9272. handleValue(value, key, store);
  9273. });
  9274. });
  9275. }
  9276. function handleValue(value, propsKey, store) {
  9277. let newVal = value;
  9278. let storeKey = InitialStateMap[propsKey];
  9279. if (typeof InitialStateMap[propsKey] === "object") {
  9280. storeKey = storeKey.key;
  9281. newVal = newVal || InitialStateMap[propsKey].default;
  9282. }
  9283. store.states[storeKey].value = newVal;
  9284. }
  9285. function getArrKeysValue(props, keys2) {
  9286. if (keys2.includes(".")) {
  9287. const keyList = keys2.split(".");
  9288. let value = props;
  9289. keyList.forEach((key) => {
  9290. value = value[key];
  9291. });
  9292. return value;
  9293. } else {
  9294. return props[keys2];
  9295. }
  9296. }
  9297. class TableLayout {
  9298. constructor(options) {
  9299. this.observers = [];
  9300. this.table = null;
  9301. this.store = null;
  9302. this.columns = [];
  9303. this.fit = true;
  9304. this.showHeader = true;
  9305. this.height = vue.ref(null);
  9306. this.scrollX = vue.ref(false);
  9307. this.scrollY = vue.ref(false);
  9308. this.bodyWidth = vue.ref(null);
  9309. this.fixedWidth = vue.ref(null);
  9310. this.rightFixedWidth = vue.ref(null);
  9311. this.gutterWidth = 0;
  9312. for (const name in options) {
  9313. if (hasOwn(options, name)) {
  9314. if (vue.isRef(this[name])) {
  9315. this[name].value = options[name];
  9316. } else {
  9317. this[name] = options[name];
  9318. }
  9319. }
  9320. }
  9321. if (!this.table) {
  9322. throw new Error("Table is required for Table Layout");
  9323. }
  9324. if (!this.store) {
  9325. throw new Error("Store is required for Table Layout");
  9326. }
  9327. }
  9328. updateScrollY() {
  9329. const height = this.height.value;
  9330. if (height === null)
  9331. return false;
  9332. const scrollBarRef = this.table.refs.scrollBarRef;
  9333. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  9334. let scrollY = true;
  9335. const prevScrollY = this.scrollY.value;
  9336. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  9337. this.scrollY.value = scrollY;
  9338. return prevScrollY !== scrollY;
  9339. }
  9340. return false;
  9341. }
  9342. setHeight(value, prop = "height") {
  9343. if (!isClient)
  9344. return;
  9345. const el = this.table.vnode.el;
  9346. value = parseHeight(value);
  9347. this.height.value = Number(value);
  9348. if (!el && (value || value === 0))
  9349. return vue.nextTick(() => this.setHeight(value, prop));
  9350. if (typeof value === "number") {
  9351. el.style[prop] = `${value}px`;
  9352. this.updateElsHeight();
  9353. } else if (typeof value === "string") {
  9354. el.style[prop] = value;
  9355. this.updateElsHeight();
  9356. }
  9357. }
  9358. setMaxHeight(value) {
  9359. this.setHeight(value, "max-height");
  9360. }
  9361. getFlattenColumns() {
  9362. const flattenColumns = [];
  9363. const columns = this.table.store.states.columns.value;
  9364. columns.forEach((column) => {
  9365. if (column.isColumnGroup) {
  9366. flattenColumns.push.apply(flattenColumns, column.columns);
  9367. } else {
  9368. flattenColumns.push(column);
  9369. }
  9370. });
  9371. return flattenColumns;
  9372. }
  9373. updateElsHeight() {
  9374. this.updateScrollY();
  9375. this.notifyObservers("scrollable");
  9376. }
  9377. headerDisplayNone(elm) {
  9378. if (!elm)
  9379. return true;
  9380. let headerChild = elm;
  9381. while (headerChild.tagName !== "DIV") {
  9382. if (getComputedStyle(headerChild).display === "none") {
  9383. return true;
  9384. }
  9385. headerChild = headerChild.parentElement;
  9386. }
  9387. return false;
  9388. }
  9389. updateColumnsWidth() {
  9390. if (!isClient)
  9391. return;
  9392. const fit = this.fit;
  9393. const bodyWidth = this.table.vnode.el.clientWidth;
  9394. let bodyMinWidth = 0;
  9395. const flattenColumns = this.getFlattenColumns();
  9396. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  9397. flattenColumns.forEach((column) => {
  9398. if (typeof column.width === "number" && column.realWidth)
  9399. column.realWidth = null;
  9400. });
  9401. if (flexColumns.length > 0 && fit) {
  9402. flattenColumns.forEach((column) => {
  9403. bodyMinWidth += Number(column.width || column.minWidth || 80);
  9404. });
  9405. if (bodyMinWidth <= bodyWidth) {
  9406. this.scrollX.value = false;
  9407. const totalFlexWidth = bodyWidth - bodyMinWidth;
  9408. if (flexColumns.length === 1) {
  9409. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  9410. } else {
  9411. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  9412. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  9413. let noneFirstWidth = 0;
  9414. flexColumns.forEach((column, index) => {
  9415. if (index === 0)
  9416. return;
  9417. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  9418. noneFirstWidth += flexWidth;
  9419. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  9420. });
  9421. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  9422. }
  9423. } else {
  9424. this.scrollX.value = true;
  9425. flexColumns.forEach((column) => {
  9426. column.realWidth = Number(column.minWidth);
  9427. });
  9428. }
  9429. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  9430. this.table.state.resizeState.value.width = this.bodyWidth.value;
  9431. } else {
  9432. flattenColumns.forEach((column) => {
  9433. if (!column.width && !column.minWidth) {
  9434. column.realWidth = 80;
  9435. } else {
  9436. column.realWidth = Number(column.width || column.minWidth);
  9437. }
  9438. bodyMinWidth += column.realWidth;
  9439. });
  9440. this.scrollX.value = bodyMinWidth > bodyWidth;
  9441. this.bodyWidth.value = bodyMinWidth;
  9442. }
  9443. const fixedColumns = this.store.states.fixedColumns.value;
  9444. if (fixedColumns.length > 0) {
  9445. let fixedWidth = 0;
  9446. fixedColumns.forEach((column) => {
  9447. fixedWidth += Number(column.realWidth || column.width);
  9448. });
  9449. this.fixedWidth.value = fixedWidth;
  9450. }
  9451. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  9452. if (rightFixedColumns.length > 0) {
  9453. let rightFixedWidth = 0;
  9454. rightFixedColumns.forEach((column) => {
  9455. rightFixedWidth += Number(column.realWidth || column.width);
  9456. });
  9457. this.rightFixedWidth.value = rightFixedWidth;
  9458. }
  9459. this.notifyObservers("columns");
  9460. }
  9461. addObserver(observer) {
  9462. this.observers.push(observer);
  9463. }
  9464. removeObserver(observer) {
  9465. const index = this.observers.indexOf(observer);
  9466. if (index !== -1) {
  9467. this.observers.splice(index, 1);
  9468. }
  9469. }
  9470. notifyObservers(event) {
  9471. const observers = this.observers;
  9472. observers.forEach((observer) => {
  9473. var _a2, _b;
  9474. switch (event) {
  9475. case "columns":
  9476. (_a2 = observer.state) == null ? void 0 : _a2.onColumnsChange(this);
  9477. break;
  9478. case "scrollable":
  9479. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  9480. break;
  9481. default:
  9482. throw new Error(`Table Layout don't have event ${event}.`);
  9483. }
  9484. });
  9485. }
  9486. }
  9487. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  9488. const _sfc_main$3 = vue.defineComponent({
  9489. name: "ElTableFilterPanel",
  9490. components: {
  9491. ElCheckbox,
  9492. ElCheckboxGroup,
  9493. ElScrollbar,
  9494. ElTooltip,
  9495. ElIcon,
  9496. ArrowDown: arrow_down_default,
  9497. ArrowUp: arrow_up_default
  9498. },
  9499. directives: { ClickOutside },
  9500. props: {
  9501. placement: {
  9502. type: String,
  9503. default: "bottom-start"
  9504. },
  9505. store: {
  9506. type: Object
  9507. },
  9508. column: {
  9509. type: Object
  9510. },
  9511. upDataColumn: {
  9512. type: Function
  9513. }
  9514. },
  9515. setup(props) {
  9516. const instance = vue.getCurrentInstance();
  9517. const { t } = useLocale();
  9518. const ns = useNamespace("table-filter");
  9519. const parent = instance == null ? void 0 : instance.parent;
  9520. if (!parent.filterPanels.value[props.column.id]) {
  9521. parent.filterPanels.value[props.column.id] = instance;
  9522. }
  9523. const tooltipVisible = vue.ref(false);
  9524. const tooltip = vue.ref(null);
  9525. const filters = vue.computed(() => {
  9526. return props.column && props.column.filters;
  9527. });
  9528. const filterClassName = vue.computed(() => {
  9529. if (props.column.filterClassName) {
  9530. return `${ns.b()} ${props.column.filterClassName}`;
  9531. }
  9532. return ns.b();
  9533. });
  9534. const filterValue = vue.computed({
  9535. get: () => {
  9536. var _a2;
  9537. return (((_a2 = props.column) == null ? void 0 : _a2.filteredValue) || [])[0];
  9538. },
  9539. set: (value) => {
  9540. if (filteredValue.value) {
  9541. if (typeof value !== "undefined" && value !== null) {
  9542. filteredValue.value.splice(0, 1, value);
  9543. } else {
  9544. filteredValue.value.splice(0, 1);
  9545. }
  9546. }
  9547. }
  9548. });
  9549. const filteredValue = vue.computed({
  9550. get() {
  9551. if (props.column) {
  9552. return props.column.filteredValue || [];
  9553. }
  9554. return [];
  9555. },
  9556. set(value) {
  9557. if (props.column) {
  9558. props.upDataColumn("filteredValue", value);
  9559. }
  9560. }
  9561. });
  9562. const multiple = vue.computed(() => {
  9563. if (props.column) {
  9564. return props.column.filterMultiple;
  9565. }
  9566. return true;
  9567. });
  9568. const isActive = (filter) => {
  9569. return filter.value === filterValue.value;
  9570. };
  9571. const hidden = () => {
  9572. tooltipVisible.value = false;
  9573. };
  9574. const showFilterPanel = (e) => {
  9575. e.stopPropagation();
  9576. tooltipVisible.value = !tooltipVisible.value;
  9577. };
  9578. const hideFilterPanel = () => {
  9579. tooltipVisible.value = false;
  9580. };
  9581. const handleConfirm = () => {
  9582. confirmFilter(filteredValue.value);
  9583. hidden();
  9584. };
  9585. const handleReset = () => {
  9586. filteredValue.value = [];
  9587. confirmFilter(filteredValue.value);
  9588. hidden();
  9589. };
  9590. const handleSelect = (_filterValue) => {
  9591. filterValue.value = _filterValue;
  9592. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  9593. confirmFilter(filteredValue.value);
  9594. } else {
  9595. confirmFilter([]);
  9596. }
  9597. hidden();
  9598. };
  9599. const confirmFilter = (filteredValue2) => {
  9600. props.store.commit("filterChange", {
  9601. column: props.column,
  9602. values: filteredValue2
  9603. });
  9604. props.store.updateAllSelected();
  9605. };
  9606. vue.watch(tooltipVisible, (value) => {
  9607. if (props.column) {
  9608. props.upDataColumn("filterOpened", value);
  9609. }
  9610. }, {
  9611. immediate: true
  9612. });
  9613. const popperPaneRef = vue.computed(() => {
  9614. var _a2, _b;
  9615. return (_b = (_a2 = tooltip.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
  9616. });
  9617. return {
  9618. tooltipVisible,
  9619. multiple,
  9620. filterClassName,
  9621. filteredValue,
  9622. filterValue,
  9623. filters,
  9624. handleConfirm,
  9625. handleReset,
  9626. handleSelect,
  9627. isActive,
  9628. t,
  9629. ns,
  9630. showFilterPanel,
  9631. hideFilterPanel,
  9632. popperPaneRef,
  9633. tooltip
  9634. };
  9635. }
  9636. });
  9637. const _hoisted_1$3 = { key: 0 };
  9638. const _hoisted_2$3 = ["disabled"];
  9639. const _hoisted_3 = ["label", "onClick"];
  9640. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  9641. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  9642. const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
  9643. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  9644. const _component_arrow_up = vue.resolveComponent("arrow-up");
  9645. const _component_arrow_down = vue.resolveComponent("arrow-down");
  9646. const _component_el_icon = vue.resolveComponent("el-icon");
  9647. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  9648. const _directive_click_outside = vue.resolveDirective("click-outside");
  9649. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  9650. ref: "tooltip",
  9651. visible: _ctx.tooltipVisible,
  9652. offset: 0,
  9653. placement: _ctx.placement,
  9654. "show-arrow": false,
  9655. "stop-popper-mouse-event": false,
  9656. teleported: "",
  9657. effect: "light",
  9658. pure: "",
  9659. "popper-class": _ctx.filterClassName,
  9660. persistent: ""
  9661. }, {
  9662. content: vue.withCtx(() => [
  9663. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
  9664. vue.createElementVNode("div", {
  9665. class: vue.normalizeClass(_ctx.ns.e("content"))
  9666. }, [
  9667. vue.createVNode(_component_el_scrollbar, {
  9668. "wrap-class": _ctx.ns.e("wrap")
  9669. }, {
  9670. default: vue.withCtx(() => [
  9671. vue.createVNode(_component_el_checkbox_group, {
  9672. modelValue: _ctx.filteredValue,
  9673. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  9674. class: vue.normalizeClass(_ctx.ns.e("checkbox-group"))
  9675. }, {
  9676. default: vue.withCtx(() => [
  9677. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  9678. return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  9679. key: filter.value,
  9680. value: filter.value
  9681. }, {
  9682. default: vue.withCtx(() => [
  9683. vue.createTextVNode(vue.toDisplayString(filter.text), 1)
  9684. ]),
  9685. _: 2
  9686. }, 1032, ["value"]);
  9687. }), 128))
  9688. ]),
  9689. _: 1
  9690. }, 8, ["modelValue", "class"])
  9691. ]),
  9692. _: 1
  9693. }, 8, ["wrap-class"])
  9694. ], 2),
  9695. vue.createElementVNode("div", {
  9696. class: vue.normalizeClass(_ctx.ns.e("bottom"))
  9697. }, [
  9698. vue.createElementVNode("button", {
  9699. class: vue.normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  9700. disabled: _ctx.filteredValue.length === 0,
  9701. type: "button",
  9702. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  9703. }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$3),
  9704. vue.createElementVNode("button", {
  9705. type: "button",
  9706. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  9707. }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  9708. ], 2)
  9709. ])) : (vue.openBlock(), vue.createElementBlock("ul", {
  9710. key: 1,
  9711. class: vue.normalizeClass(_ctx.ns.e("list"))
  9712. }, [
  9713. vue.createElementVNode("li", {
  9714. class: vue.normalizeClass([
  9715. _ctx.ns.e("list-item"),
  9716. {
  9717. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  9718. }
  9719. ]),
  9720. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  9721. }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  9722. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  9723. return vue.openBlock(), vue.createElementBlock("li", {
  9724. key: filter.value,
  9725. class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  9726. label: filter.value,
  9727. onClick: ($event) => _ctx.handleSelect(filter.value)
  9728. }, vue.toDisplayString(filter.text), 11, _hoisted_3);
  9729. }), 128))
  9730. ], 2))
  9731. ]),
  9732. default: vue.withCtx(() => [
  9733. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  9734. class: vue.normalizeClass([
  9735. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  9736. `${_ctx.ns.namespace.value}-none-outline`
  9737. ]),
  9738. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  9739. }, [
  9740. vue.createVNode(_component_el_icon, null, {
  9741. default: vue.withCtx(() => [
  9742. _ctx.column.filterOpened ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 }))
  9743. ]),
  9744. _: 1
  9745. })
  9746. ], 2)), [
  9747. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  9748. ])
  9749. ]),
  9750. _: 1
  9751. }, 8, ["visible", "placement", "popper-class"]);
  9752. }
  9753. var FilterPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["render", _sfc_render$1], ["__file", "filter-panel.vue"]]);
  9754. function useLayoutObserver(root2) {
  9755. const instance = vue.getCurrentInstance();
  9756. vue.onBeforeMount(() => {
  9757. tableLayout.value.addObserver(instance);
  9758. });
  9759. vue.onMounted(() => {
  9760. onColumnsChange(tableLayout.value);
  9761. onScrollableChange(tableLayout.value);
  9762. });
  9763. vue.onUpdated(() => {
  9764. onColumnsChange(tableLayout.value);
  9765. onScrollableChange(tableLayout.value);
  9766. });
  9767. vue.onUnmounted(() => {
  9768. tableLayout.value.removeObserver(instance);
  9769. });
  9770. const tableLayout = vue.computed(() => {
  9771. const layout = root2.layout;
  9772. if (!layout) {
  9773. throw new Error("Can not find table layout.");
  9774. }
  9775. return layout;
  9776. });
  9777. const onColumnsChange = (layout) => {
  9778. var _a2;
  9779. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col")) || [];
  9780. if (!cols.length)
  9781. return;
  9782. const flattenColumns = layout.getFlattenColumns();
  9783. const columnsMap = {};
  9784. flattenColumns.forEach((column) => {
  9785. columnsMap[column.id] = column;
  9786. });
  9787. for (let i = 0, j = cols.length; i < j; i++) {
  9788. const col = cols[i];
  9789. const name = col.getAttribute("name");
  9790. const column = columnsMap[name];
  9791. if (column) {
  9792. col.setAttribute("width", column.realWidth || column.width);
  9793. }
  9794. }
  9795. };
  9796. const onScrollableChange = (layout) => {
  9797. var _a2, _b;
  9798. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col[name=gutter]")) || [];
  9799. for (let i = 0, j = cols.length; i < j; i++) {
  9800. const col = cols[i];
  9801. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  9802. }
  9803. const ths = ((_b = root2.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  9804. for (let i = 0, j = ths.length; i < j; i++) {
  9805. const th = ths[i];
  9806. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  9807. th.style.display = layout.scrollY.value ? "" : "none";
  9808. }
  9809. };
  9810. return {
  9811. tableLayout: tableLayout.value,
  9812. onColumnsChange,
  9813. onScrollableChange
  9814. };
  9815. }
  9816. const TABLE_INJECTION_KEY = Symbol("ElTable");
  9817. function useEvent(props, emit) {
  9818. const instance = vue.getCurrentInstance();
  9819. const parent = vue.inject(TABLE_INJECTION_KEY);
  9820. const handleFilterClick = (event) => {
  9821. event.stopPropagation();
  9822. return;
  9823. };
  9824. const handleHeaderClick = (event, column) => {
  9825. if (!column.filters && column.sortable) {
  9826. handleSortClick(event, column, false);
  9827. } else if (column.filterable && !column.sortable) {
  9828. handleFilterClick(event);
  9829. }
  9830. parent == null ? void 0 : parent.emit("header-click", column, event);
  9831. };
  9832. const handleHeaderContextMenu = (event, column) => {
  9833. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  9834. };
  9835. const draggingColumn = vue.ref(null);
  9836. const dragging = vue.ref(false);
  9837. const dragState = vue.ref({});
  9838. const handleMouseDown = (event, column) => {
  9839. if (!isClient)
  9840. return;
  9841. if (column.children && column.children.length > 0)
  9842. return;
  9843. if (draggingColumn.value && props.border) {
  9844. dragging.value = true;
  9845. const table = parent;
  9846. emit("set-drag-visible", true);
  9847. const tableEl = table == null ? void 0 : table.vnode.el;
  9848. const tableLeft = tableEl.getBoundingClientRect().left;
  9849. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  9850. const columnRect = columnEl.getBoundingClientRect();
  9851. const minLeft = columnRect.left - tableLeft + 30;
  9852. addClass(columnEl, "noclick");
  9853. dragState.value = {
  9854. startMouseLeft: event.clientX,
  9855. startLeft: columnRect.right - tableLeft,
  9856. startColumnLeft: columnRect.left - tableLeft,
  9857. tableLeft
  9858. };
  9859. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  9860. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  9861. document.onselectstart = function() {
  9862. return false;
  9863. };
  9864. document.ondragstart = function() {
  9865. return false;
  9866. };
  9867. const handleMouseMove2 = (event2) => {
  9868. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  9869. const proxyLeft = dragState.value.startLeft + deltaLeft;
  9870. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  9871. };
  9872. const handleMouseUp = () => {
  9873. if (dragging.value) {
  9874. const { startColumnLeft, startLeft } = dragState.value;
  9875. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  9876. const columnWidth = finalLeft - startColumnLeft;
  9877. column.width = column.realWidth = columnWidth;
  9878. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  9879. requestAnimationFrame(() => {
  9880. props.store.scheduleLayout(false, true);
  9881. });
  9882. document.body.style.cursor = "";
  9883. dragging.value = false;
  9884. draggingColumn.value = null;
  9885. dragState.value = {};
  9886. emit("set-drag-visible", false);
  9887. }
  9888. document.removeEventListener("mousemove", handleMouseMove2);
  9889. document.removeEventListener("mouseup", handleMouseUp);
  9890. document.onselectstart = null;
  9891. document.ondragstart = null;
  9892. setTimeout(() => {
  9893. removeClass(columnEl, "noclick");
  9894. }, 0);
  9895. };
  9896. document.addEventListener("mousemove", handleMouseMove2);
  9897. document.addEventListener("mouseup", handleMouseUp);
  9898. }
  9899. };
  9900. const handleMouseMove = (event, column) => {
  9901. if (column.children && column.children.length > 0)
  9902. return;
  9903. const el = event.target;
  9904. if (!isElement(el)) {
  9905. return;
  9906. }
  9907. const target = el == null ? void 0 : el.closest("th");
  9908. if (!column || !column.resizable)
  9909. return;
  9910. if (!dragging.value && props.border) {
  9911. const rect = target.getBoundingClientRect();
  9912. const bodyStyle = document.body.style;
  9913. if (rect.width > 12 && rect.right - event.pageX < 8) {
  9914. bodyStyle.cursor = "col-resize";
  9915. if (hasClass(target, "is-sortable")) {
  9916. target.style.cursor = "col-resize";
  9917. }
  9918. draggingColumn.value = column;
  9919. } else if (!dragging.value) {
  9920. bodyStyle.cursor = "";
  9921. if (hasClass(target, "is-sortable")) {
  9922. target.style.cursor = "pointer";
  9923. }
  9924. draggingColumn.value = null;
  9925. }
  9926. }
  9927. };
  9928. const handleMouseOut = () => {
  9929. if (!isClient)
  9930. return;
  9931. document.body.style.cursor = "";
  9932. };
  9933. const toggleOrder = ({ order, sortOrders }) => {
  9934. if (order === "")
  9935. return sortOrders[0];
  9936. const index = sortOrders.indexOf(order || null);
  9937. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  9938. };
  9939. const handleSortClick = (event, column, givenOrder) => {
  9940. var _a2;
  9941. event.stopPropagation();
  9942. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  9943. const target = (_a2 = event.target) == null ? void 0 : _a2.closest("th");
  9944. if (target) {
  9945. if (hasClass(target, "noclick")) {
  9946. removeClass(target, "noclick");
  9947. return;
  9948. }
  9949. }
  9950. if (!column.sortable)
  9951. return;
  9952. const states = props.store.states;
  9953. let sortProp = states.sortProp.value;
  9954. let sortOrder;
  9955. const sortingColumn = states.sortingColumn.value;
  9956. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  9957. if (sortingColumn) {
  9958. sortingColumn.order = null;
  9959. }
  9960. states.sortingColumn.value = column;
  9961. sortProp = column.property;
  9962. }
  9963. if (!order) {
  9964. sortOrder = column.order = null;
  9965. } else {
  9966. sortOrder = column.order = order;
  9967. }
  9968. states.sortProp.value = sortProp;
  9969. states.sortOrder.value = sortOrder;
  9970. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  9971. };
  9972. return {
  9973. handleHeaderClick,
  9974. handleHeaderContextMenu,
  9975. handleMouseDown,
  9976. handleMouseMove,
  9977. handleMouseOut,
  9978. handleSortClick,
  9979. handleFilterClick
  9980. };
  9981. }
  9982. function useStyle$2(props) {
  9983. const parent = vue.inject(TABLE_INJECTION_KEY);
  9984. const ns = useNamespace("table");
  9985. const getHeaderRowStyle = (rowIndex) => {
  9986. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  9987. if (typeof headerRowStyle === "function") {
  9988. return headerRowStyle.call(null, { rowIndex });
  9989. }
  9990. return headerRowStyle;
  9991. };
  9992. const getHeaderRowClass = (rowIndex) => {
  9993. const classes = [];
  9994. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  9995. if (typeof headerRowClassName === "string") {
  9996. classes.push(headerRowClassName);
  9997. } else if (typeof headerRowClassName === "function") {
  9998. classes.push(headerRowClassName.call(null, { rowIndex }));
  9999. }
  10000. return classes.join(" ");
  10001. };
  10002. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  10003. var _a2;
  10004. let headerCellStyles = (_a2 = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a2 : {};
  10005. if (typeof headerCellStyles === "function") {
  10006. headerCellStyles = headerCellStyles.call(null, {
  10007. rowIndex,
  10008. columnIndex,
  10009. row,
  10010. column
  10011. });
  10012. }
  10013. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  10014. ensurePosition(fixedStyle, "left");
  10015. ensurePosition(fixedStyle, "right");
  10016. return Object.assign({}, headerCellStyles, fixedStyle);
  10017. };
  10018. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  10019. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  10020. const classes = [
  10021. column.id,
  10022. column.order,
  10023. column.headerAlign,
  10024. column.className,
  10025. column.labelClassName,
  10026. ...fixedClasses
  10027. ];
  10028. if (!column.children) {
  10029. classes.push("is-leaf");
  10030. }
  10031. if (column.sortable) {
  10032. classes.push("is-sortable");
  10033. }
  10034. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  10035. if (typeof headerCellClassName === "string") {
  10036. classes.push(headerCellClassName);
  10037. } else if (typeof headerCellClassName === "function") {
  10038. classes.push(headerCellClassName.call(null, {
  10039. rowIndex,
  10040. columnIndex,
  10041. row,
  10042. column
  10043. }));
  10044. }
  10045. classes.push(ns.e("cell"));
  10046. return classes.filter((className) => Boolean(className)).join(" ");
  10047. };
  10048. return {
  10049. getHeaderRowStyle,
  10050. getHeaderRowClass,
  10051. getHeaderCellStyle,
  10052. getHeaderCellClass
  10053. };
  10054. }
  10055. const getAllColumns = (columns) => {
  10056. const result = [];
  10057. columns.forEach((column) => {
  10058. if (column.children) {
  10059. result.push(column);
  10060. result.push.apply(result, getAllColumns(column.children));
  10061. } else {
  10062. result.push(column);
  10063. }
  10064. });
  10065. return result;
  10066. };
  10067. const convertToRows = (originColumns) => {
  10068. let maxLevel = 1;
  10069. const traverse = (column, parent) => {
  10070. if (parent) {
  10071. column.level = parent.level + 1;
  10072. if (maxLevel < column.level) {
  10073. maxLevel = column.level;
  10074. }
  10075. }
  10076. if (column.children) {
  10077. let colSpan = 0;
  10078. column.children.forEach((subColumn) => {
  10079. traverse(subColumn, column);
  10080. colSpan += subColumn.colSpan;
  10081. });
  10082. column.colSpan = colSpan;
  10083. } else {
  10084. column.colSpan = 1;
  10085. }
  10086. };
  10087. originColumns.forEach((column) => {
  10088. column.level = 1;
  10089. traverse(column, void 0);
  10090. });
  10091. const rows = [];
  10092. for (let i = 0; i < maxLevel; i++) {
  10093. rows.push([]);
  10094. }
  10095. const allColumns = getAllColumns(originColumns);
  10096. allColumns.forEach((column) => {
  10097. if (!column.children) {
  10098. column.rowSpan = maxLevel - column.level + 1;
  10099. } else {
  10100. column.rowSpan = 1;
  10101. column.children.forEach((col) => col.isSubColumn = true);
  10102. }
  10103. rows[column.level - 1].push(column);
  10104. });
  10105. return rows;
  10106. };
  10107. function useUtils$1(props) {
  10108. const parent = vue.inject(TABLE_INJECTION_KEY);
  10109. const columnRows = vue.computed(() => {
  10110. return convertToRows(props.store.states.originColumns.value);
  10111. });
  10112. const isGroup = vue.computed(() => {
  10113. const result = columnRows.value.length > 1;
  10114. if (result && parent) {
  10115. parent.state.isGroup.value = true;
  10116. }
  10117. return result;
  10118. });
  10119. const toggleAllSelection = (event) => {
  10120. event.stopPropagation();
  10121. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  10122. };
  10123. return {
  10124. isGroup,
  10125. toggleAllSelection,
  10126. columnRows
  10127. };
  10128. }
  10129. var TableHeader = vue.defineComponent({
  10130. name: "ElTableHeader",
  10131. components: {
  10132. ElCheckbox
  10133. },
  10134. props: {
  10135. fixed: {
  10136. type: String,
  10137. default: ""
  10138. },
  10139. store: {
  10140. required: true,
  10141. type: Object
  10142. },
  10143. border: Boolean,
  10144. defaultSort: {
  10145. type: Object,
  10146. default: () => {
  10147. return {
  10148. prop: "",
  10149. order: ""
  10150. };
  10151. }
  10152. }
  10153. },
  10154. setup(props, { emit }) {
  10155. const instance = vue.getCurrentInstance();
  10156. const parent = vue.inject(TABLE_INJECTION_KEY);
  10157. const ns = useNamespace("table");
  10158. const filterPanels = vue.ref({});
  10159. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  10160. vue.onMounted(async () => {
  10161. await vue.nextTick();
  10162. await vue.nextTick();
  10163. const { prop, order } = props.defaultSort;
  10164. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  10165. });
  10166. const {
  10167. handleHeaderClick,
  10168. handleHeaderContextMenu,
  10169. handleMouseDown,
  10170. handleMouseMove,
  10171. handleMouseOut,
  10172. handleSortClick,
  10173. handleFilterClick
  10174. } = useEvent(props, emit);
  10175. const {
  10176. getHeaderRowStyle,
  10177. getHeaderRowClass,
  10178. getHeaderCellStyle,
  10179. getHeaderCellClass
  10180. } = useStyle$2(props);
  10181. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  10182. instance.state = {
  10183. onColumnsChange,
  10184. onScrollableChange
  10185. };
  10186. instance.filterPanels = filterPanels;
  10187. return {
  10188. ns,
  10189. filterPanels,
  10190. onColumnsChange,
  10191. onScrollableChange,
  10192. columnRows,
  10193. getHeaderRowClass,
  10194. getHeaderRowStyle,
  10195. getHeaderCellClass,
  10196. getHeaderCellStyle,
  10197. handleHeaderClick,
  10198. handleHeaderContextMenu,
  10199. handleMouseDown,
  10200. handleMouseMove,
  10201. handleMouseOut,
  10202. handleSortClick,
  10203. handleFilterClick,
  10204. isGroup,
  10205. toggleAllSelection
  10206. };
  10207. },
  10208. render() {
  10209. const {
  10210. ns,
  10211. isGroup,
  10212. columnRows,
  10213. getHeaderCellStyle,
  10214. getHeaderCellClass,
  10215. getHeaderRowClass,
  10216. getHeaderRowStyle,
  10217. handleHeaderClick,
  10218. handleHeaderContextMenu,
  10219. handleMouseDown,
  10220. handleMouseMove,
  10221. handleSortClick,
  10222. handleMouseOut,
  10223. store,
  10224. $parent
  10225. } = this;
  10226. let rowSpan = 1;
  10227. return vue.h("thead", {
  10228. class: { [ns.is("group")]: isGroup }
  10229. }, columnRows.map((subColumns, rowIndex) => vue.h("tr", {
  10230. class: getHeaderRowClass(rowIndex),
  10231. key: rowIndex,
  10232. style: getHeaderRowStyle(rowIndex)
  10233. }, subColumns.map((column, cellIndex) => {
  10234. if (column.rowSpan > rowSpan) {
  10235. rowSpan = column.rowSpan;
  10236. }
  10237. return vue.h("th", {
  10238. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  10239. colspan: column.colSpan,
  10240. key: `${column.id}-thead`,
  10241. rowspan: column.rowSpan,
  10242. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  10243. onClick: ($event) => handleHeaderClick($event, column),
  10244. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  10245. onMousedown: ($event) => handleMouseDown($event, column),
  10246. onMousemove: ($event) => handleMouseMove($event, column),
  10247. onMouseout: handleMouseOut
  10248. }, [
  10249. vue.h("div", {
  10250. class: [
  10251. "cell",
  10252. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  10253. ]
  10254. }, [
  10255. column.renderHeader ? column.renderHeader({
  10256. column,
  10257. $index: cellIndex,
  10258. store,
  10259. _self: $parent
  10260. }) : column.label,
  10261. column.sortable && vue.h("span", {
  10262. onClick: ($event) => handleSortClick($event, column),
  10263. class: "caret-wrapper"
  10264. }, [
  10265. vue.h("i", {
  10266. onClick: ($event) => handleSortClick($event, column, "ascending"),
  10267. class: "sort-caret ascending"
  10268. }),
  10269. vue.h("i", {
  10270. onClick: ($event) => handleSortClick($event, column, "descending"),
  10271. class: "sort-caret descending"
  10272. })
  10273. ]),
  10274. column.filterable && vue.h(FilterPanel, {
  10275. store,
  10276. placement: column.filterPlacement || "bottom-start",
  10277. column,
  10278. upDataColumn: (key, value) => {
  10279. column[key] = value;
  10280. }
  10281. })
  10282. ])
  10283. ]);
  10284. }))));
  10285. }
  10286. });
  10287. function useEvents(props) {
  10288. const parent = vue.inject(TABLE_INJECTION_KEY);
  10289. const tooltipContent = vue.ref("");
  10290. const tooltipTrigger = vue.ref(vue.h("div"));
  10291. const handleEvent = (event, row, name) => {
  10292. var _a2;
  10293. const table = parent;
  10294. const cell = getCell(event);
  10295. let column;
  10296. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  10297. if (cell) {
  10298. column = getColumnByCell({
  10299. columns: props.store.states.columns.value
  10300. }, cell, namespace);
  10301. if (column) {
  10302. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  10303. }
  10304. }
  10305. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  10306. };
  10307. const handleDoubleClick = (event, row) => {
  10308. handleEvent(event, row, "dblclick");
  10309. };
  10310. const handleClick = (event, row) => {
  10311. props.store.commit("setCurrentRow", row);
  10312. handleEvent(event, row, "click");
  10313. };
  10314. const handleContextMenu = (event, row) => {
  10315. handleEvent(event, row, "contextmenu");
  10316. };
  10317. const handleMouseEnter = debounce((index) => {
  10318. props.store.commit("setHoverRow", index);
  10319. }, 30);
  10320. const handleMouseLeave = debounce(() => {
  10321. props.store.commit("setHoverRow", null);
  10322. }, 30);
  10323. const getPadding = (el) => {
  10324. const style2 = window.getComputedStyle(el, null);
  10325. const paddingLeft = Number.parseInt(style2.paddingLeft, 10) || 0;
  10326. const paddingRight = Number.parseInt(style2.paddingRight, 10) || 0;
  10327. const paddingTop = Number.parseInt(style2.paddingTop, 10) || 0;
  10328. const paddingBottom = Number.parseInt(style2.paddingBottom, 10) || 0;
  10329. return {
  10330. left: paddingLeft,
  10331. right: paddingRight,
  10332. top: paddingTop,
  10333. bottom: paddingBottom
  10334. };
  10335. };
  10336. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  10337. let node = event.target.parentNode;
  10338. while (rowSpan > 1) {
  10339. node = node == null ? void 0 : node.nextSibling;
  10340. if (!node || node.nodeName !== "TR")
  10341. break;
  10342. toggle(node, "hover-row hover-fixed-row");
  10343. rowSpan--;
  10344. }
  10345. };
  10346. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  10347. var _a2;
  10348. const table = parent;
  10349. const cell = getCell(event);
  10350. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  10351. if (cell) {
  10352. const column = getColumnByCell({
  10353. columns: props.store.states.columns.value
  10354. }, cell, namespace);
  10355. if (cell.rowSpan > 1) {
  10356. toggleRowClassByCell(cell.rowSpan, event, addClass);
  10357. }
  10358. const hoverState = table.hoverState = { cell, column, row };
  10359. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  10360. }
  10361. if (!tooltipOptions) {
  10362. return;
  10363. }
  10364. const cellChild = event.target.querySelector(".cell");
  10365. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  10366. return;
  10367. }
  10368. const range = document.createRange();
  10369. range.setStart(cellChild, 0);
  10370. range.setEnd(cellChild, cellChild.childNodes.length);
  10371. let rangeWidth = range.getBoundingClientRect().width;
  10372. let rangeHeight = range.getBoundingClientRect().height;
  10373. const offsetWidth = rangeWidth - Math.floor(rangeWidth);
  10374. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  10375. if (offsetWidth < 1e-3) {
  10376. rangeWidth = Math.floor(rangeWidth);
  10377. }
  10378. const offsetHeight = rangeHeight - Math.floor(rangeHeight);
  10379. if (offsetHeight < 1e-3) {
  10380. rangeHeight = Math.floor(rangeHeight);
  10381. }
  10382. const { top, left, right, bottom } = getPadding(cellChild);
  10383. const horizontalPadding = left + right;
  10384. const verticalPadding = top + bottom;
  10385. if (rangeWidth + horizontalPadding > cellChildWidth || rangeHeight + verticalPadding > cellChildHeight || cellChild.scrollWidth > cellChildWidth) {
  10386. createTablePopper(tooltipOptions, cell.innerText || cell.textContent, cell, table);
  10387. }
  10388. };
  10389. const handleCellMouseLeave = (event) => {
  10390. const cell = getCell(event);
  10391. if (!cell)
  10392. return;
  10393. if (cell.rowSpan > 1) {
  10394. toggleRowClassByCell(cell.rowSpan, event, removeClass);
  10395. }
  10396. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  10397. parent == null ? void 0 : parent.emit("cell-mouse-leave", oldHoverState == null ? void 0 : oldHoverState.row, oldHoverState == null ? void 0 : oldHoverState.column, oldHoverState == null ? void 0 : oldHoverState.cell, event);
  10398. };
  10399. return {
  10400. handleDoubleClick,
  10401. handleClick,
  10402. handleContextMenu,
  10403. handleMouseEnter,
  10404. handleMouseLeave,
  10405. handleCellMouseEnter,
  10406. handleCellMouseLeave,
  10407. tooltipContent,
  10408. tooltipTrigger
  10409. };
  10410. }
  10411. function useStyles(props) {
  10412. const parent = vue.inject(TABLE_INJECTION_KEY);
  10413. const ns = useNamespace("table");
  10414. const getRowStyle = (row, rowIndex) => {
  10415. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  10416. if (typeof rowStyle === "function") {
  10417. return rowStyle.call(null, {
  10418. row,
  10419. rowIndex
  10420. });
  10421. }
  10422. return rowStyle || null;
  10423. };
  10424. const getRowClass = (row, rowIndex) => {
  10425. const classes = [ns.e("row")];
  10426. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  10427. classes.push("current-row");
  10428. }
  10429. if (props.stripe && rowIndex % 2 === 1) {
  10430. classes.push(ns.em("row", "striped"));
  10431. }
  10432. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  10433. if (typeof rowClassName === "string") {
  10434. classes.push(rowClassName);
  10435. } else if (typeof rowClassName === "function") {
  10436. classes.push(rowClassName.call(null, {
  10437. row,
  10438. rowIndex
  10439. }));
  10440. }
  10441. return classes;
  10442. };
  10443. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  10444. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  10445. let cellStyles = cellStyle != null ? cellStyle : {};
  10446. if (typeof cellStyle === "function") {
  10447. cellStyles = cellStyle.call(null, {
  10448. rowIndex,
  10449. columnIndex,
  10450. row,
  10451. column
  10452. });
  10453. }
  10454. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  10455. ensurePosition(fixedStyle, "left");
  10456. ensurePosition(fixedStyle, "right");
  10457. return Object.assign({}, cellStyles, fixedStyle);
  10458. };
  10459. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  10460. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  10461. const classes = [column.id, column.align, column.className, ...fixedClasses];
  10462. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  10463. if (typeof cellClassName === "string") {
  10464. classes.push(cellClassName);
  10465. } else if (typeof cellClassName === "function") {
  10466. classes.push(cellClassName.call(null, {
  10467. rowIndex,
  10468. columnIndex,
  10469. row,
  10470. column
  10471. }));
  10472. }
  10473. classes.push(ns.e("cell"));
  10474. return classes.filter((className) => Boolean(className)).join(" ");
  10475. };
  10476. const getSpan = (row, column, rowIndex, columnIndex) => {
  10477. let rowspan = 1;
  10478. let colspan = 1;
  10479. const fn2 = parent == null ? void 0 : parent.props.spanMethod;
  10480. if (typeof fn2 === "function") {
  10481. const result = fn2({
  10482. row,
  10483. column,
  10484. rowIndex,
  10485. columnIndex
  10486. });
  10487. if (Array.isArray(result)) {
  10488. rowspan = result[0];
  10489. colspan = result[1];
  10490. } else if (typeof result === "object") {
  10491. rowspan = result.rowspan;
  10492. colspan = result.colspan;
  10493. }
  10494. }
  10495. return { rowspan, colspan };
  10496. };
  10497. const getColspanRealWidth = (columns, colspan, index) => {
  10498. if (colspan < 1) {
  10499. return columns[index].realWidth;
  10500. }
  10501. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  10502. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  10503. };
  10504. return {
  10505. getRowStyle,
  10506. getRowClass,
  10507. getCellStyle,
  10508. getCellClass,
  10509. getSpan,
  10510. getColspanRealWidth
  10511. };
  10512. }
  10513. function useRender$1(props) {
  10514. const parent = vue.inject(TABLE_INJECTION_KEY);
  10515. const ns = useNamespace("table");
  10516. const {
  10517. handleDoubleClick,
  10518. handleClick,
  10519. handleContextMenu,
  10520. handleMouseEnter,
  10521. handleMouseLeave,
  10522. handleCellMouseEnter,
  10523. handleCellMouseLeave,
  10524. tooltipContent,
  10525. tooltipTrigger
  10526. } = useEvents(props);
  10527. const {
  10528. getRowStyle,
  10529. getRowClass,
  10530. getCellStyle,
  10531. getCellClass,
  10532. getSpan,
  10533. getColspanRealWidth
  10534. } = useStyles(props);
  10535. const firstDefaultColumnIndex = vue.computed(() => {
  10536. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  10537. });
  10538. const getKeyOfRow = (row, index) => {
  10539. const rowKey = parent.props.rowKey;
  10540. if (rowKey) {
  10541. return getRowIdentity(row, rowKey);
  10542. }
  10543. return index;
  10544. };
  10545. const rowRender = (row, $index, treeRowData, expanded = false) => {
  10546. const { tooltipEffect, tooltipOptions, store } = props;
  10547. const { indent, columns } = store.states;
  10548. const rowClasses = getRowClass(row, $index);
  10549. let display = true;
  10550. if (treeRowData) {
  10551. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  10552. display = treeRowData.display;
  10553. }
  10554. const displayStyle = display ? null : {
  10555. display: "none"
  10556. };
  10557. return vue.h("tr", {
  10558. style: [displayStyle, getRowStyle(row, $index)],
  10559. class: rowClasses,
  10560. key: getKeyOfRow(row, $index),
  10561. onDblclick: ($event) => handleDoubleClick($event, row),
  10562. onClick: ($event) => handleClick($event, row),
  10563. onContextmenu: ($event) => handleContextMenu($event, row),
  10564. onMouseenter: () => handleMouseEnter($index),
  10565. onMouseleave: handleMouseLeave
  10566. }, columns.value.map((column, cellIndex) => {
  10567. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  10568. if (!rowspan || !colspan) {
  10569. return null;
  10570. }
  10571. const columnData = Object.assign({}, column);
  10572. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  10573. const data = {
  10574. store: props.store,
  10575. _self: props.context || parent,
  10576. column: columnData,
  10577. row,
  10578. $index,
  10579. cellIndex,
  10580. expanded
  10581. };
  10582. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  10583. data.treeNode = {
  10584. indent: treeRowData.level * indent.value,
  10585. level: treeRowData.level
  10586. };
  10587. if (typeof treeRowData.expanded === "boolean") {
  10588. data.treeNode.expanded = treeRowData.expanded;
  10589. if ("loading" in treeRowData) {
  10590. data.treeNode.loading = treeRowData.loading;
  10591. }
  10592. if ("noLazyChildren" in treeRowData) {
  10593. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  10594. }
  10595. }
  10596. }
  10597. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  10598. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  10599. const tdChildren = cellChildren(cellIndex, column, data);
  10600. const mergedTooltipOptions = column.showOverflowTooltip && merge$1({
  10601. effect: tooltipEffect
  10602. }, tooltipOptions, column.showOverflowTooltip);
  10603. return vue.h("td", {
  10604. style: getCellStyle($index, cellIndex, row, column),
  10605. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  10606. key: `${patchKey}${baseKey}`,
  10607. rowspan,
  10608. colspan,
  10609. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  10610. onMouseleave: handleCellMouseLeave
  10611. }, [tdChildren]);
  10612. }));
  10613. };
  10614. const cellChildren = (cellIndex, column, data) => {
  10615. return column.renderCell(data);
  10616. };
  10617. const wrappedRowRender = (row, $index) => {
  10618. const store = props.store;
  10619. const { isRowExpanded, assertRowKey } = store;
  10620. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  10621. const columns = store.states.columns.value;
  10622. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  10623. if (hasExpandColumn) {
  10624. const expanded = isRowExpanded(row);
  10625. const tr = rowRender(row, $index, void 0, expanded);
  10626. const renderExpanded = parent.renderExpanded;
  10627. if (expanded) {
  10628. if (!renderExpanded) {
  10629. console.error("[Element Error]renderExpanded is required.");
  10630. return tr;
  10631. }
  10632. return [
  10633. [
  10634. tr,
  10635. vue.h("tr", {
  10636. key: `expanded-row__${tr.key}`
  10637. }, [
  10638. vue.h("td", {
  10639. colspan: columns.length,
  10640. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  10641. }, [renderExpanded({ row, $index, store, expanded })])
  10642. ])
  10643. ]
  10644. ];
  10645. } else {
  10646. return [[tr]];
  10647. }
  10648. } else if (Object.keys(treeData.value).length) {
  10649. assertRowKey();
  10650. const key = getRowIdentity(row, rowKey.value);
  10651. let cur = treeData.value[key];
  10652. let treeRowData = null;
  10653. if (cur) {
  10654. treeRowData = {
  10655. expanded: cur.expanded,
  10656. level: cur.level,
  10657. display: true
  10658. };
  10659. if (typeof cur.lazy === "boolean") {
  10660. if (typeof cur.loaded === "boolean" && cur.loaded) {
  10661. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  10662. }
  10663. treeRowData.loading = cur.loading;
  10664. }
  10665. }
  10666. const tmp = [rowRender(row, $index, treeRowData)];
  10667. if (cur) {
  10668. let i = 0;
  10669. const traverse = (children, parent2) => {
  10670. if (!(children && children.length && parent2))
  10671. return;
  10672. children.forEach((node) => {
  10673. const innerTreeRowData = {
  10674. display: parent2.display && parent2.expanded,
  10675. level: parent2.level + 1,
  10676. expanded: false,
  10677. noLazyChildren: false,
  10678. loading: false
  10679. };
  10680. const childKey = getRowIdentity(node, rowKey.value);
  10681. if (childKey === void 0 || childKey === null) {
  10682. throw new Error("For nested data item, row-key is required.");
  10683. }
  10684. cur = { ...treeData.value[childKey] };
  10685. if (cur) {
  10686. innerTreeRowData.expanded = cur.expanded;
  10687. cur.level = cur.level || innerTreeRowData.level;
  10688. cur.display = !!(cur.expanded && innerTreeRowData.display);
  10689. if (typeof cur.lazy === "boolean") {
  10690. if (typeof cur.loaded === "boolean" && cur.loaded) {
  10691. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  10692. }
  10693. innerTreeRowData.loading = cur.loading;
  10694. }
  10695. }
  10696. i++;
  10697. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  10698. if (cur) {
  10699. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  10700. traverse(nodes2, cur);
  10701. }
  10702. });
  10703. };
  10704. cur.display = true;
  10705. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  10706. traverse(nodes, cur);
  10707. }
  10708. return tmp;
  10709. } else {
  10710. return rowRender(row, $index, void 0);
  10711. }
  10712. };
  10713. return {
  10714. wrappedRowRender,
  10715. tooltipContent,
  10716. tooltipTrigger
  10717. };
  10718. }
  10719. const defaultProps$2 = {
  10720. store: {
  10721. required: true,
  10722. type: Object
  10723. },
  10724. stripe: Boolean,
  10725. tooltipEffect: String,
  10726. tooltipOptions: {
  10727. type: Object
  10728. },
  10729. context: {
  10730. default: () => ({}),
  10731. type: Object
  10732. },
  10733. rowClassName: [String, Function],
  10734. rowStyle: [Object, Function],
  10735. fixed: {
  10736. type: String,
  10737. default: ""
  10738. },
  10739. highlight: Boolean
  10740. };
  10741. var TableBody = vue.defineComponent({
  10742. name: "ElTableBody",
  10743. props: defaultProps$2,
  10744. setup(props) {
  10745. const instance = vue.getCurrentInstance();
  10746. const parent = vue.inject(TABLE_INJECTION_KEY);
  10747. const ns = useNamespace("table");
  10748. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  10749. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  10750. const hoveredCellList = [];
  10751. vue.watch(props.store.states.hoverRow, (newVal, oldVal) => {
  10752. var _a2;
  10753. const el = instance == null ? void 0 : instance.vnode.el;
  10754. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  10755. let rowNum = newVal;
  10756. const childNodes = (_a2 = rows[rowNum]) == null ? void 0 : _a2.childNodes;
  10757. if (childNodes == null ? void 0 : childNodes.length) {
  10758. let control = 0;
  10759. const indexes = Array.from(childNodes).reduce((acc, item, index) => {
  10760. var _a22, _b;
  10761. if (((_a22 = childNodes[index]) == null ? void 0 : _a22.colSpan) > 1) {
  10762. control = (_b = childNodes[index]) == null ? void 0 : _b.colSpan;
  10763. }
  10764. if (item.nodeName !== "TD" && control === 0) {
  10765. acc.push(index);
  10766. }
  10767. control > 0 && control--;
  10768. return acc;
  10769. }, []);
  10770. indexes.forEach((rowIndex) => {
  10771. var _a22;
  10772. rowNum = newVal;
  10773. while (rowNum > 0) {
  10774. const preChildNodes = (_a22 = rows[rowNum - 1]) == null ? void 0 : _a22.childNodes;
  10775. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  10776. addClass(preChildNodes[rowIndex], "hover-cell");
  10777. hoveredCellList.push(preChildNodes[rowIndex]);
  10778. break;
  10779. }
  10780. rowNum--;
  10781. }
  10782. });
  10783. } else {
  10784. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  10785. hoveredCellList.length = 0;
  10786. }
  10787. if (!props.store.states.isComplex.value || !isClient)
  10788. return;
  10789. rAF(() => {
  10790. const oldRow = rows[oldVal];
  10791. const newRow = rows[newVal];
  10792. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) {
  10793. removeClass(oldRow, "hover-row");
  10794. }
  10795. if (newRow) {
  10796. addClass(newRow, "hover-row");
  10797. }
  10798. });
  10799. });
  10800. vue.onUnmounted(() => {
  10801. var _a2;
  10802. (_a2 = removePopper) == null ? void 0 : _a2();
  10803. });
  10804. return {
  10805. ns,
  10806. onColumnsChange,
  10807. onScrollableChange,
  10808. wrappedRowRender,
  10809. tooltipContent,
  10810. tooltipTrigger
  10811. };
  10812. },
  10813. render() {
  10814. const { wrappedRowRender, store } = this;
  10815. const data = store.states.data.value || [];
  10816. return vue.h("tbody", { tabIndex: -1 }, [
  10817. data.reduce((acc, row) => {
  10818. return acc.concat(wrappedRowRender(row, acc.length));
  10819. }, [])
  10820. ]);
  10821. }
  10822. });
  10823. function useMapState() {
  10824. const table = vue.inject(TABLE_INJECTION_KEY);
  10825. const store = table == null ? void 0 : table.store;
  10826. const leftFixedLeafCount = vue.computed(() => {
  10827. return store.states.fixedLeafColumnsLength.value;
  10828. });
  10829. const rightFixedLeafCount = vue.computed(() => {
  10830. return store.states.rightFixedColumns.value.length;
  10831. });
  10832. const columnsCount = vue.computed(() => {
  10833. return store.states.columns.value.length;
  10834. });
  10835. const leftFixedCount = vue.computed(() => {
  10836. return store.states.fixedColumns.value.length;
  10837. });
  10838. const rightFixedCount = vue.computed(() => {
  10839. return store.states.rightFixedColumns.value.length;
  10840. });
  10841. return {
  10842. leftFixedLeafCount,
  10843. rightFixedLeafCount,
  10844. columnsCount,
  10845. leftFixedCount,
  10846. rightFixedCount,
  10847. columns: store.states.columns
  10848. };
  10849. }
  10850. function useStyle$1(props) {
  10851. const { columns } = useMapState();
  10852. const ns = useNamespace("table");
  10853. const getCellClasses = (columns2, cellIndex) => {
  10854. const column = columns2[cellIndex];
  10855. const classes = [
  10856. ns.e("cell"),
  10857. column.id,
  10858. column.align,
  10859. column.labelClassName,
  10860. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  10861. ];
  10862. if (column.className) {
  10863. classes.push(column.className);
  10864. }
  10865. if (!column.children) {
  10866. classes.push(ns.is("leaf"));
  10867. }
  10868. return classes;
  10869. };
  10870. const getCellStyles = (column, cellIndex) => {
  10871. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  10872. ensurePosition(fixedStyle, "left");
  10873. ensurePosition(fixedStyle, "right");
  10874. return fixedStyle;
  10875. };
  10876. return {
  10877. getCellClasses,
  10878. getCellStyles,
  10879. columns
  10880. };
  10881. }
  10882. var TableFooter = vue.defineComponent({
  10883. name: "ElTableFooter",
  10884. props: {
  10885. fixed: {
  10886. type: String,
  10887. default: ""
  10888. },
  10889. store: {
  10890. required: true,
  10891. type: Object
  10892. },
  10893. summaryMethod: Function,
  10894. sumText: String,
  10895. border: Boolean,
  10896. defaultSort: {
  10897. type: Object,
  10898. default: () => {
  10899. return {
  10900. prop: "",
  10901. order: ""
  10902. };
  10903. }
  10904. }
  10905. },
  10906. setup(props) {
  10907. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  10908. const ns = useNamespace("table");
  10909. return {
  10910. ns,
  10911. getCellClasses,
  10912. getCellStyles,
  10913. columns
  10914. };
  10915. },
  10916. render() {
  10917. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  10918. const data = this.store.states.data.value;
  10919. let sums = [];
  10920. if (summaryMethod) {
  10921. sums = summaryMethod({
  10922. columns,
  10923. data
  10924. });
  10925. } else {
  10926. columns.forEach((column, index) => {
  10927. if (index === 0) {
  10928. sums[index] = sumText;
  10929. return;
  10930. }
  10931. const values = data.map((item) => Number(item[column.property]));
  10932. const precisions = [];
  10933. let notNumber = true;
  10934. values.forEach((value) => {
  10935. if (!Number.isNaN(+value)) {
  10936. notNumber = false;
  10937. const decimal = `${value}`.split(".")[1];
  10938. precisions.push(decimal ? decimal.length : 0);
  10939. }
  10940. });
  10941. const precision = Math.max.apply(null, precisions);
  10942. if (!notNumber) {
  10943. sums[index] = values.reduce((prev, curr) => {
  10944. const value = Number(curr);
  10945. if (!Number.isNaN(+value)) {
  10946. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  10947. } else {
  10948. return prev;
  10949. }
  10950. }, 0);
  10951. } else {
  10952. sums[index] = "";
  10953. }
  10954. });
  10955. }
  10956. return vue.h(vue.h("tfoot", [
  10957. vue.h("tr", {}, [
  10958. ...columns.map((column, cellIndex) => vue.h("td", {
  10959. key: cellIndex,
  10960. colspan: column.colSpan,
  10961. rowspan: column.rowSpan,
  10962. class: getCellClasses(columns, cellIndex),
  10963. style: getCellStyles(column, cellIndex)
  10964. }, [
  10965. vue.h("div", {
  10966. class: ["cell", column.labelClassName]
  10967. }, [sums[cellIndex]])
  10968. ]))
  10969. ])
  10970. ]));
  10971. }
  10972. });
  10973. function useUtils(store) {
  10974. const setCurrentRow = (row) => {
  10975. store.commit("setCurrentRow", row);
  10976. };
  10977. const getSelectionRows = () => {
  10978. return store.getSelectionRows();
  10979. };
  10980. const toggleRowSelection = (row, selected) => {
  10981. store.toggleRowSelection(row, selected, false);
  10982. store.updateAllSelected();
  10983. };
  10984. const clearSelection = () => {
  10985. store.clearSelection();
  10986. };
  10987. const clearFilter = (columnKeys) => {
  10988. store.clearFilter(columnKeys);
  10989. };
  10990. const toggleAllSelection = () => {
  10991. store.commit("toggleAllSelection");
  10992. };
  10993. const toggleRowExpansion = (row, expanded) => {
  10994. store.toggleRowExpansionAdapter(row, expanded);
  10995. };
  10996. const clearSort = () => {
  10997. store.clearSort();
  10998. };
  10999. const sort = (prop, order) => {
  11000. store.commit("sort", { prop, order });
  11001. };
  11002. return {
  11003. setCurrentRow,
  11004. getSelectionRows,
  11005. toggleRowSelection,
  11006. clearSelection,
  11007. clearFilter,
  11008. toggleAllSelection,
  11009. toggleRowExpansion,
  11010. clearSort,
  11011. sort
  11012. };
  11013. }
  11014. function useStyle(props, layout, store, table) {
  11015. const isHidden2 = vue.ref(false);
  11016. const renderExpanded = vue.ref(null);
  11017. const resizeProxyVisible = vue.ref(false);
  11018. const setDragVisible = (visible) => {
  11019. resizeProxyVisible.value = visible;
  11020. };
  11021. const resizeState = vue.ref({
  11022. width: null,
  11023. height: null,
  11024. headerHeight: null
  11025. });
  11026. const isGroup = vue.ref(false);
  11027. const scrollbarViewStyle = {
  11028. display: "inline-block",
  11029. verticalAlign: "middle"
  11030. };
  11031. const tableWidth = vue.ref();
  11032. const tableScrollHeight = vue.ref(0);
  11033. const bodyScrollHeight = vue.ref(0);
  11034. const headerScrollHeight = vue.ref(0);
  11035. const footerScrollHeight = vue.ref(0);
  11036. const appendScrollHeight = vue.ref(0);
  11037. vue.watchEffect(() => {
  11038. layout.setHeight(props.height);
  11039. });
  11040. vue.watchEffect(() => {
  11041. layout.setMaxHeight(props.maxHeight);
  11042. });
  11043. vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  11044. if (!vue.unref(rowKey) || !vue.unref(currentRowKey))
  11045. return;
  11046. store.setCurrentRowKey(`${currentRowKey}`);
  11047. }, {
  11048. immediate: true
  11049. });
  11050. vue.watch(() => props.data, (data) => {
  11051. table.store.commit("setData", data);
  11052. }, {
  11053. immediate: true,
  11054. deep: true
  11055. });
  11056. vue.watchEffect(() => {
  11057. if (props.expandRowKeys) {
  11058. store.setExpandRowKeysAdapter(props.expandRowKeys);
  11059. }
  11060. });
  11061. const handleMouseLeave = () => {
  11062. table.store.commit("setHoverRow", null);
  11063. if (table.hoverState)
  11064. table.hoverState = null;
  11065. };
  11066. const handleHeaderFooterMousewheel = (event, data) => {
  11067. const { pixelX, pixelY } = data;
  11068. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  11069. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  11070. }
  11071. };
  11072. const shouldUpdateHeight = vue.computed(() => {
  11073. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  11074. });
  11075. const tableBodyStyles = vue.computed(() => {
  11076. return {
  11077. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  11078. };
  11079. });
  11080. const doLayout = () => {
  11081. if (shouldUpdateHeight.value) {
  11082. layout.updateElsHeight();
  11083. }
  11084. layout.updateColumnsWidth();
  11085. requestAnimationFrame(syncPosition);
  11086. };
  11087. vue.onMounted(async () => {
  11088. await vue.nextTick();
  11089. store.updateColumns();
  11090. bindEvents();
  11091. requestAnimationFrame(doLayout);
  11092. const el = table.vnode.el;
  11093. const tableHeader = table.refs.headerWrapper;
  11094. if (props.flexible && el && el.parentElement) {
  11095. el.parentElement.style.minWidth = "0";
  11096. }
  11097. resizeState.value = {
  11098. width: tableWidth.value = el.offsetWidth,
  11099. height: el.offsetHeight,
  11100. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  11101. };
  11102. store.states.columns.value.forEach((column) => {
  11103. if (column.filteredValue && column.filteredValue.length) {
  11104. table.store.commit("filterChange", {
  11105. column,
  11106. values: column.filteredValue,
  11107. silent: true
  11108. });
  11109. }
  11110. });
  11111. table.$ready = true;
  11112. });
  11113. const setScrollClassByEl = (el, className) => {
  11114. if (!el)
  11115. return;
  11116. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  11117. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  11118. el.className = classList.join(" ");
  11119. };
  11120. const setScrollClass = (className) => {
  11121. const { tableWrapper } = table.refs;
  11122. setScrollClassByEl(tableWrapper, className);
  11123. };
  11124. const hasScrollClass = (className) => {
  11125. const { tableWrapper } = table.refs;
  11126. return !!(tableWrapper && tableWrapper.classList.contains(className));
  11127. };
  11128. const syncPosition = function() {
  11129. if (!table.refs.scrollBarRef)
  11130. return;
  11131. if (!layout.scrollX.value) {
  11132. const scrollingNoneClass = "is-scrolling-none";
  11133. if (!hasScrollClass(scrollingNoneClass)) {
  11134. setScrollClass(scrollingNoneClass);
  11135. }
  11136. return;
  11137. }
  11138. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  11139. if (!scrollContainer)
  11140. return;
  11141. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  11142. const { headerWrapper, footerWrapper } = table.refs;
  11143. if (headerWrapper)
  11144. headerWrapper.scrollLeft = scrollLeft;
  11145. if (footerWrapper)
  11146. footerWrapper.scrollLeft = scrollLeft;
  11147. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  11148. if (scrollLeft >= maxScrollLeftPosition) {
  11149. setScrollClass("is-scrolling-right");
  11150. } else if (scrollLeft === 0) {
  11151. setScrollClass("is-scrolling-left");
  11152. } else {
  11153. setScrollClass("is-scrolling-middle");
  11154. }
  11155. };
  11156. const bindEvents = () => {
  11157. if (!table.refs.scrollBarRef)
  11158. return;
  11159. if (table.refs.scrollBarRef.wrapRef) {
  11160. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  11161. passive: true
  11162. });
  11163. }
  11164. if (props.fit) {
  11165. useResizeObserver(table.vnode.el, resizeListener);
  11166. } else {
  11167. useEventListener(window, "resize", resizeListener);
  11168. }
  11169. useResizeObserver(table.refs.bodyWrapper, () => {
  11170. var _a2, _b;
  11171. resizeListener();
  11172. (_b = (_a2 = table.refs) == null ? void 0 : _a2.scrollBarRef) == null ? void 0 : _b.update();
  11173. });
  11174. };
  11175. const resizeListener = () => {
  11176. var _a2, _b, _c, _d;
  11177. const el = table.vnode.el;
  11178. if (!table.$ready || !el)
  11179. return;
  11180. let shouldUpdateLayout = false;
  11181. const {
  11182. width: oldWidth,
  11183. height: oldHeight,
  11184. headerHeight: oldHeaderHeight
  11185. } = resizeState.value;
  11186. const width = tableWidth.value = el.offsetWidth;
  11187. if (oldWidth !== width) {
  11188. shouldUpdateLayout = true;
  11189. }
  11190. const height = el.offsetHeight;
  11191. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  11192. shouldUpdateLayout = true;
  11193. }
  11194. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a2 = table.refs.tableHeaderRef) == null ? void 0 : _a2.$el;
  11195. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  11196. shouldUpdateLayout = true;
  11197. }
  11198. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  11199. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  11200. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  11201. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  11202. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  11203. if (shouldUpdateLayout) {
  11204. resizeState.value = {
  11205. width,
  11206. height,
  11207. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  11208. };
  11209. doLayout();
  11210. }
  11211. };
  11212. const tableSize = useFormSize();
  11213. const bodyWidth = vue.computed(() => {
  11214. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  11215. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  11216. });
  11217. const tableLayout = vue.computed(() => {
  11218. if (props.maxHeight)
  11219. return "fixed";
  11220. return props.tableLayout;
  11221. });
  11222. const emptyBlockStyle = vue.computed(() => {
  11223. if (props.data && props.data.length)
  11224. return null;
  11225. let height = "100%";
  11226. if (props.height && bodyScrollHeight.value) {
  11227. height = `${bodyScrollHeight.value}px`;
  11228. }
  11229. const width = tableWidth.value;
  11230. return {
  11231. width: width ? `${width}px` : "",
  11232. height
  11233. };
  11234. });
  11235. const tableInnerStyle = vue.computed(() => {
  11236. if (props.height) {
  11237. return {
  11238. height: !Number.isNaN(Number(props.height)) ? `${props.height}px` : props.height
  11239. };
  11240. }
  11241. if (props.maxHeight) {
  11242. return {
  11243. maxHeight: !Number.isNaN(Number(props.maxHeight)) ? `${props.maxHeight}px` : props.maxHeight
  11244. };
  11245. }
  11246. return {};
  11247. });
  11248. const scrollbarStyle = vue.computed(() => {
  11249. if (props.height) {
  11250. return {
  11251. height: "100%"
  11252. };
  11253. }
  11254. if (props.maxHeight) {
  11255. if (!Number.isNaN(Number(props.maxHeight))) {
  11256. return {
  11257. maxHeight: `${props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  11258. };
  11259. } else {
  11260. return {
  11261. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  11262. };
  11263. }
  11264. }
  11265. return {};
  11266. });
  11267. const handleFixedMousewheel = (event, data) => {
  11268. const bodyWrapper = table.refs.bodyWrapper;
  11269. if (Math.abs(data.spinY) > 0) {
  11270. const currentScrollTop = bodyWrapper.scrollTop;
  11271. if (data.pixelY < 0 && currentScrollTop !== 0) {
  11272. event.preventDefault();
  11273. }
  11274. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  11275. event.preventDefault();
  11276. }
  11277. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  11278. } else {
  11279. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  11280. }
  11281. };
  11282. return {
  11283. isHidden: isHidden2,
  11284. renderExpanded,
  11285. setDragVisible,
  11286. isGroup,
  11287. handleMouseLeave,
  11288. handleHeaderFooterMousewheel,
  11289. tableSize,
  11290. emptyBlockStyle,
  11291. handleFixedMousewheel,
  11292. resizeProxyVisible,
  11293. bodyWidth,
  11294. resizeState,
  11295. doLayout,
  11296. tableBodyStyles,
  11297. tableLayout,
  11298. scrollbarViewStyle,
  11299. tableInnerStyle,
  11300. scrollbarStyle
  11301. };
  11302. }
  11303. function useKeyRender(table) {
  11304. const observer = vue.ref();
  11305. const initWatchDom = () => {
  11306. const el = table.vnode.el;
  11307. const columnsWrapper = el.querySelector(".hidden-columns");
  11308. const config = { childList: true, subtree: true };
  11309. const updateOrderFns = table.store.states.updateOrderFns;
  11310. observer.value = new MutationObserver(() => {
  11311. updateOrderFns.forEach((fn2) => fn2());
  11312. });
  11313. observer.value.observe(columnsWrapper, config);
  11314. };
  11315. vue.onMounted(() => {
  11316. initWatchDom();
  11317. });
  11318. vue.onUnmounted(() => {
  11319. var _a2;
  11320. (_a2 = observer.value) == null ? void 0 : _a2.disconnect();
  11321. });
  11322. }
  11323. var defaultProps$1 = {
  11324. data: {
  11325. type: Array,
  11326. default: () => []
  11327. },
  11328. size: useSizeProp,
  11329. width: [String, Number],
  11330. height: [String, Number],
  11331. maxHeight: [String, Number],
  11332. fit: {
  11333. type: Boolean,
  11334. default: true
  11335. },
  11336. stripe: Boolean,
  11337. border: Boolean,
  11338. rowKey: [String, Function],
  11339. showHeader: {
  11340. type: Boolean,
  11341. default: true
  11342. },
  11343. showSummary: Boolean,
  11344. sumText: String,
  11345. summaryMethod: Function,
  11346. rowClassName: [String, Function],
  11347. rowStyle: [Object, Function],
  11348. cellClassName: [String, Function],
  11349. cellStyle: [Object, Function],
  11350. headerRowClassName: [String, Function],
  11351. headerRowStyle: [Object, Function],
  11352. headerCellClassName: [String, Function],
  11353. headerCellStyle: [Object, Function],
  11354. highlightCurrentRow: Boolean,
  11355. currentRowKey: [String, Number],
  11356. emptyText: String,
  11357. expandRowKeys: Array,
  11358. defaultExpandAll: Boolean,
  11359. defaultSort: Object,
  11360. tooltipEffect: String,
  11361. tooltipOptions: Object,
  11362. spanMethod: Function,
  11363. selectOnIndeterminate: {
  11364. type: Boolean,
  11365. default: true
  11366. },
  11367. indent: {
  11368. type: Number,
  11369. default: 16
  11370. },
  11371. treeProps: {
  11372. type: Object,
  11373. default: () => {
  11374. return {
  11375. hasChildren: "hasChildren",
  11376. children: "children"
  11377. };
  11378. }
  11379. },
  11380. lazy: Boolean,
  11381. load: Function,
  11382. style: {
  11383. type: Object,
  11384. default: () => ({})
  11385. },
  11386. className: {
  11387. type: String,
  11388. default: ""
  11389. },
  11390. tableLayout: {
  11391. type: String,
  11392. default: "fixed"
  11393. },
  11394. scrollbarAlwaysOn: Boolean,
  11395. flexible: Boolean,
  11396. showOverflowTooltip: [Boolean, Object]
  11397. };
  11398. function hColgroup(props) {
  11399. const isAuto = props.tableLayout === "auto";
  11400. let columns = props.columns || [];
  11401. if (isAuto) {
  11402. if (columns.every((column) => column.width === void 0)) {
  11403. columns = [];
  11404. }
  11405. }
  11406. const getPropsData = (column) => {
  11407. const propsData = {
  11408. key: `${props.tableLayout}_${column.id}`,
  11409. style: {},
  11410. name: void 0
  11411. };
  11412. if (isAuto) {
  11413. propsData.style = {
  11414. width: `${column.width}px`
  11415. };
  11416. } else {
  11417. propsData.name = column.id;
  11418. }
  11419. return propsData;
  11420. };
  11421. return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column))));
  11422. }
  11423. hColgroup.props = ["columns", "tableLayout"];
  11424. const useScrollbar = () => {
  11425. const scrollBarRef = vue.ref();
  11426. const scrollTo = (options, yCoord) => {
  11427. const scrollbar = scrollBarRef.value;
  11428. if (scrollbar) {
  11429. scrollbar.scrollTo(options, yCoord);
  11430. }
  11431. };
  11432. const setScrollPosition = (position, offset) => {
  11433. const scrollbar = scrollBarRef.value;
  11434. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  11435. scrollbar[`setScroll${position}`](offset);
  11436. }
  11437. };
  11438. const setScrollTop = (top) => setScrollPosition("Top", top);
  11439. const setScrollLeft = (left) => setScrollPosition("Left", left);
  11440. return {
  11441. scrollBarRef,
  11442. scrollTo,
  11443. setScrollTop,
  11444. setScrollLeft
  11445. };
  11446. };
  11447. let tableIdSeed = 1;
  11448. const _sfc_main$2 = vue.defineComponent({
  11449. name: "ElTable",
  11450. directives: {
  11451. Mousewheel
  11452. },
  11453. components: {
  11454. TableHeader,
  11455. TableBody,
  11456. TableFooter,
  11457. ElScrollbar,
  11458. hColgroup
  11459. },
  11460. props: defaultProps$1,
  11461. emits: [
  11462. "select",
  11463. "select-all",
  11464. "selection-change",
  11465. "cell-mouse-enter",
  11466. "cell-mouse-leave",
  11467. "cell-contextmenu",
  11468. "cell-click",
  11469. "cell-dblclick",
  11470. "row-click",
  11471. "row-contextmenu",
  11472. "row-dblclick",
  11473. "header-click",
  11474. "header-contextmenu",
  11475. "sort-change",
  11476. "filter-change",
  11477. "current-change",
  11478. "header-dragend",
  11479. "expand-change"
  11480. ],
  11481. setup(props) {
  11482. const { t } = useLocale();
  11483. const ns = useNamespace("table");
  11484. const table = vue.getCurrentInstance();
  11485. vue.provide(TABLE_INJECTION_KEY, table);
  11486. const store = createStore(table, props);
  11487. table.store = store;
  11488. const layout = new TableLayout({
  11489. store: table.store,
  11490. table,
  11491. fit: props.fit,
  11492. showHeader: props.showHeader
  11493. });
  11494. table.layout = layout;
  11495. const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0);
  11496. const {
  11497. setCurrentRow,
  11498. getSelectionRows,
  11499. toggleRowSelection,
  11500. clearSelection,
  11501. clearFilter,
  11502. toggleAllSelection,
  11503. toggleRowExpansion,
  11504. clearSort,
  11505. sort
  11506. } = useUtils(store);
  11507. const {
  11508. isHidden: isHidden2,
  11509. renderExpanded,
  11510. setDragVisible,
  11511. isGroup,
  11512. handleMouseLeave,
  11513. handleHeaderFooterMousewheel,
  11514. tableSize,
  11515. emptyBlockStyle,
  11516. handleFixedMousewheel,
  11517. resizeProxyVisible,
  11518. bodyWidth,
  11519. resizeState,
  11520. doLayout,
  11521. tableBodyStyles,
  11522. tableLayout,
  11523. scrollbarViewStyle,
  11524. tableInnerStyle,
  11525. scrollbarStyle
  11526. } = useStyle(props, layout, store, table);
  11527. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar();
  11528. const debouncedUpdateLayout = debounce(doLayout, 50);
  11529. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  11530. table.tableId = tableId;
  11531. table.state = {
  11532. isGroup,
  11533. resizeState,
  11534. doLayout,
  11535. debouncedUpdateLayout
  11536. };
  11537. const computedSumText = vue.computed(() => props.sumText || t("el.table.sumText"));
  11538. const computedEmptyText = vue.computed(() => {
  11539. return props.emptyText || t("el.table.emptyText");
  11540. });
  11541. useKeyRender(table);
  11542. return {
  11543. ns,
  11544. layout,
  11545. store,
  11546. handleHeaderFooterMousewheel,
  11547. handleMouseLeave,
  11548. tableId,
  11549. tableSize,
  11550. isHidden: isHidden2,
  11551. isEmpty,
  11552. renderExpanded,
  11553. resizeProxyVisible,
  11554. resizeState,
  11555. isGroup,
  11556. bodyWidth,
  11557. tableBodyStyles,
  11558. emptyBlockStyle,
  11559. debouncedUpdateLayout,
  11560. handleFixedMousewheel,
  11561. setCurrentRow,
  11562. getSelectionRows,
  11563. toggleRowSelection,
  11564. clearSelection,
  11565. clearFilter,
  11566. toggleAllSelection,
  11567. toggleRowExpansion,
  11568. clearSort,
  11569. doLayout,
  11570. sort,
  11571. t,
  11572. setDragVisible,
  11573. context: table,
  11574. computedSumText,
  11575. computedEmptyText,
  11576. tableLayout,
  11577. scrollbarViewStyle,
  11578. tableInnerStyle,
  11579. scrollbarStyle,
  11580. scrollBarRef,
  11581. scrollTo,
  11582. setScrollLeft,
  11583. setScrollTop
  11584. };
  11585. }
  11586. });
  11587. const _hoisted_1$2 = ["data-prefix"];
  11588. const _hoisted_2$2 = {
  11589. ref: "hiddenColumns",
  11590. class: "hidden-columns"
  11591. };
  11592. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  11593. const _component_hColgroup = vue.resolveComponent("hColgroup");
  11594. const _component_table_header = vue.resolveComponent("table-header");
  11595. const _component_table_body = vue.resolveComponent("table-body");
  11596. const _component_table_footer = vue.resolveComponent("table-footer");
  11597. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  11598. const _directive_mousewheel = vue.resolveDirective("mousewheel");
  11599. return vue.openBlock(), vue.createElementBlock("div", {
  11600. ref: "tableWrapper",
  11601. class: vue.normalizeClass([
  11602. {
  11603. [_ctx.ns.m("fit")]: _ctx.fit,
  11604. [_ctx.ns.m("striped")]: _ctx.stripe,
  11605. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  11606. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  11607. [_ctx.ns.m("group")]: _ctx.isGroup,
  11608. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  11609. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  11610. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  11611. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  11612. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  11613. "has-footer": _ctx.showSummary
  11614. },
  11615. _ctx.ns.m(_ctx.tableSize),
  11616. _ctx.className,
  11617. _ctx.ns.b(),
  11618. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  11619. ]),
  11620. style: vue.normalizeStyle(_ctx.style),
  11621. "data-prefix": _ctx.ns.namespace.value,
  11622. onMouseleave: _cache[0] || (_cache[0] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args))
  11623. }, [
  11624. vue.createElementVNode("div", {
  11625. class: vue.normalizeClass(_ctx.ns.e("inner-wrapper")),
  11626. style: vue.normalizeStyle(_ctx.tableInnerStyle)
  11627. }, [
  11628. vue.createElementVNode("div", _hoisted_2$2, [
  11629. vue.renderSlot(_ctx.$slots, "default")
  11630. ], 512),
  11631. _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  11632. key: 0,
  11633. ref: "headerWrapper",
  11634. class: vue.normalizeClass(_ctx.ns.e("header-wrapper"))
  11635. }, [
  11636. vue.createElementVNode("table", {
  11637. ref: "tableHeader",
  11638. class: vue.normalizeClass(_ctx.ns.e("header")),
  11639. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  11640. border: "0",
  11641. cellpadding: "0",
  11642. cellspacing: "0"
  11643. }, [
  11644. vue.createVNode(_component_hColgroup, {
  11645. columns: _ctx.store.states.columns.value,
  11646. "table-layout": _ctx.tableLayout
  11647. }, null, 8, ["columns", "table-layout"]),
  11648. vue.createVNode(_component_table_header, {
  11649. ref: "tableHeaderRef",
  11650. border: _ctx.border,
  11651. "default-sort": _ctx.defaultSort,
  11652. store: _ctx.store,
  11653. onSetDragVisible: _ctx.setDragVisible
  11654. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  11655. ], 6)
  11656. ], 2)), [
  11657. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  11658. ]) : vue.createCommentVNode("v-if", true),
  11659. vue.createElementVNode("div", {
  11660. ref: "bodyWrapper",
  11661. class: vue.normalizeClass(_ctx.ns.e("body-wrapper"))
  11662. }, [
  11663. vue.createVNode(_component_el_scrollbar, {
  11664. ref: "scrollBarRef",
  11665. "view-style": _ctx.scrollbarViewStyle,
  11666. "wrap-style": _ctx.scrollbarStyle,
  11667. always: _ctx.scrollbarAlwaysOn
  11668. }, {
  11669. default: vue.withCtx(() => [
  11670. vue.createElementVNode("table", {
  11671. ref: "tableBody",
  11672. class: vue.normalizeClass(_ctx.ns.e("body")),
  11673. cellspacing: "0",
  11674. cellpadding: "0",
  11675. border: "0",
  11676. style: vue.normalizeStyle({
  11677. width: _ctx.bodyWidth,
  11678. tableLayout: _ctx.tableLayout
  11679. })
  11680. }, [
  11681. vue.createVNode(_component_hColgroup, {
  11682. columns: _ctx.store.states.columns.value,
  11683. "table-layout": _ctx.tableLayout
  11684. }, null, 8, ["columns", "table-layout"]),
  11685. _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, {
  11686. key: 0,
  11687. ref: "tableHeaderRef",
  11688. class: vue.normalizeClass(_ctx.ns.e("body-header")),
  11689. border: _ctx.border,
  11690. "default-sort": _ctx.defaultSort,
  11691. store: _ctx.store,
  11692. onSetDragVisible: _ctx.setDragVisible
  11693. }, null, 8, ["class", "border", "default-sort", "store", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true),
  11694. vue.createVNode(_component_table_body, {
  11695. context: _ctx.context,
  11696. highlight: _ctx.highlightCurrentRow,
  11697. "row-class-name": _ctx.rowClassName,
  11698. "tooltip-effect": _ctx.tooltipEffect,
  11699. "tooltip-options": _ctx.tooltipOptions,
  11700. "row-style": _ctx.rowStyle,
  11701. store: _ctx.store,
  11702. stripe: _ctx.stripe
  11703. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  11704. _ctx.showSummary && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_footer, {
  11705. key: 1,
  11706. class: vue.normalizeClass(_ctx.ns.e("body-footer")),
  11707. border: _ctx.border,
  11708. "default-sort": _ctx.defaultSort,
  11709. store: _ctx.store,
  11710. "sum-text": _ctx.computedSumText,
  11711. "summary-method": _ctx.summaryMethod
  11712. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : vue.createCommentVNode("v-if", true)
  11713. ], 6),
  11714. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  11715. key: 0,
  11716. ref: "emptyBlock",
  11717. style: vue.normalizeStyle(_ctx.emptyBlockStyle),
  11718. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  11719. }, [
  11720. vue.createElementVNode("span", {
  11721. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  11722. }, [
  11723. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  11724. vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1)
  11725. ])
  11726. ], 2)
  11727. ], 6)) : vue.createCommentVNode("v-if", true),
  11728. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  11729. key: 1,
  11730. ref: "appendWrapper",
  11731. class: vue.normalizeClass(_ctx.ns.e("append-wrapper"))
  11732. }, [
  11733. vue.renderSlot(_ctx.$slots, "append")
  11734. ], 2)) : vue.createCommentVNode("v-if", true)
  11735. ]),
  11736. _: 3
  11737. }, 8, ["view-style", "wrap-style", "always"])
  11738. ], 2),
  11739. _ctx.showSummary && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  11740. key: 1,
  11741. ref: "footerWrapper",
  11742. class: vue.normalizeClass(_ctx.ns.e("footer-wrapper"))
  11743. }, [
  11744. vue.createElementVNode("table", {
  11745. class: vue.normalizeClass(_ctx.ns.e("footer")),
  11746. cellspacing: "0",
  11747. cellpadding: "0",
  11748. border: "0",
  11749. style: vue.normalizeStyle(_ctx.tableBodyStyles)
  11750. }, [
  11751. vue.createVNode(_component_hColgroup, {
  11752. columns: _ctx.store.states.columns.value,
  11753. "table-layout": _ctx.tableLayout
  11754. }, null, 8, ["columns", "table-layout"]),
  11755. vue.createVNode(_component_table_footer, {
  11756. border: _ctx.border,
  11757. "default-sort": _ctx.defaultSort,
  11758. store: _ctx.store,
  11759. "sum-text": _ctx.computedSumText,
  11760. "summary-method": _ctx.summaryMethod
  11761. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  11762. ], 6)
  11763. ], 2)), [
  11764. [vue.vShow, !_ctx.isEmpty],
  11765. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  11766. ]) : vue.createCommentVNode("v-if", true),
  11767. _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", {
  11768. key: 2,
  11769. class: vue.normalizeClass(_ctx.ns.e("border-left-patch"))
  11770. }, null, 2)) : vue.createCommentVNode("v-if", true)
  11771. ], 6),
  11772. vue.withDirectives(vue.createElementVNode("div", {
  11773. ref: "resizeProxy",
  11774. class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy"))
  11775. }, null, 2), [
  11776. [vue.vShow, _ctx.resizeProxyVisible]
  11777. ])
  11778. ], 46, _hoisted_1$2);
  11779. }
  11780. var Table = /* @__PURE__ */ _export_sfc$1(_sfc_main$2, [["render", _sfc_render], ["__file", "table.vue"]]);
  11781. const defaultClassNames = {
  11782. selection: "table-column--selection",
  11783. expand: "table__expand-column"
  11784. };
  11785. const cellStarts = {
  11786. default: {
  11787. order: ""
  11788. },
  11789. selection: {
  11790. width: 48,
  11791. minWidth: 48,
  11792. realWidth: 48,
  11793. order: ""
  11794. },
  11795. expand: {
  11796. width: 48,
  11797. minWidth: 48,
  11798. realWidth: 48,
  11799. order: ""
  11800. },
  11801. index: {
  11802. width: 48,
  11803. minWidth: 48,
  11804. realWidth: 48,
  11805. order: ""
  11806. }
  11807. };
  11808. const getDefaultClassName = (type) => {
  11809. return defaultClassNames[type] || "";
  11810. };
  11811. const cellForced = {
  11812. selection: {
  11813. renderHeader({ store, column }) {
  11814. function isDisabled() {
  11815. return store.states.data.value && store.states.data.value.length === 0;
  11816. }
  11817. return vue.h(ElCheckbox, {
  11818. disabled: isDisabled(),
  11819. size: store.states.tableSize.value,
  11820. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  11821. "onUpdate:modelValue": store.toggleAllSelection,
  11822. modelValue: store.states.isAllSelected.value,
  11823. ariaLabel: column.label
  11824. });
  11825. },
  11826. renderCell({
  11827. row,
  11828. column,
  11829. store,
  11830. $index
  11831. }) {
  11832. return vue.h(ElCheckbox, {
  11833. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  11834. size: store.states.tableSize.value,
  11835. onChange: () => {
  11836. store.commit("rowSelectedChanged", row);
  11837. },
  11838. onClick: (event) => event.stopPropagation(),
  11839. modelValue: store.isSelected(row),
  11840. ariaLabel: column.label
  11841. });
  11842. },
  11843. sortable: false,
  11844. resizable: false
  11845. },
  11846. index: {
  11847. renderHeader({ column }) {
  11848. return column.label || "#";
  11849. },
  11850. renderCell({
  11851. column,
  11852. $index
  11853. }) {
  11854. let i = $index + 1;
  11855. const index = column.index;
  11856. if (typeof index === "number") {
  11857. i = $index + index;
  11858. } else if (typeof index === "function") {
  11859. i = index($index);
  11860. }
  11861. return vue.h("div", {}, [i]);
  11862. },
  11863. sortable: false
  11864. },
  11865. expand: {
  11866. renderHeader({ column }) {
  11867. return column.label || "";
  11868. },
  11869. renderCell({
  11870. row,
  11871. store,
  11872. expanded
  11873. }) {
  11874. const { ns } = store;
  11875. const classes = [ns.e("expand-icon")];
  11876. if (expanded) {
  11877. classes.push(ns.em("expand-icon", "expanded"));
  11878. }
  11879. const callback = function(e) {
  11880. e.stopPropagation();
  11881. store.toggleRowExpansion(row);
  11882. };
  11883. return vue.h("div", {
  11884. class: classes,
  11885. onClick: callback
  11886. }, {
  11887. default: () => {
  11888. return [
  11889. vue.h(ElIcon, null, {
  11890. default: () => {
  11891. return [vue.h(arrow_right_default)];
  11892. }
  11893. })
  11894. ];
  11895. }
  11896. });
  11897. },
  11898. sortable: false,
  11899. resizable: false
  11900. }
  11901. };
  11902. function defaultRenderCell({
  11903. row,
  11904. column,
  11905. $index
  11906. }) {
  11907. var _a2;
  11908. const property2 = column.property;
  11909. const value = property2 && getProp(row, property2).value;
  11910. if (column && column.formatter) {
  11911. return column.formatter(row, column, value, $index);
  11912. }
  11913. return ((_a2 = value == null ? void 0 : value.toString) == null ? void 0 : _a2.call(value)) || "";
  11914. }
  11915. function treeCellPrefix({
  11916. row,
  11917. treeNode,
  11918. store
  11919. }, createPlaceholder = false) {
  11920. const { ns } = store;
  11921. if (!treeNode) {
  11922. if (createPlaceholder) {
  11923. return [
  11924. vue.h("span", {
  11925. class: ns.e("placeholder")
  11926. })
  11927. ];
  11928. }
  11929. return null;
  11930. }
  11931. const ele = [];
  11932. const callback = function(e) {
  11933. e.stopPropagation();
  11934. if (treeNode.loading) {
  11935. return;
  11936. }
  11937. store.loadOrToggle(row);
  11938. };
  11939. if (treeNode.indent) {
  11940. ele.push(vue.h("span", {
  11941. class: ns.e("indent"),
  11942. style: { "padding-left": `${treeNode.indent}px` }
  11943. }));
  11944. }
  11945. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  11946. const expandClasses = [
  11947. ns.e("expand-icon"),
  11948. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  11949. ];
  11950. let icon = arrow_right_default;
  11951. if (treeNode.loading) {
  11952. icon = loading_default;
  11953. }
  11954. ele.push(vue.h("div", {
  11955. class: expandClasses,
  11956. onClick: callback
  11957. }, {
  11958. default: () => {
  11959. return [
  11960. vue.h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  11961. default: () => [vue.h(icon)]
  11962. })
  11963. ];
  11964. }
  11965. }));
  11966. } else {
  11967. ele.push(vue.h("span", {
  11968. class: ns.e("placeholder")
  11969. }));
  11970. }
  11971. return ele;
  11972. }
  11973. function getAllAliases(props, aliases) {
  11974. return props.reduce((prev, cur) => {
  11975. prev[cur] = cur;
  11976. return prev;
  11977. }, aliases);
  11978. }
  11979. function useWatcher(owner, props_) {
  11980. const instance = vue.getCurrentInstance();
  11981. const registerComplexWatchers = () => {
  11982. const props = ["fixed"];
  11983. const aliases = {
  11984. realWidth: "width",
  11985. realMinWidth: "minWidth"
  11986. };
  11987. const allAliases = getAllAliases(props, aliases);
  11988. Object.keys(allAliases).forEach((key) => {
  11989. const columnKey = aliases[key];
  11990. if (hasOwn(props_, columnKey)) {
  11991. vue.watch(() => props_[columnKey], (newVal) => {
  11992. let value = newVal;
  11993. if (columnKey === "width" && key === "realWidth") {
  11994. value = parseWidth(newVal);
  11995. }
  11996. if (columnKey === "minWidth" && key === "realMinWidth") {
  11997. value = parseMinWidth(newVal);
  11998. }
  11999. instance.columnConfig.value[columnKey] = value;
  12000. instance.columnConfig.value[key] = value;
  12001. const updateColumns = columnKey === "fixed";
  12002. owner.value.store.scheduleLayout(updateColumns);
  12003. });
  12004. }
  12005. });
  12006. };
  12007. const registerNormalWatchers = () => {
  12008. const props = [
  12009. "label",
  12010. "filters",
  12011. "filterMultiple",
  12012. "filteredValue",
  12013. "sortable",
  12014. "index",
  12015. "formatter",
  12016. "className",
  12017. "labelClassName",
  12018. "filterClassName",
  12019. "showOverflowTooltip"
  12020. ];
  12021. const aliases = {
  12022. property: "prop",
  12023. align: "realAlign",
  12024. headerAlign: "realHeaderAlign"
  12025. };
  12026. const allAliases = getAllAliases(props, aliases);
  12027. Object.keys(allAliases).forEach((key) => {
  12028. const columnKey = aliases[key];
  12029. if (hasOwn(props_, columnKey)) {
  12030. vue.watch(() => props_[columnKey], (newVal) => {
  12031. instance.columnConfig.value[key] = newVal;
  12032. });
  12033. }
  12034. });
  12035. };
  12036. return {
  12037. registerComplexWatchers,
  12038. registerNormalWatchers
  12039. };
  12040. }
  12041. function useRender(props, slots, owner) {
  12042. const instance = vue.getCurrentInstance();
  12043. const columnId = vue.ref("");
  12044. const isSubColumn = vue.ref(false);
  12045. const realAlign = vue.ref();
  12046. const realHeaderAlign = vue.ref();
  12047. const ns = useNamespace("table");
  12048. vue.watchEffect(() => {
  12049. realAlign.value = props.align ? `is-${props.align}` : null;
  12050. realAlign.value;
  12051. });
  12052. vue.watchEffect(() => {
  12053. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  12054. realHeaderAlign.value;
  12055. });
  12056. const columnOrTableParent = vue.computed(() => {
  12057. let parent = instance.vnode.vParent || instance.parent;
  12058. while (parent && !parent.tableId && !parent.columnId) {
  12059. parent = parent.vnode.vParent || parent.parent;
  12060. }
  12061. return parent;
  12062. });
  12063. const hasTreeColumn = vue.computed(() => {
  12064. const { store } = instance.parent;
  12065. if (!store)
  12066. return false;
  12067. const { treeData } = store.states;
  12068. const treeDataValue = treeData.value;
  12069. return treeDataValue && Object.keys(treeDataValue).length > 0;
  12070. });
  12071. const realWidth = vue.ref(parseWidth(props.width));
  12072. const realMinWidth = vue.ref(parseMinWidth(props.minWidth));
  12073. const setColumnWidth = (column) => {
  12074. if (realWidth.value)
  12075. column.width = realWidth.value;
  12076. if (realMinWidth.value) {
  12077. column.minWidth = realMinWidth.value;
  12078. }
  12079. if (!realWidth.value && realMinWidth.value) {
  12080. column.width = void 0;
  12081. }
  12082. if (!column.minWidth) {
  12083. column.minWidth = 80;
  12084. }
  12085. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  12086. return column;
  12087. };
  12088. const setColumnForcedProps = (column) => {
  12089. const type = column.type;
  12090. const source = cellForced[type] || {};
  12091. Object.keys(source).forEach((prop) => {
  12092. const value = source[prop];
  12093. if (prop !== "className" && value !== void 0) {
  12094. column[prop] = value;
  12095. }
  12096. });
  12097. const className = getDefaultClassName(type);
  12098. if (className) {
  12099. const forceClass = `${vue.unref(ns.namespace)}-${className}`;
  12100. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  12101. }
  12102. return column;
  12103. };
  12104. const checkSubColumn = (children) => {
  12105. if (Array.isArray(children)) {
  12106. children.forEach((child) => check(child));
  12107. } else {
  12108. check(children);
  12109. }
  12110. function check(item) {
  12111. var _a2;
  12112. if (((_a2 = item == null ? void 0 : item.type) == null ? void 0 : _a2.name) === "ElTableColumn") {
  12113. item.vParent = instance;
  12114. }
  12115. }
  12116. };
  12117. const setColumnRenders = (column) => {
  12118. if (props.renderHeader)
  12119. ;
  12120. else if (column.type !== "selection") {
  12121. column.renderHeader = (scope) => {
  12122. instance.columnConfig.value["label"];
  12123. return vue.renderSlot(slots, "header", scope, () => [column.label]);
  12124. };
  12125. }
  12126. let originRenderCell = column.renderCell;
  12127. if (column.type === "expand") {
  12128. column.renderCell = (data) => vue.h("div", {
  12129. class: "cell"
  12130. }, [originRenderCell(data)]);
  12131. owner.value.renderExpanded = (data) => {
  12132. return slots.default ? slots.default(data) : slots.default;
  12133. };
  12134. } else {
  12135. originRenderCell = originRenderCell || defaultRenderCell;
  12136. column.renderCell = (data) => {
  12137. let children = null;
  12138. if (slots.default) {
  12139. const vnodes = slots.default(data);
  12140. children = vnodes.some((v2) => v2.type !== vue.Comment) ? vnodes : originRenderCell(data);
  12141. } else {
  12142. children = originRenderCell(data);
  12143. }
  12144. const { columns } = owner.value.store.states;
  12145. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  12146. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  12147. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  12148. const props2 = {
  12149. class: "cell",
  12150. style: {}
  12151. };
  12152. if (column.showOverflowTooltip) {
  12153. props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`;
  12154. props2.style = {
  12155. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  12156. };
  12157. }
  12158. checkSubColumn(children);
  12159. return vue.h("div", props2, [prefix, children]);
  12160. };
  12161. }
  12162. return column;
  12163. };
  12164. const getPropsData = (...propsKey) => {
  12165. return propsKey.reduce((prev, cur) => {
  12166. if (Array.isArray(cur)) {
  12167. cur.forEach((key) => {
  12168. prev[key] = props[key];
  12169. });
  12170. }
  12171. return prev;
  12172. }, {});
  12173. };
  12174. const getColumnElIndex = (children, child) => {
  12175. return Array.prototype.indexOf.call(children, child);
  12176. };
  12177. const updateColumnOrder = () => {
  12178. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  12179. };
  12180. return {
  12181. columnId,
  12182. realAlign,
  12183. isSubColumn,
  12184. realHeaderAlign,
  12185. columnOrTableParent,
  12186. setColumnWidth,
  12187. setColumnForcedProps,
  12188. setColumnRenders,
  12189. getPropsData,
  12190. getColumnElIndex,
  12191. updateColumnOrder
  12192. };
  12193. }
  12194. var defaultProps = {
  12195. type: {
  12196. type: String,
  12197. default: "default"
  12198. },
  12199. label: String,
  12200. className: String,
  12201. labelClassName: String,
  12202. property: String,
  12203. prop: String,
  12204. width: {
  12205. type: [String, Number],
  12206. default: ""
  12207. },
  12208. minWidth: {
  12209. type: [String, Number],
  12210. default: ""
  12211. },
  12212. renderHeader: Function,
  12213. sortable: {
  12214. type: [Boolean, String],
  12215. default: false
  12216. },
  12217. sortMethod: Function,
  12218. sortBy: [String, Function, Array],
  12219. resizable: {
  12220. type: Boolean,
  12221. default: true
  12222. },
  12223. columnKey: String,
  12224. align: String,
  12225. headerAlign: String,
  12226. showOverflowTooltip: {
  12227. type: [Boolean, Object],
  12228. default: void 0
  12229. },
  12230. fixed: [Boolean, String],
  12231. formatter: Function,
  12232. selectable: Function,
  12233. reserveSelection: Boolean,
  12234. filterMethod: Function,
  12235. filteredValue: Array,
  12236. filters: Array,
  12237. filterPlacement: String,
  12238. filterMultiple: {
  12239. type: Boolean,
  12240. default: true
  12241. },
  12242. filterClassName: String,
  12243. index: [Number, Function],
  12244. sortOrders: {
  12245. type: Array,
  12246. default: () => {
  12247. return ["ascending", "descending", null];
  12248. },
  12249. validator: (val) => {
  12250. return val.every((order) => ["ascending", "descending", null].includes(order));
  12251. }
  12252. }
  12253. };
  12254. let columnIdSeed = 1;
  12255. var ElTableColumn$1 = vue.defineComponent({
  12256. name: "ElTableColumn",
  12257. components: {
  12258. ElCheckbox
  12259. },
  12260. props: defaultProps,
  12261. setup(props, { slots }) {
  12262. const instance = vue.getCurrentInstance();
  12263. const columnConfig = vue.ref({});
  12264. const owner = vue.computed(() => {
  12265. let parent2 = instance.parent;
  12266. while (parent2 && !parent2.tableId) {
  12267. parent2 = parent2.parent;
  12268. }
  12269. return parent2;
  12270. });
  12271. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  12272. const {
  12273. columnId,
  12274. isSubColumn,
  12275. realHeaderAlign,
  12276. columnOrTableParent,
  12277. setColumnWidth,
  12278. setColumnForcedProps,
  12279. setColumnRenders,
  12280. getPropsData,
  12281. getColumnElIndex,
  12282. realAlign,
  12283. updateColumnOrder
  12284. } = useRender(props, slots, owner);
  12285. const parent = columnOrTableParent.value;
  12286. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  12287. vue.onBeforeMount(() => {
  12288. isSubColumn.value = owner.value !== parent;
  12289. const type = props.type || "default";
  12290. const sortable = props.sortable === "" ? true : props.sortable;
  12291. const showOverflowTooltip = isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  12292. const defaults = {
  12293. ...cellStarts[type],
  12294. id: columnId.value,
  12295. type,
  12296. property: props.prop || props.property,
  12297. align: realAlign,
  12298. headerAlign: realHeaderAlign,
  12299. showOverflowTooltip,
  12300. filterable: props.filters || props.filterMethod,
  12301. filteredValue: [],
  12302. filterPlacement: "",
  12303. filterClassName: "",
  12304. isColumnGroup: false,
  12305. isSubColumn: false,
  12306. filterOpened: false,
  12307. sortable,
  12308. index: props.index,
  12309. rawColumnKey: instance.vnode.key
  12310. };
  12311. const basicProps = [
  12312. "columnKey",
  12313. "label",
  12314. "className",
  12315. "labelClassName",
  12316. "type",
  12317. "renderHeader",
  12318. "formatter",
  12319. "fixed",
  12320. "resizable"
  12321. ];
  12322. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  12323. const selectProps = ["selectable", "reserveSelection"];
  12324. const filterProps = [
  12325. "filterMethod",
  12326. "filters",
  12327. "filterMultiple",
  12328. "filterOpened",
  12329. "filteredValue",
  12330. "filterPlacement",
  12331. "filterClassName"
  12332. ];
  12333. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  12334. column = mergeOptions(defaults, column);
  12335. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  12336. column = chains(column);
  12337. columnConfig.value = column;
  12338. registerNormalWatchers();
  12339. registerComplexWatchers();
  12340. });
  12341. vue.onMounted(() => {
  12342. var _a2;
  12343. const parent2 = columnOrTableParent.value;
  12344. const children = isSubColumn.value ? parent2.vnode.el.children : (_a2 = parent2.refs.hiddenColumns) == null ? void 0 : _a2.children;
  12345. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  12346. columnConfig.value.getColumnIndex = getColumnIndex;
  12347. const columnIndex = getColumnIndex();
  12348. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
  12349. });
  12350. vue.onBeforeUnmount(() => {
  12351. const columnIndex = columnConfig.value.getColumnIndex();
  12352. columnIndex > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
  12353. });
  12354. instance.columnId = columnId.value;
  12355. instance.columnConfig = columnConfig;
  12356. return;
  12357. },
  12358. render() {
  12359. var _a2, _b, _c;
  12360. try {
  12361. const renderDefault = (_b = (_a2 = this.$slots).default) == null ? void 0 : _b.call(_a2, {
  12362. row: {},
  12363. column: {},
  12364. $index: -1
  12365. });
  12366. const children = [];
  12367. if (Array.isArray(renderDefault)) {
  12368. for (const childNode of renderDefault) {
  12369. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  12370. children.push(childNode);
  12371. } else if (childNode.type === vue.Fragment && Array.isArray(childNode.children)) {
  12372. childNode.children.forEach((vnode2) => {
  12373. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
  12374. children.push(vnode2);
  12375. }
  12376. });
  12377. }
  12378. }
  12379. }
  12380. const vnode = vue.h("div", children);
  12381. return vnode;
  12382. } catch (e) {
  12383. return vue.h("div", []);
  12384. }
  12385. }
  12386. });
  12387. const ElTable = withInstall(Table, {
  12388. TableColumn: ElTableColumn$1
  12389. });
  12390. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  12391. const messageTypes = ["success", "info", "warning", "error"];
  12392. const messageDefaults = mutable({
  12393. customClass: "",
  12394. center: false,
  12395. dangerouslyUseHTMLString: false,
  12396. duration: 3e3,
  12397. icon: void 0,
  12398. id: "",
  12399. message: "",
  12400. onClose: void 0,
  12401. showClose: false,
  12402. type: "info",
  12403. plain: false,
  12404. offset: 16,
  12405. zIndex: 0,
  12406. grouping: false,
  12407. repeatNum: 1,
  12408. appendTo: isClient ? document.body : void 0
  12409. });
  12410. const messageProps = buildProps({
  12411. customClass: {
  12412. type: String,
  12413. default: messageDefaults.customClass
  12414. },
  12415. center: {
  12416. type: Boolean,
  12417. default: messageDefaults.center
  12418. },
  12419. dangerouslyUseHTMLString: {
  12420. type: Boolean,
  12421. default: messageDefaults.dangerouslyUseHTMLString
  12422. },
  12423. duration: {
  12424. type: Number,
  12425. default: messageDefaults.duration
  12426. },
  12427. icon: {
  12428. type: iconPropType,
  12429. default: messageDefaults.icon
  12430. },
  12431. id: {
  12432. type: String,
  12433. default: messageDefaults.id
  12434. },
  12435. message: {
  12436. type: definePropType([
  12437. String,
  12438. Object,
  12439. Function
  12440. ]),
  12441. default: messageDefaults.message
  12442. },
  12443. onClose: {
  12444. type: definePropType(Function),
  12445. default: messageDefaults.onClose
  12446. },
  12447. showClose: {
  12448. type: Boolean,
  12449. default: messageDefaults.showClose
  12450. },
  12451. type: {
  12452. type: String,
  12453. values: messageTypes,
  12454. default: messageDefaults.type
  12455. },
  12456. plain: {
  12457. type: Boolean,
  12458. default: messageDefaults.plain
  12459. },
  12460. offset: {
  12461. type: Number,
  12462. default: messageDefaults.offset
  12463. },
  12464. zIndex: {
  12465. type: Number,
  12466. default: messageDefaults.zIndex
  12467. },
  12468. grouping: {
  12469. type: Boolean,
  12470. default: messageDefaults.grouping
  12471. },
  12472. repeatNum: {
  12473. type: Number,
  12474. default: messageDefaults.repeatNum
  12475. }
  12476. });
  12477. const messageEmits = {
  12478. destroy: () => true
  12479. };
  12480. const instances = vue.shallowReactive([]);
  12481. const getInstance = (id) => {
  12482. const idx = instances.findIndex((instance) => instance.id === id);
  12483. const current = instances[idx];
  12484. let prev;
  12485. if (idx > 0) {
  12486. prev = instances[idx - 1];
  12487. }
  12488. return { current, prev };
  12489. };
  12490. const getLastOffset = (id) => {
  12491. const { prev } = getInstance(id);
  12492. if (!prev)
  12493. return 0;
  12494. return prev.vm.exposed.bottom.value;
  12495. };
  12496. const getOffsetOrSpace = (id, offset) => {
  12497. const idx = instances.findIndex((instance) => instance.id === id);
  12498. return idx > 0 ? 16 : offset;
  12499. };
  12500. const _hoisted_1$1 = ["id"];
  12501. const _hoisted_2$1 = ["innerHTML"];
  12502. const __default__ = vue.defineComponent({
  12503. name: "ElMessage"
  12504. });
  12505. const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
  12506. ...__default__,
  12507. props: messageProps,
  12508. emits: messageEmits,
  12509. setup(__props, { expose }) {
  12510. const props = __props;
  12511. const { Close } = TypeComponents;
  12512. const { ns, zIndex: zIndex2 } = useGlobalComponentSettings("message");
  12513. const { currentZIndex, nextZIndex } = zIndex2;
  12514. const messageRef = vue.ref();
  12515. const visible = vue.ref(false);
  12516. const height = vue.ref(0);
  12517. let stopTimer = void 0;
  12518. const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  12519. const typeClass = vue.computed(() => {
  12520. const type = props.type;
  12521. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  12522. });
  12523. const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
  12524. const lastOffset = vue.computed(() => getLastOffset(props.id));
  12525. const offset = vue.computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
  12526. const bottom = vue.computed(() => height.value + offset.value);
  12527. const customStyle = vue.computed(() => ({
  12528. top: `${offset.value}px`,
  12529. zIndex: currentZIndex.value
  12530. }));
  12531. function startTimer() {
  12532. if (props.duration === 0)
  12533. return;
  12534. ({ stop: stopTimer } = useTimeoutFn(() => {
  12535. close();
  12536. }, props.duration));
  12537. }
  12538. function clearTimer() {
  12539. stopTimer == null ? void 0 : stopTimer();
  12540. }
  12541. function close() {
  12542. visible.value = false;
  12543. }
  12544. function keydown({ code }) {
  12545. if (code === EVENT_CODE.esc) {
  12546. close();
  12547. }
  12548. }
  12549. vue.onMounted(() => {
  12550. startTimer();
  12551. nextZIndex();
  12552. visible.value = true;
  12553. });
  12554. vue.watch(() => props.repeatNum, () => {
  12555. clearTimer();
  12556. startTimer();
  12557. });
  12558. useEventListener(document, "keydown", keydown);
  12559. useResizeObserver(messageRef, () => {
  12560. height.value = messageRef.value.getBoundingClientRect().height;
  12561. });
  12562. expose({
  12563. visible,
  12564. bottom,
  12565. close
  12566. });
  12567. return (_ctx, _cache) => {
  12568. return vue.openBlock(), vue.createBlock(vue.Transition, {
  12569. name: vue.unref(ns).b("fade"),
  12570. onBeforeLeave: _ctx.onClose,
  12571. onAfterLeave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("destroy")),
  12572. persisted: ""
  12573. }, {
  12574. default: vue.withCtx(() => [
  12575. vue.withDirectives(vue.createElementVNode("div", {
  12576. id: _ctx.id,
  12577. ref_key: "messageRef",
  12578. ref: messageRef,
  12579. class: vue.normalizeClass([
  12580. vue.unref(ns).b(),
  12581. { [vue.unref(ns).m(_ctx.type)]: _ctx.type },
  12582. vue.unref(ns).is("center", _ctx.center),
  12583. vue.unref(ns).is("closable", _ctx.showClose),
  12584. vue.unref(ns).is("plain", _ctx.plain),
  12585. _ctx.customClass
  12586. ]),
  12587. style: vue.normalizeStyle(vue.unref(customStyle)),
  12588. role: "alert",
  12589. onMouseenter: clearTimer,
  12590. onMouseleave: startTimer
  12591. }, [
  12592. _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
  12593. key: 0,
  12594. value: _ctx.repeatNum,
  12595. type: vue.unref(badgeType),
  12596. class: vue.normalizeClass(vue.unref(ns).e("badge"))
  12597. }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
  12598. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  12599. key: 1,
  12600. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  12601. }, {
  12602. default: vue.withCtx(() => [
  12603. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  12604. ]),
  12605. _: 1
  12606. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  12607. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  12608. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
  12609. key: 0,
  12610. class: vue.normalizeClass(vue.unref(ns).e("content"))
  12611. }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  12612. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  12613. vue.createElementVNode("p", {
  12614. class: vue.normalizeClass(vue.unref(ns).e("content")),
  12615. innerHTML: _ctx.message
  12616. }, null, 10, _hoisted_2$1)
  12617. ], 2112))
  12618. ]),
  12619. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  12620. key: 2,
  12621. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  12622. onClick: vue.withModifiers(close, ["stop"])
  12623. }, {
  12624. default: vue.withCtx(() => [
  12625. vue.createVNode(vue.unref(Close))
  12626. ]),
  12627. _: 1
  12628. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  12629. ], 46, _hoisted_1$1), [
  12630. [vue.vShow, visible.value]
  12631. ])
  12632. ]),
  12633. _: 3
  12634. }, 8, ["name", "onBeforeLeave"]);
  12635. };
  12636. }
  12637. });
  12638. var MessageConstructor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["__file", "message.vue"]]);
  12639. let seed = 1;
  12640. const normalizeOptions = (params) => {
  12641. const options = !params || isString(params) || vue.isVNode(params) || isFunction$1(params) ? { message: params } : params;
  12642. const normalized = {
  12643. ...messageDefaults,
  12644. ...options
  12645. };
  12646. if (!normalized.appendTo) {
  12647. normalized.appendTo = document.body;
  12648. } else if (isString(normalized.appendTo)) {
  12649. let appendTo = document.querySelector(normalized.appendTo);
  12650. if (!isElement(appendTo)) {
  12651. appendTo = document.body;
  12652. }
  12653. normalized.appendTo = appendTo;
  12654. }
  12655. return normalized;
  12656. };
  12657. const closeMessage = (instance) => {
  12658. const idx = instances.indexOf(instance);
  12659. if (idx === -1)
  12660. return;
  12661. instances.splice(idx, 1);
  12662. const { handler } = instance;
  12663. handler.close();
  12664. };
  12665. const createMessage = ({ appendTo, ...options }, context) => {
  12666. const id = `message_${seed++}`;
  12667. const userOnClose = options.onClose;
  12668. const container = document.createElement("div");
  12669. const props = {
  12670. ...options,
  12671. id,
  12672. onClose: () => {
  12673. userOnClose == null ? void 0 : userOnClose();
  12674. closeMessage(instance);
  12675. },
  12676. onDestroy: () => {
  12677. vue.render(null, container);
  12678. }
  12679. };
  12680. const vnode = vue.createVNode(MessageConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  12681. default: isFunction$1(props.message) ? props.message : () => props.message
  12682. } : null);
  12683. vnode.appContext = context || message._context;
  12684. vue.render(vnode, container);
  12685. appendTo.appendChild(container.firstElementChild);
  12686. const vm = vnode.component;
  12687. const handler = {
  12688. close: () => {
  12689. vm.exposed.visible.value = false;
  12690. }
  12691. };
  12692. const instance = {
  12693. id,
  12694. vnode,
  12695. vm,
  12696. handler,
  12697. props: vnode.component.props
  12698. };
  12699. return instance;
  12700. };
  12701. const message = (options = {}, context) => {
  12702. if (!isClient)
  12703. return { close: () => void 0 };
  12704. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  12705. return { close: () => void 0 };
  12706. }
  12707. const normalized = normalizeOptions(options);
  12708. if (normalized.grouping && instances.length) {
  12709. const instance2 = instances.find(({ vnode: vm }) => {
  12710. var _a2;
  12711. return ((_a2 = vm.props) == null ? void 0 : _a2.message) === normalized.message;
  12712. });
  12713. if (instance2) {
  12714. instance2.props.repeatNum += 1;
  12715. instance2.props.type = normalized.type;
  12716. return instance2.handler;
  12717. }
  12718. }
  12719. const instance = createMessage(normalized, context);
  12720. instances.push(instance);
  12721. return instance.handler;
  12722. };
  12723. messageTypes.forEach((type) => {
  12724. message[type] = (options = {}, appContext) => {
  12725. const normalized = normalizeOptions(options);
  12726. return message({ ...normalized, type }, appContext);
  12727. };
  12728. });
  12729. function closeAll(type) {
  12730. for (const instance of instances) {
  12731. if (!type || type === instance.props.type) {
  12732. instance.handler.close();
  12733. }
  12734. }
  12735. }
  12736. message.closeAll = closeAll;
  12737. message._context = null;
  12738. const ElMessage = withInstallFunction(message, "$message");
  12739. const App_vue_vue_type_style_index_0_scoped_062ced24_lang = "";
  12740. const _export_sfc = (sfc, props) => {
  12741. const target = sfc.__vccOpts || sfc;
  12742. for (const [key, val] of props) {
  12743. target[key] = val;
  12744. }
  12745. return target;
  12746. };
  12747. const _withScopeId = (n) => (vue.pushScopeId("data-v-062ced24"), n = n(), vue.popScopeId(), n);
  12748. const _hoisted_1 = { class: "group-btn-data-wrapper" };
  12749. const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("i", {
  12750. class: "iconfont icon-data",
  12751. title: "\u67E5\u770B\u672C\u5730\u6570\u636E"
  12752. }, null, -1));
  12753. const _sfc_main = {
  12754. __name: "App",
  12755. setup(__props) {
  12756. const tableData = vue.ref([]);
  12757. function onShowData() {
  12758. tableData.value = [];
  12759. tableData.value.push({
  12760. type: "cookie",
  12761. key: "cookie",
  12762. value: document.cookie
  12763. });
  12764. Object.keys(localStorage).forEach((key) => {
  12765. tableData.value.push({
  12766. type: "localStorage",
  12767. key,
  12768. value: localStorage.getItem(key)
  12769. });
  12770. });
  12771. Object.keys(sessionStorage).forEach((key) => {
  12772. tableData.value.push({
  12773. type: "sessionStorage",
  12774. key,
  12775. value: sessionStorage.getItem(key)
  12776. });
  12777. });
  12778. console.log(tableData.value);
  12779. }
  12780. function onCopyCurrent(row) {
  12781. console.log(row.value);
  12782. GM_setClipboard(row.value || "", "text");
  12783. ElMessage({
  12784. message: "\u590D\u5236\u6210\u529F",
  12785. type: "success"
  12786. });
  12787. }
  12788. return (_ctx, _cache) => {
  12789. return vue.openBlock(), vue.createElementBlock("div", null, [
  12790. vue.createElementVNode("div", _hoisted_1, [
  12791. vue.createVNode(vue.unref(ElPopover), {
  12792. placement: "left",
  12793. trigger: "click",
  12794. onShow: onShowData,
  12795. width: "800px"
  12796. }, {
  12797. reference: vue.withCtx(() => [
  12798. _hoisted_2
  12799. ]),
  12800. default: vue.withCtx(() => [
  12801. vue.createVNode(vue.unref(ElTable), {
  12802. data: tableData.value,
  12803. height: "250"
  12804. }, {
  12805. default: vue.withCtx(() => [
  12806. vue.createVNode(vue.unref(ElTableColumn), {
  12807. property: "type",
  12808. label: "\u6570\u636E\u7C7B\u578B",
  12809. "show-overflow-tooltip": ""
  12810. }),
  12811. vue.createVNode(vue.unref(ElTableColumn), {
  12812. property: "key",
  12813. label: "\u952E",
  12814. "show-overflow-tooltip": ""
  12815. }),
  12816. vue.createVNode(vue.unref(ElTableColumn), {
  12817. property: "value",
  12818. label: "\u503C",
  12819. "show-overflow-tooltip": ""
  12820. }),
  12821. vue.createVNode(vue.unref(ElTableColumn), { align: "right" }, {
  12822. default: vue.withCtx((scope) => [
  12823. vue.createVNode(vue.unref(ElButton), {
  12824. onClick: ($event) => onCopyCurrent(scope.row)
  12825. }, {
  12826. default: vue.withCtx(() => [
  12827. vue.createTextVNode(" \u590D\u5236\u5F53\u524D\u6570\u636E ")
  12828. ]),
  12829. _: 2
  12830. }, 1032, ["onClick"])
  12831. ]),
  12832. _: 1
  12833. })
  12834. ]),
  12835. _: 1
  12836. }, 8, ["data"])
  12837. ]),
  12838. _: 1
  12839. })
  12840. ])
  12841. ]);
  12842. };
  12843. }
  12844. };
  12845. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-062ced24"]]);
  12846. let link = document.createElement("link");
  12847. link.setAttribute("rel", "stylesheet");
  12848. link.href = "https://unpkg.com/element-plus/dist/index.css";
  12849. document.documentElement.appendChild(link);
  12850. vue.createApp(App).mount(
  12851. (() => {
  12852. const app = document.createElement("div");
  12853. document.body.append(app);
  12854. return app;
  12855. })()
  12856. );
  12857. })(Vue);