@antdv/pro-list
Version:
@antdv/pro-list
1,458 lines • 962 kB
JavaScript
import require$$0, { Fragment, isVNode, Comment, Text, inject, shallowRef, getCurrentInstance, defineComponent, watch, unref, provide, watchEffect, onBeforeUnmount, ref, computed, triggerRef, createVNode, h as h$1, cloneVNode, nextTick, reactive, Transition, withDirectives, resolveDirective, onMounted, onUpdated, onUnmounted, toRef, withModifiers, vShow, onBeforeMount, Teleport, createTextVNode, isRef, toRefs, toRaw, render, mergeProps } from "vue";
import { ProProvider, get, useStyle as useStyle$e, ProConfigProvider } from "@antdv/pro-provider";
import ProTable, { proTableProps } from "@antdv/pro-table";
import { useMountMergeState, classNames as classNames$1, oneOfType, funcType, objectType as objectType$2, boolType, stringType as stringType$2, vNodeType as vNodeType$2, numberType, anyType as anyType$2, isValidElement as isValidElement$1, arrayType as arrayType$2, omit as omit$1 } from "@antdv/pro-utils";
import { isEmpty } from "lodash-es";
import { RightOutlined as RightOutlined$2 } from "@ant-design/icons-vue";
import { CheckCard } from "@antdv/pro-card";
function _typeof$1(o2) {
"@babel/helpers - typeof";
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
return typeof o3;
} : function(o3) {
return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
}, _typeof$1(o2);
}
function toPrimitive(t2, r2) {
if ("object" != _typeof$1(t2) || !t2) return t2;
var e2 = t2[Symbol.toPrimitive];
if (void 0 !== e2) {
var i2 = e2.call(t2, r2);
if ("object" != _typeof$1(i2)) return i2;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r2 ? String : Number)(t2);
}
function toPropertyKey(t2) {
var i2 = toPrimitive(t2, "string");
return "symbol" == _typeof$1(i2) ? i2 : i2 + "";
}
function _defineProperty$f(e2, r2, t2) {
return (r2 = toPropertyKey(r2)) in e2 ? Object.defineProperty(e2, r2, {
value: t2,
enumerable: true,
configurable: true,
writable: true
}) : e2[r2] = t2, e2;
}
function ownKeys$1(e2, r2) {
var t2 = Object.keys(e2);
if (Object.getOwnPropertySymbols) {
var o2 = Object.getOwnPropertySymbols(e2);
r2 && (o2 = o2.filter(function(r3) {
return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
})), t2.push.apply(t2, o2);
}
return t2;
}
function _objectSpread2$1(e2) {
for (var r2 = 1; r2 < arguments.length; r2++) {
var t2 = null != arguments[r2] ? arguments[r2] : {};
r2 % 2 ? ownKeys$1(Object(t2), true).forEach(function(r3) {
_defineProperty$f(e2, r3, t2[r3]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1(Object(t2)).forEach(function(r3) {
Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
});
}
return e2;
}
function _extends$1() {
return _extends$1 = Object.assign ? Object.assign.bind() : function(n2) {
for (var e2 = 1; e2 < arguments.length; e2++) {
var t2 = arguments[e2];
for (var r2 in t2) ({}).hasOwnProperty.call(t2, r2) && (n2[r2] = t2[r2]);
}
return n2;
}, _extends$1.apply(null, arguments);
}
const isFunction$1 = (val) => typeof val === "function";
const isArray$1 = Array.isArray;
const isString = (val) => typeof val === "string";
const isObject$1 = (val) => val !== null && typeof val === "object";
const onRE = /^on[^a-z]/;
const isOn = (key) => onRE.test(key);
const cacheStringFunction = (fn) => {
const cache = /* @__PURE__ */ Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
};
const camelizeRE = /-(\w)/g;
const camelize = cacheStringFunction((str) => {
return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : "");
});
const hyphenateRE = /\B([A-Z])/g;
const hyphenate = cacheStringFunction((str) => {
return str.replace(hyphenateRE, "-$1").toLowerCase();
});
const hasOwnProperty$9 = Object.prototype.hasOwnProperty;
const hasOwn = (val, key) => hasOwnProperty$9.call(val, key);
function resolvePropValue(options, props2, key, value) {
const opt = options[key];
if (opt != null) {
const hasDefault = hasOwn(opt, "default");
if (hasDefault && value === void 0) {
const defaultValue = opt.default;
value = opt.type !== Function && isFunction$1(defaultValue) ? defaultValue() : defaultValue;
}
if (opt.type === Boolean) {
if (!hasOwn(props2, key) && !hasDefault) {
value = false;
} else if (value === "") {
value = true;
}
}
}
return value;
}
function toPx(val) {
if (typeof val === "number") return `${val}px`;
return val;
}
function classNames() {
const classes = [];
for (let i2 = 0; i2 < arguments.length; i2++) {
const value = i2 < 0 || arguments.length <= i2 ? void 0 : arguments[i2];
if (!value) continue;
if (isString(value)) {
classes.push(value);
} else if (isArray$1(value)) {
for (let i3 = 0; i3 < value.length; i3++) {
const inner = classNames(value[i3]);
if (inner) {
classes.push(inner);
}
}
} else if (isObject$1(value)) {
for (const name in value) {
if (value[name]) {
classes.push(name);
}
}
}
}
return classes.join(" ");
}
function throttle$1(delay, callback, options) {
var _ref = options || {}, _ref$noTrailing = _ref.noTrailing, noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing, _ref$noLeading = _ref.noLeading, noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading, _ref$debounceMode = _ref.debounceMode, debounceMode = _ref$debounceMode === void 0 ? void 0 : _ref$debounceMode;
var timeoutID;
var cancelled = false;
var lastExec = 0;
function clearExistingTimeout() {
if (timeoutID) {
clearTimeout(timeoutID);
}
}
function cancel(options2) {
var _ref2 = options2 || {}, _ref2$upcomingOnly = _ref2.upcomingOnly, upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
clearExistingTimeout();
cancelled = !upcomingOnly;
}
function wrapper() {
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
arguments_[_key] = arguments[_key];
}
var self2 = this;
var elapsed = Date.now() - lastExec;
if (cancelled) {
return;
}
function exec() {
lastExec = Date.now();
callback.apply(self2, arguments_);
}
function clear() {
timeoutID = void 0;
}
if (!noLeading && debounceMode && !timeoutID) {
exec();
}
clearExistingTimeout();
if (debounceMode === void 0 && elapsed > delay) {
if (noLeading) {
lastExec = Date.now();
if (!noTrailing) {
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
}
} else {
exec();
}
} else if (noTrailing !== true) {
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay - elapsed : delay);
}
}
wrapper.cancel = cancel;
return wrapper;
}
function debounce(delay, callback, options) {
var _ref = {}, _ref$atBegin = _ref.atBegin, atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;
return throttle$1(delay, callback, {
debounceMode: atBegin !== false
});
}
function e(e2, t2) {
for (var n2 = 0; n2 < t2.length; n2++) {
var r2 = t2[n2];
r2.enumerable = r2.enumerable || false, r2.configurable = true, "value" in r2 && (r2.writable = true), Object.defineProperty(e2, r2.key, r2);
}
}
function t(t2, n2, r2) {
return r2 && e(t2, r2), t2;
}
function n() {
return (n = Object.assign || function(e2) {
for (var t2 = 1; t2 < arguments.length; t2++) {
var n2 = arguments[t2];
for (var r2 in n2) Object.prototype.hasOwnProperty.call(n2, r2) && (e2[r2] = n2[r2]);
}
return e2;
}).apply(this, arguments);
}
function r(e2, t2) {
e2.prototype = Object.create(t2.prototype), e2.prototype.constructor = e2, e2.__proto__ = t2;
}
function i(e2, t2) {
if (null == e2) return {};
var n2, r2, i2 = {}, o2 = Object.keys(e2);
for (r2 = 0; r2 < o2.length; r2++) t2.indexOf(n2 = o2[r2]) >= 0 || (i2[n2] = e2[n2]);
return i2;
}
function o(e2) {
return 1 == (null != (t2 = e2) && "object" == typeof t2 && false === Array.isArray(t2)) && "[object Object]" === Object.prototype.toString.call(e2);
var t2;
}
var u = Object.prototype, a = u.toString, f = u.hasOwnProperty, c = /^\s*function (\w+)/;
function l(e2) {
var t2, n2 = null !== (t2 = null == e2 ? void 0 : e2.type) && void 0 !== t2 ? t2 : e2;
if (n2) {
var r2 = n2.toString().match(c);
return r2 ? r2[1] : "";
}
return "";
}
var s = function(e2) {
var t2, n2;
return false !== o(e2) && "function" == typeof (t2 = e2.constructor) && false !== o(n2 = t2.prototype) && false !== n2.hasOwnProperty("isPrototypeOf");
}, v = function(e2) {
return e2;
}, y = v;
if ("production" !== process.env.NODE_ENV) {
var p = "undefined" != typeof console;
y = p ? function(e2) {
console.warn("[VueTypes warn]: " + e2);
} : v;
}
var d = function(e2, t2) {
return f.call(e2, t2);
}, h = Number.isInteger || function(e2) {
return "number" == typeof e2 && isFinite(e2) && Math.floor(e2) === e2;
}, b = Array.isArray || function(e2) {
return "[object Array]" === a.call(e2);
}, O = function(e2) {
return "[object Function]" === a.call(e2);
}, g = function(e2) {
return s(e2) && d(e2, "_vueTypes_name");
}, m = function(e2) {
return s(e2) && (d(e2, "type") || ["_vueTypes_name", "validator", "default", "required"].some(function(t2) {
return d(e2, t2);
}));
};
function j(e2, t2) {
return Object.defineProperty(e2.bind(t2), "__original", { value: e2 });
}
function _(e2, t2, n2) {
var r2;
var i2 = true, o2 = "";
r2 = s(e2) ? e2 : { type: e2 };
var u2 = g(r2) ? r2._vueTypes_name + " - " : "";
if (m(r2) && null !== r2.type) {
if (void 0 === r2.type || true === r2.type) return i2;
if (!r2.required && void 0 === t2) return i2;
b(r2.type) ? (i2 = r2.type.some(function(e3) {
return true === _(e3, t2);
}), o2 = r2.type.map(function(e3) {
return l(e3);
}).join(" or ")) : i2 = "Array" === (o2 = l(r2)) ? b(t2) : "Object" === o2 ? s(t2) : "String" === o2 || "Number" === o2 || "Boolean" === o2 || "Function" === o2 ? function(e3) {
if (null == e3) return "";
var t3 = e3.constructor.toString().match(c);
return t3 ? t3[1] : "";
}(t2) === o2 : t2 instanceof r2.type;
}
if (!i2) {
var a2 = u2 + 'value "' + t2 + '" should be of type "' + o2 + '"';
return a2;
}
if (d(r2, "validator") && O(r2.validator)) {
var f2 = y, v2 = [];
if (y = function(e3) {
v2.push(e3);
}, i2 = r2.validator(t2), y = f2, !i2) {
var p = (v2.length > 1 ? "* " : "") + v2.join("\n* ");
return v2.length = 0, p;
}
}
return i2;
}
function T(e2, t2) {
var n2 = Object.defineProperties(t2, { _vueTypes_name: { value: e2, writable: true }, isRequired: { get: function() {
return this.required = true, this;
} }, def: { value: function(e3) {
return void 0 !== e3 || this.default ? O(e3) || true === _(this, e3) ? (this.default = b(e3) ? function() {
return [].concat(e3);
} : s(e3) ? function() {
return Object.assign({}, e3);
} : e3, this) : (y(this._vueTypes_name + ' - invalid default value: "' + e3 + '"'), this) : this;
} } }), r2 = n2.validator;
return O(r2) && (n2.validator = j(r2, n2)), n2;
}
function w(e2, t2) {
var n2 = T(e2, t2);
return Object.defineProperty(n2, "validate", { value: function(e3) {
return O(this.validator) && y(this._vueTypes_name + " - calling .validate() will overwrite the current custom validator function. Validator info:\n" + JSON.stringify(this)), this.validator = j(e3, this), this;
} });
}
function k(e2, t2, n2) {
var r2, o2, u2 = (r2 = t2, o2 = {}, Object.getOwnPropertyNames(r2).forEach(function(e3) {
o2[e3] = Object.getOwnPropertyDescriptor(r2, e3);
}), Object.defineProperties({}, o2));
if (u2._vueTypes_name = e2, !s(n2)) return u2;
var a2, f2, c2 = n2.validator, l2 = i(n2, ["validator"]);
if (O(c2)) {
var v2 = u2.validator;
v2 && (v2 = null !== (f2 = (a2 = v2).__original) && void 0 !== f2 ? f2 : a2), u2.validator = j(v2 ? function(e3) {
return v2.call(this, e3) && c2.call(this, e3);
} : c2, u2);
}
return Object.assign(u2, l2);
}
function P(e2) {
return e2.replace(/^(?!\s*$)/gm, " ");
}
var x = function() {
return w("any", {});
}, A = function() {
return w("function", { type: Function });
}, E = function() {
return w("boolean", { type: Boolean });
}, N = function() {
return w("string", { type: String });
}, q = function() {
return w("number", { type: Number });
}, S = function() {
return w("array", { type: Array });
}, V = function() {
return w("object", { type: Object });
}, F = function() {
return T("integer", { type: Number, validator: function(e2) {
return h(e2);
} });
}, D = function() {
return T("symbol", { validator: function(e2) {
return "symbol" == typeof e2;
} });
};
function L(e2, t2) {
if (void 0 === t2 && (t2 = "custom validation failed"), "function" != typeof e2) throw new TypeError("[VueTypes error]: You must provide a function as argument");
return T(e2.name || "<<anonymous function>>", { validator: function(n2) {
var r2 = e2(n2);
return r2 || y(this._vueTypes_name + " - " + t2), r2;
} });
}
function Y(e2) {
if (!b(e2)) throw new TypeError("[VueTypes error]: You must provide an array as argument.");
var t2 = 'oneOf - value should be one of "' + e2.join('", "') + '".', n2 = e2.reduce(function(e3, t3) {
if (null != t3) {
var n3 = t3.constructor;
-1 === e3.indexOf(n3) && e3.push(n3);
}
return e3;
}, []);
return T("oneOf", { type: n2.length > 0 ? n2 : void 0, validator: function(n3) {
var r2 = -1 !== e2.indexOf(n3);
return r2 || y(t2), r2;
} });
}
function B(e2) {
if (!b(e2)) throw new TypeError("[VueTypes error]: You must provide an array as argument");
for (var t2 = false, n2 = [], r2 = 0; r2 < e2.length; r2 += 1) {
var i2 = e2[r2];
if (m(i2)) {
if (g(i2) && "oneOf" === i2._vueTypes_name) {
n2 = n2.concat(i2.type);
continue;
}
if (O(i2.validator) && (t2 = true), true !== i2.type && i2.type) {
n2 = n2.concat(i2.type);
continue;
}
}
n2.push(i2);
}
return n2 = n2.filter(function(e3, t3) {
return n2.indexOf(e3) === t3;
}), T("oneOfType", t2 ? { type: n2, validator: function(t3) {
var n3 = [], r3 = e2.some(function(e3) {
var r4 = _(g(e3) && "oneOf" === e3._vueTypes_name ? e3.type || null : e3, t3);
return "string" == typeof r4 && n3.push(r4), true === r4;
});
return r3 || y("oneOfType - provided value does not match any of the " + n3.length + " passed-in validators:\n" + P(n3.join("\n"))), r3;
} } : { type: n2 });
}
function I(e2) {
return T("arrayOf", { type: Array, validator: function(t2) {
var n2, r2 = t2.every(function(t3) {
return true === (n2 = _(e2, t3));
});
return r2 || y("arrayOf - value validation error:\n" + P(n2)), r2;
} });
}
function J(e2) {
return T("instanceOf", { type: e2 });
}
function M(e2) {
return T("objectOf", { type: Object, validator: function(t2) {
var n2, r2 = Object.keys(t2).every(function(r3) {
return true === (n2 = _(e2, t2[r3]));
});
return r2 || y("objectOf - value validation error:\n" + P(n2)), r2;
} });
}
function R(e2) {
var t2 = Object.keys(e2), n2 = t2.filter(function(t3) {
var n3;
return !!(null === (n3 = e2[t3]) || void 0 === n3 ? void 0 : n3.required);
}), r2 = T("shape", { type: Object, validator: function(r3) {
var i2 = this;
if (!s(r3)) return false;
var o2 = Object.keys(r3);
if (n2.length > 0 && n2.some(function(e3) {
return -1 === o2.indexOf(e3);
})) {
var u2 = n2.filter(function(e3) {
return -1 === o2.indexOf(e3);
});
return y(1 === u2.length ? 'shape - required property "' + u2[0] + '" is not defined.' : 'shape - required properties "' + u2.join('", "') + '" are not defined.'), false;
}
return o2.every(function(n3) {
if (-1 === t2.indexOf(n3)) return true === i2._vueTypes_isLoose || (y('shape - shape definition does not include a "' + n3 + '" property. Allowed keys: "' + t2.join('", "') + '".'), false);
var o3 = _(e2[n3], r3[n3]);
return "string" == typeof o3 && y('shape - "' + n3 + '" property validation error:\n ' + P(o3)), true === o3;
});
} });
return Object.defineProperty(r2, "_vueTypes_isLoose", { writable: true, value: false }), Object.defineProperty(r2, "loose", { get: function() {
return this._vueTypes_isLoose = true, this;
} }), r2;
}
var $ = function() {
function e2() {
}
return e2.extend = function(e3) {
var t2 = this;
if (b(e3)) return e3.forEach(function(e4) {
return t2.extend(e4);
}), this;
var n2 = e3.name, r2 = e3.validate, o2 = void 0 !== r2 && r2, u2 = e3.getter, a2 = void 0 !== u2 && u2, f2 = i(e3, ["name", "validate", "getter"]);
if (d(this, n2)) throw new TypeError('[VueTypes error]: Type "' + n2 + '" already defined');
var c2, l2 = f2.type;
return g(l2) ? (delete f2.type, Object.defineProperty(this, n2, a2 ? { get: function() {
return k(n2, l2, f2);
} } : { value: function() {
var e4, t3 = k(n2, l2, f2);
return t3.validator && (t3.validator = (e4 = t3.validator).bind.apply(e4, [t3].concat([].slice.call(arguments)))), t3;
} })) : (c2 = a2 ? { get: function() {
var e4 = Object.assign({}, f2);
return o2 ? w(n2, e4) : T(n2, e4);
}, enumerable: true } : { value: function() {
var e4, t3, r3 = Object.assign({}, f2);
return e4 = o2 ? w(n2, r3) : T(n2, r3), r3.validator && (e4.validator = (t3 = r3.validator).bind.apply(t3, [e4].concat([].slice.call(arguments)))), e4;
}, enumerable: true }, Object.defineProperty(this, n2, c2));
}, t(e2, null, [{ key: "any", get: function() {
return x();
} }, { key: "func", get: function() {
return A().def(this.defaults.func);
} }, { key: "bool", get: function() {
return E().def(this.defaults.bool);
} }, { key: "string", get: function() {
return N().def(this.defaults.string);
} }, { key: "number", get: function() {
return q().def(this.defaults.number);
} }, { key: "array", get: function() {
return S().def(this.defaults.array);
} }, { key: "object", get: function() {
return V().def(this.defaults.object);
} }, { key: "integer", get: function() {
return F().def(this.defaults.integer);
} }, { key: "symbol", get: function() {
return D();
} }]), e2;
}();
function z(e2) {
var i2;
return void 0 === e2 && (e2 = { func: function() {
}, bool: true, string: "", number: 0, array: function() {
return [];
}, object: function() {
return {};
}, integer: 0 }), (i2 = function(i3) {
function o2() {
return i3.apply(this, arguments) || this;
}
return r(o2, i3), t(o2, null, [{ key: "sensibleDefaults", get: function() {
return n({}, this.defaults);
}, set: function(t2) {
this.defaults = false !== t2 ? n({}, true !== t2 ? t2 : e2) : {};
} }]), o2;
}($)).defaults = n({}, e2), i2;
}
$.defaults = {}, $.custom = L, $.oneOf = Y, $.instanceOf = J, $.oneOfType = B, $.arrayOf = I, $.objectOf = M, $.shape = R, $.utils = { validate: function(e2, t2) {
return true === _(t2, e2);
}, toType: function(e2, t2, n2) {
return void 0 === n2 && (n2 = false), n2 ? w(e2, t2) : T(e2, t2);
} };
(function(e2) {
function t2() {
return e2.apply(this, arguments) || this;
}
return r(t2, e2), t2;
})(z());
const PropTypes = z({
func: void 0,
bool: void 0,
string: void 0,
number: void 0,
array: void 0,
object: void 0,
integer: void 0
});
PropTypes.extend([{
name: "looseBool",
getter: true,
type: Boolean,
default: void 0
}, {
name: "style",
getter: true,
type: [String, Object],
default: void 0
}, {
name: "VueNode",
getter: true,
type: null
}]);
const isValid = (value) => {
return value !== void 0 && value !== null && value !== "";
};
const initDefaultProps = (types, defaultProps) => {
const propTypes = _extends$1({}, types);
Object.keys(defaultProps).forEach((k2) => {
const prop = propTypes[k2];
if (prop) {
if (prop.type || prop.default) {
prop.default = defaultProps[k2];
} else if (prop.def) {
prop.def(defaultProps[k2]);
} else {
propTypes[k2] = {
type: prop,
default: defaultProps[k2]
};
}
} else {
throw new Error(`not have ${k2} prop`);
}
});
return propTypes;
};
const splitAttrs = (attrs) => {
const allAttrs = Object.keys(attrs);
const eventAttrs = {};
const onEvents = {};
const extraAttrs = {};
for (let i2 = 0, l2 = allAttrs.length; i2 < l2; i2++) {
const key = allAttrs[i2];
if (isOn(key)) {
eventAttrs[key[2].toLowerCase() + key.slice(3)] = attrs[key];
onEvents[key] = attrs[key];
} else {
extraAttrs[key] = attrs[key];
}
}
return {
onEvents,
events: eventAttrs,
extraAttrs
};
};
const parseStyleText = function() {
let cssText = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
let camel = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const res = {};
const listDelimiter = /;(?![^(]*\))/g;
const propertyDelimiter = /:(.+)/;
if (typeof cssText === "object") return cssText;
cssText.split(listDelimiter).forEach(function(item) {
if (item) {
const tmp = item.split(propertyDelimiter);
if (tmp.length > 1) {
const k2 = camel ? camelize(tmp[0].trim()) : tmp[0].trim();
res[k2] = tmp[1].trim();
}
}
});
return res;
};
const hasProp = (instance, prop) => {
return instance[prop] !== void 0;
};
const skipFlattenKey = Symbol("skipFlatten");
const flattenChildren = function() {
let children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
let filterEmpty2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
const temp = Array.isArray(children) ? children : [children];
const res = [];
temp.forEach((child) => {
if (Array.isArray(child)) {
res.push(...flattenChildren(child, filterEmpty2));
} else if (child && child.type === Fragment) {
if (child.key === skipFlattenKey) {
res.push(child);
} else {
res.push(...flattenChildren(child.children, filterEmpty2));
}
} else if (child && isVNode(child)) {
if (filterEmpty2 && !isEmptyElement(child)) {
res.push(child);
} else if (!filterEmpty2) {
res.push(child);
}
} else if (isValid(child)) {
res.push(child);
}
});
return res;
};
const getSlot = function(self2) {
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default";
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
if (isVNode(self2)) {
if (self2.type === Fragment) {
return name === "default" ? flattenChildren(self2.children) : [];
} else if (self2.children && self2.children[name]) {
return flattenChildren(self2.children[name](options));
} else {
return [];
}
} else {
const res = self2.$slots[name] && self2.$slots[name](options);
return flattenChildren(res);
}
};
const findDOMNode = (instance) => {
var _a;
let node2 = ((_a = instance === null || instance === void 0 ? void 0 : instance.vnode) === null || _a === void 0 ? void 0 : _a.el) || instance && (instance.$el || instance);
while (node2 && !node2.tagName) {
node2 = node2.nextSibling;
}
return node2;
};
const getOptionProps = (instance) => {
const res = {};
if (instance.$ && instance.$.vnode) {
const props2 = instance.$.vnode.props || {};
Object.keys(instance.$props).forEach((k2) => {
const v2 = instance.$props[k2];
const hyphenateKey = hyphenate(k2);
if (v2 !== void 0 || hyphenateKey in props2) {
res[k2] = v2;
}
});
} else if (isVNode(instance) && typeof instance.type === "object") {
const originProps = instance.props || {};
const props2 = {};
Object.keys(originProps).forEach((key) => {
props2[camelize(key)] = originProps[key];
});
const options = instance.type.props || {};
Object.keys(options).forEach((k2) => {
const v2 = resolvePropValue(options, props2, k2, props2[k2]);
if (v2 !== void 0 || k2 in props2) {
res[k2] = v2;
}
});
}
return res;
};
const getComponent = function(instance) {
let prop = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default";
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : instance;
let execute = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
let com = void 0;
if (instance.$) {
const temp = instance[prop];
if (temp !== void 0) {
return typeof temp === "function" && execute ? temp(options) : temp;
} else {
com = instance.$slots[prop];
com = execute && com ? com(options) : com;
}
} else if (isVNode(instance)) {
const temp = instance.props && instance.props[prop];
if (temp !== void 0 && instance.props !== null) {
return typeof temp === "function" && execute ? temp(options) : temp;
} else if (instance.type === Fragment) {
com = instance.children;
} else if (instance.children && instance.children[prop]) {
com = instance.children[prop];
com = execute && com ? com(options) : com;
}
}
if (Array.isArray(com)) {
com = flattenChildren(com);
com = com.length === 1 ? com[0] : com;
com = com.length === 0 ? void 0 : com;
}
return com;
};
function getEvents() {
let ele = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
let on = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
let props2 = {};
if (ele.$) {
props2 = _extends$1(_extends$1({}, props2), ele.$attrs);
} else {
props2 = _extends$1(_extends$1({}, props2), ele.props);
}
return splitAttrs(props2)[on ? "onEvents" : "events"];
}
function getStyle$1(ele, camel) {
const props2 = (isVNode(ele) ? ele.props : ele.$attrs) || {};
let style = props2.style || {};
if (typeof style === "string") {
style = parseStyleText(style, camel);
}
return style;
}
function isFragment(c2) {
return c2.length === 1 && c2[0].type === Fragment;
}
function isEmptyElement(c2) {
return c2 && (c2.type === Comment || c2.type === Fragment && c2.children.length === 0 || c2.type === Text && c2.children.trim() === "");
}
function isStringElement(c2) {
return c2 && c2.type === Text;
}
function filterEmpty() {
let children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
const res = [];
children.forEach((child) => {
if (Array.isArray(child)) {
res.push(...child);
} else if ((child === null || child === void 0 ? void 0 : child.type) === Fragment) {
res.push(...filterEmpty(child.children));
} else {
res.push(child);
}
});
return res.filter((c2) => !isEmptyElement(c2));
}
function isValidElement(element) {
if (Array.isArray(element) && element.length === 1) {
element = element[0];
}
return element && element.__v_isVNode && typeof element.type !== "symbol";
}
function getPropsSlot(slots, props2) {
let prop = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "default";
var _a, _b;
return (_a = props2[prop]) !== null && _a !== void 0 ? _a : (_b = slots[prop]) === null || _b === void 0 ? void 0 : _b.call(slots);
}
function murmur2(str) {
var h2 = 0;
var k2, i2 = 0, len = str.length;
for (; len >= 4; ++i2, len -= 4) {
k2 = str.charCodeAt(i2) & 255 | (str.charCodeAt(++i2) & 255) << 8 | (str.charCodeAt(++i2) & 255) << 16 | (str.charCodeAt(++i2) & 255) << 24;
k2 = /* Math.imul(k, m): */
(k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16);
k2 ^= /* k >>> r: */
k2 >>> 24;
h2 = /* Math.imul(k, m): */
(k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
(h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16);
}
switch (len) {
case 3:
h2 ^= (str.charCodeAt(i2 + 2) & 255) << 16;
case 2:
h2 ^= (str.charCodeAt(i2 + 1) & 255) << 8;
case 1:
h2 ^= str.charCodeAt(i2) & 255;
h2 = /* Math.imul(h, m): */
(h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16);
}
h2 ^= h2 >>> 13;
h2 = /* Math.imul(h, m): */
(h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16);
return ((h2 ^ h2 >>> 15) >>> 0).toString(36);
}
const SPLIT = "%";
class Entity {
constructor(instanceId) {
this.cache = /* @__PURE__ */ new Map();
this.instanceId = instanceId;
}
get(keys2) {
return this.cache.get(Array.isArray(keys2) ? keys2.join(SPLIT) : keys2) || null;
}
update(keys2, valueFn) {
const path2 = Array.isArray(keys2) ? keys2.join(SPLIT) : keys2;
const prevValue = this.cache.get(path2);
const nextValue = valueFn(prevValue);
if (nextValue === null) {
this.cache.delete(path2);
} else {
this.cache.set(path2, nextValue);
}
}
}
const tuple$1 = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args;
};
const withInstall$1 = (comp) => {
const c2 = comp;
c2.install = function(app) {
app.component(c2.displayName || c2.name, comp);
};
return comp;
};
function eventType$1() {
return {
type: [Function, Array]
};
}
function objectType$1(defaultVal) {
return {
type: Object,
default: defaultVal
};
}
function booleanType$1(defaultVal) {
return {
type: Boolean,
default: defaultVal
};
}
function functionType$1(defaultVal) {
return {
type: Function,
default: defaultVal
};
}
function anyType$1(defaultVal, required) {
const type2 = {
validator: () => true,
default: defaultVal
};
return required ? type2 : type2;
}
function vNodeType$1() {
return {
validator: () => true
};
}
function arrayType$1(defaultVal) {
return {
type: Array,
default: defaultVal
};
}
function stringType$1(defaultVal) {
return {
type: String,
default: defaultVal
};
}
function someType$1(types, defaultVal) {
return types ? {
type: types,
default: defaultVal
} : anyType$1(defaultVal);
}
const ATTR_TOKEN = "data-token-hash";
const ATTR_MARK = "data-css-hash";
const ATTR_CACHE_PATH = "data-cache-path";
const CSS_IN_JS_INSTANCE = "__cssinjs_instance__";
function createCache() {
const cssinjsInstanceId = Math.random().toString(12).slice(2);
if (typeof document !== "undefined" && document.head && document.body) {
const styles = document.body.querySelectorAll(`style[${ATTR_MARK}]`) || [];
const {
firstChild
} = document.head;
Array.from(styles).forEach((style) => {
style[CSS_IN_JS_INSTANCE] = style[CSS_IN_JS_INSTANCE] || cssinjsInstanceId;
if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
document.head.insertBefore(style, firstChild);
}
});
const styleHash = {};
Array.from(document.querySelectorAll(`style[${ATTR_MARK}]`)).forEach((style) => {
var _a;
const hash = style.getAttribute(ATTR_MARK);
if (styleHash[hash]) {
if (style[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
(_a = style.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(style);
}
} else {
styleHash[hash] = true;
}
});
}
return new Entity(cssinjsInstanceId);
}
const StyleContextKey = Symbol("StyleContextKey");
const getCache = () => {
var _a, _b, _c;
const instance = getCurrentInstance();
let cache;
if (instance && instance.appContext) {
const globalCache = (_c = (_b = (_a = instance.appContext) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.globalProperties) === null || _c === void 0 ? void 0 : _c.__ANTDV_CSSINJS_CACHE__;
if (globalCache) {
cache = globalCache;
} else {
cache = createCache();
if (instance.appContext.config.globalProperties) {
instance.appContext.config.globalProperties.__ANTDV_CSSINJS_CACHE__ = cache;
}
}
} else {
cache = createCache();
}
return cache;
};
const defaultStyleContext = {
cache: createCache(),
defaultCache: true,
hashPriority: "low"
};
const useStyleInject = () => {
const cache = getCache();
return inject(StyleContextKey, shallowRef(_extends$1(_extends$1({}, defaultStyleContext), {
cache
})));
};
const useStyleProvider = (props2) => {
const parentContext = useStyleInject();
const context2 = shallowRef(_extends$1(_extends$1({}, defaultStyleContext), {
cache: createCache()
}));
watch([() => unref(props2), parentContext], () => {
const mergedContext = _extends$1({}, parentContext.value);
const propsValue = unref(props2);
Object.keys(propsValue).forEach((key) => {
const value = propsValue[key];
if (propsValue[key] !== void 0) {
mergedContext[key] = value;
}
});
const {
cache
} = propsValue;
mergedContext.cache = mergedContext.cache || createCache();
mergedContext.defaultCache = !cache && parentContext.value.defaultCache;
context2.value = mergedContext;
}, {
immediate: true
});
provide(StyleContextKey, context2);
return context2;
};
const styleProviderProps = () => ({
autoClear: booleanType$1(),
/** @private Test only. Not work in production. */
mock: stringType$1(),
/**
* Only set when you need ssr to extract style on you own.
* If not provided, it will auto create <style /> on the end of Provider in server side.
*/
cache: objectType$1(),
/** Tell children that this context is default generated context */
defaultCache: booleanType$1(),
/** Use `:where` selector to reduce hashId css selector priority */
hashPriority: stringType$1(),
/** Tell cssinjs where to inject style in */
container: someType$1(),
/** Component wil render inline `<style />` for fallback in SSR. Not recommend. */
ssrInline: booleanType$1(),
/** Transform css before inject in document. Please note that `transformers` do not support dynamic update */
transformers: arrayType$1(),
/**
* Linters to lint css before inject in document.
* Styles will be linted after transforming.
* Please note that `linters` do not support dynamic update.
*/
linters: arrayType$1()
});
withInstall$1(defineComponent({
name: "AStyleProvider",
inheritAttrs: false,
props: styleProviderProps(),
setup(props2, _ref) {
let {
slots
} = _ref;
useStyleProvider(props2);
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
}));
function useProdHMR() {
return false;
}
let webpackHMR = false;
function useDevHMR() {
return webpackHMR;
}
const useHMR = process.env.NODE_ENV === "production" ? useProdHMR : useDevHMR;
if (process.env.NODE_ENV !== "production" && typeof module !== "undefined" && module && module.hot && typeof window !== "undefined") {
const win = window;
if (typeof win.webpackHotUpdate === "function") {
const originWebpackHotUpdate = win.webpackHotUpdate;
win.webpackHotUpdate = function() {
webpackHMR = true;
setTimeout(() => {
webpackHMR = false;
}, 0);
return originWebpackHotUpdate(...arguments);
};
}
}
function useClientCache(prefix, keyPath, cacheFn, onCacheRemove) {
const styleContext = useStyleInject();
const fullPathStr = shallowRef("");
const res = shallowRef();
watchEffect(() => {
fullPathStr.value = [prefix, ...keyPath.value].join("%");
});
const HMRUpdate = useHMR();
const clearCache = (pathStr) => {
styleContext.value.cache.update(pathStr, (prevCache) => {
const [times = 0, cache] = prevCache || [];
const nextCount = times - 1;
if (nextCount === 0) {
onCacheRemove === null || onCacheRemove === void 0 ? void 0 : onCacheRemove(cache, false);
return null;
}
return [times - 1, cache];
});
};
watch(fullPathStr, (newStr, oldStr) => {
if (oldStr) clearCache(oldStr);
styleContext.value.cache.update(newStr, (prevCache) => {
const [times = 0, cache] = prevCache || [];
let tmpCache = cache;
if (process.env.NODE_ENV !== "production" && cache && HMRUpdate) {
onCacheRemove === null || onCacheRemove === void 0 ? void 0 : onCacheRemove(tmpCache, HMRUpdate);
tmpCache = null;
}
const mergedCache = tmpCache || cacheFn();
return [times + 1, mergedCache];
});
res.value = styleContext.value.cache.get(fullPathStr.value)[1];
}, {
immediate: true
});
onBeforeUnmount(() => {
clearCache(fullPathStr.value);
});
return res;
}
function canUseDom$1() {
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
}
function contains$1(root2, n2) {
if (!root2) {
return false;
}
if (root2.contains) {
return root2.contains(n2);
}
return false;
}
const APPEND_ORDER$1 = "data-vc-order";
const MARK_KEY$1 = `vc-util-key`;
const containerCache$1 = /* @__PURE__ */ new Map();
function getMark$1() {
let {
mark
} = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
if (mark) {
return mark.startsWith("data-") ? mark : `data-${mark}`;
}
return MARK_KEY$1;
}
function getContainer$1(option) {
if (option.attachTo) {
return option.attachTo;
}
const head = document.querySelector("head");
return head || document.body;
}
function getOrder$1(prepend) {
if (prepend === "queue") {
return "prependQueue";
}
return prepend ? "prepend" : "append";
}
function findStyles$1(container) {
return Array.from((containerCache$1.get(container) || container).children).filter((node2) => node2.tagName === "STYLE");
}
function injectCSS$1(css2) {
let option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (!canUseDom$1()) {
return null;
}
const {
csp,
prepend
} = option;
const styleNode = document.createElement("style");
styleNode.setAttribute(APPEND_ORDER$1, getOrder$1(prepend));
if (csp === null || csp === void 0 ? void 0 : csp.nonce) {
styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
}
styleNode.innerHTML = css2;
const container = getContainer$1(option);
const {
firstChild
} = container;
if (prepend) {
if (prepend === "queue") {
const existStyle = findStyles$1(container).filter((node2) => ["prepend", "prependQueue"].includes(node2.getAttribute(APPEND_ORDER$1)));
if (existStyle.length) {
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
return styleNode;
}
}
container.insertBefore(styleNode, firstChild);
} else {
container.appendChild(styleNode);
}
return styleNode;
}
function findExistNode$1(key) {
let option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const container = getContainer$1(option);
return findStyles$1(container).find((node2) => node2.getAttribute(getMark$1(option)) === key);
}
function removeCSS(key) {
let option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const existNode = findExistNode$1(key, option);
if (existNode) {
const container = getContainer$1(option);
container.removeChild(existNode);
}
}
function syncRealContainer$1(container, option) {
const cachedRealContainer = containerCache$1.get(container);
if (!cachedRealContainer || !contains$1(document, cachedRealContainer)) {
const placeholderStyle = injectCSS$1("", option);
const {
parentNode
} = placeholderStyle;
containerCache$1.set(container, parentNode);
container.removeChild(placeholderStyle);
}
}
function updateCSS$1(css2, key) {
let option = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
var _a, _b, _c;
const container = getContainer$1(option);
syncRealContainer$1(container, option);
const existNode = findExistNode$1(key, option);
if (existNode) {
if (((_a = option.csp) === null || _a === void 0 ? void 0 : _a.nonce) && existNode.nonce !== ((_b = option.csp) === null || _b === void 0 ? void 0 : _b.nonce)) {
existNode.nonce = (_c = option.csp) === null || _c === void 0 ? void 0 : _c.nonce;
}
if (existNode.innerHTML !== css2) {
existNode.innerHTML = css2;
}
return existNode;
}
const newNode = injectCSS$1(css2, option);
newNode.setAttribute(getMark$1(option), key);
return newNode;
}
function sameDerivativeOption(left, right) {
if (left.length !== right.length) {
return false;
}
for (let i2 = 0; i2 < left.length; i2++) {
if (left[i2] !== right[i2]) {
return false;
}
}
return true;
}
class ThemeCache {
constructor() {
this.cache = /* @__PURE__ */ new Map();
this.keys = [];
this.cacheCallTimes = 0;
}
size() {
return this.keys.length;
}
internalGet(derivativeOption) {
let updateCallTimes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
let cache = {
map: this.cache
};
derivativeOption.forEach((derivative2) => {
var _a;
if (!cache) {
cache = void 0;
} else {
cache = (_a = cache === null || cache === void 0 ? void 0 : cache.map) === null || _a === void 0 ? void 0 : _a.get(derivative2);
}
});
if ((cache === null || cache === void 0 ? void 0 : cache.value) && updateCallTimes) {
cache.value[1] = this.cacheCallTimes++;
}
return cache === null || cache === void 0 ? void 0 : cache.value;
}
get(derivativeOption) {
var _a;
return (_a = this.internalGet(derivativeOption, true)) === null || _a === void 0 ? void 0 : _a[0];
}
has(derivativeOption) {
return !!this.internalGet(derivativeOption);
}
set(derivativeOption, value) {
if (!this.has(derivativeOption)) {
if (this.size() + 1 > ThemeCache.MAX_CACHE_SIZE + ThemeCache.MAX_CACHE_OFFSET) {
const [targetKey] = this.keys.reduce((result, key) => {
const [, callTimes] = result;
if (this.internalGet(key)[1] < callTimes) {
return [key, this.internalGet(key)[1]];
}
return result;
}, [this.keys[0], this.cacheCallTimes]);
this.delete(targetKey);
}
this.keys.push(derivativeOption);
}
let cache = this.cache;
derivativeOption.forEach((derivative2, index2) => {
if (index2 === derivativeOption.length - 1) {
cache.set(derivative2, {
value: [value, this.cacheCallTimes++]
});
} else {
const cacheValue = cache.get(derivative2);
if (!cacheValue) {
cache.set(derivative2, {
map: /* @__PURE__ */ new Map()
});
} else if (!cacheValue.map) {
cacheValue.map = /* @__PURE__ */ new Map();
}
cache = cache.get(derivative2).map;
}
});
}
deleteByPath(currentCache, derivatives) {
var _a;
const cache = currentCache.get(derivatives[0]);
if (derivatives.length === 1) {
if (!cache.map) {
currentCache.delete(derivatives[0]);
} else {
currentCache.set(derivatives[0], {
map: cache.map
});
}
return (_a = cache.value) === null || _a === void 0 ? void 0 : _a[0];
}
const result = this.deleteByPath(cache.map, derivatives.slice(1));
if ((!cache.map || cache.map.size === 0) && !cache.value) {
currentCache.delete(derivatives[0]);
}
return result;
}
delete(derivativeOption) {
if (this.has(derivativeOption)) {
this.keys = this.keys.filter((item) => !sameDerivativeOption(item, derivativeOption));
return this.deleteByPath(this.cache, derivativeOption);
}
return void 0;
}
}
ThemeCache.MAX_CACHE_SIZE = 20;
ThemeCache.MAX_CACHE_OFFSET = 5;
let warned = {};
function warning$2(valid, message) {
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
console.error(`Warning: ${message}`);
}
}
function note(valid, message) {
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
console.warn(`Note: ${message}`);
}
}
function resetWarned() {
warned = {};
}
function call(method, valid, message) {
if (!valid && !warned[message]) {
method(false, message);
warned[message] = true;
}
}
function warningOnce(valid, message) {
call(warning$2, valid, message);
}
function noteOnce(valid, message) {
call(note, valid, message);
}
function noop$4() {
}
let warning$1 = noop$4;
if (process.env.NODE_ENV !== "production") {
warning$1 = (valid, component, message) => {
warningOnce(valid, `[ant-design-vue: ${component}] ${message}`);
if (process.env.NODE_ENV === "test") {
resetWarned();
}
};
}
let uuid$2 = 0;
class Theme {
constructor(derivatives) {
this.derivatives = Array.isArray(derivatives) ? derivatives : [derivatives];
this.id = uuid$2;
if (derivatives.length === 0) {
warning$1(derivatives.length > 0, "[Ant Design Vue CSS-in-JS] Theme should have at least one derivative function.");
}
uuid$2 += 1;
}
getDerivativeToken(token2) {
return this.derivatives.reduce((result, derivative2) => derivative2(token2, result), void 0);
}
}
const cacheThemes = new ThemeCache();
function createTheme(derivatives) {
const derivativeArr = Array.isArray(derivatives) ? derivatives : [derivatives];
if (!cacheThemes.has(derivativeArr)) {
cacheThemes.set(derivativeArr, new Theme(derivativeArr));
}
return cacheThemes.get(derivativeArr);
}
const flattenTokenCache = /* @__PURE__ */ new WeakMap();
function flattenToken(token2) {
let str = flattenTokenCache.get(token2) || "";
if (!str) {
Object.keys(token2).forEach((key) => {
const value = token2[key];
str += key;
if (value instanceof Theme) {
str += value.id;
} else if (value && typeof value === "object") {
str += flattenToken(value);
} else {
str += value;
}
});
flattenTokenCache.set(token2, str);
}
return str;
}
function token2key(token2, salt) {
return murmur2(`${salt}_${flattenToken(token2)}`);
}
const randomSelectorKey = `random-${Date.now()}-${Math.random()}`.replace(/\./g, "");
const checkContent = "_bAmBoO_";
function supportSelector(styleStr, handleElement, supportCheck) {
var _a, _b;
if (canUseDom$1()) {
updateCSS$1(styleStr, randomSelectorKey);
const ele = document.createElement("div");
ele.style.position = "fixed";
ele.style.left = "0";
ele.style.top = "0";
handleElement === null || handleElement === void 0 ? void 0 : handleElement(ele);
document.body.appendChild(ele);
if (process.env.NODE_ENV !== "production") {
ele.innerHTML = "Test";
ele.style.zIndex = "9999999";
}
const support = supportCheck ? supportCheck(ele) : (_a = getComputedStyle(ele).content) === null || _a === void 0 ? void 0 : _a.includes(checkContent);
(_b = ele.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(ele);
removeCSS(randomSelectorKey);
return support;
}
return false;
}
let canLayer = void 0;
function supportLayer() {
if (canLayer === void 0) {
canLayer = supportSelector(`@layer ${randomSelectorKey} { .${randomSelectorKey} { content: "${checkContent}"!important; } }`, (ele) => {
ele.className = randomSelectorKey;
});
}
return canLayer;
}
const EMPTY_OVERRIDE = {};
const isProduction = process.env.NODE_ENV === "production";
const isPrerender = process.env.NODE_ENV === "prerender";
const hashPrefix = !isProduction && !isPrerender ? "css-dev-only-do-not-override" : "css";
const tokenKeys = /* @__PURE__ */ new Map();
function recordCleanToken(tokenKey) {
tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) + 1);
}
function removeStyleTags(key, instanceId) {
if (typeof document !== "undefined") {
const styles = document.querySelectorAll(`style[${ATTR_TOKEN}="${key}"]`);
styles.forEach((style) => {
var _a;
if (style[CSS_IN_JS_INSTANCE] === instanceId) {
(_a = style.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(style);
}
});
}
}
const TOKEN_THRESHOLD = 0;
function cleanTokenStyle(tokenKey, instanceId) {
tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) - 1);
const tokenKeyList = Array.from(tokenKeys.keys());
const cleanableKeyList = tokenKeyList.filter((key) => {
const count = tokenKeys.get(key) || 0;
return count <= 0;
});
if (tokenKeyList.length - cleanableKeyList.length > TOKEN_THRESHOLD) {
cleanableKeyList.forEach((key) => {
removeStyleTags(key, instanceId);
tokenKeys.delete(key);
});
}
}
const getComputedToken = (originToken, overrideToken, theme, format) => {
const derivativeToken = theme.getDerivativeToken(originToken);
let mergedDerivativeToken = _extends$1(_extends$1({}, derivativeToken), overrideToken);
if (format) {
mergedDerivativeToken = format(mergedDerivativeToken);
}
return mergedDerivativeToken;
};
function useCacheToken(theme, tokens) {
let option = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ref({});
const style = useStyleInject();
const mergedToken = computed(() => _extends$1({}, ...tokens.value));
const tokenStr = computed(() => flattenToken(mergedToken.value));
const overrideTokenStr = computed(() => flattenToken(option.value.override || EMPTY_OVERRIDE));